Skip to content

GetThingShadow

Source: src/AWS/IoT/GetThingShadow.ts

Runtime binding for the IoT data-plane GetThingShadow operation (IAM action iot:GetThingShadow).

Bind it to a Thing to read the thing’s device shadow — the thing name is injected automatically. The response payload is a byte Stream; decode it with Stream.decodeText + Stream.mkString. Provide the implementation with Effect.provide(AWS.IoT.GetThingShadowHttp).

Read the Classic Shadow

const getShadow = yield* AWS.IoT.GetThingShadow(thing);
const state = yield* getShadow().pipe(
Effect.flatMap((result) =>
Stream.mkString(Stream.decodeText(result.payload!)),
),
);

Read a Named Shadow

const result = yield* getShadow({ shadowName: "telemetry" });