| 1 | import type * as synthetics from "@distilled.cloud/aws/synthetics"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | /** |
| 6 | * Runtime binding for `synthetics:DescribeCanariesLastRun` — read the most |
| 7 | * recent run of every canary in the account (optionally filtered by |
| 8 | * `Names`), e.g. to render a fleet-wide status page. |
| 9 | * |
| 10 | * Provide `Synthetics.DescribeCanariesLastRunHttp` on the hosting Lambda |
| 11 | * Function to satisfy the requirement. |
| 12 | * ### Reading Canary Status |
| 13 | * **Example:** Fleet-Wide Last-Run Summary |
| 14 | * ```typescript |
| 15 | * // init — grants synthetics:DescribeCanariesLastRun |
| 16 | * const describeCanariesLastRun = |
| 17 | * yield* AWS.Synthetics.DescribeCanariesLastRun(); |
| 18 | * |
| 19 | * // runtime |
| 20 | * const { CanariesLastRun } = yield* describeCanariesLastRun(); |
| 21 | * const failing = CanariesLastRun?.filter( |
| 22 | * (c) => c.LastRun?.Status?.State === "FAILED", |
| 23 | * ); |
| 24 | * ``` |
| 25 | * |
| 26 | * @binding |
| 27 | */ |
| 28 | export interface DescribeCanariesLastRun extends Binding.Service< |
| 29 | DescribeCanariesLastRun, |
| 30 | "AWS.Synthetics.DescribeCanariesLastRun", |
| 31 | () => Effect.Effect< |
| 32 | ( |
| 33 | request?: synthetics.DescribeCanariesLastRunRequest, |
| 34 | ) => Effect.Effect< |
| 35 | synthetics.DescribeCanariesLastRunResponse, |
| 36 | synthetics.DescribeCanariesLastRunError |
| 37 | > |
| 38 | > |
| 39 | > {} |
| 40 | |
| 41 | export const DescribeCanariesLastRun = Binding.Service<DescribeCanariesLastRun>( |
| 42 | "AWS.Synthetics.DescribeCanariesLastRun", |
| 43 | ); |