Skip to content

update_safety_lever_state async

update_safety_lever_state(
    id: SafetyLeverId,
    state: UpdateSafetyLeverStateInput,
    *,
    config_overrides: Optional[AsyncfisClientConfig] = None,
) -> UpdateSafetyLeverStateResponse

Updates the specified safety lever state.

Parameters:

Raises:

Source code in docs_src/capo_fis/_services/async_fis.py
async def update_safety_lever_state(
    self,
    id: "capo_fis.types.safety_lever_id.SafetyLeverId",
    state: "capo_fis.types.update_safety_lever_state_input.UpdateSafetyLeverStateInput",
    *,
    config_overrides: Optional[AsyncfisClientConfig] = None,
) -> "capo_fis.types.update_safety_lever_state_response.UpdateSafetyLeverStateResponse":
    """<p> Updates the specified safety lever state. </p>

    Args:
        id: <p> The ID of the safety lever. </p>
        state: <p> The state of the safety lever. </p>

    Raises:
        capo_fis.errors.conflict_exception.ConflictException: <p>The request could not be processed because of a conflict.</p>
        capo_fis.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource cannot be found.</p>
        capo_fis.errors.validation_exception.ValidationException: <p>The specified input is not valid, or fails to satisfy the constraints for the request.</p>
        capo_fis.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_fis.types.update_safety_lever_state_request.UpdateSafetyLeverStateRequest]",
    ) -> AsyncOperationResponse[
        "capo_fis.types.update_safety_lever_state_response.UpdateSafetyLeverStateResponse"
    ]:
        import capo_fis._operations.fault_injection_simulator.update_safety_lever_state

        (
            output,
            http_response,
        ) = await capo_fis._operations.fault_injection_simulator.update_safety_lever_state.async_update_safety_lever_state(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateSafetyLeverState")
    )
    input_: capo_fis.types.update_safety_lever_state_request.UpdateSafetyLeverStateRequest = {
        "id": id,
        "state": state,
    }

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