alchemy 0.53.0 → 0.55.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/bin/alchemy.js +196353 -0
- package/bin/alchemy.ts +2 -2
- package/bin/commands/init.ts +1190 -0
- package/bin/constants.ts +18 -0
- package/bin/services/execute-alchemy.ts +7 -2
- package/bin/services/package-manager.ts +1 -1
- package/bin/types.ts +14 -5
- package/lib/aws/ec2/index.d.ts +10 -0
- package/lib/aws/ec2/index.d.ts.map +1 -0
- package/lib/aws/ec2/index.js +10 -0
- package/lib/aws/ec2/index.js.map +1 -0
- package/lib/aws/ec2/internet-gateway-attachment.d.ts +150 -0
- package/lib/aws/ec2/internet-gateway-attachment.d.ts.map +1 -0
- package/lib/aws/ec2/internet-gateway-attachment.js +248 -0
- package/lib/aws/ec2/internet-gateway-attachment.js.map +1 -0
- package/lib/aws/ec2/internet-gateway.d.ts +132 -0
- package/lib/aws/ec2/internet-gateway.d.ts.map +1 -0
- package/lib/aws/ec2/internet-gateway.js +311 -0
- package/lib/aws/ec2/internet-gateway.js.map +1 -0
- package/lib/aws/ec2/nat-gateway.d.ts +145 -0
- package/lib/aws/ec2/nat-gateway.d.ts.map +1 -0
- package/lib/aws/ec2/nat-gateway.js +618 -0
- package/lib/aws/ec2/nat-gateway.js.map +1 -0
- package/lib/aws/ec2/route-table-association.d.ts +134 -0
- package/lib/aws/ec2/route-table-association.d.ts.map +1 -0
- package/lib/aws/ec2/route-table-association.js +364 -0
- package/lib/aws/ec2/route-table-association.js.map +1 -0
- package/lib/aws/ec2/route-table.d.ts +94 -0
- package/lib/aws/ec2/route-table.d.ts.map +1 -0
- package/lib/aws/ec2/route-table.js +253 -0
- package/lib/aws/ec2/route-table.js.map +1 -0
- package/lib/aws/ec2/route.d.ts +130 -0
- package/lib/aws/ec2/route.d.ts.map +1 -0
- package/lib/aws/ec2/route.js +253 -0
- package/lib/aws/ec2/route.js.map +1 -0
- package/lib/aws/ec2/security-group-rule.d.ts +84 -0
- package/lib/aws/ec2/security-group-rule.d.ts.map +1 -0
- package/lib/aws/ec2/security-group-rule.js +123 -0
- package/lib/aws/ec2/security-group-rule.js.map +1 -0
- package/lib/aws/ec2/security-group.d.ts +84 -0
- package/lib/aws/ec2/security-group.d.ts.map +1 -0
- package/lib/aws/ec2/security-group.js +207 -0
- package/lib/aws/ec2/security-group.js.map +1 -0
- package/lib/aws/ec2/subnet.d.ts +110 -0
- package/lib/aws/ec2/subnet.d.ts.map +1 -0
- package/lib/aws/ec2/subnet.js +336 -0
- package/lib/aws/ec2/subnet.js.map +1 -0
- package/lib/aws/ec2/utils.d.ts +15 -0
- package/lib/aws/ec2/utils.d.ts.map +1 -0
- package/lib/aws/ec2/utils.js +79 -0
- package/lib/aws/ec2/utils.js.map +1 -0
- package/lib/aws/ec2/vpc.d.ts +160 -0
- package/lib/aws/ec2/vpc.d.ts.map +1 -0
- package/lib/aws/ec2/vpc.js +453 -0
- package/lib/aws/ec2/vpc.js.map +1 -0
- package/lib/aws/index.d.ts +7 -0
- package/lib/aws/index.d.ts.map +1 -1
- package/lib/aws/index.js +8 -0
- package/lib/aws/index.js.map +1 -1
- package/lib/aws/utils.d.ts +25 -0
- package/lib/aws/utils.d.ts.map +1 -0
- package/lib/aws/utils.js +89 -0
- package/lib/aws/utils.js.map +1 -0
- package/lib/build-date.d.ts +6 -0
- package/lib/build-date.d.ts.map +1 -0
- package/lib/build-date.js +8 -0
- package/lib/build-date.js.map +1 -0
- package/lib/cloudflare/astro.d.ts.map +1 -1
- package/lib/cloudflare/astro.js +4 -3
- package/lib/cloudflare/astro.js.map +1 -1
- package/lib/cloudflare/bundle/externals.d.ts +3 -0
- package/lib/cloudflare/bundle/externals.d.ts.map +1 -0
- package/lib/cloudflare/bundle/externals.js +35 -0
- package/lib/cloudflare/bundle/externals.js.map +1 -0
- package/lib/cloudflare/bundle/internal-worker-bundle.d.ts +8 -1
- package/lib/cloudflare/bundle/internal-worker-bundle.d.ts.map +1 -1
- package/lib/cloudflare/bundle/internal-worker-bundle.js +11 -4
- package/lib/cloudflare/bundle/internal-worker-bundle.js.map +1 -1
- package/lib/cloudflare/bundle/plugin-hot-reload.d.ts +4 -1
- package/lib/cloudflare/bundle/plugin-hot-reload.d.ts.map +1 -1
- package/lib/cloudflare/bundle/plugin-hot-reload.js +27 -11
- package/lib/cloudflare/bundle/plugin-hot-reload.js.map +1 -1
- package/lib/cloudflare/bundle/plugin-hybrid-node-compat.js +5 -1
- package/lib/cloudflare/bundle/plugin-hybrid-node-compat.js.map +1 -1
- package/lib/cloudflare/bundle/plugin-wasm.d.ts +6 -2
- package/lib/cloudflare/bundle/plugin-wasm.d.ts.map +1 -1
- package/lib/cloudflare/bundle/plugin-wasm.js +21 -47
- package/lib/cloudflare/bundle/plugin-wasm.js.map +1 -1
- package/lib/cloudflare/bundle/validate-node-compat.d.ts +2 -1
- package/lib/cloudflare/bundle/validate-node-compat.d.ts.map +1 -1
- package/lib/cloudflare/bundle/validate-node-compat.js +5 -4
- package/lib/cloudflare/bundle/validate-node-compat.js.map +1 -1
- package/lib/cloudflare/compatibility-date.gen.d.ts +1 -1
- package/lib/cloudflare/compatibility-date.gen.js +1 -1
- package/lib/cloudflare/d1-database.js +1 -1
- package/lib/cloudflare/d1-database.js.map +1 -1
- package/lib/cloudflare/d1-migrations.d.ts.map +1 -1
- package/lib/cloudflare/d1-migrations.js +8 -10
- package/lib/cloudflare/d1-migrations.js.map +1 -1
- package/lib/cloudflare/miniflare/miniflare-worker-options.d.ts +3 -3
- package/lib/cloudflare/miniflare/miniflare-worker-options.d.ts.map +1 -1
- package/lib/cloudflare/miniflare/miniflare-worker-options.js +23 -6
- package/lib/cloudflare/miniflare/miniflare-worker-options.js.map +1 -1
- package/lib/cloudflare/miniflare/miniflare.d.ts.map +1 -1
- package/lib/cloudflare/miniflare/miniflare.js +2 -4
- package/lib/cloudflare/miniflare/miniflare.js.map +1 -1
- package/lib/cloudflare/miniflare/remote-binding-proxy.d.ts.map +1 -1
- package/lib/cloudflare/miniflare/remote-binding-proxy.js +4 -6
- package/lib/cloudflare/miniflare/remote-binding-proxy.js.map +1 -1
- package/lib/cloudflare/react-router.d.ts +4 -0
- package/lib/cloudflare/react-router.d.ts.map +1 -1
- package/lib/cloudflare/react-router.js +8 -5
- package/lib/cloudflare/react-router.js.map +1 -1
- package/lib/cloudflare/worker-bundle.d.ts +80 -0
- package/lib/cloudflare/worker-bundle.d.ts.map +1 -0
- package/lib/cloudflare/worker-bundle.js +266 -0
- package/lib/cloudflare/worker-bundle.js.map +1 -0
- package/lib/cloudflare/worker.d.ts +1 -1
- package/lib/cloudflare/worker.d.ts.map +1 -1
- package/lib/cloudflare/worker.js +81 -195
- package/lib/cloudflare/worker.js.map +1 -1
- package/lib/esbuild/bundle.d.ts +1 -0
- package/lib/esbuild/bundle.d.ts.map +1 -1
- package/lib/state/cloudflare-state-store.js +1 -5
- package/lib/state/cloudflare-state-store.js.map +1 -1
- package/lib/state/dofs-state-store/store.d.ts.map +1 -1
- package/lib/state/dofs-state-store/store.js +4 -4
- package/lib/state/dofs-state-store/store.js.map +1 -1
- package/lib/util/params.d.ts +5 -0
- package/lib/util/params.d.ts.map +1 -0
- package/lib/util/params.js +30 -0
- package/lib/util/params.js.map +1 -0
- package/lib/util/timeout.d.ts +31 -0
- package/lib/util/timeout.d.ts.map +1 -0
- package/lib/util/timeout.js +109 -0
- package/lib/util/timeout.js.map +1 -0
- package/lib/util/xml.d.ts +5 -0
- package/lib/util/xml.d.ts.map +1 -0
- package/lib/util/xml.js +8 -0
- package/lib/util/xml.js.map +1 -0
- package/package.json +12 -5
- package/src/aws/ec2/index.ts +9 -0
- package/src/aws/ec2/internet-gateway-attachment.ts +468 -0
- package/src/aws/ec2/internet-gateway.ts +557 -0
- package/src/aws/ec2/nat-gateway.ts +1123 -0
- package/src/aws/ec2/route-table-association.ts +747 -0
- package/src/aws/ec2/route-table.ts +452 -0
- package/src/aws/ec2/route.ts +447 -0
- package/src/aws/ec2/security-group-rule.ts +229 -0
- package/src/aws/ec2/security-group.ts +418 -0
- package/src/aws/ec2/subnet.ts +625 -0
- package/src/aws/ec2/utils.ts +102 -0
- package/src/aws/ec2/vpc.ts +969 -0
- package/src/aws/index.ts +9 -0
- package/src/aws/utils.ts +137 -0
- package/src/build-date.ts +8 -0
- package/src/cloudflare/astro.ts +4 -3
- package/src/cloudflare/bundle/externals.ts +36 -0
- package/src/cloudflare/bundle/internal-worker-bundle.ts +12 -3
- package/src/cloudflare/bundle/plugin-hot-reload.ts +32 -12
- package/src/cloudflare/bundle/plugin-hybrid-node-compat.ts +6 -1
- package/src/cloudflare/bundle/plugin-wasm.ts +26 -54
- package/src/cloudflare/bundle/validate-node-compat.ts +6 -5
- package/src/cloudflare/compatibility-date.gen.ts +1 -1
- package/src/cloudflare/d1-database.ts +1 -1
- package/src/cloudflare/d1-migrations.ts +19 -18
- package/src/cloudflare/miniflare/miniflare-worker-options.ts +27 -13
- package/src/cloudflare/miniflare/miniflare.ts +2 -4
- package/src/cloudflare/miniflare/remote-binding-proxy.ts +5 -7
- package/src/cloudflare/react-router.ts +14 -6
- package/src/cloudflare/worker-bundle.ts +364 -0
- package/src/cloudflare/worker.ts +104 -241
- package/src/state/cloudflare-state-store.ts +1 -5
- package/src/state/dofs-state-store/store.ts +4 -4
- package/src/util/params.ts +33 -0
- package/src/util/timeout.ts +178 -0
- package/src/util/xml.ts +7 -0
- package/templates/nuxt/package.json +1 -1
- package/templates/nuxt/types/env.d.ts +11 -0
- package/templates/react-router/workers/app.ts +2 -2
- package/templates/rwsdk/.cursor/rules/alchemy_cloudflare.mdc +385 -0
- package/templates/rwsdk/wrangler.jsonc +10 -7
- package/templates/typescript/tsconfig.json +1 -2
- package/bin/alchemy.mjs +0 -51766
- package/lib/cloudflare/bundle/esbuild.d.ts +0 -16
- package/lib/cloudflare/bundle/esbuild.d.ts.map +0 -1
- package/lib/cloudflare/bundle/esbuild.js +0 -159
- package/lib/cloudflare/bundle/esbuild.js.map +0 -1
- package/lib/cloudflare/bundle/fs.d.ts +0 -18
- package/lib/cloudflare/bundle/fs.d.ts.map +0 -1
- package/lib/cloudflare/bundle/fs.js +0 -78
- package/lib/cloudflare/bundle/fs.js.map +0 -1
- package/lib/cloudflare/bundle/index.d.ts +0 -3
- package/lib/cloudflare/bundle/index.d.ts.map +0 -1
- package/lib/cloudflare/bundle/index.js +0 -2
- package/lib/cloudflare/bundle/index.js.map +0 -1
- package/lib/cloudflare/bundle/inline.d.ts +0 -12
- package/lib/cloudflare/bundle/inline.d.ts.map +0 -1
- package/lib/cloudflare/bundle/inline.js +0 -32
- package/lib/cloudflare/bundle/inline.js.map +0 -1
- package/lib/cloudflare/bundle/normalize.d.ts +0 -21
- package/lib/cloudflare/bundle/normalize.d.ts.map +0 -1
- package/lib/cloudflare/bundle/normalize.js +0 -49
- package/lib/cloudflare/bundle/normalize.js.map +0 -1
- package/lib/cloudflare/bundle/shared.d.ts +0 -30
- package/lib/cloudflare/bundle/shared.d.ts.map +0 -1
- package/lib/cloudflare/bundle/shared.js +0 -34
- package/lib/cloudflare/bundle/shared.js.map +0 -1
- package/src/cloudflare/bundle/esbuild.ts +0 -194
- package/src/cloudflare/bundle/fs.ts +0 -103
- package/src/cloudflare/bundle/index.ts +0 -6
- package/src/cloudflare/bundle/inline.ts +0 -42
- package/src/cloudflare/bundle/normalize.ts +0 -76
- package/src/cloudflare/bundle/shared.ts +0 -73
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { Context } from "../../context.ts";
|
|
2
|
+
import { Resource } from "../../resource.ts";
|
|
3
|
+
import { type TimeoutConfig } from "../../util/timeout.ts";
|
|
4
|
+
import type { RouteTable } from "./route-table.ts";
|
|
5
|
+
import type { Subnet } from "./subnet.ts";
|
|
6
|
+
/**
|
|
7
|
+
* Properties for creating or updating a Route Table Association
|
|
8
|
+
*/
|
|
9
|
+
export interface RouteTableAssociationProps {
|
|
10
|
+
/**
|
|
11
|
+
* The route table to associate
|
|
12
|
+
*/
|
|
13
|
+
routeTable: RouteTable | string;
|
|
14
|
+
/**
|
|
15
|
+
* The subnet to associate with the route table
|
|
16
|
+
* Either subnet or gateway must be specified, but not both
|
|
17
|
+
*/
|
|
18
|
+
subnet?: Subnet | string;
|
|
19
|
+
/**
|
|
20
|
+
* The internet gateway or virtual private gateway to associate with the route table
|
|
21
|
+
* Either subnet or gateway must be specified, but not both
|
|
22
|
+
*/
|
|
23
|
+
gateway?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Timeout configuration for Route Table Association operations
|
|
26
|
+
* @default Route Table Association-specific sensible defaults (30 attempts, 1000ms delay)
|
|
27
|
+
*/
|
|
28
|
+
timeout?: Partial<TimeoutConfig>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Output returned after Route Table Association creation/update
|
|
32
|
+
*/
|
|
33
|
+
export interface RouteTableAssociation extends Resource<"aws::RouteTableAssociation">, RouteTableAssociationProps {
|
|
34
|
+
/**
|
|
35
|
+
* The ID of the route table association
|
|
36
|
+
*/
|
|
37
|
+
associationId: string;
|
|
38
|
+
/**
|
|
39
|
+
* The ID of the route table
|
|
40
|
+
*/
|
|
41
|
+
routeTableId: string;
|
|
42
|
+
/**
|
|
43
|
+
* The ID of the subnet (if associated with a subnet)
|
|
44
|
+
*/
|
|
45
|
+
subnetId?: string;
|
|
46
|
+
/**
|
|
47
|
+
* The ID of the gateway (if associated with a gateway)
|
|
48
|
+
*/
|
|
49
|
+
gatewayId?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Whether this is the main route table association
|
|
52
|
+
*/
|
|
53
|
+
isMain: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* The state of the association
|
|
56
|
+
*/
|
|
57
|
+
state: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* AWS Route Table Association Resource
|
|
61
|
+
*
|
|
62
|
+
* Creates and manages associations between route tables and subnets or gateways.
|
|
63
|
+
* Each subnet can only be associated with one route table at a time. Route table
|
|
64
|
+
* associations determine which route table controls the traffic for a subnet.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* // Associate a subnet with a route table
|
|
68
|
+
* const association = await RouteTableAssociation("subnet-association", {
|
|
69
|
+
* routeTable: myRouteTable,
|
|
70
|
+
* subnet: mySubnet
|
|
71
|
+
* });
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* // Associate a subnet with a route table using IDs
|
|
75
|
+
* const association = await RouteTableAssociation("subnet-association", {
|
|
76
|
+
* routeTable: "rtb-12345678",
|
|
77
|
+
* subnet: "subnet-12345678"
|
|
78
|
+
* });
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* // Associate a gateway with a route table
|
|
82
|
+
* const gatewayAssociation = await RouteTableAssociation("gateway-association", {
|
|
83
|
+
* routeTable: myRouteTable,
|
|
84
|
+
* gateway: "igw-12345678"
|
|
85
|
+
* });
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* // Create association with custom timeout configuration
|
|
89
|
+
* const customAssociation = await RouteTableAssociation("custom-association", {
|
|
90
|
+
* routeTable: myRouteTable,
|
|
91
|
+
* subnet: mySubnet,
|
|
92
|
+
* timeout: {
|
|
93
|
+
* maxAttempts: 60,
|
|
94
|
+
* delayMs: 2000
|
|
95
|
+
* }
|
|
96
|
+
* });
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* // Associate multiple subnets with the same route table
|
|
100
|
+
* const publicSubnets = [subnet1, subnet2, subnet3];
|
|
101
|
+
* const associations = await Promise.all(
|
|
102
|
+
* publicSubnets.map((subnet, index) =>
|
|
103
|
+
* RouteTableAssociation(`public-association-${index}`, {
|
|
104
|
+
* routeTable: publicRouteTable,
|
|
105
|
+
* subnet
|
|
106
|
+
* })
|
|
107
|
+
* )
|
|
108
|
+
* );
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* // Associate private subnets with a private route table
|
|
112
|
+
* const privateAssociation1 = await RouteTableAssociation("private-association-1", {
|
|
113
|
+
* routeTable: privateRouteTable,
|
|
114
|
+
* subnet: privateSubnet1
|
|
115
|
+
* });
|
|
116
|
+
*
|
|
117
|
+
* const privateAssociation2 = await RouteTableAssociation("private-association-2", {
|
|
118
|
+
* routeTable: privateRouteTable,
|
|
119
|
+
* subnet: privateSubnet2
|
|
120
|
+
* });
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* // Handle association replacement scenarios
|
|
124
|
+
* const newAssociation = await RouteTableAssociation("replaced-association", {
|
|
125
|
+
* routeTable: newRouteTable,
|
|
126
|
+
* subnet: existingSubnet // This will replace any existing association
|
|
127
|
+
* });
|
|
128
|
+
*/
|
|
129
|
+
export declare const RouteTableAssociation: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<RouteTableAssociation>, _id: string, props: RouteTableAssociationProps) => Promise<RouteTableAssociation>);
|
|
130
|
+
/**
|
|
131
|
+
* Route Table Association timeout constants
|
|
132
|
+
*/
|
|
133
|
+
export declare const ROUTE_TABLE_ASSOCIATION_TIMEOUT: TimeoutConfig;
|
|
134
|
+
//# sourceMappingURL=route-table-association.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-table-association.d.ts","sourceRoot":"","sources":["../../../src/aws/ec2/route-table-association.ts"],"names":[],"mappings":"AAEA,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,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,UAAU,EAAE,UAAU,GAAG,MAAM,CAAC;IAEhC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAEzB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,qBACf,SAAQ,QAAQ,CAAC,4BAA4B,CAAC,EAC5C,0BAA0B;IAC5B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAkHD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AACH,eAAO,MAAM,qBAAqB,yFAGxB,OAAO,CAAC,qBAAqB,CAAC,OAC/B,MAAM,SACJ,0BAA0B,KAChC,OAAO,CAAC,qBAAqB,CAAC,CAqKlC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,+BAA+B,EAAE,aAG7C,CAAC"}
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import { XMLParser } from "fast-xml-parser";
|
|
2
|
+
import { Resource } from "../../resource.js";
|
|
3
|
+
import { ignore } from "../../util/ignore.js";
|
|
4
|
+
import { logger } from "../../util/logger.js";
|
|
5
|
+
import { mergeTimeoutConfig, waitForResourceState, } from "../../util/timeout.js";
|
|
6
|
+
import { callEC2Api, createEC2Client } from "./utils.js";
|
|
7
|
+
/**
|
|
8
|
+
* Wait for Route Table Association to reach a specific state
|
|
9
|
+
*/
|
|
10
|
+
async function waitForRouteTableAssociationState(client, routeTableId, associationId, targetState, timeoutConfig) {
|
|
11
|
+
const checkFunction = async () => {
|
|
12
|
+
const response = await callEC2Api(client, "DescribeRouteTables", parseRouteTableAssociationXmlResponse, convertDescribeRouteTablesParamsToAwsFormat({
|
|
13
|
+
RouteTableIds: [routeTableId],
|
|
14
|
+
}));
|
|
15
|
+
const routeTable = response.RouteTables?.[0];
|
|
16
|
+
if (!routeTable) {
|
|
17
|
+
throw new Error(`Route table ${routeTableId} not found`);
|
|
18
|
+
}
|
|
19
|
+
const association = routeTable.Associations?.find((a) => a.RouteTableAssociationId === associationId);
|
|
20
|
+
return association;
|
|
21
|
+
};
|
|
22
|
+
const isReady = (association) => {
|
|
23
|
+
return association?.AssociationState?.State === targetState;
|
|
24
|
+
};
|
|
25
|
+
await waitForResourceState(checkFunction, isReady, timeoutConfig, associationId, "Route Table Association", `reach state ${targetState}`);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Wait for Route Table Association to be deleted
|
|
29
|
+
*/
|
|
30
|
+
async function waitForRouteTableAssociationDeleted(client, routeTableId, associationId, timeoutConfig) {
|
|
31
|
+
const checkFunction = async () => {
|
|
32
|
+
try {
|
|
33
|
+
const response = await callEC2Api(client, "DescribeRouteTables", parseRouteTableAssociationXmlResponse, convertDescribeRouteTablesParamsToAwsFormat({
|
|
34
|
+
RouteTableIds: [routeTableId],
|
|
35
|
+
}));
|
|
36
|
+
const routeTable = response.RouteTables?.[0];
|
|
37
|
+
if (!routeTable) {
|
|
38
|
+
// Route table doesn't exist, so association is definitely gone
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
const association = routeTable.Associations?.find((a) => a.RouteTableAssociationId === associationId);
|
|
42
|
+
return association;
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
// If Route Table is not found, association is definitely gone
|
|
46
|
+
if (error.code === "InvalidRouteTableID.NotFound" ||
|
|
47
|
+
error.code === "InvalidRouteTable.NotFound") {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const isReady = (association) => {
|
|
54
|
+
// Association is deleted if it doesn't exist
|
|
55
|
+
return !association;
|
|
56
|
+
};
|
|
57
|
+
await waitForResourceState(checkFunction, isReady, timeoutConfig, associationId, "Route Table Association", "be deleted");
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* AWS Route Table Association Resource
|
|
61
|
+
*
|
|
62
|
+
* Creates and manages associations between route tables and subnets or gateways.
|
|
63
|
+
* Each subnet can only be associated with one route table at a time. Route table
|
|
64
|
+
* associations determine which route table controls the traffic for a subnet.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* // Associate a subnet with a route table
|
|
68
|
+
* const association = await RouteTableAssociation("subnet-association", {
|
|
69
|
+
* routeTable: myRouteTable,
|
|
70
|
+
* subnet: mySubnet
|
|
71
|
+
* });
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* // Associate a subnet with a route table using IDs
|
|
75
|
+
* const association = await RouteTableAssociation("subnet-association", {
|
|
76
|
+
* routeTable: "rtb-12345678",
|
|
77
|
+
* subnet: "subnet-12345678"
|
|
78
|
+
* });
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* // Associate a gateway with a route table
|
|
82
|
+
* const gatewayAssociation = await RouteTableAssociation("gateway-association", {
|
|
83
|
+
* routeTable: myRouteTable,
|
|
84
|
+
* gateway: "igw-12345678"
|
|
85
|
+
* });
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* // Create association with custom timeout configuration
|
|
89
|
+
* const customAssociation = await RouteTableAssociation("custom-association", {
|
|
90
|
+
* routeTable: myRouteTable,
|
|
91
|
+
* subnet: mySubnet,
|
|
92
|
+
* timeout: {
|
|
93
|
+
* maxAttempts: 60,
|
|
94
|
+
* delayMs: 2000
|
|
95
|
+
* }
|
|
96
|
+
* });
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* // Associate multiple subnets with the same route table
|
|
100
|
+
* const publicSubnets = [subnet1, subnet2, subnet3];
|
|
101
|
+
* const associations = await Promise.all(
|
|
102
|
+
* publicSubnets.map((subnet, index) =>
|
|
103
|
+
* RouteTableAssociation(`public-association-${index}`, {
|
|
104
|
+
* routeTable: publicRouteTable,
|
|
105
|
+
* subnet
|
|
106
|
+
* })
|
|
107
|
+
* )
|
|
108
|
+
* );
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* // Associate private subnets with a private route table
|
|
112
|
+
* const privateAssociation1 = await RouteTableAssociation("private-association-1", {
|
|
113
|
+
* routeTable: privateRouteTable,
|
|
114
|
+
* subnet: privateSubnet1
|
|
115
|
+
* });
|
|
116
|
+
*
|
|
117
|
+
* const privateAssociation2 = await RouteTableAssociation("private-association-2", {
|
|
118
|
+
* routeTable: privateRouteTable,
|
|
119
|
+
* subnet: privateSubnet2
|
|
120
|
+
* });
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* // Handle association replacement scenarios
|
|
124
|
+
* const newAssociation = await RouteTableAssociation("replaced-association", {
|
|
125
|
+
* routeTable: newRouteTable,
|
|
126
|
+
* subnet: existingSubnet // This will replace any existing association
|
|
127
|
+
* });
|
|
128
|
+
*/
|
|
129
|
+
export const RouteTableAssociation = Resource("aws::RouteTableAssociation", async function (_id, props) {
|
|
130
|
+
const client = await createEC2Client();
|
|
131
|
+
const timeoutConfig = mergeTimeoutConfig(ROUTE_TABLE_ASSOCIATION_TIMEOUT, props.timeout);
|
|
132
|
+
const routeTableId = typeof props.routeTable === "string"
|
|
133
|
+
? props.routeTable
|
|
134
|
+
: props.routeTable.routeTableId;
|
|
135
|
+
const subnetId = props.subnet
|
|
136
|
+
? typeof props.subnet === "string"
|
|
137
|
+
? props.subnet
|
|
138
|
+
: props.subnet.subnetId
|
|
139
|
+
: undefined;
|
|
140
|
+
const gatewayId = props.gateway;
|
|
141
|
+
// Validate that exactly one of subnet or gateway is specified
|
|
142
|
+
if ((!subnetId && !gatewayId) || (subnetId && gatewayId)) {
|
|
143
|
+
throw new Error("Exactly one of subnet or gateway must be specified for route table association");
|
|
144
|
+
}
|
|
145
|
+
if (this.phase === "delete") {
|
|
146
|
+
if (this.output?.associationId) {
|
|
147
|
+
logger.log(`🗑️ Deleting Route Table Association: ${this.output.associationId}`);
|
|
148
|
+
await ignore("InvalidAssociationID.NotFound", async () => {
|
|
149
|
+
const params = convertDisassociateRouteTableParamsToAwsFormat({
|
|
150
|
+
AssociationId: this.output.associationId,
|
|
151
|
+
});
|
|
152
|
+
await callEC2Api(client, "DisassociateRouteTable", parseRouteTableAssociationXmlResponse, params);
|
|
153
|
+
});
|
|
154
|
+
// Wait for association to be fully deleted
|
|
155
|
+
await waitForRouteTableAssociationDeleted(client, routeTableId, this.output.associationId, timeoutConfig);
|
|
156
|
+
logger.log(` ✅ Route Table Association ${this.output.associationId} deletion completed`);
|
|
157
|
+
}
|
|
158
|
+
return this.destroy();
|
|
159
|
+
}
|
|
160
|
+
let associationId;
|
|
161
|
+
let isMain = false;
|
|
162
|
+
let state = "associated";
|
|
163
|
+
if (this.phase === "update" && this.output?.associationId) {
|
|
164
|
+
// For updates, we need to check if the route table or target has changed
|
|
165
|
+
const currentRouteTableId = this.output.routeTableId;
|
|
166
|
+
const currentSubnetId = this.output.subnetId;
|
|
167
|
+
const currentGatewayId = this.output.gatewayId;
|
|
168
|
+
if (currentRouteTableId !== routeTableId ||
|
|
169
|
+
currentSubnetId !== subnetId ||
|
|
170
|
+
currentGatewayId !== gatewayId) {
|
|
171
|
+
// Route table or target has changed, we need to replace the association
|
|
172
|
+
const response = await callEC2Api(client, "ReplaceRouteTableAssociation", parseRouteTableAssociationXmlResponse, {
|
|
173
|
+
AssociationId: this.output.associationId,
|
|
174
|
+
RouteTableId: routeTableId,
|
|
175
|
+
});
|
|
176
|
+
associationId = response.NewAssociationId;
|
|
177
|
+
state = response.AssociationState?.State || "associated";
|
|
178
|
+
// Wait for the new association to be active
|
|
179
|
+
await waitForRouteTableAssociationState(client, routeTableId, associationId, "associated", timeoutConfig);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
// No changes needed, keep existing association
|
|
183
|
+
associationId = this.output.associationId;
|
|
184
|
+
state = this.output.state;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
// Create new association
|
|
189
|
+
const params = convertAssociateRouteTableParamsToAwsFormat({
|
|
190
|
+
RouteTableId: routeTableId,
|
|
191
|
+
SubnetId: subnetId,
|
|
192
|
+
GatewayId: gatewayId,
|
|
193
|
+
});
|
|
194
|
+
const response = await callEC2Api(client, "AssociateRouteTable", parseRouteTableAssociationXmlResponse, params);
|
|
195
|
+
associationId = response.AssociationId;
|
|
196
|
+
state = response.AssociationState?.State || "associated";
|
|
197
|
+
// Wait for association to be active
|
|
198
|
+
await waitForRouteTableAssociationState(client, routeTableId, associationId, "associated", timeoutConfig);
|
|
199
|
+
}
|
|
200
|
+
// Get the current association details to check if it's main
|
|
201
|
+
const describeResponse = await callEC2Api(client, "DescribeRouteTables", parseRouteTableAssociationXmlResponse, convertDescribeRouteTablesParamsToAwsFormat({
|
|
202
|
+
RouteTableIds: [routeTableId],
|
|
203
|
+
}));
|
|
204
|
+
const routeTable = describeResponse.RouteTables?.[0];
|
|
205
|
+
if (routeTable) {
|
|
206
|
+
const association = routeTable.Associations?.find((a) => a.RouteTableAssociationId === associationId);
|
|
207
|
+
if (association) {
|
|
208
|
+
isMain = association.Main;
|
|
209
|
+
state = association.AssociationState.State;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return this({
|
|
213
|
+
associationId,
|
|
214
|
+
routeTableId,
|
|
215
|
+
subnetId,
|
|
216
|
+
gatewayId,
|
|
217
|
+
isMain,
|
|
218
|
+
state,
|
|
219
|
+
...props,
|
|
220
|
+
routeTable: routeTableId,
|
|
221
|
+
subnet: subnetId,
|
|
222
|
+
gateway: gatewayId,
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
/**
|
|
226
|
+
* Route Table Association timeout constants
|
|
227
|
+
*/
|
|
228
|
+
export const ROUTE_TABLE_ASSOCIATION_TIMEOUT = {
|
|
229
|
+
maxAttempts: 30,
|
|
230
|
+
delayMs: 1000, // 1 second - Route Table Associations are fast resources
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* Helper functions to convert typed parameters to AWS API format
|
|
234
|
+
*/
|
|
235
|
+
function convertAssociateRouteTableParamsToAwsFormat(params) {
|
|
236
|
+
const awsParams = {
|
|
237
|
+
RouteTableId: params.RouteTableId,
|
|
238
|
+
};
|
|
239
|
+
if (params.SubnetId) {
|
|
240
|
+
awsParams.SubnetId = params.SubnetId;
|
|
241
|
+
}
|
|
242
|
+
if (params.GatewayId) {
|
|
243
|
+
awsParams.GatewayId = params.GatewayId;
|
|
244
|
+
}
|
|
245
|
+
if (params.DryRun !== undefined) {
|
|
246
|
+
awsParams.DryRun = params.DryRun.toString();
|
|
247
|
+
}
|
|
248
|
+
return awsParams;
|
|
249
|
+
}
|
|
250
|
+
function convertDisassociateRouteTableParamsToAwsFormat(params) {
|
|
251
|
+
const awsParams = {
|
|
252
|
+
AssociationId: params.AssociationId,
|
|
253
|
+
};
|
|
254
|
+
if (params.DryRun !== undefined) {
|
|
255
|
+
awsParams.DryRun = params.DryRun.toString();
|
|
256
|
+
}
|
|
257
|
+
return awsParams;
|
|
258
|
+
}
|
|
259
|
+
function convertDescribeRouteTablesParamsToAwsFormat(params) {
|
|
260
|
+
const awsParams = {};
|
|
261
|
+
if (params.RouteTableIds) {
|
|
262
|
+
params.RouteTableIds.forEach((routeTableId, index) => {
|
|
263
|
+
awsParams[`RouteTableId.${index + 1}`] = routeTableId;
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
if (params.Filters) {
|
|
267
|
+
params.Filters.forEach((filter, filterIndex) => {
|
|
268
|
+
const filterNum = filterIndex + 1;
|
|
269
|
+
awsParams[`Filter.${filterNum}.Name`] = filter.Name;
|
|
270
|
+
filter.Values.forEach((value, valueIndex) => {
|
|
271
|
+
awsParams[`Filter.${filterNum}.Value.${valueIndex + 1}`] = value;
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
if (params.DryRun !== undefined) {
|
|
276
|
+
awsParams.DryRun = params.DryRun.toString();
|
|
277
|
+
}
|
|
278
|
+
if (params.NextToken) {
|
|
279
|
+
awsParams.NextToken = params.NextToken;
|
|
280
|
+
}
|
|
281
|
+
if (params.MaxResults !== undefined) {
|
|
282
|
+
awsParams.MaxResults = params.MaxResults.toString();
|
|
283
|
+
}
|
|
284
|
+
return awsParams;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Parse XML responses specifically for Route Table Association operations
|
|
288
|
+
*/
|
|
289
|
+
function parseRouteTableAssociationXmlResponse(xmlText) {
|
|
290
|
+
const parser = new XMLParser({
|
|
291
|
+
ignoreAttributes: true,
|
|
292
|
+
parseAttributeValue: true,
|
|
293
|
+
parseTagValue: true,
|
|
294
|
+
trimValues: true,
|
|
295
|
+
});
|
|
296
|
+
const parsed = parser.parse(xmlText);
|
|
297
|
+
const result = {};
|
|
298
|
+
// Parse AssociateRouteTableResponse
|
|
299
|
+
if (parsed.AssociateRouteTableResponse) {
|
|
300
|
+
const response = parsed.AssociateRouteTableResponse;
|
|
301
|
+
result.AssociationId = response.associationId;
|
|
302
|
+
if (response.associationState) {
|
|
303
|
+
result.AssociationState = {
|
|
304
|
+
State: response.associationState.state,
|
|
305
|
+
StatusMessage: response.associationState.statusMessage,
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
// Parse DisassociateRouteTableResponse
|
|
310
|
+
if (parsed.DisassociateRouteTableResponse) {
|
|
311
|
+
const response = parsed.DisassociateRouteTableResponse;
|
|
312
|
+
result.Return = response.return;
|
|
313
|
+
}
|
|
314
|
+
// Parse ReplaceRouteTableAssociationResponse
|
|
315
|
+
if (parsed.ReplaceRouteTableAssociationResponse) {
|
|
316
|
+
const response = parsed.ReplaceRouteTableAssociationResponse;
|
|
317
|
+
result.NewAssociationId = response.newAssociationId;
|
|
318
|
+
if (response.associationState) {
|
|
319
|
+
result.AssociationState = {
|
|
320
|
+
State: response.associationState.state,
|
|
321
|
+
StatusMessage: response.associationState.statusMessage,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
// Parse DescribeRouteTablesResponse
|
|
326
|
+
if (parsed.DescribeRouteTablesResponse) {
|
|
327
|
+
const response = parsed.DescribeRouteTablesResponse;
|
|
328
|
+
const routeTableSet = response.routeTableSet;
|
|
329
|
+
if (routeTableSet?.item) {
|
|
330
|
+
const routeTables = Array.isArray(routeTableSet.item)
|
|
331
|
+
? routeTableSet.item
|
|
332
|
+
: [routeTableSet.item];
|
|
333
|
+
result.RouteTables = routeTables.map((routeTable) => {
|
|
334
|
+
const associations = routeTable.associationSet?.item
|
|
335
|
+
? Array.isArray(routeTable.associationSet.item)
|
|
336
|
+
? routeTable.associationSet.item
|
|
337
|
+
: [routeTable.associationSet.item]
|
|
338
|
+
: [];
|
|
339
|
+
return {
|
|
340
|
+
RouteTableId: routeTable.routeTableId,
|
|
341
|
+
VpcId: routeTable.vpcId,
|
|
342
|
+
Associations: associations.map((association) => {
|
|
343
|
+
return {
|
|
344
|
+
RouteTableAssociationId: association.routeTableAssociationId,
|
|
345
|
+
RouteTableId: association.routeTableId,
|
|
346
|
+
SubnetId: association.subnetId,
|
|
347
|
+
GatewayId: association.gatewayId,
|
|
348
|
+
Main: association.main,
|
|
349
|
+
AssociationState: {
|
|
350
|
+
State: association.associationState?.state ?? "associated",
|
|
351
|
+
StatusMessage: association.associationState?.statusMessage,
|
|
352
|
+
},
|
|
353
|
+
};
|
|
354
|
+
}),
|
|
355
|
+
};
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
result.RouteTables = [];
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
return result;
|
|
363
|
+
}
|
|
364
|
+
//# sourceMappingURL=route-table-association.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-table-association.js","sourceRoot":"","sources":["../../../src/aws/ec2/route-table-association.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EACL,kBAAkB,EAElB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAmEzD;;GAEG;AACH,KAAK,UAAU,iCAAiC,CAC9C,MAAiB,EACjB,YAAoB,EACpB,aAAqB,EACrB,WAAmB,EACnB,aAA4B;IAE5B,MAAM,aAAa,GAAG,KAAK,IAEzB,EAAE;QACF,MAAM,QAAQ,GAAG,MAAM,UAAU,CAC/B,MAAM,EACN,qBAAqB,EACrB,qCAAqC,EACrC,2CAA2C,CAAC;YAC1C,aAAa,EAAE,CAAC,YAAY,CAAC;SAC9B,CAAC,CACH,CAAC;QAEF,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7C,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,eAAe,YAAY,YAAY,CAAC,CAAC;QAC3D,CAAC;QAED,MAAM,WAAW,GAAG,UAAU,CAAC,YAAY,EAAE,IAAI,CAC/C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,uBAAuB,KAAK,aAAa,CACnD,CAAC;QAEF,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,CACd,WAAiD,EACxC,EAAE;QACX,OAAO,WAAW,EAAE,gBAAgB,EAAE,KAAK,KAAK,W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,gBAAgB,EAAE,aAAa;6BAC3D;yBACF,CAAC;oBACJ,CAAC,CACF;iBACF,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,WAAW,GAAG,EAAE,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,OAAO,MAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { Context } from "../../context.ts";
|
|
2
|
+
import { Resource } from "../../resource.ts";
|
|
3
|
+
import { type TimeoutConfig } from "../../util/timeout.ts";
|
|
4
|
+
import type { Vpc } from "./vpc.ts";
|
|
5
|
+
/**
|
|
6
|
+
* Properties for creating or updating a Route Table
|
|
7
|
+
*/
|
|
8
|
+
export interface RouteTableProps {
|
|
9
|
+
/**
|
|
10
|
+
* The VPC to create the route table in
|
|
11
|
+
*/
|
|
12
|
+
vpc: Vpc | string;
|
|
13
|
+
/**
|
|
14
|
+
* Tags to apply to the route table
|
|
15
|
+
*/
|
|
16
|
+
tags?: Record<string, string>;
|
|
17
|
+
/**
|
|
18
|
+
* Timeout configuration for Route Table operations
|
|
19
|
+
* @default Route Table-specific sensible defaults (30 attempts, 1000ms delay)
|
|
20
|
+
*/
|
|
21
|
+
timeout?: Partial<TimeoutConfig>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Output returned after Route Table creation/update
|
|
25
|
+
*/
|
|
26
|
+
export interface RouteTable extends Resource<"aws::RouteTable">, RouteTableProps {
|
|
27
|
+
/**
|
|
28
|
+
* The ID of the route table
|
|
29
|
+
*/
|
|
30
|
+
routeTableId: string;
|
|
31
|
+
/**
|
|
32
|
+
* The ID of the VPC the route table belongs to
|
|
33
|
+
*/
|
|
34
|
+
vpcId: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* AWS Route Table Resource
|
|
38
|
+
*
|
|
39
|
+
* Creates and manages route tables that control the routing of network traffic
|
|
40
|
+
* within a VPC. Route tables contain rules (routes) that determine where network
|
|
41
|
+
* traffic is directed. Subnet associations are managed separately using the
|
|
42
|
+
* RouteTableAssociation resource.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Create a basic route table
|
|
46
|
+
* const routeTable = await RouteTable("main-route-table", {
|
|
47
|
+
* vpc: myVpc,
|
|
48
|
+
* tags: {
|
|
49
|
+
* Name: "main-route-table",
|
|
50
|
+
* Environment: "production"
|
|
51
|
+
* }
|
|
52
|
+
* });
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* // Create a public route table for internet access
|
|
56
|
+
* const publicRouteTable = await RouteTable("public-routes", {
|
|
57
|
+
* vpc: myVpc,
|
|
58
|
+
* tags: {
|
|
59
|
+
* Name: "public-route-table",
|
|
60
|
+
* Type: "public",
|
|
61
|
+
* Purpose: "internet-access"
|
|
62
|
+
* }
|
|
63
|
+
* });
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* // Create a private route table for internal traffic
|
|
67
|
+
* const privateRouteTable = await RouteTable("private-routes", {
|
|
68
|
+
* vpc: myVpc,
|
|
69
|
+
* tags: {
|
|
70
|
+
* Name: "private-route-table",
|
|
71
|
+
* Type: "private",
|
|
72
|
+
* Purpose: "internal-only"
|
|
73
|
+
* }
|
|
74
|
+
* });
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* // Create a route table with custom timeout configuration
|
|
78
|
+
* const customRouteTable = await RouteTable("custom-routes", {
|
|
79
|
+
* vpc: myVpc,
|
|
80
|
+
* timeout: {
|
|
81
|
+
* maxAttempts: 45,
|
|
82
|
+
* delayMs: 1500
|
|
83
|
+
* },
|
|
84
|
+
* tags: {
|
|
85
|
+
* Name: "custom-timeout-route-table"
|
|
86
|
+
* }
|
|
87
|
+
* });
|
|
88
|
+
*/
|
|
89
|
+
export declare const RouteTable: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<RouteTable>, _id: string, props: RouteTableProps) => Promise<RouteTable>);
|
|
90
|
+
/**
|
|
91
|
+
* Route Table timeout constants
|
|
92
|
+
*/
|
|
93
|
+
export declare const ROUTE_TABLE_TIMEOUT: TimeoutConfig;
|
|
94
|
+
//# sourceMappingURL=route-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-table.d.ts","sourceRoot":"","sources":["../../../src/aws/ec2/route-table.ts"],"names":[],"mappings":"AAEA,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;AAE/B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC;IAElB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE9B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,UACf,SAAQ,QAAQ,CAAC,iBAAiB,CAAC,EACjC,eAAe;IACjB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,eAAO,MAAM,UAAU,yFAGb,OAAO,CAAC,UAAU,CAAC,OACpB,MAAM,SACJ,eAAe,KACrB,OAAO,CAAC,UAAU,CAAC,CA0GvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAGjC,CAAC"}
|