secrets

Model and Manager for Secrets resources.

class Secret(attrs: Mapping[str, Any] | None = None, client: APIClient | None = None, collection: Manager | None = None)[source]

Bases: PodmanResource

Details and configuration for a secret registered with the Podman service.

Initialize base class for PodmanResource’s.

Parameters:
  • attrs – Mapping of attributes for resource from Podman service.

  • client – Configured connection to a Podman service.

  • collection – Manager of this category of resource, named collection for compatibility

reload() None

Refresh this object’s data from the service.

remove(all: bool | None = None)[source]

Delete secret.

Parameters:

all – When True, delete all secrets.

Raises:
  • NotFound – when Secret does not exist

  • APIError – when error returned by service

property id

Returns the identifier for the object.

Type:

str

property name

name of the secret.

Type:

str

property short_id

Returns truncated identifier. ‘sha256’ preserved when included in the id.

No attempt is made to ensure the returned value is semantically meaningful for all resources.

Type:

str

class SecretsManager(client: APIClient)[source]

Bases: Manager

Specialized Manager for Secret resources.

Initialize SecretsManager object.

Parameters:

client – Connection to Podman service.

create(name: str, data: bytes, labels: Mapping[str, Any] | None = None, driver: str | None = None) Secret[source]

Create a Secret.

Parameters:
  • name – User-defined name of the secret.

  • data – Secret to be registered with Podman service.

  • labels – Ignored.

  • driver – Secret driver.

Raises:

APIError – when service returns an error

exists(key: str) bool[source]

Returns True if resource exists.

Podman only.

Notes

This method does _not_ provide any mutex mechanism.

get(secret_id: str) Secret[source]

Return information for Secret by name or id.

Parameters:

secret_id – Secret name or id.

Raises:
  • NotFound – when Secret does not exist

  • APIError – when error returned by service

list(**kwargs) List[Secret][source]

Report on Secrets.

Keyword Arguments:

filters (Dict[str, Any]) – Ignored.

Raises:

APIError – when error returned by service

prepare_model(attrs: PodmanResource | Mapping[str, Any]) PodmanResourceType

Create a model from a set of attributes.

remove(secret_id: Secret | str, all: bool | None = None)[source]

Delete secret.

Podman only

Parameters:
  • secret_id – Identifier of Secret to delete.

  • all – When True, delete all secrets.

Raises:
  • NotFound – when Secret does not exist

  • APIError – when an error returned by service

property resource

prepare_model() will create Secret classes.

Type:

Type[Secret]