connectDirectory method

Future<ConnectDirectoryResult> connectDirectory({
  1. required DirectoryConnectSettings connectSettings,
  2. required String name,
  3. required String password,
  4. required DirectorySize size,
  5. String? description,
  6. NetworkType? networkType,
  7. String? shortName,
  8. List<Tag>? tags,
})

Creates an AD Connector to connect to a self-managed directory.

Before you call ConnectDirectory, ensure that all of the required permissions have been explicitly granted through a policy. For details about what permissions are required to run the ConnectDirectory operation, see Directory Service API Permissions: Actions, Resources, and Conditions Reference.

May throw ClientException. May throw DirectoryLimitExceededException. May throw InvalidParameterException. May throw ServiceException.

Parameter connectSettings : A DirectoryConnectSettings object that contains additional information for the operation.

Parameter name : The fully qualified name of your self-managed directory, such as corp.example.com.

Parameter password : The password for your self-managed user account.

Parameter size : The size of the directory.

Parameter description : A description for the directory.

Parameter networkType : The network type for your directory. The default value is IPv4 or IPv6 based on the provided subnet capabilities.

Parameter shortName : The NetBIOS name of your self-managed directory, such as CORP.

Parameter tags : The tags to be assigned to AD Connector.

Implementation

Future<ConnectDirectoryResult> connectDirectory({
  required DirectoryConnectSettings connectSettings,
  required String name,
  required String password,
  required DirectorySize size,
  String? description,
  NetworkType? networkType,
  String? shortName,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'DirectoryService_20150416.ConnectDirectory'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ConnectSettings': connectSettings,
      'Name': name,
      'Password': password,
      'Size': size.value,
      if (description != null) 'Description': description,
      if (networkType != null) 'NetworkType': networkType.value,
      if (shortName != null) 'ShortName': shortName,
      if (tags != null) 'Tags': tags,
    },
  );

  return ConnectDirectoryResult.fromJson(jsonResponse.body);
}