Skip to content

modify_workspace_state async

modify_workspace_state(
    workspace_id: WorkspaceId,
    workspace_state: TargetWorkspaceState,
    *,
    config_overrides: Optional[AsyncWorkSpacesClientConfig] = None,
) -> ModifyWorkspaceStateResult

Sets the state of the specified WorkSpace.

To maintain a WorkSpace without being interrupted, set the WorkSpace state to ADMIN_MAINTENANCE. WorkSpaces in this state do not respond to requests to reboot, stop, start, rebuild, or restore. An AutoStop WorkSpace in this state is not stopped. Users cannot log into a WorkSpace in the ADMIN_MAINTENANCE state.

Parameters:

Raises:

Source code in docs_src/capo_workspaces/_services/async_work_spaces.py
async def modify_workspace_state(
    self,
    workspace_id: "capo_workspaces.types.workspace_id.WorkspaceId",
    workspace_state: "capo_workspaces.types.target_workspace_state.TargetWorkspaceState",
    *,
    config_overrides: Optional[AsyncWorkSpacesClientConfig] = None,
) -> (
    "capo_workspaces.types.modify_workspace_state_result.ModifyWorkspaceStateResult"
):
    """<p>Sets the state of the specified WorkSpace.</p> <p>To maintain a WorkSpace without being interrupted, set the WorkSpace state to <code>ADMIN_MAINTENANCE</code>. WorkSpaces in this state do not respond to requests to reboot, stop, start, rebuild, or restore. An AutoStop WorkSpace in this state is not stopped. Users cannot log into a WorkSpace in the <code>ADMIN_MAINTENANCE</code> state.</p>

    Args:
        workspace_id: <p>The identifier of the WorkSpace.</p>
        workspace_state: <p>The WorkSpace state.</p>

    Raises:
        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_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.modify_workspace_state_request.ModifyWorkspaceStateRequest]",
    ) -> AsyncOperationResponse[
        "capo_workspaces.types.modify_workspace_state_result.ModifyWorkspaceStateResult"
    ]:
        import capo_workspaces._operations.workspaces_service.modify_workspace_state

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ModifyWorkspaceState")
    )
    input_: capo_workspaces.types.modify_workspace_state_request.ModifyWorkspaceStateRequest = {
        "workspace_id": workspace_id,
        "workspace_state": workspace_state,
    }

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