proxmox

package
v0.0.0-...-d375e5b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Error_IsoFile_File    string = "file may not be empty"
	Error_IsoFile_Storage string = "storage may not be empty"
)
View Source
const (
	Error_QemuCloudInitDisk_Storage string = "storage should not be empty"
	Error_QemuCloudInitDisk_OnlyOne string = "only one cloud init disk may exist"
)
View Source
const (
	Error_QemuDisk_File              string = "file may not be empty"
	Error_QemuDisk_MutuallyExclusive string = "settings cdrom,cloudinit,disk,passthrough are mutually exclusive"
	Error_QemuDisk_Size              string = "size must be greater then 0"
	Error_QemuDisk_Storage           string = "storage may not be empty"
)
View Source
const (
	Error_QemuDiskSerial_IllegalCharacter string = "serial may only contain the following characters: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-_"
	Error_QemuDiskSerial_IllegalLength    string = "serial may only be 60 characters long"
)
View Source
const DebugLargeBodyThreshold = 5 * 1024 * 1024
View Source
const (
	ERROR_QemuDiskId_Invalid string = "invalid Disk ID"
)
View Source
const Error_NewUserID string = "no username or realm specified, syntax is \"username@realm\""
View Source
const (
	Error_QemuCdRom_MutuallyExclusive string = "iso and passthrough are mutually exclusive"
)
View Source
const (
	Error_QemuDiskBandwidthIopsLimitBurst string = "burst may not be lower then 10 except for 0"
)
View Source
const (
	Error_QemuDiskBandwidthIopsLimitConcurrent string = "concurrent may not be lower then 10 except for 0"
)
View Source
const (
	Error_QemuDiskBandwidthMBpsLimitBurst string = "burst may not be lower then 1 except for 0"
)
View Source
const (
	Error_QemuDiskBandwidthMBpsLimitConcurrent string = "concurrent may not be lower then 1 except for 0"
)
View Source
const TaskStatusCheckInterval = 2

TaskStatusCheckInterval - time between async checks in seconds

Variables

View Source
var Debug = new(bool)

Functions

func AddToList

func AddToList(list, newItem string) string

func ArrayToCSV

func ArrayToCSV(array interface{}) (csv string)

Convert Array to a comma (,) delimited list

func ArrayToStringType

func ArrayToStringType(inputarray []interface{}) (array []string)

Convert Array of type []interface{} to array of type []string

func BoolInvert

func BoolInvert(b bool) bool

func Btoi

func Btoi(b bool) int

func CSVtoArray

func CSVtoArray(csv string) []string

func CheckFileExistence

func CheckFileExistence(fileName string, files *[]Content_FileProperties) bool

Check if a file with the specific name exists in the list of files.

func CheckUserExistence

func CheckUserExistence(userId UserID, client *Client) (existence bool, err error)

Check if the user already exists in proxmox.

func DeleteFile

func DeleteFile(client *Client, node string, content Content_File) (err error)

Deletes te specified file from the specified storage.

func DeleteSnapshot

func DeleteSnapshot(c *Client, vmr *VmRef, snapshot string) (exitStatus string, err error)

func DiskSizeGB

func DiskSizeGB(dcSize interface{}) float64

Convert a disk-size string to a GB float

func DownloadIsoFromUrl

func DownloadIsoFromUrl(client *Client, content ConfigContent_Iso) (err error)

Download an Iso file from a given URL. https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/storage/{storage}/download-url

func DownloadLxcTemplate

func DownloadLxcTemplate(client *Client, content ConfigContent_Template) (err error)

Download an LXC template.

func ErrorItemExists

func ErrorItemExists(item, text string) error

func ErrorItemNotExists

func ErrorItemNotExists(item, text string) error

func ErrorKeyEmpty

func ErrorKeyEmpty(text string) error

func ErrorKeyNotSet

func ErrorKeyNotSet(text string) error

func FormatDiskParam

func FormatDiskParam(disk QemuDevice) string

Given a QemuDevice (representing a disk), return a param string to give to ProxMox

func FormatUsbParam

func FormatUsbParam(usb QemuDevice) string

Given a QemuDevice (representing a usb), return a param string to give to ProxMox

func GuestHasPendingChanges

func GuestHasPendingChanges(vmr *VmRef, client *Client) (bool, error)

Check if there are any pending changes that require a reboot to be applied.

func GuestReboot

func GuestReboot(vmr *VmRef, client *Client) (err error)

Reboot the specified guest

func ItemInKeyOfArray

func ItemInKeyOfArray(array []interface{}, key, value string) (existance bool)

Check the value of a key in a nested array of map[string]interface{}

func Itob

func Itob(i int) bool

func ListFiles

func ListFiles(client *Client, node, storage string, content ContentType) (files *[]Content_FileProperties, err error)

List all files of the given type in the the specified storage

func ListGroups

func ListGroups(client *Client) (*[]ConfigGroup, error)

Returns a list of all existing groups

func ListSnapshots

func ListSnapshots(c *Client, vmr *VmRef) (rawSnapshots, error)

func ListTemplates

func ListTemplates(client *Client, node string) (templateList *[]TemplateItem, err error)

List all LXC templates available for download.

func ListUsers

func ListUsers(client *Client, full bool) (*[]ConfigUser, error)

List all users that exist in proxmox Setting full to TRUE the output wil include group information. Depending on the number of existing groups it take substantially longer to parse

func MaxVmId

func MaxVmId(client *Client) (max int, err error)

func MoveQemuDisk

func MoveQemuDisk(format *QemuDiskFormat, diskId QemuDiskId, storage string, deleteAfterMove bool, vmr *VmRef, client *Client) (err error)

func NewUserIDs

func NewUserIDs(userIds string) (*[]UserID, error)

Converts an comma separated list of "username@realm" to a array of UserID objects

func ParamsToBody

func ParamsToBody(params map[string]interface{}) (body []byte)

func ParamsToBodyWithAllEmpty

func ParamsToBodyWithAllEmpty(params map[string]interface{}) (body []byte)

func ParamsToBodyWithEmpty

func ParamsToBodyWithEmpty(params map[string]interface{}, allowedEmpty []string) (body []byte)

func ParamsToValues

func ParamsToValues(params map[string]interface{}) (vals url.Values)

func ParamsToValuesWithAllEmpty

func ParamsToValuesWithAllEmpty(params map[string]interface{}, allowedEmpty []string, allowEmpty bool) (vals url.Values)

func ParamsToValuesWithEmpty

func ParamsToValuesWithEmpty(params map[string]interface{}, allowedEmpty []string) (vals url.Values)

func ParseSubConf

func ParseSubConf(
	element string,
	separator string,
) (key string, value interface{})

ParseSubConf - Parse standard sub-conf strings `key=value`.

func PointerBool

func PointerBool(boolean bool) *bool

Creates a pointer to a bool

func PointerInt

func PointerInt(number int) *int

Creates a pointer to an int

func PointerString

func PointerString(text string) *string

Creates a pointer to a string

func RemoveSshForwardUsernet

func RemoveSshForwardUsernet(vmr *VmRef, client *Client) (err error)

device_del net1 netdev_del net1

func ResponseJSON

func ResponseJSON(resp *http.Response) (jbody map[string]interface{}, err error)

func RollbackSnapshot

func RollbackSnapshot(c *Client, vmr *VmRef, snapshot string) (exitStatus string, err error)

func SendKeysString

func SendKeysString(vmr *VmRef, client *Client, keys string) (err error)

func SshForwardUsernet

func SshForwardUsernet(vmr *VmRef, client *Client) (sshPort string, err error)

This is because proxmox create/config API won't let us make usernet devices

func TypedResponse

func TypedResponse(resp *http.Response, v interface{}) error

func UpdateSnapshotDescription

func UpdateSnapshotDescription(c *Client, vmr *VmRef, snapshot, description string) (err error)

Can only be used to update the description of an already existing snapshot

func ValidateArrayEven

func ValidateArrayEven(array interface{}, text string) error

func ValidateArrayNotEmpty

func ValidateArrayNotEmpty(array interface{}, text string) error

func ValidateFilePath

func ValidateFilePath(path, text string) error

func ValidateIntGreater

func ValidateIntGreater(min, value int, text string) error

func ValidateIntGreaterOrEquals

func ValidateIntGreaterOrEquals(min, value int, text string) error

func ValidateIntInRange

func ValidateIntInRange(min, max, value int, text string) error

func ValidateStringInArray

func ValidateStringInArray(array []string, value, text string) error

func ValidateStringNotEmpty

func ValidateStringNotEmpty(value, text string) error

func ValidateStringsEqual

func ValidateStringsEqual(value1, value2, text string) error

check if a key is allowed to be changed after creation.

func WaitForShutdown

func WaitForShutdown(vmr *VmRef, client *Client) (err error)

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 ApiToken

type ApiToken struct {
	TokenId string `json:"tokenid"`
	Comment string `json:"comment,omitempty"`
	Expire  int64  `json:"expire"`
	Privsep bool   `json:"privsep"`
}

type ApiTokenCreateResult

type ApiTokenCreateResult struct {
	Info  map[string]interface{} `json:"info"`
	Value string                 `json:"value"`
}

type ApiTokenCreateResultWrapper

type ApiTokenCreateResultWrapper struct {
	Data ApiTokenCreateResult `json:"data"`
}

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 specific Proxmox node

func NewClient

func NewClient(apiUrl string, hclient *http.Client, http_headers string, tls *tls.Config, proxyString string, taskTimeout int) (client *Client, err error)

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) ApplyNetwork

func (c Client) ApplyNetwork(node string) (exitStatus string, err error)

ApplyNetwork applies the pending network configuration on the passed in node. It returns the body from the API response and any HTTP error the API returns.

func (*Client) ApplySDN

func (c *Client) ApplySDN() (string, error)

func (*Client) CheckAcmePluginExistence

func (c *Client) CheckAcmePluginExistence(id string) (existance bool, err error)

func (*Client) CheckMetricServerExistence

func (c *Client) CheckMetricServerExistence(id string) (existance bool, err error)

func (*Client) CheckSDNDNSExistance

func (c *Client) CheckSDNDNSExistance(id string) (existance bool, err error)

CheckSDNDNSExistance returns true if a DNS entry with the provided ID exists, false otherwise.

func (*Client) CheckSDNSubnetExistance

func (c *Client) CheckSDNSubnetExistance(vnet, id string) (existance bool, err error)

CheckSDNSubnetExistance returns true if a DNS entry with the provided ID exists, false otherwise.

func (*Client) CheckSDNVNetExistance

func (c *Client) CheckSDNVNetExistance(id string) (existance bool, err error)

CheckSDNVNetExistance returns true if a DNS entry with the provided ID exists, false otherwise.

func (*Client) CheckSDNZoneExistance

func (c *Client) CheckSDNZoneExistance(id string) (existance bool, err error)

CheckSDNZoneExistance returns true if a zone with the provided ID exists, false otherwise.

func (*Client) CheckStorageExistance

func (c *Client) CheckStorageExistance(id string) (existance bool, err error)

func (*Client) CheckTask

func (c *Client) CheckTask(resp *http.Response) (exitStatus string, err error)

CheckTask polls the API to check if the Proxmox task has been completed. It returns the body of the HTTP response and any HTTP error occurred during the request.

func (*Client) CheckVmRef

func (c *Client) CheckVmRef(vmr *VmRef) (err error)

func (*Client) CloneLxcContainer

func (c *Client) CloneLxcContainer(vmr *VmRef, vmParams map[string]interface{}) (exitStatus string, err error)

func (*Client) CloneQemuVm

func (c *Client) CloneQemuVm(vmr *VmRef, vmParams map[string]interface{}) (exitStatus string, err error)

func (*Client) CreateAcmeAccount

func (c *Client) CreateAcmeAccount(params map[string]interface{}) (exitStatus string, err error)

func (*Client) CreateAcmePlugin

func (c *Client) CreateAcmePlugin(params map[string]interface{}) error

func (*Client) CreateItemReturnStatus

func (c *Client) CreateItemReturnStatus(params map[string]interface{}, url string) (exitStatus string, err error)

CreateItemReturnStatus creates an item on the Proxmox API. It returns the body of the HTTP response and any HTTP error occurred during the request.

func (*Client) CreateLxcContainer

func (c *Client) CreateLxcContainer(node string, vmParams map[string]interface{}) (exitStatus string, err error)

func (*Client) CreateMetricServer

func (c *Client) CreateMetricServer(id string, params map[string]interface{}) error

func (*Client) CreateNetwork

func (c *Client) CreateNetwork(node string, params map[string]interface{}) (exitStatus string, err error)

CreateNetwork creates a network with the configuration of the passed in parameters on the passed in node. It returns the body from the API response and any HTTP error the API returns.

func (*Client) CreateNewDisk

func (c *Client) CreateNewDisk(vmr *VmRef, disk string, volume string) (exitStatus interface{}, err error)

CreateNewDisk - This method allows simpler disk creation for direct client users It should work for any existing container and virtual machine

func (*Client) CreatePool

func (c *Client) CreatePool(poolid string, comment string) error

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 (c *Client) CreateQemuSnapshot(vmr *VmRef, snapshotName string) (exitStatus string, err error)

DEPRECATED superseded by CreateSnapshot()

func (*Client) CreateQemuVm

func (c *Client) CreateQemuVm(node string, vmParams map[string]interface{}) (exitStatus string, err error)

func (*Client) CreateSDNDNS

func (c *Client) CreateSDNDNS(params map[string]interface{}) error

CreateSDNDNS creates a new SDN DNS in the cluster

func (*Client) CreateSDNSubnet

func (c *Client) CreateSDNSubnet(vnet string, params map[string]interface{}) error

CreateSDNSubnet creates a new SDN DNS in the cluster

func (*Client) CreateSDNVNet

func (c *Client) CreateSDNVNet(params map[string]interface{}) error

CreateSDNVNet creates a new SDN DNS in the cluster

func (*Client) CreateSDNZone

func (c *Client) CreateSDNZone(params map[string]interface{}) error

CreateSDNZone creates a new SDN zone in the cluster

func (*Client) CreateStorage

func (c *Client) CreateStorage(params map[string]interface{}) error

func (*Client) CreateTemplate

func (c *Client) CreateTemplate(vmr *VmRef) error

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) Delete

func (c *Client) Delete(url string) (err error)

Makes a DELETE request without waiting on proxmox for the task to complete. It returns the HTTP error as 'err'.

func (*Client) DeleteAcmeAccount

func (c *Client) DeleteAcmeAccount(id string) (exitStatus string, err error)

func (*Client) DeleteAcmePlugin

func (c *Client) DeleteAcmePlugin(id string) (err error)

func (*Client) DeleteMetricServer

func (c *Client) DeleteMetricServer(id string) error

func (*Client) DeleteNetwork

func (c *Client) DeleteNetwork(node string, iface string) (exitStatus string, err error)

DeleteNetwork deletes the network with the passed in iface name on the passed in node. It returns the body from the API response and any HTTP error the API returns.

func (*Client) DeletePool

func (c *Client) DeletePool(poolid string) error

func (*Client) DeleteQemuIPSet

func (c *Client) DeleteQemuIPSet(vmr *VmRef, IPSetName string) (exitStatus interface{}, err error)

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 (c *Client) DeleteQemuSnapshot(vmr *VmRef, snapshotName string) (exitStatus string, err error)

DEPRECATED superseded by DeleteSnapshot()

func (*Client) DeleteSDNDNS

func (c *Client) DeleteSDNDNS(name string) error

DeleteSDNDNS deletes an existing SDN DNS in the cluster

func (*Client) DeleteSDNSubnet

func (c *Client) DeleteSDNSubnet(vnet, name string) error

DeleteSDNSubnet deletes an existing SDN DNS in the cluster

func (*Client) DeleteSDNVNet

func (c *Client) DeleteSDNVNet(name string) error

DeleteSDNVNet deletes an existing SDN DNS in the cluster

func (*Client) DeleteSDNZone

func (c *Client) DeleteSDNZone(zoneName string) error

DeleteSDNZone deletes an existing SDN zone in the cluster

func (*Client) DeleteStorage

func (c *Client) DeleteStorage(id string) error

func (*Client) DeleteVMDisks

func (c *Client) DeleteVMDisks(
	node string,
	disks []string,
) error

DeleteVMDisks - Delete VM disks from host node. By default the VM disks are deleted when the VM is deleted, so mainly this is used to delete the disks in case VM creation didn't complete.

func (*Client) DeleteVm

func (c *Client) DeleteVm(vmr *VmRef) (exitStatus string, err error)

func (*Client) DeleteVmParams

func (c *Client) DeleteVmParams(vmr *VmRef, params map[string]interface{}) (exitStatus string, err error)

func (*Client) DeleteVolume

func (c *Client) DeleteVolume(vmr *VmRef, storageName string, volumeName string) (exitStatus interface{}, err error)

DeleteVolume - Delete volume

func (*Client) DeleteWithTask

func (c *Client) DeleteWithTask(url string) (exitStatus string, err error)

Makes a DELETE request and waits on proxmox for the task to complete. It returns the status of the test as 'exitStatus' and the HTTP error as 'err'.

func (*Client) EnableStorage

func (c *Client) EnableStorage(id string) error

storage

func (*Client) GetAcmeAccountConfig

func (c *Client) GetAcmeAccountConfig(id string) (config map[string]interface{}, err error)

func (*Client) GetAcmeAccountList

func (c *Client) GetAcmeAccountList() (accounts map[string]interface{}, err error)

ACME Account

func (*Client) GetAcmeDirectoriesUrl

func (c *Client) GetAcmeDirectoriesUrl() (url []string, err error)

ACME

func (*Client) GetAcmePluginConfig

func (c *Client) GetAcmePluginConfig(id string) (config map[string]interface{}, err error)

func (*Client) GetAcmePluginList

func (c *Client) GetAcmePluginList() (accounts map[string]interface{}, err error)

ACME Plugin

func (*Client) GetAcmeTosUrl

func (c *Client) GetAcmeTosUrl() (url string, err error)

func (*Client) GetExecStatus

func (c *Client) GetExecStatus(vmr *VmRef, pid string) (status map[string]interface{}, err error)

GetExecStatus - Gets the status of the given pid started by the guest-agent

func (*Client) GetHAGroupByName

func (c *Client) GetHAGroupByName(GroupName string) (*HAGroup, error)

func (*Client) GetHAGroupList

func (c *Client) GetHAGroupList() (haGroups []HAGroup, err error)

func (*Client) GetItemConfig

func (c *Client) GetItemConfig(url, text, message string) (config map[string]interface{}, err error)

func (*Client) GetItemConfigInterfaceArray

func (c *Client) GetItemConfigInterfaceArray(url, text, message string) ([]interface{}, error)

func (*Client) GetItemConfigMapStringInterface

func (c *Client) GetItemConfigMapStringInterface(url, text, message string) (map[string]interface{}, error)

Shared

func (*Client) GetItemConfigString

func (c *Client) GetItemConfigString(url, text, message string) (string, error)

func (*Client) GetItemList

func (c *Client) GetItemList(url string) (list map[string]interface{}, err error)

func (*Client) GetItemListInterfaceArray

func (c *Client) GetItemListInterfaceArray(url string) ([]interface{}, error)

func (*Client) GetJsonRetryable

func (c *Client) GetJsonRetryable(url string, data *map[string]interface{}, tries int) error

func (*Client) GetMetricServerConfig

func (c *Client) GetMetricServerConfig(id string) (config map[string]interface{}, err error)

Metrics

func (*Client) GetMetricsServerList

func (c *Client) GetMetricsServerList() (metricServers map[string]interface{}, err error)

func (*Client) GetNetworkInterface

func (c *Client) GetNetworkInterface(node string, iface string) (exitStatus string, err error)

GetNetworkInterface gets a json encoded object containing the configuration of the network interface with the name passed in as iface from the passed in node. It returns the body from the API response and any HTTP error the API returns.

func (*Client) GetNetworkList

func (c *Client) GetNetworkList(node string, typeFilter string) (exitStatus string, err error)

GetNetworkList gets a json encoded list of currently configured network interfaces on the passed in node. The typeFilter parameter can be used to filter by interface type. Pass in the empty string "" for typeFilter to list all network interfaces on the node. It returns the body from the API response and any HTTP error the API returns.

func (*Client) GetNextID

func (c *Client) GetNextID(currentID int) (nextID int, err error)

GetNextID - Get next free VMID

func (*Client) GetNodeList

func (c *Client) GetNodeList() (list map[string]interface{}, err error)

func (*Client) GetPoolInfo

func (c *Client) GetPoolInfo(poolid string) (poolInfo map[string]interface{}, err error)

func (*Client) GetPoolList

func (c *Client) GetPoolList() (pools map[string]interface{}, err error)

func (*Client) GetQemuFirewallOptions

func (c *Client) GetQemuFirewallOptions(vmr *VmRef) (firewallOptions map[string]interface{}, err error)

GetQemuFirewallOptions - Get VM firewall options.

func (*Client) GetQemuIPSet

func (c *Client) GetQemuIPSet(vmr *VmRef) (ipsets map[string]interface{}, err error)

GetQemuIPSet - List IPSets

func (*Client) GetResourceList

func (c *Client) GetResourceList(resourceType string) (list []interface{}, err error)

GetResourceList returns a list of all enabled proxmox resources. For resource types that can be in a disabled state, disabled resources will not be returned TODO this func should not be exported

func (*Client) GetSDNDNS

func (c *Client) GetSDNDNS(name string) (dns map[string]interface{}, err error)

GetSDNDNS returns details about the DNS entry whose name was provided. An error is returned if the zone doesn't exist. The returned zone can be unmarshalled into a ConfigSDNDNS struct.

func (*Client) GetSDNDNSs

func (c *Client) GetSDNDNSs(typeFilter string) (list map[string]interface{}, err error)

GetSDNDNSs returns a list of all DNS definitions in the "data" element of the returned map.

func (*Client) GetSDNSubnet

func (c *Client) GetSDNSubnet(vnet, name string) (subnet map[string]interface{}, err error)

GetSDNSubnet returns details about the Subnet entry whose name was provided. An error is returned if the zone doesn't exist. The returned map["data"] section can be unmarshalled into a ConfigSDNSubnet struct.

func (*Client) GetSDNSubnets

func (c *Client) GetSDNSubnets(vnet string) (list map[string]interface{}, err error)

GetSDNSubnets returns a list of all Subnet definitions in the "data" element of the returned map.

func (*Client) GetSDNVNet

func (c *Client) GetSDNVNet(name string) (dns map[string]interface{}, err error)

GetSDNVNet returns details about the DNS entry whose name was provided. An error is returned if the zone doesn't exist. The returned zone can be unmarshalled into a ConfigSDNVNet struct.

func (*Client) GetSDNVNets

func (c *Client) GetSDNVNets(pending bool) (list map[string]interface{}, err error)

GetSDNVNets returns a list of all VNet definitions in the "data" element of the returned map.

func (*Client) GetSDNZone

func (c *Client) GetSDNZone(zoneName string) (zone map[string]interface{}, err error)

GetSDNZone returns details about the zone whose name was provided. An error is returned if the zone doesn't exist. The returned zone can be unmarshalled into a ConfigSDNZone struct.

func (*Client) GetSDNZones

func (c *Client) GetSDNZones(pending bool, typeFilter string) (list map[string]interface{}, err error)

GetSDNZones returns a list of all the SDN zones defined in the cluster.

func (*Client) GetStorageConfig

func (c *Client) GetStorageConfig(id string) (config map[string]interface{}, err error)

func (*Client) GetStorageContent

func (c *Client) GetStorageContent(vmr *VmRef, storageName string) (data map[string]interface{}, err error)

func (*Client) GetStorageList

func (c *Client) GetStorageList() (metricServers map[string]interface{}, err error)

func (*Client) GetStorageStatus

func (c *Client) GetStorageStatus(vmr *VmRef, storageName string) (storageStatus map[string]interface{}, err error)

func (*Client) GetTaskExitstatus

func (c *Client) GetTaskExitstatus(taskUpid string) (exitStatus interface{}, err error)

func (*Client) GetUserPermissions

func (c *Client) GetUserPermissions(id UserID, path string) (permissions []string, err error)

permissions check

func (*Client) GetVersion

func (c *Client) GetVersion() (data map[string]interface{}, err error)

func (*Client) GetVmAgentNetworkInterfaces

func (c *Client) GetVmAgentNetworkInterfaces(vmr *VmRef) ([]AgentNetworkInterface, error)

func (*Client) GetVmConfig

func (c *Client) GetVmConfig(vmr *VmRef) (vmConfig map[string]interface{}, err error)

func (*Client) GetVmInfo

func (c *Client) GetVmInfo(vmr *VmRef) (vmInfo map[string]interface{}, err error)

func (*Client) GetVmList

func (c *Client) GetVmList() (map[string]interface{}, error)

TODO deprecate once nothing uses this anymore, use ListGuests() instead

func (*Client) GetVmRefByName

func (c *Client) GetVmRefByName(vmName string) (vmr *VmRef, err error)

func (*Client) GetVmRefsByName

func (c *Client) GetVmRefsByName(vmName string) (vmrs []*VmRef, err error)

func (*Client) GetVmSpiceProxy

func (c *Client) GetVmSpiceProxy(vmr *VmRef) (vmSpiceProxy map[string]interface{}, err error)

func (*Client) GetVmState

func (c *Client) GetVmState(vmr *VmRef) (vmState map[string]interface{}, err error)

func (*Client) HandleTaskError

func (c *Client) HandleTaskError(resp *http.Response) (exitStatus string)

HandleTaskError reads the body from the passed in HTTP response and closes it. It returns the body of the passed in HTTP response.

func (*Client) HibernateVm

func (c *Client) HibernateVm(vmr *VmRef) (exitStatus string, err error)

func (*Client) ListQemuSnapshot

func (c *Client) ListQemuSnapshot(vmr *VmRef) (taskResponse map[string]interface{}, exitStatus string, err error)

DEPRECATED superseded by ListSnapshots()

func (*Client) Login

func (c *Client) Login(username string, password string, otp string) (err error)

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 (c *Client) MonitorCmd(vmr *VmRef, command string) (monitorRes map[string]interface{}, err error)

func (*Client) MoveLxcDisk

func (c *Client) MoveLxcDisk(vmr *VmRef, disk string, storage string) (exitStatus interface{}, err error)

func (*Client) MoveQemuDisk

func (c *Client) MoveQemuDisk(vmr *VmRef, disk string, storage string) (exitStatus interface{}, err error)

DEPRECATED use MoveQemuDisk() instead. MoveQemuDisk - Move a disk from one storage to another

func (*Client) MoveQemuDiskToVM

func (c *Client) MoveQemuDiskToVM(vmrSource *VmRef, disk string, vmrTarget *VmRef) (exitStatus interface{}, err error)

MoveQemuDiskToVM - Move a disk to a different VM, using the same storage

func (*Client) PauseVm

func (c *Client) PauseVm(vmr *VmRef) (exitStatus string, err error)

func (*Client) Post

func (c *Client) Post(Params map[string]interface{}, url string) (err error)

Makes a POST request without waiting on proxmox for the task to complete. It returns the HTTP error as 'err'.

func (*Client) PostWithTask

func (c *Client) PostWithTask(Params map[string]interface{}, url string) (exitStatus string, err error)

Makes a POST request and waits on proxmox for the task to complete. It returns the status of the test as 'exitStatus' and the HTTP error as 'err'.

func (*Client) Put

func (c *Client) Put(Params map[string]interface{}, url string) (err error)

Makes a PUT request without waiting on proxmox for the task to complete. It returns the HTTP error as 'err'.

func (*Client) PutWithTask

func (c *Client) PutWithTask(Params map[string]interface{}, url string) (exitStatus string, err error)

Makes a PUT request and waits on proxmox for the task to complete. It returns the status of the test as 'exitStatus' and the HTTP error as 'err'.

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

func (c *Client) QemuAgentFileWrite(vmr *VmRef, params map[string]interface{}) (err error)

QemuAgentFileWrite - Writes the given file via guest agent.

func (*Client) QemuAgentPing

func (c *Client) QemuAgentPing(vmr *VmRef) (pingRes map[string]interface{}, err error)

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) ReadVMHA

func (c *Client) ReadVMHA(vmr *VmRef) (err error)

func (*Client) RebootNode

func (c *Client) RebootNode(node string) (exitStatus string, err error)

func (*Client) ResetVm

func (c *Client) ResetVm(vmr *VmRef) (exitStatus string, err error)

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 TODO Deprecate once LXC is able to resize disk by itself (qemu can already do this)

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. TODO Deprecate once LXC is able to resize disk by itself (qemu can already do this)

func (*Client) ResumeVm

func (c *Client) ResumeVm(vmr *VmRef) (exitStatus string, err error)

func (*Client) RevertNetwork

func (c *Client) RevertNetwork(node string) (exitStatus string, err error)

RevertNetwork reverts the pending network configuration on the passed in node. It returns the body from the API response and any HTTP error the API returns.

func (*Client) RollbackQemuVm

func (c *Client) RollbackQemuVm(vmr *VmRef, snapshot string) (exitStatus string, err error)

DEPRECATED superseded by RollbackSnapshot()

func (*Client) Sendkey

func (c *Client) Sendkey(vmr *VmRef, qmKey string) error

func (*Client) SetAPIToken

func (c *Client) SetAPIToken(userID, token string)

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, params map[string]interface{}) (exitStatus interface{}, err error)

DEPRECATED SetVmConfig - send config options

func (*Client) ShutdownNode

func (c *Client) ShutdownNode(node string) (exitStatus string, err error)

func (*Client) ShutdownVm

func (c *Client) ShutdownVm(vmr *VmRef) (exitStatus string, err error)

func (*Client) StartVm

func (c *Client) StartVm(vmr *VmRef) (exitStatus string, err error)

func (*Client) StatusChangeVm

func (c *Client) StatusChangeVm(vmr *VmRef, params map[string]interface{}, setStatus string) (exitStatus string, err error)

func (*Client) StopVm

func (c *Client) StopVm(vmr *VmRef) (exitStatus string, err error)

func (*Client) UpdateAcmeAccountEmails

func (c *Client) UpdateAcmeAccountEmails(id, emails string) (exitStatus string, err error)

func (*Client) UpdateAcmePlugin

func (c *Client) UpdateAcmePlugin(id string, params map[string]interface{}) error

func (*Client) UpdateItemReturnStatus

func (c *Client) UpdateItemReturnStatus(params map[string]interface{}, url string) (exitStatus string, err error)

UpdateItemReturnStatus updates an item on the Proxmox API. It returns the body of the HTTP response and any HTTP error occurred during the request.

func (*Client) UpdateMetricServer

func (c *Client) UpdateMetricServer(id string, params map[string]interface{}) error

func (*Client) UpdateNetwork

func (c *Client) UpdateNetwork(node string, iface string, params map[string]interface{}) (exitStatus string, err error)

UpdateNetwork updates the network corresponding to the passed in interface name on the passed in node with the configuration in the passed in parameters. It returns the body from the API response and any HTTP error the API returns.

func (*Client) UpdatePoolComment

func (c *Client) UpdatePoolComment(poolid string, comment string) error

func (*Client) UpdateSDNDNS

func (c *Client) UpdateSDNDNS(id string, params map[string]interface{}) error

UpdateSDNDNS updates the given DNS with the provided parameters

func (*Client) UpdateSDNSubnet

func (c *Client) UpdateSDNSubnet(vnet, id string, params map[string]interface{}) error

UpdateSDNSubnet updates the given DNS with the provided parameters

func (*Client) UpdateSDNVNet

func (c *Client) UpdateSDNVNet(id string, params map[string]interface{}) error

UpdateSDNVNet updates the given DNS with the provided parameters

func (*Client) UpdateSDNZone

func (c *Client) UpdateSDNZone(id string, params map[string]interface{}) error

UpdateSDNZone updates the given zone with the provided parameters

func (*Client) UpdateStorage

func (c *Client) UpdateStorage(id string, params map[string]interface{}) error

func (*Client) UpdateVMHA

func (c *Client) UpdateVMHA(vmr *VmRef, haState string, haGroup string) (exitStatus interface{}, err error)

func (*Client) UpdateVMPool

func (c *Client) UpdateVMPool(vmr *VmRef, pool string) (exitStatus interface{}, err error)

func (*Client) Upload

func (c *Client) Upload(node string, storage string, contentType string, filename string, file io.Reader) error

func (*Client) UploadLargeFile

func (c *Client) UploadLargeFile(node string, storage string, contentType string, filename string, filesize int64, file io.Reader) error

func (*Client) VMIdExists

func (c *Client) VMIdExists(vmID int) (exists bool, err error)

VMIdExists - If you pass an VMID that exists it will return true, otherwise it wil return false

func (*Client) VzDump

func (c *Client) VzDump(vmr *VmRef, params map[string]interface{}) (exitStatus interface{}, err error)

VzDump - Create backup

func (*Client) WaitForCompletion

func (c *Client) WaitForCompletion(taskResponse map[string]interface{}) (waitExitStatus string, err error)

WaitForCompletion - poll the API for task completion

type ConfigAcmeAccount

type ConfigAcmeAccount struct {
	Name      string   `json:"name"`
	Contact   []string `json:"contact"`
	Directory string   `json:"directory"`
	Tos       bool     `json:"tos,omitempty"`
}

Acme Account options for the Proxmox API

func NewConfigAcmeAccountFromApi

func NewConfigAcmeAccountFromApi(id string, client *Client) (config *ConfigAcmeAccount, err error)

func NewConfigAcmeAccountFromJson

func NewConfigAcmeAccountFromJson(input []byte) (config *ConfigAcmeAccount, err error)

func (ConfigAcmeAccount) CreateAcmeAccount

func (config ConfigAcmeAccount) CreateAcmeAccount(acmeId string, client *Client) (err error)

type ConfigAcmePlugin

type ConfigAcmePlugin struct {
	ID              string   `json:"pluginid"`
	API             string   `json:"api"`
	Data            string   `json:"data,omitempty"`
	Enable          bool     `json:"enable"`
	Nodes           []string `json:"nodes,omitempty"`
	ValidationDelay int      `json:"validation-delay"`
}

Acme Plugin options for the Proxmox API

func NewConfigAcmePluginFromApi

func NewConfigAcmePluginFromApi(id string, client *Client) (config *ConfigAcmePlugin, err error)

func NewConfigAcmePluginFromJson

func NewConfigAcmePluginFromJson(input []byte) (config *ConfigAcmePlugin, err error)

func (ConfigAcmePlugin) CreateAcmePlugin

func (config ConfigAcmePlugin) CreateAcmePlugin(client *Client) (err error)

func (ConfigAcmePlugin) SetAcmePlugin

func (config ConfigAcmePlugin) SetAcmePlugin(pluginId string, client *Client) (err error)

func (ConfigAcmePlugin) UpdateAcmePlugin

func (config ConfigAcmePlugin) UpdateAcmePlugin(client *Client) (err error)

type ConfigContent_Iso

type ConfigContent_Iso struct {
	Checksum          string
	ChecksumAlgorithm string
	DownloadUrl       string
	Filename          string
	Node              string
	Storage           string
}

func (ConfigContent_Iso) Validate

func (content ConfigContent_Iso) Validate() (err error)

Return an error if the one of the values is empty.

type ConfigContent_Template

type ConfigContent_Template struct {
	Node     string
	Storage  string
	Template string
}

func (ConfigContent_Template) Validate

func (content ConfigContent_Template) Validate() (err error)

Return an error if the one of the values is empty.

type ConfigGroup

type ConfigGroup struct {
	Name    GroupName `json:"name"`
	Comment string    `json:"comment,omitempty"`
	// Setting the Members will update the group membership to only include the specified members.
	Members *[]UserID `json:"members,omitempty"`
}

func NewConfigGroupFromApi

func NewConfigGroupFromApi(groupId GroupName, client *Client) (*ConfigGroup, error)

func (*ConfigGroup) Create

func (config *ConfigGroup) Create(client *Client) error

Creates the specified group

func (*ConfigGroup) Set

func (config *ConfigGroup) Set(client *Client) (err error)

Created or updates the specified group

func (*ConfigGroup) Update

func (config *ConfigGroup) Update(client *Client) error

Updates the specified group

func (*ConfigGroup) Validate

func (config *ConfigGroup) Validate(create bool) (err error)

Validates all items and sub items of the ConfigGroup

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

func NewConfigLxcFromApi(vmr *VmRef, client *Client) (config *ConfigLxc, err error)

func NewConfigLxcFromJson

func NewConfigLxcFromJson(input []byte) (config ConfigLxc, err error)

func (ConfigLxc) CloneLxc

func (config ConfigLxc) CloneLxc(vmr *VmRef, client *Client) (err error)

func (ConfigLxc) CreateLxc

func (config ConfigLxc) CreateLxc(vmr *VmRef, client *Client) (err error)

create LXC container using the Proxmox API

func (ConfigLxc) UpdateConfig

func (config ConfigLxc) UpdateConfig(vmr *VmRef, client *Client) (err error)

type ConfigMetrics

type ConfigMetrics struct {
	Name     string                 `json:"name"`
	Port     int                    `json:"port"`
	Server   string                 `json:"server"`
	Type     string                 `json:"type"` //type key is only used on create
	Enable   bool                   `json:"enable"`
	MTU      int                    `json:"mtu"`
	Timeout  int                    `json:"timeout,omitempty"`
	Graphite *ConfigMetricsGraphite `json:"graphite,omitempty"`
	InfluxDB *ConfigMetricsInfluxDB `json:"influxdb,omitempty"`
}

Metrics options for the Proxmox API

func InstantiateConfigMetrics

func InstantiateConfigMetrics() *ConfigMetrics

func NewConfigMetricsFromApi

func NewConfigMetricsFromApi(metricsId string, client *Client) (config *ConfigMetrics, err error)

func NewConfigMetricsFromJson

func NewConfigMetricsFromJson(input []byte) (config *ConfigMetrics, err error)

func (*ConfigMetrics) CreateMetrics

func (config *ConfigMetrics) CreateMetrics(client *Client) (err error)

func (*ConfigMetrics) RemoveMetricsNestedStructs

func (config *ConfigMetrics) RemoveMetricsNestedStructs()

func (*ConfigMetrics) SetMetrics

func (config *ConfigMetrics) SetMetrics(metricsId string, client *Client) (err error)

func (*ConfigMetrics) UpdateMetrics

func (config *ConfigMetrics) UpdateMetrics(client *Client) (err error)

func (*ConfigMetrics) ValidateMetrics

func (config *ConfigMetrics) ValidateMetrics() (err error)

type ConfigMetricsGraphite

type ConfigMetricsGraphite struct {
	Protocol string `json:"protocol"`
	Path     string `json:"path,omitempty"`
}

type ConfigMetricsInfluxDB

type ConfigMetricsInfluxDB struct {
	ApiPathPrefix     string `json:"api-path-prefix,omitempty"`
	Bucket            string `json:"bucket,omitempty"`
	Protocol          string `json:"protocol"`
	MaxBodySize       int    `json:"max-body-size,omitempty"`
	Organization      string `json:"organization,omitempty"`
	Token             string `json:"token,omitempty"` //token key is never returned from api
	VerifyCertificate bool   `json:"verify-certificate"`
}

type ConfigNetwork

type ConfigNetwork struct {
	Iface              string `json:"iface,omitempty"`
	Node               string `json:"node,omitempty"`
	Type               string `json:"type,omitempty"`
	Address            string `json:"address,omitempty"`
	Address6           string `json:"address6,omitempty"`
	Autostart          bool   `json:"autostart,omitempty"`
	BondPrimary        string `json:"bond-primary,omitempty"`
	BondMode           string `json:"bond_mode,omitempty"`
	BondXmitHashPolicy string `json:"bond_xmit_hash_policy,omitempty"`
	BridgePorts        string `json:"bridge_ports,omitempty"`
	BridgeVlanAware    bool   `json:"bridge_vlan_aware,omitempty"`
	CIDR               string `json:"cidr,omitempty"`
	CIDR6              string `json:"cidr6,omitempty"`
	Comments           string `json:"comments,omitempty"`
	Comments6          string `json:"comments6,omitempty"`
	Gateway            string `json:"gateway,omitempty"`
	Gateway6           string `json:"gateway6,omitempty"`
	MTU                int    `json:"mtu,omitempty"`
	Netmask            string `json:"netmask,omitempty"`
	Netmask6           int    `json:"netmask6,omitempty"`
	OVSBonds           string `json:"ovs_bonds,omitempty"`
	OVSBridge          string `json:"ovs_bridge,omitempty"`
	OVSOptions         string `json:"ovs_options,omitempty"`
	OVSPorts           string `json:"ovs_ports,omitempty"`
	OVSTag             int    `json:"ovs_tag,omitempty"`
	Slaves             string `json:"slaves,omitempty"`
	VlanID             int    `json:"vlan-id,omitempty"`
	VlanRawDevice      string `json:"vlan-raw-device,omitempty"`
}

ConfigNetwork maps go variables to API parameters.

func NewConfigNetworkFromJSON

func NewConfigNetworkFromJSON(input []byte) (config *ConfigNetwork, err error)

NewConfigNetworkFromJSON takes in a byte array from a json encoded network configuration and stores it in config. It returns the newly created config with the passed in configuration stored and an error if one occurs unmarshalling the input data.

func (ConfigNetwork) CreateNetwork

func (config ConfigNetwork) CreateNetwork(client *Client) (err error)

CreateNetwork creates a network on the Proxmox host with the stored config. It returns an error if the creation of the network fails.

func (ConfigNetwork) UpdateNetwork

func (config ConfigNetwork) UpdateNetwork(client *Client) (err error)

UpdateNetwork updates a network on the Proxmox host with the stored config. It returns an error if updating the network fails.

type ConfigQemu

type ConfigQemu struct {
	Agent           int           `json:"agent,omitempty"` // TODO should probably be a bool
	Args            string        `json:"args,omitempty"`
	Balloon         int           `json:"balloon,omitempty"` // TODO should probably be a bool
	Bios            string        `json:"bios,omitempty"`
	Boot            string        `json:"boot,omitempty"`       // TODO should be an array of custom enums
	BootDisk        string        `json:"bootdisk,omitempty"`   // TODO discuss deprecation? Only returned as it's deprecated in the proxmox api
	CIcustom        string        `json:"cicustom,omitempty"`   // TODO should be part of a cloud-init struct (cloud-init option)
	CIpassword      string        `json:"cipassword,omitempty"` // TODO should be part of a cloud-init struct (cloud-init option)
	CIuser          string        `json:"ciuser,omitempty"`     // TODO should be part of a cloud-init struct (cloud-init option)
	Description     string        `json:"description,omitempty"`
	Disks           *QemuStorages `json:"disks,omitempty"`
	EFIDisk         QemuDevice    `json:"efidisk,omitempty"`   // TODO should be a struct
	RNGDrive        QemuDevice    `json:"rng0,omitempty"`      // TODO should be a struct
	FullClone       *int          `json:"fullclone,omitempty"` // TODO should probably be a bool
	HaGroup         string        `json:"hagroup,omitempty"`
	HaState         string        `json:"hastate,omitempty"` // TODO should be custom type with enum
	Hookscript      string        `json:"hookscript,omitempty"`
	Hotplug         string        `json:"hotplug,omitempty"`    // TODO should be a struct
	Ipconfig        IpconfigMap   `json:"ipconfig,omitempty"`   // TODO should be part of a cloud-init struct (cloud-init option)
	Iso             *IsoFile      `json:"iso,omitempty"`        // Same as Disks.Ide.Disk_2.CdRom.Iso
	LinkedVmId      uint          `json:"linked_id,omitempty"`  // Only returned setting it has no effect
	Machine         string        `json:"machine,omitempty"`    // TODO should be custom type with enum
	Memory          int           `json:"memory,omitempty"`     // TODO should be uint
	Name            string        `json:"name,omitempty"`       // TODO should be custom type as there are character and length limitations
	Nameserver      string        `json:"nameserver,omitempty"` // TODO should be part of a cloud-init struct (cloud-init option)
	Node            string        `json:"node,omitempty"`
	Onboot          *bool         `json:"onboot,omitempty"`
	Pool            string        `json:"pool,omitempty"`    // TODO should be custom type as there are character and length limitations
	QemuCores       int           `json:"cores,omitempty"`   // TODO should be uint
	QemuCpu         string        `json:"cpu,omitempty"`     // TODO should be custom type with enum
	QemuDisks       QemuDevices   `json:"disk,omitempty"`    // DEPRECATED use Disks *QemuStorages instead
	QemuIso         string        `json:"qemuiso,omitempty"` // DEPRECATED use Iso *IsoFile instead
	QemuKVM         *bool         `json:"kvm,omitempty"`
	QemuNetworks    QemuDevices   `json:"network,omitempty"` // TODO should be a struct
	QemuNuma        *bool         `json:"numa,omitempty"`
	QemuOs          string        `json:"ostype,omitempty"`
	QemuPCIDevices  QemuDevices   `json:"hostpci,omitempty"` // TODO should be a struct
	QemuPxe         bool          `json:"pxe,omitempty"`
	QemuSerials     QemuDevices   `json:"serial,omitempty"`       // TODO should be a struct
	QemuSockets     int           `json:"sockets,omitempty"`      // TODO should be uint
	QemuUnusedDisks QemuDevices   `json:"unused,omitempty"`       // TODO should be a struct
	QemuUsbs        QemuDevices   `json:"usb,omitempty"`          // TODO should be a struct
	QemuVcpus       int           `json:"vcpus,omitempty"`        // TODO should be uint
	QemuVga         QemuDevice    `json:"vga,omitempty"`          // TODO should be a struct
	Scsihw          string        `json:"scsihw,omitempty"`       // TODO should be custom type with enum
	Searchdomain    string        `json:"searchdomain,omitempty"` // TODO should be part of a cloud-init struct (cloud-init option)
	Smbios1         string        `json:"smbios1,omitempty"`      // TODO should be custom type with enum?
	Sshkeys         string        `json:"sshkeys,omitempty"`      // TODO should be an array of strings
	Startup         string        `json:"startup,omitempty"`      // TODO should be a struct?
	Tablet          *bool         `json:"tablet,omitempty"`
	Tags            string        `json:"tags,omitempty"` // TODO should be an array of a custom type as there are character and length limitations
	VmID            int           `json:"vmid,omitempty"` // TODO should be a custom type as there are limitations
}

ConfigQemu - Proxmox API QEMU options

func NewConfigQemuFromApi

func NewConfigQemuFromApi(vmr *VmRef, client *Client) (config *ConfigQemu, err error)

func NewConfigQemuFromJson

func NewConfigQemuFromJson(input []byte) (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) Create

func (config ConfigQemu) Create(vmr *VmRef, client *Client) (err error)

Create - Tell Proxmox API to make the VM

func (ConfigQemu) CreateIpconfigParams

func (c ConfigQemu) CreateIpconfigParams(params map[string]interface{}) error

Create parameters for each Cloud-Init ipconfig entry.

func (ConfigQemu) CreateQemuDisksParams

func (c ConfigQemu) CreateQemuDisksParams(params map[string]interface{}, cloned bool)

Create parameters for each disk.

func (ConfigQemu) CreateQemuEfiParams

func (c ConfigQemu) CreateQemuEfiParams(params map[string]interface{})

Create efi parameter.

func (ConfigQemu) CreateQemuMachineParam

func (c ConfigQemu) CreateQemuMachineParam(
	params map[string]interface{},
) error

Create parameters for serial interface

func (ConfigQemu) CreateQemuNetworksParams

func (c ConfigQemu) CreateQemuNetworksParams(params map[string]interface{})

Create parameters for each Nic device.

func (ConfigQemu) CreateQemuPCIsParams

func (c ConfigQemu) CreateQemuPCIsParams(params map[string]interface{})

Create parameters for each PCI Device

func (ConfigQemu) CreateQemuRngParams

func (c ConfigQemu) CreateQemuRngParams(params map[string]interface{})

Create RNG parameter.

func (ConfigQemu) CreateQemuSerialsParams

func (c ConfigQemu) CreateQemuSerialsParams(params map[string]interface{})

Create parameters for serial interface

func (ConfigQemu) CreateQemuUsbsParams

func (c ConfigQemu) CreateQemuUsbsParams(params map[string]interface{})

Create parameters for usb interface

func (ConfigQemu) CreateVm

func (config ConfigQemu) CreateVm(vmr *VmRef, client *Client) (err error)

DEPRECATED use ConfigQemu{}.Create Instead.

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) Update

func (newConfig ConfigQemu) Update(rebootIfNeeded bool, vmr *VmRef, client *Client) (rebootRequired bool, err error)

func (ConfigQemu) UpdateConfig

func (config ConfigQemu) UpdateConfig(vmr *VmRef, client *Client) (err error)

DEPRECATED use ConfigQemu.Update instead

func (ConfigQemu) Validate

func (config ConfigQemu) Validate() (err error)

type ConfigSDNDNS

type ConfigSDNDNS struct {
	DNS  string `json:"dns"`
	Key  string `json:"key"`
	Type string `json:"type"`
	URL  string `json:"url"`
	TTL  int    `json:"ttl,omitempty"`
	// The SDN Plugin schema contains ReverseV6Mask attribute while the
	// PowerDNS plugin schema contains the ReverseMaskV6 attribute
	// This is probably a bug that crept into the Proxmox implementation.a
	// Checked in libpve-network-perl=0.7.3
	ReverseMaskV6 int `json:"reversemaskv6,omitempty"`
	ReverseV6Mask int `json:"reversev6mask,omitempty"`
	// Digest allows for a form of optimistic locking
	Digest string `json:"digest,omitempty"`
}

ConfigSDNDNS describes the SDN DNS configurable element

func NewConfigSDNDNSFromJson

func NewConfigSDNDNSFromJson(input []byte) (config *ConfigSDNDNS, err error)

func (*ConfigSDNDNS) Create

func (config *ConfigSDNDNS) Create(id string, client *Client) (err error)

func (*ConfigSDNDNS) CreateWithValidate

func (config *ConfigSDNDNS) CreateWithValidate(id string, client *Client) (err error)

func (*ConfigSDNDNS) Update

func (config *ConfigSDNDNS) Update(id string, client *Client) (err error)

func (*ConfigSDNDNS) UpdateWithValidate

func (config *ConfigSDNDNS) UpdateWithValidate(id string, client *Client) (err error)

func (*ConfigSDNDNS) Validate

func (c *ConfigSDNDNS) Validate(id string, create bool, client *Client) (err error)

type ConfigSDNSubnet

type ConfigSDNSubnet struct {
	// For creation purposes - Subnet is a CIDR
	// Once a subnet has been created, the Subnet is an identifier with the format
	// "<zone>-<ip>-<mask>"
	Subnet string `json:"subnet"`

	DNSZonePrefix string `json:"dnszoneprefix,omitempty"`
	Gateway       string `json:"gateway,omitempty"`
	SNAT          bool   `json:"snat,omitempty"`

	// Delete is a string of attributes to be deleted from the object
	Delete string `json:"delete,omitempty"`
	// Type must always hold the string "subnet"
	Type string `json:"type"`
	// Digest allows for a form of optimistic locking
	Digest string `json:"digest,omitempty"`
}

func NewConfigSDNSubnetFromJson

func NewConfigSDNSubnetFromJson(input []byte) (config *ConfigSDNSubnet, err error)

NewConfigSDNSubnetFromJSON takes in a byte array from a json encoded SDN Subnet configuration and stores it in config. It returns the newly created config with the passed in configuration stored and an error if one occurs unmarshalling the input data.

func (*ConfigSDNSubnet) Create

func (config *ConfigSDNSubnet) Create(vnet, id string, client *Client) (err error)

func (*ConfigSDNSubnet) CreateWithValidate

func (config *ConfigSDNSubnet) CreateWithValidate(vnet, id string, client *Client) (err error)

func (*ConfigSDNSubnet) Update

func (config *ConfigSDNSubnet) Update(vnet, id string, client *Client) (err error)

func (*ConfigSDNSubnet) UpdateWithValidate

func (config *ConfigSDNSubnet) UpdateWithValidate(vnet, id string, client *Client) (err error)

func (*ConfigSDNSubnet) Validate

func (c *ConfigSDNSubnet) Validate(vnet, id string, create bool, client *Client) (err error)

type ConfigSDNVNet

type ConfigSDNVNet struct {
	VNet      string `json:"vnet"`
	Zone      string `json:"zone"`
	Alias     string `json:"alias,omitempty"`
	Delete    string `json:"delete,omitempty"`
	Tag       int    `json:"tag,omitempty"`
	VLANAware bool   `json:"vlanaware,omitempty"`
	// Digest allows for a form of optimistic locking
	Digest string `json:"digest,omitempty"`
}

func NewConfigSDNVNetFromJson

func NewConfigSDNVNetFromJson(input []byte) (config *ConfigSDNVNet, err error)

func (*ConfigSDNVNet) Create

func (config *ConfigSDNVNet) Create(id string, client *Client) (err error)

func (*ConfigSDNVNet) CreateWithValidate

func (config *ConfigSDNVNet) CreateWithValidate(id string, client *Client) (err error)

func (*ConfigSDNVNet) Update

func (config *ConfigSDNVNet) Update(id string, client *Client) (err error)

func (*ConfigSDNVNet) UpdateWithValidate

func (config *ConfigSDNVNet) UpdateWithValidate(id string, client *Client) (err error)

func (*ConfigSDNVNet) Validate

func (c *ConfigSDNVNet) Validate(id string, create bool, client *Client) (err error)

type ConfigSDNZone

type ConfigSDNZone struct {
	Type                     string `json:"type"`
	Zone                     string `json:"zone"`
	AdvertiseSubnets         bool   `json:"advertise-subnets,omitempty"`
	Bridge                   string `json:"bridge,omitempty"`
	BridgeDisableMacLearning bool   `json:"bridge-disable-mac-learning,omitempty"`
	Controller               string `json:"controller,omitempty"`
	DisableARPNDSuppression  bool   `json:"disable-arp-nd-suppression,omitempty"`
	DNS                      string `json:"dns,omitempty"`
	DNSZone                  string `json:"dnszone,omitempty"`
	DPID                     int    `json:"dp-id,omitempty"`
	ExitNodes                string `json:"exitnodes,omitempty"`
	ExitNodesLocalRouting    bool   `json:"exitnodes-local-routing,omitempty"`
	ExitNodesPrimary         string `json:"exitnodes-primary,omitempty"`
	IPAM                     string `json:"ipam,omitempty"`
	MAC                      string `json:"mac,omitempty"`
	MTU                      int    `json:"mtu,omitempty"`
	Nodes                    string `json:"nodes,omitempty"`
	Peers                    string `json:"peers,omitempty"`
	ReverseDNS               string `json:"reversedns,omitempty"`
	RTImport                 string `json:"rt-import,omitempty"`
	Tag                      int    `json:"tag,omitempty"`
	VlanProtocol             string `json:"vlan-protocol,omitempty"`
	VrfVxlan                 int    `json:"vrf-vxlan,omitempty"`
	// Pass a string of attributes to be deleted from the remote object
	Delete string `json:"delete,omitempty"`
	// Digest allows for a form of optimistic locking
	Digest string `json:"digest,omitempty"`
}

ConfigSDNZone describes the Zone configurable element

func NewConfigSDNZoneFromJson

func NewConfigSDNZoneFromJson(input []byte) (config *ConfigSDNZone, err error)

NewConfigNetworkFromJSON takes in a byte array from a json encoded SDN Zone configuration and stores it in config. It returns the newly created config with the passed in configuration stored and an error if one occurs unmarshalling the input data.

func (*ConfigSDNZone) Create

func (config *ConfigSDNZone) Create(id string, client *Client) (err error)

func (*ConfigSDNZone) CreateWithValidate

func (config *ConfigSDNZone) CreateWithValidate(id string, client *Client) (err error)

func (*ConfigSDNZone) Update

func (config *ConfigSDNZone) Update(id string, client *Client) (err error)

func (*ConfigSDNZone) UpdateWithValidate

func (config *ConfigSDNZone) UpdateWithValidate(id string, client *Client) (err error)

func (*ConfigSDNZone) Validate

func (c *ConfigSDNZone) Validate(id string, create bool, client *Client) (err error)

type ConfigSnapshot

type ConfigSnapshot struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	VmState     bool   `json:"ram,omitempty"`
}

func (ConfigSnapshot) CreateSnapshot

func (config ConfigSnapshot) CreateSnapshot(c *Client, vmr *VmRef) (err error)

type ConfigStorage

type ConfigStorage struct {
	ID              string                        `json:"id"`
	Enable          bool                          `json:"enable"`
	Nodes           []string                      `json:"nodes,omitempty"`
	Type            string                        `json:"type"`
	Directory       *ConfigStorageDirectory       `json:"directory,omitempty"`
	LVM             *ConfigStorageLVM             `json:"lvm,omitempty"`
	LVMThin         *ConfigStorageLVMThin         `json:"lvm-thin,omitempty"`
	NFS             *ConfigStorageNFS             `json:"nfs,omitempty"`
	SMB             *ConfigStorageSMB             `json:"smb,omitempty"`
	GlusterFS       *ConfigStorageGlusterFS       `json:"glusterfs,omitempty"`
	ISCSI           *ConfigStorageISCSI           `json:"iscsi,omitempty"`
	CephFS          *ConfigStorageCephFS          `json:"cephfs,omitempty"`
	RBD             *ConfigStorageRBD             `json:"rbd,omitempty"`
	ZFSoverISCSI    *ConfigStorageZFSoverISCSI    `json:"zfs-over-iscsi,omitempty"`
	ZFS             *ConfigStorageZFS             `json:"zfs,omitempty"`
	PBS             *ConfigStoragePBS             `json:"pbs,omitempty"`
	Content         *ConfigStorageContent         `json:"content,omitempty"`
	BackupRetention *ConfigStorageBackupRetention `json:"backupretention,omitempty"`
}

Storage options for the Proxmox API

func NewConfigStorageFromApi

func NewConfigStorageFromApi(storageid string, client *Client) (config *ConfigStorage, err error)

func NewConfigStorageFromJson

func NewConfigStorageFromJson(input []byte) (config *ConfigStorage, err error)

func (*ConfigStorage) Create

func (config *ConfigStorage) Create(id string, errorSupression bool, client *Client) (err error)

func (*ConfigStorage) CreateWithValidate

func (config *ConfigStorage) CreateWithValidate(id string, client *Client) (err error)

func (*ConfigStorage) RemapFromAPI

func (config *ConfigStorage) RemapFromAPI()

func (*ConfigStorage) RemapToAPI

func (config *ConfigStorage) RemapToAPI()

func (*ConfigStorage) SetDefaults

func (config *ConfigStorage) SetDefaults()

func (*ConfigStorage) Update

func (config *ConfigStorage) Update(id string, client *Client) (err error)

func (*ConfigStorage) UpdateWithValidate

func (config *ConfigStorage) UpdateWithValidate(id string, client *Client) (err error)

func (*ConfigStorage) Validate

func (newConfig *ConfigStorage) Validate(id string, create bool, client *Client) (err error)

type ConfigStorageBackupRetention

type ConfigStorageBackupRetention struct {
	Last    *int `json:"last,omitempty"`
	Hourly  *int `json:"hourly,omitempty"`
	Daily   *int `json:"daily,omitempty"`
	Monthly *int `json:"monthly,omitempty"`
	Weekly  *int `json:"weekly,omitempty"`
	Yearly  *int `json:"yearly,omitempty"`
}

func (*ConfigStorageBackupRetention) AllNil

func (b *ConfigStorageBackupRetention) AllNil() bool

func (*ConfigStorageBackupRetention) MapStorageBackupRetention

func (b *ConfigStorageBackupRetention) MapStorageBackupRetention() string

func (*ConfigStorageBackupRetention) Validate

func (b *ConfigStorageBackupRetention) Validate() (err error)

type ConfigStorageCephFS

type ConfigStorageCephFS struct {
	Monitors  []string `json:"monitors"`
	SecretKey *string  `json:"secret-key,omitempty"`
	Username  string   `json:"username"`
	FSname    string   `json:"fs-name"`
}

type ConfigStorageContent

type ConfigStorageContent struct {
	Backup    *bool `json:"backup,omitempty"`    //backup
	Iso       *bool `json:"iso,omitempty"`       //iso
	Template  *bool `json:"template,omitempty"`  //vztmpl
	DiskImage *bool `json:"diskimage,omitempty"` //images
	Container *bool `json:"container,omitempty"` //rootdir
	Snippets  *bool `json:"snippets,omitempty"`  //snippets
}

func (*ConfigStorageContent) MapStorageContent

func (c *ConfigStorageContent) MapStorageContent(array []bool) (list string)

func (*ConfigStorageContent) Validate

func (c *ConfigStorageContent) Validate(storageType string) error

type ConfigStorageDirectory

type ConfigStorageDirectory struct {
	Path          string  `json:"path"`
	Preallocation *string `json:"preallocation,omitempty"`
	Shared        bool    `json:"shared"`
}

Storage Types

func (*ConfigStorageDirectory) SetDefaults

func (directory *ConfigStorageDirectory) SetDefaults()

type ConfigStorageGlusterFS

type ConfigStorageGlusterFS struct {
	Server1       string  `json:"server1"`
	Server2       string  `json:"server2,omitempty"`
	Preallocation *string `json:"preallocation,omitempty"`
	Volume        string  `json:"volume"`
}

func (*ConfigStorageGlusterFS) SetDefaults

func (glusterfs *ConfigStorageGlusterFS) SetDefaults()

type ConfigStorageISCSI

type ConfigStorageISCSI struct {
	Portal string `json:"portal"`
	Target string `json:"target"`
}

type ConfigStorageLVM

type ConfigStorageLVM struct {
	VGname string `json:"vgname"`
	Shared bool   `json:"shared,omitempty"`
}

type ConfigStorageLVMThin

type ConfigStorageLVMThin struct {
	VGname   string `json:"vgname"`
	Thinpool string `json:"thinpool"`
}

type ConfigStorageNFS

type ConfigStorageNFS struct {
	Server        string  `json:"server"`
	Export        string  `json:"export"`
	Preallocation *string `json:"preallocation,omitempty"`
	Version       *string `json:"version,omitempty"`
}

func (*ConfigStorageNFS) SetDefaults

func (nfs *ConfigStorageNFS) SetDefaults()

type ConfigStoragePBS

type ConfigStoragePBS struct {
	Server      string  `json:"server"`
	Datastore   string  `json:"datastore"`
	Username    string  `json:"username"`
	Password    *string `json:"password,omitempty"`
	Fingerprint string  `json:"fingerprint,omitempty"`
	Port        *int    `json:"port,omitempty"`
	Namespace   string  `json:"namespace,omitempty"`
}

func (*ConfigStoragePBS) SetDefaults

func (pbs *ConfigStoragePBS) SetDefaults()

type ConfigStorageRBD

type ConfigStorageRBD struct {
	Pool      string   `json:"pool"`
	Monitors  []string `json:"monitors"`
	Username  string   `json:"username"`
	Keyring   *string  `json:"keyring,omitempty"`
	Namespace string   `json:"namespace"`
	KRBD      bool     `json:"krbd"`
}

type ConfigStorageSMB

type ConfigStorageSMB struct {
	Username      string  `json:"username"`
	Share         string  `json:"share"`
	Preallocation *string `json:"preallocation,omitempty"`
	Domain        string  `json:"domain"`
	Server        string  `json:"server"`
	Password      *string `json:"password,omitempty"`
	Version       *string `json:"version,omitempty"`
}

func (*ConfigStorageSMB) SetDefaults

func (smb *ConfigStorageSMB) SetDefaults()

type ConfigStorageZFS

type ConfigStorageZFS struct {
	Pool          string  `json:"pool"`
	Blocksize     *string `json:"blocksize,omitempty"`
	Thinprovision bool    `json:"thinprovision,omitempty"`
}

func (*ConfigStorageZFS) SetDefaults

func (zfs *ConfigStorageZFS) SetDefaults()

type ConfigStorageZFSoverISCSI

type ConfigStorageZFSoverISCSI struct {
	Portal        string                             `json:"portal"`
	Pool          string                             `json:"pool"`
	Blocksize     *string                            `json:"blocksize"`
	Target        string                             `json:"target"`
	ISCSIprovider string                             `json:"iscsiprovider"`
	Thinprovision bool                               `json:"thinprovision"`
	Comstar       *ConfigStorageZFSoverISCSI_Comstar `json:"comstar,omitempty"`
	Istgt         *ConfigStorageZFSoverISCSI_istgt   `json:"istgt,omitempty"`
	LIO           *ConfigStorageZFSoverISCSI_LIO     `json:"lio,omitempty"`
}

func (*ConfigStorageZFSoverISCSI) RemapFromAPI

func (zfsoveriscsi *ConfigStorageZFSoverISCSI) RemapFromAPI()

func (*ConfigStorageZFSoverISCSI) RemapToAPI

func (zfsoveriscsi *ConfigStorageZFSoverISCSI) RemapToAPI()

func (*ConfigStorageZFSoverISCSI) SetDefaults

func (zfsoveriscsi *ConfigStorageZFSoverISCSI) SetDefaults()

type ConfigStorageZFSoverISCSI_Comstar

type ConfigStorageZFSoverISCSI_Comstar struct {
	TargetGroup string `json:"target-group"`
	HostGroup   string `json:"host-group"`
	Writecache  bool   `json:"writecache"`
}

type ConfigStorageZFSoverISCSI_LIO

type ConfigStorageZFSoverISCSI_LIO struct {
	TargetPortalGroup string `json:"targetportal-group"`
}

type ConfigStorageZFSoverISCSI_istgt

type ConfigStorageZFSoverISCSI_istgt struct {
	Writecache bool `json:"writecache"`
}

type ConfigUser

type ConfigUser struct {
	User      UserID       `json:"user"`
	Comment   string       `json:"comment,omitempty"`
	Email     string       `json:"email,omitempty"`
	Enable    bool         `json:"enable"`
	Expire    uint         `json:"expire"`
	FirstName string       `json:"firstname,omitempty"`
	Groups    *[]GroupName `json:"groups,omitempty"`
	Keys      string       `json:"keys,omitempty"`
	LastName  string       `json:"lastname,omitempty"`
	// Password is always empty when getting information from Proxmox
	Password UserPassword `json:"-"`
}

User options for the Proxmox API

func NewConfigUserFromApi

func NewConfigUserFromApi(userId UserID, client *Client) (*ConfigUser, error)

func NewConfigUserFromJson

func NewConfigUserFromJson(input []byte) (config *ConfigUser, err error)

func (ConfigUser) CreateApiToken

func (config ConfigUser) CreateApiToken(client *Client, token ApiToken) (value string, err error)

func (ConfigUser) CreateUser

func (config ConfigUser) CreateUser(client *Client) (err error)

func (ConfigUser) DeleteApiToken

func (config ConfigUser) DeleteApiToken(client *Client, token ApiToken) (err error)

func (ConfigUser) DeleteUser

func (config ConfigUser) DeleteUser(client *Client) (err error)

func (ConfigUser) ListApiTokens

func (config ConfigUser) ListApiTokens(client *Client) (tokens *[]ApiToken, err error)

func (*ConfigUser) SetUser

func (config *ConfigUser) SetUser(userId UserID, password UserPassword, client *Client) (err error)

Create or update the user depending on if the user already exists or not. "userId" and "password" overwrite what is specified in "*ConfigUser".

func (ConfigUser) UpdateApiToken

func (config ConfigUser) UpdateApiToken(client *Client, token ApiToken) (err error)

func (*ConfigUser) UpdateUser

func (config *ConfigUser) UpdateUser(client *Client) (err error)

func (ConfigUser) UpdateUserPassword

func (config ConfigUser) UpdateUserPassword(client *Client) (err error)

func (ConfigUser) Validate

func (config ConfigUser) Validate() (err error)

Validates all items and sub items in the ConfigUser struct

type ContentType

type ContentType string
const (
	ContentType_Backup    ContentType = "backup"
	ContentType_Container ContentType = "container"
	ContentType_DiskImage ContentType = "diskimage"
	ContentType_Iso       ContentType = "iso"
	ContentType_Snippets  ContentType = "snippets"
	ContentType_Template  ContentType = "template"
)

func (ContentType) Validate

func (c ContentType) Validate() (err error)

Returns an error if the enum value is invalid.

type Content_File

type Content_File struct {
	Storage     string
	ContentType ContentType
	FilePath    string
}

func (Content_File) Validate

func (c Content_File) Validate() (err error)

Return an error if the required fields are empty

type Content_FileProperties

type Content_FileProperties struct {
	Name         string    `json:"name"`
	CreationTime time.Time `json:"time"`
	Format       string    `json:"format"`
	Size         uint      `json:"size"`
}

type GroupName

type GroupName string

GroupName may only contain the following characters: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-_

func (GroupName) AddUsersToGroup

func (group GroupName) AddUsersToGroup(members *[]UserID, client *Client) error

Add users to the specified group

func (GroupName) CheckExistence

func (group GroupName) CheckExistence(client *Client) (bool, error)

Check if the specified group exists.

func (GroupName) Delete

func (group GroupName) Delete(client *Client) (err error)

Deletes the specified group

func (GroupName) RemoveAllUsersFromGroup

func (group GroupName) RemoveAllUsersFromGroup(client *Client) (err error)

Recursively remove all users from the specified group

func (GroupName) RemoveUsersFromGroup

func (group GroupName) RemoveUsersFromGroup(members *[]UserID, client *Client) (err error)

Remove users from the specified group

func (GroupName) SetMembers

func (group GroupName) SetMembers(members *[]UserID, client *Client) (err error)

Recursively add and remove users from the specified group so only the the specified users will be members of the group

func (GroupName) Validate

func (group GroupName) Validate() error

Check if a groupname is valid.

type GuestResource

type GuestResource struct {
	CpuCores           uint      `json:"cpu_cores"`
	CpuUsage           float64   `json:"cpu_usage"`
	DiskReadTotal      uint      `json:"disk_read"`
	DiskSizeInBytes    uint      `json:"disk_size"`
	DiskUsedInBytes    uint      `json:"disk_used"`
	DiskWriteTotal     uint      `json:"disk_write"`
	HaState            string    `json:"hastate"` // TODO custom type?
	Id                 uint      `json:"id"`
	MemoryTotalInBytes uint      `json:"memory_total"`
	MemoryUsedInBytes  uint      `json:"memory_used"`
	Name               string    `json:"name"` // TODO custom type
	NetworkIn          uint      `json:"network_in"`
	NetworkOut         uint      `json:"network_out"`
	Node               string    `json:"node"`   // TODO custom type
	Pool               string    `json:"pool"`   // TODO custom type
	Status             string    `json:"status"` // TODO custom type?
	Tags               []string  `json:"tags"`   // TODO custom type
	Template           bool      `json:"template"`
	Type               GuestType `json:"type"`
	UptimeInSeconds    uint      `json:"uptime"`
}

func ListGuests

func ListGuests(client *Client) ([]GuestResource, error)

List all guest the user has viewing rights for in the cluster

type GuestType

type GuestType string
const (
	GuestLXC  GuestType = "lxc"
	GuestQemu GuestType = "qemu"
)

type HAGroup

type HAGroup struct {
	Comment    string   // Description.
	Group      string   // The HA group identifier.
	Nodes      []string // List of cluster node names with optional priority. LIKE: <node>[:<pri>]{,<node>[:<pri>]}*
	NoFailback bool     // The CRM tries to run services on the node with the highest priority. If a node with higher priority comes online, the CRM migrates the service to that node. Enabling nofailback prevents that behavior.
	Restricted bool     // Resources bound to restricted groups may only run on nodes defined by the group.
	Type       string   // Group type
}

type IpconfigMap

type IpconfigMap map[int]interface{}

type IsoFile

type IsoFile struct {
	File    string `json:"file"`
	Storage string `json:"storage"`
	// Size can only be retrieved, setting it has no effect
	Size string `json:"size"`
}

func (IsoFile) Validate

func (iso IsoFile) Validate() error

type QemuCdRom

type QemuCdRom struct {
	Iso *IsoFile `json:"iso,omitempty"`
	// Passthrough and File are mutually exclusive
	Passthrough bool `json:"passthrough,omitempty"`
}

func (QemuCdRom) Validate

func (cdRom QemuCdRom) Validate() error

type QemuCloudInitDisk

type QemuCloudInitDisk struct {
	Format  QemuDiskFormat `json:"format,omitempty"`
	Storage string         `json:"storage,omitempty"`
}

func (QemuCloudInitDisk) Validate

func (cloudInit QemuCloudInitDisk) Validate() 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 QemuDevices map[int]map[string]interface{}

type QemuDiskAsyncIO

type QemuDiskAsyncIO string
const (
	QemuDiskAsyncIO_Native  QemuDiskAsyncIO = "native"
	QemuDiskAsyncIO_Threads QemuDiskAsyncIO = "threads"
	QemuDiskAsyncIO_IOuring QemuDiskAsyncIO = "io_uring"
)

func (QemuDiskAsyncIO) Error

func (QemuDiskAsyncIO) Error() error

func (QemuDiskAsyncIO) Validate

func (asyncIO QemuDiskAsyncIO) Validate() error

type QemuDiskBandwidth

type QemuDiskBandwidth struct {
	MBps QemuDiskBandwidthMBps `json:"mbps,omitempty"`
	Iops QemuDiskBandwidthIops `json:"iops,omitempty"`
}

func (QemuDiskBandwidth) Validate

func (bandwidth QemuDiskBandwidth) Validate() error

type QemuDiskBandwidthIops

type QemuDiskBandwidthIops struct {
	ReadLimit  QemuDiskBandwidthIopsLimit `json:"read,omitempty"`
	WriteLimit QemuDiskBandwidthIopsLimit `json:"write,omitempty"`
}

func (QemuDiskBandwidthIops) Validate

func (iops QemuDiskBandwidthIops) Validate() error

type QemuDiskBandwidthIopsLimit

type QemuDiskBandwidthIopsLimit struct {
	Burst         QemuDiskBandwidthIopsLimitBurst      `json:"burst,omitempty"`          // 0 = unlimited
	BurstDuration uint                                 `json:"burst_duration,omitempty"` // burst duration in seconds
	Concurrent    QemuDiskBandwidthIopsLimitConcurrent `json:"concurrent,omitempty"`     // 0 = unlimited
}

func (QemuDiskBandwidthIopsLimit) Validate

func (limit QemuDiskBandwidthIopsLimit) Validate() (err error)

type QemuDiskBandwidthIopsLimitBurst

type QemuDiskBandwidthIopsLimitBurst uint

func (QemuDiskBandwidthIopsLimitBurst) Validate

func (limit QemuDiskBandwidthIopsLimitBurst) Validate() error

type QemuDiskBandwidthIopsLimitConcurrent

type QemuDiskBandwidthIopsLimitConcurrent uint

func (QemuDiskBandwidthIopsLimitConcurrent) Validate

type QemuDiskBandwidthMBps

type QemuDiskBandwidthMBps struct {
	ReadLimit  QemuDiskBandwidthMBpsLimit `json:"read,omitempty"`
	WriteLimit QemuDiskBandwidthMBpsLimit `json:"write,omitempty"`
}

func (QemuDiskBandwidthMBps) Validate

func (data QemuDiskBandwidthMBps) Validate() error

type QemuDiskBandwidthMBpsLimit

type QemuDiskBandwidthMBpsLimit struct {
	Burst      QemuDiskBandwidthMBpsLimitBurst      `json:"burst,omitempty"`      // 0 = unlimited
	Concurrent QemuDiskBandwidthMBpsLimitConcurrent `json:"concurrent,omitempty"` // 0 = unlimited
}

func (QemuDiskBandwidthMBpsLimit) Validate

func (limit QemuDiskBandwidthMBpsLimit) Validate() (err error)

type QemuDiskBandwidthMBpsLimitBurst

type QemuDiskBandwidthMBpsLimitBurst float32

func (QemuDiskBandwidthMBpsLimitBurst) Validate

func (limit QemuDiskBandwidthMBpsLimitBurst) Validate() error

type QemuDiskBandwidthMBpsLimitConcurrent

type QemuDiskBandwidthMBpsLimitConcurrent float32

func (QemuDiskBandwidthMBpsLimitConcurrent) Validate

type QemuDiskCache

type QemuDiskCache string
const (
	QemuDiskCache_None         QemuDiskCache = "none"
	QemuDiskCache_WriteThrough QemuDiskCache = "writethrough"
	QemuDiskCache_WriteBack    QemuDiskCache = "writeback"
	QemuDiskCache_Unsafe       QemuDiskCache = "unsafe"
	QemuDiskCache_DirectSync   QemuDiskCache = "directsync"
)

func (QemuDiskCache) Error

func (QemuDiskCache) Error() error

func (QemuDiskCache) Validate

func (cache QemuDiskCache) Validate() error

type QemuDiskFormat

type QemuDiskFormat string
const (
	QemuDiskFormat_Cow   QemuDiskFormat = "cow"
	QemuDiskFormat_Cloop QemuDiskFormat = "cloop"
	QemuDiskFormat_Qcow  QemuDiskFormat = "qcow"
	QemuDiskFormat_Qcow2 QemuDiskFormat = "qcow2"
	QemuDiskFormat_Qed   QemuDiskFormat = "qed"
	QemuDiskFormat_Vmdk  QemuDiskFormat = "vmdk"
	QemuDiskFormat_Raw   QemuDiskFormat = "raw"
)

func (QemuDiskFormat) Error

func (QemuDiskFormat) Error() error

func (QemuDiskFormat) Validate

func (format QemuDiskFormat) Validate() error

type QemuDiskId

type QemuDiskId string

func (QemuDiskId) Validate

func (id QemuDiskId) Validate() error

type QemuDiskSerial

type QemuDiskSerial string

func (QemuDiskSerial) Validate

func (serial QemuDiskSerial) Validate() error

QemuDiskSerial may only contain the following characters: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-_ And has a max length of 60 characters

type QemuIdeDisk

type QemuIdeDisk struct {
	AsyncIO      QemuDiskAsyncIO   `json:"asyncio,omitempty"`
	Backup       bool              `json:"backup"`
	Bandwidth    QemuDiskBandwidth `json:"bandwidth,omitempty"`
	Cache        QemuDiskCache     `json:"cache,omitempty"`
	Discard      bool              `json:"discard"`
	EmulateSSD   bool              `json:"emulatessd"`
	Format       QemuDiskFormat    `json:"format"`
	Id           uint              `json:"id"`     //Id is only returned and setting it has no effect
	LinkedDiskId *uint             `json:"linked"` //LinkedClone is only returned and setting it has no effect
	Replicate    bool              `json:"replicate"`
	Serial       QemuDiskSerial    `json:"serial,omitempty"`
	Size         uint              `json:"size"`
	Storage      string            `json:"storage"`
}

func (QemuIdeDisk) Validate

func (disk QemuIdeDisk) Validate() error

type QemuIdeDisks

type QemuIdeDisks struct {
	Disk_0 *QemuIdeStorage `json:"0,omitempty"`
	Disk_1 *QemuIdeStorage `json:"1,omitempty"`
	Disk_2 *QemuIdeStorage `json:"2,omitempty"`
	Disk_3 *QemuIdeStorage `json:"3,omitempty"`
}

func (QemuIdeDisks) Validate

func (disks QemuIdeDisks) Validate() (err error)

type QemuIdePassthrough

type QemuIdePassthrough struct {
	AsyncIO    QemuDiskAsyncIO   `json:"asyncio,omitempty"`
	Backup     bool              `json:"backup"`
	Bandwidth  QemuDiskBandwidth `json:"bandwidth,omitempty"`
	Cache      QemuDiskCache     `json:"cache,omitempty"`
	Discard    bool              `json:"discard"`
	EmulateSSD bool              `json:"emulatessd"`
	File       string            `json:"file"`
	Replicate  bool              `json:"replicate"`
	Serial     QemuDiskSerial    `json:"serial,omitempty"`
	Size       uint              `json:"size"` //size is only returned and setting it has no effect
}

func (QemuIdePassthrough) Validate

func (passthrough QemuIdePassthrough) Validate() error

type QemuIdeStorage

type QemuIdeStorage struct {
	CdRom       *QemuCdRom          `json:"cdrom,omitempty"`
	CloudInit   *QemuCloudInitDisk  `json:"cloudinit,omitempty"`
	Disk        *QemuIdeDisk        `json:"disk,omitempty"`
	Passthrough *QemuIdePassthrough `json:"passthrough,omitempty"`
}

func (QemuIdeStorage) Validate

func (storage QemuIdeStorage) Validate() (err error)

type QemuSataDisk

type QemuSataDisk struct {
	AsyncIO      QemuDiskAsyncIO   `json:"asyncio,omitempty"`
	Backup       bool              `json:"backup"`
	Bandwidth    QemuDiskBandwidth `json:"bandwidth,omitempty"`
	Cache        QemuDiskCache     `json:"cache,omitempty"`
	Discard      bool              `json:"discard"`
	EmulateSSD   bool              `json:"emulatessd"`
	Format       QemuDiskFormat    `json:"format"`
	Id           uint              `json:"id"`     //Id is only returned and setting it has no effect
	LinkedDiskId *uint             `json:"linked"` //LinkedClone is only returned and setting it has no effect
	Replicate    bool              `json:"replicate"`
	Serial       QemuDiskSerial    `json:"serial,omitempty"`
	Size         uint              `json:"size"`
	Storage      string            `json:"storage"`
}

func (QemuSataDisk) Validate

func (disk QemuSataDisk) Validate() error

type QemuSataDisks

type QemuSataDisks struct {
	Disk_0 *QemuSataStorage `json:"0,omitempty"`
	Disk_1 *QemuSataStorage `json:"1,omitempty"`
	Disk_2 *QemuSataStorage `json:"2,omitempty"`
	Disk_3 *QemuSataStorage `json:"3,omitempty"`
	Disk_4 *QemuSataStorage `json:"4,omitempty"`
	Disk_5 *QemuSataStorage `json:"5,omitempty"`
}

func (QemuSataDisks) Validate

func (disks QemuSataDisks) Validate() (err error)

type QemuSataPassthrough

type QemuSataPassthrough struct {
	AsyncIO    QemuDiskAsyncIO   `json:"asyncio,omitempty"`
	Backup     bool              `json:"backup"`
	Bandwidth  QemuDiskBandwidth `json:"bandwidth,omitempty"`
	Cache      QemuDiskCache     `json:"cache,omitempty"`
	Discard    bool              `json:"discard"`
	EmulateSSD bool              `json:"emulatessd"`
	File       string            `json:"file"`
	Replicate  bool              `json:"replicate"`
	Serial     QemuDiskSerial    `json:"serial,omitempty"`
	Size       uint              `json:"size"` //size is only returned and setting it has no effect
}

func (QemuSataPassthrough) Validate

func (passthrough QemuSataPassthrough) Validate() error

type QemuSataStorage

type QemuSataStorage struct {
	CdRom       *QemuCdRom           `json:"cdrom,omitempty"`
	CloudInit   *QemuCloudInitDisk   `json:"cloudinit,omitempty"`
	Disk        *QemuSataDisk        `json:"disk,omitempty"`
	Passthrough *QemuSataPassthrough `json:"passthrough,omitempty"`
}

func (QemuSataStorage) Validate

func (storage QemuSataStorage) Validate() (err error)

type QemuScsiDisk

type QemuScsiDisk struct {
	AsyncIO      QemuDiskAsyncIO   `json:"asyncio,omitempty"`
	Backup       bool              `json:"backup"`
	Bandwidth    QemuDiskBandwidth `json:"bandwidth,omitempty"`
	Cache        QemuDiskCache     `json:"cache,omitempty"`
	Discard      bool              `json:"discard"`
	EmulateSSD   bool              `json:"emulatessd"`
	Format       QemuDiskFormat    `json:"format"`
	Id           uint              `json:"id"` //Id is only returned and setting it has no effect
	IOThread     bool              `json:"iothread"`
	LinkedDiskId *uint             `json:"linked"` //LinkedCloneId is only returned and setting it has no effect
	ReadOnly     bool              `json:"readonly"`
	Replicate    bool              `json:"replicate"`
	Serial       QemuDiskSerial    `json:"serial,omitempty"`
	Size         uint              `json:"size"`
	Storage      string            `json:"storage"`
}

func (QemuScsiDisk) Validate

func (disk QemuScsiDisk) Validate() error

type QemuScsiDisks

type QemuScsiDisks struct {
	Disk_0  *QemuScsiStorage `json:"0,omitempty"`
	Disk_1  *QemuScsiStorage `json:"1,omitempty"`
	Disk_2  *QemuScsiStorage `json:"2,omitempty"`
	Disk_3  *QemuScsiStorage `json:"3,omitempty"`
	Disk_4  *QemuScsiStorage `json:"4,omitempty"`
	Disk_5  *QemuScsiStorage `json:"5,omitempty"`
	Disk_6  *QemuScsiStorage `json:"6,omitempty"`
	Disk_7  *QemuScsiStorage `json:"7,omitempty"`
	Disk_8  *QemuScsiStorage `json:"8,omitempty"`
	Disk_9  *QemuScsiStorage `json:"9,omitempty"`
	Disk_10 *QemuScsiStorage `json:"10,omitempty"`
	Disk_11 *QemuScsiStorage `json:"11,omitempty"`
	Disk_12 *QemuScsiStorage `json:"12,omitempty"`
	Disk_13 *QemuScsiStorage `json:"13,omitempty"`
	Disk_14 *QemuScsiStorage `json:"14,omitempty"`
	Disk_15 *QemuScsiStorage `json:"15,omitempty"`
	Disk_16 *QemuScsiStorage `json:"16,omitempty"`
	Disk_17 *QemuScsiStorage `json:"17,omitempty"`
	Disk_18 *QemuScsiStorage `json:"18,omitempty"`
	Disk_19 *QemuScsiStorage `json:"19,omitempty"`
	Disk_20 *QemuScsiStorage `json:"20,omitempty"`
	Disk_21 *QemuScsiStorage `json:"21,omitempty"`
	Disk_22 *QemuScsiStorage `json:"22,omitempty"`
	Disk_23 *QemuScsiStorage `json:"23,omitempty"`
	Disk_24 *QemuScsiStorage `json:"24,omitempty"`
	Disk_25 *QemuScsiStorage `json:"25,omitempty"`
	Disk_26 *QemuScsiStorage `json:"26,omitempty"`
	Disk_27 *QemuScsiStorage `json:"27,omitempty"`
	Disk_28 *QemuScsiStorage `json:"28,omitempty"`
	Disk_29 *QemuScsiStorage `json:"29,omitempty"`
	Disk_30 *QemuScsiStorage `json:"30,omitempty"`
}

func (QemuScsiDisks) Validate

func (disks QemuScsiDisks) Validate() (err error)

type QemuScsiPassthrough

type QemuScsiPassthrough struct {
	AsyncIO    QemuDiskAsyncIO   `json:"asyncio,omitempty"`
	Backup     bool              `json:"backup"`
	Bandwidth  QemuDiskBandwidth `json:"bandwidth,omitempty"`
	Cache      QemuDiskCache     `json:"cache,omitempty"`
	Discard    bool              `json:"discard"`
	EmulateSSD bool              `json:"emulatessd"`
	File       string            `json:"file"`
	IOThread   bool              `json:"iothread"`
	ReadOnly   bool              `json:"readonly"`
	Replicate  bool              `json:"replicate"`
	Serial     QemuDiskSerial    `json:"serial,omitempty"`
	Size       uint              `json:"size"` //size is only returned and setting it has no effect
}

func (QemuScsiPassthrough) Validate

func (passthrough QemuScsiPassthrough) Validate() error

type QemuScsiStorage

type QemuScsiStorage struct {
	CdRom       *QemuCdRom           `json:"cdrom,omitempty"`
	CloudInit   *QemuCloudInitDisk   `json:"cloudinit,omitempty"`
	Disk        *QemuScsiDisk        `json:"disk,omitempty"`
	Passthrough *QemuScsiPassthrough `json:"passthrough,omitempty"`
}

func (QemuScsiStorage) Validate

func (storage QemuScsiStorage) Validate() (err error)

type QemuStorages

type QemuStorages struct {
	Ide    *QemuIdeDisks    `json:"ide,omitempty"`
	Sata   *QemuSataDisks   `json:"sata,omitempty"`
	Scsi   *QemuScsiDisks   `json:"scsi,omitempty"`
	VirtIO *QemuVirtIODisks `json:"virtio,omitempty"`
}

func (QemuStorages) Validate

func (storages QemuStorages) Validate() (err error)

type QemuVirtIODisk

type QemuVirtIODisk struct {
	AsyncIO      QemuDiskAsyncIO   `json:"asyncio,omitempty"`
	Backup       bool              `json:"backup"`
	Bandwidth    QemuDiskBandwidth `json:"bandwidth,omitempty"`
	Cache        QemuDiskCache     `json:"cache,omitempty"`
	Discard      bool              `json:"discard"`
	Format       QemuDiskFormat    `json:"format"`
	Id           uint              `json:"id"` //Id is only returned and setting it has no effect
	IOThread     bool              `json:"iothread"`
	LinkedDiskId *uint             `json:"linked"` //LinkedCloneId is only returned and setting it has no effect
	ReadOnly     bool              `json:"readonly"`
	Replicate    bool              `json:"replicate"`
	Serial       QemuDiskSerial    `json:"serial,omitempty"`
	Size         uint              `json:"size"`
	Storage      string            `json:"storage"`
}

func (QemuVirtIODisk) Validate

func (disk QemuVirtIODisk) Validate() error

type QemuVirtIODisks

type QemuVirtIODisks struct {
	Disk_0  *QemuVirtIOStorage `json:"0,omitempty"`
	Disk_1  *QemuVirtIOStorage `json:"1,omitempty"`
	Disk_2  *QemuVirtIOStorage `json:"2,omitempty"`
	Disk_3  *QemuVirtIOStorage `json:"3,omitempty"`
	Disk_4  *QemuVirtIOStorage `json:"4,omitempty"`
	Disk_5  *QemuVirtIOStorage `json:"5,omitempty"`
	Disk_6  *QemuVirtIOStorage `json:"6,omitempty"`
	Disk_7  *QemuVirtIOStorage `json:"7,omitempty"`
	Disk_8  *QemuVirtIOStorage `json:"8,omitempty"`
	Disk_9  *QemuVirtIOStorage `json:"9,omitempty"`
	Disk_10 *QemuVirtIOStorage `json:"10,omitempty"`
	Disk_11 *QemuVirtIOStorage `json:"11,omitempty"`
	Disk_12 *QemuVirtIOStorage `json:"12,omitempty"`
	Disk_13 *QemuVirtIOStorage `json:"13,omitempty"`
	Disk_14 *QemuVirtIOStorage `json:"14,omitempty"`
	Disk_15 *QemuVirtIOStorage `json:"15,omitempty"`
}

func (QemuVirtIODisks) Validate

func (disks QemuVirtIODisks) Validate() (err error)

type QemuVirtIOPassthrough

type QemuVirtIOPassthrough struct {
	AsyncIO   QemuDiskAsyncIO   `json:"asyncio,omitempty"`
	Backup    bool              `json:"backup"`
	Bandwidth QemuDiskBandwidth `json:"bandwidth,omitempty"`
	Cache     QemuDiskCache     `json:"cache,omitempty"`
	Discard   bool              `json:"discard"`
	File      string            `json:"file"`
	IOThread  bool              `json:"iothread"`
	ReadOnly  bool              `json:"readonly"`
	Replicate bool              `json:"replicate"`
	Serial    QemuDiskSerial    `json:"serial,omitempty"`
	Size      uint              `json:"size"` //size is only returned and setting it has no effect
}

func (QemuVirtIOPassthrough) Validate

func (passthrough QemuVirtIOPassthrough) Validate() error

type QemuVirtIOStorage

type QemuVirtIOStorage struct {
	CdRom       *QemuCdRom             `json:"cdrom,omitempty"`
	CloudInit   *QemuCloudInitDisk     `json:"cloudinit,omitempty"`
	Disk        *QemuVirtIODisk        `json:"disk,omitempty"`
	Passthrough *QemuVirtIOPassthrough `json:"passthrough,omitempty"`
}

func (QemuVirtIOStorage) Validate

func (storage QemuVirtIOStorage) Validate() (err error)

type Response

type Response struct {
	Resp *http.Response
	Body []byte
}

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 NewSession(apiUrl string, hclient *http.Client, proxyString string, tls *tls.Config) (session *Session, err error)

func (*Session) Delete

func (s *Session) Delete(
	url string,
	params *url.Values,
	headers *http.Header,
) (resp *http.Response, err error)

func (*Session) Do

func (s *Session) Do(req *http.Request) (*http.Response, error)

func (*Session) Get

func (s *Session) Get(
	url string,
	params *url.Values,
	headers *http.Header,
) (resp *http.Response, err error)

func (*Session) GetJSON

func (s *Session) GetJSON(
	url string,
	params *url.Values,
	headers *http.Header,
	responseContainer interface{},
) (resp *http.Response, err error)

func (*Session) Head

func (s *Session) Head(
	url string,
	params *url.Values,
	headers *http.Header,
) (resp *http.Response, err error)

func (*Session) Login

func (s *Session) Login(username string, password string, otp string) (err error)

func (*Session) NewRequest

func (s *Session) NewRequest(method, url string, headers *http.Header, body io.Reader) (req *http.Request, err error)

func (*Session) Post

func (s *Session) Post(
	url string,
	params *url.Values,
	headers *http.Header,
	body *[]byte,
) (resp *http.Response, err error)

func (*Session) PostJSON

func (s *Session) PostJSON(
	url string,
	params *url.Values,
	headers *http.Header,
	body interface{},
	responseContainer interface{},
) (resp *http.Response, err error)

func (*Session) Put

func (s *Session) Put(
	url string,
	params *url.Values,
	headers *http.Header,
	body *[]byte,
) (resp *http.Response, err error)

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 unmarshal returned JSON

func (*Session) SetAPIToken

func (s *Session) SetAPIToken(userID, token string)

type Snapshot

type Snapshot struct {
	Name        string      `json:"name"`
	SnapTime    uint        `json:"time,omitempty"`
	Description string      `json:"description,omitempty"`
	VmState     bool        `json:"ram,omitempty"`
	Children    []*Snapshot `json:"children,omitempty"`
	Parent      string      `json:"parent,omitempty"`
}

Used for formatting the output when retrieving snapshots

type TemplateItem

type TemplateItem struct {
	Architecture   string
	Description    string
	Headline       string
	InfoPage       string
	Location       string
	ManageURL      string
	OS             string
	Package        string
	Section        string
	SHA512Checksum string
	Source         string
	Template       string
	Type           string
	Version        string
}

type UserID

type UserID struct {
	// TODO create custom type for Name.
	// the name only seems to allows some characters, and using the string type would imply that all characters are allowed.
	// https://bugzilla.proxmox.com/show_bug.cgi?id=4461
	Name string `json:"name"`
	// TODO create custom type for Realm.
	// the realm only allows some characters, and using the string type would imply that all characters are allowed.
	// https://bugzilla.proxmox.com/show_bug.cgi?id=4462
	Realm string `json:"realm"`
}

func NewUserID

func NewUserID(userId string) (id UserID, err error)

Converts "username@realm" to a UserID object

func (UserID) ToString

func (id UserID) ToString() string

Converts the userID to "username@realm" Returns an empty string when either the Name or Realm is empty

func (UserID) Validate

func (id UserID) Validate() error

TODO improve when Name and Realm have their own types

type UserPassword

type UserPassword string

May be empty or should be at least be 5 characters long.

func (UserPassword) Validate

func (password UserPassword) Validate() error

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]

func NewVmRef

func NewVmRef(vmId int) (vmr *VmRef)

func (*VmRef) GetVmType

func (vmr *VmRef) GetVmType() string

func (*VmRef) HaGroup

func (vmr *VmRef) HaGroup() string

func (*VmRef) HaState

func (vmr *VmRef) HaState() string

func (*VmRef) Node

func (vmr *VmRef) Node() string

func (*VmRef) Pool

func (vmr *VmRef) Pool() string

func (*VmRef) SetNode

func (vmr *VmRef) SetNode(node string)

func (*VmRef) SetPool

func (vmr *VmRef) SetPool(pool string)

func (*VmRef) SetVmType

func (vmr *VmRef) SetVmType(vmType string)

func (*VmRef) VmId

func (vmr *VmRef) VmId() int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL