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