class UserPoolGroup (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Cognito.UserPoolGroup |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awscognito#UserPoolGroup |
Java | software.amazon.awscdk.services.cognito.UserPoolGroup |
Python | aws_cdk.aws_cognito.UserPoolGroup |
TypeScript (source) | aws-cdk-lib » aws_cognito » UserPoolGroup |
Implements
IConstruct
, IDependable
, IResource
, IUser
Define a user pool group.
Example
declare const userPool: cognito.UserPool;
declare const role: iam.Role;
new cognito.UserPoolGroup(this, 'UserPoolGroup', {
userPool,
groupName: 'my-group-name',
precedence: 1,
role, // assign IAM Role
});
// You can also add a group by using addGroup method.
userPool.addGroup('AnotherUserPoolGroup', {
groupName: 'another-group-name'
});
Initializer
new UserPoolGroup(scope: Construct, id: string, props: UserPoolGroupProps)
Parameters
- scope
Construct
- id
string
- props
User
Pool Group Props
Construct Props
Name | Type | Description |
---|---|---|
user | IUser | The user pool to which this group is associated. |
description? | string | A string containing the description of the group. |
group | string | The name of the group. |
precedence? | number | A non-negative integer value that specifies the precedence of this group relative to the other groups that a user can belong to in the user pool. |
role? | IRole | The role for the group. |
userPool
Type:
IUser
The user pool to which this group is associated.
description?
Type:
string
(optional, default: no description)
A string containing the description of the group.
groupName?
Type:
string
(optional, default: auto generate a name)
The name of the group.
Must be unique.
precedence?
Type:
number
(optional, default: null)
A non-negative integer value that specifies the precedence of this group relative to the other groups that a user can belong to in the user pool.
Zero is the highest precedence value.
Groups with lower Precedence values take precedence over groups with higher or null Precedence values. If a user belongs to two or more groups, it is the group with the lowest precedence value whose role ARN is given in the user's tokens for the cognito:roles and cognito:preferred_role claims.
Two groups can have the same Precedence value. If this happens, neither group takes precedence over the other. If two groups with the same Precedence have the same role ARN, that role is used in the cognito:preferred_role claim in tokens for users in each group. If the two groups have different role ARNs, the cognito:preferred_role claim isn't set in users' tokens.
role?
Type:
IRole
(optional, default: no description)
The role for the group.
Properties
Name | Type | Description |
---|---|---|
env | Resource | The environment this resource belongs to. |
group | string | The user group name. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
groupName
Type:
string
The user group name.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | Import a UserPoolGroup given its group name. |
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
GroupName(scope, id, groupName)
static frompublic static fromGroupName(scope: Construct, id: string, groupName: string): IUserPoolGroup
Parameters
- scope
Construct
- id
string
- groupName
string
Returns
Import a UserPoolGroup given its group name.