updateGroup method

Future<void> updateGroup({
  1. required String directoryId,
  2. required String sAMAccountName,
  3. String? clientToken,
  4. GroupScope? groupScope,
  5. GroupType? groupType,
  6. Map<String, AttributeValue>? otherAttributes,
  7. UpdateType? updateType,
})

Updates group information.

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 group.

Parameter sAMAccountName : The name of 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 groupScope : The scope of the AD group. For details, see Active Directory security groups.

Parameter groupType : The AD group type. For details, see Active Directory security group type.

Parameter otherAttributes : An expression that defines one or more attributes with the data type and the value of each attribute.

Parameter updateType : The type of update to be performed. If no value exists for the attribute, use ADD. Otherwise, use REPLACE to change an attribute value or REMOVE to clear the attribute value.

Implementation

Future<void> updateGroup({
  required String directoryId,
  required String sAMAccountName,
  String? clientToken,
  GroupScope? groupScope,
  GroupType? groupType,
  Map<String, AttributeValue>? otherAttributes,
  UpdateType? updateType,
}) async {
  final $query = <String, List<String>>{
    'DirectoryId': [directoryId],
  };
  final $payload = <String, dynamic>{
    'SAMAccountName': sAMAccountName,
    'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (groupScope != null) 'GroupScope': groupScope.value,
    if (groupType != null) 'GroupType': groupType.value,
    if (otherAttributes != null) 'OtherAttributes': otherAttributes,
    if (updateType != null) 'UpdateType': updateType.value,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/Groups/UpdateGroup',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
}