Class: AWSCDK::Cognito::CfnUserPool::SchemaAttributeProperty

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

Overview

A list of the user attributes and their properties in your user pool.

The attribute schema contains standard attributes, custom attributes with a custom: prefix, and developer attributes with a dev: prefix. For more information, see User pool attributes .

Developer-only dev: attributes are a legacy feature of user pools, and are read-only to all app clients. You can create and update developer-only attributes only with IAM-authenticated API operations. Use app client read/write permissions instead.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attribute_data_type: nil, developer_only_attribute: nil, mutable: nil, name: nil, number_attribute_constraints: nil, required: nil, string_attribute_constraints: nil) ⇒ SchemaAttributeProperty

Returns a new instance of SchemaAttributeProperty.

Parameters:



1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
# File 'cognito/cfn_user_pool.rb', line 1915

def initialize(attribute_data_type: nil, developer_only_attribute: nil, mutable: nil, name: nil, number_attribute_constraints: nil, required: nil, string_attribute_constraints: nil)
  @attribute_data_type = attribute_data_type
  Jsii::Type.check_type(@attribute_data_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "attributeDataType") unless @attribute_data_type.nil?
  @developer_only_attribute = developer_only_attribute
  Jsii::Type.check_type(@developer_only_attribute, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "developerOnlyAttribute") unless @developer_only_attribute.nil?
  @mutable = mutable
  Jsii::Type.check_type(@mutable, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "mutable") unless @mutable.nil?
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name") unless @name.nil?
  @number_attribute_constraints = number_attribute_constraints.is_a?(Hash) ? ::AWSCDK::Cognito::CfnUserPool::NumberAttributeConstraintsProperty.new(**number_attribute_constraints.transform_keys(&:to_sym)) : number_attribute_constraints
  Jsii::Type.check_type(@number_attribute_constraints, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jb2duaXRvLkNmblVzZXJQb29sLk51bWJlckF0dHJpYnV0ZUNvbnN0cmFpbnRzUHJvcGVydHkifV19fQ==")), "numberAttributeConstraints") unless @number_attribute_constraints.nil?
  @required = required
  Jsii::Type.check_type(@required, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "required") unless @required.nil?
  @string_attribute_constraints = string_attribute_constraints.is_a?(Hash) ? ::AWSCDK::Cognito::CfnUserPool::StringAttributeConstraintsProperty.new(**string_attribute_constraints.transform_keys(&:to_sym)) : string_attribute_constraints
  Jsii::Type.check_type(@string_attribute_constraints, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jb2duaXRvLkNmblVzZXJQb29sLlN0cmluZ0F0dHJpYnV0ZUNvbnN0cmFpbnRzUHJvcGVydHkifV19fQ==")), "stringAttributeConstraints") unless @string_attribute_constraints.nil?
end

Instance Attribute Details

#attribute_data_typeString? (readonly)

The data format of the values for your attribute.

When you choose an AttributeDataType , Amazon Cognito validates the input against the data type. A custom attribute value in your user's ID token is always a string, for example "custom:isMember" : "true" or "custom:YearsAsMember" : "12" .



1938
1939
1940
# File 'cognito/cfn_user_pool.rb', line 1938

def attribute_data_type
  @attribute_data_type
end

#developer_only_attributeBoolean, ... (readonly)

You should use WriteAttributes in the user pool client to control how attributes can be mutated for new use cases instead of using DeveloperOnlyAttribute .

Specifies whether the attribute type is developer only. This attribute can only be modified by an administrator. Users won't be able to modify this attribute using their access token. For example, DeveloperOnlyAttribute can be modified using AdminUpdateUserAttributes but can't be updated using UpdateUserAttributes.



1945
1946
1947
# File 'cognito/cfn_user_pool.rb', line 1945

def developer_only_attribute
  @developer_only_attribute
end

#mutableBoolean, ... (readonly)

Specifies whether the value of the attribute can be changed.

Any user pool attribute whose value you map from an IdP attribute must be mutable, with a parameter value of true . Amazon Cognito updates mapped attributes when users sign in to your application through an IdP. If an attribute is immutable, Amazon Cognito throws an error when it attempts to update the attribute. For more information, see Specifying Identity Provider Attribute Mappings for Your User Pool .



1952
1953
1954
# File 'cognito/cfn_user_pool.rb', line 1952

def mutable
  @mutable
end

#nameString? (readonly)

The name of your user pool attribute.

When you create or update a user pool, adding a schema attribute creates a custom or developer-only attribute. When you add an attribute with a Name value of MyAttribute , Amazon Cognito creates the custom attribute custom:MyAttribute . When DeveloperOnlyAttribute is true , Amazon Cognito creates your attribute as dev:MyAttribute . In an operation that describes a user pool, Amazon Cognito returns this value as value for standard attributes, custom:value for custom attributes, and dev:value for developer-only attributes..



1959
1960
1961
# File 'cognito/cfn_user_pool.rb', line 1959

def name
  @name
end

#number_attribute_constraintsAWSCDK::IResolvable, ... (readonly)

Specifies the constraints for an attribute of the number type.



1964
1965
1966
# File 'cognito/cfn_user_pool.rb', line 1964

def number_attribute_constraints
  @number_attribute_constraints
end

#requiredBoolean, ... (readonly)

Specifies whether a user pool attribute is required.

If the attribute is required and the user doesn't provide a value, registration or sign-in will fail.



1971
1972
1973
# File 'cognito/cfn_user_pool.rb', line 1971

def required
  @required
end

#string_attribute_constraintsAWSCDK::IResolvable, ... (readonly)

Specifies the constraints for an attribute of the string type.



1976
1977
1978
# File 'cognito/cfn_user_pool.rb', line 1976

def string_attribute_constraints
  @string_attribute_constraints
end

Class Method Details

.jsii_propertiesObject



1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
# File 'cognito/cfn_user_pool.rb', line 1978

def self.jsii_properties
  {
    :attribute_data_type => "attributeDataType",
    :developer_only_attribute => "developerOnlyAttribute",
    :mutable => "mutable",
    :name => "name",
    :number_attribute_constraints => "numberAttributeConstraints",
    :required => "required",
    :string_attribute_constraints => "stringAttributeConstraints",
  }
end

Instance Method Details

#to_jsiiObject



1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
# File 'cognito/cfn_user_pool.rb', line 1990

def to_jsii
  result = {}
  result.merge!({
    "attributeDataType" => @attribute_data_type,
    "developerOnlyAttribute" => @developer_only_attribute,
    "mutable" => @mutable,
    "name" => @name,
    "numberAttributeConstraints" => @number_attribute_constraints,
    "required" => @required,
    "stringAttributeConstraints" => @string_attribute_constraints,
  })
  result.compact
end