Skip to content

register_workspace_directory

register_workspace_directory(
    *,
    config_overrides: Optional[WorkSpacesClientConfig] = None,
    directory_id: Optional[DirectoryId] = None,
    subnet_ids: Optional[SubnetIds] = None,
    enable_self_service: Optional[BooleanObject] = None,
    tenancy: Optional[Tenancy] = None,
    tags: Optional[TagList] = None,
    workspace_directory_name: Optional[WorkspaceDirectoryName] = None,
    workspace_directory_description: Optional[WorkspaceDirectoryDescription] = None,
    user_identity_type: Optional[UserIdentityType] = None,
    idc_instance_arn: Optional[ARN] = None,
    microsoft_entra_config: Optional[MicrosoftEntraConfig] = None,
    workspace_type: Optional[WorkspaceType] = None,
    active_directory_config: Optional[ActiveDirectoryConfig] = None,
) -> RegisterWorkspaceDirectoryResult

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.

Parameters:

  • directory_id (Optional[DirectoryId], default: None ) –

    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.

  • subnet_ids (Optional[SubnetIds], default: None ) –

    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.

  • enable_self_service (Optional[BooleanObject], default: None ) –

    Indicates whether self-service capabilities are enabled or disabled.

  • tenancy (Optional[Tenancy], default: None ) –

    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.

  • tags (Optional[TagList], default: None ) –

    The tags associated with the directory.

  • workspace_directory_name (Optional[WorkspaceDirectoryName], default: None ) –

    The name of the directory to register.

  • workspace_directory_description (Optional[WorkspaceDirectoryDescription], default: None ) –

    Description of the directory to register.

  • user_identity_type (Optional[UserIdentityType], default: None ) –

    The type of identity management the user is using.

  • idc_instance_arn (Optional[ARN], default: None ) –

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

  • microsoft_entra_config (Optional[MicrosoftEntraConfig], default: None ) –

    The details about Microsoft Entra config.

  • workspace_type (Optional[WorkspaceType], default: None ) –

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

  • active_directory_config (Optional[ActiveDirectoryConfig], default: None ) –

    The active directory config of the directory.

Raises:

Source code in docs_src/capo_workspaces/_services/work_spaces.py
def register_workspace_directory(
    self,
    *,
    config_overrides: Optional[WorkSpacesClientConfig] = None,
    directory_id: Optional["capo_workspaces.types.directory_id.DirectoryId"] = None,
    subnet_ids: Optional["capo_workspaces.types.subnet_ids.SubnetIds"] = None,
    enable_self_service: Optional[
        "capo_workspaces.types.boolean_object.BooleanObject"
    ] = None,
    tenancy: Optional["capo_workspaces.types.tenancy.Tenancy"] = None,
    tags: Optional["capo_workspaces.types.tag_list.TagList"] = None,
    workspace_directory_name: Optional[
        "capo_workspaces.types.workspace_directory_name.WorkspaceDirectoryName"
    ] = None,
    workspace_directory_description: Optional[
        "capo_workspaces.types.workspace_directory_description.WorkspaceDirectoryDescription"
    ] = None,
    user_identity_type: Optional[
        "capo_workspaces.types.user_identity_type.UserIdentityType"
    ] = None,
    idc_instance_arn: Optional["capo_workspaces.types.arn.ARN"] = None,
    microsoft_entra_config: Optional[
        "capo_workspaces.types.microsoft_entra_config.MicrosoftEntraConfig"
    ] = None,
    workspace_type: Optional[
        "capo_workspaces.types.workspace_type.WorkspaceType"
    ] = None,
    active_directory_config: Optional[
        "capo_workspaces.types.active_directory_config.ActiveDirectoryConfig"
    ] = None,
) -> "capo_workspaces.types.register_workspace_directory_result.RegisterWorkspaceDirectoryResult":
    """<p>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 <a href="https://docs.aws.amazon.com/workspaces/latest/adminguide/workspaces-access-control.html#create-default-role"> Creating the workspaces_DefaultRole Role</a>.</p>

    Args:
        directory_id: <p>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.</p>
        subnet_ids: <p>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.</p>
        enable_self_service: <p>Indicates whether self-service capabilities are enabled or disabled.</p>
        tenancy: <p>Indicates whether your WorkSpace directory is dedicated or shared. To use Bring Your Own License (BYOL) images, this value must be set to <code>DEDICATED</code> 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 <a href="https://docs.aws.amazon.com/workspaces/latest/adminguide/byol-windows-images.html">Bring Your Own Windows Desktop Images</a>.</p>
        tags: <p>The tags associated with the directory.</p>
        workspace_directory_name: <p>The name of the directory to register.</p>
        workspace_directory_description: <p>Description of the directory to register.</p>
        user_identity_type: <p>The type of identity management the user is using.</p>
        idc_instance_arn: <p>The Amazon Resource Name (ARN) of the identity center instance.</p>
        microsoft_entra_config: <p>The details about Microsoft Entra config.</p>
        workspace_type: <p>Indicates whether the directory's WorkSpace type is personal or pools.</p>
        active_directory_config: <p>The active directory config of the directory.</p>

    Raises:
        capo_workspaces.errors.access_denied_exception.AccessDeniedException: <p>The user is not authorized to access a resource.</p>
        capo_workspaces.errors.invalid_parameter_values_exception.InvalidParameterValuesException: <p>One or more parameter values are not valid.</p>
        capo_workspaces.errors.invalid_resource_state_exception.InvalidResourceStateException: <p>The state of the resource is not valid for this operation.</p>
        capo_workspaces.errors.operation_not_supported_exception.OperationNotSupportedException: <p>This operation is not supported.</p>
        capo_workspaces.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The specified resource already exists.</p>
        capo_workspaces.errors.resource_limit_exceeded_exception.ResourceLimitExceededException: <p>Your resource limits have been exceeded.</p>
        capo_workspaces.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource could not be found.</p>
        capo_workspaces.errors.unsupported_network_configuration_exception.UnsupportedNetworkConfigurationException: <p>The configuration of this network is not supported for this operation, or your network configuration conflicts with the Amazon WorkSpaces management network IP range. For more information, see <a href="https://docs.aws.amazon.com/workspaces/latest/adminguide/amazon-workspaces-vpc.html"> Configure a VPC for Amazon WorkSpaces</a>.</p>
        capo_workspaces.errors.workspaces_default_role_not_found_exception.WorkspacesDefaultRoleNotFoundException: <p>The workspaces_DefaultRole role could not be found. 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 <a href="https://docs.aws.amazon.com/workspaces/latest/adminguide/workspaces-access-control.html#create-default-role">Creating the workspaces_DefaultRole Role</a>.</p>
        capo_workspaces.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_workspaces.types.register_workspace_directory_request.RegisterWorkspaceDirectoryRequest]",
    ) -> OperationResponse[
        "capo_workspaces.types.register_workspace_directory_result.RegisterWorkspaceDirectoryResult"
    ]:
        import capo_workspaces._operations.workspaces_service.register_workspace_directory

        output, http_response = (
            capo_workspaces._operations.workspaces_service.register_workspace_directory.register_workspace_directory(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RegisterWorkspaceDirectory")
    )
    input_: capo_workspaces.types.register_workspace_directory_request.RegisterWorkspaceDirectoryRequest = {}
    if directory_id is not None:
        input_["directory_id"] = directory_id
    if subnet_ids is not None:
        input_["subnet_ids"] = subnet_ids
    if enable_self_service is not None:
        input_["enable_self_service"] = enable_self_service
    if tenancy is not None:
        input_["tenancy"] = tenancy
    if tags is not None:
        input_["tags"] = tags
    if workspace_directory_name is not None:
        input_["workspace_directory_name"] = workspace_directory_name
    if workspace_directory_description is not None:
        input_["workspace_directory_description"] = workspace_directory_description
    if user_identity_type is not None:
        input_["user_identity_type"] = user_identity_type
    if idc_instance_arn is not None:
        input_["idc_instance_arn"] = idc_instance_arn
    if microsoft_entra_config is not None:
        input_["microsoft_entra_config"] = microsoft_entra_config
    if workspace_type is not None:
        input_["workspace_type"] = workspace_type
    if active_directory_config is not None:
        input_["active_directory_config"] = active_directory_config

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output