Documentation ¶
Index ¶
Constants ¶
const Version = "1.0"
Version of the builtin API
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Operation ¶
type Operation struct { ID string `json:"id" yaml:"id"` Description string `json:"description" yaml:"description"` CreatedAt time.Time `json:"created_at" yaml:"created_at"` UpdatedAt time.Time `json:"updated_at" yaml:"updated_at"` Status string `json:"status" yaml:"status"` StatusCode StatusCode `json:"status_code" yaml:"status_code"` Resources map[string][]string `json:"resources" yaml:"resources"` Metadata map[string]interface{} `json:"metadata" yaml:"metadata"` Err string `json:"err" yaml:"err"` }
Operation represents a background operation as result of a REST POST, PATCH, DELETE or PUT
type Response ¶
type Response struct { Type ResponseType `json:"type" yaml:"type"` // Valid only for Sync responses Status string `json:"status" yaml:"status"` StatusCode int `json:"status_code" yaml:"status_code"` // Valid only for Async responses Operation string `json:"operation" yaml:"operation"` // Valid only for Error responses Code int `json:"error_code" yaml:"error_code"` Error string `json:"error" yaml:"error"` // Valid for Sync and Error responses Metadata json.RawMessage `json:"metadata" yaml:"metadata"` }
Response represents a LXD operation
func (*Response) MetadataAsMap ¶
MetadataAsMap parses the Response metadata into a map
func (*Response) MetadataAsOperation ¶
MetadataAsOperation turns the Response metadata into an Operation
func (*Response) MetadataAsStringSlice ¶
MetadataAsStringSlice parses the Response metadata into a slice of string
func (*Response) MetadataAsStruct ¶
MetadataAsStruct parses the Response metadata into a provided struct
type ResponseRaw ¶
type ResponseRaw struct { Response `yaml:",inline"` Metadata interface{} `json:"metadata" yaml:"metadata"` }
ResponseRaw represents a REST operation in its original form
type ResponseType ¶
type ResponseType string
ResponseType represents a valid LXD response type
const ( ResponseTypeSync ResponseType = "sync" ResponseTypeAsync ResponseType = "async" ResponseTypeError ResponseType = "error" )
"there are three standard return types: Standard return value, Background operation, Error", each returning a JSON object with the following "type" field:
type StatusCode ¶
type StatusCode int
StatusCode represents a valid REST operation status code
const ( Created StatusCode = 100 Started StatusCode = 101 Stopped StatusCode = 102 Running StatusCode = 103 Cancelling StatusCode = 104 Pending StatusCode = 105 Starting StatusCode = 106 Stopping StatusCode = 107 Aborting StatusCode = 108 Freezing StatusCode = 109 Frozen StatusCode = 110 Thawed StatusCode = 111 Error StatusCode = 112 Success StatusCode = 200 Failure StatusCode = 400 Cancelled StatusCode = 401 )
status codes
func (StatusCode) IsFinal ¶
func (o StatusCode) IsFinal() bool
IsFinal will return true if the status code indicates an end state
func (StatusCode) String ¶
func (o StatusCode) String() string
String returns a suitable string representation for the status code