removeGroupMember method

Future<void> removeGroupMember({
  1. required String directoryId,
  2. required String groupName,
  3. required String memberName,
  4. String? clientToken,
  5. String? memberRealm,
})

Removes a member from a group.

May throw AccessDeniedException. May throw ConflictException. May throw DirectoryUnavailableException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter directoryId : The identifier (ID) of the directory that's associated with the member.

Parameter groupName : The name of the group.

Parameter memberName : The SAMAccountName of the user, group, or computer to remove from the group.

Parameter clientToken : A unique and case-sensitive identifier that you provide to make sure the idempotency of the request, so multiple identical calls have the same effect as one single call.

A client token is valid for 8 hours after the first request that uses it completes. After 8 hours, any request with the same client token is treated as a new request. If the request succeeds, any future uses of that token will be idempotent for another 8 hours.

If you submit a request with the same client token but change one of the other parameters within the 8-hour idempotency window, Directory Service Data returns an ConflictException.

Parameter memberRealm : The domain name that's associated with the group member. This parameter defaults to the Managed Microsoft AD domain.

Implementation

Future<void> removeGroupMember({
  required String directoryId,
  required String groupName,
  required String memberName,
  String? clientToken,
  String? memberRealm,
}) async {
  final $query = <String, List<String>>{
    'DirectoryId': [directoryId],
  };
  final $payload = <String, dynamic>{
    'GroupName': groupName,
    'MemberName': memberName,
    'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (memberRealm != null) 'MemberRealm': memberRealm,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/GroupMemberships/RemoveGroupMember',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
}