Documentation
¶
Index ¶
- func InstanceState2Str(state libvirt.DomainState) string
- type HyperSchema
- type IndexSchema
- type InstanceConfSchema
- type InstanceSchema
- type Server
- func (h *Server) AddInstance(w http.ResponseWriter, r *http.Request)
- func (h *Server) GetArg(r *http.Request, name string) (string, bool)
- func (h *Server) GetBridge(w http.ResponseWriter, r *http.Request)
- func (h *Server) GetDataStore(w http.ResponseWriter, r *http.Request)
- func (h *Server) GetFile(name string) string
- func (h *Server) GetISO(w http.ResponseWriter, r *http.Request)
- func (h *Server) GetInstance(w http.ResponseWriter, r *http.Request)
- func (h *Server) GetQueryOne(req *http.Request, name string) string
- func (h *Server) GetStore(store, name string) string
- func (h *Server) GetTarget(req *http.Request) string
- func (h *Server) HandleIndex(w http.ResponseWriter, r *http.Request)
- func (h *Server) HandleWebSockify(ws *websocket.Conn)
- func (h *Server) Initialize()
- func (h *Server) InstanceConf2XML(conf *InstanceConfSchema) (libvirtdriver.DomainXML, error)
- func (h *Server) IsAuth(w http.ResponseWriter, r *http.Request) bool
- func (h *Server) LoadRouter()
- func (h *Server) LoadToken() error
- func (h *Server) Middleware(next http.Handler) http.Handler
- func (h *Server) ModInstance(w http.ResponseWriter, r *http.Request)
- func (h *Server) NewImage(conf *InstanceConfSchema) (*qemuimgdriver.Image, error)
- func (h *Server) ParseFiles(w http.ResponseWriter, name string, data interface{}) error
- func (h *Server) ResponseJson(w http.ResponseWriter, v interface{})
- func (h *Server) ResponseMsg(w http.ResponseWriter, code int, message string)
- func (h *Server) ResponseXml(w http.ResponseWriter, v string)
- func (h *Server) Router() *mux.Router
- func (h *Server) SaveToken() error
- func (h *Server) SetCert(keyFile, crtFile string)
- func (h *Server) Shutdown()
- func (h *Server) Start() error
- type VersionSchema
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 (*Server) AddInstance ¶
func (h *Server) AddInstance(w http.ResponseWriter, r *http.Request)
func (*Server) GetDataStore ¶
func (h *Server) GetDataStore(w http.ResponseWriter, r *http.Request)
func (*Server) GetInstance ¶
func (h *Server) GetInstance(w http.ResponseWriter, r *http.Request)
func (*Server) HandleIndex ¶
func (h *Server) HandleIndex(w http.ResponseWriter, r *http.Request)
func (*Server) HandleWebSockify ¶
func (*Server) Initialize ¶
func (h *Server) Initialize()
func (*Server) InstanceConf2XML ¶
func (h *Server) InstanceConf2XML(conf *InstanceConfSchema) (libvirtdriver.DomainXML, error)
func (*Server) LoadRouter ¶
func (h *Server) LoadRouter()
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)
type VersionSchema ¶
type VersionSchema struct {
Version string `json:"version"`
Date string `json:"date"`
Commit string `json:"commit"`
}
func NewVersionSchema ¶
func NewVersionSchema() VersionSchema
Click to show internal directories.
Click to hide internal directories.