http

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstanceState2Str

func InstanceState2Str(state libvirt.DomainState) string

Types

type HyperSchema

type HyperSchema struct {
	CpuNum     int     `json:"cpuNum"`
	CpuVendor  string  `json:"cpuVendor"`
	MemTotal   uint64  `json:"memTotal"`
	MemFree    uint64  `json:"memFree"`
	MemPercent float64 `json:"memPercent"`
}

func NewHyperSchema

func NewHyperSchema() (hs HyperSchema)

type IndexSchema

type IndexSchema struct {
	Version   VersionSchema    `json:"version"`
	Hyper     HyperSchema      `json:"hyper"`
	Instances []InstanceSchema `json:"instances"`
}

type InstanceConfSchema

type InstanceConfSchema struct {
	Action     string `json:"action"` // If is "", means not action.
	Name       string `json:"name"`
	Arch       string `json:"arch"`
	Boots      string `json:"boots"`
	DataStore  string `json:"datastore"`
	Cpu        string `json:"cpu"`
	MemorySize string `json:"memorySize"`
	MemoryUnit string `json:"memoryUnit"`
	DiskSize   string `json:"diskSize"`
	DiskUnit   string `json:"diskUnit"`
	IsoFile    string `json:"isoFile"`
	Interface  string `json:"interface"`
}

type InstanceSchema

type InstanceSchema struct {
	UUID    string `json:"uuid"`
	Name    string `json:"name"`
	State   string `json:"state"`
	MaxCpu  uint   `json:"maxCpu"`
	MaxMem  uint64 `json:"maxMem"`  // Kbytes
	Memory  uint64 `json:"memory"`  // KBytes
	CpuTime uint64 `json:"cpuTime"` // MicroSeconds
}

func NewInstanceSchema

func NewInstanceSchema(dom libvirtdriver.Domain) InstanceSchema

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(listen, staticDir, authFile string) (h *Server)

func (*Server) AddInstance

func (h *Server) AddInstance(w http.ResponseWriter, r *http.Request)

func (*Server) GetArg

func (h *Server) GetArg(r *http.Request, name string) (string, bool)

func (*Server) GetBridge

func (h *Server) GetBridge(w http.ResponseWriter, r *http.Request)

func (*Server) GetDataStore

func (h *Server) GetDataStore(w http.ResponseWriter, r *http.Request)

func (*Server) GetFile

func (h *Server) GetFile(name string) string

func (*Server) GetISO

func (h *Server) GetISO(w http.ResponseWriter, r *http.Request)

func (*Server) GetInstance

func (h *Server) GetInstance(w http.ResponseWriter, r *http.Request)

func (*Server) GetQueryOne

func (h *Server) GetQueryOne(req *http.Request, name string) string

func (*Server) GetStore

func (h *Server) GetStore(store, name string) string

func (*Server) GetTarget

func (h *Server) GetTarget(req *http.Request) string

func (*Server) HandleIndex

func (h *Server) HandleIndex(w http.ResponseWriter, r *http.Request)

func (*Server) HandleWebSockify

func (h *Server) HandleWebSockify(ws *websocket.Conn)

func (*Server) Initialize

func (h *Server) Initialize()

func (*Server) InstanceConf2XML

func (h *Server) InstanceConf2XML(conf *InstanceConfSchema) (libvirtdriver.DomainXML, error)

func (*Server) IsAuth

func (h *Server) IsAuth(w http.ResponseWriter, r *http.Request) bool

func (*Server) LoadRouter

func (h *Server) LoadRouter()

func (*Server) LoadToken

func (h *Server) LoadToken() error

func (*Server) Middleware

func (h *Server) Middleware(next http.Handler) http.Handler

func (*Server) ModInstance

func (h *Server) ModInstance(w http.ResponseWriter, r *http.Request)

func (*Server) NewImage

func (h *Server) NewImage(conf *InstanceConfSchema) (*qemuimgdriver.Image, error)

func (*Server) ParseFiles

func (h *Server) ParseFiles(w http.ResponseWriter, name string, data interface{}) error

func (*Server) ResponseJson

func (h *Server) ResponseJson(w http.ResponseWriter, v interface{})

func (*Server) ResponseMsg

func (h *Server) ResponseMsg(w http.ResponseWriter, code int, message string)

func (*Server) ResponseXml

func (h *Server) ResponseXml(w http.ResponseWriter, v string)

func (*Server) Router

func (h *Server) Router() *mux.Router

func (*Server) SaveToken

func (h *Server) SaveToken() error

func (*Server) SetCert

func (h *Server) SetCert(keyFile, crtFile string)

func (*Server) Shutdown

func (h *Server) Shutdown()

func (*Server) Start

func (h *Server) Start() error

type VersionSchema

type VersionSchema struct {
	Version string `json:"version"`
	Date    string `json:"date"`
	Commit  string `json:"commit"`
}

func NewVersionSchema

func NewVersionSchema() VersionSchema

Jump to

Keyboard shortcuts

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