RotationSchedule
- class aws_cdk.aws_secretsmanager.RotationSchedule(scope, id, *, secret, automatically_after=None, hosted_rotation=None, rotation_lambda=None)
Bases:
Resource
A rotation schedule.
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_lambda as lambda_ import aws_cdk.aws_secretsmanager as secretsmanager import aws_cdk.core as cdk # function_: lambda.Function # hosted_rotation: secretsmanager.HostedRotation # secret: secretsmanager.Secret rotation_schedule = secretsmanager.RotationSchedule(self, "MyRotationSchedule", secret=secret, # the properties below are optional automatically_after=cdk.Duration.minutes(30), hosted_rotation=hosted_rotation, rotation_lambda=function_ )
- Parameters:
scope (
Construct
)id (
str
)secret (
ISecret
) – The secret to rotate. If hosted rotation is used, this must be a JSON string with the following format:: { “engine”: <required: database engine>, “host”: <required: instance host name>, “username”: <required: username>, “password”: <required: password>, “dbname”: <optional: database name>, “port”: <optional: if not specified, default port will be used>, “masterarn”: <required for multi user rotation: the arn of the master secret which will be used to create users/change passwords> } This is typically the case for a secret referenced from anAWS::SecretsManager::SecretTargetAttachment
or anISecret
returned by theattach()
method ofSecret
.automatically_after (
Optional
[Duration
]) – Specifies the number of days after the previous rotation before Secrets Manager triggers the next automatic rotation. A value of zero will disable automatic rotation -Duration.days(0)
. Default: Duration.days(30)hosted_rotation (
Optional
[HostedRotation
]) – Hosted rotation. Default: - eitherrotationLambda
orhostedRotation
must be specifiedrotation_lambda (
Optional
[IFunction
]) – A Lambda function that can rotate the secret. Default: - eitherrotationLambda
orhostedRotation
must be specified
Methods
- apply_removal_policy(policy)
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters:
policy (
RemovalPolicy
)- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- env
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
- node
The construct tree node associated with this construct.
- stack
The stack in which this resource is defined.
Static Methods
- classmethod is_construct(x)
Return whether the given object is a Construct.
- Parameters:
x (
Any
)- Return type:
bool
- classmethod is_resource(construct)
Check whether the given construct is a Resource.
- Parameters:
construct (
IConstruct
)- Return type:
bool