Documentation ¶
Index ¶
- func BuildNetworkInterface(interfaces []*NetworkInterface, nodeIndex int) []*api.NetworkInterface
- func Copy(dst interface{}, src interface{}) error
- func ToCIDR(address, netmask string) string
- type Configuration
- func (conf *Configuration) Clone(nodeIndex int) (*Configuration, error)
- func (conf *Configuration) Copy() *Configuration
- func (conf *Configuration) Create(name, userName, authKey string, cloudInit interface{}, network *Network, ...) (string, error)
- func (conf *Configuration) CreateWithContext(ctx *context.Context, name, userName, authKey string, cloudInit interface{}, ...) (string, error)
- func (conf *Configuration) Delete(vmuuid string) error
- func (conf *Configuration) DeleteWithContext(ctx *context.Context, vmuuid string) error
- func (conf *Configuration) Exists(name string) bool
- func (conf *Configuration) ExistsWithContext(ctx *context.Context, name string) bool
- func (conf *Configuration) FindInterface(ether *VNetDevice) *NetworkInterface
- func (conf *Configuration) FindPreferredIPAddress(devices []VNetDevice) string
- func (conf *Configuration) FindVMNet(name string) *NetworkInterface
- func (conf *Configuration) FindVNet(name string) (*NetworkDevice, error)
- func (conf *Configuration) FindVNetWithContext(ctx *context.Context, name string) (*NetworkDevice, error)
- func (conf *Configuration) GetClient() (api.VMWareDesktopAutoscalerServiceClient, error)
- func (conf *Configuration) PowerOff(name, mode string) error
- func (conf *Configuration) PowerOffWithContext(ctx *context.Context, vmuuid, mode string) error
- func (conf *Configuration) PowerOn(vmuuid string) error
- func (conf *Configuration) PowerOnWithContext(ctx *context.Context, vmuuid string) error
- func (conf *Configuration) RetrieveNetworkInfos(vmuuid string, nodeIndex int) error
- func (conf *Configuration) RetrieveNetworkInfosWithContext(ctx *context.Context, vmuuid string, nodeIndex int) error
- func (conf *Configuration) SetAutoStart(vmuuid string, autostart bool) error
- func (conf *Configuration) SetAutoStartWithContext(ctx *context.Context, vmuuid string, autostart bool) error
- func (conf *Configuration) SetClient(apiclient api.VMWareDesktopAutoscalerServiceClient)
- func (conf *Configuration) ShutdownGuest(vmuuid string) error
- func (conf *Configuration) ShutdownGuestWithContext(ctx *context.Context, vmuuid string) error
- func (conf *Configuration) Status(vmuuid string) (*Status, error)
- func (conf *Configuration) StatusWithContext(ctx *context.Context, vmuuid string) (*Status, error)
- func (conf *Configuration) UUID(name string) (string, error)
- func (conf *Configuration) UUIDWithContext(ctx *context.Context, name string) (string, error)
- func (conf *Configuration) VirtualMachineByName(name string) (*VirtualMachine, error)
- func (conf *Configuration) VirtualMachineByNameWithContext(ctx *context.Context, name string) (*VirtualMachine, error)
- func (conf *Configuration) VirtualMachineByUUID(vmuuid string) (*VirtualMachine, error)
- func (conf *Configuration) VirtualMachineByUUIDWithContext(ctx *context.Context, vmuuid string) (*VirtualMachine, error)
- func (conf *Configuration) VirtualMachineList() ([]*VirtualMachine, error)
- func (conf *Configuration) VirtualMachineListWithContext(ctx *context.Context) ([]*VirtualMachine, error)
- func (conf *Configuration) WaitForIP(vmuuid string, timeout time.Duration) (string, error)
- func (conf *Configuration) WaitForIPWithContext(ctx *context.Context, vmuuid string, timeout time.Duration) (string, error)
- func (conf *Configuration) WaitForPowerState(vmuuid string, wanted bool) error
- func (conf *Configuration) WaitForPowerStateWithContenxt(ctx *context.Context, vmuuid string, wanted bool) error
- func (conf *Configuration) WaitForToolsRunning(vmuuid string, timeout time.Duration) (bool, error)
- func (conf *Configuration) WaitForToolsRunningWithContext(ctx *context.Context, vmuuid string, timeout time.Duration) (bool, error)
- type GuestInfos
- type Nameserver
- type Network
- type NetworkAdapter
- type NetworkConfig
- type NetworkDeclare
- type NetworkDevice
- type NetworkInterface
- type NetworkResolv
- type Status
- type VNetDevice
- type VirtualMachine
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildNetworkInterface ¶
func BuildNetworkInterface(interfaces []*NetworkInterface, nodeIndex int) []*api.NetworkInterface
Types ¶
type Configuration ¶
type Configuration struct { //Configuration *api.Configuration `json:"configuration"` NodeGroup string `json:"nodegroup"` Timeout time.Duration `json:"timeout"` TemplateUUID string `json:"template"` TimeZone string `json:"time-zone"` LinkedClone bool `json:"linked"` Autostart bool `json:"autostart"` Network *Network `json:"network"` AllowUpgrade bool `json:"allow-upgrade"` // contains filtered or unexported fields }
Configuration declares desktop connection info
func (*Configuration) Clone ¶
func (conf *Configuration) Clone(nodeIndex int) (*Configuration, error)
Clone duplicate the conf, change ip address in network config if needed
func (*Configuration) Create ¶
func (conf *Configuration) Create(name, userName, authKey string, cloudInit interface{}, network *Network, memory, cpus, disk, nodeIndex int) (string, error)
Create will create a named VM not powered memory and disk are in megabytes
func (*Configuration) CreateWithContext ¶
func (conf *Configuration) CreateWithContext(ctx *context.Context, name, userName, authKey string, cloudInit interface{}, network *Network, memory, cpus, disk, nodeIndex int) (string, error)
CreateWithContext will create a named VM not powered memory and disk are in megabytes Return vm UUID
func (*Configuration) Delete ¶
func (conf *Configuration) Delete(vmuuid string) error
Delete a VM by vmuuid
func (*Configuration) DeleteWithContext ¶
func (conf *Configuration) DeleteWithContext(ctx *context.Context, vmuuid string) error
DeleteWithContext a VM by UUID
func (*Configuration) Exists ¶
func (conf *Configuration) Exists(name string) bool
func (*Configuration) ExistsWithContext ¶
func (conf *Configuration) ExistsWithContext(ctx *context.Context, name string) bool
ExistsWithContext return the current status of VM by name
func (*Configuration) FindInterface ¶
func (conf *Configuration) FindInterface(ether *VNetDevice) *NetworkInterface
func (*Configuration) FindPreferredIPAddress ¶
func (conf *Configuration) FindPreferredIPAddress(devices []VNetDevice) string
func (*Configuration) FindVMNet ¶
func (conf *Configuration) FindVMNet(name string) *NetworkInterface
func (*Configuration) FindVNet ¶
func (conf *Configuration) FindVNet(name string) (*NetworkDevice, error)
func (*Configuration) FindVNetWithContext ¶
func (conf *Configuration) FindVNetWithContext(ctx *context.Context, name string) (*NetworkDevice, error)
func (*Configuration) GetClient ¶
func (conf *Configuration) GetClient() (api.VMWareDesktopAutoscalerServiceClient, error)
func (*Configuration) PowerOff ¶
func (conf *Configuration) PowerOff(name, mode string) error
PowerOff power off a VM by name
func (*Configuration) PowerOffWithContext ¶
func (conf *Configuration) PowerOffWithContext(ctx *context.Context, vmuuid, mode string) error
PowerOffWithContext power off a VM by vmuuid
func (*Configuration) PowerOn ¶
func (conf *Configuration) PowerOn(vmuuid string) error
PowerOn power on a VM by vmuuid
func (*Configuration) PowerOnWithContext ¶
func (conf *Configuration) PowerOnWithContext(ctx *context.Context, vmuuid string) error
PowerOnWithContext power on a VM by vmuuid
func (*Configuration) RetrieveNetworkInfos ¶
func (conf *Configuration) RetrieveNetworkInfos(vmuuid string, nodeIndex int) error
func (*Configuration) RetrieveNetworkInfosWithContext ¶
func (*Configuration) SetAutoStart ¶
func (conf *Configuration) SetAutoStart(vmuuid string, autostart bool) error
SetAutoStart set autostart for the VM
func (*Configuration) SetAutoStartWithContext ¶
func (conf *Configuration) SetAutoStartWithContext(ctx *context.Context, vmuuid string, autostart bool) error
SetAutoStartWithContext set autostart for the VM
func (*Configuration) SetClient ¶
func (conf *Configuration) SetClient(apiclient api.VMWareDesktopAutoscalerServiceClient)
func (*Configuration) ShutdownGuest ¶
func (conf *Configuration) ShutdownGuest(vmuuid string) error
ShutdownGuest power off a VM by vmuuid
func (*Configuration) ShutdownGuestWithContext ¶
func (conf *Configuration) ShutdownGuestWithContext(ctx *context.Context, vmuuid string) error
ShutdownGuestWithContext power off a VM by vmuuid
func (*Configuration) Status ¶
func (conf *Configuration) Status(vmuuid string) (*Status, error)
Status return the current status of VM by vmuuid
func (*Configuration) StatusWithContext ¶
StatusWithContext return the current status of VM by vmuuid
func (*Configuration) UUID ¶
func (conf *Configuration) UUID(name string) (string, error)
UUID get VM UUID by name
func (*Configuration) UUIDWithContext ¶
UUID get VM UUID by name
func (*Configuration) VirtualMachineByName ¶
func (conf *Configuration) VirtualMachineByName(name string) (*VirtualMachine, error)
VirtualMachine Retrieve VM by vmuuid
func (*Configuration) VirtualMachineByNameWithContext ¶
func (conf *Configuration) VirtualMachineByNameWithContext(ctx *context.Context, name string) (*VirtualMachine, error)
VirtualMachineWithContext Retrieve VM by name
func (*Configuration) VirtualMachineByUUID ¶
func (conf *Configuration) VirtualMachineByUUID(vmuuid string) (*VirtualMachine, error)
VirtualMachine Retrieve VM by vmuuid
func (*Configuration) VirtualMachineByUUIDWithContext ¶
func (conf *Configuration) VirtualMachineByUUIDWithContext(ctx *context.Context, vmuuid string) (*VirtualMachine, error)
VirtualMachineWithContext Retrieve VM by vmuuid
func (*Configuration) VirtualMachineList ¶
func (conf *Configuration) VirtualMachineList() ([]*VirtualMachine, error)
VirtualMachineList return all VM for the current datastore
func (*Configuration) VirtualMachineListWithContext ¶
func (conf *Configuration) VirtualMachineListWithContext(ctx *context.Context) ([]*VirtualMachine, error)
VirtualMachineListWithContext return all VM for the current datastore
func (*Configuration) WaitForIPWithContext ¶
func (conf *Configuration) WaitForIPWithContext(ctx *context.Context, vmuuid string, timeout time.Duration) (string, error)
WaitForIPWithContext wait ip a VM by vmuuid
func (*Configuration) WaitForPowerState ¶
func (conf *Configuration) WaitForPowerState(vmuuid string, wanted bool) error
func (*Configuration) WaitForPowerStateWithContenxt ¶
func (*Configuration) WaitForToolsRunning ¶
WaitForToolsRunning wait vmware tools is running a VM by vmuuid
func (*Configuration) WaitForToolsRunningWithContext ¶
func (conf *Configuration) WaitForToolsRunningWithContext(ctx *context.Context, vmuuid string, timeout time.Duration) (bool, error)
WaitForToolsRunningWithContext wait vmware tools is running a VM by vmuuid
type GuestInfos ¶
GuestInfos the guest infos Must not start with `guestinfo.`
func BuildCloudInit ¶
func BuildCloudInit(hostName, userName, authKey, tz string, cloudInit interface{}, network *Network, nodeIndex int, allowUpgrade bool) (GuestInfos, error)
BuildCloudInit build map for guestinfo
type Nameserver ¶
type Nameserver struct { Search []string `json:"search,omitempty" yaml:"search,omitempty"` Addresses []string `json:"addresses,omitempty" yaml:"addresses,omitempty"` }
Nameserver declaration
type Network ¶
type Network struct { Domain string `json:"domain,omitempty" yaml:"domain,omitempty"` Interfaces []*NetworkInterface `json:"interfaces,omitempty" yaml:"interfaces,omitempty"` DNS *NetworkResolv `json:"dns,omitempty" yaml:"dns,omitempty"` }
Network describes a card adapter
func (*Network) GetCloudInitNetwork ¶
func (net *Network) GetCloudInitNetwork(nodeIndex int) *NetworkDeclare
GetCloudInitNetwork create cloud-init object
func (*Network) GetDeclaredExistingInterfaces ¶
func (net *Network) GetDeclaredExistingInterfaces() []*NetworkInterface
GetDeclaredExistingInterfaces return the declared existing interfaces
func (*Network) UpdateMacAddressTable ¶
type NetworkAdapter ¶
type NetworkAdapter struct { DHCP4 bool `json:"dhcp4,omitempty" yaml:"dhcp4,omitempty"` NicName *string `json:"set-name,omitempty" yaml:"set-name,omitempty"` Match *map[string]string `json:"match,omitempty" yaml:"match,omitempty"` Gateway4 *string `json:"gateway4,omitempty" yaml:"gateway4,omitempty"` Addresses *[]string `json:"addresses,omitempty" yaml:"addresses,omitempty"` Nameservers *Nameserver `json:"nameservers,omitempty" yaml:"nameservers,omitempty"` DHCPOverrides *map[string]interface{} `json:"dhcp4-overrides,omitempty" yaml:"dhcp4-overrides,omitempty"` Routes *[]v1alpha1.NetworkRoutes `json:"routes,omitempty" yaml:"routes,omitempty"` }
NetworkAdapter wrapper
type NetworkConfig ¶
type NetworkConfig struct { InstanceID string `json:"instance-id,omitempty" yaml:"instance-id,omitempty"` LocalHostname string `json:"local-hostname,omitempty" yaml:"local-hostname,omitempty"` Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty"` Network *NetworkDeclare `json:"network,omitempty" yaml:"network,omitempty"` }
NetworkConfig wrapper
type NetworkDeclare ¶
type NetworkDeclare struct { Version int `json:"version,omitempty" yaml:"version,omitempty"` Ethernets map[string]*NetworkAdapter `json:"ethernets,omitempty" yaml:"ethernets,omitempty"` }
NetworkDeclare wrapper
type NetworkDevice ¶
type NetworkDevice struct { Name string `json:"name,omitempty" yaml:"name,omitempty"` Type string `json:"type,omitempty" yaml:"type,omitempty"` Dhcp bool `json:"dhcp,omitempty" yaml:"dhcp,omitempty"` Subnet string `json:"subnet,omitempty" yaml:"subnet,omitempty"` Mask string `json:"mask,omitempty" yaml:"mask,omitempty"` }
type NetworkInterface ¶
type NetworkInterface struct { Primary bool `json:"primary,omitempty" yaml:"primary,omitempty"` Existing bool `json:"exists,omitempty" yaml:"exists,omitempty"` ConnectionType string `default:"nat" json:"type,omitempty" yaml:"type,omitempty"` VNet string `json:"vnet,omitempty" yaml:"vnet,omitempty"` VirtualDev string `default:"vmxnet3" json:"device,omitempty" yaml:"device,omitempty"` BsdName string `json:"bsd-name,omitempty" yaml:"bsd-name,omitempty"` DisplayName string `json:"display-name,omitempty" yaml:"display-name,omitempty"` MacAddress string `json:"mac-address,omitempty" yaml:"mac-address,omitempty"` NicName string `json:"nic,omitempty" yaml:"nic,omitempty"` DHCP bool `json:"dhcp,omitempty" yaml:"dhcp,omitempty"` UseRoutes bool `default:"true" json:"use-dhcp-routes,omitempty" yaml:"use-dhcp-routes,omitempty"` IPAddress string `json:"address,omitempty" yaml:"address,omitempty"` Netmask string `json:"netmask,omitempty" yaml:"netmask,omitempty"` Gateway string `json:"gateway,omitempty" yaml:"gateway,omitempty"` Routes []v1alpha1.NetworkRoutes `json:"routes,omitempty" yaml:"routes,omitempty"` }
NetworkInterface declare single interface
func (*NetworkInterface) AttachMacAddress ¶
func (net *NetworkInterface) AttachMacAddress(address string, nodeIndex int)
func (*NetworkInterface) GetMacAddress ¶
func (net *NetworkInterface) GetMacAddress(nodeIndex int) string
GetMacAddress return a macaddress
func (*NetworkInterface) Same ¶
func (inf *NetworkInterface) Same(connectionType, vnet string) bool
type NetworkResolv ¶
type NetworkResolv struct { Search []string `json:"search,omitempty" yaml:"search,omitempty"` Nameserver []string `json:"nameserver,omitempty" yaml:"nameserver,omitempty"` }
NetworkResolv /etc/resolv.conf
type VNetDevice ¶
type VNetDevice struct { AddressType string `json:"addressType,omitempty" yaml:"addressType,omitempty"` BsdName string `json:"bsdName,omitempty" yaml:"bsdName,omitempty"` ConnectionType string `json:"connectionType,omitempty" yaml:"connectionType,omitempty"` DisplayName string `json:"displayName,omitempty" yaml:"displayName,omitempty"` GeneratedAddress string `json:"generatedAddress,omitempty" yaml:"generatedAddress,omitempty"` GeneratedAddressOffset int32 `json:"generatedAddressOffset,omitempty" yaml:"generatedAddressOffset,omitempty"` LinkStatePropagation bool `json:"linkStatePropagation,omitempty" yaml:"linkStatePropagation,omitempty"` PciSlotNumber int32 `json:"pciSlotNumber,omitempty" yaml:"pciSlotNumber,omitempty"` Present bool `json:"present,omitempty" yaml:"present,omitempty"` VirtualDevice string `json:"virtualDev,omitempty" yaml:"virtualDev,omitempty"` VNet string `json:"vnet,omitempty" yaml:"vnet,omitempty"` Address string `json:"address,omitempty" yaml:"address,omitempty"` }
VMNetDevice declare single interface