api

package
v0.0.0-...-9bbedf1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: LGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "1.0"

Version of current exposed API

Variables

This section is empty.

Functions

This section is empty.

Types

type Certificate

type Certificate struct {
	// Base64 encoded certificate content without the header or the footer
	// Example: MIIFUTCCAzmgAw...xjKoUEEQOzJ9
	Certificate string `json:"certificate" yaml:"certificate"`
	// SHA-256 fingerprint of the certificate
	// Example: b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9
	Fingerprint string `json:"fingerprint" yaml:"fingerprint"`
}

Certificate represents an available client certificate

swagger:model

type CertificatesPost

type CertificatesPost struct {
	// Base64 encoded certificate content without the header or the footer
	// Example: MIIFUTCCAzmgAw...xjKoUEEQOzJ9
	Certificate string `json:"certificate" yaml:"certificate"`
	// TrustPassword is used to register a new client with the service
	// Example: sUp3rs3cr3t
	TrustPassword string `json:"trust-password,omitempty" yaml:"trust-password,omitempty"`
}

CertificatesPost represents the fields of a new auth provided certificate

swagger:model

type Operation

type Operation struct {
	// UUID of the operation
	// Example: c6832c58-0867-467e-b245-2962d6527876
	ID string `json:"id" yaml:"id"`
	// Class of the operation
	// Enum: task,websocket,token
	// Example: task
	Class string `json:"class" yaml:"class"`
	// Human readable description of the operation
	// Example: updating addon 3apqo5te
	Description string `json:"description" yaml:"description"`
	// When the operation was created
	// swagger:strfmt date-time
	// Example: 2018-04-02T16:49:36.341463206+02:00
	CreatedAt time.Time `json:"created_at" yaml:"created_at"`
	// When the operation was updated
	// swagger:strfmt date-time
	// Example: 2018-04-02T16:49:36.341463206+02:00
	UpdatedAt time.Time `json:"updated_at" yaml:"updated_at"`
	// String version of the operation status
	// Example: Running
	Status string `json:"status" yaml:"status"`
	// Code of the operation status
	// Example: 103
	StatusCode StatusCode `json:"status_code" yaml:"status_code"`
	// Dictionnary of resource types (containers, snapshots, images)
	// and affected resources
	// Example: {"applications": [ "/1.0/applications/my-app" ]}
	Resources map[string][]string `json:"resources,omitempty" yaml:"resources,omitempty"`
	// Metadata related to the operation and affected resources
	// Example: {}
	Metadata map[string]interface{} `json:"metadata,omitempty" yaml:"metadata,omitempty"`
	// Whether this operation can be canceled (DELETE over REST)
	// Example: false
	MayCancel bool `json:"may_cancel" yaml:"may_cancel"`
	// The error string if the operation failed
	// Example:
	Err string `json:"err,omitempty" yaml:"err,omitempty"`
	// The address of the server where the operation ran
	// swagger:strfmt ipv4
	// Example: 10.0.0.1
	ServerAddress string `json:"server_address,omitempty" yaml:"server_address,omitempty"`
}

Operation represents a background operation

swagger:model

type Response

type Response struct {
	Type ResponseType `json:"type" yaml:"type"`

	// Total Count of the collection
	TotalSize *int `json:"total_size,omitempty" yaml:"total_size,omitempty"`

	// 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,omitempty" yaml:"operation,omitempty"`

	// Valid only for Error responses
	Code  int    `json:"error_code" yaml:"error_code"`
	Error string `json:"error,omitempty" yaml:"error,omitempty"`

	// Valid for Sync and Error responses
	Metadata json.RawMessage `json:"metadata,omitempty" yaml:"metadata,omitempty"`
}

Response represents a LXD operation

func (*Response) MetadataAsMap

func (r *Response) MetadataAsMap() (map[string]interface{}, error)

MetadataAsMap parses the Response metadata into a map

func (*Response) MetadataAsOperation

func (r *Response) MetadataAsOperation() (*Operation, error)

MetadataAsOperation turns the Response metadata into an Operation

func (*Response) MetadataAsStringSlice

func (r *Response) MetadataAsStringSlice() ([]string, error)

MetadataAsStringSlice parses the Response metadata into a slice of string

func (*Response) MetadataAsStruct

func (r *Response) MetadataAsStruct(target interface{}) error

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

const (
	OperationCreated 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

Jump to

Keyboard shortcuts

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