-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdataModel.go
219 lines (192 loc) · 6.68 KB
/
dataModel.go
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
// Copyright 2023 Stigian Consulting - reference license in top level of project
package main
import (
"github.com/aws/aws-sdk-go/service/ec2"
)
type RegionData struct {
VPCs map[string]*VPC
}
type RegionDataSorted struct {
Region string `json:"region"`
VPCs []*VPCSorted
}
type VPCData struct {
ID string `json:"id"`
CidrBlock string `json:"cidrBlock"`
IPv6CidrBlock string `json:"iPv6CidrBlock"`
Name string `json:"name"`
IsDefault bool `json:"isDefault"`
}
type VPCSorted struct {
VPCData
Gateways []string `json:"gateways,omitempty"`
Subnets []*SubnetSorted `json:"subnets,omitempty"`
Peers []*VPCPeer `json:"peers,omitempty"`
}
type VPC struct {
VPCData
RawVPC *ec2.Vpc
Subnets map[string]*Subnet
Peers map[string]*VPCPeer
Gateways []string
}
type SubnetData struct {
RouteTable *RouteTable
ID string `json:"id"`
CidrBlock string `json:"cidrBlock"`
AvailabilityZone string `json:"availabilityZone"`
AvailabilityZoneID string `json:"availabilityZoneId"`
Name string `json:"name"`
Public bool `json:"public"`
}
type SubnetSorted struct {
SubnetData
Instances []*InstanceSorted `json:"instances,omitempty"`
NatGateways []*NatGateway `json:"natGateways,omitempty"`
TGWs []*TGWAttachment `json:"tgws,omitempty"`
ENIs []*NetworkInterface `json:"enis,omitempty"`
InterfaceEndpoints []*InterfaceEndpointSorted `json:"interfaceEndpoints,omitempty"`
GatewayEndpoints []*GatewayEndpoint `json:"gatewayEndpoints,omitempty"`
}
type Subnet struct {
RawSubnet *ec2.Subnet
Instances map[string]*Instance
NatGateways map[string]*NatGateway
TGWs map[string]*TGWAttachment
ENIs map[string]*NetworkInterface
InterfaceEndpoints map[string]*InterfaceEndpoint
GatewayEndpoints map[string]*GatewayEndpoint
SubnetData
}
type InstanceData struct {
ID string `json:"id"`
Type string `json:"type"`
SubnetID string `json:"subnetId"`
VpcID string `json:"vpcId"`
State string `json:"state"`
PublicIP string `json:"publicIP"`
PrivateIP string `json:"privateIP"`
Name string `json:"name"`
InstanceStatus string `json:"instanceStatus"`
SystemStatus string `json:"systemStatus"`
}
type InstanceSorted struct {
InstanceData
Volumes []*Volume `json:"volumes,omitempty"`
Interfaces []*NetworkInterfaceSorted `json:"interfaces,omitempty"`
}
type Instance struct {
Volumes map[string]*Volume
Interfaces map[string]*NetworkInterface
RawEc2 *ec2.Instance
InstanceData
}
type NetworkInterfaceData struct {
RawNetworkInterface *ec2.NetworkInterface `json:"-"`
ID string `json:"id"`
PrivateIP string `json:"privateIp"`
MAC string `json:"mAC"`
DNS string `json:"dNS"`
Type string `json:"type"`
Description string `json:"description"`
PublicIP string `json:"publicIp"`
Name string `json:"name"`
SubnetID string `json:"subnetId"` // we're just accounting for this for display purposes
}
type NetworkInterface struct {
Groups map[string]*SecurityGroup `json:"groups"`
NetworkInterfaceData
}
type NetworkInterfaceSorted struct {
NetworkInterfaceData
Groups []*SecurityGroup `json:"groups"`
}
type SecurityGroup struct {
RawSecurityGroup *ec2.SecurityGroup `json:"-"`
Description string `json:"description"`
GroupID string `json:"groupId"`
GroupName string `json:"groupName"`
TagName string `json:"tagName"`
IPPermissions []*SecurityGroupRule `json:"ipPermissions"`
IPPermissionsEgress []*SecurityGroupRule `json:"ipPermissionsEgress"`
}
type SecurityGroupRule struct {
IPProtocol string `json:"ipProtocol"`
IPRanges []*IPRange `json:"ipRanges"`
IPv6Ranges []*IPv6Range `json:"ipv6Ranges"`
FromPort int64 `json:"fromPort"`
ToPort int64 `json:"toPort"`
}
type IPRange struct {
CidrIP string `json:"cidrIp"`
Description string `json:"description"`
}
type IPv6Range struct {
CidrIPV6 string `json:"cidrIpv6"`
Description string `json:"description"`
}
type Volume struct {
ID string `json:"id"`
DeviceName string `json:"deviceName"`
VolumeType string `json:"volumeType"`
Name string `json:"name"`
RawVolume *ec2.Volume `json:"-"`
KMSKeyID string `json:"kmsKeyId"`
Size int64 `json:"size"`
Encrypted bool `json:"encrypted"`
}
type NatGatewayData struct {
RawNatGateway *ec2.NatGateway `json:"-"`
ID string `json:"id"`
PrivateIP string `json:"privateIP"`
PublicIP string `json:"publicIP"`
State string `json:"state"`
Type string `json:"type"`
Name string `json:"name"`
}
type NatGateway struct {
Interfaces map[string]*NetworkInterface `json:"interfaces"`
NatGatewayData
}
type NatGatewaySorted struct {
NatGatewayData
Interfaces []*NetworkInterfaceSorted `json:"interfaces"`
}
type RouteTable struct {
RawRoute *ec2.RouteTable `json:"-"`
ID string `json:"id"`
Default string `json:"default"`
}
type TGWAttachment struct {
RawAttachment *ec2.TransitGatewayVpcAttachment `json:"-"`
AttachmentID string `json:"attachmentId"`
TransitGatewayID string `json:"transitGatewayId"`
Name string `json:"name"`
}
type VPCPeer struct {
RawPeer *ec2.VpcPeeringConnection `json:"-"`
ID string `json:"id"`
Requester string `json:"requester"`
Accepter string `json:"accepter"`
Name string `json:"name"`
}
type InterfaceEndpointData struct {
RawEndpoint *ec2.VpcEndpoint `json:"-"`
ID string `json:"id"`
ServiceName string `json:"serviceName"`
Name string `json:"name"`
}
type InterfaceEndpoint struct {
Interfaces map[string]*NetworkInterface
InterfaceEndpointData
}
type InterfaceEndpointSorted struct {
InterfaceEndpointData
Interfaces []*NetworkInterfaceSorted
}
type GatewayEndpoint struct {
RawEndpoint *ec2.VpcEndpoint `json:"-"`
ID string `json:"id"`
ServiceName string `json:"serviceName"`
Name string `json:"name"`
}