| 1 | import * as eventbridge from "@distilled.cloud/aws/eventbridge"; |
| 2 | import * as Layer from "effect/Layer"; |
| 3 | import { makeEventBridgeRuleHttpBinding } from "./BindingHttp.ts"; |
| 4 | import { EnableRule } from "./EnableRule.ts"; |
| 5 | |
| 6 | /** |
| 7 | * HTTP implementation of {@link EnableRule}. At deploy time it grants |
| 8 | * `events:EnableRule` on the bound rule; at runtime it calls the EventBridge |
| 9 | * API with the host Function's credentials. Provide this layer on the |
| 10 | * Function using the binding. |
| 11 | */ |
| 12 | export const EnableRuleHttp = Layer.effect( |
| 13 | EnableRule, |
| 14 | makeEventBridgeRuleHttpBinding({ |
| 15 | tag: "AWS.EventBridge.EnableRule", |
| 16 | operation: eventbridge.enableRule, |
| 17 | actions: ["events:EnableRule"], |
| 18 | ruleNameKey: "Name", |
| 19 | }), |
| 20 | ); |