gplib

package module
v0.0.0-...-dfc536e Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2019 License: GPL-3.0 Imports: 6 Imported by: 0

README

Proxmox REST API client library for Go

Tested on Proxmox 5.3

Work in progress

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capabilities

type Capabilities struct {
	VMs     map[string]int `json:"vms"`
	DC      map[string]int `json:"dc"`
	Nodes   map[string]int `json:"nodes"`
	Access  map[string]int `json:"access"`
	Storage map[string]int `json:"storage"`
}

func (*Capabilities) Has

func (c *Capabilities) Has(capability string) bool

type LoginResponse

type LoginResponse struct {
	CSRFPreventionToken string       `json:"CSRFPreventionToken"`
	Username            string       `json:"username"`
	Ticket              string       `json:"ticket"`
	UserCapabilities    Capabilities `json:"cap"`
}

type LoginResponseContainer

type LoginResponseContainer struct {
	Data LoginResponse `json:"data"`
}

type NodeListContainer

type NodeListContainer struct {
	Data []NodeListItem `json:"data"`
}

type NodeListItem

type NodeListItem struct {
	ID             string `json:"id"`
	Type           string `json:"type"`
	Node           string `json:"node"`
	Status         string `json:"status"`
	Level          string `json:"level"`
	Uptime         int64  `json:"uptime"`
	SSLFingerprint string `json:"ssl_fingerprint"`

	Mem    int64 `json:"mem"`
	MaxMem int64 `json:"maxmem"`

	CPU    float64 `json:"cpu"`
	MaxCPU float64 `json:"maxcpu"`

	Disk int64 `json:"disk"`
}

type NodeNetworkInfoContainer

type NodeNetworkInfoContainer struct {
	Data NodeNetworkListItem `json:"data"`
}

type NodeNetworkListContainer

type NodeNetworkListContainer struct {
	Data []NodeNetworkListItem `json:"data"`
}

type NodeNetworkListItem

type NodeNetworkListItem struct {
	IFace     string    `json:"iface"`
	Type      string    `json:"type"`
	Active    *int      `json:"active"`
	Exists    *int      `json:"exists"`
	Autostart *int      `json:"autostart"`
	Priority  *int      `json:"priority"`
	Families  *[]string `json:"families"`
	Slaves    *string   `json:"slaves"`

	BridgeVLANAware *int    `json:"bridge_vlan_aware"`
	BridgeFD        *string `json:"bridge_fd"`
	BridgeSTP       *string `json:"bridge_stp"`
	BridgePorts     *string `json:"bridge_ports"`

	BondMode           *string `json:"bond_mode"`
	BondXmitHashPolicy *string `json:"bond_xmit_hash_policy"`

	OVSBonds   *string `json:"ovs_bonds"`
	OVSBridge  *string `json:"ovs_bridge"`
	OVSOptions *string `json:"ovs_options"`
	OVSPorts   *string `json:"ovs_ports"`
	OVSTag     int     `json:"ovs_tag"`

	Method   *string `json:"method"`
	Address  *string `json:"address"`
	Netmask  *string `json:"netmask"`
	Gateway  *string `json:"gateway"`
	Comments *string `json:"comments"`

	Method6   *string `json:"method6"`
	Address6  *string `json:"address6"`
	Netmask6  *string `json:"netmask6"`
	Gateway6  *string `json:"gateway6"`
	Comments6 *string `json:"comments6"`
}

type NodeVMListContainer

type NodeVMListContainer struct {
	Data []NodeVMListItem `json:"data"`
}

type NodeVMListItem

type NodeVMListItem struct {
	VMID     string `json:"string"`
	Name     string `json:"name"`
	PID      *int64 `json:"pid"`
	Status   string `json:"status"`
	Uptime   int64  `json:"uptime"`
	Template string `json:"template"`

	CPU  float64 `json:"cpu"`
	CPUs int     `json:"cpus"`

	Mem int64 `json:"mem"`

	NetIn  int64 `json:"netin"`
	NetOut int64 `json:"netout"`

	Disk      int64 `json:"disk"`
	DiskRead  int64 `json:"diskread"`
	DiskWrite int64 `json:"diskwrite"`
	MaxDisk   int64 `json:"maxdisk"`
}

type PoolInfo

type PoolInfo struct {
	Comment string           `json:"comment"`
	Members []PoolMemberInfo `json:"members"`
}

type PoolInfoResponse

type PoolInfoResponse struct {
	Data PoolInfo `json:"data"`
}

type PoolListItem

type PoolListItem struct {
	PoolId  string `json:"poolid"`
	Comment string `json:"comment"`
}

type PoolListItemContainer

type PoolListItemContainer struct {
	Data []PoolListItem `json:"data"`
}

type PoolMemberInfo

type PoolMemberInfo struct {
	ID        string `json:"id"`
	VMID      int    `json:"vmid"`
	Type      string `json:"type"`
	Name      string `json:"name"`
	Status    string `json:"status"`
	Node      string `json:"node"`
	Uptime    int64  `json:"uptime"`
	Template  int    `json:"template"`
	Disk      int64  `json:"disk"`
	DiskRead  int64  `json:"diskread"`
	DiskWrite int64  `json:"diskwrite"`
	MaxDisk   int64  `json:"maxdisk"`
	CPU       int    `json:"cpu"`
	MaxCPU    int    `json:"maxcpu"`
	Mem       int64  `json:"mem"`
	MaxMem    int64  `json:"maxmem"`
	NetIn     int64  `json:"netin"`
	NetOut    int64  `json:"netout"`
}

type Proxmox

type Proxmox interface {
	Login(username string, password string) (LoginResponse, error)
	GetVersion() (VersionInfo, error)

	GetUserList() ([]UserListItem, error)
	GetUserInfo(userid string) (UserInfo, error)
	NewUser(userid string, email string, expire int, firstname string, lastname string, groups []string, password string) error
	DeleteUser(userid string) error

	GetPoolList() ([]PoolListItem, error)
	NewPool(poolid string, comment string) error
	GetPoolInfo(poolid string) (PoolInfo, error)
	DeletePool(poolid string) error

	GetNodeList() ([]NodeListItem, error)

	GetNodeVMs(node string) ([]NodeVMListItem, error)

	GetNodeNetworks(node string, nictype string) ([]NodeNetworkListItem, error)
	ReloadNetworkConfig(node string) error
	RevertNetworkConfig(node string) error
}

func New

func New(serverURL string, insecureTLS bool) Proxmox

type UserInfo

type UserInfo struct {
	FirstName string   `json:"firstname"`
	LastName  string   `json:"lastname"`
	EMail     string   `json:"comment"`
	Groups    []string `json:"groups"`
	Expire    int64    `json:"expire"`
	Enable    int      `json:"enable"`
	Comment   string   `json:"comment"`
	Keys      string   `json:"keys"`
}

type UserInfoResponse

type UserInfoResponse struct {
	Data UserInfo `json:"data"`
}

type UserListItem

type UserListItem struct {
	UserId string `json:"userid"`
	Email  string `json:"email"`
	Enable int    `json:"enable"`
	Expire int64  `json:"expire"`
}

type UserListResponseContainer

type UserListResponseContainer struct {
	Data []UserListItem `json:"data"`
}

type VersionInfo

type VersionInfo struct {
	RepoID   string `json:"repoid"`
	Release  string `json:"release"`
	Version  string `json:"version"`
	Keyboard string `json:"keyboard"`
}

type VersionInfoResponse

type VersionInfoResponse struct {
	Data VersionInfo `json:"data"`
}

Jump to

Keyboard shortcuts

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