sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ CloudWatch/ EnableAlarmActions.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:EnableAlarmActions` — re-enable the
 * actions of the bound alarms after they were suppressed with
 * {@link DisableAlarmActions}. Bind it to one or more {@link Alarm} /
 * {@link CompositeAlarm} resources; the alarm names are injected
 * automatically.
 *
 * Provide `CloudWatch.EnableAlarmActionsHttp` on the hosting Lambda
 * Function to satisfy the requirement.
 * ### Managing Alarm Actions
 * **Example:** Re-enable an Alarm After a Deploy
 * ```typescript
 * // init — grants cloudwatch:EnableAlarmActions on the alarm
 * const enableAlarmActions = yield* AWS.CloudWatch.EnableAlarmActions(alarm);
 *
 * // runtime
 * yield* enableAlarmActions();
 * ```
 *
 * @binding
 */
export interface EnableAlarmActions extends Binding.Service<
  EnableAlarmActions,
  "AWS.CloudWatch.EnableAlarmActions",
  (
    ...alarms: AlarmResources
  ) => Effect.Effect<() => Effect.Effect<cloudwatch.EnableAlarmActionsResponse, any>>
> {}

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