-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmve_types.go
285 lines (255 loc) · 11.1 KB
/
mve_types.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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
package megaport
// MVEOrderConfig represents a request to buy an MVE from the Megaport Products API.
type MVEOrderConfig struct {
LocationID int `json:"locationId"`
Name string `json:"productName"`
Term int `json:"term"`
ProductType string `json:"productType"`
PromoCode string `json:"promoCode,omitempty"`
CostCentre string `json:"costCentre,omitempty"`
NetworkInterfaces []MVENetworkInterface `json:"vnics"`
VendorConfig VendorConfig `json:"vendorConfig"`
Config MVEConfig `json:"config"`
ResourceTags []ResourceTag `json:"resourceTags,omitempty"`
}
// Nested configuration Fields for the MVE Order
type MVEConfig struct {
DiversityZone string `json:"diversityZone,omitempty"`
}
// VendorConfig is an interface for MVE vendor configuration.
type VendorConfig interface {
IsVendorConfig()
}
// VSRConfig represents the configuration for a 6WIND VSR MVE.
type SixwindVSRConfig struct {
VendorConfig
Vendor string `json:"vendor"`
ImageID int `json:"imageId"`
ProductSize string `json:"productSize"`
MVELabel string `json:"mveLabel"`
SSHPublicKey string `json:"sshPublicKey"`
}
// ArubaConfig represents the configuration for an Aruba MVE.
type ArubaConfig struct {
VendorConfig
Vendor string `json:"vendor"`
ImageID int `json:"imageId"`
ProductSize string `json:"productSize"`
MVELabel string `json:"mveLabel,omitempty"`
AccountName string `json:"accountName"`
AccountKey string `json:"accountKey"`
SystemTag string `json:"systemTag"`
}
// AviatrixConfig represents the configuration for an Aviatrix Secure Edge MVE.
type AviatrixConfig struct {
VendorConfig
Vendor string `json:"vendor"`
ImageID int `json:"imageId"`
ProductSize string `json:"productSize"`
MVELabel string `json:"mveLabel"`
CloudInit string `json:"cloudInit"`
}
// CiscoConfig represents the configuration for a Cisco MVE.
type CiscoConfig struct {
VendorConfig
Vendor string `json:"vendor"`
ImageID int `json:"imageId"`
ProductSize string `json:"productSize"`
MVELabel string `json:"mveLabel,omitempty"`
ManageLocally bool `json:"manageLocally"`
AdminSSHPublicKey string `json:"adminSshPublicKey"`
SSHPublicKey string `json:"sshPublicKey"`
CloudInit string `json:"cloudInit"`
FMCIPAddress string `json:"fmcIpAddress"`
FMCRegistrationKey string `json:"fmcRegistrationKey"`
FMCNatID string `json:"fmcNatId"`
}
// FortinetConfig represents the configuration for a Fortinet MVE.
type FortinetConfig struct {
VendorConfig
Vendor string `json:"vendor"`
ImageID int `json:"imageId"`
ProductSize string `json:"productSize"`
MVELabel string `json:"mveLabel,omitempty"`
AdminSSHPublicKey string `json:"adminSshPublicKey"`
SSHPublicKey string `json:"sshPublicKey"`
LicenseData string `json:"licenseData"`
}
// PaloAltoConfig represents the configuration for a Palo Alto MVE.
type PaloAltoConfig struct {
VendorConfig
Vendor string `json:"vendor"`
ImageID int `json:"imageId"`
ProductSize string `json:"productSize,omitempty"`
MVELabel string `json:"mveLabel,omitempty"`
AdminSSHPublicKey string `json:"adminSshPublicKey,omitempty"`
SSHPublicKey string `json:"sshPublicKey,omitempty"`
AdminPasswordHash string `json:"adminPasswordHash,omitempty"`
LicenseData string `json:"licenseData,omitempty"`
}
// PrismaConfig represents the configuration for a Palo Alto Prisma MVE.
type PrismaConfig struct {
VendorConfig
Vendor string `json:"vendor"`
ImageID int `json:"imageId"`
ProductSize string `json:"productSize"`
MVELabel string `json:"mveLabel"`
IONKey string `json:"ionKey"`
SecretKey string `json:"secretKey"`
}
// VersaConfig represents the configuration for a Versa MVE.
type VersaConfig struct {
VendorConfig
Vendor string `json:"vendor"`
ImageID int `json:"imageId"`
ProductSize string `json:"productSize"`
MVELabel string `json:"mveLabel,omitempty"`
DirectorAddress string `json:"directorAddress"`
ControllerAddress string `json:"controllerAddress"`
LocalAuth string `json:"localAuth"`
RemoteAuth string `json:"remoteAuth"`
SerialNumber string `json:"serialNumber"`
}
// VmwareConfig represents the configuration for a VMware MVE.
type VmwareConfig struct {
VendorConfig
Vendor string `json:"vendor"`
ImageID int `json:"imageId"`
ProductSize string `json:"productSize"`
MVELabel string `json:"mveLabel,omitempty"`
AdminSSHPublicKey string `json:"adminSshPublicKey"`
SSHPublicKey string `json:"sshPublicKey"`
VcoAddress string `json:"vcoAddress"`
VcoActivationCode string `json:"vcoActivationCode"`
}
// MerakiConfig represents the configuration for a Meraki MVE.
type MerakiConfig struct {
VendorConfig
Vendor string `json:"vendor"`
ImageID int `json:"imageId"`
ProductSize string `json:"productSize"`
MVELabel string `json:"mveLabel,omitempty"`
Token string `json:"token"`
}
// MVENetworkInterface represents a vNIC.
type MVENetworkInterface struct {
Description string `json:"description"`
VLAN int `json:"vlan"`
}
// InstanceSize encodes the available MVE instance sizes.
type MVEInstanceSize string
// MVE instance sizes.
const (
MVE_SMALL MVEInstanceSize = "SMALL"
MVE_MEDIUM MVEInstanceSize = "MEDIUM"
MVE_LARGE MVEInstanceSize = "LARGE"
MVE_XLARGE MVEInstanceSize = "X_LARGE_12"
)
// MVEOrderConfirmation represents the response to an MVE order request.
type MVEOrderConfirmation struct {
TechnicalServiceUID string `json:"technicalServiceUid"`
}
// MVE represents a Megaport Virtual Edge from the Megaport MVE API.
type MVE struct {
ID int `json:"productId"`
UID string `json:"productUid"`
Name string `json:"productName"`
Type string `json:"productType"`
ProvisioningStatus string `json:"provisioningStatus"`
CreateDate *Time `json:"createDate"`
CreatedBy string `json:"createdBy"`
TerminateDate *Time `json:"terminateDate"`
LiveDate *Time `json:"liveDate"`
Market string `json:"market"`
LocationID int `json:"locationId"`
UsageAlgorithm string `json:"usageAlgorithm"`
MarketplaceVisibility bool `json:"marketplaceVisibility"`
VXCPermitted bool `json:"vxcpermitted"`
VXCAutoApproval bool `json:"vxcAutoApproval"`
SecondaryName string `json:"secondaryName"`
CompanyUID string `json:"companyUid"`
CompanyName string `json:"companyName"`
ContractStartDate *Time `json:"contractStartDate"`
ContractEndDate *Time `json:"contractEndDate"`
ContractTermMonths int `json:"contractTermMonths"`
AttributeTags map[string]string `json:"attributeTags"`
CostCentre string `json:"costCentre"`
Virtual bool `json:"virtual"`
BuyoutPort bool `json:"buyoutPort"`
Locked bool `json:"locked"`
AdminLocked bool `json:"adminLocked"`
Cancelable bool `json:"cancelable"`
Resources *MVEResources `json:"resources"`
Vendor string `json:"vendor"`
Size string `json:"mveSize"`
DiversityZone string `json:"diversityZone"`
NetworkInterfaces []*MVENetworkInterface `json:"vnics"`
LocationDetails *ProductLocationDetails `json:"locationDetail"`
ResourceTags []map[string]string `json:"resourceTags,omitempty"`
}
// MVEResources represents the resources associated with an MVE.
type MVEResources struct {
Interface *PortInterface `json:"interface"`
VirtualMachines []*MVEVirtualMachine `json:"virtual_machine"`
}
// MVEVirtualMachine represents a virtual machine associated with an MVE.
type MVEVirtualMachine struct {
ID int `json:"id"`
CpuCount int `json:"cpu_count"`
Image *MVEVirtualMachineImage `json:"image"`
ResourceType string `json:"resource_type"`
Up bool `json:"up"`
Vnics []*MVENetworkInterface `json:"vnics"`
}
// MVVEVirtualMachineImage represents the image associated with an MVE virtual machine.
type MVEVirtualMachineImage struct {
ID int `json:"id"`
Vendor string `json:"vendor"`
Product string `json:"product"`
Version string `json:"version"`
}
// MVEOrderResponse represents the response to an MVE order request.
type MVEOrderResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data []*MVEOrderConfirmation `json:"data"`
}
// MVEResponse represents the response to an MVE request.
type MVEResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data *MVE `json:"data"`
}
// MVEImage represents details for an MVE image, including image ID, version, product, and vendor.
type MVEImage struct {
ID int `json:"id"`
Version string `json:"version"`
Product string `json:"product"`
Vendor string `json:"vendor"`
VendorDescription string `json:"vendorDescription"`
ReleaseImage bool `json:"releaseImage"`
ProductCode string `json:"productCode"`
}
// MVEImageAPIResponse represents the response to an MVE image request.
type MVEImageAPIResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data *MVEImageAPIResponseData `json:"data"`
}
// MVEImageAPIResponseData represents the data in an MVE image response.
type MVEImageAPIResponseData struct {
Images []*MVEImage `json:"mveImages"`
}
// MVESize represents the details on the MVE size. The instance size determines the MVE capabilities, such as how many concurrent connections it can support. The compute sizes are 2/8, 4/16, 8/32, and 12/48, where the first number is the CPU and the second number is the GB of available RAM. Each size has 4 GB of RAM for every vCPU allocated.
type MVESize struct {
Size string `json:"size"`
Label string `json:"label"`
CPUCoreCount int `json:"cpuCoreCount"`
RamGB int `json:"ramGB"`
}
// MVESizeAPIResponse represents the response to an MVE size request, returning a list of currently available MVE sizes and details for each size.
type MVESizeAPIResponse struct {
Message string `json:"message"`
Terms string `json:"terms"`
Data []*MVESize `json:"data"`
}