Skip to content
v2.278.0

RoleMappingRule Struct ​

Represents an Identity Pool Role Attachment role mapping rule.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_cognito_identitypool as cognito_identitypool } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';

declare const role: iam.Role;
const roleMappingRule: cognito_identitypool.RoleMappingRule = {
  claim: 'claim',
  claimValue: 'claimValue',
  mappedRole: role,

  // the properties below are optional
  matchType: cognito_identitypool.RoleMappingMatchType.EQUALS,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_cognito_identitypool as cognito_identitypool
from aws_cdk import aws_iam as iam

# role: iam.Role

role_mapping_rule = cognito_identitypool.RoleMappingRule(
    claim="claim",
    claim_value="claimValue",
    mapped_role=role,

    # the properties below are optional
    match_type=cognito_identitypool.RoleMappingMatchType.EQUALS
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.cognito.identitypool.*;
import software.amazon.awscdk.services.iam.*;

Role role;

RoleMappingRule roleMappingRule = RoleMappingRule.builder()
        .claim("claim")
        .claimValue("claimValue")
        .mappedRole(role)

        // the properties below are optional
        .matchType(RoleMappingMatchType.EQUALS)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Cognito.Identitypool;
using Amazon.CDK.AWS.IAM;

Role role;

var roleMappingRule = new RoleMappingRule {
    Claim = "claim",
    ClaimValue = "claimValue",
    MappedRole = role,

    // the properties below are optional
    MatchType = RoleMappingMatchType.EQUALS
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var role Role

roleMappingRule := &RoleMappingRule{
	Claim: jsii.String("claim"),
	ClaimValue: jsii.String("claimValue"),
	MappedRole: role,

	// the properties below are optional
	MatchType: awscdk.Aws_cognito_identitypool.RoleMappingMatchType_EQUALS,
}

Properties ​

claimstringclaimstrclaimStringClaimstringClaim*string required #
The key sent in the token by the federated Identity Provider.
claimValuestringclaim_valuestrclaimValueStringClaimValuestringClaimValue*string required #
The value of the claim that must be matched.
mappedRoleIRolemapped_roleIRolemappedRoleIRoleMappedRoleIRoleMappedRoleIRole required #
The role to be assumed when the claim value is matched.
matchTypeoptionalRoleMappingMatchTypematch_typeoptionalRoleMappingMatchTypematchTypeoptionalRoleMappingMatchTypeMatchTypeoptionalRoleMappingMatchTypeMatchTypeoptionalRoleMappingMatchType = RoleMappingMatchType.EQUALS #
How to match with the claim value.