alchemy 0.61.0 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/bin/alchemy.js +1406 -1464
- package/bin/commands/init.ts +29 -2
- package/bin/services/execute-alchemy.ts +1 -2
- package/lib/alchemy.d.ts +2 -2
- package/lib/alchemy.d.ts.map +1 -1
- package/lib/alchemy.js.map +1 -1
- package/lib/aws/client-props.d.ts +149 -0
- package/lib/aws/client-props.d.ts.map +1 -0
- package/lib/aws/client-props.js +1 -0
- package/lib/aws/client-props.js.map +1 -0
- package/lib/aws/credentials.d.ts +68 -5
- package/lib/aws/credentials.d.ts.map +1 -1
- package/lib/aws/credentials.js +148 -0
- package/lib/aws/credentials.js.map +1 -1
- package/lib/aws/ec2/internet-gateway-attachment.d.ts +57 -3
- package/lib/aws/ec2/internet-gateway-attachment.d.ts.map +1 -1
- package/lib/aws/ec2/internet-gateway-attachment.js +57 -3
- package/lib/aws/ec2/internet-gateway-attachment.js.map +1 -1
- package/lib/aws/ec2/internet-gateway.d.ts +68 -40
- package/lib/aws/ec2/internet-gateway.d.ts.map +1 -1
- package/lib/aws/ec2/internet-gateway.js +68 -40
- package/lib/aws/ec2/internet-gateway.js.map +1 -1
- package/lib/aws/ec2/nat-gateway.d.ts +99 -18
- package/lib/aws/ec2/nat-gateway.d.ts.map +1 -1
- package/lib/aws/ec2/nat-gateway.js +113 -37
- package/lib/aws/ec2/nat-gateway.js.map +1 -1
- package/lib/aws/ec2/route-table-association.d.ts +1 -1
- package/lib/aws/ec2/route-table-association.js +1 -1
- package/lib/aws/ec2/route-table.d.ts +64 -1
- package/lib/aws/ec2/route-table.d.ts.map +1 -1
- package/lib/aws/ec2/route-table.js +64 -1
- package/lib/aws/ec2/route-table.js.map +1 -1
- package/lib/aws/ec2/route.d.ts +60 -1
- package/lib/aws/ec2/route.d.ts.map +1 -1
- package/lib/aws/ec2/route.js +60 -1
- package/lib/aws/ec2/route.js.map +1 -1
- package/lib/aws/ec2/security-group.d.ts +96 -3
- package/lib/aws/ec2/security-group.d.ts.map +1 -1
- package/lib/aws/ec2/security-group.js +96 -3
- package/lib/aws/ec2/security-group.js.map +1 -1
- package/lib/aws/ec2/subnet.d.ts +61 -3
- package/lib/aws/ec2/subnet.d.ts.map +1 -1
- package/lib/aws/ec2/subnet.js +61 -3
- package/lib/aws/ec2/subnet.js.map +1 -1
- package/lib/aws/ec2/utils.d.ts +10 -2
- package/lib/aws/ec2/utils.d.ts.map +1 -1
- package/lib/aws/ec2/utils.js +68 -7
- package/lib/aws/ec2/utils.js.map +1 -1
- package/lib/aws/ec2/vpc.d.ts +50 -2
- package/lib/aws/ec2/vpc.d.ts.map +1 -1
- package/lib/aws/ec2/vpc.js +50 -2
- package/lib/aws/ec2/vpc.js.map +1 -1
- package/lib/aws/index.d.ts +2 -0
- package/lib/aws/index.d.ts.map +1 -1
- package/lib/aws/index.js +2 -0
- package/lib/aws/index.js.map +1 -1
- package/lib/cloudflare/api-response.js +2 -2
- package/lib/cloudflare/api-response.js.map +1 -1
- package/lib/cloudflare/api.d.ts +19 -0
- package/lib/cloudflare/api.d.ts.map +1 -1
- package/lib/cloudflare/api.js +4 -0
- package/lib/cloudflare/api.js.map +1 -1
- package/lib/cloudflare/assets.d.ts.map +1 -1
- package/lib/cloudflare/assets.js +3 -4
- package/lib/cloudflare/assets.js.map +1 -1
- package/lib/cloudflare/bucket.d.ts +5 -3
- package/lib/cloudflare/bucket.d.ts.map +1 -1
- package/lib/cloudflare/bucket.js +22 -18
- package/lib/cloudflare/bucket.js.map +1 -1
- package/lib/cloudflare/bundle/plugin-compat-warning.js +7 -7
- package/lib/cloudflare/bundle/plugin-compat-warning.js.map +1 -1
- package/lib/cloudflare/cloudflare-env-proxy.js.map +1 -1
- package/lib/cloudflare/kv-namespace.d.ts +2 -2
- package/lib/cloudflare/kv-namespace.d.ts.map +1 -1
- package/lib/cloudflare/kv-namespace.js.map +1 -1
- package/lib/cloudflare/oauth.js +3 -3
- package/lib/cloudflare/oauth.js.map +1 -1
- package/lib/cloudflare/quick-tunnel.d.ts +1 -1
- package/lib/cloudflare/website.d.ts.map +1 -1
- package/lib/cloudflare/website.js +26 -97
- package/lib/cloudflare/website.js.map +1 -1
- package/lib/cloudflare/worker-bundle.d.ts.map +1 -1
- package/lib/cloudflare/worker-bundle.js +9 -8
- package/lib/cloudflare/worker-bundle.js.map +1 -1
- package/lib/cloudflare/worker-tail.d.ts.map +1 -1
- package/lib/cloudflare/worker-tail.js +6 -6
- package/lib/cloudflare/worker-tail.js.map +1 -1
- package/lib/resource.d.ts +1 -0
- package/lib/resource.d.ts.map +1 -1
- package/lib/resource.js +13 -2
- package/lib/resource.js.map +1 -1
- package/lib/scope.d.ts +24 -23
- package/lib/scope.d.ts.map +1 -1
- package/lib/scope.js +25 -20
- package/lib/scope.js.map +1 -1
- package/lib/state/cloudflare-state-store.d.ts.map +1 -1
- package/lib/state/cloudflare-state-store.js +2 -1
- package/lib/state/cloudflare-state-store.js.map +1 -1
- package/lib/util/idempotent-spawn.d.ts +10 -8
- package/lib/util/idempotent-spawn.d.ts.map +1 -1
- package/lib/util/idempotent-spawn.js +97 -78
- package/lib/util/idempotent-spawn.js.map +1 -1
- package/lib/util/index.d.ts +2 -0
- package/lib/util/index.d.ts.map +1 -0
- package/lib/util/index.js +2 -0
- package/lib/util/index.js.map +1 -0
- package/lib/util/safe-fetch.d.ts +24 -0
- package/lib/util/safe-fetch.d.ts.map +1 -1
- package/lib/util/safe-fetch.js +72 -0
- package/lib/util/safe-fetch.js.map +1 -1
- package/package.json +8 -5
- package/src/alchemy.ts +2 -2
- package/src/aws/client-props.ts +156 -0
- package/src/aws/credentials.ts +165 -4
- package/src/aws/ec2/internet-gateway-attachment.ts +59 -4
- package/src/aws/ec2/internet-gateway.ts +70 -41
- package/src/aws/ec2/nat-gateway.ts +123 -33
- package/src/aws/ec2/route-table-association.ts +1 -1
- package/src/aws/ec2/route-table.ts +66 -2
- package/src/aws/ec2/route.ts +62 -2
- package/src/aws/ec2/security-group.ts +98 -4
- package/src/aws/ec2/subnet.ts +63 -4
- package/src/aws/ec2/utils.ts +73 -7
- package/src/aws/ec2/vpc.ts +52 -3
- package/src/aws/index.ts +2 -0
- package/src/cloudflare/api-response.ts +2 -2
- package/src/cloudflare/api.ts +23 -0
- package/src/cloudflare/assets.ts +3 -4
- package/src/cloudflare/bucket.ts +27 -25
- package/src/cloudflare/bundle/plugin-compat-warning.ts +7 -7
- package/src/cloudflare/cloudflare-env-proxy.ts +2 -2
- package/src/cloudflare/kv-namespace.ts +26 -27
- package/src/cloudflare/oauth.ts +3 -3
- package/src/cloudflare/website.ts +30 -111
- package/src/cloudflare/worker-bundle.ts +9 -8
- package/src/cloudflare/worker-tail.ts +6 -8
- package/src/resource.ts +19 -2
- package/src/scope.ts +73 -43
- package/src/state/cloudflare-state-store.ts +2 -1
- package/src/util/idempotent-spawn.ts +117 -100
- package/src/util/index.ts +1 -0
- package/src/util/safe-fetch.ts +114 -0
package/bin/commands/init.ts
CHANGED
|
@@ -59,6 +59,7 @@ export const init = loggedProcedure
|
|
|
59
59
|
main: updatedConfig?.main,
|
|
60
60
|
});
|
|
61
61
|
await updatePackageJson(context);
|
|
62
|
+
await updateGitignore(context);
|
|
62
63
|
|
|
63
64
|
displaySuccessMessage(context);
|
|
64
65
|
} catch (_error) {
|
|
@@ -264,8 +265,7 @@ export const worker = await Vite("${context.projectName}", {
|
|
|
264
265
|
// main: "./.output/server/index.mjs",
|
|
265
266
|
// command: "vite build",
|
|
266
267
|
// dev: { command: "vite dev" },
|
|
267
|
-
assets: "dist"
|
|
268
|
-
wrangler: false,
|
|
268
|
+
assets: "dist"
|
|
269
269
|
});
|
|
270
270
|
|
|
271
271
|
console.log({
|
|
@@ -482,6 +482,33 @@ async function updatePackageJson(context: InitContext): Promise<void> {
|
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
484
|
|
|
485
|
+
async function updateGitignore(context: InitContext) {
|
|
486
|
+
try {
|
|
487
|
+
const gitignorePath = resolve(context.cwd, ".gitignore");
|
|
488
|
+
|
|
489
|
+
await fs.ensureFile(gitignorePath);
|
|
490
|
+
|
|
491
|
+
let gitignoreContent = "";
|
|
492
|
+
if (await fs.pathExists(gitignorePath)) {
|
|
493
|
+
gitignoreContent = await fs.readFile(gitignorePath, "utf-8");
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
const lines = gitignoreContent.split("\n").map((line) => line.trim());
|
|
497
|
+
const hasAlchemy = lines.some(
|
|
498
|
+
(line) => line === ".alchemy" || line === ".alchemy/",
|
|
499
|
+
);
|
|
500
|
+
|
|
501
|
+
if (!hasAlchemy) {
|
|
502
|
+
if (gitignoreContent && !gitignoreContent.endsWith("\n")) {
|
|
503
|
+
gitignoreContent += "\n";
|
|
504
|
+
}
|
|
505
|
+
await fs.appendFile(gitignorePath, ".alchemy\n", "utf-8");
|
|
506
|
+
}
|
|
507
|
+
} catch (error) {
|
|
508
|
+
throwWithContext(error, "Failed to update .gitignore");
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
485
512
|
interface TsConfigUpdate {
|
|
486
513
|
include?: string[];
|
|
487
514
|
exclude?: string[];
|
package/lib/alchemy.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DestroyStrategy, destroy } from "./destroy.ts";
|
|
2
2
|
import { env } from "./env.ts";
|
|
3
|
-
import { Scope } from "./scope.ts";
|
|
3
|
+
import { Scope, type ProviderCredentials } from "./scope.ts";
|
|
4
4
|
import { secret } from "./secret.ts";
|
|
5
5
|
import type { StateStoreType } from "./state.ts";
|
|
6
6
|
import type { LoggerApi } from "./util/cli.ts";
|
|
@@ -174,7 +174,7 @@ export interface AlchemyOptions {
|
|
|
174
174
|
export interface ScopeOptions extends AlchemyOptions {
|
|
175
175
|
enter: boolean;
|
|
176
176
|
}
|
|
177
|
-
export interface RunOptions extends AlchemyOptions {
|
|
177
|
+
export interface RunOptions extends AlchemyOptions, ProviderCredentials {
|
|
178
178
|
/**
|
|
179
179
|
* @default false
|
|
180
180
|
*/
|
package/lib/alchemy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alchemy.d.ts","sourceRoot":"","sources":["../src/alchemy.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAmB,OAAO,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAU/B,OAAO,EAAiB,KAAK,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"alchemy.d.ts","sourceRoot":"","sources":["../src/alchemy.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAmB,OAAO,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAU/B,OAAO,EAAiB,KAAK,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI/C;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC;AAE9B,eAAO,MAAM,OAAO,EAAE,OAAyB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,OAAO,GAAG,CAAC;IAChB,OAAO,EAAE,OAAO,OAAO,CAAC;IAExB;;OAEG;IACH,GAAG,EAAE,OAAO,GAAG,CAAC;IAEhB;;;;OAIG;IACH,MAAM,EAAE,OAAO,MAAM,CAAC;IACtB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IAEnB;;;;;;;;;;;;;;;;;OAiBG;IACH,CAAC,OAAO,EAAE,MAAM,EAAE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AcG;AACH,iBAAe,GAAG,CAAC,CAAC,EAClB,GAAG,IAAI,EACH,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,GAC3D;IACE,EAAE,EAAE,MAAM;IACV,OAAO,EAAE,UAAU;IACnB,EAAE,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC;CAC9C,GACJ,OAAO,CAAC,CAAC,CAAC,CAoEZ"}
|
package/lib/alchemy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alchemy.js","sourceRoot":"","sources":["../src/alchemy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EACL,WAAW,EACX,UAAU,EACV,YAAY,EACZ,aAAa,EACb,WAAW,GAEZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"alchemy.js","sourceRoot":"","sources":["../src/alchemy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACx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AY,cAAc,CAAC,EACtE,CAAC;YACD,MAAM,CAAC,IAAI,EAAE,CAAC;QAChB,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;YAAS,CAAC;QACT,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import type { Secret } from "../secret.ts";
|
|
2
|
+
/**
|
|
3
|
+
* AWS client properties for credential configuration.
|
|
4
|
+
*
|
|
5
|
+
* This interface defines the properties that can be used to configure AWS credentials
|
|
6
|
+
* at different levels of your application. It supports the three-tier credential resolution
|
|
7
|
+
* system (global → scope → resource) and enables multi-account and multi-region deployments.
|
|
8
|
+
*
|
|
9
|
+
* These properties can be specified at:
|
|
10
|
+
* 1. Resource level - directly in resource creation parameters
|
|
11
|
+
* 2. Scope level - in alchemy.run() options with `aws` property
|
|
12
|
+
* 3. Global level - through environment variables (AWS_REGION, AWS_PROFILE, etc.)
|
|
13
|
+
*
|
|
14
|
+
* The credential resolution follows a precedence order where resource-level credentials
|
|
15
|
+
* override scope-level credentials, which override global environment variables.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // Resource-level credential overrides
|
|
20
|
+
* const vpc = await Vpc("main-vpc", {
|
|
21
|
+
* cidrBlock: "10.0.0.0/16",
|
|
22
|
+
* region: "us-west-2", // Override region
|
|
23
|
+
* profile: "production", // Override profile
|
|
24
|
+
* tags: { Name: "main-vpc" }
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* // Scope-level credential configuration
|
|
31
|
+
* await alchemy.run("production", {
|
|
32
|
+
* aws: {
|
|
33
|
+
* region: "us-west-2",
|
|
34
|
+
* profile: "production",
|
|
35
|
+
* }
|
|
36
|
+
* }, async () => {
|
|
37
|
+
* // Resources created here will use the scope credentials by default
|
|
38
|
+
* const vpc = await Vpc("main-vpc", {
|
|
39
|
+
* cidrBlock: "10.0.0.0/16"
|
|
40
|
+
* });
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export interface AwsClientProps {
|
|
45
|
+
/**
|
|
46
|
+
* AWS access key ID for authentication.
|
|
47
|
+
*
|
|
48
|
+
* This corresponds to the AWS_ACCESS_KEY_ID environment variable.
|
|
49
|
+
* When provided at the resource or scope level, it overrides the environment variable.
|
|
50
|
+
*/
|
|
51
|
+
accessKeyId?: Secret<string>;
|
|
52
|
+
/**
|
|
53
|
+
* AWS secret access key for authentication.
|
|
54
|
+
*
|
|
55
|
+
* This corresponds to the AWS_SECRET_ACCESS_KEY environment variable.
|
|
56
|
+
* When provided at the resource or scope level, it overrides the environment variable.
|
|
57
|
+
*/
|
|
58
|
+
secretAccessKey?: Secret<string>;
|
|
59
|
+
/**
|
|
60
|
+
* AWS session token for temporary credentials.
|
|
61
|
+
*
|
|
62
|
+
* This corresponds to the AWS_SESSION_TOKEN environment variable.
|
|
63
|
+
* Used with temporary credentials from STS or when assuming a role.
|
|
64
|
+
*/
|
|
65
|
+
sessionToken?: Secret<string>;
|
|
66
|
+
/**
|
|
67
|
+
* AWS region to use for API calls.
|
|
68
|
+
*
|
|
69
|
+
* This corresponds to the AWS_REGION or AWS_DEFAULT_REGION environment variables.
|
|
70
|
+
* When provided at the resource or scope level, it overrides the environment variables.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* // Resource in a specific region
|
|
75
|
+
* const euVpc = await Vpc("eu-vpc", {
|
|
76
|
+
* cidrBlock: "10.0.0.0/16",
|
|
77
|
+
* region: "eu-west-1",
|
|
78
|
+
* tags: { Name: "eu-vpc" }
|
|
79
|
+
* });
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
region?: string;
|
|
83
|
+
/**
|
|
84
|
+
* AWS profile name to use from credentials file.
|
|
85
|
+
*
|
|
86
|
+
* This corresponds to the AWS_PROFILE environment variable.
|
|
87
|
+
* Profiles are defined in ~/.aws/credentials or ~/.aws/config files.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* // Resource using a specific profile
|
|
92
|
+
* const prodVpc = await Vpc("prod-vpc", {
|
|
93
|
+
* cidrBlock: "10.0.0.0/16",
|
|
94
|
+
* profile: "production-account",
|
|
95
|
+
* tags: { Name: "prod-vpc" }
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
profile?: string;
|
|
100
|
+
/**
|
|
101
|
+
* AWS role ARN to assume for authentication.
|
|
102
|
+
*
|
|
103
|
+
* This corresponds to the AWS_ROLE_ARN environment variable.
|
|
104
|
+
* Used for cross-account access or for assuming roles with specific permissions.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* // Resource using role assumption
|
|
109
|
+
* const crossAccountVpc = await Vpc("cross-account-vpc", {
|
|
110
|
+
* cidrBlock: "10.0.0.0/16",
|
|
111
|
+
* roleArn: "arn:aws:iam::123456789012:role/DeploymentRole",
|
|
112
|
+
* roleSessionName: "alchemy-deployment",
|
|
113
|
+
* tags: { Name: "cross-account-vpc" }
|
|
114
|
+
* });
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
roleArn?: string;
|
|
118
|
+
/**
|
|
119
|
+
* External ID to use when assuming a role.
|
|
120
|
+
*
|
|
121
|
+
* This corresponds to the AWS_EXTERNAL_ID environment variable.
|
|
122
|
+
* Used as an additional security measure when assuming roles across accounts.
|
|
123
|
+
*/
|
|
124
|
+
externalId?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Session name to use when assuming a role.
|
|
127
|
+
*
|
|
128
|
+
* This corresponds to the AWS_ROLE_SESSION_NAME environment variable.
|
|
129
|
+
* Helps identify who/what is using the assumed role in AWS CloudTrail logs.
|
|
130
|
+
*/
|
|
131
|
+
roleSessionName?: string;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* AWS scope extensions - adds AWS credential support to scope options.
|
|
135
|
+
* This uses TypeScript module augmentation to extend the ProviderCredentials interface.
|
|
136
|
+
* Since ScopeOptions and RunOptions both extend ProviderCredentials,
|
|
137
|
+
* they automatically inherit these properties.
|
|
138
|
+
*/
|
|
139
|
+
declare module "../scope.ts" {
|
|
140
|
+
interface ProviderCredentials {
|
|
141
|
+
/**
|
|
142
|
+
* AWS credentials configuration for this scope.
|
|
143
|
+
* All AWS resources created within this scope will inherit these credentials
|
|
144
|
+
* unless overridden at the resource level.
|
|
145
|
+
*/
|
|
146
|
+
aws?: AwsClientProps;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=client-props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-props.d.ts","sourceRoot":"","sources":["../../src/aws/client-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAE7B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAEjC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAE9B;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AACD;;;;;GAKG;AACH,OAAO,QAAQ,aAAa,CAAC;IAC3B,UAAU,mBAAmB;QAC3B;;;;WAIG;QACH,GAAG,CAAC,EAAE,cAAc,CAAC;KACtB;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=client-props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-props.js","sourceRoot":"","sources":["../../src/aws/client-props.ts"],"names":[],"mappings":""}
|
package/lib/aws/credentials.d.ts
CHANGED
|
@@ -1,6 +1,69 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { AwsClientProps } from "./client-props.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Get global AWS configuration from environment variables.
|
|
4
|
+
* This provides the base layer of AWS credential configuration.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getGlobalAwsConfig(): AwsClientProps;
|
|
7
|
+
/**
|
|
8
|
+
* Resolve AWS credentials using three-tier resolution: global → scope → resource.
|
|
9
|
+
*
|
|
10
|
+
* This function implements a comprehensive credential resolution system that allows
|
|
11
|
+
* for flexible AWS credential management across different levels of your application.
|
|
12
|
+
* It enables multi-account and multi-region deployments by providing a consistent
|
|
13
|
+
* way to override credentials at different scopes.
|
|
14
|
+
*
|
|
15
|
+
* The resolution follows this precedence order:
|
|
16
|
+
* 1. Resource-level credentials (highest priority)
|
|
17
|
+
* 2. Scope-level credentials (medium priority)
|
|
18
|
+
* 3. Global environment variables (lowest priority)
|
|
19
|
+
*
|
|
20
|
+
* Supported credential properties include:
|
|
21
|
+
* - `region`: AWS region (e.g., 'us-west-2', 'eu-central-1')
|
|
22
|
+
* - `profile`: AWS profile name from credentials file
|
|
23
|
+
* - `accessKeyId`: AWS access key ID
|
|
24
|
+
* - `secretAccessKey`: AWS secret access key
|
|
25
|
+
* - `sessionToken`: AWS session token for temporary credentials
|
|
26
|
+
* - `roleArn`: AWS role ARN to assume
|
|
27
|
+
* - `roleSessionName`: Session name when assuming a role
|
|
28
|
+
* - `externalId`: External ID when assuming a role
|
|
29
|
+
*
|
|
30
|
+
* @param resourceProps - Resource-level AWS credential properties (optional)
|
|
31
|
+
* @returns Resolved AWS client properties with validation
|
|
32
|
+
*
|
|
33
|
+
* @throws {Error} When scope contains invalid AWS configuration
|
|
34
|
+
* @throws {Error} When resource properties contain invalid AWS configuration
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* // Basic usage with resource-level credentials
|
|
39
|
+
* const credentials = resolveAwsCredentials({
|
|
40
|
+
* region: "us-west-2",
|
|
41
|
+
* profile: "production"
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* // Usage with scope-level credentials
|
|
48
|
+
* await alchemy.run("my-app", {
|
|
49
|
+
* aws: {
|
|
50
|
+
* region: "eu-west-1",
|
|
51
|
+
* profile: "staging"
|
|
52
|
+
* }
|
|
53
|
+
* }, async () => {
|
|
54
|
+
* // Resources created here will use the scope credentials by default
|
|
55
|
+
* const vpc = await Vpc("main-vpc", {
|
|
56
|
+
* cidrBlock: "10.0.0.0/16"
|
|
57
|
+
* });
|
|
58
|
+
*
|
|
59
|
+
* // Resources can override scope credentials
|
|
60
|
+
* const crossRegionSubnet = await Subnet("cross-region-subnet", {
|
|
61
|
+
* vpc,
|
|
62
|
+
* cidrBlock: "10.0.1.0/24",
|
|
63
|
+
* region: "us-east-1" // Override scope region
|
|
64
|
+
* });
|
|
65
|
+
* });
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare function resolveAwsCredentials(resourceProps?: AwsClientProps): Promise<AwsClientProps>;
|
|
6
69
|
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/aws/credentials.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/aws/credentials.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAgCxD;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,cAAc,CAiBnD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,wBAAsB,qBAAqB,CACzC,aAAa,CAAC,EAAE,cAAc,GAC7B,OAAO,CAAC,cAAc,CAAC,CA8CzB"}
|
package/lib/aws/credentials.js
CHANGED
|
@@ -1 +1,149 @@
|
|
|
1
|
+
import { alchemy } from "../alchemy.js";
|
|
2
|
+
import { isSecret } from "../secret.js";
|
|
3
|
+
/**
|
|
4
|
+
* Validate AWS client properties to ensure they are strings.
|
|
5
|
+
* This follows the same pattern as Cloudflare credential validation.
|
|
6
|
+
*/
|
|
7
|
+
function validateAwsClientProps(props, context) {
|
|
8
|
+
const validKeys = [
|
|
9
|
+
"accessKeyId",
|
|
10
|
+
"secretAccessKey",
|
|
11
|
+
"sessionToken",
|
|
12
|
+
"region",
|
|
13
|
+
"profile",
|
|
14
|
+
"roleArn",
|
|
15
|
+
"externalId",
|
|
16
|
+
"roleSessionName",
|
|
17
|
+
];
|
|
18
|
+
for (const [key, value] of Object.entries(props)) {
|
|
19
|
+
if (!validKeys.includes(key)) {
|
|
20
|
+
continue; // Ignore unknown properties
|
|
21
|
+
}
|
|
22
|
+
if (value !== undefined && typeof value !== "string" && !isSecret(value)) {
|
|
23
|
+
throw new Error(`Invalid AWS configuration in ${context}: Property '${key}' must be a string or Secret, got ${typeof value}. ` +
|
|
24
|
+
"Please ensure all AWS credential properties are strings or Secret objects.");
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get global AWS configuration from environment variables.
|
|
30
|
+
* This provides the base layer of AWS credential configuration.
|
|
31
|
+
*/
|
|
32
|
+
export function getGlobalAwsConfig() {
|
|
33
|
+
return {
|
|
34
|
+
accessKeyId: process.env.AWS_ACCESS_KEY_ID
|
|
35
|
+
? alchemy.secret(process.env.AWS_ACCESS_KEY_ID)
|
|
36
|
+
: undefined,
|
|
37
|
+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
|
|
38
|
+
? alchemy.secret(process.env.AWS_SECRET_ACCESS_KEY)
|
|
39
|
+
: undefined,
|
|
40
|
+
sessionToken: process.env.AWS_SESSION_TOKEN
|
|
41
|
+
? alchemy.secret(process.env.AWS_SESSION_TOKEN)
|
|
42
|
+
: undefined,
|
|
43
|
+
region: process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION,
|
|
44
|
+
profile: process.env.AWS_PROFILE,
|
|
45
|
+
roleArn: process.env.AWS_ROLE_ARN,
|
|
46
|
+
externalId: process.env.AWS_EXTERNAL_ID,
|
|
47
|
+
roleSessionName: process.env.AWS_ROLE_SESSION_NAME,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Resolve AWS credentials using three-tier resolution: global → scope → resource.
|
|
52
|
+
*
|
|
53
|
+
* This function implements a comprehensive credential resolution system that allows
|
|
54
|
+
* for flexible AWS credential management across different levels of your application.
|
|
55
|
+
* It enables multi-account and multi-region deployments by providing a consistent
|
|
56
|
+
* way to override credentials at different scopes.
|
|
57
|
+
*
|
|
58
|
+
* The resolution follows this precedence order:
|
|
59
|
+
* 1. Resource-level credentials (highest priority)
|
|
60
|
+
* 2. Scope-level credentials (medium priority)
|
|
61
|
+
* 3. Global environment variables (lowest priority)
|
|
62
|
+
*
|
|
63
|
+
* Supported credential properties include:
|
|
64
|
+
* - `region`: AWS region (e.g., 'us-west-2', 'eu-central-1')
|
|
65
|
+
* - `profile`: AWS profile name from credentials file
|
|
66
|
+
* - `accessKeyId`: AWS access key ID
|
|
67
|
+
* - `secretAccessKey`: AWS secret access key
|
|
68
|
+
* - `sessionToken`: AWS session token for temporary credentials
|
|
69
|
+
* - `roleArn`: AWS role ARN to assume
|
|
70
|
+
* - `roleSessionName`: Session name when assuming a role
|
|
71
|
+
* - `externalId`: External ID when assuming a role
|
|
72
|
+
*
|
|
73
|
+
* @param resourceProps - Resource-level AWS credential properties (optional)
|
|
74
|
+
* @returns Resolved AWS client properties with validation
|
|
75
|
+
*
|
|
76
|
+
* @throws {Error} When scope contains invalid AWS configuration
|
|
77
|
+
* @throws {Error} When resource properties contain invalid AWS configuration
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* // Basic usage with resource-level credentials
|
|
82
|
+
* const credentials = resolveAwsCredentials({
|
|
83
|
+
* region: "us-west-2",
|
|
84
|
+
* profile: "production"
|
|
85
|
+
* });
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* // Usage with scope-level credentials
|
|
91
|
+
* await alchemy.run("my-app", {
|
|
92
|
+
* aws: {
|
|
93
|
+
* region: "eu-west-1",
|
|
94
|
+
* profile: "staging"
|
|
95
|
+
* }
|
|
96
|
+
* }, async () => {
|
|
97
|
+
* // Resources created here will use the scope credentials by default
|
|
98
|
+
* const vpc = await Vpc("main-vpc", {
|
|
99
|
+
* cidrBlock: "10.0.0.0/16"
|
|
100
|
+
* });
|
|
101
|
+
*
|
|
102
|
+
* // Resources can override scope credentials
|
|
103
|
+
* const crossRegionSubnet = await Subnet("cross-region-subnet", {
|
|
104
|
+
* vpc,
|
|
105
|
+
* cidrBlock: "10.0.1.0/24",
|
|
106
|
+
* region: "us-east-1" // Override scope region
|
|
107
|
+
* });
|
|
108
|
+
* });
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export async function resolveAwsCredentials(resourceProps) {
|
|
112
|
+
// 1. Start with global environment variables (lowest priority)
|
|
113
|
+
const globalConfig = getGlobalAwsConfig();
|
|
114
|
+
// 2. Layer in scope-level credentials (medium priority)
|
|
115
|
+
let scopeConfig = {};
|
|
116
|
+
try {
|
|
117
|
+
// Import Scope dynamically to avoid circular dependency
|
|
118
|
+
const { Scope } = await import("../scope.js");
|
|
119
|
+
const currentScope = Scope.getScope();
|
|
120
|
+
if (currentScope?.providerCredentials?.aws) {
|
|
121
|
+
scopeConfig = currentScope.providerCredentials.aws;
|
|
122
|
+
// Validate scope-level credentials if provided
|
|
123
|
+
validateAwsClientProps(scopeConfig, "scope");
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
// If we can't access scope (e.g., not running in scope context), just continue
|
|
128
|
+
// with empty scope config unless it's a validation error
|
|
129
|
+
if (error instanceof Error &&
|
|
130
|
+
error.message.includes("Invalid AWS configuration")) {
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// 3. Layer in resource-level credentials (highest priority)
|
|
135
|
+
const resourceConfig = resourceProps || {};
|
|
136
|
+
// Validate resource-level credentials if provided
|
|
137
|
+
if (resourceProps && Object.keys(resourceProps).length > 0) {
|
|
138
|
+
validateAwsClientProps(resourceProps, "resource properties");
|
|
139
|
+
}
|
|
140
|
+
// Merge configurations with proper precedence (later properties override earlier ones)
|
|
141
|
+
const resolvedConfig = {
|
|
142
|
+
...globalConfig,
|
|
143
|
+
...scopeConfig,
|
|
144
|
+
...resourceConfig,
|
|
145
|
+
};
|
|
146
|
+
// Filter out undefined values from the final result
|
|
147
|
+
return Object.fromEntries(Object.entries(resolvedConfig).filter(([_, value]) => value !== undefined));
|
|
148
|
+
}
|
|
1
149
|
//# sourceMappingURL=credentials.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/aws/credentials.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/aws/credentials.ts"],"names":[],"mapp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DAAkD;IAClD,IAAI,aAAa,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3D,sBAAsB,CAAC,aAAa,EAAE,qBAAqB,CAAC,CAAC;IAC/D,CAAC;IAED,uFAAuF;IACvF,MAAM,cAAc,GAAG;QACrB,GAAG,YAAY;QACf,GAAG,WAAW;QACd,GAAG,cAAc;KAClB,CAAC;IAEF,oDAAoD;IACpD,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CACzD,CAAC;AACtB,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { Context } from "../../context.ts";
|
|
2
2
|
import { Resource } from "../../resource.ts";
|
|
3
3
|
import { type TimeoutConfig } from "../../util/timeout.ts";
|
|
4
|
+
import type { AwsClientProps } from "../client-props.ts";
|
|
4
5
|
import type { InternetGateway } from "./internet-gateway.ts";
|
|
5
6
|
import type { Vpc } from "./vpc.ts";
|
|
6
7
|
/**
|
|
7
8
|
* Properties for creating or updating an Internet Gateway Attachment
|
|
8
9
|
*/
|
|
9
|
-
export interface InternetGatewayAttachmentProps {
|
|
10
|
+
export interface InternetGatewayAttachmentProps extends AwsClientProps {
|
|
10
11
|
/**
|
|
11
12
|
* The Internet Gateway to attach
|
|
12
13
|
*/
|
|
@@ -50,6 +51,9 @@ export interface InternetGatewayAttachment extends Resource<"aws::InternetGatewa
|
|
|
50
51
|
* allowing traffic to flow between the VPC and the internet when combined with proper
|
|
51
52
|
* routing configuration.
|
|
52
53
|
*
|
|
54
|
+
* Supports AWS credential overrides at the resource level, allowing you to deploy Internet Gateway Attachments
|
|
55
|
+
* to different AWS accounts or regions than the default scope configuration.
|
|
56
|
+
*
|
|
53
57
|
* @example
|
|
54
58
|
* // Basic Internet Gateway attachment for internet connectivity
|
|
55
59
|
* const vpc = await Vpc("main-vpc", {
|
|
@@ -64,6 +68,36 @@ export interface InternetGatewayAttachment extends Resource<"aws::InternetGatewa
|
|
|
64
68
|
* });
|
|
65
69
|
*
|
|
66
70
|
* @example
|
|
71
|
+
* // Internet Gateway Attachment with AWS credential overrides
|
|
72
|
+
* const crossAccountAttachment = await InternetGatewayAttachment("cross-account-attachment", {
|
|
73
|
+
* internetGateway: igw,
|
|
74
|
+
* vpc: vpc,
|
|
75
|
+
* // Override AWS credentials for this specific resource
|
|
76
|
+
* region: "us-east-1",
|
|
77
|
+
* profile: "production-account",
|
|
78
|
+
* });
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* // Internet Gateway Attachment in different region with role assumption
|
|
82
|
+
* const multiRegionAttachment = await InternetGatewayAttachment("multi-region-attachment", {
|
|
83
|
+
* internetGateway: euIgw,
|
|
84
|
+
* vpc: euVpc,
|
|
85
|
+
* region: "eu-west-1",
|
|
86
|
+
* roleArn: "arn:aws:iam::123456789012:role/CrossRegionRole",
|
|
87
|
+
* roleSessionName: "igw-attachment-deployment",
|
|
88
|
+
* });
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* // Internet Gateway Attachment with explicit credentials
|
|
92
|
+
* const explicitCredsAttachment = await InternetGatewayAttachment("explicit-creds-attachment", {
|
|
93
|
+
* internetGateway: testIgw,
|
|
94
|
+
* vpc: testVpc,
|
|
95
|
+
* accessKeyId: alchemy.secret("AKIAIOSFODNN7EXAMPLE"),
|
|
96
|
+
* secretAccessKey: alchemy.secret("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"),
|
|
97
|
+
* region: "us-west-2",
|
|
98
|
+
* });
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
67
101
|
* // Internet Gateway attachment with custom timeout configuration
|
|
68
102
|
* // for environments with slower AWS API responses
|
|
69
103
|
* const attachment = await InternetGatewayAttachment("slow-env-attachment", {
|
|
@@ -92,7 +126,7 @@ export interface InternetGatewayAttachment extends Resource<"aws::InternetGatewa
|
|
|
92
126
|
*
|
|
93
127
|
* // Create public subnet and route table for internet access
|
|
94
128
|
* const publicSubnet = await Subnet("public-subnet", {
|
|
95
|
-
* vpc,
|
|
129
|
+
* vpc: vpc,
|
|
96
130
|
* cidrBlock: "10.0.1.0/24",
|
|
97
131
|
* availabilityZone: "us-east-1a"
|
|
98
132
|
* });
|
|
@@ -104,7 +138,27 @@ export interface InternetGatewayAttachment extends Resource<"aws::InternetGatewa
|
|
|
104
138
|
* const internetRoute = await Route("internet-route", {
|
|
105
139
|
* routeTable: publicRouteTable,
|
|
106
140
|
* destinationCidrBlock: "0.0.0.0/0",
|
|
107
|
-
*
|
|
141
|
+
* target: { internetGateway: igw }
|
|
142
|
+
* });
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* // Multi-account deployment with scope-level and resource-level overrides
|
|
146
|
+
* await alchemy.run("production", {
|
|
147
|
+
* aws: { region: "us-west-2", profile: "main-account" }
|
|
148
|
+
* }, async () => {
|
|
149
|
+
* // This Internet Gateway Attachment uses scope credentials (main-account, us-west-2)
|
|
150
|
+
* const mainAttachment = await InternetGatewayAttachment("main-attachment", {
|
|
151
|
+
* internetGateway: mainIgw,
|
|
152
|
+
* vpc: mainVpc
|
|
153
|
+
* });
|
|
154
|
+
*
|
|
155
|
+
* // This Internet Gateway Attachment overrides to use different account
|
|
156
|
+
* const crossAccountAttachment = await InternetGatewayAttachment("cross-account-attachment", {
|
|
157
|
+
* internetGateway: crossIgw,
|
|
158
|
+
* vpc: crossVpc,
|
|
159
|
+
* profile: "secondary-account",
|
|
160
|
+
* region: "us-east-1", // Also override region
|
|
161
|
+
* });
|
|
108
162
|
* });
|
|
109
163
|
*/
|
|
110
164
|
export declare const InternetGatewayAttachment: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<InternetGatewayAttachment>, _id: string, props: InternetGatewayAttachmentProps) => Promise<InternetGatewayAttachment>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internet-gateway-attachment.d.ts","sourceRoot":"","sources":["../../../src/aws/ec2/internet-gateway-attachment.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"internet-gateway-attachment.d.ts","sourceRoot":"","sources":["../../../src/aws/ec2/internet-gateway-attachment.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,8BAA+B,SAAQ,cAAc;IACpE;;OAEG;IACH,eAAe,EAAE,eAAe,GAAG,MAAM,CAAC;IAE1C;;OAEG;IACH,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC;IAElB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,yBACf,SAAQ,QAAQ,CAAC,gCAAgC,CAAC,EAChD,8BAA8B;IAChC;;OAEG;IACH,iB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