The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as sdb from "@distilled.cloud/aws/simpledb"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as Layer from "effect/Layer"; |
| 4 | import * as AWSBindings from "../AWSBindings.ts"; |
| 5 | import { ListDomains } from "./ListDomains.ts"; |
| 6 | |
| 7 | /** |
| 8 | * Account-level binding — bespoke rather than `makeSimpleDbBinding` because |
| 9 | * `ListDomains` targets no single domain: SimpleDB IAM cannot scope it |
| 10 | * narrower than every domain in the account, so the grant is |
| 11 | * `sdb:ListDomains` on `domain/*` (expressed as `*`). |
| 12 | */ |
| 13 | export const ListDomainsHttp = Layer.effect( |
| 14 | ListDomains, |
| 15 | Effect.gen(function* () { |
| 16 | const bind = yield* AWSBindings.Bind; |
| 17 | const listDomains = yield* AWSBindings.withCredentials(sdb.listDomains); |
| 18 | |
| 19 | return Effect.fn(function* () { |
| 20 | if (!globalThis.__ALCHEMY_RUNTIME__) { |
| 21 | yield* bind`AWS.SimpleDB.ListDomains()`({ |
| 22 | policyStatements: [ |
| 23 | { |
| 24 | Effect: "Allow", |
| 25 | Action: ["sdb:ListDomains"], |
| 26 | Resource: ["*"], |
| 27 | }, |
| 28 | ], |
| 29 | }); |
| 30 | } |
| 31 | return Effect.fn("AWS.SimpleDB.ListDomains")(function* (request?: sdb.ListDomainsRequest) { |
| 32 | return yield* listDomains({ ...request }); |
| 33 | }); |
| 34 | }); |
| 35 | }), |
| 36 | ); |