1import * as eventbridge from "@distilled.cloud/aws/eventbridge";
2import * as Layer from "effect/Layer";
3import { makeEventBridgeBusHttpBinding } from "./BindingHttp.ts";
4import { ListRules } from "./ListRules.ts";
5
6/**
7 * HTTP implementation of {@link ListRules}. At deploy time it grants
8 * `events:ListRules`; at runtime it calls the EventBridge API with the host
9 * Function's credentials. Provide this layer on the Function using the
10 * binding.
11 */
12export const ListRulesHttp = Layer.effect(
13 ListRules,
14 makeEventBridgeBusHttpBinding({
15 tag: "AWS.EventBridge.ListRules",
16 operation: eventbridge.listRules,
17 actions: ["events:ListRules"],
18 busNameKey: "EventBusName",
19 // events:ListRules does not support resource-level permissions — a grant
20 // scoped to the bus ARN is AccessDenied at runtime. Grant on `*`.
21 resources: () => ["*"],
22 }),
23);