1
// Copyright 2014 ALTOROS
2
// Licensed under the AGPLv3, see LICENSE file for details.
8
// ServerDrive describe properties of disk drive
9
type ServerDrive struct {
10
BootOrder int `json:"boot_order,omitempty"`
11
Channel string `json:"dev_channel,omitempty"`
12
Device string `json:"device,omitempty"`
13
Drive Resource `json:"drive,omitempty"`
16
// Server contains detail properties of cloud server instance
19
Context bool `json:"context,omitempty"`
20
CPU uint64 `json:"cpu,omitempty"`
21
CPUsInsteadOfCores bool `json:"cpus_instead_of_cores,omitempty"`
22
CPUModel string `json:"cpu_model,omitempty"`
23
Drives []ServerDrive `json:"drives,omitempty"`
24
Mem uint64 `json:"mem,omitempty"`
25
Meta map[string]string `json:"meta,omitempty"`
26
Name string `json:"name,omitempty"`
27
NICs []NIC `json:"nics,omitempty"`
28
SMP uint64 `json:"smp,omitempty"`
29
Status string `json:"status,omitempty"`
30
VNCPassword string `json:"vnc_password,omitempty"`
33
// Servers holds collection of Server objects
35
Meta Meta `json:"meta"`
36
Objects []Server `json:"objects"`
39
// ReadServers reads and unmarshalls description of cloud server instances from JSON stream
40
func ReadServers(r io.Reader) ([]Server, error) {
42
if err := ReadJSON(r, &servers); err != nil {
45
return servers.Objects, nil
48
// ReadServer reads and unmarshalls description of single cloud server instance from JSON stream
49
func ReadServer(r io.Reader) (*Server, error) {
51
if err := ReadJSON(r, &server); err != nil {