1import type * as synthetics from "@distilled.cloud/aws/synthetics";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Canary } from "./Canary.ts";
5
6export interface GetCanaryRunsRequest extends Omit<
7 synthetics.GetCanaryRunsRequest,
8 "Name"
9> {}
10
11/**
12 * Runtime binding for `synthetics:GetCanaryRuns` — list the run results
13 * (status, timeline, artifact location) of the bound {@link Canary}; the
14 * canary name is injected automatically.
15 *
16 * Provide `Synthetics.GetCanaryRunsHttp` on the hosting Lambda Function to
17 * satisfy the requirement.
18 * ### Reading Canary Runs
19 * **Example:** List Recent Runs
20 * ```typescript
21 * // init — grants synthetics:GetCanaryRuns on the canary
22 * const getCanaryRuns = yield* AWS.Synthetics.GetCanaryRuns(canary);
23 *
24 * // runtime
25 * const { CanaryRuns } = yield* getCanaryRuns({ MaxResults: 10 });
26 * const failed = CanaryRuns?.filter((run) => run.Status?.State === "FAILED");
27 * ```
28 *
29 * @binding
30 */
31export interface GetCanaryRuns extends Binding.Service<
32 GetCanaryRuns,
33 "AWS.Synthetics.GetCanaryRuns",
34 (
35 canary: Canary,
36 ) => Effect.Effect<
37 (
38 request?: GetCanaryRunsRequest,
39 ) => Effect.Effect<
40 synthetics.GetCanaryRunsResponse,
41 synthetics.GetCanaryRunsError
42 >
43 >
44> {}
45
46export const GetCanaryRuns = Binding.Service<GetCanaryRuns>(
47 "AWS.Synthetics.GetCanaryRuns",
48);