prefect_aws.secrets_manager
Tasks for interacting with AWS Secrets Manager
Functions
read_secret
secret_name: Name of stored secret.aws_credentials: Credentials to use for authentication with AWS.version_id: Specifies version of secret to read. Defaults to the most recent version if not given.version_stage: Specifies the version stage of the secret to read. Defaults to AWS_CURRENT if not given.
- The secret values as a
strorbytesdepending on the format in which the secret was stored.
update_secret
secret_name: Name of secret to update.secret_value: Desired value of the secret. Can be eitherstrorbytes.aws_credentials: Credentials to use for authentication with AWS.description: Desired description of the secret.
- A dict containing the secret ARN (Amazon Resource Name), name, and current version ID.
create_secret
secret_name: The name of the secret to create.secret_value: The value to store in the created secret.aws_credentials: Credentials to use for authentication with AWS.description: A description for the created secret.tags: A list of tags to attach to the secret. Each tag should be specified as a dictionary in the following format:
- A dict containing the secret ARN (Amazon Resource Name), name, and current version ID.
delete_secret
force_delete_without_recovery
equal to True. Otherwise, secrets will be marked for deletion and available for
recovery for the number of days specified in recovery_window_in_days
Args:
secret_name: Name of the secret to be deleted.aws_credentials: Credentials to use for authentication with AWS.recovery_window_in_days: Number of days a secret should be recoverable for before permanent deletion. Minimum window is 7 days and maximum window is 30 days. Ifforce_delete_without_recoveryis set toTrue, this value will be ignored.force_delete_without_recovery: IfTrue, the secret will be immediately deleted and will not be recoverable.
- A dict containing the secret ARN (Amazon Resource Name),
name, and deletion date of the secret. DeletionDate is the date and
time of the delete request plus the number of days in
recovery_window_in_days.
Classes
AwsSecret
Manages a secret in AWS’s Secrets Manager.
Attributes:
aws_credentials: The credentials to use for authentication with AWS.secret_name: The name of the secret.
adelete_secret
recovery_window_in_days: The number of days to wait before permanently deleting the secret. Must be between 7 and 30 days.force_delete_without_recovery: If True, the secret will be deleted immediately without a recovery window.**delete_kwargs: Additional keyword arguments to pass to the delete_secret method of the boto3 client.
- The path that the secret was deleted from.
aread_secret
version_id: The version of the secret to read. If not provided, the latest version will be read.version_stage: The version stage of the secret to read. If not provided, the latest version will be read.read_kwargs: Additional keyword arguments to pass to theget_secret_valuemethod of the boto3 client.
- The secret data.
awrite_secret
secret_data: The secret data to write.**put_or_create_secret_kwargs: Additional keyword arguments to pass to put_secret_value or create_secret method of the boto3 client.
- The path that the secret was written to.
delete_secret
recovery_window_in_days: The number of days to wait before permanently deleting the secret. Must be between 7 and 30 days.force_delete_without_recovery: If True, the secret will be deleted immediately without a recovery window.**delete_kwargs: Additional keyword arguments to pass to the delete_secret method of the boto3 client.
- The path that the secret was deleted from.
read_secret
version_id: The version of the secret to read. If not provided, the latest version will be read.version_stage: The version stage of the secret to read. If not provided, the latest version will be read.read_kwargs: Additional keyword arguments to pass to theget_secret_valuemethod of the boto3 client.
- The secret data.
write_secret
secret_data: The secret data to write.**put_or_create_secret_kwargs: Additional keyword arguments to pass to put_secret_value or create_secret method of the boto3 client.
- The path that the secret was written to.