| 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 DescribeAlarmHistoryRequest |
| 6 | extends cloudwatch.DescribeAlarmHistoryInput {} |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `cloudwatch:DescribeAlarmHistory` — read state |
| 10 | * transitions and configuration changes recorded for alarms in the |
| 11 | * account/region. |
| 12 | * |
| 13 | * Provide `CloudWatch.DescribeAlarmHistoryHttp` on the hosting Lambda |
| 14 | * Function to satisfy the requirement. |
| 15 | * ### Reading Alarm State |
| 16 | * **Example:** Read an Alarm's Recent History |
| 17 | * ```typescript |
| 18 | * // init — grants cloudwatch:DescribeAlarmHistory |
| 19 | * const describeAlarmHistory = yield* AWS.CloudWatch.DescribeAlarmHistory(); |
| 20 | * |
| 21 | * // runtime |
| 22 | * const result = yield* describeAlarmHistory({ |
| 23 | * AlarmName: yield* alarm.alarmName, |
| 24 | * MaxRecords: 10, |
| 25 | * }); |
| 26 | * const items = result.AlarmHistoryItems ?? []; |
| 27 | * ``` |
| 28 | * |
| 29 | * @binding |
| 30 | */ |
| 31 | export interface DescribeAlarmHistory extends Binding.Service< |
| 32 | DescribeAlarmHistory, |
| 33 | "AWS.CloudWatch.DescribeAlarmHistory", |
| 34 | () => Effect.Effect< |
| 35 | ( |
| 36 | request?: DescribeAlarmHistoryRequest, |
| 37 | ) => Effect.Effect< |
| 38 | cloudwatch.DescribeAlarmHistoryOutput, |
| 39 | cloudwatch.DescribeAlarmHistoryError |
| 40 | > |
| 41 | > |
| 42 | > {} |
| 43 | |
| 44 | export const DescribeAlarmHistory = Binding.Service<DescribeAlarmHistory>( |
| 45 | "AWS.CloudWatch.DescribeAlarmHistory", |
| 46 | ); |