@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 31 lines 1.48 KB
Raw
1 import * as appconfig from "@distilled.cloud/aws/appconfig";
2 import * as Output from "alchemy/Output";
3 import type { Application } from "./Application.ts";
4 import { makeAppConfigHttpBinding } from "./BindingHttp.ts";
5 import type { Environment } from "./Environment.ts";
6 import { GetDeployment } from "./GetDeployment.ts";
7
8 /**
9 * HTTP implementation of the {@link GetDeployment} binding. Calls
10 * `appconfig:GetDeployment` with the Lambda's IAM role, scoped to the bound
11 * environment's deployments.
12 */
13 export const GetDeploymentHttp = makeAppConfigHttpBinding(GetDeployment, {
14 operation: appconfig.getDeployment,
15 spec: (application: Application, environment: Environment) => ({
16 identifiers: {
17 ApplicationId: application.applicationId,
18 EnvironmentId: environment.environmentId,
19 },
20 // The live authorizer evaluates the parent container ARNs (application,
21 // environment) in addition to the deployment — observed via CloudTrail.
22 iam: ({ region, accountId }) => ({
23 actions: ["appconfig:GetDeployment"],
24 resources: [
25 Output.interpolate`arn:aws:appconfig:${region}:${accountId}:application/${application.applicationId}`,
26 Output.interpolate`arn:aws:appconfig:${region}:${accountId}:application/${application.applicationId}/environment/${environment.environmentId}`,
27 Output.interpolate`arn:aws:appconfig:${region}:${accountId}:application/${application.applicationId}/environment/${environment.environmentId}/deployment/*`,
28 ],
29 }),
30 }),
31 });