1import * as eventbridge from "@distilled.cloud/aws/eventbridge";
2import * as Layer from "effect/Layer";
3import { makeEventBridgeAccountHttpBinding } from "./BindingHttp.ts";
4import { CancelReplay } from "./CancelReplay.ts";
5
6/**
7 * HTTP implementation of {@link CancelReplay}. At deploy time it grants
8 * `events:CancelReplay` on the account's replays; at runtime it calls the
9 * EventBridge API with the host Function's credentials. Provide this layer
10 * on the Function using the binding.
11 */
12export const CancelReplayHttp = Layer.effect(
13 CancelReplay,
14 makeEventBridgeAccountHttpBinding({
15 tag: "AWS.EventBridge.CancelReplay",
16 operation: eventbridge.cancelReplay,
17 actions: ["events:CancelReplay"],
18 resources: ({ accountId, region }) => [
19 `arn:aws:events:${region}:${accountId}:replay/*`,
20 ],
21 }),
22);