Models & objects#

Domain models#

Domain models provide complete information about the resource, similar to aggregates, and also have commands (methods) for managing the resource.

pydantic model yc_lockbox._models.Secret[source]#

A root domain model that represents Lockbox Secret. This model contains commands (methods) for secret manipulate.

Usage:

# basic commands
secret.deactivate()
secret.activate()
secret.delete()

# get payload from Secret
secret_payload = secret.payload()
print(secret_payload["my_entry"])  # by default secret values is masked like ******
print(secret_payload["my_entry"].reveal_text_value())  # show real value

# get all secret versions and destruct olds
for version in secret.list_versions(iterator=True):
    print(version)
    if version.id != secret.current_version.id:
        version.schedule_version_destruction()

# update a secret
new_data = IUpdateSecret(
    update_mask="name,description",
    name="new-secret-name",
    description="My secret"
)
update_operation = secret.update(new_data)

if update_operation.done:  # or use secret.refresh()
    print(update_operation.resource.name, update_operation.resource.description)
Fields:
field created_at: datetime [Required] (alias 'createdAt')#
field current_version: SecretVersion [Required] (alias 'currentVersion')#
field deletion_protection: bool [Required] (alias 'deletionProtection')#
field description: str | None = None#
field folder_id: str [Required] (alias 'folderId')#
field id: str [Required]#
field kms_key_id: str | None = None (alias 'kmsKeyId')#
field labels: dict[str, str] | None = None#
field name: str | None = None#
field status: str = 'UNKNOWN'#
activate(**kwargs)[source]#

Shortcut for activate the current secret.

Return type:

Union[Operation, YandexCloudError]

add_version(version, **kwargs)[source]#

Shortcut for add a new version to the current secret.

Return type:

Union[Operation, YandexCloudError]

cancel_version_destruction(version_id, **kwargs)[source]#

Shortcut for cancel destruction specified version of the current secret.

Return type:

Union[Operation, YandexCloudError]

deactivate(**kwargs)[source]#

Shortcut for deactivate the current secret.

Return type:

Union[Operation, YandexCloudError]

delete(**kwargs)[source]#

Shortcut for delete the current secret.

Return type:

Union[Operation, YandexCloudError]

list_versions(page_size=100, page_token=None, iterator=False, **kwargs)[source]#

Shortcut for list all available versions of the current secret.

Return type:

Union[SecretVersionsList, Iterator[SecretVersion], AsyncGenerator[Any, SecretVersion], YandexCloudError]

payload(version_id=None, **kwargs)[source]#
Return type:

Union[Operation, YandexCloudError]

refresh(**kwargs)[source]#

Shortcut for refresh attributes for this secret.

Return type:

Secret

schedule_version_destruction(version_id, pending_period=604800, **kwargs)[source]#

Shortcut for schedule destruction for specified version of the current secret.

Return type:

Union[Operation, YandexCloudError]

update(data, **kwargs)[source]#

Shortcut for update current secret.

Return type:

Union[Operation, YandexCloudError]

pydantic model yc_lockbox._models.SecretVersion[source]#

Domain object that represents a version from Secret. This object contains methods for call version commands.

Fields:
field created_at: datetime [Required] (alias 'createdAt')#
field description: str | None = None#
field destroy_at: datetime | None = None (alias 'destroyAt')#
field id: str [Required]#
field payload_entry_keys: list[str] | None = None (alias 'payloadEntryKeys')#
field secret_id: str [Required] (alias 'secretId')#
field status: str = 'UNKNOWN'#
cancel_version_destruction(**kwargs)[source]#

Shortcut for cancel destruction for this version.

Return type:

Union[Operation, YandexCloudError]

payload(**kwargs)[source]#

Get payload from the current secret..

Return type:

Union[SecretPayload, YandexCloudError]

schedule_version_destruction(pending_period=604800, **kwargs)[source]#

Shortcut for schedule descruction for this version.

Return type:

Union[Operation, YandexCloudError]

pydantic model yc_lockbox._models.SecretPayload[source]#

Domain object that represents a payload for Secret.

Fields:
field entries: list[SecretPayloadEntry] [Required]#
field version_id: str [Required] (alias 'versionId')#
get(key, default=None)[source]#

Get entry object from payload.

Parameters:
  • key (str) – Entry key (name).

  • default (Optional[Any]) – Default return value if key not exists.

Return type:

SecretPayloadEntry | None

pydantic model yc_lockbox._models.SecretPayloadEntry[source]#

Domain object that represents an entry in the SecretPayload.

Fields:
field binary_value: SecretStr | SecretBytes | None = None (alias 'binaryValue')#
field key: str [Required]#
field text_value: SecretStr | None = None (alias 'textValue')#
reveal_binary_value()[source]#

Reveal a binary value.

Return type:

bytes

reveal_text_value()[source]#

Reveal a text value.

Return type:

str

Paginated models#

Used when iterator=False.

The models contain a next_page_token: str | None field pointing to the next page.

pydantic model yc_lockbox._models.SecretsList[source]#
Fields:
field secrets: list[Secret] = []#
pydantic model yc_lockbox._models.SecretVersionsList[source]#
Fields:
field versions: list[SecretVersion] = []#

Upsert models#

Upsert models (interfaces) are designed for operations of creating new resources or updating objects inside an existing resource.

pydantic model yc_lockbox._models.INewSecret[source]#
Fields:
field deletion_protection: bool = False (alias 'deletionProtection')#
field description: str | None = None#
field folder_id: str [Required] (alias 'folderId')#
field kms_key_id: str | None = None (alias 'kmsKeyId')#
field labels: dict[str, str] | None = {}#
field name: str | None = None#
field version_description: str | None = None (alias 'versionDescription')#
field version_payload_entries: list[INewSecretPayloadEntry] [Required] (alias 'versionPayloadEntries')#
pydantic model yc_lockbox._models.INewSecretVersion[source]#
Fields:
field base_version_id: str | None = None (alias 'baseVersionId')#
field description: str | None = None#
field payload_entries: list[INewSecretPayloadEntry] [Required] (alias 'payloadEntries')#
pydantic model yc_lockbox._models.INewSecretPayloadEntry[source]#
Fields:
field binary_value: str | None = None (alias 'binaryValue')#
field key: str [Required]#
field text_value: str | None = None (alias 'textValue')#
pydantic model yc_lockbox._models.IUpdateSecret[source]#
Fields:
field deletion_protection: bool | None = None (alias 'deletionProtection')#
field description: str | None = None#
field labels: dict[str, str] | None = None#
field name: str | None = None#
field update_mask: str [Required] (alias 'updateMask')#

Comma-separated model field names to be updated.

Common models#

Other Yandex Cloud models related to Lockbox.

pydantic model yc_lockbox._models.Operation[source]#
Fields:
field created_at: datetime | None = None (alias 'createdAt')#
field created_by: str | None = None (alias 'createdBy')#
field description: str | None = None#
field done: bool = False#
field error: Any = None#
field id: str [Required]#
field metadata: Union[dict[str, str], Any] = None#
field modified_at: datetime | None = None (alias 'modifiedAt')#
field response: Any = None#
property resource: T | None#

Returns response from operation if possible. Otherwise returns None.

pydantic model yc_lockbox._models.YandexCloudError[source]#
Fields:
field code: int [Required]#
field details: Any = None#
field message: str | None = None#
property error_type: RpcError#
pydantic model yc_lockbox._models.IamTokenResponse[source]#
Fields:
field expires_at: datetime [Required] (alias 'expiresAt')#
field token: str [Required] (alias 'iamToken')#