Versions in this module Expand all Collapse all v1 v1.0.3 Apr 18, 2022 v1.0.2 Apr 18, 2022 Changes in this version + const TaskStatusCheckInterval + var Debug = new(bool) + 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 struct + IPAddresses []net.IP + MACAddress string + Name string + Statistics map[string]int64 + func (a *AgentNetworkInterface) UnmarshalJSON(b []byte) error + type Client struct + ApiUrl string + Otp string + Password string + TaskTimeout int + Username string + func NewClient(apiUrl string, hclient *http.Client, tls *tls.Config, proxyString string, ...) (client *Client, err error) + 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 struct + Arch string + BWLimit int + CMode string + CPULimit int + CPUUnits int + Clone string + CloneStorage string + Console bool + Cores int + Description string + Features QemuDevice + Force bool + Full bool + HaGroup string + HaState string + Hookscript string + Hostname string + IgnoreUnpackErrors bool + Lock string + Memory int + Mountpoints QemuDevices + Nameserver string + Networks QemuDevices + OnBoot bool + OsType string + Ostemplate string + Password string + Pool string + Protection bool + Restore bool + RootFs QemuDevice + SSHPublicKeys string + SearchDomain string + Snapname string + Start bool + Startup string + Storage string + Swap int + Tags string + Template bool + Tty int + Unique bool + Unprivileged bool + Unused []string + func NewConfigLxc() ConfigLxc + func NewConfigLxcFromApi(vmr *VmRef, client *Client) (config *ConfigLxc, err error) + func NewConfigLxcFromJson(io io.Reader) (config ConfigLxc, err error) + func (config ConfigLxc) CloneLxc(vmr *VmRef, client *Client) (err error) + func (config ConfigLxc) CreateLxc(vmr *VmRef, client *Client) (err error) + func (config ConfigLxc) UpdateConfig(vmr *VmRef, client *Client) (err error) + type ConfigQemu struct + Agent int + Args string + Balloon int + Bios string + Boot string + BootDisk string + CIcustom string + CIpassword string + CIuser string + Description string + DiskSize float64 + EFIDisk string + FullClone *int + HaGroup string + HaState string + Hotplug string + Ipconfig0 string + Ipconfig1 string + Ipconfig10 string + Ipconfig11 string + Ipconfig12 string + Ipconfig13 string + Ipconfig14 string + Ipconfig15 string + Ipconfig2 string + Ipconfig3 string + Ipconfig4 string + Ipconfig5 string + Ipconfig6 string + Ipconfig7 string + Ipconfig8 string + Ipconfig9 string + Machine string + Memory int + Name string + Nameserver string + Onboot bool + Pool string + QemuBrige string + QemuCores int + QemuCpu string + QemuDisks QemuDevices + QemuIso string + QemuKVM bool + QemuMacAddr string + QemuNetworks QemuDevices + QemuNicModel string + QemuNuma bool + QemuOs string + QemuPxe bool + QemuSerials QemuDevices + QemuSockets int + QemuUnusedDisks QemuDevices + QemuUsbs QemuDevices + QemuVcpus int + QemuVga QemuDevice + QemuVlanTag int + Scsihw string + Searchdomain string + Smbios1 string + Sshkeys string + Storage string + StorageType string + Tablet bool + Tags string + VmID int + func NewConfigQemuFromApi(vmr *VmRef, client *Client) (config *ConfigQemu, err error) + func NewConfigQemuFromJson(io io.Reader) (config *ConfigQemu, 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 (c ConfigQemu) String() string + func (config ConfigQemu) CloneVm(sourceVmr *VmRef, vmr *VmRef, client *Client) (err error) + func (config ConfigQemu) CreateVm(vmr *VmRef, client *Client) (err error) + func (config ConfigQemu) HasCloudInit() bool + func (config ConfigQemu) UpdateConfig(vmr *VmRef, client *Client) (err error) + type QemuDevice map[string]interface + func ParseConf(kvString string, confSeparator string, subConfSeparator string, ...) QemuDevice + func ParseLxcDisk(diskStr string) QemuDevice + func ParsePMConf(kvString string, implicitFirstKey string) QemuDevice + type QemuDeviceParam []string + type QemuDevices map[int]map[string]interface + type Response struct + Body []byte + Resp *http.Response + type Session struct + ApiUrl string + AuthTicket string + AuthToken string + CsrfToken string + Headers http.Header + func NewSession(apiUrl string, hclient *http.Client, proxyString string, tls *tls.Config) (session *Session, err error) + 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 struct + func NewVmRef(vmId int) (vmr *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