Class: AWSCDK::SecretsManager::RotationScheduleProps

Inherits:
RotationScheduleOptions
  • Object
show all
Defined in:
secrets_manager/rotation_schedule_props.rb

Overview

Construction properties for a RotationSchedule.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(automatically_after: nil, hosted_rotation: nil, rotate_immediately_on_update: nil, rotation_lambda: nil, secret:) ⇒ RotationScheduleProps

Returns a new instance of RotationScheduleProps.

Parameters:

  • automatically_after (AWSCDK::Duration, nil) (defaults to: nil)

    Specifies the number of days after the previous rotation before Secrets Manager triggers the next automatic rotation.

  • hosted_rotation (AWSCDK::SecretsManager::HostedRotation, nil) (defaults to: nil)

    Hosted rotation.

  • rotate_immediately_on_update (Boolean, nil) (defaults to: nil)

    Specifies whether to rotate the secret immediately or wait until the next scheduled rotation window.

  • rotation_lambda (AWSCDK::Lambda::IFunction, nil) (defaults to: nil)

    A Lambda function that can rotate the secret.

  • secret (AWSCDK::SecretsManager::ISecret)

    The secret to rotate.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'secrets_manager/rotation_schedule_props.rb', line 12

def initialize(automatically_after: nil, hosted_rotation: nil, rotate_immediately_on_update: nil, rotation_lambda: nil, secret:)
  @automatically_after = automatically_after
  Jsii::Type.check_type(@automatically_after, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "automaticallyAfter") unless @automatically_after.nil?
  @hosted_rotation = hosted_rotation
  Jsii::Type.check_type(@hosted_rotation, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc2VjcmV0c21hbmFnZXIuSG9zdGVkUm90YXRpb24ifQ==")), "hostedRotation") unless @hosted_rotation.nil?
  @rotate_immediately_on_update = rotate_immediately_on_update
  Jsii::Type.check_type(@rotate_immediately_on_update, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "rotateImmediatelyOnUpdate") unless @rotate_immediately_on_update.nil?
  @rotation_lambda = rotation_lambda
  Jsii::Type.check_type(@rotation_lambda, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklGdW5jdGlvbiJ9")), "rotationLambda") unless @rotation_lambda.nil?
  @secret = secret
  Jsii::Type.check_type(@secret, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc2VjcmV0c21hbmFnZXIuSVNlY3JldCJ9")), "secret")
end

Instance Attribute Details

#automatically_afterAWSCDK::Duration? (readonly)

Note:

Default: Duration.days(30)

Specifies the number of days after the previous rotation before Secrets Manager triggers the next automatic rotation.

The minimum value is 4 hours. The maximum value is 1000 days.

A value of zero (Duration.days(0)) will not create RotationRules.

Returns:



34
35
36
# File 'secrets_manager/rotation_schedule_props.rb', line 34

def automatically_after
  @automatically_after
end

#hosted_rotationAWSCDK::SecretsManager::HostedRotation? (readonly)

Note:

Default: - either rotationLambda or hostedRotation must be specified

Hosted rotation.



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

def hosted_rotation
  @hosted_rotation
end

#rotate_immediately_on_updateBoolean? (readonly)

Note:

Default: true

Specifies whether to rotate the secret immediately or wait until the next scheduled rotation window.

Returns:

  • (Boolean, nil)


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

def rotate_immediately_on_update
  @rotate_immediately_on_update
end

#rotation_lambdaAWSCDK::Lambda::IFunction? (readonly)

Note:

Default: - either rotationLambda or hostedRotation must be specified

A Lambda function that can rotate the secret.

Returns:



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

def rotation_lambda
  @rotation_lambda
end

#secretAWSCDK::SecretsManager::ISecret (readonly)

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 an AWS::SecretsManager::SecretTargetAttachment or an ISecret returned by the attach() method of Secret.



70
71
72
# File 'secrets_manager/rotation_schedule_props.rb', line 70

def secret
  @secret
end

Class Method Details

.jsii_propertiesObject



72
73
74
75
76
77
78
79
80
# File 'secrets_manager/rotation_schedule_props.rb', line 72

def self.jsii_properties
  {
    :automatically_after => "automaticallyAfter",
    :hosted_rotation => "hostedRotation",
    :rotate_immediately_on_update => "rotateImmediatelyOnUpdate",
    :rotation_lambda => "rotationLambda",
    :secret => "secret",
  }
end

Instance Method Details

#to_jsiiObject



82
83
84
85
86
87
88
89
90
91
92
93
# File 'secrets_manager/rotation_schedule_props.rb', line 82

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "automaticallyAfter" => @automatically_after,
    "hostedRotation" => @hosted_rotation,
    "rotateImmediatelyOnUpdate" => @rotate_immediately_on_update,
    "rotationLambda" => @rotation_lambda,
    "secret" => @secret,
  })
  result.compact
end