synology_apm.sdk.models.protection_plan module¶
ProtectionPlan and all associated policy, config, task, and request models.
- class synology_apm.sdk.models.protection_plan.ProtectionSchedule(frequency, start_time, weekdays=())¶
Bases:
objectBackup schedule configuration.
- Variables:
frequency (synology_apm.sdk.enums.ScheduleFrequency) – Schedule frequency (MANUAL / HOURLY / DAILY / WEEKLY / AFTER_BACKUP).
start_time (datetime.time | None) – Execution time. None for MANUAL / AFTER_BACKUP; time(0, run_minute) for HOURLY (only minute is meaningful — runs at that minute of every hour); full HH:MM for DAILY / WEEKLY.
weekdays (tuple[synology_apm.sdk.enums.WeekDay, ...]) – Days of the week to run (only meaningful for WEEKLY; at least one weekday is required for WEEKLY; always empty for other frequencies).
- frequency: ScheduleFrequency¶
- class synology_apm.sdk.models.protection_plan.GFSRetention(daily_versions, weekly_versions, monthly_versions, yearly_versions)¶
Bases:
objectGFS (Grandfather-Father-Son) rotation retention policy details.
- class synology_apm.sdk.models.protection_plan.ProtectionRetentionPolicy(retention_type, days=None, versions=None, gfs=None)¶
Bases:
objectVersion retention policy for a Protection Plan.
- retention_type: RetentionType¶
- gfs: GFSRetention | None = None¶
- class synology_apm.sdk.models.protection_plan.ProtectionPlanPolicy(retention, schedule)¶
Bases:
objectCombined schedule and retention policy for a backup or Backup Copy.
- Variables:
retention (synology_apm.sdk.models.protection_plan.ProtectionRetentionPolicy) – Version retention policy.
schedule (synology_apm.sdk.models.protection_plan.ProtectionSchedule | None) – Schedule settings; None for list() results.
- retention: ProtectionRetentionPolicy¶
- schedule: ProtectionSchedule | None¶
- class synology_apm.sdk.models.protection_plan.PlanBackupCopyStatus(status, reason, pending_version_count=0, remaining_bytes=None, skipped_workload_count=0)¶
Bases:
objectBackup copy status summary for a Protection Plan.
- Variables:
status (synology_apm.sdk.enums.VersionCopyStatus) – Overall backup copy status for this plan; parallels WorkloadVersion.copy_status.
reason (synology_apm.sdk.enums.CopyReason | None) – Detail reason when status is SKIPPED, RETRY, or FAILED; NO_VERSIONS_TO_COPY when the plan has no versions eligible for copy; None otherwise.
pending_version_count (int) – Number of versions waiting to be copied (meaningful when WAITING, IN_PROGRESS, RETRY, or FAILED).
remaining_bytes (int | None) – Estimated bytes remaining for the pending copy; None when unavailable.
skipped_workload_count (int) – Number of workloads skipped in the last copy run (meaningful when SKIPPED).
- status: VersionCopyStatus¶
- reason: CopyReason | None¶
- class synology_apm.sdk.models.protection_plan.BackupCopyPolicy(destination, retention, schedule)¶
Bases:
objectBackup Copy configuration as read from a Protection Plan (read-only).
To modify Backup Copy settings, use BackupCopyConfig in create()/update() requests. To look up the full destination object for a new request, resolve destination.identifier via apm.backup_servers or apm.remote_storages.
- Variables:
destination (synology_apm.sdk.models.location.LocationInfo) – Backup Copy destination location.
retention (synology_apm.sdk.models.protection_plan.ProtectionRetentionPolicy) – Retention policy applied to copied versions.
schedule (synology_apm.sdk.models.protection_plan.ProtectionSchedule) – Copy trigger — AFTER_BACKUP or a fixed daily/weekly time.
- destination: LocationInfo¶
- retention: ProtectionRetentionPolicy¶
- schedule: ProtectionSchedule¶
- class synology_apm.sdk.models.protection_plan.BackupCopyConfig(destination, retention, schedule)¶
Bases:
objectBackup Copy configuration for create()/update() requests.
- Variables:
destination (synology_apm.sdk.models.backup_server.BackupServer | synology_apm.sdk.models.remote_storage.RemoteStorage) – Backup Copy destination: a BackupServer (ActiveProtect appliance) or RemoteStorage. Determines the storage endpoint type used for copy.
retention (synology_apm.sdk.models.protection_plan.ProtectionRetentionPolicy) – Retention policy applied to copied versions.
schedule (synology_apm.sdk.models.protection_plan.ProtectionSchedule) – Copy trigger: AFTER_BACKUP runs after each backup; DAILY/WEEKLY runs at the specified time.
- destination: BackupServer | RemoteStorage¶
- retention: ProtectionRetentionPolicy¶
- schedule: ProtectionSchedule¶
- class synology_apm.sdk.models.protection_plan.MachineVmConfig(enable_app_aware_bkp=True, enable_verification=False, verification_video_duration_seconds=120, enable_datastore_usage_detection=False, datastore_min_free_space_percent=10)¶
Bases:
objectVM workload advanced settings.
- Variables:
enable_app_aware_bkp (bool) – Application-consistent backup (quiesces VSS/VMware Tools).
enable_verification (bool) – Run backup verification after each backup.
verification_video_duration_seconds (int) – Length of the verification recording in seconds.
enable_datastore_usage_detection (bool) – Monitor datastore usage during backup.
datastore_min_free_space_percent (int) – Minimum free space (%) the datastore must maintain.
- class synology_apm.sdk.models.protection_plan.MachinePcConfig(shutdown_after_backup=False, wake_for_backup=False, prevent_sleep_during_backup=False)¶
Bases:
objectPC workload advanced settings (Windows and macOS).
- Variables:
- class synology_apm.sdk.models.protection_plan.MachinePsConfig(enable_app_aware_bkp=True, enable_verification=False, verification_video_duration_seconds=120, shutdown_after_backup=False, wake_for_backup=False, prevent_sleep_during_backup=False)¶
Bases:
objectPhysical server workload advanced settings.
- Variables:
enable_app_aware_bkp (bool) – Application-consistent backup (quiesces VSS).
enable_verification (bool) – Run backup verification after each backup.
verification_video_duration_seconds (int) – Length of the verification recording in seconds.
shutdown_after_backup (bool) – Shut down the server after backup completes.
wake_for_backup (bool) – Wake the server from sleep before backup starts.
prevent_sleep_during_backup (bool) – Prevent the server from entering sleep during backup (Windows only).
- class synology_apm.sdk.models.protection_plan.MachineDbConfig(action_on_error=DbActionOnError.CONTINUE, mssql_log_setting=MssqlLogSetting.DO_NOT_TRUNCATE, oracle_log_setting=OracleLogSetting.DO_NOT_DELETE)¶
Bases:
objectDatabase processing configuration (applies when DB backup is enabled).
- Variables:
action_on_error (synology_apm.sdk.enums.DbActionOnError) – Action when a database processing error occurs during backup.
mssql_log_setting (synology_apm.sdk.enums.MssqlLogSetting) – Transaction log handling for Microsoft SQL Server databases.
oracle_log_setting (synology_apm.sdk.enums.OracleLogSetting) – Archived log handling for Oracle databases.
- action_on_error: DbActionOnError = 'continue'¶
- mssql_log_setting: MssqlLogSetting = 'do_not_truncate'¶
- oracle_log_setting: OracleLogSetting = 'do_not_delete'¶
- class synology_apm.sdk.models.protection_plan.MachineBackupWindow(enabled, allowed_hours=<factory>)¶
Bases:
objectAllowed time slots for backup execution.
- Variables:
enabled (bool) – Whether the backup window restriction is active. When False, backup can run at any time.
allowed_hours (dict[synology_apm.sdk.enums.WeekDay, frozenset[int]]) – Weekday → set of allowed hours (0–23). Absent weekdays are fully blocked. Empty dict with enabled=True blocks all backup. Ignored when enabled is False.
- class synology_apm.sdk.models.protection_plan.EventTriggerConfig(on_sign_out=False, on_lock=False, on_startup=False, min_interval=<factory>)¶
Bases:
objectEvent-triggered backup settings for PC/Mac tasks.
- Variables:
on_sign_out (bool) – Back up when the user signs out.
on_lock (bool) – Back up when the screen locks.
on_startup (bool) – Back up on system startup.
min_interval (datetime.timedelta) – Minimum time between consecutive event-triggered backups. Sub-minute precision is not supported; values are rounded down to the nearest minute.
- Raises:
ValueError – At least one of on_sign_out, on_lock, on_startup must be True.
ValueError – min_interval must be a positive duration.
- class synology_apm.sdk.models.protection_plan.MachineTaskSchedule(time_schedule=None, event_trigger=None)¶
Bases:
objectPer-task backup schedule for an individual task entry in a DEVICE plan.
- Variables:
time_schedule (synology_apm.sdk.models.protection_plan.ProtectionSchedule | None) – Time-based schedule component; None when there is no time-based schedule (event-triggered-only or on-demand backup).
event_trigger (synology_apm.sdk.models.protection_plan.EventTriggerConfig | None) – Event-triggered backup settings; None when event-triggered backup is disabled. Only applicable to PC (Windows and Mac) tasks.
- time_schedule: ProtectionSchedule | None = None¶
- event_trigger: EventTriggerConfig | None = None¶
- class synology_apm.sdk.models.protection_plan.MachineTaskConfig(workload_type, os_type, scope=None, custom_volumes=(), include_external_drives=False, include_boot_partition=True, use_main_schedule=True, schedule=None)¶
Bases:
objectOne backup scope/schedule entry in a DEVICE plan’s task array.
A plan always contains at least 6 entries — one for each mandatory (workload_type, os_type) pair. PC and PS pairs may have additional entries to back up different scopes independently. VM and FS are always exactly one entry each and do not support scope customization.
- Variables:
workload_type (synology_apm.sdk.enums.MachineWorkloadType) – PC, PS, VM, or FS.
os_type (synology_apm.sdk.enums.MachineOsType) – OS for this entry. Must match the workload type: PC → WINDOWS or MAC; PS → WINDOWS or LINUX; VM/FS → NONE.
scope (synology_apm.sdk.enums.MachineTaskScope | None) – Backup scope; not applicable for VM and FS workloads.
custom_volumes (tuple[str, ...]) – Volume specifiers when scope=CUSTOM_VOLUME. Windows: drive letters (“C:”) or volume labels (“Volume_1”). macOS: volume labels or “$System_Volume”. Linux PS: mount paths (“/my/mount/point”).
include_external_drives (bool) – Include external drives when scope=ENTIRE_MACHINE. Ignored for SYSTEM_VOLUME and CUSTOM_VOLUME.
include_boot_partition (bool) – Include boot partition when scope=CUSTOM_VOLUME and the selection contains the system partition.
use_main_schedule (bool) – Follow the plan’s main schedule. When True, schedule is ignored.
schedule (synology_apm.sdk.models.protection_plan.MachineTaskSchedule | None) – Per-task schedule; only used when use_main_schedule=False.
- workload_type: MachineWorkloadType¶
- os_type: MachineOsType¶
- scope: MachineTaskScope | None = None¶
- schedule: MachineTaskSchedule | None = None¶
- class synology_apm.sdk.models.protection_plan.ProtectionPlan(plan_id, name, category, policy=None, workload_count=None, description='', successful_workload_count=0, unsuccessful_workload_count=0, is_immutable=False, backup_copy_policy=None, backup_copy_status=None, run_schedule_by_controller_time=False, vm_config=None, pc_config=None, ps_config=None, db_config=None, backup_window=None, tasks=None)¶
Bases:
objectCore configuration unit for a backup task.
- Variables:
plan_id (str) – Unique plan identifier.
name (str) – Plan display name.
category (synology_apm.sdk.enums.WorkloadCategory) – Workload category this plan belongs to.
policy (synology_apm.sdk.models.protection_plan.ProtectionPlanPolicy | None) – Schedule and retention policy for the main backup.
workload_count (int | None) – Total number of workloads this plan is applied to.
description (str) – Plan description.
successful_workload_count (int) – Number of workloads with successful backups.
unsuccessful_workload_count (int) – Number of workloads with failed backups.
is_immutable (bool) – Whether immutable backups are enabled.
backup_copy_policy (synology_apm.sdk.models.protection_plan.BackupCopyPolicy | None) – Backup Copy configuration; None when Backup Copy is not enabled.
backup_copy_status (synology_apm.sdk.models.protection_plan.PlanBackupCopyStatus | None) – Current backup copy status; None when Backup Copy is not configured.
run_schedule_by_controller_time (bool) – Whether schedules run on the APM controller’s clock rather than each backup server’s local clock.
vm_config (synology_apm.sdk.models.protection_plan.MachineVmConfig | None) – VM workload settings; None for M365 plans or for list() results.
pc_config (synology_apm.sdk.models.protection_plan.MachinePcConfig | None) – PC workload settings; None for M365 plans or for list() results.
ps_config (synology_apm.sdk.models.protection_plan.MachinePsConfig | None) – Physical server settings; None for M365 plans or for list() results.
db_config (synology_apm.sdk.models.protection_plan.MachineDbConfig | None) – Database backup settings; None when DB backup is disabled or for list() results.
backup_window (synology_apm.sdk.models.protection_plan.MachineBackupWindow | None) – Allowed backup time window; None for list() results.
tasks (tuple[synology_apm.sdk.models.protection_plan.MachineTaskConfig, ...] | None) – Per-workload-type task entries; None for M365 plans or for list() results.
- category: WorkloadCategory¶
- policy: ProtectionPlanPolicy | None = None¶
- backup_copy_policy: BackupCopyPolicy | None = None¶
- backup_copy_status: PlanBackupCopyStatus | None = None¶
- vm_config: MachineVmConfig | None = None¶
- pc_config: MachinePcConfig | None = None¶
- ps_config: MachinePsConfig | None = None¶
- db_config: MachineDbConfig | None = None¶
- backup_window: MachineBackupWindow | None = None¶
- tasks: tuple[MachineTaskConfig, ...] | None = None¶
- class synology_apm.sdk.models.protection_plan.MachinePlanCreateRequest(name, retention, schedule, description='', is_immutable=False, vm_config=None, pc_config=None, ps_config=None, db_config=None, backup_window=None, tasks=None, backup_copy=None, run_schedule_by_controller_time=False)¶
Bases:
objectParameters for creating a Machine (DEVICE) Protection Plan.
- Variables:
name (str) – Plan display name.
retention (synology_apm.sdk.models.protection_plan.ProtectionRetentionPolicy) – Version retention policy.
schedule (synology_apm.sdk.models.protection_plan.ProtectionSchedule) – Main backup schedule.
description (str) – Plan description.
is_immutable (bool) – Enable immutable backups (requires KEEP_DAYS retention).
vm_config (synology_apm.sdk.models.protection_plan.MachineVmConfig | None) – VM workload settings; None applies default settings.
pc_config (synology_apm.sdk.models.protection_plan.MachinePcConfig | None) – PC workload settings; None applies default settings.
ps_config (synology_apm.sdk.models.protection_plan.MachinePsConfig | None) – Physical server settings; None applies default settings.
db_config (synology_apm.sdk.models.protection_plan.MachineDbConfig | None) – Database processing settings; None disables DB backup.
backup_window (synology_apm.sdk.models.protection_plan.MachineBackupWindow | None) – Allowed backup time window; None imposes no restriction.
tasks (tuple[synology_apm.sdk.models.protection_plan.MachineTaskConfig, ...] | None) – Per-workload-type task entries. None generates the 6 default entries (one per mandatory (workload_type, os_type) pair). All 6 mandatory pairs must be covered when provided.
backup_copy (synology_apm.sdk.models.protection_plan.BackupCopyConfig | None) – Backup Copy configuration; None disables copy.
run_schedule_by_controller_time (bool) – Use APM controller’s clock for scheduling.
- Raises:
ValueError – schedule frequency cannot be AFTER_BACKUP.
ValueError – WEEKLY schedule requires at least one weekday.
ValueError – Immutable plans require KEEP_DAYS retention.
ValueError – tasks is missing a mandatory (workload_type, os_type) pair.
ValueError – tasks contains more than one FS or VM entry.
ValueError – tasks contains a duplicate MachineTaskConfig.
ValueError – A task’s os_type is invalid for its workload_type.
ValueError – A VM or FS task has a non-None scope.
ValueError – custom_volumes is non-empty when scope != CUSTOM_VOLUME.
ValueError – A task with use_main_schedule=False has no schedule.
ValueError – A non-PC task’s schedule has event_trigger set.
ValueError – A task schedule uses AFTER_BACKUP frequency.
ValueError – A task WEEKLY schedule has no weekdays.
- retention: ProtectionRetentionPolicy¶
- schedule: ProtectionSchedule¶
- vm_config: MachineVmConfig | None = None¶
- pc_config: MachinePcConfig | None = None¶
- ps_config: MachinePsConfig | None = None¶
- db_config: MachineDbConfig | None = None¶
- backup_window: MachineBackupWindow | None = None¶
- tasks: tuple[MachineTaskConfig, ...] | None = None¶
- backup_copy: BackupCopyConfig | None = None¶
- class synology_apm.sdk.models.protection_plan.M365PlanCreateRequest(name, retention, schedule, description='', is_immutable=False, backup_copy=None, run_schedule_by_controller_time=False)¶
Bases:
objectParameters for creating an M365 Protection Plan.
- Variables:
name (str) – Plan display name.
retention (synology_apm.sdk.models.protection_plan.ProtectionRetentionPolicy) – Version retention policy.
schedule (synology_apm.sdk.models.protection_plan.ProtectionSchedule) – Backup schedule.
description (str) – Plan description.
is_immutable (bool) – Enable immutable backups (requires KEEP_DAYS retention).
backup_copy (synology_apm.sdk.models.protection_plan.BackupCopyConfig | None) – Backup Copy configuration; None disables copy.
run_schedule_by_controller_time (bool) – Use APM controller’s clock for scheduling.
- Raises:
ValueError – schedule frequency cannot be AFTER_BACKUP.
ValueError – WEEKLY schedule requires at least one weekday.
ValueError – Immutable plans require KEEP_DAYS retention.
- retention: ProtectionRetentionPolicy¶
- schedule: ProtectionSchedule¶
- backup_copy: BackupCopyConfig | None = None¶