Class: AWSCDK::Cognito::SignInAliases

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

Overview

The different ways in which users of this pool can sign up or sign in.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(email: nil, phone: nil, preferred_username: nil, username: nil) ⇒ SignInAliases

Returns a new instance of SignInAliases.

Parameters:

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

    Whether a user is allowed to sign up or sign in with an email address.

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

    Whether a user is allowed to sign up or sign in with a phone number.

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

    Whether a user is allowed to sign in with a secondary username, that can be set and modified after sign up.

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

    Whether user is allowed to sign up or sign in with a username.



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

def initialize(email: nil, phone: nil, preferred_username: nil, username: nil)
  @email = email
  Jsii::Type.check_type(@email, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "email") unless @email.nil?
  @phone = phone
  Jsii::Type.check_type(@phone, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "phone") unless @phone.nil?
  @preferred_username = preferred_username
  Jsii::Type.check_type(@preferred_username, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "preferredUsername") unless @preferred_username.nil?
  @username = username
  Jsii::Type.check_type(@username, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "username") unless @username.nil?
end

Instance Attribute Details

#emailBoolean? (readonly)

Note:

Default: false

Whether a user is allowed to sign up or sign in with an email address.

Returns:

  • (Boolean, nil)


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

def email
  @email
end

#phoneBoolean? (readonly)

Note:

Default: false

Whether a user is allowed to sign up or sign in with a phone number.

Returns:

  • (Boolean, nil)


31
32
33
# File 'cognito/sign_in_aliases.rb', line 31

def phone
  @phone
end

#preferred_usernameBoolean? (readonly)

Note:

Default: false

Whether a user is allowed to sign in with a secondary username, that can be set and modified after sign up.

Can only be used in conjunction with USERNAME.

Returns:

  • (Boolean, nil)


38
39
40
# File 'cognito/sign_in_aliases.rb', line 38

def preferred_username
  @preferred_username
end

#usernameBoolean? (readonly)

Note:

Default: true

Whether user is allowed to sign up or sign in with a username.

Returns:

  • (Boolean, nil)


43
44
45
# File 'cognito/sign_in_aliases.rb', line 43

def username
  @username
end

Class Method Details

.jsii_propertiesObject



45
46
47
48
49
50
51
52
# File 'cognito/sign_in_aliases.rb', line 45

def self.jsii_properties
  {
    :email => "email",
    :phone => "phone",
    :preferred_username => "preferredUsername",
    :username => "username",
  }
end

Instance Method Details

#to_jsiiObject



54
55
56
57
58
59
60
61
62
63
# File 'cognito/sign_in_aliases.rb', line 54

def to_jsii
  result = {}
  result.merge!({
    "email" => @email,
    "phone" => @phone,
    "preferredUsername" => @preferred_username,
    "username" => @username,
  })
  result.compact
end