Skip to content

restore_workspace async

restore_workspace(
    workspace_id: WorkspaceId,
    *,
    config_overrides: Optional[AsyncWorkSpacesClientConfig] = None,
) -> RestoreWorkspaceResult

Restores the specified WorkSpace to its last known healthy state.

You cannot restore a WorkSpace unless its state is AVAILABLE, ERROR, UNHEALTHY, or STOPPED.

Restoring a WorkSpace is a potentially destructive action that can result in the loss of data. For more information, see Restore a WorkSpace.

This operation is asynchronous and returns before the WorkSpace is completely restored.

Parameters:

  • workspace_id (WorkspaceId) –

    The identifier of the WorkSpace.

Raises:

Source code in docs_src/capo_workspaces/_services/async_work_spaces.py
async def restore_workspace(
    self,
    workspace_id: "capo_workspaces.types.workspace_id.WorkspaceId",
    *,
    config_overrides: Optional[AsyncWorkSpacesClientConfig] = None,
) -> "capo_workspaces.types.restore_workspace_result.RestoreWorkspaceResult":
    """<p>Restores the specified WorkSpace to its last known healthy state.</p> <p>You cannot restore a WorkSpace unless its state is <code> AVAILABLE</code>, <code>ERROR</code>, <code>UNHEALTHY</code>, or <code>STOPPED</code>.</p> <p>Restoring a WorkSpace is a potentially destructive action that can result in the loss of data. For more information, see <a href="https://docs.aws.amazon.com/workspaces/latest/adminguide/restore-workspace.html">Restore a WorkSpace</a>.</p> <p>This operation is asynchronous and returns before the WorkSpace is completely restored.</p>

    Args:
        workspace_id: <p>The identifier of the WorkSpace.</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.operation_not_supported_exception.OperationNotSupportedException: <p>This operation is not supported.</p>
        capo_workspaces.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource could not be found.</p>
        capo_workspaces.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_workspaces.types.restore_workspace_request.RestoreWorkspaceRequest]",
    ) -> AsyncOperationResponse[
        "capo_workspaces.types.restore_workspace_result.RestoreWorkspaceResult"
    ]:
        import capo_workspaces._operations.workspaces_service.restore_workspace

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RestoreWorkspace")
    )
    input_: capo_workspaces.types.restore_workspace_request.RestoreWorkspaceRequest = {
        "workspace_id": workspace_id
    }

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