| 1 | import type * as iotdata from "@distilled.cloud/aws/iot-data-plane"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | export interface GetConnectionRequest extends iotdata.GetConnectionRequest {} |
| 6 | |
| 7 | /** |
| 8 | * Runtime binding for the IoT data-plane `GetConnection` operation (IAM |
| 9 | * action `iot:GetConnection`). |
| 10 | * |
| 11 | * Binding to a client id filter grants `iot:GetConnection` on matching |
| 12 | * MQTT client ARNs (or all clients when the filter is omitted) and returns |
| 13 | * a callable that reads a client's connection state. Provide the |
| 14 | * implementation with `Effect.provide(AWS.IoT.GetConnectionHttp)`. |
| 15 | * ### MQTT Connections |
| 16 | * **Example:** Check a Device's Connectivity |
| 17 | * ```typescript |
| 18 | * const getConnection = yield* AWS.IoT.GetConnection("sensor-*"); |
| 19 | * |
| 20 | * const { connected } = yield* getConnection({ clientId: "sensor-1" }); |
| 21 | * ``` |
| 22 | * |
| 23 | * @binding |
| 24 | */ |
| 25 | export interface GetConnection extends Binding.Service< |
| 26 | GetConnection, |
| 27 | "AWS.IoT.GetConnection", |
| 28 | ( |
| 29 | clientIdFilter?: string, |
| 30 | ) => Effect.Effect< |
| 31 | ( |
| 32 | request: GetConnectionRequest, |
| 33 | ) => Effect.Effect< |
| 34 | iotdata.GetConnectionResponse, |
| 35 | iotdata.GetConnectionError |
| 36 | > |
| 37 | > |
| 38 | > {} |
| 39 | |
| 40 | export const GetConnection = Binding.Service<GetConnection>( |
| 41 | "AWS.IoT.GetConnection", |
| 42 | ); |