createDirectory method

Future<CreateDirectoryResponse> createDirectory({
  1. required String name,
  2. required String schemaArn,
})

Creates a Directory by copying the published schema into the directory. A directory cannot be created without a schema.

May throw InternalServiceException. May throw InvalidArnException. May throw RetryableConflictException. May throw ValidationException. May throw LimitExceededException. May throw AccessDeniedException. May throw DirectoryAlreadyExistsException. May throw ResourceNotFoundException.

Parameter name : The name of the Directory. Should be unique per account, per region.

Parameter schemaArn : The Amazon Resource Name (ARN) of the published schema that will be copied into the data Directory. For more information, see arns.

Implementation

Future<CreateDirectoryResponse> createDirectory({
  required String name,
  required String schemaArn,
}) async {
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(schemaArn, 'schemaArn');
  final headers = <String, String>{
    'x-amz-data-partition': schemaArn.toString(),
  };
  final $payload = <String, dynamic>{
    'Name': name,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/amazonclouddirectory/2017-01-11/directory/create',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return CreateDirectoryResponse.fromJson(response);
}