launchflow.gcp.secret_manager
SecretManagerSecret
1class SecretManagerSecret(Resource[SecretManagerConnectionInfo])
A Secret Manager secret resource.
This creates the container for the secret and allows you to access the secret's value. You will need to manually add a value to the secret.
Example usage:
1import launchflow as lf
2
3# Docs: https://docs.launchflow.com/reference/gcp-resources/gcp-secret-manager
4api_key = lf.gcp.SecretManagerSecret("api-key")
__init__
1def __init__(name: str) -> None
Create a new Secret Manager secret resource.
Args:
name
(str): The name of the secret.
version
1def version(version: str = "latest") -> bytes
Access a version of the secret.
Args:
version
(str): The version of the secret to access. Defaults to "latest".
Returns:
- The value of the secret as bytes.
Example usage:
1import launchflow as lf
2
3api_key = lf.gcp.SecretManagerSecret("api-key")
4secret = api_key.version()
add_version
1def add_version(payload: bytes)
Add a version of the secret.
Args:
payload
(str): The payload to add to the secret.
Example usage:
1import launchflow as lf
2
3api_key = lf.gcp.SecretManagerSecret("api-key")
4api_key.add_version(open("api-key.txt", "rb").read())