createGroup method
Creates a new group.
May throw AccessDeniedException.
May throw ConflictException.
May throw DirectoryUnavailableException.
May throw InternalServerException.
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 group scope.
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
value of each attribute.
Implementation
Future<CreateGroupResult> createGroup({
required String directoryId,
required String sAMAccountName,
String? clientToken,
GroupScope? groupScope,
GroupType? groupType,
Map<String, AttributeValue>? otherAttributes,
}) 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,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/Groups/CreateGroup',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return CreateGroupResult.fromJson(response);
}