The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as amp from "@distilled.cloud/aws/amp"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as Layer from "effect/Layer"; |
| 4 | import * as AWSBindings from "../AWSBindings.ts"; |
| 5 | import { ListWorkspaces, type ListWorkspacesRequest } from "./ListWorkspaces.ts"; |
| 6 | |
| 7 | export const ListWorkspacesHttp = Layer.effect( |
| 8 | ListWorkspaces, |
| 9 | Effect.gen(function* () { |
| 10 | const bind = yield* AWSBindings.Bind; |
| 11 | const listWorkspaces = yield* AWSBindings.withCredentials(amp.listWorkspaces); |
| 12 | |
| 13 | return Effect.fn(function* () { |
| 14 | if (!globalThis.__ALCHEMY_RUNTIME__) { |
| 15 | yield* bind`AWS.AMP.ListWorkspaces()`({ |
| 16 | policyStatements: [ |
| 17 | { |
| 18 | Effect: "Allow", |
| 19 | Action: ["aps:ListWorkspaces"], |
| 20 | Resource: ["*"], |
| 21 | }, |
| 22 | ], |
| 23 | }); |
| 24 | } |
| 25 | return Effect.fn("AWS.AMP.ListWorkspaces")(function* (request?: ListWorkspacesRequest) { |
| 26 | return yield* listWorkspaces(request ?? {}); |
| 27 | }); |
| 28 | }); |
| 29 | }), |
| 30 | ); |