Skip to content

update_thing_shadow async

update_thing_shadow(
    thing_name: ThingName,
    payload: JsonDocument,
    *,
    config_overrides: Optional[AsyncIoTDataPlaneClientConfig] = None,
    shadow_name: Optional[ShadowName] = None,
) -> UpdateThingShadowResponse

Updates the shadow for the specified thing.

Requires permission to access the UpdateThingShadow action.

For more information, see UpdateThingShadow in the IoT Developer Guide.

Parameters:

  • thing_name (ThingName) –

    The name of the thing.

  • shadow_name (Optional[ShadowName], default: None ) –

    The name of the shadow.

  • payload (JsonDocument) –

    The state information, in JSON format.

Raises:

Source code in docs_src/capo_iot_data_plane/_services/async_io_t_data_plane.py
async def update_thing_shadow(
    self,
    thing_name: "capo_iot_data_plane.types.thing_name.ThingName",
    payload: "capo_iot_data_plane.types.json_document.JsonDocument",
    *,
    config_overrides: Optional[AsyncIoTDataPlaneClientConfig] = None,
    shadow_name: Optional[
        "capo_iot_data_plane.types.shadow_name.ShadowName"
    ] = None,
) -> "capo_iot_data_plane.types.update_thing_shadow_response.UpdateThingShadowResponse":
    """<p>Updates the shadow for the specified thing.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">UpdateThingShadow</a> action.</p> <p>For more information, see <a href="http://docs.aws.amazon.com/iot/latest/developerguide/API_UpdateThingShadow.html">UpdateThingShadow</a> in the IoT Developer Guide.</p>

    Args:
        thing_name: <p>The name of the thing.</p>
        shadow_name: <p>The name of the shadow.</p>
        payload: <p>The state information, in JSON format.</p>

    Raises:
        capo_iot_data_plane.errors.conflict_exception.ConflictException: <p>The specified version does not match the version of the document.</p>
        capo_iot_data_plane.errors.internal_failure_exception.InternalFailureException: <p>An unexpected error has occurred.</p>
        capo_iot_data_plane.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_iot_data_plane.errors.method_not_allowed_exception.MethodNotAllowedException: <p>The specified combination of HTTP verb and URI is not supported.</p>
        capo_iot_data_plane.errors.request_entity_too_large_exception.RequestEntityTooLargeException: <p>The payload exceeds the maximum size allowed.</p>
        capo_iot_data_plane.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is temporarily unavailable.</p>
        capo_iot_data_plane.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot_data_plane.errors.unauthorized_exception.UnauthorizedException: <p>You are not authorized to perform this operation.</p>
        capo_iot_data_plane.errors.unsupported_document_encoding_exception.UnsupportedDocumentEncodingException: <p>The document encoding is not supported.</p>
        capo_iot_data_plane.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iot_data_plane.types.update_thing_shadow_request.UpdateThingShadowRequest]",
    ) -> AsyncOperationResponse[
        "capo_iot_data_plane.types.update_thing_shadow_response.UpdateThingShadowResponse"
    ]:
        import capo_iot_data_plane._operations.iot_moonraker_service.update_thing_shadow

        (
            output,
            http_response,
        ) = await capo_iot_data_plane._operations.iot_moonraker_service.update_thing_shadow.async_update_thing_shadow(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateThingShadow")
    )
    input_: capo_iot_data_plane.types.update_thing_shadow_request.UpdateThingShadowRequest = {
        "thing_name": thing_name,
        "payload": payload,
    }
    if shadow_name is not None:
        input_["shadow_name"] = shadow_name

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