@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 39 lines 1.43 KB
Raw
1 import * as codedeploy from "@distilled.cloud/aws/codedeploy";
2 import * as Effect from "effect/Effect";
3 import * as Layer from "effect/Layer";
4 import * as AWSBindings from "../AWSBindings.ts";
5 import { BatchGetDeployments } from "./BatchGetDeployments.ts";
6 import type { DeploymentGroup } from "./DeploymentGroup.ts";
7
8 /**
9 * Bespoke IAM: `codedeploy:BatchGetDeployments` does not support
10 * resource-level permissions (a batch of deployment ids cannot be mapped to
11 * a deployment-group resource before authorization), so the grant must be
12 * on `*` — a group-scoped grant is denied with AccessDeniedException.
13 */
14 export const BatchGetDeploymentsHttp = Layer.effect(
15 BatchGetDeployments,
16 Effect.gen(function* () {
17 const bind = yield* AWSBindings.Bind;
18 const op = yield* AWSBindings.withCredentials(codedeploy.batchGetDeployments);
19
20 return Effect.fn(function* <G extends DeploymentGroup>(group: G) {
21 if (!globalThis.__ALCHEMY_RUNTIME__) {
22 yield* bind`AWS.CodeDeploy.BatchGetDeployments(${group})`({
23 policyStatements: [
24 {
25 Effect: "Allow",
26 Action: ["codedeploy:BatchGetDeployments"],
27 Resource: ["*"],
28 },
29 ],
30 });
31 }
32 return Effect.fn(`AWS.CodeDeploy.BatchGetDeployments(${group.LogicalId})`)(function* (
33 request: codedeploy.BatchGetDeploymentsInput,
34 ) {
35 return yield* op(request);
36 });
37 });
38 }),
39 );