| 1 | import type * as eventbridge from "@distilled.cloud/aws/eventbridge"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Rule } from "./Rule.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Enables an EventBridge rule (`events:EnableRule`) so it resumes matching |
| 8 | * events. |
| 9 | * |
| 10 | * Bind this operation to a {@link Rule} inside a function runtime to get a |
| 11 | * callable that re-enables the rule — the runtime half of a feature toggle |
| 12 | * or kill switch. Provide the `EnableRuleHttp` layer on the Function to |
| 13 | * satisfy the binding. |
| 14 | * ### Toggling Rules |
| 15 | * **Example:** Re-enable the Bound Rule |
| 16 | * ```typescript |
| 17 | * // init — bind the rule (provide AWS.EventBridge.EnableRuleHttp on the Function) |
| 18 | * const enableRule = yield* AWS.EventBridge.EnableRule(rule); |
| 19 | * |
| 20 | * // runtime — turn event routing back on |
| 21 | * yield* enableRule(); |
| 22 | * ``` |
| 23 | * |
| 24 | * @binding |
| 25 | */ |
| 26 | export interface EnableRule extends Binding.Service< |
| 27 | EnableRule, |
| 28 | "AWS.EventBridge.EnableRule", |
| 29 | ( |
| 30 | rule: Rule, |
| 31 | ) => Effect.Effect< |
| 32 | () => Effect.Effect< |
| 33 | eventbridge.EnableRuleResponse, |
| 34 | eventbridge.EnableRuleError |
| 35 | > |
| 36 | > |
| 37 | > {} |
| 38 | export const EnableRule = Binding.Service<EnableRule>( |
| 39 | "AWS.EventBridge.EnableRule", |
| 40 | ); |