Class: AWSCDK::Cognito::CfnUserPoolUserProps

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

Overview

Properties for defining a CfnUserPoolUser.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user_pool_id:, client_metadata: nil, desired_delivery_mediums: nil, force_alias_creation: nil, message_action: nil, user_attributes: nil, username: nil, validation_data: nil) ⇒ CfnUserPoolUserProps

Returns a new instance of CfnUserPoolUserProps.

Parameters:

  • user_pool_id (String, AWSCDK::Interfaces::AWSCognito::IUserPoolRef)

    The ID of the user pool where you want to create a user.

  • client_metadata (AWSCDK::IResolvable, Hash{String => String}, nil) (defaults to: nil)

    A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers.

  • desired_delivery_mediums (Array<String>, nil) (defaults to: nil)

    Specify EMAIL if email will be used to send the welcome message.

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

    This parameter is used only if the phone_number_verified or email_verified attribute is set to True .

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

    Set to RESEND to resend the invitation message to a user that already exists, and to reset the temporary-password duration with a new temporary password.

  • user_attributes (AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::Cognito::CfnUserPoolUser::AttributeTypeProperty>, nil) (defaults to: nil)

    An array of name-value pairs that contain user attributes and attribute values to be set for the user to be created.

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

    The value that you want to set as the username sign-in attribute.

  • validation_data (AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::Cognito::CfnUserPoolUser::AttributeTypeProperty>, nil) (defaults to: nil)

    Temporary user attributes that contribute to the outcomes of your pre sign-up Lambda trigger.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'cognito/cfn_user_pool_user_props.rb', line 17

def initialize(user_pool_id:, client_metadata: nil, desired_delivery_mediums: nil, force_alias_creation: nil, message_action: nil, user_attributes: nil, username: nil, validation_data: nil)
  @user_pool_id = user_pool_id
  Jsii::Type.check_type(@user_pool_id, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoic3RyaW5nIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19jb2duaXRvLklVc2VyUG9vbFJlZiJ9XX19")), "userPoolId")
  @client_metadata = 
  Jsii::Type.check_type(@client_metadata, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsicHJpbWl0aXZlIjoic3RyaW5nIn0sImtpbmQiOiJtYXAifX1dfX0=")), "clientMetadata") unless @client_metadata.nil?
  @desired_delivery_mediums = desired_delivery_mediums
  Jsii::Type.check_type(@desired_delivery_mediums, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "desiredDeliveryMediums") unless @desired_delivery_mediums.nil?
  @force_alias_creation = force_alias_creation
  Jsii::Type.check_type(@force_alias_creation, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "forceAliasCreation") unless @force_alias_creation.nil?
  @message_action = message_action
  Jsii::Type.check_type(@message_action, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "messageAction") unless @message_action.nil?
  @user_attributes = user_attributes
  Jsii::Type.check_type(@user_attributes, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29nbml0by5DZm5Vc2VyUG9vbFVzZXIuQXR0cmlidXRlVHlwZVByb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "userAttributes") unless @user_attributes.nil?
  @username = username
  Jsii::Type.check_type(@username, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "username") unless @username.nil?
  @validation_data = validation_data
  Jsii::Type.check_type(@validation_data, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29nbml0by5DZm5Vc2VyUG9vbFVzZXIuQXR0cmlidXRlVHlwZVByb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "validationData") unless @validation_data.nil?
end

Instance Attribute Details

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

A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers.

You create custom workflows by assigning AWS Lambda functions to user pool triggers.

When Amazon Cognito invokes any of these functions, it passes a JSON payload, which the function receives as input. This payload contains a client_metadata attribute that provides the data that you assigned to the ClientMetadata parameter in your request. In your function code, you can process the client_metadata value to enhance your workflow for your specific needs.

To review the Lambda trigger types that Amazon Cognito invokes at runtime with API requests, see Connecting API actions to Lambda triggers in the Amazon Cognito Developer Guide .

When you use the ClientMetadata parameter, note that Amazon Cognito won't do the following:

  • Store the ClientMetadata value. This data is available only to AWS Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.
  • Validate the ClientMetadata value.
  • Encrypt the ClientMetadata value. Don't send sensitive information in this parameter.


57
58
59
# File 'cognito/cfn_user_pool_user_props.rb', line 57

def 
  @client_metadata
end

#desired_delivery_mediumsArray<String>? (readonly)

Specify EMAIL if email will be used to send the welcome message.

Specify SMS if the phone number will be used. The default value is SMS . You can specify more than one value.



64
65
66
# File 'cognito/cfn_user_pool_user_props.rb', line 64

def desired_delivery_mediums
  @desired_delivery_mediums
end

#force_alias_creationBoolean, ... (readonly)

This parameter is used only if the phone_number_verified or email_verified attribute is set to True .

Otherwise, it is ignored.

If this parameter is set to True and the phone number or email address specified in the UserAttributes parameter already exists as an alias with a different user, this request migrates the alias from the previous user to the newly-created user. The previous user will no longer be able to log in using that alias.

If this parameter is set to False , the API throws an AliasExistsException error if the alias already exists. The default value is False .



75
76
77
# File 'cognito/cfn_user_pool_user_props.rb', line 75

def force_alias_creation
  @force_alias_creation
end

#message_actionString? (readonly)

Set to RESEND to resend the invitation message to a user that already exists, and to reset the temporary-password duration with a new temporary password.

Set to SUPPRESS to suppress sending the message. You can specify only one value.



82
83
84
# File 'cognito/cfn_user_pool_user_props.rb', line 82

def message_action
  @message_action
end

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

An array of name-value pairs that contain user attributes and attribute values to be set for the user to be created.

You can create a user without specifying any attributes other than Username . However, any attributes that you specify as required (when creating a user pool or in the Attributes tab of the console) either you should supply (in your call to AdminCreateUser ) or the user should supply (when they sign up in response to your welcome message).

For custom attributes, you must prepend the custom: prefix to the attribute name.

To send a message inviting the user to sign up, you must specify the user's email address or phone number. You can do this in your call to AdminCreateUser or in the Users tab of the Amazon Cognito console for managing your user pools.

You must also provide an email address or phone number when you expect the user to do passwordless sign-in with an email or SMS OTP. These attributes must be provided when passwordless options are the only available, or when you don't submit a TemporaryPassword .

In your call to AdminCreateUser , you can set the email_verified attribute to True , and you can set the phone_number_verified attribute to True .

  • email : The email address of the user to whom the message that contains the code and username will be sent. Required if the email_verified attribute is set to True , or if "EMAIL" is specified in the DesiredDeliveryMediums parameter.
  • phone_number : The phone number of the user to whom the message that contains the code and username will be sent. Required if the phone_number_verified attribute is set to True , or if "SMS" is specified in the DesiredDeliveryMediums parameter.


100
101
102
# File 'cognito/cfn_user_pool_user_props.rb', line 100

def user_attributes
  @user_attributes
end

#user_pool_idString, AWSCDK::Interfaces::AWSCognito::IUserPoolRef (readonly)

The ID of the user pool where you want to create a user.



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

def user_pool_id
  @user_pool_id
end

#usernameString? (readonly)

The value that you want to set as the username sign-in attribute.

The following conditions apply to the username parameter.

  • The username can't be a duplicate of another username in the same user pool.
  • You can't change the value of a username after you create it.
  • You can only provide a value if usernames are a valid sign-in attribute for your user pool. If your user pool only supports phone numbers or email addresses as sign-in attributes, Amazon Cognito automatically generates a username value. For more information, see Customizing sign-in attributes .


111
112
113
# File 'cognito/cfn_user_pool_user_props.rb', line 111

def username
  @username
end

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

Temporary user attributes that contribute to the outcomes of your pre sign-up Lambda trigger.

This set of key-value pairs are for custom validation of information that you collect from your users but don't need to retain.

Your Lambda function can analyze this additional data and act on it. Your function can automatically confirm and verify select users or perform external API operations like logging user attributes and validation data to Amazon CloudWatch Logs.

For more information about the pre sign-up Lambda trigger, see Pre sign-up Lambda trigger .



122
123
124
# File 'cognito/cfn_user_pool_user_props.rb', line 122

def validation_data
  @validation_data
end

Class Method Details

.jsii_propertiesObject



124
125
126
127
128
129
130
131
132
133
134
135
# File 'cognito/cfn_user_pool_user_props.rb', line 124

def self.jsii_properties
  {
    :user_pool_id => "userPoolId",
    :client_metadata => "clientMetadata",
    :desired_delivery_mediums => "desiredDeliveryMediums",
    :force_alias_creation => "forceAliasCreation",
    :message_action => "messageAction",
    :user_attributes => "userAttributes",
    :username => "username",
    :validation_data => "validationData",
  }
end

Instance Method Details

#to_jsiiObject



137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'cognito/cfn_user_pool_user_props.rb', line 137

def to_jsii
  result = {}
  result.merge!({
    "userPoolId" => @user_pool_id,
    "clientMetadata" => @client_metadata,
    "desiredDeliveryMediums" => @desired_delivery_mediums,
    "forceAliasCreation" => @force_alias_creation,
    "messageAction" => @message_action,
    "userAttributes" => @user_attributes,
    "username" => @username,
    "validationData" => @validation_data,
  })
  result.compact
end