Documentation ¶
Index ¶
- Constants
- Variables
- func DiskSizeGB(dcSize interface{}) float64
- func FormatDiskParam(disk QemuDevice) string
- func FormatUsbParam(usb QemuDevice) string
- func Itob(i int) bool
- func MaxVmId(client *Client) (max int, err error)
- func ParamsToBody(params map[string]interface{}) (body []byte)
- func ParamsToBodyWithEmpty(params map[string]interface{}, allowedEmpty []string) (body []byte)
- func ParamsToValues(params map[string]interface{}) (vals url.Values)
- func ParamsToValuesWithEmpty(params map[string]interface{}, allowedEmpty []string) (vals url.Values)
- func ParseSubConf(element string, separator string) (key string, value interface{})
- func RemoveSshForwardUsernet(vmr *VmRef, client *Client) (err error)
- func ResponseJSON(resp *http.Response) (jbody map[string]interface{}, err error)
- func SendKeysString(vmr *VmRef, client *Client, keys string) (err error)
- func SshForwardUsernet(vmr *VmRef, client *Client) (sshPort string, err error)
- func TypedResponse(resp *http.Response, v interface{}) error
- func WaitForShutdown(vmr *VmRef, client *Client) (err error)
- type AgentNetworkInterface
- type Client
- func (c *Client) AddQemuIPSet(vmr *VmRef, name string, params map[string]interface{}) (exitStatus interface{}, err error)
- func (c *Client) CheckVmRef(vmr *VmRef) (err error)
- func (c *Client) CloneLxcContainer(vmr *VmRef, vmParams map[string]interface{}) (exitStatus string, err error)
- func (c *Client) CloneQemuVm(vmr *VmRef, vmParams map[string]interface{}) (exitStatus string, err error)
- func (c *Client) CreateLxcContainer(node string, vmParams map[string]interface{}) (exitStatus string, err error)
- func (c *Client) CreatePool(poolid string, comment string) error
- func (c *Client) CreateQemuIPSet(vmr *VmRef, params map[string]interface{}) (exitStatus interface{}, err error)
- func (c *Client) CreateQemuSnapshot(vmr *VmRef, snapshotName string) (exitStatus string, err error)
- func (c *Client) CreateQemuVm(node string, vmParams map[string]interface{}) (exitStatus string, err error)
- func (c *Client) CreateTemplate(vmr *VmRef) error
- func (c *Client) CreateVMDisk(nodeName string, storageName string, fullDiskName string, ...) error
- func (c *Client) CreateVNCProxy(vmr *VmRef, params map[string]interface{}) (vncProxyRes map[string]interface{}, err error)
- func (c *Client) DeletePool(poolid string) error
- func (c *Client) DeleteQemuIPSet(vmr *VmRef, IPSetName string) (exitStatus interface{}, err error)
- func (c *Client) DeleteQemuIPSetNetwork(vmr *VmRef, IPSetName string, network string, params map[string]interface{}) (exitStatus interface{}, err error)
- func (c *Client) DeleteQemuSnapshot(vmr *VmRef, snapshotName string) (exitStatus string, err error)
- func (c *Client) DeleteVMDisks(node string, disks []string) error
- func (c *Client) DeleteVm(vmr *VmRef) (exitStatus string, err error)
- func (c *Client) DeleteVmParams(vmr *VmRef, params map[string]interface{}) (exitStatus string, err error)
- func (c *Client) DeleteVolume(vmr *VmRef, storageName string, volumeName string) (exitStatus interface{}, err error)
- func (c *Client) GetExecStatus(vmr *VmRef, pid string) (status map[string]interface{}, err error)
- func (c *Client) GetJsonRetryable(url string, data *map[string]interface{}, tries int) error
- func (c *Client) GetNextID(currentID int) (nextID int, err error)
- func (c *Client) GetNodeList() (list map[string]interface{}, err error)
- func (c *Client) GetPoolInfo(poolid string) (poolInfo map[string]interface{}, err error)
- func (c *Client) GetPoolList() (pools map[string]interface{}, err error)
- func (c *Client) GetQemuFirewallOptions(vmr *VmRef) (firewallOptions map[string]interface{}, err error)
- func (c *Client) GetQemuIPSet(vmr *VmRef) (ipsets map[string]interface{}, err error)
- func (c *Client) GetStorageContent(vmr *VmRef, storageName string) (data map[string]interface{}, err error)
- func (c *Client) GetStorageStatus(vmr *VmRef, storageName string) (storageStatus map[string]interface{}, err error)
- func (c *Client) GetTaskExitstatus(taskUpid string) (exitStatus interface{}, err error)
- func (c *Client) GetVersion() (data map[string]interface{}, err error)
- func (c *Client) GetVmAgentNetworkInterfaces(vmr *VmRef) ([]AgentNetworkInterface, error)
- func (c *Client) GetVmConfig(vmr *VmRef) (vmConfig map[string]interface{}, err error)
- func (c *Client) GetVmInfo(vmr *VmRef) (vmInfo map[string]interface{}, err error)
- func (c *Client) GetVmList() (list map[string]interface{}, err error)
- func (c *Client) GetVmRefByName(vmName string) (vmr *VmRef, err error)
- func (c *Client) GetVmRefsByName(vmName string) (vmrs []*VmRef, err error)
- func (c *Client) GetVmSpiceProxy(vmr *VmRef) (vmSpiceProxy map[string]interface{}, err error)
- func (c *Client) GetVmState(vmr *VmRef) (vmState map[string]interface{}, err error)
- func (c *Client) ListQemuSnapshot(vmr *VmRef) (taskResponse map[string]interface{}, exitStatus string, err error)
- func (c *Client) Login(username string, password string, otp string) (err error)
- func (c *Client) MigrateNode(vmr *VmRef, newTargetNode string, online bool) (exitStatus interface{}, err error)
- func (c *Client) MonitorCmd(vmr *VmRef, command string) (monitorRes map[string]interface{}, err error)
- func (c *Client) MoveLxcDisk(vmr *VmRef, disk string, storage string) (exitStatus interface{}, err error)
- func (c *Client) MoveQemuDisk(vmr *VmRef, disk string, storage string) (exitStatus interface{}, err error)
- func (c *Client) QemuAgentExec(vmr *VmRef, params map[string]interface{}) (result map[string]interface{}, err error)
- func (c *Client) QemuAgentFileWrite(vmr *VmRef, params map[string]interface{}) (err error)
- func (c *Client) QemuAgentPing(vmr *VmRef) (pingRes map[string]interface{}, err error)
- func (c *Client) QemuAgentSetUserPassword(vmr *VmRef, params map[string]interface{}) (result map[string]interface{}, err error)
- func (c *Client) ReadVMHA(vmr *VmRef) (err error)
- func (c *Client) ResetVm(vmr *VmRef) (exitStatus string, err error)
- func (c *Client) ResizeQemuDisk(vmr *VmRef, disk string, moreSizeGB int) (exitStatus interface{}, err error)
- func (c *Client) ResizeQemuDiskRaw(vmr *VmRef, disk string, size string) (exitStatus interface{}, err error)
- func (c *Client) ResumeVm(vmr *VmRef) (exitStatus string, err error)
- func (c *Client) RollbackQemuVm(vmr *VmRef, snapshot string) (exitStatus string, err error)
- func (c *Client) Sendkey(vmr *VmRef, qmKey string) error
- func (c *Client) SetAPIToken(userID, token string)
- func (c *Client) SetLxcConfig(vmr *VmRef, vmParams map[string]interface{}) (exitStatus interface{}, err error)
- func (c *Client) SetQemuFirewallOptions(vmr *VmRef, fwOptions map[string]interface{}) (exitStatus interface{}, err error)
- func (c *Client) SetVmConfig(vmr *VmRef, vmParams map[string]interface{}) (exitStatus interface{}, err error)
- func (c *Client) ShutdownVm(vmr *VmRef) (exitStatus string, err error)
- func (c *Client) StartVm(vmr *VmRef) (exitStatus string, err error)
- func (c *Client) StatusChangeVm(vmr *VmRef, setStatus string) (exitStatus string, err error)
- func (c *Client) StopVm(vmr *VmRef) (exitStatus string, err error)
- func (c *Client) SuspendVm(vmr *VmRef) (exitStatus string, err error)
- func (c *Client) UpdatePoolComment(poolid string, comment string) error
- func (c *Client) UpdateVMHA(vmr *VmRef, haState string, haGroup string) (exitStatus interface{}, err error)
- func (c *Client) UpdateVMPool(vmr *VmRef, pool string) (exitStatus interface{}, err error)
- func (c *Client) Upload(node string, storage string, contentType string, filename string, ...) error
- func (c *Client) VMIdExists(vmID int) (id int, err error)
- func (c *Client) VzDump(vmr *VmRef, params map[string]interface{}) (exitStatus interface{}, err error)
- func (c *Client) WaitForCompletion(taskResponse map[string]interface{}) (waitExitStatus string, err error)
- type ConfigLxc
- type ConfigQemu
- func (config ConfigQemu) CloneVm(sourceVmr *VmRef, vmr *VmRef, client *Client) (err error)
- func (c ConfigQemu) CreateQemuDisksParams(vmID int, params map[string]interface{}, cloned bool) error
- func (c ConfigQemu) CreateQemuMachineParam(params map[string]interface{}) error
- func (c ConfigQemu) CreateQemuNetworksParams(vmID int, params map[string]interface{}) error
- func (c ConfigQemu) CreateQemuSerialsParams(vmID int, params map[string]interface{}) error
- func (c ConfigQemu) CreateQemuUsbsParams(vmID int, params map[string]interface{}) error
- func (config ConfigQemu) CreateVm(vmr *VmRef, client *Client) (err error)
- func (config ConfigQemu) HasCloudInit() bool
- func (c ConfigQemu) String() string
- func (config ConfigQemu) UpdateConfig(vmr *VmRef, client *Client) (err error)
- type QemuDevice
- type QemuDeviceParam
- type QemuDevices
- type Response
- type Session
- func (s *Session) Delete(url string, params *url.Values, headers *http.Header) (resp *http.Response, err error)
- func (s *Session) Do(req *http.Request) (*http.Response, error)
- func (s *Session) Get(url string, params *url.Values, headers *http.Header) (resp *http.Response, err error)
- func (s *Session) GetJSON(url string, params *url.Values, headers *http.Header, ...) (resp *http.Response, err error)
- func (s *Session) Head(url string, params *url.Values, headers *http.Header) (resp *http.Response, err error)
- func (s *Session) Login(username string, password string, otp string) (err error)
- func (s *Session) NewRequest(method, url string, headers *http.Header, body io.Reader) (req *http.Request, err error)
- func (s *Session) Post(url string, params *url.Values, headers *http.Header, body *[]byte) (resp *http.Response, err error)
- func (s *Session) PostJSON(url string, params *url.Values, headers *http.Header, body interface{}, ...) (resp *http.Response, err error)
- func (s *Session) Put(url string, params *url.Values, headers *http.Header, body *[]byte) (resp *http.Response, err error)
- func (s *Session) Request(method string, url string, params *url.Values, headers *http.Header, ...) (resp *http.Response, err error)
- func (s *Session) RequestJSON(method string, url string, params *url.Values, headers *http.Header, ...) (resp *http.Response, err error)
- func (s *Session) SetAPIToken(userID, token string)
- type VmRef
- func (vmr *VmRef) GetVmType() string
- func (vmr *VmRef) HaGroup() string
- func (vmr *VmRef) HaState() string
- func (vmr *VmRef) Node() string
- func (vmr *VmRef) Pool() string
- func (vmr *VmRef) SetNode(node string)
- func (vmr *VmRef) SetPool(pool string)
- func (vmr *VmRef) SetVmType(vmType string)
- func (vmr *VmRef) VmId() int
Constants ¶
const TaskStatusCheckInterval = 2
TaskStatusCheckInterval - time between async checks in seconds
Variables ¶
var Debug = new(bool)
Functions ¶
func DiskSizeGB ¶
func DiskSizeGB(dcSize interface{}) float64
Convert a disk-size string to a GB float
func FormatDiskParam ¶
func FormatDiskParam(disk QemuDevice) string
Given a QemuDevice (represesting a disk), return a param string to give to ProxMox
func FormatUsbParam ¶
func FormatUsbParam(usb QemuDevice) string
Given a QemuDevice (represesting a usb), return a param string to give to ProxMox
func ParamsToBody ¶
func ParamsToBodyWithEmpty ¶
func ParamsToValues ¶
func ParamsToValuesWithEmpty ¶
func ParseSubConf ¶
ParseSubConf - Parse standard sub-conf strings `key=value`.
func RemoveSshForwardUsernet ¶
device_del net1 netdev_del net1
func ResponseJSON ¶
func SshForwardUsernet ¶
This is because proxmox create/config API won't let us make usernet devices
func TypedResponse ¶
func WaitForShutdown ¶
Useful waiting for ISO install to complete
Types ¶
type AgentNetworkInterface ¶
type AgentNetworkInterface struct { MACAddress string IPAddresses []net.IP Name string Statistics map[string]int64 }
func (*AgentNetworkInterface) UnmarshalJSON ¶
func (a *AgentNetworkInterface) UnmarshalJSON(b []byte) error
type Client ¶
type Client struct { ApiUrl string Username string Password string Otp string TaskTimeout int // contains filtered or unexported fields }
Client - URL, user and password to specifc Proxmox node
func (*Client) AddQemuIPSet ¶
func (c *Client) AddQemuIPSet(vmr *VmRef, name string, params map[string]interface{}) (exitStatus interface{}, err error)
AddQemuIPSet - Add IP or Network to IPSet.
func (*Client) CheckVmRef ¶
func (*Client) CloneLxcContainer ¶
func (*Client) CloneQemuVm ¶
func (*Client) CreateLxcContainer ¶
func (*Client) CreateQemuIPSet ¶
func (c *Client) CreateQemuIPSet(vmr *VmRef, params map[string]interface{}) (exitStatus interface{}, err error)
CreateQemuIPSet - Create new IPSet
func (*Client) CreateQemuSnapshot ¶
func (*Client) CreateQemuVm ¶
func (*Client) CreateTemplate ¶
func (*Client) CreateVMDisk ¶
func (c *Client) CreateVMDisk( nodeName string, storageName string, fullDiskName string, diskParams map[string]interface{}, ) error
CreateVMDisk - Create single disk for VM on host node.
func (*Client) CreateVNCProxy ¶
func (c *Client) CreateVNCProxy(vmr *VmRef, params map[string]interface{}) (vncProxyRes map[string]interface{}, err error)
CreateVNCProxy - Creates a TCP VNC proxy connections
func (*Client) DeletePool ¶
func (*Client) DeleteQemuIPSet ¶
DeleteQemuIPSet - Delete IPSet
func (*Client) DeleteQemuIPSetNetwork ¶
func (c *Client) DeleteQemuIPSetNetwork(vmr *VmRef, IPSetName string, network string, params map[string]interface{}) (exitStatus interface{}, err error)
DeleteQemuIPSetNetwork - Remove IP or Network from IPSet.
func (*Client) DeleteQemuSnapshot ¶
func (*Client) DeleteVMDisks ¶
DeleteVMDisks - Delete VM disks from host node. By default the VM disks are deteled when the VM is deleted, so mainly this is used to delete the disks in case VM creation didn't complete.
func (*Client) DeleteVmParams ¶
func (*Client) DeleteVolume ¶
func (c *Client) DeleteVolume(vmr *VmRef, storageName string, volumeName string) (exitStatus interface{}, err error)
DeleteVolume - Delete volume
func (*Client) GetExecStatus ¶
GetExecStatus - Gets the status of the given pid started by the guest-agent
func (*Client) GetJsonRetryable ¶
func (*Client) GetNodeList ¶
func (*Client) GetPoolInfo ¶
func (*Client) GetPoolList ¶
func (*Client) GetQemuFirewallOptions ¶
func (c *Client) GetQemuFirewallOptions(vmr *VmRef) (firewallOptions map[string]interface{}, err error)
GetQemuFirewallOptions - Get VM firewall options.
func (*Client) GetQemuIPSet ¶
GetQemuIPSet - List IPSets
func (*Client) GetStorageContent ¶
func (*Client) GetStorageStatus ¶
func (*Client) GetTaskExitstatus ¶
func (*Client) GetVersion ¶
func (*Client) GetVmAgentNetworkInterfaces ¶
func (c *Client) GetVmAgentNetworkInterfaces(vmr *VmRef) ([]AgentNetworkInterface, error)
func (*Client) GetVmConfig ¶
func (*Client) GetVmRefByName ¶
func (*Client) GetVmRefsByName ¶
func (*Client) GetVmSpiceProxy ¶
func (*Client) GetVmState ¶
func (*Client) ListQemuSnapshot ¶
func (*Client) MigrateNode ¶
func (c *Client) MigrateNode(vmr *VmRef, newTargetNode string, online bool) (exitStatus interface{}, err error)
MigrateNode - Migrate a VM
func (*Client) MonitorCmd ¶
func (*Client) MoveLxcDisk ¶
func (*Client) MoveQemuDisk ¶
func (*Client) QemuAgentExec ¶
func (c *Client) QemuAgentExec(vmr *VmRef, params map[string]interface{}) (result map[string]interface{}, err error)
QemuAgentExec - Executes the given command in the vm via the guest-agent and returns an object with the pid.
func (*Client) QemuAgentFileWrite ¶
QemuAgentFileWrite - Writes the given file via guest agent.
func (*Client) QemuAgentPing ¶
QemuAgentPing - Execute ping.
func (*Client) QemuAgentSetUserPassword ¶
func (c *Client) QemuAgentSetUserPassword(vmr *VmRef, params map[string]interface{}) (result map[string]interface{}, err error)
QemuAgentSetUserPassword - Sets the password for the given user to the given password.
func (*Client) ResizeQemuDisk ¶
func (c *Client) ResizeQemuDisk(vmr *VmRef, disk string, moreSizeGB int) (exitStatus interface{}, err error)
ResizeQemuDisk allows the caller to increase the size of a disk by the indicated number of gigabytes
func (*Client) ResizeQemuDiskRaw ¶
func (c *Client) ResizeQemuDiskRaw(vmr *VmRef, disk string, size string) (exitStatus interface{}, err error)
ResizeQemuDiskRaw allows the caller to provide the raw resize string to be send to proxmox. See the proxmox API documentation for full information, but the short version is if you prefix your desired size with a '+' character it will ADD size to the disk. If you just specify the size by itself it will do an absolute resizing to the specified size. Permitted suffixes are K, M, G, T to indicate order of magnitude (kilobyte, megabyte, etc). Decrease of disk size is not permitted.
func (*Client) RollbackQemuVm ¶
func (*Client) SetAPIToken ¶
SetAPIToken specifies a pair of user identifier and token UUID to use for authenticating API calls. If this is set, a ticket from calling `Login` will not be used.
- `userID` is expected to be in the form `USER@REALM!TOKENID` - `token` is just the UUID you get when initially creating the token
See https://pve.proxmox.com/wiki/User_Management#pveum_tokens
func (*Client) SetLxcConfig ¶
func (c *Client) SetLxcConfig(vmr *VmRef, vmParams map[string]interface{}) (exitStatus interface{}, err error)
SetLxcConfig - send config options
func (*Client) SetQemuFirewallOptions ¶
func (c *Client) SetQemuFirewallOptions(vmr *VmRef, fwOptions map[string]interface{}) (exitStatus interface{}, err error)
SetQemuFirewallOptions - Set Firewall options.
func (*Client) SetVmConfig ¶
func (c *Client) SetVmConfig(vmr *VmRef, vmParams map[string]interface{}) (exitStatus interface{}, err error)
SetVmConfig - send config options
func (*Client) StatusChangeVm ¶
func (*Client) UpdatePoolComment ¶
func (*Client) UpdateVMHA ¶
func (*Client) UpdateVMPool ¶
func (*Client) VMIdExists ¶
VMIdExists - If you pass an VMID that exists it will raise an error otherwise it will return the vmID
type ConfigLxc ¶
type ConfigLxc struct { Ostemplate string `json:"ostemplate"` Arch string `json:"arch"` BWLimit int `json:"bwlimit,omitempty"` Clone string `json:"clone,omitempty"` CloneStorage string `json:"clone-storage,omitempty"` CMode string `json:"cmode"` Console bool `json:"console"` Cores int `json:"cores,omitempty"` CPULimit int `json:"cpulimit"` CPUUnits int `json:"cpuunits"` Description string `json:"description,omitempty"` Features QemuDevice `json:"features,omitempty"` Force bool `json:"force,omitempty"` Full bool `json:"full,omitempty"` HaState string `json:"hastate,omitempty"` HaGroup string `json:"hagroup,omitempty"` Hookscript string `json:"hookscript,omitempty"` Hostname string `json:"hostname,omitempty"` IgnoreUnpackErrors bool `json:"ignore-unpack-errors,omitempty"` Lock string `json:"lock,omitempty"` Memory int `json:"memory"` Mountpoints QemuDevices `json:"mountpoints,omitempty"` Nameserver string `json:"nameserver,omitempty"` Networks QemuDevices `json:"networks,omitempty"` OnBoot bool `json:"onboot"` OsType string `json:"ostype,omitempty"` Password string `json:"password,omitempty"` Pool string `json:"pool,omitempty"` Protection bool `json:"protection"` Restore bool `json:"restore,omitempty"` RootFs QemuDevice `json:"rootfs,omitempty"` SearchDomain string `json:"searchdomain,omitempty"` Snapname string `json:"snapname,omitempty"` SSHPublicKeys string `json:"ssh-public-keys,omitempty"` Start bool `json:"start"` Startup string `json:"startup,omitempty"` Storage string `json:"storage"` Swap int `json:"swap"` Template bool `json:"template,omitempty"` Tty int `json:"tty"` Unique bool `json:"unique,omitempty"` Unprivileged bool `json:"unprivileged"` Tags string `json:"tags"` Unused []string `json:"unused,omitempty"` }
LXC options for the Proxmox API
func NewConfigLxc ¶
func NewConfigLxc() ConfigLxc
func NewConfigLxcFromApi ¶
type ConfigQemu ¶
type ConfigQemu struct { VmID int `json:"vmid"` Name string `json:"name"` Description string `json:"desc"` Pool string `json:"pool,omitempty"` Bios string `json:"bios"` EFIDisk string `json:"efidisk,omitempty"` Machine string `json:"machine,omitempty"` Onboot bool `json:"onboot"` Tablet bool `json:"tablet"` Agent int `json:"agent"` Memory int `json:"memory"` Balloon int `json:"balloon"` QemuOs string `json:"os"` QemuCores int `json:"cores"` QemuSockets int `json:"sockets"` QemuVcpus int `json:"vcpus"` QemuCpu string `json:"cpu"` QemuNuma bool `json:"numa"` QemuKVM bool `json:"kvm"` Hotplug string `json:"hotplug"` QemuIso string `json:"iso"` QemuPxe bool `json:"pxe"` FullClone *int `json:"fullclone"` Boot string `json:"boot"` BootDisk string `json:"bootdisk,omitempty"` Scsihw string `json:"scsihw,omitempty"` QemuDisks QemuDevices `json:"disk"` QemuUnusedDisks QemuDevices `json:"unused_disk"` QemuVga QemuDevice `json:"vga,omitempty"` QemuNetworks QemuDevices `json:"network"` QemuSerials QemuDevices `json:"serial,omitempty"` QemuUsbs QemuDevices `json:"usb,omitempty"` HaState string `json:"hastate,omitempty"` HaGroup string `json:"hagroup,omitempty"` Tags string `json:"tags"` Args string `json:"args"` // Deprecated single disk. DiskSize float64 `json:"diskGB"` Storage string `json:"storage"` StorageType string `json:"storageType"` // virtio|scsi (cloud-init defaults to scsi) // Deprecated single nic. QemuNicModel string `json:"nic"` QemuBrige string `json:"bridge"` QemuVlanTag int `json:"vlan"` QemuMacAddr string `json:"mac"` // cloud-init options CIuser string `json:"ciuser"` CIpassword string `json:"cipassword"` CIcustom string `json:"cicustom"` Searchdomain string `json:"searchdomain"` Nameserver string `json:"nameserver"` Sshkeys string `json:"sshkeys"` // Tpm configuration TpmEnabled bool `json:"tpm_enabled"` TpmStorage string `json:"tpm_storage"` TpmVersion string `json:"tpm_version"` // arrays are hard, support 16 interfaces for now Ipconfig0 string `json:"ipconfig0"` Ipconfig1 string `json:"ipconfig1"` Ipconfig2 string `json:"ipconfig2"` Ipconfig3 string `json:"ipconfig3"` Ipconfig4 string `json:"ipconfig4"` Ipconfig5 string `json:"ipconfig5"` Ipconfig6 string `json:"ipconfig6"` Ipconfig7 string `json:"ipconfig7"` Ipconfig8 string `json:"ipconfig8"` Ipconfig9 string `json:"ipconfig9"` Ipconfig10 string `json:"ipconfig10"` Ipconfig11 string `json:"ipconfig11"` Ipconfig12 string `json:"ipconfig12"` Ipconfig13 string `json:"ipconfig13"` Ipconfig14 string `json:"ipconfig14"` Ipconfig15 string `json:"ipconfig15"` }
ConfigQemu - Proxmox API QEMU options
func NewConfigQemuFromApi ¶
func NewConfigQemuFromApi(vmr *VmRef, client *Client) (config *ConfigQemu, err error)
func NewConfigQemuFromJson ¶
func NewConfigQemuFromJson(io io.Reader) (config *ConfigQemu, err error)
func (ConfigQemu) CloneVm ¶
func (config ConfigQemu) CloneVm(sourceVmr *VmRef, vmr *VmRef, client *Client) (err error)
CloneVm Example: Request
nodes/proxmox1-xx/qemu/1012/clone
newid:145 name:tf-clone1 target:proxmox1-xx full:1 storage:xxx
func (ConfigQemu) CreateQemuDisksParams ¶
func (c ConfigQemu) CreateQemuDisksParams( vmID int, params map[string]interface{}, cloned bool, ) error
Create parameters for each disk.
func (ConfigQemu) CreateQemuMachineParam ¶
func (c ConfigQemu) CreateQemuMachineParam( params map[string]interface{}, ) error
Create parameters for serial interface
func (ConfigQemu) CreateQemuNetworksParams ¶
func (c ConfigQemu) CreateQemuNetworksParams(vmID int, params map[string]interface{}) error
Create parameters for each Nic device.
func (ConfigQemu) CreateQemuSerialsParams ¶
func (c ConfigQemu) CreateQemuSerialsParams( vmID int, params map[string]interface{}, ) error
Create parameters for serial interface
func (ConfigQemu) CreateQemuUsbsParams ¶
func (c ConfigQemu) CreateQemuUsbsParams( vmID int, params map[string]interface{}, ) error
Create parameters for usb interface
func (ConfigQemu) CreateVm ¶
func (config ConfigQemu) CreateVm(vmr *VmRef, client *Client) (err error)
CreateVm - Tell Proxmox API to make the VM
func (ConfigQemu) HasCloudInit ¶
func (config ConfigQemu) HasCloudInit() bool
HasCloudInit - are there cloud-init options?
func (ConfigQemu) String ¶
func (c ConfigQemu) String() string
func (ConfigQemu) UpdateConfig ¶
func (config ConfigQemu) UpdateConfig(vmr *VmRef, client *Client) (err error)
type QemuDevice ¶
type QemuDevice map[string]interface{}
func ParseConf ¶
func ParseConf( kvString string, confSeparator string, subConfSeparator string, implicitFirstKey string, ) QemuDevice
ParseConf - Parse standard device conf string `key1=val1,key2=val2`.
func ParseLxcDisk ¶
func ParseLxcDisk(diskStr string) QemuDevice
func ParsePMConf ¶
func ParsePMConf( kvString string, implicitFirstKey string, ) QemuDevice
type QemuDeviceParam ¶
type QemuDeviceParam []string
type QemuDevices ¶
type Session ¶
type Session struct { ApiUrl string AuthTicket string CsrfToken string AuthToken string // Combination of user, realm, token ID and UUID Headers http.Header // contains filtered or unexported fields }
func NewSession ¶
func (*Session) NewRequest ¶
func (*Session) Request ¶
func (s *Session) Request( method string, url string, params *url.Values, headers *http.Header, body *[]byte, ) (resp *http.Response, err error)
Perform a simple get to an endpoint
func (*Session) RequestJSON ¶
func (s *Session) RequestJSON( method string, url string, params *url.Values, headers *http.Header, body interface{}, responseContainer interface{}, ) (resp *http.Response, err error)
Perform a simple get to an endpoint and unmarshall returned JSON
func (*Session) SetAPIToken ¶
type VmRef ¶
type VmRef struct {
// contains filtered or unexported fields
}
VmRef - virtual machine ref parts map[type:qemu node:proxmox1-xx id:qemu/132 diskread:5.57424738e+08 disk:0 netin:5.9297450593e+10 mem:3.3235968e+09 uptime:1.4567097e+07 vmid:132 template:0 maxcpu:2 netout:6.053310416e+09 maxdisk:3.4359738368e+10 maxmem:8.592031744e+09 diskwrite:1.49663619584e+12 status:running cpu:0.00386980694947209 name:appt-app1-dev.xxx.xx]