createGroup method

Future<CreateGroupResponse> createGroup({
  1. required String name,
  2. required String organizationId,
})

Creates a group that can be used in Amazon WorkMail by calling the RegisterToWorkMail operation.

May throw DirectoryServiceAuthenticationFailedException. May throw DirectoryUnavailableException. May throw InvalidParameterException. May throw NameAvailabilityException. May throw OrganizationNotFoundException. May throw OrganizationStateException. May throw ReservedNameException. May throw UnsupportedOperationException.

Parameter name : The name of the group.

Parameter organizationId : The organization under which the group is to be created.

Implementation

Future<CreateGroupResponse> createGroup({
  required String name,
  required String organizationId,
}) async {
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(organizationId, 'organizationId');
  _s.validateStringLength(
    'organizationId',
    organizationId,
    34,
    34,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'WorkMailService.CreateGroup'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Name': name,
      'OrganizationId': organizationId,
    },
  );

  return CreateGroupResponse.fromJson(jsonResponse.body);
}