1/*
2 * Copyright 2014 VMware, Inc.  All rights reserved.  Licensed under the Apache v2 License.
3 */
4
5package types
6
7import (
8	"encoding/xml"
9)
10
11// Maps status Attribute Values for VAppTemplate, VApp, Vm, and Media Objects
12var VAppStatuses = map[int]string{
13	-1: "FAILED_CREATION",
14	0:  "UNRESOLVED",
15	1:  "RESOLVED",
16	2:  "DEPLOYED",
17	3:  "SUSPENDED",
18	4:  "POWERED_ON",
19	5:  "WAITING_FOR_INPUT",
20	6:  "UNKNOWN",
21	7:  "UNRECOGNIZED",
22	8:  "POWERED_OFF",
23	9:  "INCONSISTENT_STATE",
24	10: "MIXED",
25	11: "DESCRIPTOR_PENDING",
26	12: "COPYING_CONTENTS",
27	13: "DISK_CONTENTS_PENDING",
28	14: "QUARANTINED",
29	15: "QUARANTINE_EXPIRED",
30	16: "REJECTED",
31	17: "TRANSFER_TIMEOUT",
32	18: "VAPP_UNDEPLOYED",
33	19: "VAPP_PARTIALLY_DEPLOYED",
34}
35
36// Maps status Attribute Values for VDC Objects
37var VDCStatuses = map[int]string{
38	-1: "FAILED_CREATION",
39	0:  "NOT_READY",
40	1:  "READY",
41	2:  "UNKNOWN",
42	3:  "UNRECOGNIZED",
43}
44
45// VCD API
46
47// Type: DefaultStorageProfileSection_Type
48// Namespace: http://www.vmware.com/vcloud/v1.5
49// Description: Name of the storage profile that will be specified for this virtual machine. The named storage profile must exist in the organization vDC that contains the virtual machine. If not specified, the default storage profile for the vDC is used.
50// Since: 5.1
51type DefaultStorageProfileSection struct {
52	StorageProfile string `xml:"StorageProfile,omitempty"`
53}
54
55// Type: CustomizationSectionType
56// Namespace: http://www.vmware.com/vcloud/v1.5
57// Description: Represents a vApp template customization settings.
58// Since: 1.0
59type CustomizationSection struct {
60	// FIXME: OVF Section needs to be laid down correctly
61	Info string `xml:"ovf:Info"`
62	//
63	GoldMaster             bool    `xml:"goldMaster,attr,omitempty"`
64	HREF                   string  `xml:"href,attr,omitempty"`
65	Type                   string  `xml:"type,attr,omitempty"`
66	CustomizeOnInstantiate bool    `xml:"CustomizeOnInstantiate"`
67	Link                   []*Link `xml:"Link,omitempty"`
68}
69
70// Type: LeaseSettingsSectionType
71// Namespace: http://www.vmware.com/vcloud/v1.5
72// Description: Represents vApp lease settings.
73// Since: 0.9
74type LeaseSettingsSection struct {
75	HREF                      string `xml:"href,attr,omitempty"`
76	Type                      string `xml:"type,attr,omitempty"`
77	DeploymentLeaseExpiration string `xml:"DeploymentLeaseExpiration,omitempty"`
78	DeploymentLeaseInSeconds  int    `xml:"DeploymentLeaseInSeconds,omitempty"`
79	Link                      *Link  `xml:"Link,omitempty"`
80	StorageLeaseExpiration    string `xml:"StorageLeaseExpiration,omitempty"`
81	StorageLeaseInSeconds     int    `xml:"StorageLeaseInSeconds,omitempty"`
82}
83
84// Type: IpRangeType
85// Namespace: http://www.vmware.com/vcloud/v1.5
86// Description: Represents a range of IP addresses, start and end inclusive.
87// Since: 0.9
88type IPRange struct {
89	EndAddress   string `xml:"EndAddress"`   // End address of the IP range.
90	StartAddress string `xml:"StartAddress"` // Start address of the IP range.
91}
92
93// Type: DhcpServiceType
94// Namespace: http://www.vmware.com/vcloud/v1.5
95// Description: Represents a DHCP network service.
96// Since:
97type DhcpService struct {
98	DefaultLeaseTime    int      `xml:"DefaultLeaseTime,omitempty"`    // Default lease in seconds for DHCP addresses.
99	DomainName          string   `xml:"DomainName,omitempty"`          //	The domain name.
100	IPRange             *IPRange `xml:"IpRange"`                       //	IP range for DHCP addresses.
101	IsEnabled           bool     `xml:"IsEnabled"`                     // Enable or disable the service using this flag
102	MaxLeaseTime        int      `xml:"MaxLeaseTime"`                  //	Max lease in seconds for DHCP addresses.
103	PrimaryNameServer   string   `xml:"PrimaryNameServer,omitempty"`   // The primary name server.
104	RouterIP            string   `xml:"RouterIp,omitempty"`            // Router IP.
105	SecondaryNameServer string   `xml:"SecondaryNameServer,omitempty"` // The secondary name server.
106	SubMask             string   `xml:"SubMask,omitempty"`             // The subnet mask.
107}
108
109// Type: NetworkFeaturesType
110// Namespace: http://www.vmware.com/vcloud/v1.5
111// Description: Represents features of a network.
112// Since:
113type NetworkFeatures struct {
114	DhcpService          *DhcpService          `xml:"DhcpService,omitempty"`          // Substitute for NetworkService. DHCP service settings
115	FirewallService      *FirewallService      `xml:"FirewallService,omitempty"`      // Substitute for NetworkService. Firewall service settings
116	NatService           *NatService           `xml:"NatService,omitempty"`           // Substitute for NetworkService. NAT service settings
117	LoadBalancerService  *LoadBalancerService  `xml:"LoadBalancerService,omitempty"`  // Substitute for NetworkService. Load Balancer service settings
118	StaticRoutingService *StaticRoutingService `xml:"StaticRoutingService,omitempty"` // Substitute for NetworkService. Static Routing service settings
119	// TODO: Not Implemented
120	// IpsecVpnService      IpsecVpnService      `xml:"IpsecVpnService,omitempty"`      // Substitute for NetworkService. Ipsec Vpn service settings
121}
122
123// Type: IpAddressesType
124// Namespace: http://www.vmware.com/vcloud/v1.5
125// Description: A list of IP addresses.
126// Since: 0.9
127type IPAddresses struct {
128	IPAddress string `xml:"IpAddress,omitempty"` // An IP address.
129}
130
131// Type: IpRangesType
132// Namespace: http://www.vmware.com/vcloud/v1.5
133// Description: Represents a list of IP ranges.
134// Since: 0.9
135type IPRanges struct {
136	IPRange []*IPRange `xml:"IpRange,omitempty"` // IP range.
137}
138
139// Type: IpScopeType
140// Namespace: http://www.vmware.com/vcloud/v1.5
141// Description: Specify network settings like gateway, network mask, DNS servers, IP ranges, etc.
142// Since: 0.9
143type IPScope struct {
144	IsInherited          bool            `xml:"IsInherited"`                    // True if the IP scope is inherit from parent network.
145	Gateway              string          `xml:"Gateway,omitempty"`              // Gateway of the network.
146	Netmask              string          `xml:"Netmask,omitempty"`              // Network mask.
147	DNS1                 string          `xml:"Dns1,omitempty"`                 // Primary DNS server.
148	DNS2                 string          `xml:"Dns2,omitempty"`                 // Secondary DNS server.
149	DNSSuffix            string          `xml:"DnsSuffix,omitempty"`            // DNS suffix.
150	IsEnabled            bool            `xml:"IsEnabled"`                      // Indicates if subnet is enabled or not. Default value is True.
151	IPRanges             *IPRanges       `xml:"IpRanges,omitempty"`             // IP ranges used for static pool allocation in the network.
152	AllocatedIPAddresses *IPAddresses    `xml:"AllocatedIpAddresses,omitempty"` // Read-only list of allocated IP addresses in the network.
153	SubAllocations       *SubAllocations `xml:"SubAllocations,omitempty"`       // Read-only list of IP addresses that are sub allocated to edge gateways.
154}
155
156// Type: SubAllocationsType
157// Namespace: http://www.vmware.com/vcloud/v1.5
158// Description: A list of IP addresses that are sub allocated to edge gateways.
159// Since: 5.1
160type SubAllocations struct {
161	// Attributes
162	HREF string `xml:"href,attr,omitempty"` // The URI of the entity.
163	Type string `xml:"type,attr,omitempty"` // The MIME type of the entity.
164	// Elements
165	Link          []*Link        `xml:"Link,omitempty"`          // A reference to an entity or operation associated with this object.
166	SubAllocation *SubAllocation `xml:"SubAllocation,omitempty"` // IP Range sub allocated to a edge gateway.
167}
168
169// Type: SubAllocationType
170// Namespace: http://www.vmware.com/vcloud/v1.5
171// Description: IP range sub allocated to an edge gateway.
172// Since: 5.1
173type SubAllocation struct {
174	EdgeGateway *Reference `xml:"EdgeGateway,omitempty"` // Edge gateway that uses this sub allocation.
175	IPRanges    *IPRanges  `xml:"IpRanges,omitempty"`    // IP range sub allocated to the edge gateway.
176}
177
178// Type: IpScopesType
179// Namespace: http://www.vmware.com/vcloud/v1.5
180// Description: Represents a list of IP scopes.
181// Since: 5.1
182type IPScopes struct {
183	IPScope IPScope `xml:"IpScope"` // IP scope.
184}
185
186// Type: NetworkConfigurationType
187// Namespace: http://www.vmware.com/vcloud/v1.5
188// Description: The configurations applied to a network. This is an abstract base type. The concrete types include those for vApp and Organization wide networks.
189// Since: 0.9
190type NetworkConfiguration struct {
191	BackwardCompatibilityMode      bool             `xml:"BackwardCompatibilityMode"`
192	Features                       *NetworkFeatures `xml:"Features,omitempty"`
193	ParentNetwork                  *Reference       `xml:"ParentNetwork,omitempty"`
194	FenceMode                      string           `xml:"FenceMode"`
195	IPScopes                       *IPScopes        `xml:"IpScopes,omitempty"`
196	RetainNetInfoAcrossDeployments bool             `xml:"RetainNetInfoAcrossDeployments"`
197	// TODO: Not Implemented
198	// RouterInfo                     RouterInfo           `xml:"RouterInfo,omitempty"`
199	// SyslogServerSettings           SyslogServerSettings `xml:"SyslogServerSettings,omitempty"`
200}
201
202// Type: VAppNetworkConfigurationType
203// Namespace: http://www.vmware.com/vcloud/v1.5
204// Description: Represents a vApp network configuration.
205// Since: 0.9
206type VAppNetworkConfiguration struct {
207	HREF        string `xml:"href,attr,omitempty"`
208	Type        string `xml:"type,attr,omitempty"`
209	NetworkName string `xml:"networkName,attr"`
210
211	Configuration *NetworkConfiguration `xml:"Configuration"`
212	Description   string                `xml:"Description,omitempty"`
213	IsDeployed    bool                  `xml:"IsDeployed"`
214	Link          *Link                 `xml:"Link,omitempty"`
215}
216
217// Type: NetworkConfigSectionType
218// Namespace: http://www.vmware.com/vcloud/v1.5
219// Description: Container for vApp networks.
220// Since: 0.9
221type NetworkConfigSection struct {
222	// Extends OVF Section_Type
223	// FIXME: Fix the OVF section
224	Info string `xml:"ovf:Info"`
225	//
226	HREF          string                    `xml:"href,attr,omitempty"`
227	Type          string                    `xml:"type,attr,omitempty"`
228	Link          *Link                     `xml:"Link,omitempty"`
229	NetworkConfig *VAppNetworkConfiguration `xml:"NetworkConfig,omitempty"`
230}
231
232// Type: NetworkConnectionType
233// Namespace: http://www.vmware.com/vcloud/v1.5
234// Description: Represents a network connection in the virtual machine.
235// Since: 0.9
236type NetworkConnection struct {
237	Network                 string `xml:"network,attr"`                      // Name of the network to which this NIC is connected.
238	NetworkConnectionIndex  int    `xml:"NetworkConnectionIndex"`            // Virtual slot number associated with this NIC. First slot number is 0.
239	IsConnected             bool   `xml:"IsConnected"`                       // If the virtual machine is undeployed, this value specifies whether the NIC should be connected upon deployment. If the virtual machine is deployed, this value reports the current status of this NIC's connection, and can be updated to change that connection status.
240	NeedsCustomization      bool   `xml:"needsCustomization,attr,omitempty"` // True if this NIC needs customization.
241	ExternalIPAddress       string `xml:"ExternalIpAddress,omitempty"`       // If the network to which this NIC connects provides NAT services, the external address assigned to this NIC appears here.
242	IPAddress               string `xml:"IpAddress,omitempty"`               // IP address assigned to this NIC.
243	IPAddressAllocationMode string `xml:"IpAddressAllocationMode"`           // IP address allocation mode for this connection. One of: POOL (A static IP address is allocated automatically from a pool of addresses.) DHCP (The IP address is obtained from a DHCP service.) MANUAL (The IP address is assigned manually in the IpAddress element.) NONE (No IP addressing mode specified.)
244	MACAddress              string `xml:"MACAddress,omitempty"`              // MAC address associated with the NIC.
245}
246
247// Type: NetworkConnectionSectionType
248// Namespace: http://www.vmware.com/vcloud/v1.5
249// Description: Container for the network connections of this virtual machine.
250// Since: 0.9
251type NetworkConnectionSection struct {
252	// Extends OVF Section_Type
253	// FIXME: Fix the OVF section
254	Info string `xml:"ovf:Info"`
255	//
256	HREF                          string             `xml:"href,attr,omitempty"`
257	Type                          string             `xml:"type,attr,omitempty"`
258	Link                          *Link              `xml:"Link,omitempty"`
259	PrimaryNetworkConnectionIndex int                `xml:"PrimaryNetworkConnectionIndex"`
260	NetworkConnection             *NetworkConnection `xml:"NetworkConnection,omitempty"`
261}
262
263// Type: InstantiationParamsType
264// Namespace: http://www.vmware.com/vcloud/v1.5
265// Description: Container for ovf:Section_Type elements that specify vApp configuration on instantiate, compose, or recompose.
266// Since: 0.9
267type InstantiationParams struct {
268	CustomizationSection         *CustomizationSection         `xml:"CustomizationSection,omitempty"`
269	DefaultStorageProfileSection *DefaultStorageProfileSection `xml:"DefaultStorageProfileSection,omitempty"`
270	GuestCustomizationSection    *GuestCustomizationSection    `xml:"GuestCustomizationSection,omitempty"`
271	LeaseSettingsSection         *LeaseSettingsSection         `xml:"LeaseSettingsSection,omitempty"`
272	NetworkConfigSection         *NetworkConfigSection         `xml:"NetworkConfigSection,omitempty"`
273	NetworkConnectionSection     *NetworkConnectionSection     `xml:"NetworkConnectionSection,omitempty"`
274	// TODO: Not Implemented
275	// SnapshotSection              SnapshotSection              `xml:"SnapshotSection,omitempty"`
276}
277
278// Type: OrgVdcNetworkType
279// Namespace: http://www.vmware.com/vcloud/v1.5
280// Description: Represents an Org vDC network in the vCloud model.
281// Since: 5.1
282type OrgVDCNetwork struct {
283	XMLName       xml.Name              `xml:"OrgVdcNetwork"`
284	HREF          string                `xml:"href,attr,omitempty"`
285	Type          string                `xml:"type,attr,omitempty"`
286	ID            string                `xml:"id,attr,omitempty"`
287	OperationKey  string                `xml:"operationKey,attr,omitempty"`
288	Name          string                `xml:"name,attr"`
289	Status        string                `xml:"status,attr,omitempty"`
290	Configuration *NetworkConfiguration `xml:"Configuration,omitempty"`
291	Description   string                `xml:"Description,omitempty"`
292	EdgeGateway   *Reference            `xml:"EdgeGateway,omitempty"`
293	IsShared      bool                  `xml:"IsShared"`
294	Link          []Link                `xml:"Link"`
295	ServiceConfig *GatewayFeatures      `xml:"ServiceConfig,omitempty"` // Specifies the service configuration for an isolated Org vDC networks
296	Tasks         TasksInProgress       `xml:"Tasks,omitempty"`
297}
298
299// Type: SupportedHardwareVersionType
300// Namespace: http://www.vmware.com/vcloud/v1.5
301// Description: Represents a supported virtual hardware version.
302// Since: 1.5
303type SupportedHardwareVersion struct {
304	SupportedHardwareVersion string `xml:"SupportedHardwareVersion"`
305}
306
307// Type: SupportedHardwareVersionsType
308// Namespace: http://www.vmware.com/vcloud/v1.5
309// Description: Contains a list of VMware virtual hardware versions supported in this vDC.
310// Since: 1.5
311type SupportedHardwareVersions struct {
312	SupportedHardwareVersion []*SupportedHardwareVersion `xml:"SupportedHardwareVersion,omitempty"` // A virtual hardware version supported in this vDC.
313}
314
315// Type: CapabilitiesType
316// Namespace: http://www.vmware.com/vcloud/v1.5
317// Description: Collection of supported hardware capabilities.
318// Since: 1.5
319type Capabilities struct {
320	SupportedHardwareVersions *SupportedHardwareVersions `xml:"SupportedHardwareVersions,omitempty"` // Read-only list of virtual hardware versions supported by this vDC.
321}
322
323// Type: VdcType
324// Namespace: http://www.vmware.com/vcloud/v1.5
325// Description: Represents the user view of an organization vDC.
326// Since: 0.9
327type Vdc struct {
328	HREF         string `xml:"href,attr,omitempty"`
329	Type         string `xml:"type,attr,omitempty"`
330	ID           string `xml:"id,attr,omitempty"`
331	OperationKey string `xml:"operationKey,attr,omitempty"`
332	Name         string `xml:"name,attr"`
333	Status       string `xml:"status,attr,omitempty"`
334
335	AllocationModel    string                `xml:"AllocationModel"`
336	AvailableNetworks  []*AvailableNetworks  `xml:"AvailableNetworks,omitempty"`
337	Capabilities       []*Capabilities       `xml:"Capabilities,omitempty"`
338	ComputeCapacity    []*ComputeCapacity    `xml:"ComputeCapacity"`
339	Description        string                `xml:"Description,omitempty"`
340	IsEnabled          bool                  `xml:"IsEnabled"`
341	Link               []*Link               `xml:"Link,omitempty"`
342	NetworkQuota       int                   `xml:"NetworkQuota"`
343	NicQuota           int                   `xml:"NicQuota"`
344	ResourceEntities   []*ResourceEntities   `xml:"ResourceEntities,omitempty"`
345	Tasks              *TasksInProgress      `xml:"Taks,omitempty"`
346	UsedNetworkCount   int                   `xml:"UsedNetworkCount,omitempty"`
347	VdcStorageProfiles []*VdcStorageProfiles `xml:"VdcStorageProfiles"`
348	VMQuota            int                   `xml:"VmQuota"`
349}
350
351// Type: TaskType
352// Namespace: http://www.vmware.com/vcloud/v1.5
353// Description: Represents an asynchronous operation in vCloud Director.
354// Since: 0.9
355type Task struct {
356	HREF             string           `xml:"href,attr,omitempty"`
357	Type             string           `xml:"type,attr,omitempty"`
358	ID               string           `xml:"id,attr,omitempty"`
359	OperationKey     string           `xml:"operationKey,attr,omitempty"`
360	Name             string           `xml:"name,attr"`
361	Status           string           `xml:"status,attr"`
362	Operation        string           `xml:"operation,attr,omitempty"`
363	OperationName    string           `xml:"operationName,attr,omitempty"`
364	ServiceNamespace string           `xml:"serviceNamespace,attr,omitempty"`
365	StartTime        string           `xml:"startTime,attr,omitempty"`
366	EndTime          string           `xml:"endTime,attr,omitempty"`
367	ExpiryTime       string           `xml:"expiryTime,attr,omitempty"`
368	CancelRequested  bool             `xml:"cancelRequested,attr,omitempty"`
369	Description      string           `xml:"Description,omitempty"`
370	Details          string           `xml:"Details,omitempty"`
371	Error            *Error           `xml:"Error,omitempty"`
372	Link             *Link            `xml:"Link,omitempty"`
373	Organization     *Reference       `xml:"Organization,omitempty"`
374	Owner            *Reference       `xml:"Owner,omitempty"`
375	Progress         int              `xml:"Progress,omitempty"`
376	Tasks            *TasksInProgress `xml:"Tasks,omitempty"`
377	User             *Reference       `xml:"User,omitempty"`
378}
379
380// Type: CapacityWithUsageType
381// Namespace: http://www.vmware.com/vcloud/v1.5
382// Description: Represents a capacity and usage of a given resource.
383// Since: 0.9
384type CapacityWithUsage struct {
385	Allocated int64  `xml:"Allocated,omitempty"`
386	Limit     int64  `xml:"Limit,omitempty"`
387	Overhead  int64  `xml:"Overhead,omitempty"`
388	Reserved  int64  `xml:"Reserved,omitempty"`
389	Units     string `xml:"Units"`
390	Used      int64  `xml:"Used,omitempty"`
391}
392
393// Type: ComputeCapacityType
394// Namespace: http://www.vmware.com/vcloud/v1.5
395// Description: Represents vDC compute capacity.
396// Since: 0.9
397type ComputeCapacity struct {
398	CPU    *CapacityWithUsage `xml:"Cpu"`
399	Memory *CapacityWithUsage `xml:"Memory"`
400}
401
402// Type: ReferenceType
403// Namespace: http://www.vmware.com/vcloud/v1.5
404// Description: A reference to a resource. Contains an href attribute and optional name and type attributes.
405// Since: 0.9
406type Reference struct {
407	HREF string `xml:"href,attr"`
408	ID   string `xml:"id,attr,omitempty"`
409	Type string `xml:"type,attr,omitempty"`
410	Name string `xml:"name,attr,omitempty"`
411}
412
413// Type: ResourceReferenceType
414// Namespace: http://www.vmware.com/vcloud/v1.5
415// Description: Represents a reference to a resource. Contains an href attribute, a resource status attribute, and optional name and type attributes.
416// Since: 0.9
417type ResourceReference struct {
418	HREF   string `xml:"href,attr"`
419	ID     string `xml:"id,attr,omitempty"`
420	Type   string `xml:"type,attr,omitempty"`
421	Name   string `xml:"name,attr,omitempty"`
422	Status string `xml:"status,attr,omitempty"`
423}
424
425// Element: VdcStorageProfiles
426// Type: VdcStorageProfilesType
427// Namespace: http://www.vmware.com/vcloud/v1.5
428// Description: Container for references to storage profiles associated with a vDC.
429// Since: 5.1
430type VdcStorageProfiles struct {
431	VdcStorageProfile []*Reference `xml:"VdcStorageProfile,omitempty"`
432}
433
434// Type: ResourceEntitiesType
435// Namespace: http://www.vmware.com/vcloud/v1.5
436// Description: Container for references to ResourceEntity objects in this vDC.
437// Since: 0.9
438type ResourceEntities struct {
439	ResourceEntity []*ResourceReference `xml:"ResourceEntity,omitempty"`
440}
441
442// Type: AvailableNetworksType
443// Namespace: http://www.vmware.com/vcloud/v1.5
444// Description: Container for references to available organization vDC networks.
445// Since: 0.9
446type AvailableNetworks struct {
447	Network []*Reference `xml:"Network,omitempty"`
448}
449
450// Type: LinkType
451// Namespace: http://www.vmware.com/vcloud/v1.5
452// Description: Extends reference type by adding relation attribute. Defines a hyper-link with a relationship, hyper-link reference, and an optional MIME type.
453// Since: 0.9
454type Link struct {
455	HREF string `xml:"href,attr"`
456	ID   string `xml:"id,attr,omitempty"`
457	Type string `xml:"type,attr,omitempty"`
458	Name string `xml:"name,attr,omitempty"`
459	Rel  string `xml:"rel,attr"`
460}
461
462// Type: OrgType
463// Namespace: http://www.vmware.com/vcloud/v1.5
464// Description: Represents the user view of a vCloud Director organization.
465// Since: 0.9
466type Org struct {
467	HREF         string           `xml:"href,attr,omitempty"`
468	Type         string           `xml:"type,attr,omitempty"`
469	ID           string           `xml:"id,attr,omitempty"`
470	OperationKey string           `xml:"operationKey,attr,omitempty"`
471	Name         string           `xml:"name,attr"`
472	Description  string           `xml:"Description,omitempty"`
473	FullName     string           `xml:"FullName"`
474	IsEnabled    bool             `xml:"IsEnabled,omitempty"`
475	Link         []*Link          `xml:"Link,omitempty"`
476	Tasks        *TasksInProgress `xml:"Tasks,omitempty"`
477}
478
479// Type: CatalogItemType
480// Namespace: http://www.vmware.com/vcloud/v1.5
481// Description: Contains a reference to a VappTemplate or Media object and related metadata.
482// Since: 0.9
483type CatalogItem struct {
484	HREF          string           `xml:"href,attr,omitempty"`
485	Type          string           `xml:"type,attr,omitempty"`
486	ID            string           `xml:"id,attr,omitempty"`
487	OperationKey  string           `xml:"operationKey,attr,omitempty"`
488	Name          string           `xml:"name,attr"`
489	Size          int64            `xml:"size,attr,omitempty"`
490	DateCreated   string           `xml:"DateCreated,omitempty"`
491	Description   string           `xml:"Description,omitempty"`
492	Entity        *Entity          `xml:"Entity"`
493	Link          []*Link          `xml:"Link,omitempty"`
494	Tasks         *TasksInProgress `xml:"Tasks,omitempty"`
495	VersionNumber int64            `xml:"VersionNumber,omitempty"`
496}
497
498// Type: EntityType
499// Namespace: http://www.vmware.com/vcloud/v1.5
500// Description: Basic entity type in the vCloud object model. Includes a name, an optional description, and an optional list of links.
501// Since: 0.9
502type Entity struct {
503	HREF         string           `xml:"href,attr,omitempty"`
504	Type         string           `xml:"type,attr,omitempty"`
505	ID           string           `xml:"id,attr,omitempty"`
506	OperationKey string           `xml:"operationKey,attr,omitempty"`
507	Name         string           `xml:"name,attr"`
508	Description  string           `xml:"Description,omitempty"`
509	Link         []*Link          `xml:"Link,omitempty"`
510	Tasks        *TasksInProgress `xml:"Tasks,omitempty"`
511}
512
513// Type: CatalogItemsType
514// Namespace: http://www.vmware.com/vcloud/v1.5
515// Description: Container for references to catalog items.
516// Since: 0.9
517type CatalogItems struct {
518	CatalogItem []*Reference `xml:"CatalogItem"`
519}
520
521// Type: CatalogType
522// Namespace: http://www.vmware.com/vcloud/v1.5
523// Description: Represents the user view of a Catalog object.
524// Since: 0.9
525type Catalog struct {
526	HREF          string           `xml:"href,attr,omitempty"`
527	Type          string           `xml:"type,attr,omitempty"`
528	ID            string           `xml:"id,attr,omitempty"`
529	OperationKey  string           `xml:"operationKey,attr,omitempty"`
530	Name          string           `xml:"name,attr"`
531	CatalogItems  []*CatalogItems  `xml:"CatalogItems"`
532	DateCreated   string           `xml:"DateCreated"`
533	Description   string           `xml:"Description"`
534	IsPublished   bool             `xml:"IsPublished"`
535	Link          []*Link          `xml:"Link"`
536	Owner         *Owner           `xml:"Owner,omitempty"`
537	Tasks         *TasksInProgress `xml:"Tasks,omitempty"`
538	VersionNumber int64            `xml:"VersionNumber"`
539}
540
541// Type: OwnerType
542// Namespace: http://www.vmware.com/vcloud/v1.5
543// Description: Represents the owner of this entity.
544// Since: 1.5
545type Owner struct {
546	HREF string     `xml:"href,attr,omitempty"`
547	Type string     `xml:"type,attr,omitempty"`
548	Link []*Link    `xml:"Link,omitempty"`
549	User *Reference `xml:"User"`
550}
551
552// Type: ErrorType
553// Namespace: http://www.vmware.com/vcloud/v1.5
554// Description: The standard error message type used in the vCloud REST API.
555// Since: 0.9
556type Error struct {
557	Message                 string `xml:"message,attr"`
558	MajorErrorCode          int    `xml:"majorErrorCode,attr"`
559	MinorErrorCode          string `xml:"minorErrorCode,attr"`
560	VendorSpecificErrorCode string `xml:"vendorSpecificErrorCode,attr,omitempty"`
561	StackTrace              string `xml:"stackTrace,attr,omitempty"`
562}
563
564// Type: FileType
565// Namespace: http://www.vmware.com/vcloud/v1.5
566// Description: Represents a file to be transferred (uploaded or downloaded).
567// Since: 0.9
568type File struct {
569	HREF             string           `xml:"href,attr,omitempty"`
570	Type             string           `xml:"type,attr,omitempty"`
571	ID               string           `xml:"id,attr,omitempty"`
572	OperationKey     string           `xml:"operationKey,attr,omitempty"`
573	Name             string           `xml:"name,attr"`
574	Size             int64            `xml:"size,attr,omitempty"`
575	BytesTransferred int64            `xml:"bytesTransferred,attr,omitempty"`
576	Checksum         string           `xml:"checksum,attr,omitempty"`
577	Description      string           `xml:"Description,omitempty"`
578	Link             []*Link          `xml:"Link,omitempty"`
579	Tasks            *TasksInProgress `xml:"Tasks,omitempty"`
580}
581
582// Type: FilesListType
583// Namespace: http://www.vmware.com/vcloud/v1.5
584// Description: Represents a list of files to be transferred (uploaded or downloaded).
585// Since: 0.9
586type FilesList struct {
587	File []*File `xml:"File"`
588}
589
590// Type: UndeployVAppParamsType
591// Namespace: http://www.vmware.com/vcloud/v1.5
592// Description: Parameters to an undeploy vApp request.
593// Since: 0.9
594type UndeployVAppParams struct {
595	Xmlns               string `xml:"xmlns,attr"`
596	UndeployPowerAction string `xml:"UndeployPowerAction,omitempty"`
597}
598
599// Type: VmCapabilitiesType
600// Namespace: http://www.vmware.com/vcloud/v1.5
601// Description: Allows you to specify certain capabilities of this virtual machine.
602// Since: 5.1
603type VMCapabilities struct {
604	HREF                string  `xml:"href,attr,omitempty"`
605	Type                string  `xml:"type,attr,omitempty"`
606	CPUHotAddEnabled    bool    `xml:"CpuHotAddEnabled,omitempty"`
607	Link                []*Link `xml:"Link,omitempty"`
608	MemoryHotAddEnabled bool    `xml:"MemoryHotAddEnabled,omitempty"`
609}
610
611// Type: VmsType
612// Namespace: http://www.vmware.com/vcloud/v1.5
613// Description: Represents a list of virtual machines.
614// Since: 5.1
615type VMs struct {
616	HREF        string       `xml:"href,attr,omitempty"`
617	Type        string       `xml:"type,attr,omitempty"`
618	Link        []*Link      `xml:"Link,omitempty"`
619	VMReference []*Reference `xml:"VmReference,omitempty"`
620}
621
622/*
623 * Types that are completely valid (position, comment, coverage complete)
624 */
625
626// Type: ComposeVAppParamsType
627// Namespace: http://www.vmware.com/vcloud/v1.5
628// Description: Represents vApp composition parameters.
629// Since: 0.9
630type ComposeVAppParams struct {
631	XMLName xml.Name `xml:"ComposeVAppParams"`
632	Ovf     string   `xml:"xmlns:ovf,attr"`
633	Xsi     string   `xml:"xmlns:xsi,attr"`
634	Xmlns   string   `xml:"xmlns,attr"`
635	// Attributes
636	Name        string `xml:"name,attr,omitempty"`        // Typically used to name or identify the subject of the request. For example, the name of the object being created or modified.
637	Deploy      bool   `xml:"deploy,attr"`                // True if the vApp should be deployed at instantiation. Defaults to true.
638	PowerOn     bool   `xml:"powerOn,attr"`               // True if the vApp should be powered-on at instantiation. Defaults to true.
639	LinkedClone bool   `xml:"linkedClone,attr,omitempty"` // Reserved. Unimplemented.
640	// Elements
641	Description         string                       `xml:"Description,omitempty"`         // Optional description.
642	VAppParent          *Reference                   `xml:"VAppParent,omitempty"`          // Reserved. Unimplemented.
643	InstantiationParams *InstantiationParams         `xml:"InstantiationParams,omitempty"` // Instantiation parameters for the composed vApp.
644	SourcedItem         *SourcedCompositionItemParam `xml:"SourcedItem,omitempty"`         // Composition item. One of: vApp vAppTemplate Vm.
645	AllEULAsAccepted    bool                         `xml:"AllEULAsAccepted,omitempty"`    // True confirms acceptance of all EULAs in a vApp template. Instantiation fails if this element is missing, empty, or set to false and one or more EulaSection elements are present.
646}
647
648// Type: SourcedCompositionItemParamType
649// Namespace: http://www.vmware.com/vcloud/v1.5
650// Description: Represents a vApp, vApp template or Vm to include in a composed vApp.
651// Since: 0.9
652type SourcedCompositionItemParam struct {
653	// Attributes
654	SourceDelete bool `xml:"sourceDelete,attr,omitempty"` // True if the source item should be deleted after composition is complete.
655	// Elements
656	Source              *Reference           `xml:"Source"`                        // Reference to a vApp, vApp template or virtual machine to include in the composition. Changing the name of the newly created VM by specifying name attribute is deprecated. Include VmGeneralParams element instead.
657	VMGeneralParams     *VMGeneralParams     `xml:"VmGeneralParams,omitempty"`     // Specify name, description, and other properties of a VM during instantiation.
658	VAppScopedLocalID   string               `xml:"VAppScopedLocalId,omitempty"`   // If Source references a Vm, this value provides a unique identifier for the Vm in the scope of the composed vApp.
659	InstantiationParams *InstantiationParams `xml:"InstantiationParams,omitempty"` // If Source references a Vm this can include any of the following OVF sections: VirtualHardwareSection OperatingSystemSection NetworkConnectionSection GuestCustomizationSection.
660	NetworkAssignment   *NetworkAssignment   `xml:"NetworkAssignment,omitempty"`   // If Source references a Vm, this element maps a network name specified in the Vm to the network name of a vApp network defined in the composed vApp.
661	StorageProfile      *Reference           `xml:"StorageProfile,omitempty"`      // If Source references a Vm, this element contains a reference to a storage profile to be used for the Vm. The specified storage profile must exist in the organization vDC that contains the composed vApp. If not specified, the default storage profile for the vDC is used.
662	LocalityParams      *LocalityParams      `xml:"LocalityParams,omitempty"`      // Represents locality parameters. Locality parameters provide a hint that may help the placement engine optimize placement of a VM and an independent a Disk so that the VM can make efficient use of the disk.
663}
664
665// Type: LocalityParamsType
666// Namespace: http://www.vmware.com/vcloud/v1.5
667// Description: Represents locality parameters. Locality parameters provide a hint that may help the placement engine optimize placement of a VM with respect to another VM or an independent disk.
668// Since: 5.1
669type LocalityParams struct {
670	// Elements
671	ResourceEntity *Reference `xml:"ResourceEntity,omitempty"` // Reference to a Disk, or a VM.
672}
673
674// Type: NetworkAssignmentType
675// Namespace: http://www.vmware.com/vcloud/v1.5
676// Description: Maps a network name specified in a Vm to the network name of a vApp network defined in the VApp that contains the Vm
677// Since: 0.9
678type NetworkAssignment struct {
679	// Attributes
680	InnerNetwork     string `xml:"innerNetwork,attr"`     // Name of the network as specified in the Vm.
681	ContainerNetwork string `xml:"containerNetwork,attr"` // Name of the vApp network to map to.
682}
683
684// Type: VmGeneralParamsType
685// Namespace: http://www.vmware.com/vcloud/v1.5
686// Description: A set of overrides to source VM properties to apply to target VM during copying.
687// Since: 5.6
688type VMGeneralParams struct {
689	// Elements
690	Name               string `xml:"Name,omitempty"`               // Name of VM
691	Description        string `xml:"Description,omitempty"`        // VM description
692	NeedsCustomization bool   `xml:"NeedsCustomization,omitempty"` // True if this VM needs guest customization
693}
694
695// Type: VAppType
696// Namespace: http://www.vmware.com/vcloud/v1.5
697// Description: Represents a vApp.
698// Since: 0.9
699type VApp struct {
700	// Attributes
701	HREF                  string `xml:"href,attr,omitempty"`                  // The URI of the entity.
702	Type                  string `xml:"type,attr,omitempty"`                  // The MIME type of the entity.
703	ID                    string `xml:"id,attr,omitempty"`                    // The entity identifier, expressed in URN format. The value of this attribute uniquely identifies the entity, persists for the life of the entity, and is never reused.
704	OperationKey          string `xml:"operationKey,attr,omitempty"`          // Optional unique identifier to support idempotent semantics for create and delete operations.
705	Name                  string `xml:"name,attr"`                            // The name of the entity.
706	Status                int    `xml:"status,attr,omitempty"`                // Creation status of the resource entity.
707	Deployed              bool   `xml:"deployed,attr,omitempty"`              // True if the virtual machine is deployed.
708	OvfDescriptorUploaded bool   `xml:"ovfDescriptorUploaded,attr,omitempty"` // Read-only indicator that the OVF descriptor for this vApp has been uploaded.
709	// Elements
710	Link        []*Link          `xml:"Link,omitempty"`        // A reference to an entity or operation associated with this object.
711	Description string           `xml:"Description,omitempty"` // Optional description.
712	Tasks       *TasksInProgress `xml:"Tasks,omitempty"`       // A list of queued, running, or recently completed tasks associated with this entity.
713	Files       *FilesList       `xml:"Files,omitempty"`       // Represents a list of files to be transferred (uploaded or downloaded). Each File in the list is part of the ResourceEntity.
714	VAppParent  *Reference       `xml:"VAppParent,omitempty"`  // Reserved. Unimplemented.
715	// TODO: OVF Sections to be implemented
716	// Section OVF_Section `xml:"Section"`
717	DateCreated       string        `xml:"DateCreated,omitempty"`       // Creation date/time of the vApp.
718	Owner             *Owner        `xml:"Owner,omitempty"`             // vApp owner.
719	InMaintenanceMode bool          `xml:"InMaintenanceMode,omitempty"` // True if this vApp is in maintenance mode. Prevents users from changing vApp metadata.
720	Children          *VAppChildren `xml:"Children,omitempty"`          // Container for virtual machines included in this vApp.
721}
722
723// Type: VAppChildrenType
724// Namespace: http://www.vmware.com/vcloud/v1.5
725// Description: Container for virtual machines included in this vApp.
726// Since: 0.9
727type VAppChildren struct {
728	VM []*VM `xml:"Vm,omitempty"` // Rerpresents a virtual machine.
729}
730
731// Type: TasksInProgressType
732// Namespace: http://www.vmware.com/vcloud/v1.5
733// Description: A list of queued, running, or recently completed tasks.
734// Since: 0.9
735type TasksInProgress struct {
736	// Elements
737	Task []*Task `xml:"Task"` // A task.
738}
739
740// Type: VAppTemplateChildrenType
741// Namespace: http://www.vmware.com/vcloud/v1.5
742// Description: Container for virtual machines included in this vApp template.
743// Since: 0.9
744type VAppTemplateChildren struct {
745	// Elements
746	VM []*VAppTemplate `xml:"Vm"` // Represents a virtual machine in this vApp template.
747}
748
749// Type: VAppTemplateType
750// Namespace: http://www.vmware.com/vcloud/v1.5
751// Description: Represents a vApp template.
752// Since: 0.9
753type VAppTemplate struct {
754	// Attributes
755	HREF                  string `xml:"href,attr,omitempty"`                  // The URI of the entity.
756	Type                  string `xml:"type,attr,omitempty"`                  // The MIME type of the entity.
757	ID                    string `xml:"id,attr,omitempty"`                    // The entity identifier, expressed in URN format. The value of this attribute uniquely identifies the entity, persists for the life of the entity, and is never reused.
758	OperationKey          string `xml:"operationKey,attr,omitempty"`          // Optional unique identifier to support idempotent semantics for create and delete operations.
759	Name                  string `xml:"name,attr"`                            // The name of the entity.
760	Status                int    `xml:"status,attr,omitempty"`                // Creation status of the resource entity.
761	OvfDescriptorUploaded string `xml:"ovfDescriptorUploaded,attr,omitempty"` // True if the OVF descriptor for this template has been uploaded.
762	GoldMaster            bool   `xml:"goldMaster,attr,omitempty"`            // True if this template is a gold master.
763	// Elements
764	Link                  []*Link               `xml:"Link,omitempty"`                  // A reference to an entity or operation associated with this object.
765	Description           string                `xml:"Description,omitempty"`           // Optional description.
766	Tasks                 *TasksInProgress      `xml:"Tasks,omitempty"`                 // A list of queued, running, or recently completed tasks associated with this entity.
767	Files                 *FilesList            `xml:"Files,omitempty"`                 // Represents a list of files to be transferred (uploaded or downloaded). Each File in the list is part of the ResourceEntity.
768	Owner                 *Owner                `xml:"Owner,omitempty"`                 // vAppTemplate owner.
769	Children              *VAppTemplateChildren `xml:"Children,omitempty"`              // Container for virtual machines included in this vApp template.
770	VAppScopedLocalID     string                `xml:"VAppScopedLocalId"`               // A unique identifier for the Vm in the scope of the vApp template.
771	DefaultStorageProfile string                `xml:"DefaultStorageProfile,omitempty"` // The name of the storage profile to be used for this object. The named storage profile must exist in the organization vDC that contains the object. If not specified, the default storage profile for the vDC is used.
772	DateCreated           string                `xml:"DateCreated,omitempty"`           // Creation date/time of the template.
773	// FIXME: Upstream bug? Missing NetworkConfigSection, LeaseSettingSection and
774	// CustomizationSection at least, NetworkConnectionSection is required when
775	// using ComposeVApp action in the context of a Children VM (still
776	// referenced by VAppTemplateType).
777	NetworkConfigSection     *NetworkConfigSection     `xml:"NetworkConfigSection,omitempty"`
778	NetworkConnectionSection *NetworkConnectionSection `xml:"NetworkConnectionSection,omitempty"`
779	LeaseSettingsSection     *LeaseSettingsSection     `xml:"LeaseSettingsSection,omitempty"`
780	CustomizationSection     *CustomizationSection     `xml:"CustomizationSection,omitempty"`
781	// OVF Section needs to be added
782	// Section               Section              `xml:"Section,omitempty"`
783}
784
785// Type: VmType
786// Namespace: http://www.vmware.com/vcloud/v1.5
787// Description: Represents a virtual machine.
788// Since: 0.9
789type VM struct {
790	// Attributes
791	Ovf   string `xml:"xmlns:ovf,attr,omitempty"`
792	Xsi   string `xml:"xmlns:xsi,attr,omitempty"`
793	Xmlns string `xml:"xmlns,attr,omitempty"`
794
795	HREF                    string `xml:"href,attr,omitempty"`                    // The URI of the entity.
796	Type                    string `xml:"type,attr,omitempty"`                    // The MIME type of the entity.
797	ID                      string `xml:"id,attr,omitempty"`                      // The entity identifier, expressed in URN format. The value of this attribute uniquely identifies the entity, persists for the life of the entity, and is never reused
798	OperationKey            string `xml:"operationKey,attr,omitempty"`            // Optional unique identifier to support idempotent semantics for create and delete operations.
799	Name                    string `xml:"name,attr"`                              // The name of the entity.
800	Status                  int    `xml:"status,attr,omitempty"`                  // Creation status of the resource entity.
801	Deployed                bool   `xml:"deployed,attr,omitempty"`                // True if the virtual machine is deployed.
802	NeedsCustomization      bool   `xml:"needsCustomization,attr,omitempty"`      // True if this virtual machine needs customization.
803	NestedHypervisorEnabled bool   `xml:"nestedHypervisorEnabled,attr,omitempty"` // True if hardware-assisted CPU virtualization capabilities in the host should be exposed to the guest operating system.
804	// Elements
805	Link        []*Link          `xml:"Link,omitempty"`        // A reference to an entity or operation associated with this object.
806	Description string           `xml:"Description,omitempty"` // Optional description.
807	Tasks       *TasksInProgress `xml:"Tasks,omitempty"`       // A list of queued, running, or recently completed tasks associated with this entity.
808	Files       *FilesList       `xml:"FilesList,omitempty"`   // Represents a list of files to be transferred (uploaded or downloaded). Each File in the list is part of the ResourceEntity.
809	VAppParent  *Reference       `xml:"VAppParent,omitempty"`  // Reserved. Unimplemented.
810	// TODO: OVF Sections to be implemented
811	// Section OVF_Section `xml:"Section,omitempty"
812	DateCreated string `xml:"DateCreated"` // Creation date/time of the vApp.
813
814	// FIXME: Upstream bug? Missing NetworkConnectionSection
815	NetworkConnectionSection *NetworkConnectionSection `xml:"NetworkConnectionSection,omitempty"`
816
817	VAppScopedLocalID string `xml:"VAppScopedLocalId,omitempty"` // A unique identifier for the virtual machine in the scope of the vApp.
818
819	// TODO: OVF Sections to be implemented
820	// Environment OVF_Environment `xml:"Environment,omitempty"
821
822	VMCapabilities *VMCapabilities `xml:"VmCapabilities,omitempty"` // Allows you to specify certain capabilities of this virtual machine.
823	StorageProfile *Reference      `xml:"StorageProfile,omitempty"` // A reference to a storage profile to be used for this object. The specified storage profile must exist in the organization vDC that contains the object. If not specified, the default storage profile for the vDC is used.
824}
825
826// Horrible kludge to process OVF, needs to be fixed with proper types.
827type OVFItem struct {
828	XMLName         xml.Name `xml:"vcloud:Item"`
829	XmlnsRasd       string   `xml:"xmlns:rasd,attr"`
830	XmlnsVCloud     string   `xml:"xmlns:vcloud,attr"`
831	XmlnsXsi        string   `xml:"xmlns:xsi,attr"`
832	VCloudHREF      string   `xml:"vcloud:href,attr"`
833	VCloudType      string   `xml:"vcloud:type,attr"`
834	AllocationUnits string   `xml:"rasd:AllocationUnits"`
835	Description     string   `xml:"rasd:Description"`
836	ElementName     string   `xml:"rasd:ElementName"`
837	InstanceID      int      `xml:"rasd:InstanceID"`
838	Reservation     int      `xml:"rasd:Reservation"`
839	ResourceType    int      `xml:"rasd:ResourceType"`
840	VirtualQuantity int      `xml:"rasd:VirtualQuantity"`
841	Weight          int      `xml:"rasd:Weight"`
842	Link            *Link    `xml:"vcloud:Link"`
843}
844
845// Type: DeployVAppParamsType
846// Namespace: http://www.vmware.com/vcloud/v1.5
847// Description: Parameters to a deploy vApp request.
848// Since: 0.9
849type DeployVAppParams struct {
850	XMLName xml.Name `xml:"DeployVAppParams"`
851	Xmlns   string   `xml:"xmlns,attr"`
852	// Attributes
853	PowerOn                bool `xml:"powerOn,attr"`                          // Used to specify whether to power on vapp on deployment, if not set default value is true.
854	DeploymentLeaseSeconds int  `xml:"deploymentLeaseSeconds,attr,omitempty"` // Lease in seconds for deployment. A value of 0 is replaced by the organization default deploymentLeaseSeconds value.
855	ForceCustomization     bool `xml:"forceCustomization,attr,omitempty"`     // Used to specify whether to force customization on deployment, if not set default value is false
856}
857
858// Type: GuestCustomizationSectionType
859// Namespace: http://www.vmware.com/vcloud/v1.5
860// Description: Represents a guest customization settings.
861// Since: 1.0
862type GuestCustomizationSection struct {
863	// Extends OVF Section_Type
864	// Attributes
865	Ovf   string `xml:"xmlns:ovf,attr,omitempty"`
866	Xsi   string `xml:"xmlns:xsi,attr,omitempty"`
867	Xmlns string `xml:"xmlns,attr,omitempty"`
868
869	HREF string `xml:"href,attr,omitempty"` // A reference to the section in URL format.
870	Type string `xml:"type,attr,omitempty"` // The MIME type of the section.
871	// FIXME: Fix the OVF section
872	Info string `xml:"ovf:Info"`
873	// Elements
874	Enabled               bool    `xml:"Enabled,omitempty"`               // True if guest customization is enabled.
875	ChangeSid             bool    `xml:"ChangeSid,omitempty"`             // True if customization can change the Windows SID of this virtual machine.
876	VirtualMachineID      string  `xml:"VirtualMachineId,omitempty"`      // Virtual machine ID to apply.
877	JoinDomainEnabled     bool    `xml:"JoinDomainEnabled,omitempty"`     // True if this virtual machine can join a Windows Domain.
878	UseOrgSettings        bool    `xml:"UseOrgSettings,omitempty"`        // True if customization should use organization settings (OrgGuestPersonalizationSettings) when joining a Windows Domain.
879	DomainName            string  `xml:"DomainName,omitempty"`            // The name of the Windows Domain to join.
880	DomainUserName        string  `xml:"DomainUserName,omitempty"`        // User name to specify when joining a Windows Domain.
881	DomainUserPassword    string  `xml:"DomainUserPassword,omitempty"`    // Password to use with DomainUserName.
882	MachineObjectOU       string  `xml:"MachineObjectOU,omitempty"`       // The name of the Windows Domain Organizational Unit (OU) in which the computer account for this virtual machine will be created.
883	AdminPasswordEnabled  bool    `xml:"AdminPasswordEnabled,omitempty"`  // True if guest customization can modify administrator password settings for this virtual machine.
884	AdminPasswordAuto     bool    `xml:"AdminPasswordAuto,omitempty"`     // True if the administrator password for this virtual machine should be automatically generated.
885	AdminPassword         string  `xml:"AdminPassword,omitempty"`         // True if the administrator password for this virtual machine should be set to this string. (AdminPasswordAuto must be false.)
886	AdminAutoLogonEnabled bool    `xml:"AdminAutoLogonEnabled,omitempty"` // True if guest administrator should automatically log into this virtual machine.
887	AdminAutoLogonCount   int     `xml:"AdminAutoLogonCount,omitempty"`   // Number of times administrator can automatically log into this virtual machine. In case AdminAutoLogon is set to True, this value should be between 1 and 100. Otherwise, it should be 0.
888	ResetPasswordRequired bool    `xml:"ResetPasswordRequired,omitempty"` // True if the administrator password for this virtual machine must be reset after first use.
889	CustomizationScript   string  `xml:"CustomizationScript,omitempty"`   // Script to run on guest customization. The entire script must appear in this element. Use the XML entity 
 to represent a newline. Unicode characters can be represented in the form &#xxxx; where xxxx is the character number.
890	ComputerName          string  `xml:"ComputerName,omitempty"`          // Computer name to assign to this virtual machine.
891	Link                  []*Link `xml:"Link,omitempty"`                  // A link to an operation on this section.
892}
893
894// Type: InstantiateVAppTemplateParamsType
895// Namespace: http://www.vmware.com/vcloud/v1.5
896// Description: Represents vApp template instantiation parameters.
897// Since: 0.9
898type InstantiateVAppTemplateParams struct {
899	XMLName xml.Name `xml:"InstantiateVAppTemplateParams"`
900	Ovf     string   `xml:"xmlns:ovf,attr"`
901	Xsi     string   `xml:"xmlns:xsi,attr"`
902	Xmlns   string   `xml:"xmlns,attr"`
903	// Attributes
904	Name        string `xml:"name,attr,omitempty"`        // Typically used to name or identify the subject of the request. For example, the name of the object being created or modified.
905	Deploy      bool   `xml:"deploy,attr"`                // True if the vApp should be deployed at instantiation. Defaults to true.
906	PowerOn     bool   `xml:"powerOn,attr"`               // True if the vApp should be powered-on at instantiation. Defaults to true.
907	LinkedClone bool   `xml:"linkedClone,attr,omitempty"` // Reserved. Unimplemented.
908	// Elements
909	Description         string                       `xml:"Description,omitempty"`         // Optional description.
910	VAppParent          *Reference                   `xml:"VAppParent,omitempty"`          // Reserved. Unimplemented.
911	InstantiationParams *InstantiationParams         `xml:"InstantiationParams,omitempty"` // Instantiation parameters for the composed vApp.
912	Source              *Reference                   `xml:"Source"`                        // A reference to a source object such as a vApp or vApp template.
913	IsSourceDelete      bool                         `xml:"IsSourceDelete,omitempty"`      // Set to true to delete the source object after the operation completes.
914	SourcedItem         *SourcedCompositionItemParam `xml:"SourcedItem,omitempty"`         // Composition item. One of: vApp vAppTemplate Vm.
915	AllEULAsAccepted    bool                         `xml:"AllEULAsAccepted,omitempty"`    // True confirms acceptance of all EULAs in a vApp template. Instantiation fails if this element is missing, empty, or set to false and one or more EulaSection elements are present.
916}
917
918// Element: EdgeGateway
919// Type: GatewayType
920// Namespace: http://www.vmware.com/vcloud/v1.5
921// Description: Represents a gateway.
922// Since: 5.1
923type EdgeGateway struct {
924	// Attributes
925	HREF         string `xml:"href,attr,omitempty"`         // The URI of the entity.
926	Type         string `xml:"type,attr,omitempty"`         // The MIME type of the entity.
927	ID           string `xml:"id,attr,omitempty"`           // The entity identifier, expressed in URN format. The value of this attribute uniquely identifies the entity, persists for the life of the entity, and is never reused
928	OperationKey string `xml:"operationKey,attr,omitempty"` // Optional unique identifier to support idempotent semantics for create and delete operations.
929	Name         string `xml:"name,attr"`                   // The name of the entity.
930	Status       int    `xml:"status,attr,omitempty"`       // Creation status of the gateway. One of: 0 (The gateway is still being created) 1 (The gateway is ready) -1 (There was an error while creating the gateway).
931	// Elements
932	Link          []*Link               `xml:"Link,omitempty"`        // A link to an operation on this section.
933	Description   string                `xml:"Description,omitempty"` // Optional description.
934	Tasks         *TasksInProgress      `xml:"Tasks,omitempty"`       //	A list of queued, running, or recently completed tasks associated with this entity.
935	Configuration *GatewayConfiguration `xml:"Configuration"`         // Gateway configuration.
936}
937
938// Type: GatewayConfigurationType
939// Namespace: http://www.vmware.com/vcloud/v1.5
940// Description: Gateway Configuration.
941// Since: 5.1
942type GatewayConfiguration struct {
943	Xmlns string `xml:"xmlns,attr,omitempty"`
944	// Elements
945	BackwardCompatibilityMode       bool               `xml:"BackwardCompatibilityMode,omitempty"`       // Compatibilty mode. Default is false. If set to true, will allow users to write firewall rules in the old 1.5 format. The new format does not require to use direction in firewall rules. Also, for firewall rules to allow NAT traffic the filter is applied on the original IP addresses. Once set to true cannot be reverted back to false.
946	GatewayBackingConfig            string             `xml:"GatewayBackingConfig"`                      // Configuration of the vShield edge VM for this gateway. One of: compact, full.
947	GatewayInterfaces               *GatewayInterfaces `xml:"GatewayInterfaces"`                         // List of Gateway interfaces.
948	EdgeGatewayServiceConfiguration *GatewayFeatures   `xml:"EdgeGatewayServiceConfiguration,omitempty"` // Represents Gateway Features.
949	HaEnabled                       bool               `xml:"HaEnabled,omitempty"`                       // True if this gateway is highly available. (Requires two vShield edge VMs.)
950	UseDefaultRouteForDNSRelay      bool               `xml:"UseDefaultRouteForDnsRelay,omitempty"`      // True if the default gateway on the external network selected for default route should be used as the DNS relay.
951}
952
953// Type: GatewayInterfacesType
954// Namespace: http://www.vmware.com/vcloud/v1.5
955// Description: A list of Gateway Interfaces.
956// Since: 5.1
957type GatewayInterfaces struct {
958	GatewayInterface []*GatewayInterface `xml:"GatewayInterface"` // Gateway Interface.
959}
960
961// Type: GatewayInterfaceType
962// Namespace: http://www.vmware.com/vcloud/v1.5
963// Description: Gateway Interface configuration.
964// Since: 5.1
965type GatewayInterface struct {
966	Name                string               `xml:"Name,omitempty"`                // Internally generated name for the Gateway Interface.
967	DisplayName         string               `xml:"DisplayName,omitempty"`         // Gateway Interface display name.
968	Network             *Reference           `xml:"Network"`                       // A reference to the network connected to the gateway interface.
969	InterfaceType       string               `xml:"InterfaceType"`                 // The type of interface: One of: Uplink, Internal
970	SubnetParticipation *SubnetParticipation `xml:"SubnetParticipation,omitempty"` // IP allocation per subnet.
971	ApplyRateLimit      bool                 `xml:"ApplyRateLimit,omitempty"`      // True if rate limiting is applied on this interface.
972	InRateLimit         float64              `xml:"InRateLimit,omitempty"`         // Incoming rate limit expressed as Gbps.
973	OutRateLimit        float64              `xml:"OutRateLimit,omitempty"`        // Outgoing rate limit expressed as Gbps.
974	UseForDefaultRoute  bool                 `xml:"UseForDefaultRoute,omitempty"`  // True if this network is default route for the gateway.
975}
976
977// Type: SubnetParticipationType
978// Namespace: http://www.vmware.com/vcloud/v1.5
979// Description: Allows to chose which subnets a gateway can be part of
980// Since: 5.1
981type SubnetParticipation struct {
982	Gateway   string    `xml:"Gateway"`             // Gateway for subnet
983	IPAddress string    `xml:"IpAddress,omitempty"` // Ip Address to be assigned. Keep empty or ommit element for auto assignment
984	IPRanges  *IPRanges `xml:"IpRanges,omitempty"`  // Range of IP addresses available for external interfaces.
985	Netmask   string    `xml:"Netmask"`             // Nestmask for the subnet
986}
987
988// Element: EdgeGatewayServiceConfiguration
989// Type: GatewayFeaturesType
990// Namespace: http://www.vmware.com/vcloud/v1.5
991// Description: Represents edge gateway services.
992// Since: 5.1
993type GatewayFeatures struct {
994	XMLName                xml.Name
995	Xmlns                  string                  `xml:"xmlns,attr,omitempty"`
996	FirewallService        *FirewallService        `xml:"FirewallService,omitempty"`        // Substitute for NetworkService. Firewall service settings
997	NatService             *NatService             `xml:"NatService,omitempty"`             // Substitute for NetworkService. NAT service settings
998	GatewayDhcpService     *GatewayDhcpService     `xml:"GatewayDhcpService,omitempty"`     // Substitute for NetworkService. Gateway DHCP service settings
999	GatewayIpsecVpnService *GatewayIpsecVpnService `xml:"GatewayIpsecVpnService,omitempty"` // Substitute for NetworkService. Gateway Ipsec VPN service settings
1000	LoadBalancerService    *LoadBalancerService    `xml:"LoadBalancerService,omitempty"`    // Substitute for NetworkService. Load Balancer service settings
1001	StaticRoutingService   *StaticRoutingService   `xml:"StaticRoutingService,omitempty"`   // Substitute for NetworkService. Static Routing service settings
1002}
1003
1004// Type: StaticRoutingServiceType
1005// Namespace: http://www.vmware.com/vcloud/v1.5
1006// Description: Represents Static Routing network service.
1007// Since: 1.5
1008type StaticRoutingService struct {
1009	IsEnabled   bool         `xml:"IsEnabled"`             // Enable or disable the service using this flag
1010	StaticRoute *StaticRoute `xml:"StaticRoute,omitempty"` // Details of each Static Route.
1011}
1012
1013// Type: StaticRouteType
1014// Namespace: http://www.vmware.com/vcloud/v1.5
1015// Description:
1016// Since:
1017type StaticRoute struct {
1018	Name             string     `xml:"Name"`                       // Name for the static route.
1019	Network          string     `xml:"Network"`                    // Network specification in CIDR.
1020	NextHopIp        string     `xml:"NextHopIp"`                  // IP Address of Next Hop router/gateway.
1021	Interface        string     `xml:"Interface,omitempty"`        // Interface to use for static routing. Internal and External are the supported values.
1022	GatewayInterface *Reference `xml:"GatewayInterface,omitempty"` // Gateway interface to which static route is bound.
1023}
1024
1025// Type: LoadBalancerServiceType
1026// Namespace: http://www.vmware.com/vcloud/v1.5
1027// Description: Represents gateway load balancer service.
1028// Since: 5.1
1029type LoadBalancerService struct {
1030	IsEnabled     bool                       `xml:"IsEnabled"`               // Enable or disable the service using this flag
1031	Pool          *LoadBalancerPool          `xml:"Pool,omitempty"`          // List of load balancer pools.
1032	VirtualServer *LoadBalancerVirtualServer `xml:"VirtualServer,omitempty"` // List of load balancer virtual servers.
1033}
1034
1035// Type: LoadBalancerPoolType
1036// Namespace: http://www.vmware.com/vcloud/v1.5
1037// Description: Represents a load balancer pool.
1038// Since: 5.1
1039type LoadBalancerPool struct {
1040	ID           string             `xml:"Id,omitempty"`           // Load balancer pool id.
1041	Name         string             `xml:"Name"`                   // Load balancer pool name.
1042	Description  string             `xml:"Description,omitempty"`  // Load balancer pool description.
1043	ServicePort  *LBPoolServicePort `xml:"ServicePort"`            // Load balancer pool service port.
1044	Member       *LBPoolMember      `xml:"Member"`                 // Load balancer pool member.
1045	Operational  bool               `xml:"Operational,omitempty"`  // True if the load balancer pool is operational.
1046	ErrorDetails string             `xml:"ErrorDetails,omitempty"` // Error details for this pool.
1047}
1048
1049// Type: LBPoolServicePortType
1050// Namespace: http://www.vmware.com/vcloud/v1.5
1051// Description: Represents a service port in a load balancer pool.
1052// Since: 5.1
1053type LBPoolServicePort struct {
1054	IsEnabled       bool               `xml:"IsEnabled,omitempty"`       // True if this service port is enabled.
1055	Protocol        string             `xml:"Protocol"`                  // Load balancer protocol type. One of: HTTP, HTTPS, TCP.
1056	Algorithm       string             `xml:"Algorithm"`                 // Load Balancer algorithm type. One of: IP_HASH, ROUND_ROBIN, URI, LEAST_CONN.
1057	Port            string             `xml:"Port"`                      // Port for this service profile.
1058	HealthCheckPort string             `xml:"HealthCheckPort,omitempty"` // Health check port for this profile.
1059	HealthCheck     *LBPoolHealthCheck `xml:"HealthCheck,omitempty"`     // Health check list.
1060}
1061
1062// Type: LBPoolHealthCheckType
1063// Namespace: http://www.vmware.com/vcloud/v1.5
1064// Description: Represents a service port health check list.
1065// Since: 5.1
1066type LBPoolHealthCheck struct {
1067	Mode              string `xml:"Mode"`                        // Load balancer service port health check mode. One of: TCP, HTTP, SSL.
1068	Uri               string `xml:"Uri,omitempty"`               // Load balancer service port health check URI.
1069	HealthThreshold   string `xml:"HealthThreshold,omitempty"`   // Health threshold for this service port.
1070	UnhealthThreshold string `xml:"UnhealthThreshold,omitempty"` // Unhealth check port for this profile.
1071	Interval          string `xml:"Interval,omitempty"`          // Interval between health checks.
1072	Timeout           string `xml:"Timeout,omitempty"`           // Health check timeout.
1073}
1074
1075// Type: LBPoolMemberType
1076// Namespace: http://www.vmware.com/vcloud/v1.5
1077// Description: Represents a member in a load balancer pool.
1078// Since: 5.1
1079type LBPoolMember struct {
1080	IPAddress   string             `xml:"IpAddress"`             // Ip Address for load balancer member.
1081	Weight      string             `xml:"Weight"`                // Weight of this member.
1082	ServicePort *LBPoolServicePort `xml:"ServicePort,omitempty"` // Load balancer member service port.
1083}
1084
1085// Type: LoadBalancerVirtualServerType
1086// Namespace: http://www.vmware.com/vcloud/v1.5
1087// Description: Represents a load balancer virtual server.
1088// Since: 5.1
1089type LoadBalancerVirtualServer struct {
1090	IsEnabled             bool                           `xml:"IsEnabled,omitempty"`             // True if this virtual server is enabled.
1091	Name                  string                         `xml:"Name"`                            // Load balancer virtual server name.
1092	Description           string                         `xml:"Description,omitempty"`           // Load balancer virtual server description.
1093	Interface             *Reference                     `xml:"Interface"`                       // Gateway Interface to which Load Balancer Virtual Server is bound.
1094	IPAddress             string                         `xml:"IpAddress"`                       // Load balancer virtual server Ip Address.
1095	ServiceProfile        *LBVirtualServerServiceProfile `xml:"ServiceProfile"`                  // Load balancer virtual server service profiles.
1096	Logging               bool                           `xml:"Logging,omitempty"`               // Enable logging for this virtual server.
1097	Pool                  string                         `xml:"Pool"`                            // Name of Load balancer pool associated with this virtual server.
1098	LoadBalancerTemplates *VendorTemplate                `xml:"LoadBalancerTemplates,omitempty"` // Service template related attributes.
1099}
1100
1101// Type: LBVirtualServerServiceProfileType
1102// Namespace: http://www.vmware.com/vcloud/v1.5
1103// Description: Represents service profile for a load balancing virtual server.
1104// Since: 5.1
1105type LBVirtualServerServiceProfile struct {
1106	IsEnabled   bool           `xml:"IsEnabled,omitempty"`   // True if this service profile is enabled.
1107	Protocol    string         `xml:"Protocol"`              // Load balancer Protocol type. One of: HTTP, HTTPS, TCP.
1108	Port        string         `xml:"Port"`                  // Port for this service profile.
1109	Persistence *LBPersistence `xml:"Persistence,omitempty"` // Persistence type for service profile.
1110}
1111
1112// Type: LBPersistenceType
1113// Namespace: http://www.vmware.com/vcloud/v1.5
1114// Description: Represents persistence type for a load balancer service profile.
1115// Since: 5.1
1116type LBPersistence struct {
1117	Method     string `xml:"Method"`               // Persistence method. One of: COOKIE, SSL_SESSION_ID.
1118	CookieName string `xml:"CookieName,omitempty"` // Cookie name when persistence method is COOKIE.
1119	CookieMode string `xml:"CookieMode,omitempty"` // Cookie Mode. One of: INSERT, PREFIX, APP.
1120}
1121
1122// Type: VendorTemplateType
1123// Namespace: http://www.vmware.com/vcloud/v1.5
1124// Description: Information about a vendor service template. This is optional.
1125// Since: 5.1
1126type VendorTemplate struct {
1127	Name string `xml:"Name"` // Name of the vendor template. This is required.
1128	ID   string `xml:"Id"`   // ID of the vendor template. This is required.
1129}
1130
1131// Type: GatewayIpsecVpnServiceType
1132// Namespace: http://www.vmware.com/vcloud/v1.5
1133// Description: Represents gateway IPsec VPN service.
1134// Since: 5.1
1135type GatewayIpsecVpnService struct {
1136	IsEnabled bool                     `xml:"IsEnabled"`          // Enable or disable the service using this flag
1137	Endpoint  *GatewayIpsecVpnEndpoint `xml:"Endpoint,omitempty"` // List of IPSec VPN Service Endpoints.
1138	Tunnel    []*GatewayIpsecVpnTunnel `xml:"Tunnel"`             // List of IPSec VPN tunnels.
1139}
1140
1141// Type: GatewayIpsecVpnEndpointType
1142// Namespace: http://www.vmware.com/vcloud/v1.5
1143// Description: Represents an IPSec VPN endpoint.
1144// Since: 5.1
1145type GatewayIpsecVpnEndpoint struct {
1146	Network  *Reference `xml:"Network"`            // External network reference.
1147	PublicIP string     `xml:"PublicIp,omitempty"` // Public IP for IPSec endpoint.
1148}
1149
1150// Type: GatewayIpsecVpnTunnelType
1151// Namespace: http://www.vmware.com/vcloud/v1.5
1152// Description: Represents an IPSec VPN tunnel.
1153// Since: 5.1
1154type GatewayIpsecVpnTunnel struct {
1155	Name        string `xml:"Name"`                  // The name of the tunnel.
1156	Description string `xml:"Description,omitempty"` // A description of the tunnel.
1157	// TODO: Fix this in a better way
1158	IpsecVpnThirdPartyPeer *IpsecVpnThirdPartyPeer `xml:"IpsecVpnThirdPartyPeer,omitempty"` // Details about the peer network.
1159	PeerIPAddress          string                  `xml:"PeerIpAddress"`                    // IP address of the peer endpoint.
1160	PeerID                 string                  `xml:"PeerId"`                           // Id for the peer end point
1161	LocalIPAddress         string                  `xml:"LocalIpAddress"`                   // Address of the local network.
1162	LocalID                string                  `xml:"LocalId"`                          // Id for local end point
1163	LocalSubnet            *IpsecVpnSubnet         `xml:"LocalSubnet"`                      // List of local subnets in the tunnel.
1164	PeerSubnet             *IpsecVpnSubnet         `xml:"PeerSubnet"`                       // List of peer subnets in the tunnel.
1165	SharedSecret           string                  `xml:"SharedSecret"`                     // Shared secret used for authentication.
1166	SharedSecretEncrypted  bool                    `xml:"SharedSecretEncrypted,omitempty"`  // True if shared secret is encrypted.
1167	EncryptionProtocol     string                  `xml:"EncryptionProtocol"`               // Encryption protocol to be used. One of: AES, AES256, TRIPLEDES
1168	Mtu                    int                     `xml:"Mtu"`                              // MTU for the tunnel.
1169	IsEnabled              bool                    `xml:"IsEnabled,omitempty"`              // True if the tunnel is enabled.
1170	IsOperational          bool                    `xml:"IsOperational,omitempty"`          // True if the tunnel is operational.
1171	ErrorDetails           string                  `xml:"ErrorDetails,omitempty"`           // Error details of the tunnel.
1172}
1173
1174type IpsecVpnThirdPartyPeer struct {
1175	PeerID string `xml:"PeerId,omitempty"` // Id for the peer end point
1176}
1177
1178// Type: IpsecVpnSubnetType
1179// Namespace: http://www.vmware.com/vcloud/v1.5
1180// Description: Represents subnet details.
1181// Since: 5.1
1182type IpsecVpnSubnet struct {
1183	Name    string `xml:"Name"`    // Gateway Name.
1184	Gateway string `xml:"Gateway"` // Subnet Gateway.
1185	Netmask string `xml:"Netmask"` // Subnet Netmask.
1186}
1187
1188// Type: GatewayDhcpServiceType
1189// Namespace: http://www.vmware.com/vcloud/v1.5
1190// Description: Represents Gateway DHCP service.
1191// Since: 5.1
1192type GatewayDhcpService struct {
1193	IsEnabled bool             `xml:"IsEnabled,omitempty"` // Enable or disable the service using this flag
1194	Pool      *DhcpPoolService `xml:"Pool,omitempty"`      // A DHCP pool.
1195}
1196
1197// Type: DhcpPoolServiceType
1198// Namespace: http://www.vmware.com/vcloud/v1.5
1199// Description: Represents DHCP pool service.
1200// Since: 5.1
1201type DhcpPoolService struct {
1202	IsEnabled        bool       `xml:"IsEnabled,omitempty"`        // True if this DHCP Pool is enabled.
1203	Network          *Reference `xml:"Network"`                    // Org vDC network to which the DHCP range is applicable.
1204	DefaultLeaseTime int        `xml:"DefaultLeaseTime,omitempty"` // Default lease period for DHCP range.
1205	MaxLeaseTime     int        `xml:"MaxLeaseTime"`               // Maximum lease period for DHCP range.
1206	LowIPAddress     string     `xml:"LowIpAddress"`               // Low IP address in DHCP range.
1207	HighIPAddress    string     `xml:"HighIpAddress"`              // High IP address in DHCP range.
1208}
1209
1210// Type: VmSelectionType
1211// Namespace: http://www.vmware.com/vcloud/v1.5
1212// Description: Represents details of an vm+nic+iptype selection.
1213// Since: 5.1
1214type VMSelection struct {
1215	VAppScopedVMID string `xml:"VAppScopedVmId"` // VAppScopedVmId of VM to which this rule applies.
1216	VMNicID        int    `xml:"VmNicId"`        // VM NIC ID to which this rule applies.
1217	IPType         string `xml:"IpType"`         // The value can be one of:- assigned: assigned internal IP be automatically choosen. NAT: NATed external IP will be automatically choosen.
1218}
1219
1220// Type: FirewallRuleType/Protocols
1221// Namespace: http://www.vmware.com/vcloud/v1.5
1222// Description:
1223// Since:
1224type FirewallRuleProtocols struct {
1225	Icmp bool `xml:"Icmp,omitempty"` // True if the rule applies to the ICMP protocol.
1226	Any  bool `xml:"Any,omitempty"`  // True if the rule applies to any protocol.
1227	Tcp  bool `xml:"Tcp,omitempty"`  // True if the rule applies to the TCP protocol.
1228	Udp  bool `xml:"Udp,omitempty"`  // True if the rule applies to the UDP protocol.
1229	// FIXME: this is supposed to extend protocol support to all the VSM supported protocols
1230	// Other string `xml:"Other,omitempty"` //	Any other protocol supported by vShield Manager
1231}
1232
1233// Type: FirewallRuleType
1234// Namespace: http://www.vmware.com/vcloud/v1.5
1235// Description: Represents a firewall rule.
1236// Since: 0.9
1237type FirewallRule struct {
1238	ID                   string                 `xml:"Id,omitempty"`                   // Firewall rule identifier.
1239	IsEnabled            bool                   `xml:"IsEnabled"`                      // Used to enable or disable the firewall rule. Default value is true.
1240	MatchOnTranslate     bool                   `xml:"MatchOnTranslate"`               // For DNATed traffic, match the firewall rules only after the destination IP is translated.
1241	Description          string                 `xml:"Description,omitempty"`          // A description of the rule.
1242	Policy               string                 `xml:"Policy,omitempty"`               // One of: drop (drop packets that match the rule), allow (allow packets that match the rule to pass through the firewall)
1243	Protocols            *FirewallRuleProtocols `xml:"Protocols,omitempty"`            // Specify the protocols to which the rule should be applied.
1244	IcmpSubType          string                 `xml:"IcmpSubType,omitempty"`          // ICMP subtype. One of: address-mask-request, address-mask-reply, destination-unreachable, echo-request, echo-reply, parameter-problem, redirect, router-advertisement, router-solicitation, source-quench, time-exceeded, timestamp-request, timestamp-reply, any.
1245	Port                 int                    `xml:"Port,omitempty"`                 // The port to which this rule applies. A value of -1 matches any port.
1246	DestinationPortRange string                 `xml:"DestinationPortRange,omitempty"` // Destination port range to which this rule applies.
1247	DestinationIP        string                 `xml:"DestinationIp,omitempty"`        // Destination IP address to which the rule applies. A value of Any matches any IP address.
1248	DestinationVM        *VMSelection           `xml:"DestinationVm,omitempty"`        // Details of the destination VM
1249	SourcePort           int                    `xml:"SourcePort,omitempty"`           // Destination port to which this rule applies. A value of -1 matches any port.
1250	SourcePortRange      string                 `xml:"SourcePortRange,omitempty"`      // Source port range to which this rule applies.
1251	SourceIP             string                 `xml:"SourceIp,omitempty"`             // Source IP address to which the rule applies. A value of Any matches any IP address.
1252	SourceVM             *VMSelection           `xml:"SourceVm,omitempty"`             // Details of the source Vm
1253	Direction            string                 `xml:"Direction,omitempty"`            // Direction of traffic to which rule applies. One of: in (rule applies to incoming traffic. This is the default value), out (rule applies to outgoing traffic).
1254	EnableLogging        bool                   `xml:"EnableLogging"`                  // Used to enable or disable firewall rule logging. Default value is false.
1255}
1256
1257// Type: FirewallServiceType
1258// Namespace: http://www.vmware.com/vcloud/v1.5
1259// Description: Represents a network firewall service.
1260// Since:
1261type FirewallService struct {
1262	IsEnabled        bool            `xml:"IsEnabled"`               // Enable or disable the service using this flag
1263	DefaultAction    string          `xml:"DefaultAction,omitempty"` // Default action of the firewall. One of: drop (Default. Drop packets that match the rule.), allow (Allow packets that match the rule to pass through the firewall)
1264	LogDefaultAction bool            `xml:"LogDefaultAction"`        // Flag to enable logging for default action. Default value is false.
1265	FirewallRule     []*FirewallRule `xml:"FirewallRule,omitempty"`  //	A firewall rule.
1266}
1267
1268// Type: NatServiceType
1269// Namespace: http://www.vmware.com/vcloud/v1.5
1270// Description: Represents a NAT network service.
1271// Since:
1272type NatService struct {
1273	Xmlns string `xml:"xmlns,attr,omitempty"`
1274	// Elements
1275	IsEnabled  bool       `xml:"IsEnabled"`            // Enable or disable the service using this flag
1276	NatType    string     `xml:"NatType,omitempty"`    // One of: ipTranslation (use IP translation), portForwarding (use port forwarding)
1277	Policy     string     `xml:"Policy,omitempty"`     // One of: allowTraffic (Allow all traffic), allowTrafficIn (Allow inbound traffic only)
1278	NatRule    []*NatRule `xml:"NatRule,omitempty"`    // A NAT rule.
1279	ExternalIP string     `xml:"ExternalIp,omitempty"` // External IP address for rule.
1280}
1281
1282// Type: NatRuleType
1283// Namespace: http://www.vmware.com/vcloud/v1.5
1284// Description: Represents a NAT rule.
1285// Since: 0.9
1286type NatRule struct {
1287	Xmlns string `xml:"xmlns,attr,omitempty"`
1288	// Elements
1289	Description        string                 `xml:"Description,omitempty"`        // A description of the rule.
1290	RuleType           string                 `xml:"RuleType,omitempty"`           // Type of NAT rule. One of: SNAT (source NAT), DNAT (destination NAT)
1291	IsEnabled          bool                   `xml:"IsEnabled"`                    // Used to enable or disable the firewall rule. Default value is true.
1292	ID                 string                 `xml:"Id,omitempty"`                 // Firewall rule identifier.
1293	GatewayNatRule     *GatewayNatRule        `xml:"GatewayNatRule,omitempty"`     // Defines SNAT and DNAT types.
1294	OneToOneBasicRule  *NatOneToOneBasicRule  `xml:"OneToOneBasicRule,omitempty"`  // Maps one internal IP address to one external IP address.
1295	OneToOneVMRule     *NatOneToOneVMRule     `xml:"OneToOneVmRule,omitempty"`     // Maps one VM NIC to one external IP addresses.
1296	PortForwardingRule *NatPortForwardingRule `xml:"PortForwardingRule,omitempty"` // Port forwarding internal to external IP addresses.
1297	VMRule             *NatVMRule             `xml:"VmRule,omitempty"`             // Port forwarding VM NIC to external IP addresses.
1298}
1299
1300// Type: GatewayNatRuleType
1301// Namespace: http://www.vmware.com/vcloud/v1.5
1302// Description: Represents the SNAT and DNAT rules.
1303// Since: 5.1
1304type GatewayNatRule struct {
1305	Xmlns string `xml:"xmlns,attr,omitempty"`
1306	// Elements
1307	Interface      *Reference `xml:"Interface,omitempty"`      // Interface to which rule is applied.
1308	OriginalIP     string     `xml:"OriginalIp"`               // Original IP for rule.
1309	OriginalPort   string     `xml:"OriginalPort,omitempty"`   // Original port for rule.
1310	TranslatedIP   string     `xml:"TranslatedIp"`             // Translated IP for rule.
1311	TranslatedPort string     `xml:"TranslatedPort,omitempty"` // Translated port for rule.
1312	Protocol       string     `xml:"Protocol,omitempty"`       // Protocol for rule.
1313	IcmpSubType    string     `xml:"IcmpSubType,omitempty"`    // ICMP subtype. One of: address-mask-request, address-mask-reply, destination-unreachable, echo-request, echo-reply, parameter-problem, redirect, router-advertisement, router-solicitation, source-quench, time-exceeded, timestamp-request, timestamp-reply, any.
1314}
1315
1316// Type: NatOneToOneBasicRuleType
1317// Namespace: http://www.vmware.com/vcloud/v1.5
1318// Description: Represents the NAT basic rule for one to one mapping of internal and external IP addresses from a network.
1319// Since: 0.9
1320type NatOneToOneBasicRule struct {
1321	Xmlns string `xml:"xmlns,attr,omitempty"`
1322	// Elements
1323	MappingMode       string `xml:"MappingMode"`       // One of: automatic (map IP addresses automatically), manual (map IP addresses manually using ExternalIpAddress and InternalIpAddress)
1324	ExternalIPAddress string `xml:"ExternalIpAddress"` // External IP address to map.
1325	InternalIPAddress string `xml:"InternalIpAddress"` // Internal IP address to map.
1326}
1327
1328// Type: NatOneToOneVmRuleType
1329// Namespace: http://www.vmware.com/vcloud/v1.5
1330// Description: Represents the NAT rule for one to one mapping of VM NIC and external IP addresses from a network.
1331// Since: 0.9
1332type NatOneToOneVMRule struct {
1333	Xmlns string `xml:"xmlns,attr,omitempty"`
1334	// Elements
1335	MappingMode       string `xml:"MappingMode"`       // Mapping mode.
1336	ExternalIPAddress string `xml:"ExternalIpAddress"` // External IP address to map.
1337	VAppScopedVMID    string `xml:"VAppScopedVmId"`    // VAppScopedVmId of VM to which this rule applies.
1338	VMNicID           int    `xml:"VmNicId"`           // VM NIC ID to which this rule applies.
1339}
1340
1341// Type: NatPortForwardingRuleType
1342// Namespace: http://www.vmware.com/vcloud/v1.5
1343// Description: Represents the NAT rule for port forwarding between internal IP/port and external IP/port.
1344// Since: 0.9
1345type NatPortForwardingRule struct {
1346	ExternalIPAddress string `xml:"ExternalIpAddress"`  // External IP address to map.
1347	ExternalPort      int    `xml:"ExternalPort"`       // External port to forward to.
1348	InternalIPAddress string `xml:"InternalIpAddress"`  // Internal IP address to map.
1349	InternalPort      int    `xml:"InternalPort"`       // Internal port to forward to.
1350	Protocol          string `xml:"Protocol,omitempty"` // Protocol to forward. One of: TCP (forward TCP packets), UDP (forward UDP packets), TCP_UDP (forward TCP and UDP packets).
1351}
1352
1353// Type: NatVmRuleType
1354// Namespace: http://www.vmware.com/vcloud/v1.5
1355// Description: Represents the NAT rule for port forwarding between VM NIC/port and external IP/port.
1356// Since: 0.9
1357type NatVMRule struct {
1358	ExternalIPAddress string `xml:"ExternalIpAddress,omitempty"` // External IP address to map.
1359	ExternalPort      int    `xml:"ExternalPort"`                // External port to forward to.
1360	VAppScopedVMID    string `xml:"VAppScopedVmId"`              // VAppScopedVmId of VM to which this rule applies.
1361	VMNicID           int    `xml:"VmNicId"`                     // VM NIC ID to which this rule applies.
1362	InternalPort      int    `xml:"InternalPort"`                // Internal port to forward to.
1363	Protocol          string `xml:"Protocol,omitempty"`          // Protocol to forward. One of: TCP (forward TCP packets), UDP (forward UDP packets), TCP_UDP (forward TCP and UDP packets).
1364}
1365
1366// Type: QueryResultRecordsType
1367// Namespace: http://www.vmware.com/vcloud/v1.5
1368// Description: Container for query results in records format.
1369// Since: 1.5
1370type QueryResultEdgeGatewayRecordsType struct {
1371	// Attributes
1372	HREF     string  `xml:"href,attr,omitempty"`     // The URI of the entity.
1373	Type     string  `xml:"type,attr,omitempty"`     // The MIME type of the entity.
1374	Name     string  `xml:"name,attr,omitempty"`     // The name of the entity.
1375	Page     int     `xml:"page,attr,omitempty"`     // Page of the result set that this container holds. The first page is page number 1.
1376	PageSize int     `xml:"pageSize,attr,omitempty"` // Page size, as a number of records or references.
1377	Total    float64 `xml:"total,attr,omitempty"`    // Total number of records or references in the container.
1378	// Elements
1379	Link              []*Link                           `xml:"Link,omitempty"`    // A reference to an entity or operation associated with this object.
1380	EdgeGatewayRecord *QueryResultEdgeGatewayRecordType `xml:"EdgeGatewayRecord"` // A record representing a query result.
1381}
1382
1383type QueryResultEdgeGatewayRecordType struct {
1384	// Attributes
1385	HREF                string `xml:"href,attr,omitempty"`                // The URI of the entity.
1386	Type                string `xml:"type,attr,omitempty"`                // The MIME type of the entity.
1387	Name                string `xml:"name,attr,omitempty"`                // EdgeGateway name.
1388	Vdc                 string `xml:"vdc,attr,omitempty"`                 // VDC Reference or ID
1389	NumberOfExtNetworks int    `xml:"numberOfExtNetworks,attr,omitempty"` // Number of external networks connected to the edgeGateway.	Yes	Yes
1390	NumberOfOrgNetworks int    `xml:"numberOfOrgNetworks,attr,omitempty"` // Number of org VDC networks connected to the edgeGateway	Yes	Yes
1391	IsBusy              bool   `xml:"isBusy,attr"`                        // True if this Edge Gateway is busy.	Yes	Yes
1392	GatewayStatus       string `xml:"gatewayStatus,attr,omitempty"`       //
1393	HaStatus            string `xml:"haStatus,attr,omitempty"`            // High Availability Status of the edgeGateway	Yes	Yes
1394}
1395