/
vpc.ts
178 lines (152 loc) · 3.81 KB
/
vpc.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/**
* The type of subnet group.
* Same as SubnetType in the aws-cdk-lib/aws-ec2 package,
* but we can't use that because of cyclical dependencies.
*/
export enum VpcSubnetGroupType {
/** Public subnet group type. */
PUBLIC = 'Public',
/** Private subnet group type. */
PRIVATE = 'Private',
/** Isolated subnet group type. */
ISOLATED = 'Isolated',
}
/**
* A subnet representation that the VPC provider uses.
*/
export interface VpcSubnet {
/** The identifier of the subnet. */
readonly subnetId: string;
/**
* The code of the availability zone this subnet is in
* (for example, 'us-west-2a').
*/
readonly availabilityZone: string;
/** The identifier of the route table for this subnet. */
readonly routeTableId: string;
/**
* CIDR range of the subnet
*
* @default - CIDR information not available
*/
readonly cidr?: string;
}
/**
* A group of subnets returned by the VPC provider.
* The included subnets do NOT have to be symmetric!
*/
export interface VpcSubnetGroup {
/**
* The name of the subnet group,
* determined by looking at the tags of of the subnets
* that belong to it.
*/
readonly name: string;
/** The type of the subnet group. */
readonly type: VpcSubnetGroupType;
/**
* The subnets that are part of this group.
* There is no condition that the subnets have to be symmetric
* in the group.
*/
readonly subnets: VpcSubnet[];
}
/**
* Properties of a discovered VPC
*/
export interface VpcContextResponse {
/**
* VPC id
*/
readonly vpcId: string;
/**
* VPC cidr
*
* @default - CIDR information not available
*/
readonly vpcCidrBlock?: string;
/**
* AZs
*/
readonly availabilityZones: string[];
/**
* IDs of all public subnets
*
* Element count: #(availabilityZones) · #(publicGroups)
*/
readonly publicSubnetIds?: string[];
/**
* Name of public subnet groups
*
* Element count: #(publicGroups)
*/
readonly publicSubnetNames?: string[];
/**
* Route Table IDs of public subnet groups.
*
* Element count: #(availabilityZones) · #(publicGroups)
*/
readonly publicSubnetRouteTableIds?: string[];
/**
* IDs of all private subnets
*
* Element count: #(availabilityZones) · #(privateGroups)
*/
readonly privateSubnetIds?: string[];
/**
* Name of private subnet groups
*
* Element count: #(privateGroups)
*/
readonly privateSubnetNames?: string[];
/**
* Route Table IDs of private subnet groups.
*
* Element count: #(availabilityZones) · #(privateGroups)
*/
readonly privateSubnetRouteTableIds?: string[];
/**
* IDs of all isolated subnets
*
* Element count: #(availabilityZones) · #(isolatedGroups)
*/
readonly isolatedSubnetIds?: string[];
/**
* Name of isolated subnet groups
*
* Element count: #(isolatedGroups)
*/
readonly isolatedSubnetNames?: string[];
/**
* Route Table IDs of isolated subnet groups.
*
* Element count: #(availabilityZones) · #(isolatedGroups)
*/
readonly isolatedSubnetRouteTableIds?: string[];
/**
* The VPN gateway ID
*/
readonly vpnGatewayId?: string;
/**
* The subnet groups discovered for the given VPC.
* Unlike the above properties, this will include asymmetric subnets,
* if the VPC has any.
* This property will only be populated if `VpcContextQuery.returnAsymmetricSubnets`
* is true.
*
* @default - no subnet groups will be returned unless `VpcContextQuery.returnAsymmetricSubnets` is true
*/
readonly subnetGroups?: VpcSubnetGroup[];
/**
* The region in which the VPC is in.
*
* @default - Region of the parent stack
*/
readonly region?: string;
/**
* The ID of the AWS account that owns the VPC.
*
* @default the account id of the parent stack
*/
readonly ownerAccountId?: string;
}