registerWorkspaceDirectory method

Future<RegisterWorkspaceDirectoryResult> registerWorkspaceDirectory({
  1. ActiveDirectoryConfig? activeDirectoryConfig,
  2. String? directoryId,
  3. bool? enableSelfService,
  4. String? idcInstanceArn,
  5. MicrosoftEntraConfig? microsoftEntraConfig,
  6. List<String>? subnetIds,
  7. List<Tag>? tags,
  8. Tenancy? tenancy,
  9. UserIdentityType? userIdentityType,
  10. String? workspaceDirectoryDescription,
  11. String? workspaceDirectoryName,
  12. WorkspaceType? workspaceType,
})

Registers the specified directory. This operation is asynchronous and returns before the WorkSpace directory is registered. If this is the first time you are registering a directory, you will need to create the workspaces_DefaultRole role before you can register a directory. For more information, see Creating the workspaces_DefaultRole Role.

May throw AccessDeniedException. May throw InvalidParameterValuesException. May throw InvalidResourceStateException. May throw OperationNotSupportedException. May throw ResourceAlreadyExistsException. May throw ResourceLimitExceededException. May throw ResourceNotFoundException. May throw UnsupportedNetworkConfigurationException. May throw WorkspacesDefaultRoleNotFoundException.

Parameter activeDirectoryConfig : The active directory config of the directory.

Parameter directoryId : The identifier of the directory. You cannot register a directory if it does not have a status of Active. If the directory does not have a status of Active, you will receive an InvalidResourceStateException error. If you have already registered the maximum number of directories that you can register with Amazon WorkSpaces, you will receive a ResourceLimitExceededException error. Deregister directories that you are not using for WorkSpaces, and try again.

Parameter enableSelfService : Indicates whether self-service capabilities are enabled or disabled.

Parameter idcInstanceArn : The Amazon Resource Name (ARN) of the identity center instance.

Parameter microsoftEntraConfig : The details about Microsoft Entra config.

Parameter subnetIds : The identifiers of the subnets for your virtual private cloud (VPC). Make sure that the subnets are in supported Availability Zones. The subnets must also be in separate Availability Zones. If these conditions are not met, you will receive an OperationNotSupportedException error.

Parameter tags : The tags associated with the directory.

Parameter tenancy : Indicates whether your WorkSpace directory is dedicated or shared. To use Bring Your Own License (BYOL) images, this value must be set to DEDICATED and your Amazon Web Services account must be enabled for BYOL. If your account has not been enabled for BYOL, you will receive an InvalidParameterValuesException error. For more information about BYOL images, see Bring Your Own Windows Desktop Images.

Parameter userIdentityType : The type of identity management the user is using.

Parameter workspaceDirectoryDescription : Description of the directory to register.

Parameter workspaceDirectoryName : The name of the directory to register.

Parameter workspaceType : Indicates whether the directory's WorkSpace type is personal or pools.

Implementation

Future<RegisterWorkspaceDirectoryResult> registerWorkspaceDirectory({
  ActiveDirectoryConfig? activeDirectoryConfig,
  String? directoryId,
  bool? enableSelfService,
  String? idcInstanceArn,
  MicrosoftEntraConfig? microsoftEntraConfig,
  List<String>? subnetIds,
  List<Tag>? tags,
  Tenancy? tenancy,
  UserIdentityType? userIdentityType,
  String? workspaceDirectoryDescription,
  String? workspaceDirectoryName,
  WorkspaceType? workspaceType,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'WorkspacesService.RegisterWorkspaceDirectory'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (activeDirectoryConfig != null)
        'ActiveDirectoryConfig': activeDirectoryConfig,
      if (directoryId != null) 'DirectoryId': directoryId,
      if (enableSelfService != null) 'EnableSelfService': enableSelfService,
      if (idcInstanceArn != null) 'IdcInstanceArn': idcInstanceArn,
      if (microsoftEntraConfig != null)
        'MicrosoftEntraConfig': microsoftEntraConfig,
      if (subnetIds != null) 'SubnetIds': subnetIds,
      if (tags != null) 'Tags': tags,
      if (tenancy != null) 'Tenancy': tenancy.value,
      if (userIdentityType != null)
        'UserIdentityType': userIdentityType.value,
      if (workspaceDirectoryDescription != null)
        'WorkspaceDirectoryDescription': workspaceDirectoryDescription,
      if (workspaceDirectoryName != null)
        'WorkspaceDirectoryName': workspaceDirectoryName,
      if (workspaceType != null) 'WorkspaceType': workspaceType.value,
    },
  );

  return RegisterWorkspaceDirectoryResult.fromJson(jsonResponse.body);
}