ds_common_placeholder_py_lib.functions.secrets

File: functions/secrets.py Region: ds-common-placeholder-py-lib

Description

get_secret (contract §7): tenant-scoped vault keys, base64 handling, and recording each value so Context.scrub can remove it.

Functions

key_tenant(key) → str | None

The tenant segment of a vault key /ds/vault/<store>/<tenant>/….

get_secret(ctx, args) → str

Read a vault value of the run's tenant from ds-vault.

secret(ctx, args) → str

A secret already read upstream (resolve(strict=False) writes each one

Module Contents

ds_common_placeholder_py_lib.functions.secrets.key_tenant(key: object) → str | None[source]

The tenant segment of a vault key /ds/vault/<store>/<tenant>/….

Only the tenant is read; the rest of the key’s format is the definition author’s (and the frontend’s) concern. Returns None when the key has no tenant segment, so it cannot be shown to belong to any tenant.

ds_common_placeholder_py_lib.functions.secrets.get_secret(ctx: ds_common_placeholder_py_lib.context.Context, args: list[Any]) → str[source]

Read a vault value of the run’s tenant from ds-vault.

Raises:

PlaceholderError – secret_scope if the key’s tenant segment is not the context’s tenant (checked before the vault is read), secret_missing if the vault has no such key, secret_unavailable if the vault cannot be read (configuration, connection, or KMS), type if the value is not UTF-8.

ds_common_placeholder_py_lib.functions.secrets.secret(ctx: ds_common_placeholder_py_lib.context.Context, args: list[Any]) → str[source]

A secret already read upstream (resolve(strict=False) writes each one as @{secret, '…'}): return it and record it, so Context.scrub() and the SQL check know it.