1import * as cloudwatch from "@distilled.cloud/aws/cloudwatch";
2import * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4
5export interface DescribeAlarmsForMetricRequest
6 extends cloudwatch.DescribeAlarmsForMetricInput {}
7
8/**
9 * Runtime binding for `cloudwatch:DescribeAlarmsForMetric` — find the
10 * alarms watching a specific metric.
11 *
12 * Provide `CloudWatch.DescribeAlarmsForMetricHttp` on the hosting Lambda
13 * Function to satisfy the requirement.
14 * ### Reading Alarm State
15 * **Example:** Find Alarms Watching a Metric
16 * ```typescript
17 * // init — grants cloudwatch:DescribeAlarmsForMetric
18 * const describeAlarmsForMetric = yield* AWS.CloudWatch.DescribeAlarmsForMetric();
19 *
20 * // runtime
21 * const result = yield* describeAlarmsForMetric({
22 * Namespace: "MyApp/Payments",
23 * MetricName: "PaymentProcessed",
24 * Statistic: "Sum",
25 * Period: 60,
26 * });
27 * const alarmNames = (result.MetricAlarms ?? []).map((a) => a.AlarmName);
28 * ```
29 *
30 * @binding
31 */
32export interface DescribeAlarmsForMetric extends Binding.Service<
33 DescribeAlarmsForMetric,
34 "AWS.CloudWatch.DescribeAlarmsForMetric",
35 () => Effect.Effect<
36 (
37 request: DescribeAlarmsForMetricRequest,
38 ) => Effect.Effect<
39 cloudwatch.DescribeAlarmsForMetricOutput,
40 cloudwatch.DescribeAlarmsForMetricError
41 >
42 >
43> {}
44
45export const DescribeAlarmsForMetric = Binding.Service<DescribeAlarmsForMetric>(
46 "AWS.CloudWatch.DescribeAlarmsForMetric",
47);