updateGroup method
Updates the specified group with the specified attributes.
Calling this action requires developer credentials.
May throw ResourceNotFoundException. May throw InvalidParameterException. May throw TooManyRequestsException. May throw NotAuthorizedException. May throw InternalErrorException.
Parameter groupName
:
The name of the group.
Parameter userPoolId
:
The user pool ID for the user pool.
Parameter description
:
A string containing the new description of the group.
Parameter precedence
:
The new precedence value for the group. For more information about this
parameter, see CreateGroup.
Parameter roleArn
:
The new role ARN for the group. This is used for setting the
cognito:roles
and cognito:preferred_role
claims
in the token.
Implementation
Future<UpdateGroupResponse> updateGroup({
required String groupName,
required String userPoolId,
String? description,
int? precedence,
String? roleArn,
}) async {
ArgumentError.checkNotNull(groupName, 'groupName');
_s.validateStringLength(
'groupName',
groupName,
1,
128,
isRequired: true,
);
ArgumentError.checkNotNull(userPoolId, 'userPoolId');
_s.validateStringLength(
'userPoolId',
userPoolId,
1,
55,
isRequired: true,
);
_s.validateStringLength(
'description',
description,
0,
2048,
);
_s.validateNumRange(
'precedence',
precedence,
0,
1152921504606846976,
);
_s.validateStringLength(
'roleArn',
roleArn,
20,
2048,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSCognitoIdentityProviderService.UpdateGroup'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'GroupName': groupName,
'UserPoolId': userPoolId,
if (description != null) 'Description': description,
if (precedence != null) 'Precedence': precedence,
if (roleArn != null) 'RoleArn': roleArn,
},
);
return UpdateGroupResponse.fromJson(jsonResponse.body);
}