Class: AWSCDK::SecretsManager::SecretStringGenerator
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::SecretsManager::SecretStringGenerator
- Defined in:
- secrets_manager/secret_string_generator.rb
Overview
Configuration to generate secrets such as passwords automatically.
Instance Attribute Summary collapse
-
#exclude_characters ⇒ String?
readonly
A string that includes characters that shouldn't be included in the generated password.
-
#exclude_lowercase ⇒ Boolean?
readonly
Specifies that the generated password shouldn't include lowercase letters.
-
#exclude_numbers ⇒ Boolean?
readonly
Specifies that the generated password shouldn't include digits.
-
#exclude_punctuation ⇒ Boolean?
readonly
Specifies that the generated password shouldn't include punctuation characters.
-
#exclude_uppercase ⇒ Boolean?
readonly
Specifies that the generated password shouldn't include uppercase letters.
-
#generate_string_key ⇒ String?
readonly
The JSON key name that's used to add the generated password to the JSON structure specified by the
secretStringTemplateparameter. -
#include_space ⇒ Boolean?
readonly
Specifies that the generated password can include the space character.
-
#password_length ⇒ Numeric?
readonly
The desired length of the generated password.
-
#require_each_included_type ⇒ Boolean?
readonly
Specifies whether the generated password must include at least one of every allowed character type.
-
#secret_string_template ⇒ String?
readonly
A properly structured JSON string that the generated password can be added to.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(exclude_characters: nil, exclude_lowercase: nil, exclude_numbers: nil, exclude_punctuation: nil, exclude_uppercase: nil, generate_string_key: nil, include_space: nil, password_length: nil, require_each_included_type: nil, secret_string_template: nil) ⇒ SecretStringGenerator
constructor
A new instance of SecretStringGenerator.
- #to_jsii ⇒ Object
Constructor Details
#initialize(exclude_characters: nil, exclude_lowercase: nil, exclude_numbers: nil, exclude_punctuation: nil, exclude_uppercase: nil, generate_string_key: nil, include_space: nil, password_length: nil, require_each_included_type: nil, secret_string_template: nil) ⇒ SecretStringGenerator
Returns a new instance of SecretStringGenerator.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'secrets_manager/secret_string_generator.rb', line 17 def initialize(exclude_characters: nil, exclude_lowercase: nil, exclude_numbers: nil, exclude_punctuation: nil, exclude_uppercase: nil, generate_string_key: nil, include_space: nil, password_length: nil, require_each_included_type: nil, secret_string_template: nil) @exclude_characters = exclude_characters Jsii::Type.check_type(@exclude_characters, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "excludeCharacters") unless @exclude_characters.nil? @exclude_lowercase = exclude_lowercase Jsii::Type.check_type(@exclude_lowercase, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "excludeLowercase") unless @exclude_lowercase.nil? @exclude_numbers = exclude_numbers Jsii::Type.check_type(@exclude_numbers, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "excludeNumbers") unless @exclude_numbers.nil? @exclude_punctuation = exclude_punctuation Jsii::Type.check_type(@exclude_punctuation, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "excludePunctuation") unless @exclude_punctuation.nil? @exclude_uppercase = exclude_uppercase Jsii::Type.check_type(@exclude_uppercase, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "excludeUppercase") unless @exclude_uppercase.nil? @generate_string_key = generate_string_key Jsii::Type.check_type(@generate_string_key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "generateStringKey") unless @generate_string_key.nil? @include_space = include_space Jsii::Type.check_type(@include_space, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "includeSpace") unless @include_space.nil? @password_length = password_length Jsii::Type.check_type(@password_length, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "passwordLength") unless @password_length.nil? @require_each_included_type = require_each_included_type Jsii::Type.check_type(@require_each_included_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "requireEachIncludedType") unless @require_each_included_type.nil? @secret_string_template = secret_string_template Jsii::Type.check_type(@secret_string_template, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "secretStringTemplate") unless @secret_string_template.nil? end |
Instance Attribute Details
#exclude_characters ⇒ String? (readonly)
Default: no exclusions
A string that includes characters that shouldn't be included in the generated password.
The string can be a minimum
of 0 and a maximum of 4096 characters long.
47 48 49 |
# File 'secrets_manager/secret_string_generator.rb', line 47 def exclude_characters @exclude_characters end |
#exclude_lowercase ⇒ Boolean? (readonly)
Default: false
Specifies that the generated password shouldn't include lowercase letters.
52 53 54 |
# File 'secrets_manager/secret_string_generator.rb', line 52 def exclude_lowercase @exclude_lowercase end |
#exclude_numbers ⇒ Boolean? (readonly)
Default: false
Specifies that the generated password shouldn't include digits.
57 58 59 |
# File 'secrets_manager/secret_string_generator.rb', line 57 def exclude_numbers @exclude_numbers end |
#exclude_punctuation ⇒ Boolean? (readonly)
Default: false
Specifies that the generated password shouldn't include punctuation characters.
62 63 64 |
# File 'secrets_manager/secret_string_generator.rb', line 62 def exclude_punctuation @exclude_punctuation end |
#exclude_uppercase ⇒ Boolean? (readonly)
Default: false
Specifies that the generated password shouldn't include uppercase letters.
67 68 69 |
# File 'secrets_manager/secret_string_generator.rb', line 67 def exclude_uppercase @exclude_uppercase end |
#generate_string_key ⇒ String? (readonly)
The JSON key name that's used to add the generated password to the JSON structure specified by the secretStringTemplate parameter.
If you specify generate_string_key then secret_string_template
must be also be specified.
74 75 76 |
# File 'secrets_manager/secret_string_generator.rb', line 74 def generate_string_key @generate_string_key end |
#include_space ⇒ Boolean? (readonly)
Default: false
Specifies that the generated password can include the space character.
79 80 81 |
# File 'secrets_manager/secret_string_generator.rb', line 79 def include_space @include_space end |
#password_length ⇒ Numeric? (readonly)
Default: 32
The desired length of the generated password.
84 85 86 |
# File 'secrets_manager/secret_string_generator.rb', line 84 def password_length @password_length end |
#require_each_included_type ⇒ Boolean? (readonly)
Default: true
Specifies whether the generated password must include at least one of every allowed character type.
89 90 91 |
# File 'secrets_manager/secret_string_generator.rb', line 89 def require_each_included_type @require_each_included_type end |
#secret_string_template ⇒ String? (readonly)
A properly structured JSON string that the generated password can be added to.
The generate_string_key is
combined with the generated random string and inserted into the JSON structure that's specified by this parameter.
The merged JSON string is returned as the completed SecretString of the secret. If you specify secret_string_template
then generate_string_key must be also be specified.
98 99 100 |
# File 'secrets_manager/secret_string_generator.rb', line 98 def secret_string_template @secret_string_template end |
Class Method Details
.jsii_properties ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'secrets_manager/secret_string_generator.rb', line 100 def self.jsii_properties { :exclude_characters => "excludeCharacters", :exclude_lowercase => "excludeLowercase", :exclude_numbers => "excludeNumbers", :exclude_punctuation => "excludePunctuation", :exclude_uppercase => "excludeUppercase", :generate_string_key => "generateStringKey", :include_space => "includeSpace", :password_length => "passwordLength", :require_each_included_type => "requireEachIncludedType", :secret_string_template => "secretStringTemplate", } end |
Instance Method Details
#to_jsii ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'secrets_manager/secret_string_generator.rb', line 115 def to_jsii result = {} result.merge!({ "excludeCharacters" => @exclude_characters, "excludeLowercase" => @exclude_lowercase, "excludeNumbers" => @exclude_numbers, "excludePunctuation" => @exclude_punctuation, "excludeUppercase" => @exclude_uppercase, "generateStringKey" => @generate_string_key, "includeSpace" => @include_space, "passwordLength" => @password_length, "requireEachIncludedType" => @require_each_included_type, "secretStringTemplate" => @secret_string_template, }) result.compact end |