launchflow.gcp.secret_manager

SecretManagerSecret

1
class 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:

1
import launchflow as lf
2
3
# Docs: https://docs.launchflow.com/reference/gcp-resources/gcp-secret-manager
4
api_key = lf.gcp.SecretManagerSecret("api-key")

__init__

1
def __init__(name: str) -> None

Create a new Secret Manager secret resource.

Args:

  • name (str): The name of the secret.

version

1
def 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:

1
import launchflow as lf
2
3
api_key = lf.gcp.SecretManagerSecret("api-key")
4
secret = api_key.version()

add_version

1
def add_version(payload: bytes)

Add a version of the secret.

Args:

  • payload (str): The payload to add to the secret.

Example usage:

1
import launchflow as lf
2
3
api_key = lf.gcp.SecretManagerSecret("api-key")
4
api_key.add_version(open("api-key.txt", "rb").read())