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
| 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 { ConfigurationProfile } from "./ConfigurationProfile.ts"; |
| 6 | import { ValidateConfiguration } from "./ValidateConfiguration.ts"; |
| 7 | |
| 8 | /** |
| 9 | * HTTP implementation of the {@link ValidateConfiguration} binding. Calls |
| 10 | * `appconfig:ValidateConfiguration` with the Lambda's IAM role, scoped to |
| 11 | * the bound configuration profile. |
| 12 | */ |
| 13 | export const ValidateConfigurationHttp = makeAppConfigHttpBinding(ValidateConfiguration, { |
| 14 | operation: appconfig.validateConfiguration, |
| 15 | spec: (application: Application, configurationProfile: ConfigurationProfile) => ({ |
| 16 | identifiers: { |
| 17 | ApplicationId: application.applicationId, |
| 18 | ConfigurationProfileId: configurationProfile.configurationProfileId, |
| 19 | }, |
| 20 | // The service authorization reference lists configurationprofile + |
| 21 | // hostedconfigurationversion, but the LIVE authorizer evaluates the |
| 22 | // APPLICATION ARN (CloudTrail: "not authorized to perform: |
| 23 | // appconfig:ValidateConfiguration on resource: ...:application/{id}"). |
| 24 | // Grant all three. |
| 25 | iam: ({ region, accountId }) => ({ |
| 26 | actions: ["appconfig:ValidateConfiguration"], |
| 27 | resources: [ |
| 28 | Output.interpolate`arn:aws:appconfig:${region}:${accountId}:application/${application.applicationId}`, |
| 29 | Output.interpolate`arn:aws:appconfig:${region}:${accountId}:application/${application.applicationId}/configurationprofile/${configurationProfile.configurationProfileId}`, |
| 30 | Output.interpolate`arn:aws:appconfig:${region}:${accountId}:application/${application.applicationId}/configurationprofile/${configurationProfile.configurationProfileId}/hostedconfigurationversion/*`, |
| 31 | ], |
| 32 | }), |
| 33 | }), |
| 34 | }); |