Vault | Python SDK | General Endpoints
General Endpoints
Delete
Vault.delete(item_id, recursive)Delete a secret or key
vault.delete(id="pvi_p6g5i3gtbvqvc3u6zugab6qs6r63tqf5")
Retrieve
Vault.get(item_id, version)Retrieve a secret, key or folder, and any associated information.
response = vault.get(
id="pvi_p6g5i3gtbvqvc3u6zugab6qs6r63tqf5",
version=1,
)
Get bulk
Vault.get_bulk(filter, size, order, order_by, last)Retrieve details for multiple Vault items, including keys, secrets, tokens, or folders, that match a given filter specification.
response = vault.get_bulk({"id": "pvi_..."})
List
Vault.list(filter, size, order, order_by, last)Retrieve a list of secrets, keys and folders, and their associated information.
response = vault.list(
filter={
"folder": "/",
"type": "asymmetric_key",
"name__contains": "test",
"metadata_key1": "value1",
"created_at__lt": "2023-12-12T00:00:00Z"
},
last="WyIvdGVzdF8yMDdfc3ltbWV0cmljLyJd",
order=ItemOrder.ASC,
order_by=ItemOrderBy.NAME,
size=20,
)
State change
Vault.state_change(item_id, state, version, destroy_period)Change the state of a specific version of a secret or key.
response = vault.state_change(
id="pvi_p6g5i3gtbvqvc3u6zugab6qs6r63tqf5",
state=ItemVersionState.DEACTIVATED,
)
Update
Vault.update(item_id, name, folder, metadata, tags, disabled_at, enabled, rotation_frequency, rotation_state, rotation_grace_period)Update information associated with a secret, key or folder.
response = vault.update(
id="pvi_p6g5i3gtbvqvc3u6zugab6qs6r63tqf5",
name="my-very-secret-secret",
folder="/personal",
metadata={
"created_by": "John Doe",
"used_in": "Google products"
},
tags=[
"irs_2023",
"personal"
],
rotation_frequency="10d",
rotation_state=ItemVersionState.DEACTIVATED,
)