| 1 | import * as eventbridge from "@distilled.cloud/aws/eventbridge"; |
| 2 | import * as Layer from "effect/Layer"; |
| 3 | import { makeEventBridgeAccountHttpBinding } from "./BindingHttp.ts"; |
| 4 | import { DescribeReplay } from "./DescribeReplay.ts"; |
| 5 | |
| 6 | /** |
| 7 | * HTTP implementation of {@link DescribeReplay}. At deploy time it grants |
| 8 | * `events:DescribeReplay` 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 | */ |
| 12 | export const DescribeReplayHttp = Layer.effect( |
| 13 | DescribeReplay, |
| 14 | makeEventBridgeAccountHttpBinding({ |
| 15 | tag: "AWS.EventBridge.DescribeReplay", |
| 16 | operation: eventbridge.describeReplay, |
| 17 | actions: ["events:DescribeReplay"], |
| 18 | resources: ({ accountId, region }) => [ |
| 19 | `arn:aws:events:${region}:${accountId}:replay/*`, |
| 20 | ], |
| 21 | }), |
| 22 | ); |