1import * as cloudwatch from "@distilled.cloud/aws/cloudwatch";
2import * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Dashboard } from "./Dashboard.ts";
5
6export interface GetDashboardRequest extends Omit<
7 cloudwatch.GetDashboardInput,
8 "DashboardName"
9> {}
10
11/**
12 * Runtime binding for `cloudwatch:GetDashboard` — read the body and
13 * metadata of the bound {@link Dashboard}; the dashboard name is injected
14 * automatically.
15 *
16 * Provide `CloudWatch.GetDashboardHttp` on the hosting Lambda Function to
17 * satisfy the requirement.
18 * ### Reading Dashboards
19 * **Example:** Read a Bound Dashboard
20 * ```typescript
21 * // init — grants cloudwatch:GetDashboard on the dashboard
22 * const getDashboard = yield* AWS.CloudWatch.GetDashboard(dashboard);
23 *
24 * // runtime
25 * const result = yield* getDashboard();
26 * const widgets = JSON.parse(result.DashboardBody ?? "{}").widgets;
27 * ```
28 *
29 * @binding
30 */
31export interface GetDashboard extends Binding.Service<
32 GetDashboard,
33 "AWS.CloudWatch.GetDashboard",
34 (
35 dashboard: Dashboard,
36 ) => Effect.Effect<
37 (
38 request?: GetDashboardRequest,
39 ) => Effect.Effect<
40 cloudwatch.GetDashboardOutput,
41 cloudwatch.GetDashboardError
42 >
43 >
44> {}
45
46export const GetDashboard = Binding.Service<GetDashboard>(
47 "AWS.CloudWatch.GetDashboard",
48);