Skip to content

terminate_workspaces async

terminate_workspaces(
    terminate_workspace_requests: TerminateWorkspaceRequests,
    *,
    config_overrides: Optional[AsyncWorkSpacesClientConfig] = None,
) -> TerminateWorkspacesResult

Terminates the specified WorkSpaces.

Terminating a WorkSpace is a permanent action and cannot be undone. The user's data is destroyed. If you need to archive any user data, contact Amazon Web Services Support before terminating the WorkSpace.

You can terminate a WorkSpace that is in any state except SUSPENDED.

This operation is asynchronous and returns before the WorkSpaces have been completely terminated. After a WorkSpace is terminated, the TERMINATED state is returned only briefly before the WorkSpace directory metadata is cleaned up, so this state is rarely returned. To confirm that a WorkSpace is terminated, check for the WorkSpace ID by using DescribeWorkSpaces. If the WorkSpace ID isn't returned, then the WorkSpace has been successfully terminated.

Simple AD and AD Connector are made available to you free of charge to use with WorkSpaces. If there are no WorkSpaces being used with your Simple AD or AD Connector directory for 30 consecutive days, this directory will be automatically deregistered for use with Amazon WorkSpaces, and you will be charged for this directory as per the Directory Service pricing terms.

To delete empty directories, see Delete the Directory for Your WorkSpaces. If you delete your Simple AD or AD Connector directory, you can always create a new one when you want to start using WorkSpaces again.

Parameters:

Raises:

Source code in docs_src/capo_workspaces/_services/async_work_spaces.py
async def terminate_workspaces(
    self,
    terminate_workspace_requests: "capo_workspaces.types.terminate_workspace_requests.TerminateWorkspaceRequests",
    *,
    config_overrides: Optional[AsyncWorkSpacesClientConfig] = None,
) -> "capo_workspaces.types.terminate_workspaces_result.TerminateWorkspacesResult":
    """<p>Terminates the specified WorkSpaces.</p> <important> <p>Terminating a WorkSpace is a permanent action and cannot be undone. The user's data is destroyed. If you need to archive any user data, contact Amazon Web Services Support before terminating the WorkSpace.</p> </important> <p>You can terminate a WorkSpace that is in any state except <code>SUSPENDED</code>.</p> <p>This operation is asynchronous and returns before the WorkSpaces have been completely terminated. After a WorkSpace is terminated, the <code>TERMINATED</code> state is returned only briefly before the WorkSpace directory metadata is cleaned up, so this state is rarely returned. To confirm that a WorkSpace is terminated, check for the WorkSpace ID by using <a href="https://docs.aws.amazon.com/workspaces/latest/api/API_DescribeWorkspaces.html"> DescribeWorkSpaces</a>. If the WorkSpace ID isn't returned, then the WorkSpace has been successfully terminated.</p> <note> <p>Simple AD and AD Connector are made available to you free of charge to use with WorkSpaces. If there are no WorkSpaces being used with your Simple AD or AD Connector directory for 30 consecutive days, this directory will be automatically deregistered for use with Amazon WorkSpaces, and you will be charged for this directory as per the <a href="http://aws.amazon.com/directoryservice/pricing/">Directory Service pricing terms</a>.</p> <p>To delete empty directories, see <a href="https://docs.aws.amazon.com/workspaces/latest/adminguide/delete-workspaces-directory.html"> Delete the Directory for Your WorkSpaces</a>. If you delete your Simple AD or AD Connector directory, you can always create a new one when you want to start using WorkSpaces again.</p> </note>

    Args:
        terminate_workspace_requests: <p>The WorkSpaces to terminate. You can specify up to 25 WorkSpaces.</p>

    Raises:
        capo_workspaces.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_workspaces.types.terminate_workspaces_request.TerminateWorkspacesRequest]",
    ) -> AsyncOperationResponse[
        "capo_workspaces.types.terminate_workspaces_result.TerminateWorkspacesResult"
    ]:
        import capo_workspaces._operations.workspaces_service.terminate_workspaces

        (
            output,
            http_response,
        ) = await capo_workspaces._operations.workspaces_service.terminate_workspaces.async_terminate_workspaces(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("TerminateWorkspaces")
    )
    input_: capo_workspaces.types.terminate_workspaces_request.TerminateWorkspacesRequest = {
        "terminate_workspace_requests": terminate_workspace_requests
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output