sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ CloudWatch/ DisableAlarmActions.ts

import * as cloudwatch from "@distilled.cloud/aws/cloudwatch";
import * as Binding from "alchemy/Binding";
import * as Effect from "effect/Effect";
import type { AlarmResource } from "./binding-common.ts";

type AlarmResources = [AlarmResource, ...AlarmResource[]];

/**
 * Runtime binding for `cloudwatch:DisableAlarmActions` — suppress the
 * actions of the bound alarms (e.g. during a deploy or maintenance
 * window). Bind it to one or more {@link Alarm} / {@link CompositeAlarm}
 * resources; the alarm names are injected automatically. Re-enable with
 * {@link EnableAlarmActions}.
 *
 * Provide `CloudWatch.DisableAlarmActionsHttp` on the hosting Lambda
 * Function to satisfy the requirement.
 * ### Managing Alarm Actions
 * **Example:** Mute an Alarm During a Deploy
 * ```typescript
 * // init — grants cloudwatch:DisableAlarmActions on the alarm
 * const disableAlarmActions = yield* AWS.CloudWatch.DisableAlarmActions(alarm);
 *
 * // runtime
 * yield* disableAlarmActions();
 * ```
 *
 * @binding
 */
export interface DisableAlarmActions extends Binding.Service<
  DisableAlarmActions,
  "AWS.CloudWatch.DisableAlarmActions",
  (
    ...alarms: AlarmResources
  ) => Effect.Effect<() => Effect.Effect<cloudwatch.DisableAlarmActionsResponse, any>>
> {}

export const DisableAlarmActions = Binding.Service<DisableAlarmActions>(
  "AWS.CloudWatch.DisableAlarmActions",
);