@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 46 lines 1.52 KB
Raw
1 import * as im from "@distilled.cloud/aws/internetmonitor";
2 import * as Binding from "alchemy/Binding";
3 import * as Effect from "effect/Effect";
4 import type { Monitor } from "./Monitor.ts";
5
6 export interface GetQueryStatusRequest extends Omit<im.GetQueryStatusInput, "MonitorName"> {}
7
8 /**
9 * Runtime binding for `internetmonitor:GetQueryStatus` — check whether a
10 * query started on the bound {@link Monitor} is `QUEUED`, `RUNNING`,
11 * `SUCCEEDED`, `FAILED`, or `CANCELED`; the monitor name is injected
12 * automatically.
13 *
14 * Provide `InternetMonitor.GetQueryStatusHttp` on the hosting Lambda
15 * Function to satisfy the requirement.
16 * ### Querying Measurements
17 * **Example:** Poll a Query Until It Completes
18 * ```typescript
19 * // init — grants internetmonitor:GetQueryStatus on the monitor
20 * const getQueryStatus = yield* AWS.InternetMonitor.GetQueryStatus(monitor);
21 *
22 * // runtime
23 * const { Status } = yield* getQueryStatus({ QueryId: queryId }).pipe(
24 * Effect.repeat({
25 * schedule: Schedule.spaced("2 seconds"),
26 * until: (r) => r.Status !== "QUEUED" && r.Status !== "RUNNING",
27 * times: 10,
28 * }),
29 * );
30 * ```
31 *
32 * @binding
33 */
34 export interface GetQueryStatus extends Binding.Service<
35 GetQueryStatus,
36 "AWS.InternetMonitor.GetQueryStatus",
37 (
38 monitor: Monitor,
39 ) => Effect.Effect<
40 (
41 request: GetQueryStatusRequest,
42 ) => Effect.Effect<im.GetQueryStatusOutput, im.GetQueryStatusError>
43 >
44 > {}
45
46 export const GetQueryStatus = Binding.Service<GetQueryStatus>("AWS.InternetMonitor.GetQueryStatus");