synology_apm_repo.sdk.profiles.model module¶
Data model for saved S3/Azure/SMB connection profiles.
Profile fields go by one canonical name everywhere (CLI flags, TUI forms,
these dataclasses): bucket/endpoint/region/verify_tls/…
Each config’s client_kwargs translates them to its client’s kwarg
names. Secret fields (S3’s access/secret key, Azure’s credential, SMB’s
password) live in the OS keyring, never on these dataclasses;
client_kwargs_with_secrets merges them in.
- class synology_apm_repo.sdk.profiles.model.BackendKind(*values)¶
Bases:
StrEnumWhich backend a profile targets; the value is also its CLI/TUI name.
- S3 = 's3'¶
- AZURE = 'azure'¶
- SMB = 'smb'¶
- class synology_apm_repo.sdk.profiles.model.S3ProfileConfig(bucket, endpoint=None, region=None, verify_tls=True)¶
Bases:
objectNon-secret
S3Storeconstructor inputs.access_key/secret_keyare not fields here — seesecrets.py.- kind: ClassVar[BackendKind] = 's3'¶
- open_store(**client_kwargs)¶
The
S3Storefor this bucket, built withclient_kwargs(client_kwargs_with_secrets’s result).
- class synology_apm_repo.sdk.profiles.model.AzureProfileConfig(container, account_url=None, verify_tls=True)¶
Bases:
objectNon-secret
AzureStoreconstructor inputs.credentialis not a field here — seesecrets.py.- kind: ClassVar[BackendKind] = 'azure'¶
- open_store(**client_kwargs)¶
The
AzureStorefor this container; seeS3ProfileConfig.open_store.- Raises:
ProfileFieldError – Azure rejected
account_url(missing or malformed).
- class synology_apm_repo.sdk.profiles.model.SmbProfileConfig(server, share, port=445, username=None)¶
Bases:
objectNon-secret
SmbStoreconstructor inputs.passwordis not a field here — seesecrets.py.usernamemay carry a domain asDOMAIN\usernameoruser@domain; a profile names a whole share.- kind: ClassVar[BackendKind] = 'smb'¶
- open_store(**client_kwargs)¶
The
SmbStorefor this share; seeS3ProfileConfig.open_store.
- synology_apm_repo.sdk.profiles.model.ProfileConfig = synology_apm_repo.sdk.profiles.model.S3ProfileConfig | synology_apm_repo.sdk.profiles.model.AzureProfileConfig | synology_apm_repo.sdk.profiles.model.SmbProfileConfig¶
Any backend’s non-secret profile config.
- class synology_apm_repo.sdk.profiles.model.Profile(name, config)¶
Bases:
objectOne saved profile, keyed by its user-chosen
name(unique across every backend kind). Never carries secret values.- config: S3ProfileConfig | AzureProfileConfig | SmbProfileConfig¶
- property kind: BackendKind¶
The backend this profile targets, its config’s
kind.
- class synology_apm_repo.sdk.profiles.model.ProfileFieldSpec(name, strip=True, is_checkbox=False, is_port=False, required=False, secret=False, prompt='')¶
Bases:
objectOne profile field, in canonical collection/display order for its backend: what a connection form binds and how
config_from_fieldsreads it.- Variables:
name (str) – The canonical field name.
strip (bool) – Whether leading/trailing whitespace is dropped;
Falsewhere it might be significant (secret_key/credential/password).is_checkbox (bool) – A boolean field, true when absent.
is_port (bool) – A port number,
DEFAULT_SMB_PORTwhen blank.required (bool) – Must be non-blank.
secret (bool) – Kept in the OS keyring, never in
profiles.json.prompt (str) – The interactive prompt for a secret field.
- synology_apm_repo.sdk.profiles.model.form_fields_for(kind)¶
kind’s full field list, in canonical order — every field a connection form binds, secrets included.
- synology_apm_repo.sdk.profiles.model.secret_fields_for(kind)¶
Which field names are secret (keyring-backed) for
kind— the rest are plain config, persisted toprofiles.json.
- synology_apm_repo.sdk.profiles.model.config_from_fields(kind, fields, *, check_required=True)¶
fields(canonical names, as a connection form or the CLI collects them; extra keys, secrets included, are ignored) turned intokind’s config. A blank optional field means “not set”; a blank port meansDEFAULT_SMB_PORT.check_required=Falseaccepts blank required fields, for an account-level operation (listing buckets) that has none chosen yet.- Raises:
ProfileFieldError – A required field is blank, or the port is not a number.
- synology_apm_repo.sdk.profiles.model.config_from_json(kind, raw)¶
kind’s config from one savedprofiles.jsonentry, strictly: nothing is coerced, so a hand-edited"false"is rejected rather than read as true.
- synology_apm_repo.sdk.profiles.model.client_kwargs_with_secrets(config, secrets)¶
config.client_kwargsplus each of its kind’s secret fields thatsecretsholds as a non-empty string; other keys insecretsare ignored.