synology_apm.sdk.collections.gws_auto_backup_rule module¶
GWSAutoBackupRuleCollection — manage GWS auto-backup rules.
- class synology_apm.sdk.collections.gws_auto_backup_rule.GWSAutoBackupRuleCollection(session)¶
Bases:
objectCollection interface for managing GWS auto-backup rules.
Accessed via APMClient.gws.auto_backup_rules; should not be instantiated directly.
Auto-backup rules have two independently-managed sections:
User Services (CRUD on per-plan rules): Mail / Calendar / Contact / Drive workloads are added automatically when their Google Group membership changes, bound per service type.
Collaboration Services (single settings object per domain): Shared Drives — all shared drives are included automatically when enabled.
Plus a domain-wide setting controlling whether unlicensed/archived Google Workspace accounts are included in auto-backup (see update_protected_account_types()).
- async list(domain)¶
Return all auto-backup rules and collaboration service settings for a domain.
- Parameters:
domain (str) – Google Workspace domain.
- Returns:
GWSAutoBackupRuleListResult containing user-service rules, the Shared Drive collaboration service setting, and the domain’s protected-account-type setting. Rules pending deletion are excluded.
- Raises:
ResourceNotFoundError – The specified domain was not found.
- Return type:
- async create(domain, namespace, plan_id, mail_group_ids=None, calendar_group_ids=None, contact_group_ids=None, drive_group_ids=None)¶
Create a new User Services auto-backup rule for a GWS domain.
A single rule associates one protection plan and one backup server with a set of Google Groups for Mail, Calendar, Contact, and/or Drive service types.
- Parameters:
domain (str) – Google Workspace domain.
namespace (str) – Backup server namespace (= BackupServer.namespace).
plan_id (str) – Protection plan ID to apply (= ProtectionPlan.plan_id).
mail_group_ids (Sequence[str] | None) – Google Group IDs whose Mail members are auto-protected.
calendar_group_ids (Sequence[str] | None) – Google Group IDs whose Calendar members are auto-protected.
contact_group_ids (Sequence[str] | None) – Google Group IDs whose Contact members are auto-protected.
drive_group_ids (Sequence[str] | None) – Google Group IDs whose Drive members are auto-protected.
- async update(rule, plan_id=None, mail_group_ids=None, calendar_group_ids=None, contact_group_ids=None, drive_group_ids=None)¶
Update an existing User Services auto-backup rule.
Only the supplied fields are changed; omit a parameter to keep its current value.
- Parameters:
rule (GWSAutoBackupRule) – Existing rule to update (obtained via list()).
plan_id (str | None) – Replacement protection plan ID, or None to keep current.
mail_group_ids (Sequence[str] | None) – Replacement Mail group IDs, or None to keep current.
calendar_group_ids (Sequence[str] | None) – Replacement Calendar group IDs, or None to keep current.
contact_group_ids (Sequence[str] | None) – Replacement Contact group IDs, or None to keep current.
drive_group_ids (Sequence[str] | None) – Replacement Drive group IDs, or None to keep current.
- async delete(rule)¶
Delete a User Services auto-backup rule.
- Parameters:
rule (GWSAutoBackupRule) – Rule to delete (obtained via list()).
- async update_collab_settings(domain, shared_drive=None)¶
Replace the Collaboration Services auto-backup setting for a GWS domain.
GWS has a single Collaboration Service: Shared Drives. Pass the current GWSSharedDriveSetting from list() to preserve it unmodified, or None to disable it.
- Parameters:
domain (str) – Google Workspace domain.
shared_drive (GWSSharedDriveSetting | None) – Setting for Shared Drives; None = disabled.
- async update_protected_account_types(domain, *, include_unlicensed_accounts, include_archived_accounts)¶
Update which additional Google Workspace account types are auto-protected for a domain.
Google Workspace accounts with licenses are always auto-protected; this setting controls whether unlicensed and/or archived accounts are also included. This is a domain-wide setting (not per-rule) — only these two fields change; other domain configuration is preserved.
- Parameters:
- Raises:
ResourceNotFoundError – The specified domain was not found.