Migrate to go-acme/lego.
This commit is contained in:
parent
4a68d29ce2
commit
87da7520de
286 changed files with 14021 additions and 2501 deletions
354
vendor/github.com/exoscale/egoscale/virtual_machines.go
generated
vendored
354
vendor/github.com/exoscale/egoscale/virtual_machines.go
generated
vendored
|
@ -29,8 +29,10 @@ const (
|
|||
VirtualMachineDestroyed VirtualMachineState = "Destroyed"
|
||||
// VirtualMachineExpunging "VM is being expunged
|
||||
VirtualMachineExpunging VirtualMachineState = "Expunging"
|
||||
// VirtualMachineMigrating VM is being migrated. host id holds to from host
|
||||
// VirtualMachineMigrating VM is being live migrated. host id holds destination host, last host id holds source host
|
||||
VirtualMachineMigrating VirtualMachineState = "Migrating"
|
||||
// VirtualMachineMoving VM is being migrated offline (volume is being moved).
|
||||
VirtualMachineMoving VirtualMachineState = "Moving"
|
||||
// VirtualMachineError VM is in error
|
||||
VirtualMachineError VirtualMachineState = "Error"
|
||||
// VirtualMachineUnknown VM state is unknown
|
||||
|
@ -43,67 +45,62 @@ const (
|
|||
//
|
||||
// See: http://docs.cloudstack.apache.org/projects/cloudstack-administration/en/stable/virtual_machines.html
|
||||
type VirtualMachine struct {
|
||||
Account string `json:"account,omitempty" doc:"the account associated with the virtual machine"`
|
||||
AccountID *UUID `json:"accountid,omitempty" doc:"the account ID associated with the virtual machine"`
|
||||
AffinityGroup []AffinityGroup `json:"affinitygroup,omitempty" doc:"list of affinity groups associated with the virtual machine"`
|
||||
ClusterID *UUID `json:"clusterid,omitempty" doc:"the ID of the vm's cluster"`
|
||||
ClusterName string `json:"clustername,omitempty" doc:"the name of the vm's cluster"`
|
||||
CPUNumber int `json:"cpunumber,omitempty" doc:"the number of cpu this virtual machine is running with"`
|
||||
CPUSpeed int `json:"cpuspeed,omitempty" doc:"the speed of each cpu"`
|
||||
CPUUsed string `json:"cpuused,omitempty" doc:"the amount of the vm's CPU currently used"`
|
||||
Created string `json:"created,omitempty" doc:"the date when this virtual machine was created"`
|
||||
Details map[string]string `json:"details,omitempty" doc:"Vm details in key/value pairs."`
|
||||
DiskIoRead int64 `json:"diskioread,omitempty" doc:"the read (io) of disk on the vm"`
|
||||
DiskIoWrite int64 `json:"diskiowrite,omitempty" doc:"the write (io) of disk on the vm"`
|
||||
DiskKbsRead int64 `json:"diskkbsread,omitempty" doc:"the read (bytes) of disk on the vm"`
|
||||
DiskKbsWrite int64 `json:"diskkbswrite,omitempty" doc:"the write (bytes) of disk on the vm"`
|
||||
DiskOfferingID *UUID `json:"diskofferingid,omitempty" doc:"the ID of the disk offering of the virtual machine"`
|
||||
DiskOfferingName string `json:"diskofferingname,omitempty" doc:"the name of the disk offering of the virtual machine"`
|
||||
DisplayName string `json:"displayname,omitempty" doc:"user generated name. The name of the virtual machine is returned if no displayname exists."`
|
||||
DisplayVM bool `json:"displayvm,omitempty" doc:"an optional field whether to the display the vm to the end user or not."`
|
||||
Domain string `json:"domain,omitempty" doc:"the name of the domain in which the virtual machine exists"`
|
||||
DomainID *UUID `json:"domainid,omitempty" doc:"the ID of the domain in which the virtual machine exists"`
|
||||
ForVirtualNetwork bool `json:"forvirtualnetwork,omitempty" doc:"the virtual network for the service offering"`
|
||||
Group string `json:"group,omitempty" doc:"the group name of the virtual machine"`
|
||||
GroupID *UUID `json:"groupid,omitempty" doc:"the group ID of the virtual machine"`
|
||||
HAEnable bool `json:"haenable,omitempty" doc:"true if high-availability is enabled, false otherwise"`
|
||||
HostID *UUID `json:"hostid,omitempty" doc:"the ID of the host for the virtual machine"`
|
||||
HostName string `json:"hostname,omitempty" doc:"the name of the host for the virtual machine"`
|
||||
Hypervisor string `json:"hypervisor,omitempty" doc:"the hypervisor on which the template runs"`
|
||||
ID *UUID `json:"id,omitempty" doc:"the ID of the virtual machine"`
|
||||
InstanceName string `json:"instancename,omitempty" doc:"instance name of the user vm; this parameter is returned to the ROOT admin only"`
|
||||
IsDynamicallyScalable bool `json:"isdynamicallyscalable,omitempty" doc:"true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory."`
|
||||
IsoDisplayText string `json:"isodisplaytext,omitempty" doc:"an alternate display text of the ISO attached to the virtual machine"`
|
||||
IsoID *UUID `json:"isoid,omitempty" doc:"the ID of the ISO attached to the virtual machine"`
|
||||
IsoName string `json:"isoname,omitempty" doc:"the name of the ISO attached to the virtual machine"`
|
||||
KeyPair string `json:"keypair,omitempty" doc:"ssh key-pair"`
|
||||
Memory int `json:"memory,omitempty" doc:"the memory allocated for the virtual machine"`
|
||||
Name string `json:"name,omitempty" doc:"the name of the virtual machine"`
|
||||
NetworkKbsRead int64 `json:"networkkbsread,omitempty" doc:"the incoming network traffic on the vm"`
|
||||
NetworkKbsWrite int64 `json:"networkkbswrite,omitempty" doc:"the outgoing network traffic on the host"`
|
||||
Nic []Nic `json:"nic,omitempty" doc:"the list of nics associated with vm"`
|
||||
OSCategoryID *UUID `json:"oscategoryid,omitempty" doc:"Os category ID of the virtual machine"`
|
||||
OSCategoryName string `json:"oscategoryname,omitempty" doc:"Os category name of the virtual machine"`
|
||||
Password string `json:"password,omitempty" doc:"the password (if exists) of the virtual machine"`
|
||||
PasswordEnabled bool `json:"passwordenabled,omitempty" doc:"true if the password rest feature is enabled, false otherwise"`
|
||||
PCIDevices []PCIDevice `json:"pcidevices,omitempty" doc:"list of PCI devices"`
|
||||
PodID *UUID `json:"podid,omitempty" doc:"the ID of the vm's pod"`
|
||||
PodName string `json:"podname,omitempty" doc:"the name of the vm's pod"`
|
||||
PublicIP string `json:"publicip,omitempty" doc:"public IP address id associated with vm via Static nat rule"`
|
||||
PublicIPID *UUID `json:"publicipid,omitempty" doc:"public IP address id associated with vm via Static nat rule"`
|
||||
RootDeviceID int64 `json:"rootdeviceid,omitempty" doc:"device ID of the root volume"`
|
||||
RootDeviceType string `json:"rootdevicetype,omitempty" doc:"device type of the root volume"`
|
||||
SecurityGroup []SecurityGroup `json:"securitygroup,omitempty" doc:"list of security groups associated with the virtual machine"`
|
||||
ServiceOfferingID *UUID `json:"serviceofferingid,omitempty" doc:"the ID of the service offering of the virtual machine"`
|
||||
ServiceOfferingName string `json:"serviceofferingname,omitempty" doc:"the name of the service offering of the virtual machine"`
|
||||
ServiceState string `json:"servicestate,omitempty" doc:"State of the Service from LB rule"`
|
||||
State string `json:"state,omitempty" doc:"the state of the virtual machine"`
|
||||
Tags []ResourceTag `json:"tags,omitempty" doc:"the list of resource tags associated with vm"`
|
||||
TemplateDisplayText string `json:"templatedisplaytext,omitempty" doc:"an alternate display text of the template for the virtual machine"`
|
||||
TemplateID *UUID `json:"templateid,omitempty" doc:"the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file."`
|
||||
TemplateName string `json:"templatename,omitempty" doc:"the name of the template for the virtual machine"`
|
||||
ZoneID *UUID `json:"zoneid,omitempty" doc:"the ID of the availablility zone for the virtual machine"`
|
||||
ZoneName string `json:"zonename,omitempty" doc:"the name of the availability zone for the virtual machine"`
|
||||
Account string `json:"account,omitempty" doc:"the account associated with the virtual machine"`
|
||||
AccountID *UUID `json:"accountid,omitempty" doc:"the account ID associated with the virtual machine"`
|
||||
AffinityGroup []AffinityGroup `json:"affinitygroup,omitempty" doc:"list of affinity groups associated with the virtual machine"`
|
||||
ClusterID *UUID `json:"clusterid,omitempty" doc:"the ID of the vm's cluster"`
|
||||
ClusterName string `json:"clustername,omitempty" doc:"the name of the vm's cluster"`
|
||||
CPUNumber int `json:"cpunumber,omitempty" doc:"the number of cpu this virtual machine is running with"`
|
||||
CPUSpeed int `json:"cpuspeed,omitempty" doc:"the speed of each cpu"`
|
||||
CPUUsed string `json:"cpuused,omitempty" doc:"the amount of the vm's CPU currently used"`
|
||||
Created string `json:"created,omitempty" doc:"the date when this virtual machine was created"`
|
||||
Details map[string]string `json:"details,omitempty" doc:"Vm details in key/value pairs."`
|
||||
DiskIoRead int64 `json:"diskioread,omitempty" doc:"the read (io) of disk on the vm"`
|
||||
DiskIoWrite int64 `json:"diskiowrite,omitempty" doc:"the write (io) of disk on the vm"`
|
||||
DiskKbsRead int64 `json:"diskkbsread,omitempty" doc:"the read (bytes) of disk on the vm"`
|
||||
DiskKbsWrite int64 `json:"diskkbswrite,omitempty" doc:"the write (bytes) of disk on the vm"`
|
||||
DiskOfferingID *UUID `json:"diskofferingid,omitempty" doc:"the ID of the disk offering of the virtual machine"`
|
||||
DiskOfferingName string `json:"diskofferingname,omitempty" doc:"the name of the disk offering of the virtual machine"`
|
||||
DisplayName string `json:"displayname,omitempty" doc:"user generated name. The name of the virtual machine is returned if no displayname exists."`
|
||||
ForVirtualNetwork bool `json:"forvirtualnetwork,omitempty" doc:"the virtual network for the service offering"`
|
||||
Group string `json:"group,omitempty" doc:"the group name of the virtual machine"`
|
||||
GroupID *UUID `json:"groupid,omitempty" doc:"the group ID of the virtual machine"`
|
||||
HAEnable bool `json:"haenable,omitempty" doc:"true if high-availability is enabled, false otherwise"`
|
||||
HostName string `json:"hostname,omitempty" doc:"the name of the host for the virtual machine"`
|
||||
ID *UUID `json:"id,omitempty" doc:"the ID of the virtual machine"`
|
||||
InstanceName string `json:"instancename,omitempty" doc:"instance name of the user vm; this parameter is returned to the ROOT admin only"`
|
||||
IsoDisplayText string `json:"isodisplaytext,omitempty" doc:"an alternate display text of the ISO attached to the virtual machine"`
|
||||
IsoID *UUID `json:"isoid,omitempty" doc:"the ID of the ISO attached to the virtual machine"`
|
||||
IsoName string `json:"isoname,omitempty" doc:"the name of the ISO attached to the virtual machine"`
|
||||
KeyPair string `json:"keypair,omitempty" doc:"ssh key-pair"`
|
||||
Memory int `json:"memory,omitempty" doc:"the memory allocated for the virtual machine"`
|
||||
Name string `json:"name,omitempty" doc:"the name of the virtual machine"`
|
||||
NetworkKbsRead int64 `json:"networkkbsread,omitempty" doc:"the incoming network traffic on the vm"`
|
||||
NetworkKbsWrite int64 `json:"networkkbswrite,omitempty" doc:"the outgoing network traffic on the host"`
|
||||
Nic []Nic `json:"nic,omitempty" doc:"the list of nics associated with vm"`
|
||||
OSCategoryID *UUID `json:"oscategoryid,omitempty" doc:"Os category ID of the virtual machine"`
|
||||
OSCategoryName string `json:"oscategoryname,omitempty" doc:"Os category name of the virtual machine"`
|
||||
OSTypeID *UUID `json:"ostypeid,omitempty" doc:"OS type id of the vm"`
|
||||
Password string `json:"password,omitempty" doc:"the password (if exists) of the virtual machine"`
|
||||
PasswordEnabled bool `json:"passwordenabled,omitempty" doc:"true if the password rest feature is enabled, false otherwise"`
|
||||
PCIDevices []PCIDevice `json:"pcidevices,omitempty" doc:"list of PCI devices"`
|
||||
PodID *UUID `json:"podid,omitempty" doc:"the ID of the vm's pod"`
|
||||
PodName string `json:"podname,omitempty" doc:"the name of the vm's pod"`
|
||||
PublicIP string `json:"publicip,omitempty" doc:"public IP address id associated with vm via Static nat rule"`
|
||||
PublicIPID *UUID `json:"publicipid,omitempty" doc:"public IP address id associated with vm via Static nat rule"`
|
||||
RootDeviceID int64 `json:"rootdeviceid,omitempty" doc:"device ID of the root volume"`
|
||||
RootDeviceType string `json:"rootdevicetype,omitempty" doc:"device type of the root volume"`
|
||||
SecurityGroup []SecurityGroup `json:"securitygroup,omitempty" doc:"list of security groups associated with the virtual machine"`
|
||||
ServiceOfferingID *UUID `json:"serviceofferingid,omitempty" doc:"the ID of the service offering of the virtual machine"`
|
||||
ServiceOfferingName string `json:"serviceofferingname,omitempty" doc:"the name of the service offering of the virtual machine"`
|
||||
ServiceState string `json:"servicestate,omitempty" doc:"State of the Service from LB rule"`
|
||||
State string `json:"state,omitempty" doc:"the state of the virtual machine"`
|
||||
Tags []ResourceTag `json:"tags,omitempty" doc:"the list of resource tags associated with vm"`
|
||||
TemplateDisplayText string `json:"templatedisplaytext,omitempty" doc:"an alternate display text of the template for the virtual machine"`
|
||||
TemplateID *UUID `json:"templateid,omitempty" doc:"the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file."`
|
||||
TemplateName string `json:"templatename,omitempty" doc:"the name of the template for the virtual machine"`
|
||||
ZoneID *UUID `json:"zoneid,omitempty" doc:"the ID of the availablility zone for the virtual machine"`
|
||||
ZoneName string `json:"zonename,omitempty" doc:"the name of the availability zone for the virtual machine"`
|
||||
}
|
||||
|
||||
// ResourceType returns the type of the resource
|
||||
|
@ -122,11 +119,9 @@ func (vm VirtualMachine) Delete(ctx context.Context, client *Client) error {
|
|||
|
||||
// ListRequest builds the ListVirtualMachines request
|
||||
func (vm VirtualMachine) ListRequest() (ListCommand, error) {
|
||||
// XXX: AffinityGroupID, SecurityGroupID, Tags
|
||||
// XXX: AffinityGroupID, SecurityGroupID
|
||||
|
||||
req := &ListVirtualMachines{
|
||||
Account: vm.Account,
|
||||
DomainID: vm.DomainID,
|
||||
GroupID: vm.GroupID,
|
||||
ID: vm.ID,
|
||||
Name: vm.Name,
|
||||
|
@ -140,14 +135,18 @@ func (vm VirtualMachine) ListRequest() (ListCommand, error) {
|
|||
req.IPAddress = nic.IPAddress
|
||||
}
|
||||
|
||||
for i := range vm.Tags {
|
||||
req.Tags = append(req.Tags, vm.Tags[i])
|
||||
}
|
||||
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// DefaultNic returns the default nic
|
||||
func (vm VirtualMachine) DefaultNic() *Nic {
|
||||
for _, nic := range vm.Nic {
|
||||
for i, nic := range vm.Nic {
|
||||
if nic.IsDefault {
|
||||
return &nic
|
||||
return &vm.Nic[i]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,8 +170,9 @@ func (vm VirtualMachine) NicsByType(nicType string) []Nic {
|
|||
for _, nic := range vm.Nic {
|
||||
if nic.Type == nicType {
|
||||
// XXX The API forgets to specify it
|
||||
nic.VirtualMachineID = vm.ID
|
||||
nics = append(nics, nic)
|
||||
n := nic
|
||||
n.VirtualMachineID = vm.ID
|
||||
nics = append(nics, n)
|
||||
}
|
||||
}
|
||||
return nics
|
||||
|
@ -184,8 +184,9 @@ func (vm VirtualMachine) NicsByType(nicType string) []Nic {
|
|||
func (vm VirtualMachine) NicByNetworkID(networkID UUID) *Nic {
|
||||
for _, nic := range vm.Nic {
|
||||
if nic.NetworkID.Equal(networkID) {
|
||||
nic.VirtualMachineID = vm.ID
|
||||
return &nic
|
||||
n := nic
|
||||
n.VirtualMachineID = vm.ID
|
||||
return &n
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
@ -195,8 +196,9 @@ func (vm VirtualMachine) NicByNetworkID(networkID UUID) *Nic {
|
|||
func (vm VirtualMachine) NicByID(nicID UUID) *Nic {
|
||||
for _, nic := range vm.Nic {
|
||||
if nic.ID.Equal(nicID) {
|
||||
nic.VirtualMachineID = vm.ID
|
||||
return &nic
|
||||
n := nic
|
||||
n.VirtualMachineID = vm.ID
|
||||
return &n
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,10 +215,10 @@ type IPToNetwork struct {
|
|||
// PCIDevice represents a PCI card present in the host
|
||||
type PCIDevice struct {
|
||||
PCIVendorName string `json:"pcivendorname,omitempty" doc:"Device vendor name of pci card"`
|
||||
DeviceID *UUID `json:"deviceid,omitempty" doc:"Device model ID of pci card"`
|
||||
DeviceID string `json:"deviceid,omitempty" doc:"Device model ID of pci card"`
|
||||
RemainingCapacity int `json:"remainingcapacity,omitempty" doc:"Remaining capacity in terms of no. of more VMs that can be deployped with this vGPU type"`
|
||||
MaxCapacity int `json:"maxcapacity,omitempty" doc:"Maximum vgpu can be created with this vgpu type on the given pci group"`
|
||||
PCIVendorID *UUID `json:"pcivendorid,omitempty" doc:"Device vendor ID of pci card"`
|
||||
PCIVendorID string `json:"pcivendorid,omitempty" doc:"Device vendor ID of pci card"`
|
||||
PCIDeviceName string `json:"pcidevicename,omitempty" doc:"Device model name of pci card"`
|
||||
}
|
||||
|
||||
|
@ -229,8 +231,8 @@ type Password struct {
|
|||
|
||||
// VirtualMachineUserData represents the base64 encoded user-data
|
||||
type VirtualMachineUserData struct {
|
||||
UserData string `json:"userdata,omitempty" doc:"Base 64 encoded VM user data"`
|
||||
VirtualMachineID *UUID `json:"virtualmachineid,omitempty" doc:"the ID of the virtual machine"`
|
||||
UserData string `json:"userdata" doc:"Base 64 encoded VM user data"`
|
||||
VirtualMachineID *UUID `json:"virtualmachineid" doc:"the ID of the virtual machine"`
|
||||
}
|
||||
|
||||
// Decode decodes as a readable string the content of the user-data (base64 · gzip)
|
||||
|
@ -260,24 +262,16 @@ func (userdata VirtualMachineUserData) Decode() (string, error) {
|
|||
//
|
||||
// Regarding the UserData field, the client is responsible to base64 (and probably gzip) it. Doing it within this library would make the integration with other tools, e.g. Terraform harder.
|
||||
type DeployVirtualMachine struct {
|
||||
Account string `json:"account,omitempty" doc:"an optional account for the virtual machine. Must be used with domainId."`
|
||||
AffinityGroupIDs []UUID `json:"affinitygroupids,omitempty" doc:"comma separated list of affinity groups id that are going to be applied to the virtual machine. Mutually exclusive with affinitygroupnames parameter"`
|
||||
AffinityGroupNames []string `json:"affinitygroupnames,omitempty" doc:"comma separated list of affinity groups names that are going to be applied to the virtual machine.Mutually exclusive with affinitygroupids parameter"`
|
||||
CustomID *UUID `json:"customid,omitempty" doc:"an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only"`
|
||||
DeploymentPlanner string `json:"deploymentplanner,omitempty" doc:"Deployment planner to use for vm allocation. Available to ROOT admin only"`
|
||||
Details map[string]string `json:"details,omitempty" doc:"used to specify the custom parameters."`
|
||||
DiskOfferingID *UUID `json:"diskofferingid,omitempty" doc:"the ID of the disk offering for the virtual machine. If the template is of ISO format, the diskOfferingId is for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk volume. If the templateId parameter passed is from a Template object, the diskOfferingId refers to a DATA Disk Volume created. If the templateId parameter passed is from an ISO object, the diskOfferingId refers to a ROOT Disk Volume created."`
|
||||
DiskOfferingID *UUID `json:"diskofferingid,omitempty" doc:"the ID of the disk offering for the virtual machine. If the template is of ISO format, the diskofferingid is for the root disk volume. Otherwise this parameter is used to indicate the offering for the data disk volume. If the templateid parameter passed is from a Template object, the diskofferingid refers to a DATA Disk Volume created. If the templateid parameter passed is from an ISO object, the diskofferingid refers to a ROOT Disk Volume created."`
|
||||
DisplayName string `json:"displayname,omitempty" doc:"an optional user generated name for the virtual machine"`
|
||||
DisplayVM *bool `json:"displayvm,omitempty" doc:"an optional field, whether to the display the vm to the end user or not."`
|
||||
DomainID *UUID `json:"domainid,omitempty" doc:"an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used."`
|
||||
Group string `json:"group,omitempty" doc:"an optional group for the virtual machine"`
|
||||
HostID *UUID `json:"hostid,omitempty" doc:"destination Host ID to deploy the VM to - parameter available for root admin only"`
|
||||
Hypervisor string `json:"hypervisor,omitempty" doc:"the hypervisor on which to deploy the virtual machine"`
|
||||
IP4 *bool `json:"ip4,omitempty" doc:"True to set an IPv4 to the default interface"`
|
||||
IP6 *bool `json:"ip6,omitempty" doc:"True to set an IPv6 to the default interface"`
|
||||
IP6Address net.IP `json:"ip6address,omitempty" doc:"the ipv6 address for default vm's network"`
|
||||
IPAddress net.IP `json:"ipaddress,omitempty" doc:"the ip address for default vm's network"`
|
||||
IPToNetworkList []IPToNetwork `json:"iptonetworklist,omitempty" doc:"ip to network mapping. Can't be specified with networkIds parameter. Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].ipv6=fc00:1234:5678::abcd&iptonetworklist[0].networkid=uuid - requests to use ip 10.10.10.11 in network id=uuid"`
|
||||
Keyboard string `json:"keyboard,omitempty" doc:"an optional keyboard device type for the virtual machine. valid value can be one of de,de-ch,es,fi,fr,fr-be,fr-ch,is,it,jp,nl-be,no,pt,uk,us"`
|
||||
KeyPair string `json:"keypair,omitempty" doc:"name of the ssh key pair used to login to the virtual machine"`
|
||||
Name string `json:"name,omitempty" doc:"host name for the virtual machine"`
|
||||
|
@ -286,7 +280,7 @@ type DeployVirtualMachine struct {
|
|||
SecurityGroupIDs []UUID `json:"securitygroupids,omitempty" doc:"comma separated list of security groups id that going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupnames parameter"`
|
||||
SecurityGroupNames []string `json:"securitygroupnames,omitempty" doc:"comma separated list of security groups names that going to be applied to the virtual machine. Should be passed only when vm is created from a zone with Basic Network support. Mutually exclusive with securitygroupids parameter"`
|
||||
ServiceOfferingID *UUID `json:"serviceofferingid" doc:"the ID of the service offering for the virtual machine"`
|
||||
Size int64 `json:"size,omitempty" doc:"the arbitrary size for the DATADISK volume. Mutually exclusive with diskOfferingId"`
|
||||
Size int64 `json:"size,omitempty" doc:"the arbitrary size for the DATADISK volume. Mutually exclusive with diskofferingid"`
|
||||
StartVM *bool `json:"startvm,omitempty" doc:"true if start vm after creating. Default value is true"`
|
||||
TemplateID *UUID `json:"templateid" doc:"the ID of the template for the virtual machine"`
|
||||
UserData string `json:"userdata,omitempty" doc:"an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding. Using HTTP POST(via POST body), you can send up to 32K of data after base64 encoding."`
|
||||
|
@ -294,7 +288,7 @@ type DeployVirtualMachine struct {
|
|||
_ bool `name:"deployVirtualMachine" description:"Creates and automatically starts a virtual machine based on a service offering, disk offering, and template."`
|
||||
}
|
||||
|
||||
func (req DeployVirtualMachine) onBeforeSend(params url.Values) error {
|
||||
func (req DeployVirtualMachine) onBeforeSend(_ url.Values) error {
|
||||
// Either AffinityGroupIDs or AffinityGroupNames must be set
|
||||
if len(req.AffinityGroupIDs) > 0 && len(req.AffinityGroupNames) > 0 {
|
||||
return fmt.Errorf("either AffinityGroupIDs or AffinityGroupNames must be set")
|
||||
|
@ -308,27 +302,29 @@ func (req DeployVirtualMachine) onBeforeSend(params url.Values) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (DeployVirtualMachine) response() interface{} {
|
||||
// Response returns the struct to unmarshal
|
||||
func (DeployVirtualMachine) Response() interface{} {
|
||||
return new(AsyncJobResult)
|
||||
}
|
||||
|
||||
func (DeployVirtualMachine) asyncResponse() interface{} {
|
||||
// AsyncResponse returns the struct to unmarshal the async job
|
||||
func (DeployVirtualMachine) AsyncResponse() interface{} {
|
||||
return new(VirtualMachine)
|
||||
}
|
||||
|
||||
// StartVirtualMachine (Async) represents the creation of the virtual machine
|
||||
type StartVirtualMachine struct {
|
||||
ID *UUID `json:"id" doc:"The ID of the virtual machine"`
|
||||
DeploymentPlanner string `json:"deploymentplanner,omitempty" doc:"Deployment planner to use for vm allocation. Available to ROOT admin only"`
|
||||
HostID *UUID `json:"hostid,omitempty" doc:"destination Host ID to deploy the VM to - parameter available for root admin only"`
|
||||
_ bool `name:"startVirtualMachine" description:"Starts a virtual machine."`
|
||||
ID *UUID `json:"id" doc:"The ID of the virtual machine"`
|
||||
_ bool `name:"startVirtualMachine" description:"Starts a virtual machine."`
|
||||
}
|
||||
|
||||
func (StartVirtualMachine) response() interface{} {
|
||||
// Response returns the struct to unmarshal
|
||||
func (StartVirtualMachine) Response() interface{} {
|
||||
return new(AsyncJobResult)
|
||||
}
|
||||
|
||||
func (StartVirtualMachine) asyncResponse() interface{} {
|
||||
// AsyncResponse returns the struct to unmarshal the async job
|
||||
func (StartVirtualMachine) AsyncResponse() interface{} {
|
||||
return new(VirtualMachine)
|
||||
}
|
||||
|
||||
|
@ -339,11 +335,13 @@ type StopVirtualMachine struct {
|
|||
_ bool `name:"stopVirtualMachine" description:"Stops a virtual machine."`
|
||||
}
|
||||
|
||||
func (StopVirtualMachine) response() interface{} {
|
||||
// Response returns the struct to unmarshal
|
||||
func (StopVirtualMachine) Response() interface{} {
|
||||
return new(AsyncJobResult)
|
||||
}
|
||||
|
||||
func (StopVirtualMachine) asyncResponse() interface{} {
|
||||
// AsyncResponse returns the struct to unmarshal the async job
|
||||
func (StopVirtualMachine) AsyncResponse() interface{} {
|
||||
return new(VirtualMachine)
|
||||
}
|
||||
|
||||
|
@ -353,11 +351,13 @@ type RebootVirtualMachine struct {
|
|||
_ bool `name:"rebootVirtualMachine" description:"Reboots a virtual machine."`
|
||||
}
|
||||
|
||||
func (RebootVirtualMachine) response() interface{} {
|
||||
// Response returns the struct to unmarshal
|
||||
func (RebootVirtualMachine) Response() interface{} {
|
||||
return new(AsyncJobResult)
|
||||
}
|
||||
|
||||
func (RebootVirtualMachine) asyncResponse() interface{} {
|
||||
// AsyncResponse returns the struct to unmarshal the async job
|
||||
func (RebootVirtualMachine) AsyncResponse() interface{} {
|
||||
return new(VirtualMachine)
|
||||
}
|
||||
|
||||
|
@ -369,11 +369,13 @@ type RestoreVirtualMachine struct {
|
|||
_ bool `name:"restoreVirtualMachine" description:"Restore a VM to original template/ISO or new template/ISO"`
|
||||
}
|
||||
|
||||
func (RestoreVirtualMachine) response() interface{} {
|
||||
// Response returns the struct to unmarshal
|
||||
func (RestoreVirtualMachine) Response() interface{} {
|
||||
return new(AsyncJobResult)
|
||||
}
|
||||
|
||||
func (RestoreVirtualMachine) asyncResponse() interface{} {
|
||||
// AsyncResponse returns the struct to unmarshal the async job
|
||||
func (RestoreVirtualMachine) AsyncResponse() interface{} {
|
||||
return new(VirtualMachine)
|
||||
}
|
||||
|
||||
|
@ -383,42 +385,41 @@ type RecoverVirtualMachine struct {
|
|||
_ bool `name:"recoverVirtualMachine" description:"Recovers a virtual machine."`
|
||||
}
|
||||
|
||||
func (RecoverVirtualMachine) response() interface{} {
|
||||
// Response returns the struct to unmarshal
|
||||
func (RecoverVirtualMachine) Response() interface{} {
|
||||
return new(VirtualMachine)
|
||||
}
|
||||
|
||||
// DestroyVirtualMachine (Async) represents the destruction of the virtual machine
|
||||
type DestroyVirtualMachine struct {
|
||||
ID *UUID `json:"id" doc:"The ID of the virtual machine"`
|
||||
Expunge *bool `json:"expunge,omitempty" doc:"If true is passed, the vm is expunged immediately. False by default."`
|
||||
_ bool `name:"destroyVirtualMachine" description:"Destroys a virtual machine."`
|
||||
ID *UUID `json:"id" doc:"The ID of the virtual machine"`
|
||||
_ bool `name:"destroyVirtualMachine" description:"Destroys a virtual machine."`
|
||||
}
|
||||
|
||||
func (DestroyVirtualMachine) response() interface{} {
|
||||
// Response returns the struct to unmarshal
|
||||
func (DestroyVirtualMachine) Response() interface{} {
|
||||
return new(AsyncJobResult)
|
||||
}
|
||||
|
||||
func (DestroyVirtualMachine) asyncResponse() interface{} {
|
||||
// AsyncResponse returns the struct to unmarshal the async job
|
||||
func (DestroyVirtualMachine) AsyncResponse() interface{} {
|
||||
return new(VirtualMachine)
|
||||
}
|
||||
|
||||
// UpdateVirtualMachine represents the update of the virtual machine
|
||||
type UpdateVirtualMachine struct {
|
||||
ID *UUID `json:"id" doc:"The ID of the virtual machine"`
|
||||
CustomID *UUID `json:"customid,omitempty" doc:"an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only"`
|
||||
Details map[string]string `json:"details,omitempty" doc:"Details in key/value pairs."`
|
||||
DisplayName string `json:"displayname,omitempty" doc:"user generated name"`
|
||||
DisplayVM *bool `json:"displayvm,omitempty" doc:"an optional field, whether to the display the vm to the end user or not."`
|
||||
Group string `json:"group,omitempty" doc:"group of the virtual machine"`
|
||||
HAEnable *bool `json:"haenable,omitempty" doc:"true if high-availability is enabled for the virtual machine, false otherwise"`
|
||||
IsDynamicallyScalable *bool `json:"isdynamicallyscalable,omitempty" doc:"true if VM contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory"`
|
||||
Name string `json:"name,omitempty" doc:"new host name of the vm. The VM has to be stopped/started for this update to take affect"`
|
||||
SecurityGroupIDs []UUID `json:"securitygroupids,omitempty" doc:"list of security group ids to be applied on the virtual machine."`
|
||||
UserData string `json:"userdata,omitempty" doc:"an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding. Using HTTP POST(via POST body), you can send up to 32K of data after base64 encoding."`
|
||||
_ bool `name:"updateVirtualMachine" description:"Updates properties of a virtual machine. The VM has to be stopped and restarted for the new properties to take effect. UpdateVirtualMachine does not first check whether the VM is stopped. Therefore, stop the VM manually before issuing this call."`
|
||||
ID *UUID `json:"id" doc:"The ID of the virtual machine"`
|
||||
Details map[string]string `json:"details,omitempty" doc:"Details in key/value pairs."`
|
||||
DisplayName string `json:"displayname,omitempty" doc:"user generated name"`
|
||||
Group string `json:"group,omitempty" doc:"group of the virtual machine"`
|
||||
Name string `json:"name,omitempty" doc:"new host name of the vm. The VM has to be stopped/started for this update to take affect"`
|
||||
SecurityGroupIDs []UUID `json:"securitygroupids,omitempty" doc:"list of security group ids to be applied on the virtual machine."`
|
||||
UserData string `json:"userdata,omitempty" doc:"an optional binary data that can be sent to the virtual machine upon a successful deployment. This binary data must be base64 encoded before adding it to the request. Using HTTP GET (via querystring), you can send up to 2KB of data after base64 encoding. Using HTTP POST(via POST body), you can send up to 32K of data after base64 encoding."`
|
||||
_ bool `name:"updateVirtualMachine" description:"Updates properties of a virtual machine. The VM has to be stopped and restarted for the new properties to take effect. UpdateVirtualMachine does not first check whether the VM is stopped. Therefore, stop the VM manually before issuing this call."`
|
||||
}
|
||||
|
||||
func (UpdateVirtualMachine) response() interface{} {
|
||||
// Response returns the struct to unmarshal
|
||||
func (UpdateVirtualMachine) Response() interface{} {
|
||||
return new(VirtualMachine)
|
||||
}
|
||||
|
||||
|
@ -428,12 +429,14 @@ type ExpungeVirtualMachine struct {
|
|||
_ bool `name:"expungeVirtualMachine" description:"Expunge a virtual machine. Once expunged, it cannot be recoverd."`
|
||||
}
|
||||
|
||||
func (ExpungeVirtualMachine) response() interface{} {
|
||||
// Response returns the struct to unmarshal
|
||||
func (ExpungeVirtualMachine) Response() interface{} {
|
||||
return new(AsyncJobResult)
|
||||
}
|
||||
|
||||
func (ExpungeVirtualMachine) asyncResponse() interface{} {
|
||||
return new(booleanResponse)
|
||||
// AsyncResponse returns the struct to unmarshal the async job
|
||||
func (ExpungeVirtualMachine) AsyncResponse() interface{} {
|
||||
return new(BooleanResponse)
|
||||
}
|
||||
|
||||
// ScaleVirtualMachine (Async) scales the virtual machine to a new service offering.
|
||||
|
@ -447,12 +450,14 @@ type ScaleVirtualMachine struct {
|
|||
_ bool `name:"scaleVirtualMachine" description:"Scales the virtual machine to a new service offering."`
|
||||
}
|
||||
|
||||
func (ScaleVirtualMachine) response() interface{} {
|
||||
// Response returns the struct to unmarshal
|
||||
func (ScaleVirtualMachine) Response() interface{} {
|
||||
return new(AsyncJobResult)
|
||||
}
|
||||
|
||||
func (ScaleVirtualMachine) asyncResponse() interface{} {
|
||||
return new(booleanResponse)
|
||||
// AsyncResponse returns the struct to unmarshal the async job
|
||||
func (ScaleVirtualMachine) AsyncResponse() interface{} {
|
||||
return new(BooleanResponse)
|
||||
}
|
||||
|
||||
// ChangeServiceForVirtualMachine changes the service offering for a virtual machine. The virtual machine must be in a "Stopped" state for this command to take effect.
|
||||
|
@ -463,7 +468,8 @@ type ChangeServiceForVirtualMachine struct {
|
|||
_ bool `name:"changeServiceForVirtualMachine" description:"Changes the service offering for a virtual machine. The virtual machine must be in a \"Stopped\" state for this command to take effect."`
|
||||
}
|
||||
|
||||
func (ChangeServiceForVirtualMachine) response() interface{} {
|
||||
// Response returns the struct to unmarshal
|
||||
func (ChangeServiceForVirtualMachine) Response() interface{} {
|
||||
return new(VirtualMachine)
|
||||
}
|
||||
|
||||
|
@ -473,10 +479,13 @@ type ResetPasswordForVirtualMachine struct {
|
|||
_ bool `name:"resetPasswordForVirtualMachine" description:"Resets the password for virtual machine. The virtual machine must be in a \"Stopped\" state and the template must already support this feature for this command to take effect."`
|
||||
}
|
||||
|
||||
func (ResetPasswordForVirtualMachine) response() interface{} {
|
||||
// Response returns the struct to unmarshal
|
||||
func (ResetPasswordForVirtualMachine) Response() interface{} {
|
||||
return new(AsyncJobResult)
|
||||
}
|
||||
func (ResetPasswordForVirtualMachine) asyncResponse() interface{} {
|
||||
|
||||
// AsyncResponse returns the struct to unmarshal the async job
|
||||
func (ResetPasswordForVirtualMachine) AsyncResponse() interface{} {
|
||||
return new(VirtualMachine)
|
||||
}
|
||||
|
||||
|
@ -486,28 +495,24 @@ type GetVMPassword struct {
|
|||
_ bool `name:"getVMPassword" description:"Returns an encrypted password for the VM"`
|
||||
}
|
||||
|
||||
func (GetVMPassword) response() interface{} {
|
||||
// Response returns the struct to unmarshal
|
||||
func (GetVMPassword) Response() interface{} {
|
||||
return new(Password)
|
||||
}
|
||||
|
||||
//go:generate go run generate/main.go -interface=Listable ListVirtualMachines
|
||||
|
||||
// ListVirtualMachines represents a search for a VM
|
||||
type ListVirtualMachines struct {
|
||||
Account string `json:"account,omitempty" doc:"list resources by account. Must be used with the domainId parameter."`
|
||||
AffinityGroupID *UUID `json:"affinitygroupid,omitempty" doc:"list vms by affinity group"`
|
||||
Details []string `json:"details,omitempty" doc:"comma separated list of host details requested, value can be a list of [all, group, nics, stats, secgrp, tmpl, servoff, diskoff, iso, volume, min, affgrp]. If no parameter is passed in, the details will be defaulted to all"`
|
||||
DisplayVM *bool `json:"displayvm,omitempty" doc:"list resources by display flag; only ROOT admin is eligible to pass this parameter"`
|
||||
DomainID *UUID `json:"domainid,omitempty" doc:"list only resources belonging to the domain specified"`
|
||||
ForVirtualNetwork *bool `json:"forvirtualnetwork,omitempty" doc:"list by network type; true if need to list vms using Virtual Network, false otherwise"`
|
||||
GroupID *UUID `json:"groupid,omitempty" doc:"the group ID"`
|
||||
HostID *UUID `json:"hostid,omitempty" doc:"the host ID"`
|
||||
Hypervisor string `json:"hypervisor,omitempty" doc:"the target hypervisor for the template"`
|
||||
ID *UUID `json:"id,omitempty" doc:"the ID of the virtual machine"`
|
||||
IDs []string `json:"ids,omitempty" doc:"the IDs of the virtual machines, mutually exclusive with id"`
|
||||
IDs []UUID `json:"ids,omitempty" doc:"the IDs of the virtual machines, mutually exclusive with id"`
|
||||
IPAddress net.IP `json:"ipaddress,omitempty" doc:"an IP address to filter the result"`
|
||||
IsoID *UUID `json:"isoid,omitempty" doc:"list vms by iso"`
|
||||
IsRecursive *bool `json:"isrecursive,omitempty" doc:"defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves."`
|
||||
Keyword string `json:"keyword,omitempty" doc:"List by keyword"`
|
||||
ListAll *bool `json:"listall,omitempty" doc:"If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false"`
|
||||
Name string `json:"name,omitempty" doc:"name of the virtual machine"`
|
||||
NetworkID *UUID `json:"networkid,omitempty" doc:"list by network id"`
|
||||
Page int `json:"page,omitempty"`
|
||||
|
@ -526,47 +531,21 @@ type ListVirtualMachinesResponse struct {
|
|||
VirtualMachine []VirtualMachine `json:"virtualmachine"`
|
||||
}
|
||||
|
||||
func (ListVirtualMachines) response() interface{} {
|
||||
return new(ListVirtualMachinesResponse)
|
||||
}
|
||||
|
||||
// SetPage sets the current page
|
||||
func (ls *ListVirtualMachines) SetPage(page int) {
|
||||
ls.Page = page
|
||||
}
|
||||
|
||||
// SetPageSize sets the page size
|
||||
func (ls *ListVirtualMachines) SetPageSize(pageSize int) {
|
||||
ls.PageSize = pageSize
|
||||
}
|
||||
|
||||
func (ListVirtualMachines) each(resp interface{}, callback IterateItemFunc) {
|
||||
vms, ok := resp.(*ListVirtualMachinesResponse)
|
||||
if !ok {
|
||||
callback(nil, fmt.Errorf("wrong type. ListVirtualMachinesResponse expected, got %T", resp))
|
||||
return
|
||||
}
|
||||
|
||||
for i := range vms.VirtualMachine {
|
||||
if !callback(&vms.VirtualMachine[i], nil) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AddNicToVirtualMachine (Async) adds a NIC to a VM
|
||||
type AddNicToVirtualMachine struct {
|
||||
NetworkID *UUID `json:"networkid" doc:"Network ID"`
|
||||
VirtualMachineID *UUID `json:"virtualmachineid" doc:"Virtual Machine ID"`
|
||||
IPAddress net.IP `json:"ipaddress,omitempty" doc:"IP Address for the new network"`
|
||||
IPAddress net.IP `json:"ipaddress,omitempty" doc:"Static IP address lease for the corresponding NIC and network which should be in the range defined in the network"`
|
||||
_ bool `name:"addNicToVirtualMachine" description:"Adds VM to specified network by creating a NIC"`
|
||||
}
|
||||
|
||||
func (AddNicToVirtualMachine) response() interface{} {
|
||||
// Response returns the struct to unmarshal
|
||||
func (AddNicToVirtualMachine) Response() interface{} {
|
||||
return new(AsyncJobResult)
|
||||
}
|
||||
|
||||
func (AddNicToVirtualMachine) asyncResponse() interface{} {
|
||||
// AsyncResponse returns the struct to unmarshal the async job
|
||||
func (AddNicToVirtualMachine) AsyncResponse() interface{} {
|
||||
return new(VirtualMachine)
|
||||
}
|
||||
|
||||
|
@ -577,11 +556,13 @@ type RemoveNicFromVirtualMachine struct {
|
|||
_ bool `name:"removeNicFromVirtualMachine" description:"Removes VM from specified network by deleting a NIC"`
|
||||
}
|
||||
|
||||
func (RemoveNicFromVirtualMachine) response() interface{} {
|
||||
// Response returns the struct to unmarshal
|
||||
func (RemoveNicFromVirtualMachine) Response() interface{} {
|
||||
return new(AsyncJobResult)
|
||||
}
|
||||
|
||||
func (RemoveNicFromVirtualMachine) asyncResponse() interface{} {
|
||||
// AsyncResponse returns the struct to unmarshal the async job
|
||||
func (RemoveNicFromVirtualMachine) AsyncResponse() interface{} {
|
||||
return new(VirtualMachine)
|
||||
}
|
||||
|
||||
|
@ -592,10 +573,13 @@ type UpdateDefaultNicForVirtualMachine struct {
|
|||
_ bool `name:"updateDefaultNicForVirtualMachine" description:"Changes the default NIC on a VM"`
|
||||
}
|
||||
|
||||
func (UpdateDefaultNicForVirtualMachine) response() interface{} {
|
||||
// Response returns the struct to unmarshal
|
||||
func (UpdateDefaultNicForVirtualMachine) Response() interface{} {
|
||||
return new(AsyncJobResult)
|
||||
}
|
||||
func (UpdateDefaultNicForVirtualMachine) asyncResponse() interface{} {
|
||||
|
||||
// AsyncResponse returns the struct to unmarshal the async job
|
||||
func (UpdateDefaultNicForVirtualMachine) AsyncResponse() interface{} {
|
||||
return new(VirtualMachine)
|
||||
}
|
||||
|
||||
|
@ -605,24 +589,24 @@ type GetVirtualMachineUserData struct {
|
|||
_ bool `name:"getVirtualMachineUserData" description:"Returns user data associated with the VM"`
|
||||
}
|
||||
|
||||
func (GetVirtualMachineUserData) response() interface{} {
|
||||
// Response returns the struct to unmarshal
|
||||
func (GetVirtualMachineUserData) Response() interface{} {
|
||||
return new(VirtualMachineUserData)
|
||||
}
|
||||
|
||||
// Decode decodes the base64 / gzipped encoded user data
|
||||
|
||||
// MigrateVirtualMachine (Async) attempts migration of a VM to a different host or Root volume of the vm to a different storage pool
|
||||
type MigrateVirtualMachine struct {
|
||||
HostID *UUID `json:"hostid,omitempty" doc:"Destination Host ID to migrate VM to. Required for live migrating a VM from host to host"`
|
||||
StorageID *UUID `json:"storageid,omitempty" doc:"Destination storage pool ID to migrate VM volumes to. Required for migrating the root disk volume"`
|
||||
VirtualMachineID *UUID `json:"virtualmachineid" doc:"the ID of the virtual machine"`
|
||||
_ bool `name:"migrateVirtualMachine" description:"Attempts Migration of a VM to a different host or Root volume of the vm to a different storage pool"`
|
||||
// UpdateVMNicIP updates the default IP address of a VM Nic
|
||||
type UpdateVMNicIP struct {
|
||||
_ bool `name:"updateVmNicIp" description:"Update the default Ip of a VM Nic"`
|
||||
IPAddress net.IP `json:"ipaddress,omitempty" doc:"Static IP address lease for the corresponding NIC and network which should be in the range defined in the network. If absent, the call removes the lease associated with the nic."`
|
||||
NicID *UUID `json:"nicid" doc:"the ID of the nic."`
|
||||
}
|
||||
|
||||
func (MigrateVirtualMachine) response() interface{} {
|
||||
// Response returns the struct to unmarshal
|
||||
func (UpdateVMNicIP) Response() interface{} {
|
||||
return new(AsyncJobResult)
|
||||
}
|
||||
|
||||
func (MigrateVirtualMachine) asyncResponse() interface{} {
|
||||
// AsyncResponse returns the struct to unmarshal the async job
|
||||
func (UpdateVMNicIP) AsyncResponse() interface{} {
|
||||
return new(VirtualMachine)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue