1import * as ag from "@distilled.cloud/aws/api-gateway";
2import * as Effect from "effect/Effect";
3import * as Layer from "effect/Layer";
4import { registerApiGatewayBinding } from "./BindingHttp.ts";
5import { GetApiKeys, type GetApiKeysRequest } from "./GetApiKeys.ts";
6
7/**
8 * HTTP implementation of the {@link GetApiKeys} binding. Grants
9 * `apigateway:GET` on `/apikeys` and calls the API with the host
10 * Function's credentials.
11 */
12export const GetApiKeysHttp = Layer.effect(
13 GetApiKeys,
14 Effect.gen(function* () {
15 const getApiKeys = yield* ag.getApiKeys;
16 return Effect.fn(function* () {
17 yield* registerApiGatewayBinding({
18 cap: "AWS.ApiGateway.GetApiKeys",
19 target: "",
20 verb: "GET",
21 paths: (region) => [`arn:aws:apigateway:${region}::/apikeys`],
22 });
23 return Effect.fn("AWS.ApiGateway.GetApiKeys")(function* (
24 request?: GetApiKeysRequest,
25 ) {
26 return yield* getApiKeys(request ?? {});
27 });
28 });
29 }),
30);