| 1 | import * as cloudwatch from "@distilled.cloud/aws/cloudwatch"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | export interface ListMetricsRequest extends cloudwatch.ListMetricsInput {} |
| 6 | |
| 7 | /** |
| 8 | * Runtime binding for `cloudwatch:ListMetrics` — enumerate the metrics |
| 9 | * visible in the account/region, optionally filtered by namespace, metric |
| 10 | * name, or dimensions. |
| 11 | * |
| 12 | * Provide `CloudWatch.ListMetricsHttp` on the hosting Lambda Function to |
| 13 | * satisfy the requirement. |
| 14 | * ### Listing Metrics |
| 15 | * **Example:** List Metrics in a Namespace |
| 16 | * ```typescript |
| 17 | * // init — grants cloudwatch:ListMetrics |
| 18 | * const listMetrics = yield* AWS.CloudWatch.ListMetrics(); |
| 19 | * |
| 20 | * // runtime |
| 21 | * const result = yield* listMetrics({ Namespace: "MyApp/Payments" }); |
| 22 | * const names = (result.Metrics ?? []).map((metric) => metric.MetricName); |
| 23 | * ``` |
| 24 | * |
| 25 | * @binding |
| 26 | */ |
| 27 | export interface ListMetrics extends Binding.Service< |
| 28 | ListMetrics, |
| 29 | "AWS.CloudWatch.ListMetrics", |
| 30 | () => Effect.Effect< |
| 31 | ( |
| 32 | request?: ListMetricsRequest, |
| 33 | ) => Effect.Effect< |
| 34 | cloudwatch.ListMetricsOutput, |
| 35 | cloudwatch.ListMetricsError |
| 36 | > |
| 37 | > |
| 38 | > {} |
| 39 | |
| 40 | export const ListMetrics = Binding.Service<ListMetrics>( |
| 41 | "AWS.CloudWatch.ListMetrics", |
| 42 | ); |