Skip to main content

Update a key

You may need to update a key to add tags or metadata. Tags and metadata can help identify what the key is used for and for finding the key via search.


import os

import pangea.exceptions as pe
from pangea.config import PangeaConfig
from pangea.services import Vault


def update_secret_metadata(secret_id, new_meta):
token = os.getenv("PANGEA_VAULT_TOKEN")
domain = os.getenv("PANGEA_DOMAIN")
config = PangeaConfig(domain=domain)
vault = Vault(token, config=config)

try:
# use other keywords to update other fields
vault.update(secret_id, metadata=new_meta)

except pe.PangeaAPIException as e:
print(f"Vault Request Error: {e.response.summary}")
for err in e.errors:
print(f"\t{err.detail} \n")

return

Was this article helpful?

Contact us