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 | |
| 5 | export interface GetMetricWidgetImageRequest extends cloudwatch.GetMetricWidgetImageInput {} |
| 6 | |
| 7 | /** |
| 8 | * Runtime binding for `cloudwatch:GetMetricWidgetImage` — render a metric |
| 9 | * graph as a PNG (useful for embedding charts in alerts or reports). |
| 10 | * |
| 11 | * Provide `CloudWatch.GetMetricWidgetImageHttp` on the hosting Lambda |
| 12 | * Function to satisfy the requirement. |
| 13 | * ### Rendering Metric Graphs |
| 14 | * **Example:** Render a Metric Graph as PNG |
| 15 | * ```typescript |
| 16 | * // init — grants cloudwatch:GetMetricWidgetImage |
| 17 | * const getMetricWidgetImage = yield* AWS.CloudWatch.GetMetricWidgetImage(); |
| 18 | * |
| 19 | * // runtime |
| 20 | * const result = yield* getMetricWidgetImage({ |
| 21 | * MetricWidget: JSON.stringify({ |
| 22 | * metrics: [["MyApp/Payments", "PaymentProcessed"]], |
| 23 | * width: 600, |
| 24 | * height: 400, |
| 25 | * start: "-PT3H", |
| 26 | * }), |
| 27 | * }); |
| 28 | * const png = result.MetricWidgetImage; // image bytes |
| 29 | * ``` |
| 30 | * |
| 31 | * @binding |
| 32 | */ |
| 33 | export interface GetMetricWidgetImage extends Binding.Service< |
| 34 | GetMetricWidgetImage, |
| 35 | "AWS.CloudWatch.GetMetricWidgetImage", |
| 36 | () => Effect.Effect< |
| 37 | ( |
| 38 | request: GetMetricWidgetImageRequest, |
| 39 | ) => Effect.Effect<cloudwatch.GetMetricWidgetImageOutput, cloudwatch.GetMetricWidgetImageError> |
| 40 | > |
| 41 | > {} |
| 42 | |
| 43 | export const GetMetricWidgetImage = Binding.Service<GetMetricWidgetImage>( |
| 44 | "AWS.CloudWatch.GetMetricWidgetImage", |
| 45 | ); |