createAlias method

Future<CreateAliasResult> createAlias({
  1. required String alias,
  2. required String directoryId,
})

Creates an alias for a directory and assigns the alias to the directory. The alias is used to construct the access URL for the directory, such as http://<alias>.awsapps.com.

May throw EntityAlreadyExistsException. May throw EntityDoesNotExistException. May throw InvalidParameterException. May throw ClientException. May throw ServiceException.

Parameter alias : The requested alias.

The alias must be unique amongst all aliases in AWS. This operation throws an EntityAlreadyExistsException error if the alias already exists.

Parameter directoryId : The identifier of the directory for which to create the alias.

Implementation

Future<CreateAliasResult> createAlias({
  required String alias,
  required String directoryId,
}) async {
  ArgumentError.checkNotNull(alias, 'alias');
  _s.validateStringLength(
    'alias',
    alias,
    1,
    62,
    isRequired: true,
  );
  ArgumentError.checkNotNull(directoryId, 'directoryId');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'DirectoryService_20150416.CreateAlias'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Alias': alias,
      'DirectoryId': directoryId,
    },
  );

  return CreateAliasResult.fromJson(jsonResponse.body);
}