modifyUserGroup method

Future<UserGroup> modifyUserGroup({
  1. required String userGroupId,
  2. List<String>? userIdsToAdd,
  3. List<String>? userIdsToRemove,
})

Changes the list of users that belong to the user group.

May throw UserGroupNotFoundFault. May throw UserNotFoundFault. May throw DuplicateUserNameFault. May throw DefaultUserRequired. May throw InvalidUserGroupStateFault. May throw InvalidParameterValueException. May throw InvalidParameterCombinationException.

Parameter userGroupId : The ID of the user group.

Parameter userIdsToAdd : The list of user IDs to add to the user group.

Parameter userIdsToRemove : The list of user IDs to remove from the user group.

Implementation

Future<UserGroup> modifyUserGroup({
  required String userGroupId,
  List<String>? userIdsToAdd,
  List<String>? userIdsToRemove,
}) async {
  ArgumentError.checkNotNull(userGroupId, 'userGroupId');
  final $request = <String, dynamic>{};
  $request['UserGroupId'] = userGroupId;
  userIdsToAdd?.also((arg) => $request['UserIdsToAdd'] = arg);
  userIdsToRemove?.also((arg) => $request['UserIdsToRemove'] = arg);
  final $result = await _protocol.send(
    $request,
    action: 'ModifyUserGroup',
    version: '2015-02-02',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['ModifyUserGroupMessage'],
    shapes: shapes,
    resultWrapper: 'ModifyUserGroupResult',
  );
  return UserGroup.fromXml($result);
}