Python - secret.version.access()

Retrieves the value from a version of a secret.

from nitric.resources import secret
from nitric.application import Nitric
# Get latest secret version
latest = secret("database.password").allow("access").latest()
# Access the latest secret version
value = await latest_version.access()
Nitric.run()

Examples

Access the latest version of a secret

from nitric.resources import secret
from nitric.application import Nitric
latest = secret("database.password").allow("access").latest()
value = await latest.access()
Nitric.run()

Access a specific version of a secret

from nitric.resources import secret
from nitric.application import Nitric
key_ref = secret('apiKey').allow('access')
key_value = await key_ref.version('the-version-id').access()
Nitric.run()
Last updated on Dec 19, 2024