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 GetCanaryRequest extends Omit<
7 synthetics.GetCanaryRequest,
8 "Name"
9> {}
10
11/**
12 * Runtime binding for `synthetics:GetCanary` — read the full configuration
13 * and current status (state, last run, timeline) of the bound
14 * {@link Canary}; the canary name is injected automatically.
15 *
16 * Provide `Synthetics.GetCanaryHttp` on the hosting Lambda Function to
17 * satisfy the requirement.
18 * ### Reading Canary Status
19 * **Example:** Read the Canary's Current State
20 * ```typescript
21 * // init — grants synthetics:GetCanary on the canary
22 * const getCanary = yield* AWS.Synthetics.GetCanary(canary);
23 *
24 * // runtime
25 * const { Canary } = yield* getCanary();
26 * const state = Canary?.Status?.State;
27 * ```
28 *
29 * @binding
30 */
31export interface GetCanary extends Binding.Service<
32 GetCanary,
33 "AWS.Synthetics.GetCanary",
34 (
35 canary: Canary,
36 ) => Effect.Effect<
37 (
38 request?: GetCanaryRequest,
39 ) => Effect.Effect<synthetics.GetCanaryResponse, synthetics.GetCanaryError>
40 >
41> {}
42
43export const GetCanary = Binding.Service<GetCanary>("AWS.Synthetics.GetCanary");