deleteGroup method

Future<void> deleteGroup({
  1. required String groupName,
  2. required String userPoolId,
})

Deletes a group from the specified user pool. When you delete a group, that group no longer contributes to users' cognito:preferred_group or cognito:groups claims, and no longer influence access-control decision that are based on group membership. For more information about user pool groups, see Adding groups to a user pool.

Learn more

May throw InternalErrorException. May throw InvalidParameterException. May throw NotAuthorizedException. May throw OperationNotEnabledException. May throw ResourceNotFoundException. May throw TooManyRequestsException.

Parameter groupName : The name of the group that you want to delete.

Parameter userPoolId : The ID of the user pool where you want to delete the group.

Implementation

Future<void> deleteGroup({
  required String groupName,
  required String userPoolId,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSCognitoIdentityProviderService.DeleteGroup'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'GroupName': groupName,
      'UserPoolId': userPoolId,
    },
  );
}