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 { UpdateApiKey, type UpdateApiKeyRequest } from "./UpdateApiKey.ts";
7
8 /**
9 * HTTP implementation of the {@link UpdateApiKey} binding. Grants
10 * `apigateway:PATCH` on `/apikeys/*` and calls the API with the host
11 * Function's credentials.
12 */
13 export const UpdateApiKeyHttp = Layer.effect(
14 UpdateApiKey,
15 Effect.gen(function* () {
16 const registerApiGatewayBinding = yield* RegisterApiGatewayBinding;
17 const updateApiKey = yield* AWSBindings.withCredentials(ag.updateApiKey);
18 return Effect.fn(function* () {
19 yield* registerApiGatewayBinding({
20 cap: "AWS.ApiGateway.UpdateApiKey",
21 target: "",
22 verb: "PATCH",
23 paths: (region) => [`arn:aws:apigateway:${region}::/apikeys/*`],
24 });
25 return Effect.fn("AWS.ApiGateway.UpdateApiKey")(function* (request: UpdateApiKeyRequest) {
26 return yield* updateApiKey(request);
27 });
28 });
29 }),
30 );