This repository has been archived by the owner on Jun 21, 2022. It is now read-only.
/
vApp.go
398 lines (391 loc) · 15.1 KB
/
vApp.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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
package models
import "encoding/xml"
/*
Generated from https://www.onlinetool.io/xmltogo/ based on what I got from
the vCloud API
*/
// VApp is a struct representation of application/vnd.vmware.vcloud.vApp+xml
type VApp struct {
XMLName xml.Name `xml:"VApp"`
Text string `xml:",chardata"`
Xmlns string `xml:"xmlns,attr"`
Ovf string `xml:"ovf,attr"`
Vssd string `xml:"vssd,attr"`
Common string `xml:"common,attr"`
Rasd string `xml:"rasd,attr"`
Vmw string `xml:"vmw,attr"`
Vmext string `xml:"vmext,attr"`
Ovfenv string `xml:"ovfenv,attr"`
Ns9 string `xml:"ns9,attr"`
OvfDescriptorUploaded string `xml:"ovfDescriptorUploaded,attr"`
Deployed string `xml:"deployed,attr"`
Status string `xml:"status,attr"`
Name string `xml:"name,attr"`
ID string `xml:"id,attr"`
Href string `xml:"href,attr"`
Type string `xml:"type,attr"`
Link []struct {
Text string `xml:",chardata"`
Rel string `xml:"rel,attr"`
Href string `xml:"href,attr"`
Name string `xml:"name,attr"`
Type string `xml:"type,attr"`
} `xml:"Link"`
Description string `xml:"Description"`
Tasks struct {
Text string `xml:",chardata"`
Task struct {
Text string `xml:",chardata"`
CancelRequested string `xml:"cancelRequested,attr"`
ExpiryTime string `xml:"expiryTime,attr"`
Operation string `xml:"operation,attr"`
OperationName string `xml:"operationName,attr"`
ServiceNamespace string `xml:"serviceNamespace,attr"`
StartTime string `xml:"startTime,attr"`
Status string `xml:"status,attr"`
Name string `xml:"name,attr"`
ID string `xml:"id,attr"`
Href string `xml:"href,attr"`
Type string `xml:"type,attr"`
Owner struct {
Text string `xml:",chardata"`
Href string `xml:"href,attr"`
ID string `xml:"id,attr"`
Name string `xml:"name,attr"`
Type string `xml:"type,attr"`
} `xml:"Owner"`
User struct {
Text string `xml:",chardata"`
Href string `xml:"href,attr"`
ID string `xml:"id,attr"`
Name string `xml:"name,attr"`
Type string `xml:"type,attr"`
} `xml:"User"`
Organization struct {
Text string `xml:",chardata"`
Href string `xml:"href,attr"`
ID string `xml:"id,attr"`
Name string `xml:"name,attr"`
Type string `xml:"type,attr"`
} `xml:"Organization"`
Progress string `xml:"Progress"`
Details string `xml:"Details"`
} `xml:"Task"`
} `xml:"Tasks"`
LeaseSettingsSection struct {
Text string `xml:",chardata"`
Href string `xml:"href,attr"`
Type string `xml:"type,attr"`
Required string `xml:"required,attr"`
Info string `xml:"Info"`
Link struct {
Text string `xml:",chardata"`
Rel string `xml:"rel,attr"`
Href string `xml:"href,attr"`
Type string `xml:"type,attr"`
} `xml:"Link"`
DeploymentLeaseInSeconds string `xml:"DeploymentLeaseInSeconds"`
StorageLeaseInSeconds string `xml:"StorageLeaseInSeconds"`
} `xml:"LeaseSettingsSection"`
StartupSection struct {
Text string `xml:",chardata"`
Ns10 string `xml:"ns10,attr"`
Type string `xml:"type,attr"`
Href string `xml:"href,attr"`
Info string `xml:"Info"`
Item struct {
Text string `xml:",chardata"`
ID string `xml:"id,attr"`
Order string `xml:"order,attr"`
StartAction string `xml:"startAction,attr"`
StartDelay string `xml:"startDelay,attr"`
StopAction string `xml:"stopAction,attr"`
StopDelay string `xml:"stopDelay,attr"`
} `xml:"Item"`
Link struct {
Text string `xml:",chardata"`
Rel string `xml:"rel,attr"`
Href string `xml:"href,attr"`
Type string `xml:"type,attr"`
} `xml:"Link"`
} `xml:"StartupSection"`
NetworkSection struct {
Text string `xml:",chardata"`
Ns10 string `xml:"ns10,attr"`
Type string `xml:"type,attr"`
Href string `xml:"href,attr"`
Info string `xml:"Info"`
Network struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Description string `xml:"Description"`
} `xml:"Network"`
} `xml:"NetworkSection"`
NetworkConfigSection struct {
Text string `xml:",chardata"`
Href string `xml:"href,attr"`
Type string `xml:"type,attr"`
Required string `xml:"required,attr"`
Info string `xml:"Info"`
NetworkConfig struct {
Text string `xml:",chardata"`
NetworkName string `xml:"networkName,attr"`
Link struct {
Text string `xml:",chardata"`
Rel string `xml:"rel,attr"`
Href string `xml:"href,attr"`
} `xml:"Link"`
Description string `xml:"Description"`
Configuration struct {
Text string `xml:",chardata"`
IPScopes struct {
Text string `xml:",chardata"`
IPScope struct {
Text string `xml:",chardata"`
IsInherited string `xml:"IsInherited"`
Gateway string `xml:"Gateway"`
Netmask string `xml:"Netmask"`
SubnetPrefixLength string `xml:"SubnetPrefixLength"`
DNS1 string `xml:"Dns1"`
DNS2 string `xml:"Dns2"`
IsEnabled string `xml:"IsEnabled"`
IPRanges struct {
Text string `xml:",chardata"`
IPRange struct {
Text string `xml:",chardata"`
StartAddress string `xml:"StartAddress"`
EndAddress string `xml:"EndAddress"`
} `xml:"IpRange"`
} `xml:"IpRanges"`
} `xml:"IpScope"`
} `xml:"IpScopes"`
ParentNetwork struct {
Text string `xml:",chardata"`
Href string `xml:"href,attr"`
ID string `xml:"id,attr"`
Name string `xml:"name,attr"`
} `xml:"ParentNetwork"`
FenceMode string `xml:"FenceMode"`
RetainNetInfoAcrossDeployments string `xml:"RetainNetInfoAcrossDeployments"`
GuestVlanAllowed string `xml:"GuestVlanAllowed"`
} `xml:"Configuration"`
IsDeployed string `xml:"IsDeployed"`
} `xml:"NetworkConfig"`
} `xml:"NetworkConfigSection"`
SnapshotSection struct {
Text string `xml:",chardata"`
Href string `xml:"href,attr"`
Type string `xml:"type,attr"`
Required string `xml:"required,attr"`
Info string `xml:"Info"`
} `xml:"SnapshotSection"`
DateCreated string `xml:"DateCreated"`
Owner struct {
Text string `xml:",chardata"`
Type string `xml:"type,attr"`
User struct {
Text string `xml:",chardata"`
Href string `xml:"href,attr"`
Name string `xml:"name,attr"`
Type string `xml:"type,attr"`
} `xml:"User"`
} `xml:"Owner"`
AutoNature string `xml:"autoNature"`
InMaintenanceMode string `xml:"InMaintenanceMode"`
Children struct {
Text string `xml:",chardata"`
VM struct {
Text string `xml:",chardata"`
NeedsCustomization string `xml:"needsCustomization,attr"`
Deployed string `xml:"deployed,attr"`
Status string `xml:"status,attr"`
Name string `xml:"name,attr"`
ID string `xml:"id,attr"`
Href string `xml:"href,attr"`
Type string `xml:"type,attr"`
Link []struct {
Text string `xml:",chardata"`
Rel string `xml:"rel,attr"`
Href string `xml:"href,attr"`
Type string `xml:"type,attr"`
} `xml:"Link"`
DateCreated string `xml:"DateCreated"`
VAppScopedLocalID string `xml:"VAppScopedLocalId"`
VMCapabilities struct {
Text string `xml:",chardata"`
Href string `xml:"href,attr"`
Type string `xml:"type,attr"`
} `xml:"VmCapabilities"`
StorageProfile struct {
Text string `xml:",chardata"`
Href string `xml:"href,attr"`
ID string `xml:"id,attr"`
Name string `xml:"name,attr"`
Type string `xml:"type,attr"`
} `xml:"StorageProfile"`
VdcComputePolicy struct {
Text string `xml:",chardata"`
Href string `xml:"href,attr"`
ID string `xml:"id,attr"`
Name string `xml:"name,attr"`
Type string `xml:"type,attr"`
} `xml:"VdcComputePolicy"`
} `xml:"Vm"`
} `xml:"Children"`
}
// QueryResultRecords is a struct representation of a query of vApps
type QueryResultRecords struct {
XMLName xml.Name `xml:"QueryResultRecords"`
Text string `xml:",chardata"`
Xmlns string `xml:"xmlns,attr"`
Ovf string `xml:"ovf,attr"`
Vssd string `xml:"vssd,attr"`
Common string `xml:"common,attr"`
Rasd string `xml:"rasd,attr"`
Vmw string `xml:"vmw,attr"`
Vmext string `xml:"vmext,attr"`
Ovfenv string `xml:"ovfenv,attr"`
Ns9 string `xml:"ns9,attr"`
Name string `xml:"name,attr"`
Page string `xml:"page,attr"`
PageSize string `xml:"pageSize,attr"`
Total string `xml:"total,attr"`
Href string `xml:"href,attr"`
Type string `xml:"type,attr"`
Link []struct {
Text string `xml:",chardata"`
Rel string `xml:"rel,attr"`
Href string `xml:"href,attr"`
Type string `xml:"type,attr"`
} `xml:"Link"`
VAppRecord []struct {
Text string `xml:",chardata"`
CreationDate string `xml:"creationDate,attr"`
IsAutoNature string `xml:"isAutoNature,attr"`
IsBusy string `xml:"isBusy,attr"`
IsDeployed string `xml:"isDeployed,attr"`
IsEnabled string `xml:"isEnabled,attr"`
IsExpired string `xml:"isExpired,attr"`
IsInMaintenanceMode string `xml:"isInMaintenanceMode,attr"`
IsPublic string `xml:"isPublic,attr"`
Name string `xml:"name,attr"`
OwnerName string `xml:"ownerName,attr"`
Snapshot string `xml:"snapshot,attr"`
Status string `xml:"status,attr"`
Vdc string `xml:"vdc,attr"`
VdcName string `xml:"vdcName,attr"`
Href string `xml:"href,attr"`
TaskStatusName string `xml:"taskStatusName,attr"`
IsAutoDeleteNotified string `xml:"isAutoDeleteNotified,attr"`
IsVdcEnabled string `xml:"isVdcEnabled,attr"`
HonorBootOrder string `xml:"honorBootOrder,attr"`
NumberOfVMs string `xml:"numberOfVMs,attr"`
CPUAllocationInMhz string `xml:"cpuAllocationInMhz,attr"`
NumberOfCpus string `xml:"numberOfCpus,attr"`
CPUAllocationMhz string `xml:"cpuAllocationMhz,attr"`
Task string `xml:"task,attr"`
LowestHardwareVersionInVApp string `xml:"lowestHardwareVersionInVApp,attr"`
MemoryAllocationMB string `xml:"memoryAllocationMB,attr"`
StorageKB string `xml:"storageKB,attr"`
PvdcHighestSupportedHardwareVersion string `xml:"pvdcHighestSupportedHardwareVersion,attr"`
IsAutoUndeployNotified string `xml:"isAutoUndeployNotified,attr"`
TaskStatus string `xml:"taskStatus,attr"`
TaskDetails string `xml:"taskDetails,attr"`
} `xml:"VAppRecord"`
}
// Task is a struct representation of application/vnd.vmware.vcloud.task+xml
type Task struct {
XMLName xml.Name `xml:"Task"`
Text string `xml:",chardata"`
Xmlns string `xml:"xmlns,attr"`
Ovf string `xml:"ovf,attr"`
Vssd string `xml:"vssd,attr"`
Common string `xml:"common,attr"`
Rasd string `xml:"rasd,attr"`
Vmw string `xml:"vmw,attr"`
Ovfenv string `xml:"ovfenv,attr"`
Vmext string `xml:"vmext,attr"`
Ns9 string `xml:"ns9,attr"`
CancelRequested string `xml:"cancelRequested,attr"`
EndTime string `xml:"endTime,attr"`
ExpiryTime string `xml:"expiryTime,attr"`
Operation string `xml:"operation,attr"`
OperationName string `xml:"operationName,attr"`
ServiceNamespace string `xml:"serviceNamespace,attr"`
StartTime string `xml:"startTime,attr"`
Status string `xml:"status,attr"`
Name string `xml:"name,attr"`
ID string `xml:"id,attr"`
Href string `xml:"href,attr"`
Type string `xml:"type,attr"`
Owner struct {
Text string `xml:",chardata"`
Href string `xml:"href,attr"`
ID string `xml:"id,attr"`
Name string `xml:"name,attr"`
Type string `xml:"type,attr"`
} `xml:"Owner"`
Error struct {
Text string `xml:",chardata"`
MajorErrorCode string `xml:"majorErrorCode,attr"`
Message string `xml:"message,attr"`
MinorErrorCode string `xml:"minorErrorCode,attr"`
} `xml:"Error"`
User struct {
Text string `xml:",chardata"`
Href string `xml:"href,attr"`
ID string `xml:"id,attr"`
Name string `xml:"name,attr"`
Type string `xml:"type,attr"`
} `xml:"User"`
Organization struct {
Text string `xml:",chardata"`
Href string `xml:"href,attr"`
ID string `xml:"id,attr"`
Name string `xml:"name,attr"`
Type string `xml:"type,attr"`
} `xml:"Organization"`
Progress string `xml:"Progress"`
Details string `xml:"Details"`
}
// VcloudError is return when a 400 error code appearss
type VcloudError struct {
XMLName xml.Name `xml:"Error"`
Text string `xml:",chardata"`
Xmlns string `xml:"xmlns,attr"`
Ovf string `xml:"ovf,attr"`
Vssd string `xml:"vssd,attr"`
Common string `xml:"common,attr"`
Rasd string `xml:"rasd,attr"`
Vmw string `xml:"vmw,attr"`
Ovfenv string `xml:"ovfenv,attr"`
Vmext string `xml:"vmext,attr"`
Ns9 string `xml:"ns9,attr"`
MajorErrorCode string `xml:"majorErrorCode,attr"`
Message string `xml:"message,attr"`
MinorErrorCode string `xml:"minorErrorCode,attr"`
}
// NetworkConnectionSection represents application/vnd.vmware.vcloud.networkConnectionSection+xml
type NetworkConnectionSection struct {
XMLName xml.Name `xml:"NetworkConnectionSection"`
Xmlns string `xml:"xmlns,attr"`
Ovf string `xml:"ovf,attr"`
Href string `xml:"href,attr"`
Type string `xml:"type,attr"`
PrimaryNetworkConnectionIndex int `xml:"PrimaryNetworkConnectionIndex"`
NetworkConnection struct {
NetworkConnectionIndex int `xml:"NetworkConnectionIndex"`
IPAddress string `xml:"IpAddress"`
ExternalIPAddress string `xml:"ExternalIpAddress"`
IsConnected bool `xml:"IsConnected"`
MACAddress string `xml:"MACAddress"`
IPAddressAllocationMode string `xml:"IpAddressAllocationMode"`
}
Link struct {
Href string `xml:"href,attr"`
ID string `xml:"id,attr"`
Type string `xml:"type,attr"`
Name string `xml:"name,attr"`
Rel string `xml:"rel,attr"`
}
}