data

package
v0.0.0-...-3122893 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2015 License: AGPL-3.0 Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadJSON

func ReadJSON(r io.Reader, v interface{}) error

ReadJSON from io.Reader to the interface

func WriteDrive

func WriteDrive(obj *Drive) (io.Reader, error)

WriteDrive marshals single drive object to JSON stream

Types

type Context

type Context struct {
	CPU         int64             `json:"cpu,omitempty"`
	CPUModel    string            `json:"cpu_model,omitempty"`
	Drives      []ContextDrive    `json:"drives,omitempty"`
	Mem         int64             `json:"mem,omitempty"`
	Meta        map[string]string `json:"meta,omitempty"`
	Name        string            `json:"name,omitempty"`
	NICs        []ContextNIC      `json:"nics,omitempty"`
	UUID        string            `json:"uuid,omitempty"`
	VNCPassword string            `json:"vnc_password,omitempty"`
}

Context contains detail properties of server instance context

func ReadContext

func ReadContext(r io.Reader) (*Context, error)

ReadContext reads and unmarshalls server instance context from JSON stream

type ContextDrive

type ContextDrive struct {
	BootOrder int    `json:"boot_order,omitempty"`
	Channel   string `json:"dev_channel,omitempty"`
	Device    string `json:"device,omitempty"`
}

ContextDrive describes properties of disk drive in server context

type ContextIPv4

type ContextIPv4 struct {
	Conf string            `json:"conf"`
	IP   ContextIPv4Config `json:"ip"`
}

ContextIPv4 describes IPv4 configuration in server context

type ContextIPv4Config

type ContextIPv4Config struct {
	Gateway     string            `json:"gateway"`
	Meta        map[string]string `json:"meta"`
	Nameservers []string          `json:"nameservers"`
	Netmask     int               `json:"netmask"`
	UUID        string            `json:"uuid"`
}

ContextIPv4Config describes IPv4 parameters in server context

type ContextNIC

type ContextNIC struct {
	IPv4  *ContextIPv4 `json:"ip_v4_conf"`
	Mac   string       `json:"mac"`
	Model string       `json:"model"`
	VLan  *ContextVLan `json:"vlan"`
}

ContextNIC describes network interface properties in server context

type ContextVLan

type ContextVLan struct {
	Meta map[string]string `json:"meta,omitempty"`
	Tags []string          `json:"tags,omitempty"`
	UUID string            `json:"uuid"`
}

ContextVLan describes network interface properties for VLan in server context

type Drive

type Drive struct {
	Resource
	LibraryDrive
	Affinities      []string          `json:"affinities,omitempty"`
	AllowMultimount bool              `json:"allow_multimount,omitempty"`
	Jobs            []Resource        `json:"jobs,omitempty"`
	Media           string            `json:"media,omitempty"`
	Meta            map[string]string `json:"meta,omitempty"`
	Name            string            `json:"name,omitempty"`
	Owner           *Resource         `json:"owner,omitempty"`
	Size            uint64            `json:"size,omitempty"`
	Status          string            `json:"status,omitempty"`
	StorageType     string            `json:"storage_type,omitempty"`
}

Drive contains properties of cloud drive instance

func ReadDrive

func ReadDrive(r io.Reader) (*Drive, error)

ReadDrive reads and unmarshalls information about single cloud drive instance from JSON stream

func ReadDrives

func ReadDrives(r io.Reader) ([]Drive, error)

ReadDrives reads and unmarshalls information about cloud drive instances from JSON stream

type Drives

type Drives struct {
	Meta    Meta    `json:"meta"`
	Objects []Drive `json:"objects"`
}

Drives holds collection of Drive objects

type Error

type Error struct {
	Point   string `json:"error_point"`
	Type    string `json:"error_type"`
	Message string `json:"error_message"`
}

Error contains error information from server reply

func ReadError

func ReadError(r io.Reader) ([]Error, error)

ReadError reads and unmarshalls information about cloud server error JSON stream

func (Error) Error

func (e Error) Error() string

type IPv4

type IPv4 struct {
	Conf string    `json:"conf,omitempty"`
	IP   *Resource `json:"ip,omitempty"`
}

IPv4 describes properties of IPv4 address

type Job

type Job struct {
	Resource
	Children     []string  `json:"children"`
	Created      time.Time `json:"created"`
	Data         JobData   `json:"data"`
	LastModified time.Time `json:"last_modified"`
	Operation    string    `json:"operation"`
	Resources    []string  `json:"resources"`
	State        string    `json:"state"`
}

Job contains properties of job instance

func ReadJob

func ReadJob(r io.Reader) (*Job, error)

ReadJob reads and unmarshalls information about job instance from JSON stream

type JobData

type JobData struct {
	Progress int `json:"progress"`
}

JobData contains metainformation of job instance

type Jobs

type Jobs struct {
	Meta    Meta  `json:"meta"`
	Objects []Job `json:"objects"`
}

Jobs holds collection of Job objects

type LibraryDrive

type LibraryDrive struct {
	Arch      string `json:"arch,omitempty"`
	ImageType string `json:"image_type,omitempty"`
	OS        string `json:"os,omitempty"`
	Paid      bool   `json:"paid,omitempty"`
}

LibraryDrive contains properties of cloud drive instance specific for CloudSigma media library drives

type Meta

type Meta struct {
	Limit      int `json:"limit"`
	Offset     int `json:"offset"`
	TotalCount int `json:"total_count"`
}

Meta describes properties of dataset

type NIC

type NIC struct {
	IPv4    *IPv4           `json:"ip_v4_conf,omitempty"`
	Model   string          `json:"model,omitempty"`
	MAC     string          `json:"mac,omitempty"`
	VLAN    *Resource       `json:"vlan,omitempty"`
	Runtime *RuntimeNetwork `json:"runtime,omitempty"`
}

NIC describes properties of network interface card

type Resource

type Resource struct {
	URI  string `json:"resource_uri,omitempty"`
	UUID string `json:"uuid,omitempty"`
}

Resource describes properties of linked resource

func MakeDriveResource

func MakeDriveResource(uuid string) *Resource

MakeDriveResource returns drive Resource structure for given UUID

func MakeIPResource

func MakeIPResource(ip string) *Resource

MakeIPResource returns IP Resource structure for given IP address

func MakeJobResource

func MakeJobResource(uuid string) *Resource

MakeJobResource returns job Resource structure for given UUID

func MakeLibDriveResource

func MakeLibDriveResource(uuid string) *Resource

MakeLibDriveResource returns library drive Resource structure for given UUID

func MakeResource

func MakeResource(t, uuid string) *Resource

MakeResource returns Resource structure from given type and UUID

func MakeServerResource

func MakeServerResource(uuid string) *Resource

MakeServerResource returns server Resource structure for given UUID

func MakeUserResource

func MakeUserResource(uuid string) *Resource

MakeUserResource returns user Resource structure for given UUID

func MakeVLanResource

func MakeVLanResource(uuid string) *Resource

MakeVLanResource returns VLan Resource structure for given UUID

type RuntimeNetwork

type RuntimeNetwork struct {
	InterfaceType string             `json:"interface_type,omitempty"`
	IO            RuntimeNetworkStat `json:"io,omitempty"`
	IPv4          *Resource          `json:"ip_v4,omitempty"`
}

RuntimeNetwork describes properties of network interface card at runtime

type RuntimeNetworkStat

type RuntimeNetworkStat struct {
	BytesRecv   int64 `json:"bytes_recv"`
	BytesSent   int64 `json:"bytes_sent"`
	PacketsRecv int64 `json:"packets_recv"`
	PacketsSent int64 `json:"packets_sent"`
}

RuntimeNetworkStat describes runtime I/O statistic for network interface card at runtime

type Server

type Server struct {
	Resource
	Context            bool              `json:"context,omitempty"`
	CPU                uint64            `json:"cpu,omitempty"`
	CPUsInsteadOfCores bool              `json:"cpus_instead_of_cores,omitempty"`
	CPUModel           string            `json:"cpu_model,omitempty"`
	Drives             []ServerDrive     `json:"drives,omitempty"`
	Mem                uint64            `json:"mem,omitempty"`
	Meta               map[string]string `json:"meta,omitempty"`
	Name               string            `json:"name,omitempty"`
	NICs               []NIC             `json:"nics,omitempty"`
	SMP                uint64            `json:"smp,omitempty"`
	Status             string            `json:"status,omitempty"`
	VNCPassword        string            `json:"vnc_password,omitempty"`
}

Server contains detail properties of cloud server instance

func ReadServer

func ReadServer(r io.Reader) (*Server, error)

ReadServer reads and unmarshalls description of single cloud server instance from JSON stream

func ReadServers

func ReadServers(r io.Reader) ([]Server, error)

ReadServers reads and unmarshalls description of cloud server instances from JSON stream

type ServerDrive

type ServerDrive struct {
	BootOrder int      `json:"boot_order,omitempty"`
	Channel   string   `json:"dev_channel,omitempty"`
	Device    string   `json:"device,omitempty"`
	Drive     Resource `json:"drive,omitempty"`
}

ServerDrive describe properties of disk drive

type Servers

type Servers struct {
	Meta    Meta     `json:"meta"`
	Objects []Server `json:"objects"`
}

Servers holds collection of Server objects

Jump to

Keyboard shortcuts

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