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