1import * as cloudwatch from "@distilled.cloud/aws/cloudwatch";
2import * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { AlarmResource } from "./binding-common.ts";
5
6export interface SetAlarmStateRequest extends Omit<
7 cloudwatch.SetAlarmStateInput,
8 "AlarmName"
9> {}
10
11/**
12 * Runtime binding for `cloudwatch:SetAlarmState` — force the bound alarm
13 * into a specific state (useful for testing alarm actions or resetting a
14 * stuck alarm). Bind it to an {@link Alarm} / {@link CompositeAlarm}; the
15 * alarm name is injected automatically.
16 *
17 * Provide `CloudWatch.SetAlarmStateHttp` on the hosting Lambda Function to
18 * satisfy the requirement.
19 * ### Managing Alarm Actions
20 * **Example:** Force an Alarm into ALARM to Test Its Actions
21 * ```typescript
22 * // init — grants cloudwatch:SetAlarmState on the alarm
23 * const setAlarmState = yield* AWS.CloudWatch.SetAlarmState(alarm);
24 *
25 * // runtime
26 * yield* setAlarmState({
27 * StateValue: "ALARM",
28 * StateReason: "fire-drill: verifying the on-call page",
29 * });
30 * ```
31 *
32 * @binding
33 */
34export interface SetAlarmState extends Binding.Service<
35 SetAlarmState,
36 "AWS.CloudWatch.SetAlarmState",
37 (
38 alarm: AlarmResource,
39 ) => Effect.Effect<
40 (
41 request: SetAlarmStateRequest,
42 ) => Effect.Effect<
43 cloudwatch.SetAlarmStateResponse,
44 cloudwatch.SetAlarmStateError
45 >
46 >
47> {}
48
49export const SetAlarmState = Binding.Service<SetAlarmState>(
50 "AWS.CloudWatch.SetAlarmState",
51);