The best way to control Claude Code, Codex and more from any computer or phone

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