alchemy 0.54.0 → 0.55.1
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 +38717 -11847
- 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/worker-metadata.d.ts +1 -1
- package/lib/cloudflare/worker-metadata.d.ts.map +1 -1
- package/lib/cloudflare/worker-metadata.js +1 -0
- package/lib/cloudflare/worker-metadata.js.map +1 -1
- package/lib/cloudflare/worker.d.ts +0 -2
- package/lib/cloudflare/worker.d.ts.map +1 -1
- package/lib/cloudflare/worker.js +1 -1
- package/lib/cloudflare/worker.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 +7 -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/worker-metadata.ts +1 -1
- package/src/cloudflare/worker.ts +1 -1
- package/src/util/params.ts +33 -0
- package/src/util/timeout.ts +178 -0
- package/src/util/xml.ts +7 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./internet-gateway-attachment.ts";
|
|
2
|
+
export * from "./internet-gateway.ts";
|
|
3
|
+
export * from "./nat-gateway.ts";
|
|
4
|
+
export * from "./route-table-association.ts";
|
|
5
|
+
export * from "./route-table.ts";
|
|
6
|
+
export * from "./route.ts";
|
|
7
|
+
export * from "./security-group.ts";
|
|
8
|
+
export * from "./subnet.ts";
|
|
9
|
+
export * from "./vpc.ts";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/aws/ec2/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./internet-gateway-attachment.js";
|
|
2
|
+
export * from "./internet-gateway.js";
|
|
3
|
+
export * from "./nat-gateway.js";
|
|
4
|
+
export * from "./route-table-association.js";
|
|
5
|
+
export * from "./route-table.js";
|
|
6
|
+
export * from "./route.js";
|
|
7
|
+
export * from "./security-group.js";
|
|
8
|
+
export * from "./subnet.js";
|
|
9
|
+
export * from "./vpc.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/aws/ec2/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { Context } from "../../context.ts";
|
|
2
|
+
import { Resource } from "../../resource.ts";
|
|
3
|
+
import { type TimeoutConfig } from "../../util/timeout.ts";
|
|
4
|
+
import type { InternetGateway } from "./internet-gateway.ts";
|
|
5
|
+
import type { Vpc } from "./vpc.ts";
|
|
6
|
+
/**
|
|
7
|
+
* Properties for creating or updating an Internet Gateway Attachment
|
|
8
|
+
*/
|
|
9
|
+
export interface InternetGatewayAttachmentProps {
|
|
10
|
+
/**
|
|
11
|
+
* The Internet Gateway to attach
|
|
12
|
+
*/
|
|
13
|
+
internetGateway: InternetGateway | string;
|
|
14
|
+
/**
|
|
15
|
+
* The VPC to attach the Internet Gateway to
|
|
16
|
+
*/
|
|
17
|
+
vpc: Vpc | string;
|
|
18
|
+
/**
|
|
19
|
+
* Timeout configuration for Internet Gateway Attachment operations
|
|
20
|
+
* @default Internet Gateway Attachment-specific sensible defaults (60 attempts, 2000ms delay)
|
|
21
|
+
*/
|
|
22
|
+
timeout?: Partial<TimeoutConfig>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Output returned after Internet Gateway Attachment creation/update
|
|
26
|
+
*/
|
|
27
|
+
export interface InternetGatewayAttachment extends Resource<"aws::InternetGatewayAttachment">, InternetGatewayAttachmentProps {
|
|
28
|
+
/**
|
|
29
|
+
* The ID of the Internet Gateway
|
|
30
|
+
*/
|
|
31
|
+
internetGatewayId: string;
|
|
32
|
+
/**
|
|
33
|
+
* The ID of the VPC
|
|
34
|
+
*/
|
|
35
|
+
vpcId: string;
|
|
36
|
+
/**
|
|
37
|
+
* The current state of the attachment
|
|
38
|
+
*/
|
|
39
|
+
state: "attaching" | "attached" | "detaching" | "detached";
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* AWS Internet Gateway Attachment Resource
|
|
43
|
+
*
|
|
44
|
+
* Manages the attachment of an Internet Gateway to a VPC, enabling internet connectivity
|
|
45
|
+
* for the VPC. This is a separate resource to ensure proper dependency ordering and
|
|
46
|
+
* lifecycle management between Internet Gateways and VPCs.
|
|
47
|
+
*
|
|
48
|
+
* An Internet Gateway attachment is required for any VPC that needs internet access.
|
|
49
|
+
* The attachment creates a logical connection between the Internet Gateway and the VPC,
|
|
50
|
+
* allowing traffic to flow between the VPC and the internet when combined with proper
|
|
51
|
+
* routing configuration.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* // Basic Internet Gateway attachment for internet connectivity
|
|
55
|
+
* const vpc = await Vpc("main-vpc", {
|
|
56
|
+
* cidrBlock: "10.0.0.0/16"
|
|
57
|
+
* });
|
|
58
|
+
*
|
|
59
|
+
* const igw = await InternetGateway("main-igw", {});
|
|
60
|
+
*
|
|
61
|
+
* const attachment = await InternetGatewayAttachment("main-igw-attachment", {
|
|
62
|
+
* internetGateway: igw,
|
|
63
|
+
* vpc: vpc
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* // Internet Gateway attachment with custom timeout configuration
|
|
68
|
+
* // for environments with slower AWS API responses
|
|
69
|
+
* const attachment = await InternetGatewayAttachment("slow-env-attachment", {
|
|
70
|
+
* internetGateway: "igw-1234567890abcdef0",
|
|
71
|
+
* vpc: "vpc-0987654321fedcba0",
|
|
72
|
+
* timeout: {
|
|
73
|
+
* maxAttempts: 120,
|
|
74
|
+
* delayMs: 3000
|
|
75
|
+
* }
|
|
76
|
+
* });
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* // Complete setup for a VPC with internet access including routing
|
|
80
|
+
* const vpc = await Vpc("web-vpc", {
|
|
81
|
+
* cidrBlock: "10.0.0.0/16",
|
|
82
|
+
* enableDnsHostnames: true,
|
|
83
|
+
* enableDnsSupport: true
|
|
84
|
+
* });
|
|
85
|
+
*
|
|
86
|
+
* const igw = await InternetGateway("web-igw", {});
|
|
87
|
+
*
|
|
88
|
+
* const attachment = await InternetGatewayAttachment("web-igw-attachment", {
|
|
89
|
+
* internetGateway: igw,
|
|
90
|
+
* vpc: vpc
|
|
91
|
+
* });
|
|
92
|
+
*
|
|
93
|
+
* // Create public subnet and route table for internet access
|
|
94
|
+
* const publicSubnet = await Subnet("public-subnet", {
|
|
95
|
+
* vpc,
|
|
96
|
+
* cidrBlock: "10.0.1.0/24",
|
|
97
|
+
* availabilityZone: "us-east-1a"
|
|
98
|
+
* });
|
|
99
|
+
*
|
|
100
|
+
* const publicRouteTable = await RouteTable("public-rt", {
|
|
101
|
+
* vpc: vpc
|
|
102
|
+
* });
|
|
103
|
+
*
|
|
104
|
+
* const internetRoute = await Route("internet-route", {
|
|
105
|
+
* routeTable: publicRouteTable,
|
|
106
|
+
* destinationCidrBlock: "0.0.0.0/0",
|
|
107
|
+
* gateway: igw
|
|
108
|
+
* });
|
|
109
|
+
*/
|
|
110
|
+
export declare const InternetGatewayAttachment: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<InternetGatewayAttachment>, _id: string, props: InternetGatewayAttachmentProps) => Promise<InternetGatewayAttachment>);
|
|
111
|
+
/**
|
|
112
|
+
* Possible states for an Internet Gateway attachment.
|
|
113
|
+
*/
|
|
114
|
+
type AttachmentState = "attaching" | "attached" | "detaching" | "detached" | "available";
|
|
115
|
+
/**
|
|
116
|
+
* Represents an attachment as described by the EC2 API.
|
|
117
|
+
*/
|
|
118
|
+
interface DescribedAttachment {
|
|
119
|
+
VpcId: string;
|
|
120
|
+
State: AttachmentState;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Represents a tag as described by the EC2 API.
|
|
124
|
+
*/
|
|
125
|
+
interface DescribedTag {
|
|
126
|
+
Key: string;
|
|
127
|
+
Value: string;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Represents an Internet Gateway as described by the EC2 API.
|
|
131
|
+
*/
|
|
132
|
+
interface DescribedInternetGateway {
|
|
133
|
+
InternetGatewayId: string;
|
|
134
|
+
State: "available";
|
|
135
|
+
Attachments: DescribedAttachment[];
|
|
136
|
+
Tags?: DescribedTag[];
|
|
137
|
+
OwnerId: string;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The structure of the response from the DescribeInternetGateways API call.
|
|
141
|
+
*/
|
|
142
|
+
export interface DescribeInternetGatewaysApiResponse {
|
|
143
|
+
InternetGateways: DescribedInternetGateway[];
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Internet Gateway Attachment timeout constants
|
|
147
|
+
*/
|
|
148
|
+
export declare const INTERNET_GATEWAY_ATTACHMENT_TIMEOUT: TimeoutConfig;
|
|
149
|
+
export {};
|
|
150
|
+
//# sourceMappingURL=internet-gateway-attachment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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IACd,KAAK,EAAE,eAAe,CAAC;CACxB;AAED;;GAEG;AACH,UAAU,YAAY;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,UAAU,wBAAwB;IAChC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,WAAW,CAAC;IACnB,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACnC,IAAI,CAAC,EAAE,YAAY,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,mCAAmC;IAClD,gBAAgB,EAAE,wBAAwB,EAAE,CAAC;CAC9C;AAgCD;;GAEG;AACH,eAAO,MAAM,mCAAmC,EAAE,aAGjD,CAAC"}
|
|
@@ -0,0 +1,248 @@
|
|
|
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
|
+
* AWS Internet Gateway Attachment Resource
|
|
9
|
+
*
|
|
10
|
+
* Manages the attachment of an Internet Gateway to a VPC, enabling internet connectivity
|
|
11
|
+
* for the VPC. This is a separate resource to ensure proper dependency ordering and
|
|
12
|
+
* lifecycle management between Internet Gateways and VPCs.
|
|
13
|
+
*
|
|
14
|
+
* An Internet Gateway attachment is required for any VPC that needs internet access.
|
|
15
|
+
* The attachment creates a logical connection between the Internet Gateway and the VPC,
|
|
16
|
+
* allowing traffic to flow between the VPC and the internet when combined with proper
|
|
17
|
+
* routing configuration.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // Basic Internet Gateway attachment for internet connectivity
|
|
21
|
+
* const vpc = await Vpc("main-vpc", {
|
|
22
|
+
* cidrBlock: "10.0.0.0/16"
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* const igw = await InternetGateway("main-igw", {});
|
|
26
|
+
*
|
|
27
|
+
* const attachment = await InternetGatewayAttachment("main-igw-attachment", {
|
|
28
|
+
* internetGateway: igw,
|
|
29
|
+
* vpc: vpc
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* // Internet Gateway attachment with custom timeout configuration
|
|
34
|
+
* // for environments with slower AWS API responses
|
|
35
|
+
* const attachment = await InternetGatewayAttachment("slow-env-attachment", {
|
|
36
|
+
* internetGateway: "igw-1234567890abcdef0",
|
|
37
|
+
* vpc: "vpc-0987654321fedcba0",
|
|
38
|
+
* timeout: {
|
|
39
|
+
* maxAttempts: 120,
|
|
40
|
+
* delayMs: 3000
|
|
41
|
+
* }
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Complete setup for a VPC with internet access including routing
|
|
46
|
+
* const vpc = await Vpc("web-vpc", {
|
|
47
|
+
* cidrBlock: "10.0.0.0/16",
|
|
48
|
+
* enableDnsHostnames: true,
|
|
49
|
+
* enableDnsSupport: true
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
52
|
+
* const igw = await InternetGateway("web-igw", {});
|
|
53
|
+
*
|
|
54
|
+
* const attachment = await InternetGatewayAttachment("web-igw-attachment", {
|
|
55
|
+
* internetGateway: igw,
|
|
56
|
+
* vpc: vpc
|
|
57
|
+
* });
|
|
58
|
+
*
|
|
59
|
+
* // Create public subnet and route table for internet access
|
|
60
|
+
* const publicSubnet = await Subnet("public-subnet", {
|
|
61
|
+
* vpc,
|
|
62
|
+
* cidrBlock: "10.0.1.0/24",
|
|
63
|
+
* availabilityZone: "us-east-1a"
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* const publicRouteTable = await RouteTable("public-rt", {
|
|
67
|
+
* vpc: vpc
|
|
68
|
+
* });
|
|
69
|
+
*
|
|
70
|
+
* const internetRoute = await Route("internet-route", {
|
|
71
|
+
* routeTable: publicRouteTable,
|
|
72
|
+
* destinationCidrBlock: "0.0.0.0/0",
|
|
73
|
+
* gateway: igw
|
|
74
|
+
* });
|
|
75
|
+
*/
|
|
76
|
+
export const InternetGatewayAttachment = Resource("aws::InternetGatewayAttachment", async function (_id, props) {
|
|
77
|
+
const client = await createEC2Client();
|
|
78
|
+
const timeoutConfig = mergeTimeoutConfig(INTERNET_GATEWAY_ATTACHMENT_TIMEOUT, props.timeout);
|
|
79
|
+
const internetGatewayId = typeof props.internetGateway === "string"
|
|
80
|
+
? props.internetGateway
|
|
81
|
+
: props.internetGateway.internetGatewayId;
|
|
82
|
+
const vpcId = typeof props.vpc === "string" ? props.vpc : props.vpc.vpcId;
|
|
83
|
+
if (this.phase === "delete") {
|
|
84
|
+
if (this.output?.internetGatewayId && this.output?.vpcId) {
|
|
85
|
+
logger.log(`🗑️ Detaching Internet Gateway: ${this.output.internetGatewayId} from VPC: ${this.output.vpcId}`);
|
|
86
|
+
await ignore("Gateway.NotAttached", async () => {
|
|
87
|
+
await ignore("InvalidInternetGatewayID.NotFound", async () => {
|
|
88
|
+
await ignore("InvalidVpcID.NotFound", async () => {
|
|
89
|
+
await callEC2Api(client, "DetachInternetGateway", parseInternetGatewayAttachmentXmlResponse, {
|
|
90
|
+
InternetGatewayId: this.output.internetGatewayId,
|
|
91
|
+
VpcId: this.output.vpcId,
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
const checkDetached = async () => {
|
|
97
|
+
try {
|
|
98
|
+
const response = await callEC2Api(client, "DescribeInternetGateways", parseInternetGatewayAttachmentXmlResponse, {
|
|
99
|
+
"InternetGatewayId.1": this.output.internetGatewayId,
|
|
100
|
+
});
|
|
101
|
+
const igw = response.InternetGateways?.[0];
|
|
102
|
+
if (!igw) {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
return igw.Attachments?.find((att) => att.VpcId === this.output.vpcId);
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
if (error.code === "InvalidInternetGatewayID.NotFound") {
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
await waitForResourceState(checkDetached, (attachment) => !attachment, timeoutConfig, `${this.output.internetGatewayId} to ${this.output.vpcId}`, "Internet Gateway Attachment", "to be detached");
|
|
115
|
+
logger.log(` ✅ Internet Gateway ${this.output.internetGatewayId} detached from VPC ${this.output.vpcId}`);
|
|
116
|
+
}
|
|
117
|
+
return this.destroy();
|
|
118
|
+
}
|
|
119
|
+
// Check if already attached
|
|
120
|
+
if (this.phase === "update" && this.output?.internetGatewayId) {
|
|
121
|
+
// Verify the attachment still exists
|
|
122
|
+
const response = await callEC2Api(client, "DescribeInternetGateways", parseInternetGatewayAttachmentXmlResponse, {
|
|
123
|
+
"InternetGatewayId.1": this.output.internetGatewayId,
|
|
124
|
+
});
|
|
125
|
+
const igw = response.InternetGateways?.[0];
|
|
126
|
+
const attachment = igw?.Attachments?.find((att) => att.VpcId === vpcId);
|
|
127
|
+
if (attachment) {
|
|
128
|
+
return this({
|
|
129
|
+
internetGatewayId,
|
|
130
|
+
vpcId,
|
|
131
|
+
state: "attached",
|
|
132
|
+
...props,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// Check if already attached before creating
|
|
137
|
+
const checkResponse = await callEC2Api(client, "DescribeInternetGateways", parseInternetGatewayAttachmentXmlResponse, {
|
|
138
|
+
"InternetGatewayId.1": internetGatewayId,
|
|
139
|
+
});
|
|
140
|
+
const existingIgw = checkResponse.InternetGateways?.[0];
|
|
141
|
+
const existingAttachment = existingIgw?.Attachments?.find((att) => att.VpcId === vpcId);
|
|
142
|
+
if (!existingAttachment) {
|
|
143
|
+
// Create the attachment only if it doesn't exist
|
|
144
|
+
await callEC2Api(client, "AttachInternetGateway", parseInternetGatewayAttachmentXmlResponse, {
|
|
145
|
+
InternetGatewayId: internetGatewayId,
|
|
146
|
+
VpcId: vpcId,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
// Wait for attachment to complete
|
|
150
|
+
const checkAttached = async () => {
|
|
151
|
+
try {
|
|
152
|
+
const response = await callEC2Api(client, "DescribeInternetGateways", parseInternetGatewayAttachmentXmlResponse, {
|
|
153
|
+
"InternetGatewayId.1": internetGatewayId,
|
|
154
|
+
});
|
|
155
|
+
const igw = response.InternetGateways?.[0];
|
|
156
|
+
if (!igw) {
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
return igw.Attachments?.find((att) => att.VpcId === vpcId);
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
if (error.code === "InvalidInternetGatewayID.NotFound") {
|
|
163
|
+
return undefined;
|
|
164
|
+
}
|
|
165
|
+
throw error;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
const isAttached = (attachment) => {
|
|
169
|
+
return (attachment?.State === "attached" || attachment?.State === "available");
|
|
170
|
+
};
|
|
171
|
+
await waitForResourceState(checkAttached, isAttached, timeoutConfig, `${internetGatewayId} to ${vpcId}`, "Internet Gateway Attachment", "to be attached");
|
|
172
|
+
return this({
|
|
173
|
+
internetGatewayId,
|
|
174
|
+
vpcId,
|
|
175
|
+
state: "attached",
|
|
176
|
+
...props,
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
/**
|
|
180
|
+
* Internet Gateway Attachment timeout constants
|
|
181
|
+
*/
|
|
182
|
+
export const INTERNET_GATEWAY_ATTACHMENT_TIMEOUT = {
|
|
183
|
+
maxAttempts: 60,
|
|
184
|
+
delayMs: 2000, // 2 seconds - IGW attachments are usually fast
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* Parse XML responses for Internet Gateway Attachment operations
|
|
188
|
+
*/
|
|
189
|
+
function parseInternetGatewayAttachmentXmlResponse(xmlText) {
|
|
190
|
+
const parser = new XMLParser({
|
|
191
|
+
ignoreAttributes: true,
|
|
192
|
+
parseAttributeValue: true,
|
|
193
|
+
parseTagValue: true,
|
|
194
|
+
trimValues: true,
|
|
195
|
+
});
|
|
196
|
+
const parsed = parser.parse(xmlText);
|
|
197
|
+
const result = {};
|
|
198
|
+
// Handle success responses
|
|
199
|
+
if (parsed.AttachInternetGatewayResponse) {
|
|
200
|
+
result.success = true;
|
|
201
|
+
result.return = parsed.AttachInternetGatewayResponse.return;
|
|
202
|
+
}
|
|
203
|
+
if (parsed.DetachInternetGatewayResponse) {
|
|
204
|
+
result.success = true;
|
|
205
|
+
result.return = parsed.DetachInternetGatewayResponse.return;
|
|
206
|
+
}
|
|
207
|
+
// Handle DescribeInternetGatewaysResponse
|
|
208
|
+
if (parsed.DescribeInternetGatewaysResponse) {
|
|
209
|
+
const internetGatewaySet = parsed.DescribeInternetGatewaysResponse.internetGatewaySet;
|
|
210
|
+
if (internetGatewaySet?.item) {
|
|
211
|
+
const igws = Array.isArray(internetGatewaySet.item)
|
|
212
|
+
? internetGatewaySet.item
|
|
213
|
+
: [internetGatewaySet.item];
|
|
214
|
+
result.InternetGateways = igws.map((igw) => {
|
|
215
|
+
const attachments = igw.attachmentSet?.item
|
|
216
|
+
? Array.isArray(igw.attachmentSet.item)
|
|
217
|
+
? igw.attachmentSet.item
|
|
218
|
+
: [igw.attachmentSet.item]
|
|
219
|
+
: [];
|
|
220
|
+
const tags = igw.tagSet?.item
|
|
221
|
+
? Array.isArray(igw.tagSet.item)
|
|
222
|
+
? igw.tagSet.item
|
|
223
|
+
: [igw.tagSet.item]
|
|
224
|
+
: [];
|
|
225
|
+
return {
|
|
226
|
+
InternetGatewayId: igw.internetGatewayId,
|
|
227
|
+
State: "available", // IGWs are always available once created
|
|
228
|
+
Attachments: attachments.map((attachment) => ({
|
|
229
|
+
VpcId: attachment.vpcId,
|
|
230
|
+
State: attachment.state,
|
|
231
|
+
})),
|
|
232
|
+
Tags: tags.length > 0
|
|
233
|
+
? tags.map((tag) => ({
|
|
234
|
+
Key: tag.key,
|
|
235
|
+
Value: tag.value,
|
|
236
|
+
}))
|
|
237
|
+
: undefined,
|
|
238
|
+
OwnerId: igw.ownerId,
|
|
239
|
+
};
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
result.InternetGateways = [];
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return result;
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=internet-gateway-attachment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internet-gateway-attachment.js","sourceRoot":"","sources":["../../../src/aws/ec2/internet-gateway-attachment.ts"],"names":[],"mappings":"AAAA,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;AAE/B,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AA8CzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,QAAQ,CAC/C,gCAAgC,EAChC,KAAK,WAEH,GAAW,EACX,KAAqC;IAErC,MAAM,MAAM,GAAG,MAAM,eAAe,EAAE,CAAC;IACvC,MAAM,aAAa,GAAG,kBAAkB,CACtC,mCAAmC,EACnC,KAAK,CAAC,OAAO,CACd,CAAC;IAEF,MAAM,iBAAiB,GACrB,OAAO,KAAK,CAAC,eAAe,KAAK,QAAQ;QACvC,CAAC,CAAC,KAAK,CAAC,eAAe;QACvB,CAAC,CAA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,EAAE,yCAAyC;oBAC7D,WAAW,EAAE,WAAW,CAAC,GAAG,CAC1B,CAAC,UAAU,EAAuB,EAAE,CAAC,CAAC;wBACpC,KAAK,EAAE,UAAU,CAAC,KAAK;wBACvB,KAAK,EAAE,UAAU,CAAC,KAAK;qBACxB,CAAC,CACH;oBACD,IAAI,EACF,IAAI,CAAC,MAAM,GAAG,CAAC;wBACb,CAAC,CAAC,IAAI,CAAC,GAAG,CACN,CAAC,GAAG,EAAgB,EAAE,CAAC,CAAC;4BACtB,GAAG,EAAE,GAAG,CAAC,GAAG;4BACZ,KAAK,EAAE,GAAG,CAAC,KAAK;yBACjB,CAAC,CACH;wBACH,CAAC,CAAC,SAAS;oBACf,OAAO,EAAE,GAAG,CAAC,OAAO;iBACrB,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,OAAO,MAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { Context } from "../../context.ts";
|
|
2
|
+
import { Resource } from "../../resource.ts";
|
|
3
|
+
import { type TimeoutConfig } from "../../util/timeout.ts";
|
|
4
|
+
/**
|
|
5
|
+
* Properties for creating or updating an Internet Gateway
|
|
6
|
+
*/
|
|
7
|
+
export interface InternetGatewayProps {
|
|
8
|
+
/**
|
|
9
|
+
* Tags to apply to the Internet Gateway
|
|
10
|
+
*/
|
|
11
|
+
tags?: Record<string, string>;
|
|
12
|
+
/**
|
|
13
|
+
* Timeout configuration for Internet Gateway operations
|
|
14
|
+
* @default Internet Gateway-specific sensible defaults (60 attempts, 2000ms delay)
|
|
15
|
+
*/
|
|
16
|
+
timeout?: Partial<TimeoutConfig>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Output returned after Internet Gateway creation/update
|
|
20
|
+
*/
|
|
21
|
+
export interface InternetGateway extends Resource<"aws::InternetGateway">, InternetGatewayProps {
|
|
22
|
+
/**
|
|
23
|
+
* The ID of the Internet Gateway
|
|
24
|
+
*/
|
|
25
|
+
internetGatewayId: string;
|
|
26
|
+
/**
|
|
27
|
+
* The current state of the Internet Gateway
|
|
28
|
+
*/
|
|
29
|
+
state: "available";
|
|
30
|
+
/**
|
|
31
|
+
* Information about the VPCs attached to the Internet Gateway
|
|
32
|
+
*/
|
|
33
|
+
attachments?: Array<{
|
|
34
|
+
vpcId: string;
|
|
35
|
+
state: "attaching" | "attached" | "detaching" | "detached";
|
|
36
|
+
}>;
|
|
37
|
+
/**
|
|
38
|
+
* The ID of the AWS account that owns the Internet Gateway
|
|
39
|
+
*/
|
|
40
|
+
ownerId?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* AWS Internet Gateway Resource
|
|
44
|
+
*
|
|
45
|
+
* An Internet Gateway is a horizontally scaled, redundant, and highly available VPC component
|
|
46
|
+
* that allows communication between your VPC and the internet. It serves two purposes:
|
|
47
|
+
* 1. Provide a target in your VPC route tables for internet-routable traffic
|
|
48
|
+
* 2. Perform network address translation (NAT) for instances with public IPv4 addresses
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* // Create a basic Internet Gateway
|
|
53
|
+
* const igw = new InternetGateway({
|
|
54
|
+
* tags: {
|
|
55
|
+
* Name: "my-internet-gateway",
|
|
56
|
+
* Environment: "production"
|
|
57
|
+
* }
|
|
58
|
+
* });
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* // Create Internet Gateway with custom timeout configuration
|
|
64
|
+
* const igw = new InternetGateway({
|
|
65
|
+
* tags: { Name: "custom-igw" },
|
|
66
|
+
* timeoutConfig: {
|
|
67
|
+
* maxAttempts: 30,
|
|
68
|
+
* delayMs: 1000
|
|
69
|
+
* }
|
|
70
|
+
* });
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* // Create Internet Gateway and attach to VPC
|
|
76
|
+
* const vpc = new VPC({ cidrBlock: "10.0.0.0/16" });
|
|
77
|
+
* const igw = new InternetGateway({ tags: { Name: "vpc-igw" } });
|
|
78
|
+
* const attachment = new InternetGatewayAttachment({
|
|
79
|
+
* internetGatewayId: igw.internetGatewayId,
|
|
80
|
+
* vpcId: vpc.vpcId
|
|
81
|
+
* });
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* // Access Internet Gateway properties
|
|
87
|
+
* const igw = new InternetGateway({ tags: { Name: "example-igw" } });
|
|
88
|
+
* logger.log(`Internet Gateway ID: ${igw.internetGatewayId}`);
|
|
89
|
+
* logger.log(`State: ${igw.state}`);
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* Creates and manages Internet Gateways that provide internet access to VPCs.
|
|
93
|
+
* Note: Use InternetGatewayAttachment to attach the gateway to a VPC.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* // Create a basic Internet Gateway
|
|
97
|
+
* const igw = await InternetGateway("main-igw", {
|
|
98
|
+
* tags: {
|
|
99
|
+
* Name: "main-internet-gateway",
|
|
100
|
+
* Environment: "production"
|
|
101
|
+
* }
|
|
102
|
+
* });
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* // Create an Internet Gateway for development environment
|
|
106
|
+
* const devIgw = await InternetGateway("dev-igw", {
|
|
107
|
+
* tags: {
|
|
108
|
+
* Name: "dev-internet-gateway",
|
|
109
|
+
* Environment: "development",
|
|
110
|
+
* Team: "backend"
|
|
111
|
+
* }
|
|
112
|
+
* });
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* // Create an Internet Gateway with custom timeout configuration
|
|
116
|
+
* const customIgw = await InternetGateway("custom-igw", {
|
|
117
|
+
* timeout: {
|
|
118
|
+
* maxAttempts: 90,
|
|
119
|
+
* delayMs: 1500
|
|
120
|
+
* },
|
|
121
|
+
* tags: {
|
|
122
|
+
* Name: "custom-timeout-igw",
|
|
123
|
+
* Purpose: "high-availability"
|
|
124
|
+
* }
|
|
125
|
+
* });
|
|
126
|
+
*/
|
|
127
|
+
export declare const InternetGateway: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context<InternetGateway>, _id: string, props: InternetGatewayProps) => Promise<InternetGateway>);
|
|
128
|
+
/**
|
|
129
|
+
* Internet Gateway timeout constants
|
|
130
|
+
*/
|
|
131
|
+
export declare const INTERNET_GATEWAY_TIMEOUT: TimeoutConfig;
|
|
132
|
+
//# sourceMappingURL=internet-gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internet-gateway.d.ts","sourceRoot":"","sources":["../../../src/aws/ec2/internet-gateway.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;AAG/B;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;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,eACf,SAAQ,QAAQ,CAAC,sBAAsB,CAAC,EACtC,oBAAoB;IACtB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,KAAK,EAAE,WAAW,CAAC;IAEnB;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC;KAC5D,CAAC,CAAC;IAEH;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAkFD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AACH,eAAO,MAAM,eAAe,yFAGlB,OAAO,CAAC,eAAe,CAAC,OACzB,MAAM,SACJ,oBAAoB,KAC1B,OAAO,CAAC,eAAe,CAAC,CAgH5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,aAGtC,CAAC"}
|