connectDirectory method
- required DirectoryConnectSettings connectSettings,
- required String name,
- required String password,
- required DirectorySize size,
- String? description,
- String? shortName,
- List<
Tag> ? tags,
Creates an AD Connector to connect to an on-premises 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 AWS
Directory Service API Permissions: Actions, Resources, and Conditions
Reference.
May throw DirectoryLimitExceededException. May throw InvalidParameterException. May throw ClientException. May throw ServiceException.
Parameter connectSettings
:
A DirectoryConnectSettings object that contains additional
information for the operation.
Parameter name
:
The fully qualified name of the on-premises directory, such as
corp.example.com
.
Parameter password
:
The password for the on-premises user account.
Parameter size
:
The size of the directory.
Parameter description
:
A description for the directory.
Parameter shortName
:
The NetBIOS name of the on-premises 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,
String? shortName,
List<Tag>? tags,
}) async {
ArgumentError.checkNotNull(connectSettings, 'connectSettings');
ArgumentError.checkNotNull(name, 'name');
ArgumentError.checkNotNull(password, 'password');
_s.validateStringLength(
'password',
password,
1,
128,
isRequired: true,
);
ArgumentError.checkNotNull(size, 'size');
_s.validateStringLength(
'description',
description,
0,
128,
);
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.toValue(),
if (description != null) 'Description': description,
if (shortName != null) 'ShortName': shortName,
if (tags != null) 'Tags': tags,
},
);
return ConnectDirectoryResult.fromJson(jsonResponse.body);
}