Class: AWSCDK::SecretsManager::SecretRotationProps

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

Overview

Construction properties for a SecretRotation.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(application:, secret:, target:, vpc:, automatically_after: nil, endpoint: nil, exclude_characters: nil, master_secret: nil, rotate_immediately_on_update: nil, security_group: nil, vpc_subnets: nil) ⇒ SecretRotationProps

Returns a new instance of SecretRotationProps.

Parameters:

  • application (AWSCDK::SecretsManager::SecretRotationApplication)

    The serverless application for the rotation.

  • secret (AWSCDK::SecretsManager::ISecret)

    The secret to rotate. It must be a JSON string with the following format:.

  • target (AWSCDK::EC2::IConnectable)

    The target service or database.

  • vpc (AWSCDK::EC2::IVPC)

    The VPC where the Lambda rotation function will run.

  • 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.

  • endpoint (AWSCDK::EC2::IInterfaceVPCEndpoint, nil) (defaults to: nil)

    The VPC interface endpoint to use for the Secrets Manager API.

  • exclude_characters (String, nil) (defaults to: nil)

    Characters which should not appear in the generated password.

  • master_secret (AWSCDK::SecretsManager::ISecret, nil) (defaults to: nil)

    The master secret for a multi user rotation scheme.

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

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

  • security_group (AWSCDK::EC2::ISecurityGroup, nil) (defaults to: nil)

    The security group for the Lambda rotation function.

  • vpc_subnets (AWSCDK::EC2::SubnetSelection, nil) (defaults to: nil)

    The type of subnets in the VPC where the Lambda rotation function will run.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'secrets_manager/secret_rotation_props.rb', line 18

def initialize(application:, secret:, target:, vpc:, automatically_after: nil, endpoint: nil, exclude_characters: nil, master_secret: nil, rotate_immediately_on_update: nil, security_group: nil, vpc_subnets: nil)
  @application = application
  Jsii::Type.check_type(@application, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc2VjcmV0c21hbmFnZXIuU2VjcmV0Um90YXRpb25BcHBsaWNhdGlvbiJ9")), "application")
  @secret = secret
  Jsii::Type.check_type(@secret, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc2VjcmV0c21hbmFnZXIuSVNlY3JldCJ9")), "secret")
  @target = target
  Jsii::Type.check_type(@target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklDb25uZWN0YWJsZSJ9")), "target")
  @vpc = vpc
  Jsii::Type.check_type(@vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc")
  @automatically_after = automatically_after
  Jsii::Type.check_type(@automatically_after, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "automaticallyAfter") unless @automatically_after.nil?
  @endpoint = endpoint
  Jsii::Type.check_type(@endpoint, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklJbnRlcmZhY2VWcGNFbmRwb2ludCJ9")), "endpoint") unless @endpoint.nil?
  @exclude_characters = exclude_characters
  Jsii::Type.check_type(@exclude_characters, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "excludeCharacters") unless @exclude_characters.nil?
  @master_secret = master_secret
  Jsii::Type.check_type(@master_secret, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfc2VjcmV0c21hbmFnZXIuSVNlY3JldCJ9")), "masterSecret") unless @master_secret.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?
  @security_group = security_group
  Jsii::Type.check_type(@security_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklTZWN1cml0eUdyb3VwIn0=")), "securityGroup") unless @security_group.nil?
  @vpc_subnets = vpc_subnets.is_a?(Hash) ? ::AWSCDK::EC2::SubnetSelection.new(**vpc_subnets.transform_keys(&:to_sym)) : vpc_subnets
  Jsii::Type.check_type(@vpc_subnets, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlN1Ym5ldFNlbGVjdGlvbiJ9")), "vpcSubnets") unless @vpc_subnets.nil?
end

Instance Attribute Details

#applicationAWSCDK::SecretsManager::SecretRotationApplication (readonly)

The serverless application for the rotation.



46
47
48
# File 'secrets_manager/secret_rotation_props.rb', line 46

def application
  @application
end

#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.

Returns:



79
80
81
# File 'secrets_manager/secret_rotation_props.rb', line 79

def automatically_after
  @automatically_after
end

#endpointAWSCDK::EC2::IInterfaceVPCEndpoint? (readonly)

Note:

Default: https://secretsmanager..amazonaws.com

The VPC interface endpoint to use for the Secrets Manager API.

If you enable private DNS hostnames for your VPC private endpoint (the default), you don't need to specify an endpoint. The standard Secrets Manager DNS hostname the Secrets Manager CLI and SDKs use by default (https://secretsmanager..amazonaws.com) automatically resolves to your VPC endpoint.



89
90
91
# File 'secrets_manager/secret_rotation_props.rb', line 89

def endpoint
  @endpoint
end

#exclude_charactersString? (readonly)

Note:

Default: - no additional characters are explicitly excluded

Characters which should not appear in the generated password.

Returns:

  • (String, nil)


94
95
96
# File 'secrets_manager/secret_rotation_props.rb', line 94

def exclude_characters
  @exclude_characters
end

#master_secretAWSCDK::SecretsManager::ISecret? (readonly)

Note:

Default: - single user rotation scheme

The master secret for a multi user rotation scheme.



99
100
101
# File 'secrets_manager/secret_rotation_props.rb', line 99

def master_secret
  @master_secret
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)


104
105
106
# File 'secrets_manager/secret_rotation_props.rb', line 104

def rotate_immediately_on_update
  @rotate_immediately_on_update
end

#secretAWSCDK::SecretsManager::ISecret (readonly)

The secret to rotate. It 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.



66
67
68
# File 'secrets_manager/secret_rotation_props.rb', line 66

def secret
  @secret
end

#security_groupAWSCDK::EC2::ISecurityGroup? (readonly)

Note:

Default: - a new security group is created

The security group for the Lambda rotation function.

Returns:



109
110
111
# File 'secrets_manager/secret_rotation_props.rb', line 109

def security_group
  @security_group
end

#targetAWSCDK::EC2::IConnectable (readonly)

The target service or database.



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

def target
  @target
end

#vpcAWSCDK::EC2::IVPC (readonly)

The VPC where the Lambda rotation function will run.

Returns:



74
75
76
# File 'secrets_manager/secret_rotation_props.rb', line 74

def vpc
  @vpc
end

#vpc_subnetsAWSCDK::EC2::SubnetSelection? (readonly)

Note:

Default: - the Vpc default strategy if not specified.

The type of subnets in the VPC where the Lambda rotation function will run.



114
115
116
# File 'secrets_manager/secret_rotation_props.rb', line 114

def vpc_subnets
  @vpc_subnets
end

Class Method Details

.jsii_propertiesObject



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'secrets_manager/secret_rotation_props.rb', line 116

def self.jsii_properties
  {
    :application => "application",
    :secret => "secret",
    :target => "target",
    :vpc => "vpc",
    :automatically_after => "automaticallyAfter",
    :endpoint => "endpoint",
    :exclude_characters => "excludeCharacters",
    :master_secret => "masterSecret",
    :rotate_immediately_on_update => "rotateImmediatelyOnUpdate",
    :security_group => "securityGroup",
    :vpc_subnets => "vpcSubnets",
  }
end

Instance Method Details

#to_jsiiObject



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'secrets_manager/secret_rotation_props.rb', line 132

def to_jsii
  result = {}
  result.merge!({
    "application" => @application,
    "secret" => @secret,
    "target" => @target,
    "vpc" => @vpc,
    "automaticallyAfter" => @automatically_after,
    "endpoint" => @endpoint,
    "excludeCharacters" => @exclude_characters,
    "masterSecret" => @master_secret,
    "rotateImmediatelyOnUpdate" => @rotate_immediately_on_update,
    "securityGroup" => @security_group,
    "vpcSubnets" => @vpc_subnets,
  })
  result.compact
end