Class: AWSCDK::Cognito::CustomAttributeConfig

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
cognito/custom_attribute_config.rb

Overview

Configuration that will be fed into CloudFormation for any custom attribute type.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data_type:, mutable: nil, number_constraints: nil, string_constraints: nil) ⇒ CustomAttributeConfig

Returns a new instance of CustomAttributeConfig.

Parameters:

  • data_type (String)

    The data type of the custom attribute.

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

    Specifies whether the value of the attribute can be changed.

  • number_constraints (AWSCDK::Cognito::NumberAttributeConstraints, nil) (defaults to: nil)

    The constraints for a custom attribute of the 'Number' data type.

  • string_constraints (AWSCDK::Cognito::StringAttributeConstraints, nil) (defaults to: nil)

    The constraints for a custom attribute of 'String' data type.



11
12
13
14
15
16
17
18
19
20
# File 'cognito/custom_attribute_config.rb', line 11

def initialize(data_type:, mutable: nil, number_constraints: nil, string_constraints: nil)
  @data_type = data_type
  Jsii::Type.check_type(@data_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "dataType")
  @mutable = mutable
  Jsii::Type.check_type(@mutable, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "mutable") unless @mutable.nil?
  @number_constraints = number_constraints.is_a?(Hash) ? ::AWSCDK::Cognito::NumberAttributeConstraints.new(**number_constraints.transform_keys(&:to_sym)) : number_constraints
  Jsii::Type.check_type(@number_constraints, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29nbml0by5OdW1iZXJBdHRyaWJ1dGVDb25zdHJhaW50cyJ9")), "numberConstraints") unless @number_constraints.nil?
  @string_constraints = string_constraints.is_a?(Hash) ? ::AWSCDK::Cognito::StringAttributeConstraints.new(**string_constraints.transform_keys(&:to_sym)) : string_constraints
  Jsii::Type.check_type(@string_constraints, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29nbml0by5TdHJpbmdBdHRyaWJ1dGVDb25zdHJhaW50cyJ9")), "stringConstraints") unless @string_constraints.nil?
end

Instance Attribute Details

#data_typeString (readonly)

The data type of the custom attribute.



26
27
28
# File 'cognito/custom_attribute_config.rb', line 26

def data_type
  @data_type
end

#mutableBoolean? (readonly)

Note:

Default: false

Specifies whether the value of the attribute can be changed.

For any user pool attribute that's mapped to an identity provider attribute, you must set this parameter to true. Amazon Cognito updates mapped attributes when users sign in to your application through an identity provider. If an attribute is immutable, Amazon Cognito throws an error when it attempts to update the attribute.

Returns:

  • (Boolean, nil)


35
36
37
# File 'cognito/custom_attribute_config.rb', line 35

def mutable
  @mutable
end

#number_constraintsAWSCDK::Cognito::NumberAttributeConstraints? (readonly)

Note:

Default: - None.

The constraints for a custom attribute of the 'Number' data type.



40
41
42
# File 'cognito/custom_attribute_config.rb', line 40

def number_constraints
  @number_constraints
end

#string_constraintsAWSCDK::Cognito::StringAttributeConstraints? (readonly)

Note:

Default: - None.

The constraints for a custom attribute of 'String' data type.



45
46
47
# File 'cognito/custom_attribute_config.rb', line 45

def string_constraints
  @string_constraints
end

Class Method Details

.jsii_propertiesObject



47
48
49
50
51
52
53
54
# File 'cognito/custom_attribute_config.rb', line 47

def self.jsii_properties
  {
    :data_type => "dataType",
    :mutable => "mutable",
    :number_constraints => "numberConstraints",
    :string_constraints => "stringConstraints",
  }
end

Instance Method Details

#to_jsiiObject



56
57
58
59
60
61
62
63
64
65
# File 'cognito/custom_attribute_config.rb', line 56

def to_jsii
  result = {}
  result.merge!({
    "dataType" => @data_type,
    "mutable" => @mutable,
    "numberConstraints" => @number_constraints,
    "stringConstraints" => @string_constraints,
  })
  result.compact
end