api

package
v0.0.0-...-15aa78f Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2016 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	OtherOS        OSType = "other"
	MSWindowsXP           = "wxp"
	MSWindows2000         = "w2k"
	MSWindows2003         = "w2k3"
	MSWindows2008         = "w2k8"
	MSWindowsVista        = "wvista"
	MSWindows7            = "win7"
	MSWindows8            = "win8"
	Linux24               = "l24"
	Linux26               = "l26"
	Solaris               = "solaris"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	BaseURL  string
	Username string
	Password string
	Client   *http.Client
	// contains filtered or unexported fields
}

func NewAPI

func NewAPI(baseURL string, username string, password string) *API

func (*API) CreateVM

func (api *API) CreateVM(options *CreateVMOptions) error

func (*API) DeleteVM

func (api *API) DeleteVM(node string, id int) error

func (*API) GetVMStatus

func (api *API) GetVMStatus(node string, id int) (*VM, error)

func (*API) ListNodes

func (api *API) ListNodes() ([]Node, error)

func (*API) ListVMsOnNode

func (api *API) ListVMsOnNode(node string) ([]VM, error)

func (*API) ResetVM

func (api *API) ResetVM(node string, id int) error

func (*API) StartVM

func (api *API) StartVM(node string, id int) error

func (*API) StopVM

func (api *API) StopVM(node string, id int) error

func (*API) VNCProxy

func (api *API) VNCProxy(node string, id int) error

type AuthenticateResponse

type AuthenticateResponse struct {
	CSRFPreventionToken string `json:"CSRFPreventionToken"`
	Ticket              string `json:"ticket"`
	Username            string `json:"username"`
}

type CreateVMOptions

type CreateVMOptions struct {
	ID   int
	Node string
	Name string

	// Number of cores per socket
	Cores int

	// Amount of RAM in MB
	Memory int

	// Operating system type, to enable special optimization/features for specific OS
	OSType OSType

	// ISO identifier, like "local:iso/ubuntu.iso"
	ISO string

	// Storage destination, defaults to "local"
	Storage string

	// Disk capacity in GB
	DiskSize int

	// Network bridge name, if empty then uses default NAT setup
	NetworkBridge string

	// Network driver, defaults to e1000
	NetworkDriver NetworkDriver
}

type NetworkDriver

type NetworkDriver string
const (
	E1000     NetworkDriver = "e1000"
	VirtioNet               = "virtio"
)

type Node

type Node struct {
	Node string `json:"node"`

	Memory    int64 `json:"mem"`
	MaxMemory int64 `json:"maxmem"`

	Disk    int64 `json:"disk"`
	MaxDisk int64 `json:"maxdisk"`
}

type OSType

type OSType string

type VM

type VM struct {
	ID     int    `json:"vmid"`
	Name   string `json:"name"`
	Status string `json:"status"`
	CPUs   int    `json:"cpus"`

	Memory    int64 `json:"mem"`
	MaxMemory int64 `json:"maxmem"`

	Disk    int64 `json:"disk"`
	MaxDisk int64 `json:"maxdisk"`
}

Jump to

Keyboard shortcuts

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