Manage secrets
The CRUD methods create, read, update, and delete secrets. They can be called directly from the SDK or through a Project object. When using a Project object, omit the project parameter and pass every other parameter as a keyword argument. For creation, see Create a secret and the secret kind.
Read
Use the read methods to retrieve secrets from the backend or load them from a YAML descriptor.
get_secret
Get a secret entity from the backend.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
identifier
|
str
|
Entity name or entity key ( |
required |
project
|
str
|
Project name. Required when |
None
|
entity_id
|
str
|
Entity identifier used to select a specific version when
|
None
|
Returns:
| Type | Description |
|---|---|
Secret
|
Retrieved secret entity. |
list_secrets
List the latest versions of secret entities in a project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
str
|
Project name. |
required |
Returns:
| Type | Description |
|---|---|
list[Secret]
|
Latest versions of secret entities in the project. |
import_secret
Import a secret entity from a YAML file or entity key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file
|
str
|
Path to a YAML file containing the entity descriptor. Provide either
|
None
|
key
|
str
|
Entity key ( |
None
|
reset_id
|
bool
|
Whether to generate a new entity identifier instead of preserving the identifier from the imported entity. |
False
|
context
|
str
|
Project name used for context resolution. If omitted, the project from the entity descriptor is used. |
None
|
Returns:
| Type | Description |
|---|---|
Secret
|
Imported secret entity. |
Update
Update a secret after changing its mutable metadata.
update_secret
Update a secret entity in the backend.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity
|
Secret
|
Entity to update. The entity specification is immutable. |
required |
Returns:
| Type | Description |
|---|---|
Secret
|
Updated secret entity. |
Delete
Delete one secret version or all versions of a secret.
delete_secret
Delete one or more versions of a secret entity from the backend.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
identifier
|
str
|
Entity name or entity key ( |
required |
project
|
str
|
Project name. Required when |
None
|
entity_id
|
str
|
Identifier of the version to delete. Required when
|
None
|
delete_all_versions
|
bool
|
Whether to delete all versions of the named entity. When False, only one version is deleted. |
False
|
Returns:
| Type | Description |
|---|---|
dict
|
Response data from the backend. |