Class: AWSCDK::SecretsManager::CfnRotationScheduleProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
secrets_manager/cfn_rotation_schedule_props.rb

Overview

Properties for defining a CfnRotationSchedule.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(secret_id:, external_secret_rotation_metadata: nil, external_secret_rotation_role_arn: nil, hosted_rotation_lambda: nil, rotate_immediately_on_update: nil, rotation_lambda_arn: nil, rotation_rules: nil) ⇒ CfnRotationScheduleProps

Returns a new instance of CfnRotationScheduleProps.

Parameters:



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'secrets_manager/cfn_rotation_schedule_props.rb', line 16

def initialize(secret_id:, external_secret_rotation_metadata: nil, external_secret_rotation_role_arn: nil, hosted_rotation_lambda: nil, rotate_immediately_on_update: nil, rotation_lambda_arn: nil, rotation_rules: nil)
  @secret_id = secret_id
  Jsii::Type.check_type(@secret_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "secretId")
  @external_secret_rotation_metadata = 
  Jsii::Type.check_type(@external_secret_rotation_metadata, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc2VjcmV0c21hbmFnZXIuQ2ZuUm90YXRpb25TY2hlZHVsZS5FeHRlcm5hbFNlY3JldFJvdGF0aW9uTWV0YWRhdGFJdGVtUHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "externalSecretRotationMetadata") unless @external_secret_rotation_metadata.nil?
  @external_secret_rotation_role_arn = external_secret_rotation_role_arn
  Jsii::Type.check_type(@external_secret_rotation_role_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "externalSecretRotationRoleArn") unless @external_secret_rotation_role_arn.nil?
  @hosted_rotation_lambda = hosted_rotation_lambda.is_a?(Hash) ? ::AWSCDK::SecretsManager::CfnRotationSchedule::HostedRotationLambdaProperty.new(**hosted_rotation_lambda.transform_keys(&:to_sym)) : hosted_rotation_lambda
  Jsii::Type.check_type(@hosted_rotation_lambda, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zZWNyZXRzbWFuYWdlci5DZm5Sb3RhdGlvblNjaGVkdWxlLkhvc3RlZFJvdGF0aW9uTGFtYmRhUHJvcGVydHkifV19fQ==")), "hostedRotationLambda") unless @hosted_rotation_lambda.nil?
  @rotate_immediately_on_update = rotate_immediately_on_update
  Jsii::Type.check_type(@rotate_immediately_on_update, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "rotateImmediatelyOnUpdate") unless @rotate_immediately_on_update.nil?
  @rotation_lambda_arn = rotation_lambda_arn
  Jsii::Type.check_type(@rotation_lambda_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "rotationLambdaArn") unless @rotation_lambda_arn.nil?
  @rotation_rules = rotation_rules.is_a?(Hash) ? ::AWSCDK::SecretsManager::CfnRotationSchedule::RotationRulesProperty.new(**rotation_rules.transform_keys(&:to_sym)) : rotation_rules
  Jsii::Type.check_type(@rotation_rules, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zZWNyZXRzbWFuYWdlci5DZm5Sb3RhdGlvblNjaGVkdWxlLlJvdGF0aW9uUnVsZXNQcm9wZXJ0eSJ9XX19")), "rotationRules") unless @rotation_rules.nil?
end

Instance Attribute Details

#external_secret_rotation_metadataAWSCDK::IResolvable, ... (readonly)

The list of metadata needed to successfully rotate a managed external secret.



44
45
46
# File 'secrets_manager/cfn_rotation_schedule_props.rb', line 44

def 
  @external_secret_rotation_metadata
end

#external_secret_rotation_role_arnString? (readonly)

The ARN of the IAM role that is used by Secrets Manager to rotate a managed external secret.



49
50
51
# File 'secrets_manager/cfn_rotation_schedule_props.rb', line 49

def external_secret_rotation_role_arn
  @external_secret_rotation_role_arn
end

#hosted_rotation_lambdaAWSCDK::IResolvable, ... (readonly)

Creates a new Lambda rotation function based on one of the Secrets Manager rotation function templates . To use a rotation function that already exists, specify RotationLambdaARN instead.

You must specify Transform: AWS::SecretsManager-2024-09-16 at the beginning of the CloudFormation template. Transforms are macros hosted by AWS CloudFormation that help you create and manage complex infrastructure. The Transform: AWS::SecretsManager-2024-09-16 transform automatically extends the CloudFormation stack to include a nested stack (of type AWS::CloudFormation::Stack ), which then creates and updates on your behalf during subsequent stack operations, the appropriate rotation Lambda function for your database or service. For general information on transforms, see the AWS CloudFormation documentation.

For Amazon RDS master user credentials, see AWS::RDS::DBCluster MasterUserSecret .

For Amazon Redshift admin user credentials, see AWS::Redshift::Cluster .



60
61
62
# File 'secrets_manager/cfn_rotation_schedule_props.rb', line 60

def hosted_rotation_lambda
  @hosted_rotation_lambda
end

#rotate_immediately_on_updateBoolean, ... (readonly)

Determines whether to rotate the secret immediately or wait until the next scheduled rotation window when the rotation schedule is updated.

The rotation schedule is defined in RotationRules .

The default for RotateImmediatelyOnUpdate is true . If you don't specify this value, Secrets Manager rotates the secret immediately.

If you set RotateImmediatelyOnUpdate to false , Secrets Manager tests the rotation configuration by running the test_secret step of the Lambda rotation function. This test creates an AWSPENDING version of the secret and then removes it.

When changing an existing rotation schedule and setting RotateImmediatelyOnUpdate to false :

  • If using AutomaticallyAfterDays or a ScheduleExpression with rate() , the previously scheduled rotation might still occur.
  • To prevent unintended rotations, use a ScheduleExpression with cron() for granular control over rotation windows.

Rotation is an asynchronous process. For more information, see How rotation works .



78
79
80
# File 'secrets_manager/cfn_rotation_schedule_props.rb', line 78

def rotate_immediately_on_update
  @rotate_immediately_on_update
end

#rotation_lambda_arnString? (readonly)

The ARN of an existing Lambda rotation function.

To specify a rotation function that is also defined in this template, use the Ref function.

For Amazon RDS master user credentials, see AWS::RDS::DBCluster MasterUserSecret .

For Amazon Redshift admin user credentials, see AWS::Redshift::Cluster .

To create a new rotation function based on one of the Secrets Manager rotation function templates , specify HostedRotationLambda instead.



91
92
93
# File 'secrets_manager/cfn_rotation_schedule_props.rb', line 91

def rotation_lambda_arn
  @rotation_lambda_arn
end

#rotation_rulesAWSCDK::IResolvable, ... (readonly)

A structure that defines the rotation configuration for this secret.



96
97
98
# File 'secrets_manager/cfn_rotation_schedule_props.rb', line 96

def rotation_rules
  @rotation_rules
end

#secret_idString (readonly)

The ARN or name of the secret to rotate. This is unique for each rotation schedule definition.

To reference a secret also created in this template, use the Ref function with the secret's logical ID.



39
40
41
# File 'secrets_manager/cfn_rotation_schedule_props.rb', line 39

def secret_id
  @secret_id
end

Class Method Details

.jsii_propertiesObject



98
99
100
101
102
103
104
105
106
107
108
# File 'secrets_manager/cfn_rotation_schedule_props.rb', line 98

def self.jsii_properties
  {
    :secret_id => "secretId",
    :external_secret_rotation_metadata => "externalSecretRotationMetadata",
    :external_secret_rotation_role_arn => "externalSecretRotationRoleArn",
    :hosted_rotation_lambda => "hostedRotationLambda",
    :rotate_immediately_on_update => "rotateImmediatelyOnUpdate",
    :rotation_lambda_arn => "rotationLambdaArn",
    :rotation_rules => "rotationRules",
  }
end

Instance Method Details

#to_jsiiObject



110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'secrets_manager/cfn_rotation_schedule_props.rb', line 110

def to_jsii
  result = {}
  result.merge!({
    "secretId" => @secret_id,
    "externalSecretRotationMetadata" => @external_secret_rotation_metadata,
    "externalSecretRotationRoleArn" => @external_secret_rotation_role_arn,
    "hostedRotationLambda" => @hosted_rotation_lambda,
    "rotateImmediatelyOnUpdate" => @rotate_immediately_on_update,
    "rotationLambdaArn" => @rotation_lambda_arn,
    "rotationRules" => @rotation_rules,
  })
  result.compact
end