proxmox

package module
v0.0.0-...-92dc169 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2016 License: BSD-3-Clause Imports: 14 Imported by: 0

README

go-proxmox

Proxmox API in golang. This is work in progress and far from being complete. Contributions and suggestions are welcome.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	Mem      float64 `json:"mem"`
	MaxDisk  float64 `json:"maxdisk"`
	Node     string  `json:"node"`
	MaxCPU   float64 `json:"maxcpu"`
	Uptime   float64 `json:"uptime"`
	Id       string  `json:"id"`
	CPU      float64 `json:"cpu"`
	Level    string  `json:"level"`
	NodeType string  `json:"nodetype"`
	Disk     float64 `json:"disk"`
	MaxMem   float64 `json:"maxmem"`
	Proxmox  ProxMox
}

func (Node) CreateQemuVM

func (node Node) CreateQemuVM(Name string, Sockets int, Cores int, MemorySize int, DiskSize string) (string, error)

func (Node) MaxQemuId

func (node Node) MaxQemuId() (float64, error)

func (Node) Qemu

func (node Node) Qemu() (QemuList, error)

func (Node) Storages

func (node Node) Storages() (StorageList, error)

func (Node) Tasks

func (node Node) Tasks(Limit int, Start int, UserFilter string, VmId string) (TaskList, error)

func (Node) VZDump

func (node Node) VZDump(VmId string, BWLimit int, Compress string, IONice int, LockWait int, Mode string) (string, error)

type NodeList

type NodeList map[string]Node

type NodeListResult

type NodeListResult struct {
	Data NodeList `json:"data"`
}

type ProxMox

type ProxMox struct {
	Hostname string
	Username string

	VerifySSL bool
	BaseURL   string

	ConnectionTicket string
	// contains filtered or unexported fields
}

func NewProxMox

func NewProxMox(HostName string, UserName string, Password string) (*ProxMox, error)

func (ProxMox) Delete

func (proxmox ProxMox) Delete(endpoint string) (map[string]interface{}, error)

func (ProxMox) DetermineVMPlacement

func (proxmox ProxMox) DetermineVMPlacement(cpu int64, cores int64, mem int64, overCommitCPU float64, overCommitMem float64) (Node, error)

func (ProxMox) FindVM

func (proxmox ProxMox) FindVM(VmId string) (QemuVM, error)

func (ProxMox) Get

func (proxmox ProxMox) Get(endpoint string) (map[string]interface{}, error)

func (ProxMox) GetBytes

func (proxmox ProxMox) GetBytes(endpoint string) ([]byte, error)

func (ProxMox) NextVMId

func (proxmox ProxMox) NextVMId() (float64, error)

func (ProxMox) Nodes

func (proxmox ProxMox) Nodes() (NodeList, error)

func (ProxMox) Post

func (proxmox ProxMox) Post(endpoint string, input string) (map[string]interface{}, error)

func (ProxMox) PostForm

func (proxmox ProxMox) PostForm(endpoint string, form url.Values) (map[string]interface{}, error)

func (ProxMox) Tasks

func (proxmox ProxMox) Tasks() (TaskList, error)

type QemuConfig

type QemuConfig struct {
	Bootdisk string  `json:"bootdisk"`
	Cores    float64 `json:"cores"`
	Digest   string  `json:"digest"`
	Memory   float64 `json:"memory"`
	Net      map[string]QemuNet
	SMBios1  string            `json:"smbios1"`
	Sockets  float64           `json:"sockets"`
	Disks    map[string]string `json:"disks"`
}

type QemuList

type QemuList map[string]QemuVM

type QemuNet

type QemuNet map[string]string

type QemuStatus

type QemuStatus struct {
	CPU       float64 `json:"cpu"`
	CPUs      float64 `json:"cpus"`
	Mem       float64 `json:"mem"`
	MaxMem    float64 `json:"maxmem"`
	Disk      float64 `json:"disk"`
	MaxDisk   float64 `json:"maxdisk"`
	DiskWrite float64 `json:"diskwrite"`
	DiskRead  float64 `json:"diskread"`
	NetIn     float64 `json:"netin"`
	NetOut    float64 `json:"netout"`
	Uptime    float64 `json:"uptime"`
	QmpStatus string  `json:"qmpstatus"`
	Status    string  `json:"status"`
	Template  string  `json:"template"`
}

type QemuVM

type QemuVM struct {
	Mem       float64 `json:"mem"`
	CPUs      float64 `json:"cpus"`
	NetOut    float64 `json:"netout"`
	PID       string  `json:"pid"`
	Disk      float64 `json:"disk"`
	MaxMem    float64 `json:"maxmem"`
	Status    string  `json:"status"`
	Template  float64 `json:"template"`
	NetIn     float64 `json:"netin"`
	MaxDisk   float64 `json:"maxdisk"`
	Name      string  `json:"name"`
	DiskWrite float64 `json:"diskwrite"`
	CPU       float64 `json:"cpu"`
	VMId      float64 `json:"vmid"`
	DiskRead  float64 `json:"diskread"`
	Uptime    float64 `json:"uptime"`
	Node      Node
}

func (QemuVM) Clone

func (qemu QemuVM) Clone(newId float64, name string, targetName string) (string, error)

func (QemuVM) Config

func (qemu QemuVM) Config() (QemuConfig, error)

func (QemuVM) CurrentStatus

func (qemu QemuVM) CurrentStatus() (QemuStatus, error)

func (QemuVM) Delete

func (qemu QemuVM) Delete() (map[string]interface{}, error)

func (QemuVM) Resume

func (qemu QemuVM) Resume() error

func (QemuVM) Shutdown

func (qemu QemuVM) Shutdown() error

func (QemuVM) Start

func (qemu QemuVM) Start() error

func (QemuVM) Stop

func (qemu QemuVM) Stop() error

func (QemuVM) Suspend

func (qemu QemuVM) Suspend() error

func (QemuVM) WaitForStatus

func (qemu QemuVM) WaitForStatus(status string, timeout int) error

type Storage

type Storage struct {
	StorageType string  `json:"type"`
	Active      float64 `json:"active"`
	Total       float64 `json:"total"`
	Content     string  `json:"content"`
	Shared      float64 `json:"shared"`
	Storage     string  `json:"storage"`
	Used        float64 `json:"used"`
	Avail       float64 `json:"avail"`
	Node        Node
}

func (Storage) CreateVolume

func (storage Storage) CreateVolume(FileName string, DiskSize string, VmId string) (map[string]interface{}, error)

func (Storage) Volumes

func (storage Storage) Volumes() (VolumeList, error)

type StorageList

type StorageList map[string]Storage

type Task

type Task struct {
	UPid       string  `json:"upid"`
	Type       string  `json:"type"`
	Status     string  `json:"status"`
	ExitStatus string  `json:"exitstatus"`
	PID        float64 `json:"pid"`
	PStart     float64 `json:"pstart"`
	StartTime  float64 `json:"starttime"`
	EndTime    float64 `json:"endtime"`
	ID         string  `json:"id"`
	// contains filtered or unexported fields
}

func (Task) GetStatus

func (task Task) GetStatus() (string, string, error)

func (Task) WaitForStatus

func (task Task) WaitForStatus(status string, timeout int) (string, error)

type TaskList

type TaskList map[string]Task

type TaskResult

type TaskResult struct {
	Data Task `json:"data"`
}

type Volume

type Volume struct {
	Size    float64
	VolId   string
	VmId    string
	Format  string
	Content string
	Used    float64
	// contains filtered or unexported fields
}

type VolumeList

type VolumeList map[string]Volume

Jump to

Keyboard shortcuts

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