synology_apm_repo.sdk.catalog.workload module

Workload: one db/workload_config row, with its own display-name/ subtitle extraction (_device_display_name/_saas_display_name) as a first-class output, not an afterthought: CLI/TUI show only display_name/subtitle/attrs in the default (non-diagnostic) mode, so this can’t be bolted on later.

workloads()’s own per-connection lookup, _workload_ids_for_connection, relies on the same copy_target_version join catalog/connection.py documents in its batched form.

class synology_apm_repo.sdk.catalog.workload.TargetType(value)

Bases: StrEnum

The six real Workload.workload_type/Version.target_type values (db/workload_config/db/copy_target_version on-disk strings) — device workloads (VM/PC/PS/FS) vs. SaaS connector kinds (GW/M365). A str subclass: every existing site comparing one against a plain "VM"/"GW" literal, or collecting it alongside the still-str-typed workload_type/target_type fields, keeps working unchanged.

VM = 'VM'
PC = 'PC'
PS = 'PS'
FS = 'FS'
GW = 'GW'
M365 = 'M365'
class synology_apm_repo.sdk.catalog.workload.Workload(workload_id, workload_uid, workload_type, sub_type, display_name, subtitle, spec)

Bases: object

One db/workload_config row, with display fields extracted per this module’s docstring.

workload_id: WorkloadId
workload_uid: WorkloadUid
workload_type: str
sub_type: str | None
display_name: str
subtitle: str | None
spec: dict[str, object]
property type_hint: str

A short, human-meaningful classification for disambiguation — sub_type where present, else the top-level workload_type. Deliberately not ``subtitle`` — that field carries workload-specific detail (an OS name, a host IP), not a type classification. Feeds disambiguate’s hints parameter.

property tenant_id: str | None

The real M365 (Microsoft 365) tenant GUID — workload_spec.spec.tenant_id. Not the same thing as workload_spec’s own top-level namespace field, a backup-server-internal bookkeeping UUID that can differ across workloads sharing this same tenant_id. None for non-M365 workloads — GW’s tenant-equivalent is domain, a different field, never this one.

property domain: str | None

The real GWS (Google Workspace) domain — workload_spec.spec.domain, already a plain human-readable domain string — unlike M365’s tenant_id, which is only ever a GUID (no field anywhere in workload_spec carries a plain M365 tenant domain string). None for non-GW workloads.

async synology_apm_repo.sdk.catalog.workload.workloads(repo, connection)

Sorted by display_name (case-insensitive), same reasoning as connections().

async synology_apm_repo.sdk.catalog.workload.workload_by_id(repo, workload_id)

A single Workload by its own workload_config primary key — a direct WHERE workload_id = ? lookup, not a connections() + workloads(connection) scan followed by a linear match: unlike Connection, no field of a Workload (see _workload_from_row) depends on which connection it belongs to, so there is nothing a full catalog walk would supply that this direct lookup doesn’t already have. None if workload_id doesn’t resolve to any row.