Class: AWSCDK::CognitoIdentitypool::RoleMappingRule

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
cognito_identitypool/role_mapping_rule.rb

Overview

Represents an Identity Pool Role Attachment role mapping rule.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(claim:, claim_value:, mapped_role:, match_type: nil) ⇒ RoleMappingRule

Returns a new instance of RoleMappingRule.

Parameters:

  • claim (String)

    The key sent in the token by the federated Identity Provider.

  • claim_value (String)

    The value of the claim that must be matched.

  • mapped_role (AWSCDK::IAM::IRole)

    The role to be assumed when the claim value is matched.

  • match_type (AWSCDK::CognitoIdentitypool::RoleMappingMatchType, nil) (defaults to: nil)

    How to match with the claim value.



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

def initialize(claim:, claim_value:, mapped_role:, match_type: nil)
  @claim = claim
  Jsii::Type.check_type(@claim, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "claim")
  @claim_value = claim_value
  Jsii::Type.check_type(@claim_value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "claimValue")
  @mapped_role = mapped_role
  Jsii::Type.check_type(@mapped_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "mappedRole")
  @match_type = match_type
  Jsii::Type.check_type(@match_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29nbml0b19pZGVudGl0eXBvb2wuUm9sZU1hcHBpbmdNYXRjaFR5cGUifQ==")), "matchType") unless @match_type.nil?
end

Instance Attribute Details

#claimString (readonly)

The key sent in the token by the federated Identity Provider.

Returns:

  • (String)


25
26
27
# File 'cognito_identitypool/role_mapping_rule.rb', line 25

def claim
  @claim
end

#claim_valueString (readonly)

The value of the claim that must be matched.

Returns:

  • (String)


29
30
31
# File 'cognito_identitypool/role_mapping_rule.rb', line 29

def claim_value
  @claim_value
end

#mapped_roleAWSCDK::IAM::IRole (readonly)

The role to be assumed when the claim value is matched.

Returns:



33
34
35
# File 'cognito_identitypool/role_mapping_rule.rb', line 33

def mapped_role
  @mapped_role
end

#match_typeAWSCDK::CognitoIdentitypool::RoleMappingMatchType? (readonly)

Note:

Default: RoleMappingMatchType.EQUALS

How to match with the claim value.



38
39
40
# File 'cognito_identitypool/role_mapping_rule.rb', line 38

def match_type
  @match_type
end

Class Method Details

.jsii_propertiesObject



40
41
42
43
44
45
46
47
# File 'cognito_identitypool/role_mapping_rule.rb', line 40

def self.jsii_properties
  {
    :claim => "claim",
    :claim_value => "claimValue",
    :mapped_role => "mappedRole",
    :match_type => "matchType",
  }
end

Instance Method Details

#to_jsiiObject



49
50
51
52
53
54
55
56
57
58
# File 'cognito_identitypool/role_mapping_rule.rb', line 49

def to_jsii
  result = {}
  result.merge!({
    "claim" => @claim,
    "claimValue" => @claim_value,
    "mappedRole" => @mapped_role,
    "matchType" => @match_type,
  })
  result.compact
end