registerWorkspaceDirectory method

Future<void> registerWorkspaceDirectory({
  1. required String directoryId,
  2. required bool enableWorkDocs,
  3. bool? enableSelfService,
  4. List<String>? subnetIds,
  5. List<Tag>? tags,
  6. Tenancy? tenancy,
})

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 InvalidParameterValuesException. May throw ResourceNotFoundException. May throw ResourceLimitExceededException. May throw AccessDeniedException. May throw WorkspacesDefaultRoleNotFoundException. May throw InvalidResourceStateException. May throw UnsupportedNetworkConfigurationException. May throw OperationNotSupportedException.

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 enableWorkDocs : Indicates whether Amazon WorkDocs is enabled or disabled. If you have enabled this parameter and WorkDocs is not available in the Region, you will receive an OperationNotSupportedException error. Set EnableWorkDocs to disabled, and try again.

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

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 AWS 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.

Implementation

Future<void> registerWorkspaceDirectory({
  required String directoryId,
  required bool enableWorkDocs,
  bool? enableSelfService,
  List<String>? subnetIds,
  List<Tag>? tags,
  Tenancy? tenancy,
}) async {
  ArgumentError.checkNotNull(directoryId, 'directoryId');
  _s.validateStringLength(
    'directoryId',
    directoryId,
    10,
    65,
    isRequired: true,
  );
  ArgumentError.checkNotNull(enableWorkDocs, 'enableWorkDocs');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'WorkspacesService.RegisterWorkspaceDirectory'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DirectoryId': directoryId,
      'EnableWorkDocs': enableWorkDocs,
      if (enableSelfService != null) 'EnableSelfService': enableSelfService,
      if (subnetIds != null) 'SubnetIds': subnetIds,
      if (tags != null) 'Tags': tags,
      if (tenancy != null) 'Tenancy': tenancy.toValue(),
    },
  );
}