1import type * as iotdata from "@distilled.cloud/aws/iot-data-plane";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Thing } from "./Thing.ts";
5
6export interface UpdateThingShadowRequest extends Omit<
7 iotdata.UpdateThingShadowRequest,
8 "thingName"
9> {}
10
11/**
12 * Runtime binding for the IoT data-plane `UpdateThingShadow` operation (IAM
13 * action `iot:UpdateThingShadow`).
14 *
15 * Bind it to a {@link Thing} to write the thing's device shadow — the thing
16 * name is injected automatically. Provide the implementation with
17 * `Effect.provide(AWS.IoT.UpdateThingShadowHttp)`.
18 * ### Device Shadows
19 * **Example:** Set Desired State
20 * ```typescript
21 * const updateShadow = yield* AWS.IoT.UpdateThingShadow(thing);
22 *
23 * yield* updateShadow({
24 * payload: JSON.stringify({ state: { desired: { led: "on" } } }),
25 * });
26 * ```
27 *
28 * **Example:** Write a Named Shadow
29 * ```typescript
30 * yield* updateShadow({
31 * shadowName: "telemetry",
32 * payload: JSON.stringify({ state: { reported: { t: 22.5 } } }),
33 * });
34 * ```
35 *
36 * @binding
37 */
38export interface UpdateThingShadow extends Binding.Service<
39 UpdateThingShadow,
40 "AWS.IoT.UpdateThingShadow",
41 (
42 thing: Thing,
43 ) => Effect.Effect<
44 (
45 request: UpdateThingShadowRequest,
46 ) => Effect.Effect<
47 iotdata.UpdateThingShadowResponse,
48 iotdata.UpdateThingShadowError
49 >
50 >
51> {}
52
53export const UpdateThingShadow = Binding.Service<UpdateThingShadow>(
54 "AWS.IoT.UpdateThingShadow",
55);