Class: AWSCDK::SecretsManager::CfnSecret::GenerateSecretStringProperty

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

Overview

Generates a random password.

We recommend that you specify the maximum length and include every character type that the system you are generating a password for can support.

Required permissions: secretsmanager:GetRandomPassword . For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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) ⇒ GenerateSecretStringProperty

Returns a new instance of GenerateSecretStringProperty.

Parameters:

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

    A string of the characters that you don't want in the password.

  • exclude_lowercase (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Specifies whether to exclude lowercase letters from the password.

  • exclude_numbers (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Specifies whether to exclude numbers from the password.

  • exclude_punctuation (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Specifies whether to exclude the following punctuation characters from the password: `!

  • exclude_uppercase (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Specifies whether to exclude uppercase letters from the password.

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

    The JSON key name for the key/value pair, where the value is the generated password.

  • include_space (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Specifies whether to include the space character.

  • password_length (Numeric, nil) (defaults to: nil)

    The length of the password.

  • require_each_included_type (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Specifies whether to include at least one upper and lowercase letter, one number, and one punctuation.

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

    A template that the generated string must match.



647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
# File 'secrets_manager/cfn_secret.rb', line 647

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("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "excludeLowercase") unless @exclude_lowercase.nil?
  @exclude_numbers = exclude_numbers
  Jsii::Type.check_type(@exclude_numbers, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "excludeNumbers") unless @exclude_numbers.nil?
  @exclude_punctuation = exclude_punctuation
  Jsii::Type.check_type(@exclude_punctuation, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "excludePunctuation") unless @exclude_punctuation.nil?
  @exclude_uppercase = exclude_uppercase
  Jsii::Type.check_type(@exclude_uppercase, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "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("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "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("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "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_charactersString? (readonly)

A string of the characters that you don't want in the password.



674
675
676
# File 'secrets_manager/cfn_secret.rb', line 674

def exclude_characters
  @exclude_characters
end

#exclude_lowercaseBoolean, ... (readonly)

Specifies whether to exclude lowercase letters from the password.

If you don't include this switch, the password can contain lowercase letters.



681
682
683
# File 'secrets_manager/cfn_secret.rb', line 681

def exclude_lowercase
  @exclude_lowercase
end

#exclude_numbersBoolean, ... (readonly)

Specifies whether to exclude numbers from the password.

If you don't include this switch, the password can contain numbers.



688
689
690
# File 'secrets_manager/cfn_secret.rb', line 688

def exclude_numbers
  @exclude_numbers
end

#exclude_punctuationBoolean, ... (readonly)

Specifies whether to exclude the following punctuation characters from the password: `!

" # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ { | } ~ . If you don't include this switch, the password can contain punctuation.



695
696
697
# File 'secrets_manager/cfn_secret.rb', line 695

def exclude_punctuation
  @exclude_punctuation
end

#exclude_uppercaseBoolean, ... (readonly)

Specifies whether to exclude uppercase letters from the password.

If you don't include this switch, the password can contain uppercase letters.



702
703
704
# File 'secrets_manager/cfn_secret.rb', line 702

def exclude_uppercase
  @exclude_uppercase
end

#generate_string_keyString? (readonly)

The JSON key name for the key/value pair, where the value is the generated password.

This pair is added to the JSON structure specified by the SecretStringTemplate parameter. If you specify this parameter, then you must also specify SecretStringTemplate .



709
710
711
# File 'secrets_manager/cfn_secret.rb', line 709

def generate_string_key
  @generate_string_key
end

#include_spaceBoolean, ... (readonly)

Specifies whether to include the space character.

If you include this switch, the password can contain space characters.



716
717
718
# File 'secrets_manager/cfn_secret.rb', line 716

def include_space
  @include_space
end

#password_lengthNumeric? (readonly)

The length of the password.

If you don't include this parameter, the default length is 32 characters.



723
724
725
# File 'secrets_manager/cfn_secret.rb', line 723

def password_length
  @password_length
end

#require_each_included_typeBoolean, ... (readonly)

Specifies whether to include at least one upper and lowercase letter, one number, and one punctuation.

If you don't include this switch, the password contains at least one of every character type.



730
731
732
# File 'secrets_manager/cfn_secret.rb', line 730

def require_each_included_type
  @require_each_included_type
end

#secret_string_templateString? (readonly)

A template that the generated string must match.

When you make a change to this property, a new secret version is created.



737
738
739
# File 'secrets_manager/cfn_secret.rb', line 737

def secret_string_template
  @secret_string_template
end

Class Method Details

.jsii_propertiesObject



739
740
741
742
743
744
745
746
747
748
749
750
751
752
# File 'secrets_manager/cfn_secret.rb', line 739

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_jsiiObject



754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
# File 'secrets_manager/cfn_secret.rb', line 754

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