createDirectoryConfig method

Future<CreateDirectoryConfigResult> createDirectoryConfig({
  1. required String directoryName,
  2. required List<String> organizationalUnitDistinguishedNames,
  3. ServiceAccountCredentials? serviceAccountCredentials,
})

Creates a Directory Config object in AppStream 2.0. This object includes the configuration information required to join fleets and image builders to Microsoft Active Directory domains.

May throw ResourceNotFoundException. May throw ResourceAlreadyExistsException. May throw LimitExceededException. May throw InvalidAccountStatusException. May throw OperationNotPermittedException. May throw InvalidRoleException.

Parameter directoryName : The fully qualified name of the directory (for example, corp.example.com).

Parameter organizationalUnitDistinguishedNames : The distinguished names of the organizational units for computer accounts.

Parameter serviceAccountCredentials : The credentials for the service account used by the fleet or image builder to connect to the directory.

Implementation

Future<CreateDirectoryConfigResult> createDirectoryConfig({
  required String directoryName,
  required List<String> organizationalUnitDistinguishedNames,
  ServiceAccountCredentials? serviceAccountCredentials,
}) async {
  ArgumentError.checkNotNull(directoryName, 'directoryName');
  ArgumentError.checkNotNull(organizationalUnitDistinguishedNames,
      'organizationalUnitDistinguishedNames');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'PhotonAdminProxyService.CreateDirectoryConfig'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DirectoryName': directoryName,
      'OrganizationalUnitDistinguishedNames':
          organizationalUnitDistinguishedNames,
      if (serviceAccountCredentials != null)
        'ServiceAccountCredentials': serviceAccountCredentials,
    },
  );

  return CreateDirectoryConfigResult.fromJson(jsonResponse.body);
}