api

package
v0.0.0-...-a810e79 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package api contains Go structs for all LXD API objects

Overview

This package has Go structs for every API object, all the various structs are named after the object they represent and some variations of those structs exist for initial object creation, object update and object retrieval.

A few convenience functions are also tied to those structs which let you convert between the various strucs for a given object and also query some of the more complex metadata that LXD can export.

Index

Constants

View Source
const InstanceTypeAny = InstanceType("")

InstanceTypeAny defines the instance type value for requesting any instance type.

View Source
const InstanceTypeContainer = InstanceType("container")

InstanceTypeContainer defines the instance type value for a container.

View Source
const InstanceTypeVM = InstanceType("virtual-machine")

InstanceTypeVM defines the instance type value for a virtual-machine.

View Source
const NetworkStatusCreated = "Created"

NetworkStatusCreated network is fully created.

View Source
const NetworkStatusErrored = "Errored"

NetworkStatusErrored network is in error status.

View Source
const NetworkStatusPending = "Pending"

NetworkStatusPending network is pending creation on other cluster nodes.

View Source
const NetworkStatusUnknown = "Unknown"

NetworkStatusUnknown network is in unknown status.

View Source
const StoragePoolStatusCreated = "Created"

StoragePoolStatusCreated storage pool is fully created.

View Source
const StoragePoolStatusErrored = "Errored"

StoragePoolStatusErrored storage pool is in error status.

View Source
const StoragePoolStatusPending = "Pending"

StoragePoolStatusPending storage pool is pending creation on other cluster nodes.

View Source
const StoragePoolStatusUnknown = "Unknown"

StoragePoolStatusUnknown storage pool is in unknown status.

Variables

This section is empty.

Functions

This section is empty.

Types

type Certificate

type Certificate struct {
	CertificatePut `yaml:",inline"`

	// The certificate itself, as PEM encoded X509
	// Read only: true
	// Example: X509 PEM certificate
	Certificate string `json:"certificate" yaml:"certificate"`

	// SHA256 fingerprint of the certificate
	// Read only: true
	// Example: fd200419b271f1dc2a5591b693cc5774b7f234e1ff8c6b78ad703b6888fe2b69
	Fingerprint string `json:"fingerprint" yaml:"fingerprint"`
}

Certificate represents a LXD certificate

swagger:model

func (*Certificate) Writable

func (cert *Certificate) Writable() CertificatePut

Writable converts a full Certificate struct into a CertificatePut struct (filters read-only fields)

type CertificatePut

type CertificatePut struct {
	// Name associated with the certificate
	// Example: castiana
	Name string `json:"name" yaml:"name"`

	// Usage type for the certificate (only client currently)
	// Example: client
	Type string `json:"type" yaml:"type"`

	// Whether to limit the certificate to listed projects
	// Example: true
	//
	// API extension: certificate_project
	Restricted bool `json:"restricted" yaml:"restricted"`

	// List of allowed projects (applies when restricted)
	// Example: ["default", "foo", "bar"]
	//
	// API extension: certificate_project
	Projects []string `json:"projects" yaml:"projects"`
}

CertificatePut represents the modifiable fields of a LXD certificate

API extension: certificate_update

swagger:model

type CertificatesPost

type CertificatesPost struct {
	CertificatePut `yaml:",inline"`

	// The certificate itself, as PEM encoded X509
	// Example: X509 PEM certificate
	Certificate string `json:"certificate" yaml:"certificate"`

	// Server trust password (used to add an untrusted client)
	// Example: blah
	Password string `json:"password" yaml:"password"`
}

CertificatesPost represents the fields of a new LXD certificate

swagger:model

type Cluster

type Cluster struct {
	ServerName string `json:"server_name" yaml:"server_name"`
	Enabled    bool   `json:"enabled" yaml:"enabled"`

	// API extension: clustering_join
	MemberConfig []ClusterMemberConfigKey `json:"member_config" yaml:"member_config"`
}

Cluster represents high-level information about a LXD cluster.

API extension: clustering

type ClusterMember

type ClusterMember struct {
	ClusterMemberPut `yaml:",inline"`

	ServerName string `json:"server_name" yaml:"server_name"`
	URL        string `json:"url" yaml:"url"`
	Database   bool   `json:"database" yaml:"database"`
	Status     string `json:"status" yaml:"status"`
	Message    string `json:"message" yaml:"message"`
}

ClusterMember represents the a LXD node in the cluster.

API extension: clustering

func (*ClusterMember) Writable

func (member *ClusterMember) Writable() ClusterMemberPut

Writable converts a full Profile struct into a ProfilePut struct (filters read-only fields)

type ClusterMemberConfigKey

type ClusterMemberConfigKey struct {
	Entity      string `json:"entity" yaml:"entity"`
	Name        string `json:"name" yaml:"name"`
	Key         string `json:"key" yaml:"key"`
	Value       string `json:"value" yaml:"value"`
	Description string `json:"description" yaml:"description"`
}

ClusterMemberConfigKey represents a single config key that a new member of the cluster is required to provide when joining.

The Value field is empty when getting clustering information with GET /1.0/cluster, and should be filled by the joining node when performing a PUT /1.0/cluster join request.

API extension: clustering_join

type ClusterMemberPost

type ClusterMemberPost struct {
	ServerName string `json:"server_name" yaml:"server_name"`
}

ClusterMemberPost represents the fields required to rename a LXD node.

API extension: clustering

type ClusterMemberPut

type ClusterMemberPut struct {
	// API extension: clustering_roles
	Roles []string `json:"roles" yaml:"roles"`

	// API extension: clustering_architecture
	Architecture string `json:"architecture" yaml:"architecture"`

	// API extension: clustering_failure_domains
	FailureDomain string `json:"failure_domain" yaml:"failure_domain"`
}

ClusterMemberPut represents the the modifiable fields of a LXD cluster member

API extension: clustering_edit_roles

type ClusterPut

type ClusterPut struct {
	Cluster            `yaml:",inline"`
	ClusterAddress     string `json:"cluster_address" yaml:"cluster_address"`
	ClusterCertificate string `json:"cluster_certificate" yaml:"cluster_certificate"`

	// API extension: clustering_join
	ServerAddress   string `json:"server_address" yaml:"server_address"`
	ClusterPassword string `json:"cluster_password" yaml:"cluster_password"`
}

ClusterPut represents the fields required to bootstrap or join a LXD cluster.

API extension: clustering

type Container

type Container struct {
	ContainerPut `yaml:",inline"`

	CreatedAt       time.Time                    `json:"created_at" yaml:"created_at"`
	ExpandedConfig  map[string]string            `json:"expanded_config" yaml:"expanded_config"`
	ExpandedDevices map[string]map[string]string `json:"expanded_devices" yaml:"expanded_devices"`
	Name            string                       `json:"name" yaml:"name"`
	Status          string                       `json:"status" yaml:"status"`
	StatusCode      StatusCode                   `json:"status_code" yaml:"status_code"`

	// API extension: container_last_used_at
	LastUsedAt time.Time `json:"last_used_at" yaml:"last_used_at"`

	// API extension: clustering
	Location string `json:"location" yaml:"location"`
}

Container represents a LXD container

func (Container) IsActive

func (c Container) IsActive() bool

IsActive checks whether the container state indicates the container is active

func (*Container) Writable

func (c *Container) Writable() ContainerPut

Writable converts a full Container struct into a ContainerPut struct (filters read-only fields)

type ContainerBackup

type ContainerBackup struct {
	Name             string    `json:"name" yaml:"name"`
	CreatedAt        time.Time `json:"created_at" yaml:"created_at"`
	ExpiresAt        time.Time `json:"expires_at" yaml:"expires_at"`
	ContainerOnly    bool      `json:"container_only" yaml:"container_only"`
	OptimizedStorage bool      `json:"optimized_storage" yaml:"optimized_storage"`
}

ContainerBackup represents a LXD container backup API extension: container_backup

type ContainerBackupPost

type ContainerBackupPost struct {
	Name string `json:"name" yaml:"name"`
}

ContainerBackupPost represents the fields available for the renaming of a container backup API extension: container_backup

type ContainerBackupsPost

type ContainerBackupsPost struct {
	Name             string    `json:"name" yaml:"name"`
	ExpiresAt        time.Time `json:"expires_at" yaml:"expires_at"`
	ContainerOnly    bool      `json:"container_only" yaml:"container_only"`
	OptimizedStorage bool      `json:"optimized_storage" yaml:"optimized_storage"`
}

ContainerBackupsPost represents the fields available for a new LXD container backup API extension: container_backup

type ContainerConsoleControl

type ContainerConsoleControl struct {
	Command string            `json:"command" yaml:"command"`
	Args    map[string]string `json:"args" yaml:"args"`
}

ContainerConsoleControl represents a message on the container console "control" socket

API extension: console

type ContainerConsolePost

type ContainerConsolePost struct {
	Width  int `json:"width" yaml:"width"`
	Height int `json:"height" yaml:"height"`
}

ContainerConsolePost represents a LXD container console request

API extension: console

type ContainerExecControl

type ContainerExecControl struct {
	Command string            `json:"command" yaml:"command"`
	Args    map[string]string `json:"args" yaml:"args"`
	Signal  int               `json:"signal" yaml:"signal"`
}

ContainerExecControl represents a message on the container exec "control" socket

type ContainerExecPost

type ContainerExecPost struct {
	Command     []string          `json:"command" yaml:"command"`
	WaitForWS   bool              `json:"wait-for-websocket" yaml:"wait-for-websocket"`
	Interactive bool              `json:"interactive" yaml:"interactive"`
	Environment map[string]string `json:"environment" yaml:"environment"`
	Width       int               `json:"width" yaml:"width"`
	Height      int               `json:"height" yaml:"height"`

	// API extension: container_exec_recording
	RecordOutput bool `json:"record-output" yaml:"record-output"`

	// API extension: container_user_group_cwd
	User  uint32 `json:"user" yaml:"user"`
	Group uint32 `json:"group" yaml:"group"`
	Cwd   string `json:"cwd" yaml:"cwd"`
}

ContainerExecPost represents a LXD container exec request

type ContainerFull

type ContainerFull struct {
	Container `yaml:",inline"`

	Backups   []ContainerBackup   `json:"backups" yaml:"backups"`
	State     *ContainerState     `json:"state" yaml:"state"`
	Snapshots []ContainerSnapshot `json:"snapshots" yaml:"snapshots"`
}

ContainerFull is a combination of Container, ContainerState and CotnainerSnapshot

API extension: container_full

type ContainerPost

type ContainerPost struct {
	// Used for renames
	Name string `json:"name" yaml:"name"`

	// Used for migration
	Migration bool `json:"migration" yaml:"migration"`

	// API extension: container_stateless_copy
	Live bool `json:"live" yaml:"live"`

	// API extension: container_only_migration
	ContainerOnly bool `json:"container_only" yaml:"container_only"`

	// API extension: container_push_target
	Target *ContainerPostTarget `json:"target" yaml:"target"`
}

ContainerPost represents the fields required to rename/move a LXD container

type ContainerPostTarget

type ContainerPostTarget struct {
	Certificate string            `json:"certificate" yaml:"certificate"`
	Operation   string            `json:"operation,omitempty" yaml:"operation,omitempty"`
	Websockets  map[string]string `json:"secrets,omitempty" yaml:"secrets,omitempty"`
}

ContainerPostTarget represents the migration target host and operation

API extension: container_push_target

type ContainerPut

type ContainerPut struct {
	Architecture string                       `json:"architecture" yaml:"architecture"`
	Config       map[string]string            `json:"config" yaml:"config"`
	Devices      map[string]map[string]string `json:"devices" yaml:"devices"`
	Ephemeral    bool                         `json:"ephemeral" yaml:"ephemeral"`
	Profiles     []string                     `json:"profiles" yaml:"profiles"`

	// For snapshot restore
	Restore  string `json:"restore,omitempty" yaml:"restore,omitempty"`
	Stateful bool   `json:"stateful" yaml:"stateful"`

	// API extension: entity_description
	Description string `json:"description" yaml:"description"`
}

ContainerPut represents the modifiable fields of a LXD container

type ContainerSnapshot

type ContainerSnapshot struct {
	ContainerSnapshotPut `yaml:",inline"`

	CreatedAt       time.Time                    `json:"created_at" yaml:"created_at"`
	ExpandedConfig  map[string]string            `json:"expanded_config" yaml:"expanded_config"`
	ExpandedDevices map[string]map[string]string `json:"expanded_devices" yaml:"expanded_devices"`
	LastUsedAt      time.Time                    `json:"last_used_at" yaml:"last_used_at"`
	Name            string                       `json:"name" yaml:"name"`
	Stateful        bool                         `json:"stateful" yaml:"stateful"`
}

ContainerSnapshot represents a LXD conainer snapshot

func (*ContainerSnapshot) Writable

Writable converts a full ContainerSnapshot struct into a ContainerSnapshotPut struct (filters read-only fields)

type ContainerSnapshotPost

type ContainerSnapshotPost struct {
	Name      string               `json:"name" yaml:"name"`
	Migration bool                 `json:"migration" yaml:"migration"`
	Target    *ContainerPostTarget `json:"target" yaml:"target"`

	// API extension: container_snapshot_stateful_migration
	Live bool `json:"live,omitempty" yaml:"live,omitempty"`
}

ContainerSnapshotPost represents the fields required to rename/move a LXD container snapshot

type ContainerSnapshotPut

type ContainerSnapshotPut struct {
	Architecture string                       `json:"architecture" yaml:"architecture"`
	Config       map[string]string            `json:"config" yaml:"config"`
	Devices      map[string]map[string]string `json:"devices" yaml:"devices"`
	Ephemeral    bool                         `json:"ephemeral" yaml:"ephemeral"`
	Profiles     []string                     `json:"profiles" yaml:"profiles"`
	ExpiresAt    time.Time                    `json:"expires_at" yaml:"expires_at"`
}

ContainerSnapshotPut represents the modifiable fields of a LXD container snapshot API extension: snapshot_expiry

type ContainerSnapshotsPost

type ContainerSnapshotsPost struct {
	Name     string `json:"name" yaml:"name"`
	Stateful bool   `json:"stateful" yaml:"stateful"`

	// API extension: snapshot_expiry_creation
	ExpiresAt *time.Time `json:"expires_at" yaml:"expires_at"`
}

ContainerSnapshotsPost represents the fields available for a new LXD container snapshot

type ContainerSource

type ContainerSource struct {
	Type        string `json:"type" yaml:"type"`
	Certificate string `json:"certificate" yaml:"certificate"`

	// For "image" type
	Alias       string            `json:"alias,omitempty" yaml:"alias,omitempty"`
	Fingerprint string            `json:"fingerprint,omitempty" yaml:"fingerprint,omitempty"`
	Properties  map[string]string `json:"properties,omitempty" yaml:"properties,omitempty"`
	Server      string            `json:"server,omitempty" yaml:"server,omitempty"`
	Secret      string            `json:"secret,omitempty" yaml:"secret,omitempty"`
	Protocol    string            `json:"protocol,omitempty" yaml:"protocol,omitempty"`

	// For "migration" and "copy" types
	BaseImage string `json:"base-image,omitempty" yaml:"base-image,omitempty"`

	// For "migration" type
	Mode       string            `json:"mode,omitempty" yaml:"mode,omitempty"`
	Operation  string            `json:"operation,omitempty" yaml:"operation,omitempty"`
	Websockets map[string]string `json:"secrets,omitempty" yaml:"secrets,omitempty"`

	// For "copy" type
	Source string `json:"source,omitempty" yaml:"source,omitempty"`

	// API extension: container_push
	Live bool `json:"live,omitempty" yaml:"live,omitempty"`

	// API extension: container_only_migration
	ContainerOnly bool `json:"container_only,omitempty" yaml:"container_only,omitempty"`

	// API extension: container_incremental_copy
	Refresh bool `json:"refresh,omitempty" yaml:"refresh,omitempty"`

	// API extension: container_copy_project
	Project string `json:"project,omitempty" yaml:"project,omitempty"`
}

ContainerSource represents the creation source for a new container

type ContainerState

type ContainerState struct {
	Status     string                           `json:"status" yaml:"status"`
	StatusCode StatusCode                       `json:"status_code" yaml:"status_code"`
	Disk       map[string]ContainerStateDisk    `json:"disk" yaml:"disk"`
	Memory     ContainerStateMemory             `json:"memory" yaml:"memory"`
	Network    map[string]ContainerStateNetwork `json:"network" yaml:"network"`
	Pid        int64                            `json:"pid" yaml:"pid"`
	Processes  int64                            `json:"processes" yaml:"processes"`

	// API extension: container_cpu_time
	CPU ContainerStateCPU `json:"cpu" yaml:"cpu"`
}

ContainerState represents a LXD container's state

type ContainerStateCPU

type ContainerStateCPU struct {
	Usage int64 `json:"usage" yaml:"usage"`
}

ContainerStateCPU represents the cpu information section of a LXD container's state

API extension: container_cpu_time

type ContainerStateDisk

type ContainerStateDisk struct {
	Usage int64 `json:"usage" yaml:"usage"`
}

ContainerStateDisk represents the disk information section of a LXD container's state

type ContainerStateMemory

type ContainerStateMemory struct {
	Usage         int64 `json:"usage" yaml:"usage"`
	UsagePeak     int64 `json:"usage_peak" yaml:"usage_peak"`
	SwapUsage     int64 `json:"swap_usage" yaml:"swap_usage"`
	SwapUsagePeak int64 `json:"swap_usage_peak" yaml:"swap_usage_peak"`
}

ContainerStateMemory represents the memory information section of a LXD container's state

type ContainerStateNetwork

type ContainerStateNetwork struct {
	Addresses []ContainerStateNetworkAddress `json:"addresses" yaml:"addresses"`
	Counters  ContainerStateNetworkCounters  `json:"counters" yaml:"counters"`
	Hwaddr    string                         `json:"hwaddr" yaml:"hwaddr"`
	HostName  string                         `json:"host_name" yaml:"host_name"`
	Mtu       int                            `json:"mtu" yaml:"mtu"`
	State     string                         `json:"state" yaml:"state"`
	Type      string                         `json:"type" yaml:"type"`
}

ContainerStateNetwork represents the network information section of a LXD container's state

type ContainerStateNetworkAddress

type ContainerStateNetworkAddress struct {
	Family  string `json:"family" yaml:"family"`
	Address string `json:"address" yaml:"address"`
	Netmask string `json:"netmask" yaml:"netmask"`
	Scope   string `json:"scope" yaml:"scope"`
}

ContainerStateNetworkAddress represents a network address as part of the network section of a LXD container's state

type ContainerStateNetworkCounters

type ContainerStateNetworkCounters struct {
	BytesReceived   int64 `json:"bytes_received" yaml:"bytes_received"`
	BytesSent       int64 `json:"bytes_sent" yaml:"bytes_sent"`
	PacketsReceived int64 `json:"packets_received" yaml:"packets_received"`
	PacketsSent     int64 `json:"packets_sent" yaml:"packets_sent"`
}

ContainerStateNetworkCounters represents packet counters as part of the network section of a LXD container's state

type ContainerStatePut

type ContainerStatePut struct {
	Action   string `json:"action" yaml:"action"`
	Timeout  int    `json:"timeout" yaml:"timeout"`
	Force    bool   `json:"force" yaml:"force"`
	Stateful bool   `json:"stateful" yaml:"stateful"`
}

ContainerStatePut represents the modifiable fields of a LXD container's state

type ContainersPost

type ContainersPost struct {
	ContainerPut `yaml:",inline"`

	Name   string          `json:"name" yaml:"name"`
	Source ContainerSource `json:"source" yaml:"source"`

	InstanceType string `json:"instance_type" yaml:"instance_type"`
}

ContainersPost represents the fields available for a new LXD container

type Event

type Event struct {
	Type      string          `yaml:"type" json:"type"`
	Timestamp time.Time       `yaml:"timestamp" json:"timestamp"`
	Metadata  json.RawMessage `yaml:"metadata" json:"metadata"`

	// API extension: event_location
	Location string `yaml:"location,omitempty" json:"location,omitempty"`
}

Event represents an event entry (over websocket)

type EventLifecycle

type EventLifecycle struct {
	Action  string                 `yaml:"action" json:"action"`
	Source  string                 `yaml:"source" json:"source"`
	Context map[string]interface{} `yaml:"context,omitempty" json:"context,omitempty"`
}

EventLifecycle represets a lifecycle type event entry

API extension: event_lifecycle

type EventLogging

type EventLogging struct {
	Message string            `yaml:"message" json:"message"`
	Level   string            `yaml:"level" json:"level"`
	Context map[string]string `yaml:"context" json:"context"`
}

EventLogging represents a logging type event entry (admin only)

type Image

type Image struct {
	ImagePut `yaml:",inline"`

	Aliases      []ImageAlias `json:"aliases" yaml:"aliases"`
	Architecture string       `json:"architecture" yaml:"architecture"`
	Cached       bool         `json:"cached" yaml:"cached"`
	Filename     string       `json:"filename" yaml:"filename"`
	Fingerprint  string       `json:"fingerprint" yaml:"fingerprint"`
	Size         int64        `json:"size" yaml:"size"`
	UpdateSource *ImageSource `json:"update_source,omitempty" yaml:"update_source,omitempty"`

	// API extension: image_types
	Type string `json:"type" yaml:"type"`

	CreatedAt  time.Time `json:"created_at" yaml:"created_at"`
	LastUsedAt time.Time `json:"last_used_at" yaml:"last_used_at"`
	UploadedAt time.Time `json:"uploaded_at" yaml:"uploaded_at"`
}

Image represents a LXD image

func (*Image) Writable

func (img *Image) Writable() ImagePut

Writable converts a full Image struct into a ImagePut struct (filters read-only fields)

type ImageAlias

type ImageAlias struct {
	Name        string `json:"name" yaml:"name"`
	Description string `json:"description" yaml:"description"`
}

ImageAlias represents an alias from the alias list of a LXD image

type ImageAliasesEntry

type ImageAliasesEntry struct {
	ImageAliasesEntryPut `yaml:",inline"`

	Name string `json:"name" yaml:"name"`

	// API extension: image_types
	Type string `json:"type" yaml:"type"`
}

ImageAliasesEntry represents a LXD image alias

type ImageAliasesEntryPost

type ImageAliasesEntryPost struct {
	Name string `json:"name" yaml:"name"`
}

ImageAliasesEntryPost represents the required fields to rename a LXD image alias

type ImageAliasesEntryPut

type ImageAliasesEntryPut struct {
	Description string `json:"description" yaml:"description"`
	Target      string `json:"target" yaml:"target"`
}

ImageAliasesEntryPut represents the modifiable fields of a LXD image alias

type ImageAliasesPost

type ImageAliasesPost struct {
	ImageAliasesEntry `yaml:",inline"`
}

ImageAliasesPost represents a new LXD image alias

type ImageExportPost

type ImageExportPost struct {
	Target      string       `json:"target" yaml:"target"`
	Secret      string       `json:"secret" yaml:"secret"`
	Certificate string       `json:"certificate" yaml:"certificate"`
	Aliases     []ImageAlias `json:"aliases" yaml:"aliases"`
}

ImageExportPost represents the fields required to export a LXD image API extension: images_push_relay

type ImageMetadata

type ImageMetadata struct {
	Architecture string                            `json:"architecture" yaml:"architecture"`
	CreationDate int64                             `json:"creation_date" yaml:"creation_date"`
	ExpiryDate   int64                             `json:"expiry_date" yaml:"expiry_date"`
	Properties   map[string]string                 `json:"properties" yaml:"properties"`
	Templates    map[string]*ImageMetadataTemplate `json:"templates" yaml:"templates"`
}

ImageMetadata represents LXD image metadata

type ImageMetadataTemplate

type ImageMetadataTemplate struct {
	When       []string          `json:"when" yaml:"when"`
	CreateOnly bool              `json:"create_only" yaml:"create_only"`
	Template   string            `json:"template" yaml:"template"`
	Properties map[string]string `json:"properties" yaml:"properties"`
}

ImageMetadataTemplate represents a template entry in image metadata

type ImagePut

type ImagePut struct {
	AutoUpdate bool              `json:"auto_update" yaml:"auto_update"`
	Properties map[string]string `json:"properties" yaml:"properties"`
	Public     bool              `json:"public" yaml:"public"`

	// API extension: images_expiry
	ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"`

	// API extension: image_profiles
	Profiles []string `json:"profiles" yaml:"profiles"`
}

ImagePut represents the modifiable fields of a LXD image

type ImageSource

type ImageSource struct {
	Alias       string `json:"alias" yaml:"alias"`
	Certificate string `json:"certificate" yaml:"certificate"`
	Protocol    string `json:"protocol" yaml:"protocol"`
	Server      string `json:"server" yaml:"server"`

	// API extension: image_types
	ImageType string `json:"image_type" yaml:"image_type"`
}

ImageSource represents the source of a LXD image

type ImagesPost

type ImagesPost struct {
	ImagePut `yaml:",inline"`

	Filename string            `json:"filename" yaml:"filename"`
	Source   *ImagesPostSource `json:"source" yaml:"source"`

	// API extension: image_compression_algorithm
	CompressionAlgorithm string `json:"compression_algorithm" yaml:"compression_algorithm"`

	// API extension: image_create_aliases
	Aliases []ImageAlias `json:"aliases" yaml:"aliases"`
}

ImagesPost represents the fields available for a new LXD image

type ImagesPostSource

type ImagesPostSource struct {
	ImageSource `yaml:",inline"`

	Mode string `json:"mode" yaml:"mode"`
	Type string `json:"type" yaml:"type"`

	// For protocol "direct"
	URL string `json:"url" yaml:"url"`

	// For type "container"
	Name string `json:"name" yaml:"name"`

	// For type "image"
	Fingerprint string `json:"fingerprint" yaml:"fingerprint"`
	Secret      string `json:"secret" yaml:"secret"`
}

ImagesPostSource represents the source of a new LXD image

type Instance

type Instance struct {
	InstancePut `yaml:",inline"`

	CreatedAt       time.Time                    `json:"created_at" yaml:"created_at"`
	ExpandedConfig  map[string]string            `json:"expanded_config" yaml:"expanded_config"`
	ExpandedDevices map[string]map[string]string `json:"expanded_devices" yaml:"expanded_devices"`
	Name            string                       `json:"name" yaml:"name"`
	Status          string                       `json:"status" yaml:"status"`
	StatusCode      StatusCode                   `json:"status_code" yaml:"status_code"`
	LastUsedAt      time.Time                    `json:"last_used_at" yaml:"last_used_at"`
	Location        string                       `json:"location" yaml:"location"`
	Type            string                       `json:"type" yaml:"type"`
}

Instance represents a LXD instance.

API extension: instances

func (Instance) IsActive

func (c Instance) IsActive() bool

IsActive checks whether the instance state indicates the instance is active.

API extension: instances

func (*Instance) Writable

func (c *Instance) Writable() InstancePut

Writable converts a full Instance struct into a InstancePut struct (filters read-only fields).

API extension: instances

type InstanceBackup

type InstanceBackup struct {
	Name             string    `json:"name" yaml:"name"`
	CreatedAt        time.Time `json:"created_at" yaml:"created_at"`
	ExpiresAt        time.Time `json:"expires_at" yaml:"expires_at"`
	InstanceOnly     bool      `json:"instance_only" yaml:"instance_only"`
	ContainerOnly    bool      `json:"container_only" yaml:"container_only"` // Deprecated, use InstanceOnly.
	OptimizedStorage bool      `json:"optimized_storage" yaml:"optimized_storage"`
}

InstanceBackup represents a LXD instance backup.

API extension: instances

type InstanceBackupPost

type InstanceBackupPost struct {
	Name string `json:"name" yaml:"name"`
}

InstanceBackupPost represents the fields available for the renaming of a instance backup.

API extension: instances

type InstanceBackupsPost

type InstanceBackupsPost struct {
	Name             string    `json:"name" yaml:"name"`
	ExpiresAt        time.Time `json:"expires_at" yaml:"expires_at"`
	InstanceOnly     bool      `json:"instance_only" yaml:"instance_only"`
	ContainerOnly    bool      `json:"container_only" yaml:"container_only"` // Deprecated, use InstanceOnly.
	OptimizedStorage bool      `json:"optimized_storage" yaml:"optimized_storage"`

	// API extension: backup_compression_algorithm
	CompressionAlgorithm string `json:"compression_algorithm" yaml:"compression_algorithm"`
}

InstanceBackupsPost represents the fields available for a new LXD instance backup.

API extension: instances

type InstanceConsoleControl

type InstanceConsoleControl struct {
	Command string            `json:"command" yaml:"command"`
	Args    map[string]string `json:"args" yaml:"args"`
}

InstanceConsoleControl represents a message on the instance console "control" socket.

API extension: instances

type InstanceConsolePost

type InstanceConsolePost struct {
	Width  int `json:"width" yaml:"width"`
	Height int `json:"height" yaml:"height"`

	// API extension: console_vga_type
	Type string `json:"type" yaml:"type"`
}

InstanceConsolePost represents a LXD instance console request.

API extension: instances

type InstanceExecControl

type InstanceExecControl struct {
	Command string            `json:"command" yaml:"command"`
	Args    map[string]string `json:"args" yaml:"args"`
	Signal  int               `json:"signal" yaml:"signal"`
}

InstanceExecControl represents a message on the instance exec "control" socket.

API extension: instances

type InstanceExecPost

type InstanceExecPost struct {
	Command      []string          `json:"command" yaml:"command"`
	WaitForWS    bool              `json:"wait-for-websocket" yaml:"wait-for-websocket"`
	Interactive  bool              `json:"interactive" yaml:"interactive"`
	Environment  map[string]string `json:"environment" yaml:"environment"`
	Width        int               `json:"width" yaml:"width"`
	Height       int               `json:"height" yaml:"height"`
	RecordOutput bool              `json:"record-output" yaml:"record-output"`
	User         uint32            `json:"user" yaml:"user"`
	Group        uint32            `json:"group" yaml:"group"`
	Cwd          string            `json:"cwd" yaml:"cwd"`
}

InstanceExecPost represents a LXD instance exec request.

API extension: instances

type InstanceFull

type InstanceFull struct {
	Instance `yaml:",inline"`

	Backups   []InstanceBackup   `json:"backups" yaml:"backups"`
	State     *InstanceState     `json:"state" yaml:"state"`
	Snapshots []InstanceSnapshot `json:"snapshots" yaml:"snapshots"`
}

InstanceFull is a combination of Instance, InstanceBackup, InstanceState and InstanceSnapshot.

API extension: instances

type InstancePost

type InstancePost struct {
	Name          string              `json:"name" yaml:"name"`
	Migration     bool                `json:"migration" yaml:"migration"`
	Live          bool                `json:"live" yaml:"live"`
	InstanceOnly  bool                `json:"instance_only" yaml:"instance_only"`
	ContainerOnly bool                `json:"container_only" yaml:"container_only"` // Deprecated, use InstanceOnly.
	Target        *InstancePostTarget `json:"target" yaml:"target"`

	// API extension: instance_pool_move
	Pool string `json:"pool" yaml:"pool"`
}

InstancePost represents the fields required to rename/move a LXD instance.

API extension: instances

type InstancePostTarget

type InstancePostTarget struct {
	Certificate string            `json:"certificate" yaml:"certificate"`
	Operation   string            `json:"operation,omitempty" yaml:"operation,omitempty"`
	Websockets  map[string]string `json:"secrets,omitempty" yaml:"secrets,omitempty"`
}

InstancePostTarget represents the migration target host and operation.

API extension: instances

type InstancePut

type InstancePut struct {
	Architecture string                       `json:"architecture" yaml:"architecture"`
	Config       map[string]string            `json:"config" yaml:"config"`
	Devices      map[string]map[string]string `json:"devices" yaml:"devices"`
	Ephemeral    bool                         `json:"ephemeral" yaml:"ephemeral"`
	Profiles     []string                     `json:"profiles" yaml:"profiles"`
	Restore      string                       `json:"restore,omitempty" yaml:"restore,omitempty"`
	Stateful     bool                         `json:"stateful" yaml:"stateful"`
	Description  string                       `json:"description" yaml:"description"`
}

InstancePut represents the modifiable fields of a LXD instance.

API extension: instances

type InstanceSnapshot

type InstanceSnapshot struct {
	InstanceSnapshotPut `yaml:",inline"`

	CreatedAt       time.Time                    `json:"created_at" yaml:"created_at"`
	ExpandedConfig  map[string]string            `json:"expanded_config" yaml:"expanded_config"`
	ExpandedDevices map[string]map[string]string `json:"expanded_devices" yaml:"expanded_devices"`
	LastUsedAt      time.Time                    `json:"last_used_at" yaml:"last_used_at"`
	Name            string                       `json:"name" yaml:"name"`
	Stateful        bool                         `json:"stateful" yaml:"stateful"`

	// API extension: snapshot_disk_usage
	Size int64 `json:"size" yaml:"size"`
}

InstanceSnapshot represents a LXD instance snapshot.

API extension: instances

func (*InstanceSnapshot) Writable

func (c *InstanceSnapshot) Writable() InstanceSnapshotPut

Writable converts a full InstanceSnapshot struct into a InstanceSnapshotPut struct (filters read-only fields).

API extension: instances

type InstanceSnapshotPost

type InstanceSnapshotPost struct {
	Name      string              `json:"name" yaml:"name"`
	Migration bool                `json:"migration" yaml:"migration"`
	Target    *InstancePostTarget `json:"target" yaml:"target"`
	Live      bool                `json:"live,omitempty" yaml:"live,omitempty"`
}

InstanceSnapshotPost represents the fields required to rename/move a LXD instance snapshot.

API extension: instances

type InstanceSnapshotPut

type InstanceSnapshotPut struct {
	Architecture string                       `json:"architecture" yaml:"architecture"`
	Config       map[string]string            `json:"config" yaml:"config"`
	Devices      map[string]map[string]string `json:"devices" yaml:"devices"`
	Ephemeral    bool                         `json:"ephemeral" yaml:"ephemeral"`
	Profiles     []string                     `json:"profiles" yaml:"profiles"`
	ExpiresAt    time.Time                    `json:"expires_at" yaml:"expires_at"`
}

InstanceSnapshotPut represents the modifiable fields of a LXD instance snapshot.

API extension: instances

type InstanceSnapshotsPost

type InstanceSnapshotsPost struct {
	Name     string `json:"name" yaml:"name"`
	Stateful bool   `json:"stateful" yaml:"stateful"`

	// API extension: snapshot_expiry_creation
	ExpiresAt *time.Time `json:"expires_at" yaml:"expires_at"`
}

InstanceSnapshotsPost represents the fields available for a new LXD instance snapshot.

API extension: instances

type InstanceSource

type InstanceSource struct {
	Type          string            `json:"type" yaml:"type"`
	Certificate   string            `json:"certificate" yaml:"certificate"`
	Alias         string            `json:"alias,omitempty" yaml:"alias,omitempty"`
	Fingerprint   string            `json:"fingerprint,omitempty" yaml:"fingerprint,omitempty"`
	Properties    map[string]string `json:"properties,omitempty" yaml:"properties,omitempty"`
	Server        string            `json:"server,omitempty" yaml:"server,omitempty"`
	Secret        string            `json:"secret,omitempty" yaml:"secret,omitempty"`
	Protocol      string            `json:"protocol,omitempty" yaml:"protocol,omitempty"`
	BaseImage     string            `json:"base-image,omitempty" yaml:"base-image,omitempty"`
	Mode          string            `json:"mode,omitempty" yaml:"mode,omitempty"`
	Operation     string            `json:"operation,omitempty" yaml:"operation,omitempty"`
	Websockets    map[string]string `json:"secrets,omitempty" yaml:"secrets,omitempty"`
	Source        string            `json:"source,omitempty" yaml:"source,omitempty"`
	Live          bool              `json:"live,omitempty" yaml:"live,omitempty"`
	InstanceOnly  bool              `json:"instance_only,omitempty" yaml:"instance_only,omitempty"`
	ContainerOnly bool              `json:"container_only,omitempty" yaml:"container_only,omitempty"` // Deprecated, use InstanceOnly.
	Refresh       bool              `json:"refresh,omitempty" yaml:"refresh,omitempty"`
	Project       string            `json:"project,omitempty" yaml:"project,omitempty"`
}

InstanceSource represents the creation source for a new instance.

API extension: instances

type InstanceState

type InstanceState struct {
	Status     string                          `json:"status" yaml:"status"`
	StatusCode StatusCode                      `json:"status_code" yaml:"status_code"`
	Disk       map[string]InstanceStateDisk    `json:"disk" yaml:"disk"`
	Memory     InstanceStateMemory             `json:"memory" yaml:"memory"`
	Network    map[string]InstanceStateNetwork `json:"network" yaml:"network"`
	Pid        int64                           `json:"pid" yaml:"pid"`
	Processes  int64                           `json:"processes" yaml:"processes"`
	CPU        InstanceStateCPU                `json:"cpu" yaml:"cpu"`
}

InstanceState represents a LXD instance's state.

API extension: instances

type InstanceStateCPU

type InstanceStateCPU struct {
	Usage int64 `json:"usage" yaml:"usage"`
}

InstanceStateCPU represents the cpu information section of a LXD instance's state.

API extension: instances

type InstanceStateDisk

type InstanceStateDisk struct {
	Usage int64 `json:"usage" yaml:"usage"`
}

InstanceStateDisk represents the disk information section of a LXD instance's state.

API extension: instances

type InstanceStateMemory

type InstanceStateMemory struct {
	Usage         int64 `json:"usage" yaml:"usage"`
	UsagePeak     int64 `json:"usage_peak" yaml:"usage_peak"`
	SwapUsage     int64 `json:"swap_usage" yaml:"swap_usage"`
	SwapUsagePeak int64 `json:"swap_usage_peak" yaml:"swap_usage_peak"`
}

InstanceStateMemory represents the memory information section of a LXD instance's state.

API extension: instances

type InstanceStateNetwork

type InstanceStateNetwork struct {
	Addresses []InstanceStateNetworkAddress `json:"addresses" yaml:"addresses"`
	Counters  InstanceStateNetworkCounters  `json:"counters" yaml:"counters"`
	Hwaddr    string                        `json:"hwaddr" yaml:"hwaddr"`
	HostName  string                        `json:"host_name" yaml:"host_name"`
	Mtu       int                           `json:"mtu" yaml:"mtu"`
	State     string                        `json:"state" yaml:"state"`
	Type      string                        `json:"type" yaml:"type"`
}

InstanceStateNetwork represents the network information section of a LXD instance's state.

API extension: instances

type InstanceStateNetworkAddress

type InstanceStateNetworkAddress struct {
	Family  string `json:"family" yaml:"family"`
	Address string `json:"address" yaml:"address"`
	Netmask string `json:"netmask" yaml:"netmask"`
	Scope   string `json:"scope" yaml:"scope"`
}

InstanceStateNetworkAddress represents a network address as part of the network section of a LXD instance's state.

API extension: instances

type InstanceStateNetworkCounters

type InstanceStateNetworkCounters struct {
	BytesReceived   int64 `json:"bytes_received" yaml:"bytes_received"`
	BytesSent       int64 `json:"bytes_sent" yaml:"bytes_sent"`
	PacketsReceived int64 `json:"packets_received" yaml:"packets_received"`
	PacketsSent     int64 `json:"packets_sent" yaml:"packets_sent"`
}

InstanceStateNetworkCounters represents packet counters as part of the network section of a LXD instance's state.

API extension: instances

type InstanceStatePut

type InstanceStatePut struct {
	Action   string `json:"action" yaml:"action"`
	Timeout  int    `json:"timeout" yaml:"timeout"`
	Force    bool   `json:"force" yaml:"force"`
	Stateful bool   `json:"stateful" yaml:"stateful"`
}

InstanceStatePut represents the modifiable fields of a LXD instance's state.

API extension: instances

type InstanceType

type InstanceType string

InstanceType represents the type if instance being returned or requested via the API.

type InstancesPost

type InstancesPost struct {
	InstancePut `yaml:",inline"`

	Name         string         `json:"name" yaml:"name"`
	Source       InstanceSource `json:"source" yaml:"source"`
	InstanceType string         `json:"instance_type" yaml:"instance_type"`
	Type         InstanceType   `json:"type" yaml:"type"`
}

InstancesPost represents the fields available for a new LXD instance.

API extension: instances

type InstancesPut

type InstancesPut struct {
	State *InstanceStatePut `json:"state" yaml:"state"`
}

InstancesPut represents the fields available for a mass update.

API extension: instance_bulk_state_change

type Network

type Network struct {
	NetworkPut `yaml:",inline"`

	Name   string   `json:"name" yaml:"name"`
	Type   string   `json:"type" yaml:"type"`
	UsedBy []string `json:"used_by" yaml:"used_by"`

	// API extension: network
	Managed bool `json:"managed" yaml:"managed"`

	// API extension: clustering
	Status    string   `json:"status" yaml:"status"`
	Locations []string `json:"locations" yaml:"locations"`
}

Network represents a LXD network

func (*Network) Writable

func (network *Network) Writable() NetworkPut

Writable converts a full Network struct into a NetworkPut struct (filters read-only fields)

type NetworkACL

type NetworkACL struct {
	NetworkACLPost `yaml:",inline"`
	NetworkACLPut  `yaml:",inline"`

	UsedBy []string `json:"used_by" yaml:"used_by"` // Resources that use the ACL.
}

NetworkACL used for displaying an ACL. API extension: network_acl

func (*NetworkACL) Writable

func (acl *NetworkACL) Writable() NetworkACLPut

Writable converts a full NetworkACL struct into a NetworkACLPut struct (filters read-only fields).

type NetworkACLPost

type NetworkACLPost struct {
	Name string `json:"name" yaml:"name"` // Name of ACL.
}

NetworkACLPost used for renaming an ACL. API extension: network_acl

type NetworkACLPut

type NetworkACLPut struct {
	Description string            `json:"description" yaml:"description"` // Friendly description of ACL.
	Egress      []NetworkACLRule  `json:"egress" yaml:"egress"`           // Egress rules (order independent).
	Ingress     []NetworkACLRule  `json:"ingress" yaml:"ingress"`         // Ingress rules (order independent).
	Config      map[string]string `json:"config" yaml:"config"`           // Used for custom settings.
}

NetworkACLPut used for updating an ACL. API extension: network_acl

type NetworkACLRule

type NetworkACLRule struct {
	Action          string `json:"action" yaml:"action"`
	Source          string `json:"source" yaml:"source"`
	Destination     string `json:"destination" yaml:"destination"`
	Protocol        string `json:"protocol" yaml:"protocol"`
	SourcePort      string `json:"source_port" yaml:"source_port"`
	DestinationPort string `json:"destination_port" yaml:"destination_port"`
	ICMPType        string `json:"icmp_type" yaml:"icmp_type"`
	ICMPCode        string `json:"icmp_code" yaml:"icmp_code"`
	Description     string `json:"description" yaml:"description"`
	State           string `json:"state" yaml:"state"`
}

NetworkACLRule represents a single rule in an ACL ruleset. API extension: network_acl

func (*NetworkACLRule) Normalise

func (r *NetworkACLRule) Normalise()

Normalise normalises the fields in the rule so that they are comparable with ones stored.

type NetworkACLsPost

type NetworkACLsPost struct {
	NetworkACLPost `yaml:",inline"`
	NetworkACLPut  `yaml:",inline"`
}

NetworkACLsPost used for creating an ACL. API extension: network_acl

type NetworkLease

type NetworkLease struct {
	Hostname string `json:"hostname" yaml:"hostname"`
	Hwaddr   string `json:"hwaddr" yaml:"hwaddr"`
	Address  string `json:"address" yaml:"address"`
	Type     string `json:"type" yaml:"type"`

	// API extension: network_leases_location
	Location string `json:"location" yaml:"location"`
}

NetworkLease represents a DHCP lease

API extension: network_leases

type NetworkPost

type NetworkPost struct {
	Name string `json:"name" yaml:"name"`
}

NetworkPost represents the fields required to rename a LXD network

API extension: network

type NetworkPut

type NetworkPut struct {
	Config map[string]string `json:"config" yaml:"config"`

	// API extension: entity_description
	Description string `json:"description" yaml:"description"`
}

NetworkPut represents the modifiable fields of a LXD network

API extension: network

type NetworkState

type NetworkState struct {
	Addresses []NetworkStateAddress `json:"addresses" yaml:"addresses"`
	Counters  NetworkStateCounters  `json:"counters" yaml:"counters"`
	Hwaddr    string                `json:"hwaddr" yaml:"hwaddr"`
	Mtu       int                   `json:"mtu" yaml:"mtu"`
	State     string                `json:"state" yaml:"state"`
	Type      string                `json:"type" yaml:"type"`

	// API extension: network_state_bond_bridge
	Bond   *NetworkStateBond   `json:"bond" yaml:"bond"`
	Bridge *NetworkStateBridge `json:"bridge" yaml:"bridge"`

	// API extension: network_state_vlan
	VLAN *NetworkStateVLAN `json:"vlan" yaml:"vlan"`
}

NetworkState represents the network state

type NetworkStateAddress

type NetworkStateAddress struct {
	Family  string `json:"family" yaml:"family"`
	Address string `json:"address" yaml:"address"`
	Netmask string `json:"netmask" yaml:"netmask"`
	Scope   string `json:"scope" yaml:"scope"`
}

NetworkStateAddress represents a network address

type NetworkStateBond

type NetworkStateBond struct {
	Mode           string `json:"mode" yaml:"mode"`
	TransmitPolicy string `json:"transmit_policy" yaml:"transmit_policy"`
	UpDelay        uint64 `json:"up_delay" yaml:"up_delay"`
	DownDelay      uint64 `json:"down_delay" yaml:"down_delay"`

	MIIFrequency uint64 `json:"mii_frequency" yaml:"mii_frequency"`
	MIIState     string `json:"mii_state" yaml:"mii_state"`

	LowerDevices []string `json:"lower_devices" yaml:"lower_devices"`
}

NetworkStateBond represents bond specific state API extension: network_state_bond_bridge

type NetworkStateBridge

type NetworkStateBridge struct {
	ID           string `json:"id" yaml:"id"`
	STP          bool   `json:"stp" yaml:"stp"`
	ForwardDelay uint64 `json:"forward_delay" yaml:"forward_delay"`

	VLANDefault   uint64 `json:"vlan_default" yaml:"vlan_default"`
	VLANFiltering bool   `json:"vlan_filtering" yaml:"vlan_filtering"`

	UpperDevices []string `json:"upper_devices" yaml:"upper_devices"`
}

NetworkStateBridge represents bridge specific state API extension: network_state_bond_bridge

type NetworkStateCounters

type NetworkStateCounters struct {
	BytesReceived   int64 `json:"bytes_received" yaml:"bytes_received"`
	BytesSent       int64 `json:"bytes_sent" yaml:"bytes_sent"`
	PacketsReceived int64 `json:"packets_received" yaml:"packets_received"`
	PacketsSent     int64 `json:"packets_sent" yaml:"packets_sent"`
}

NetworkStateCounters represents packet counters

type NetworkStateVLAN

type NetworkStateVLAN struct {
	LowerDevice string `json:"lower_device" yaml:"lower_device"`
	VID         uint64 `json:"vid" yaml:"vid"`
}

NetworkStateVLAN represents VLAN specific state API extension: network_state_vlan

type NetworksPost

type NetworksPost struct {
	NetworkPut `yaml:",inline"`

	Name string `json:"name" yaml:"name"`
	Type string `json:"type" yaml:"type"`
}

NetworksPost represents the fields of a new LXD network

API extension: network

type Operation

type Operation struct {
	ID          string                 `json:"id" yaml:"id"`
	Class       string                 `json:"class" yaml:"class"`
	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"`
	MayCancel   bool                   `json:"may_cancel" yaml:"may_cancel"`
	Err         string                 `json:"err" yaml:"err"`

	// API extension: operation_location
	Location string `json:"location" yaml:"location"`
}

Operation represents a LXD background operation

type Profile

type Profile struct {
	ProfilePut `yaml:",inline"`

	Name string `json:"name" yaml:"name" db:"primary=yes"`

	// API extension: profile_usedby
	UsedBy []string `json:"used_by" yaml:"used_by"`
}

Profile represents a LXD profile

func (*Profile) Writable

func (profile *Profile) Writable() ProfilePut

Writable converts a full Profile struct into a ProfilePut struct (filters read-only fields)

type ProfilePost

type ProfilePost struct {
	Name string `json:"name" yaml:"name"`
}

ProfilePost represents the fields required to rename a LXD profile

type ProfilePut

type ProfilePut struct {
	Config      map[string]string            `json:"config" yaml:"config"`
	Description string                       `json:"description" yaml:"description"`
	Devices     map[string]map[string]string `json:"devices" yaml:"devices"`
}

ProfilePut represents the modifiable fields of a LXD profile

type ProfilesPost

type ProfilesPost struct {
	ProfilePut `yaml:",inline"`

	Name string `json:"name" yaml:"name" db:"primary=yes"`
}

ProfilesPost represents the fields of a new LXD profile

type Project

type Project struct {
	ProjectPut `yaml:",inline"`

	Name   string   `json:"name" yaml:"name"`
	UsedBy []string `json:"used_by" yaml:"used_by"`
}

Project represents a LXD project

API extension: projects

func (*Project) Writable

func (project *Project) Writable() ProjectPut

Writable converts a full Project struct into a ProjectPut struct (filters read-only fields)

API extension: projects

type ProjectPost

type ProjectPost struct {
	Name string `json:"name" yaml:"name"`
}

ProjectPost represents the fields required to rename a LXD project

API extension: projects

type ProjectPut

type ProjectPut struct {
	Description string            `json:"description" yaml:"description"`
	Config      map[string]string `json:"config" yaml:"config"`
}

ProjectPut represents the modifiable fields of a LXD project

API extension: projects

type ProjectsPost

type ProjectsPost struct {
	ProjectPut `yaml:",inline"`

	Name string `json:"name" yaml:"name"`
}

ProjectsPost represents the fields of a new LXD project

API extension: projects

type Resources

type Resources struct {
	// CPU information
	CPU ResourcesCPU `json:"cpu" yaml:"cpu"`

	// Memory information
	Memory ResourcesMemory `json:"memory" yaml:"memory"`

	// GPU devices
	//
	// API extension: resources_gpu
	GPU ResourcesGPU `json:"gpu" yaml:"gpu"`

	// Network devices
	//
	// API extension: resources_v2
	Network ResourcesNetwork `json:"network" yaml:"network"`

	// Storage devices
	//
	// API extension: resources_v2
	Storage ResourcesStorage `json:"storage" yaml:"storage"`

	// USB devices
	//
	// API extension: resources_usb_pci
	USB ResourcesUSB `json:"usb" yaml:"usb"`

	// PCI devices
	//
	// API extension: resources_usb_pci
	PCI ResourcesPCI `json:"pci" yaml:"pci"`

	// System information
	//
	// API extension: resources_system
	System ResourcesSystem `json:"system" yaml:"system"`
}

Resources represents the system resources available for LXD

API extension: resources

swagger:model

type ResourcesCPU

type ResourcesCPU struct {
	// Architecture name
	// Example: x86_64
	//
	// API extension: resources_v2
	Architecture string `json:"architecture" yaml:"architecture"`

	// List of CPU sockets
	Sockets []ResourcesCPUSocket `json:"sockets" yaml:"sockets"`

	// Total number of CPU threads (from all sockets and cores)
	// Example: 1
	Total uint64 `json:"total" yaml:"total"`
}

ResourcesCPU represents the cpu resources available on the system

API extension: resources

type ResourcesCPUCache

type ResourcesCPUCache struct {
	// Cache level (usually a number from 1 to 3)
	// Example: 1
	Level uint64 `json:"level" yaml:"level"`

	// Type of cache (Data, Instruction, Unified, ...)
	// Example: Data
	Type string `json:"type" yaml:"type"`

	// Size of the cache (in bytes)
	// Example: 32768
	Size uint64 `json:"size" yaml:"size"`
}

ResourcesCPUCache represents a CPU cache

API extension: resources_v2

type ResourcesCPUCore

type ResourcesCPUCore struct {
	// Core identifier within the socket
	// Example: 0
	Core uint64 `json:"core" yaml:"core"`

	// What die the CPU is a part of (for chiplet designs)
	// Example: 0
	//
	// API extension: resources_cpu_core_die
	Die uint64 `json:"die" yaml:"die"`

	// List of threads
	Threads []ResourcesCPUThread `json:"threads" yaml:"threads"`

	// Current frequency
	// Example: 3500
	Frequency uint64 `json:"frequency,omitempty" yaml:"frequency,omitempty"`
}

ResourcesCPUCore represents a CPU core on the system API extension: resources_v2

type ResourcesCPUSocket

type ResourcesCPUSocket struct {
	// Product name
	// Example: Intel(R) Core(TM) i5-7300U CPU @ 2.60GHz
	Name string `json:"name,omitempty" yaml:"name,omitempty"`

	// Vendor name
	// Example: GenuineIntel
	Vendor string `json:"vendor,omitempty" yaml:"vendor,omitempty"`

	// Socket number
	// Example: 0
	Socket uint64 `json:"socket" yaml:"socket"`

	// List of CPU caches
	Cache []ResourcesCPUCache `json:"cache,omitempty" yaml:"cache,omitempty"`

	// List of CPU cores
	Cores []ResourcesCPUCore `json:"cores" yaml:"cores"`

	// Current CPU frequency (Mhz)
	// Example: 3499
	Frequency uint64 `json:"frequency,omitempty" yaml:"frequency,omitempty"`

	// Minimum CPU frequency (Mhz)
	// Example: 400
	FrequencyMinimum uint64 `json:"frequency_minimum,omitempty" yaml:"frequency_minimum,omitempty"`

	// Maximum CPU frequency (Mhz)
	// Example: 3500
	FrequencyTurbo uint64 `json:"frequency_turbo,omitempty" yaml:"frequency_turbo,omitempty"`
}

ResourcesCPUSocket represents a CPU socket on the system

API extension: resources_v2

type ResourcesCPUThread

type ResourcesCPUThread struct {
	// Thread ID (used for CPU pinning)
	// Example: 0
	ID int64 `json:"id" yaml:"id"`

	// NUMA node the thread is a part of
	// Example: 0
	NUMANode uint64 `json:"numa_node" yaml:"numa_node"`

	// Thread identifier within the core
	// Example: 0
	Thread uint64 `json:"thread" yaml:"thread"`

	// Whether the thread is online (enabled)
	// Example: true
	Online bool `json:"online" yaml:"online"`

	// Whether the thread has been isolated (outside of normal scheduling)
	// Example: false
	//
	// API extension: resource_cpu_isolated
	Isolated bool `json:"isolated" yaml:"isolated"`
}

ResourcesCPUThread represents a CPU thread on the system

API extension: resources_v2

type ResourcesGPU

type ResourcesGPU struct {
	// List of GPUs
	Cards []ResourcesGPUCard `json:"cards" yaml:"cards"`

	// Total number of GPUs
	// Example: 1
	Total uint64 `json:"total" yaml:"total"`
}

ResourcesGPU represents the GPU resources available on the system

API extension: resources_gpu

type ResourcesGPUCard

type ResourcesGPUCard struct {
	// Kernel driver currently associated with the GPU
	// Example: i915
	Driver string `json:"driver,omitempty" yaml:"driver,omitempty"`

	// Version of the kernel driver
	// Example: 5.8.0-36-generic
	DriverVersion string `json:"driver_version,omitempty" yaml:"driver_version,omitempty"`

	// DRM information (if card is in used by the host)
	DRM *ResourcesGPUCardDRM `json:"drm,omitempty" yaml:"drm,omitempty"`

	// SRIOV information (when supported by the card)
	SRIOV *ResourcesGPUCardSRIOV `json:"sriov,omitempty" yaml:"sriov,omitempty"`

	// NVIDIA specific information
	Nvidia *ResourcesGPUCardNvidia `json:"nvidia,omitempty" yaml:"nvidia,omitempty"`

	// Map of available mediated device profiles
	// Example: null
	//
	// API extension: resources_gpu_mdev
	Mdev map[string]ResourcesGPUCardMdev `json:"mdev,omitempty" yaml:"mdev,omitempty"`

	// NUMA node the GPU is a part of
	// Example: 0
	NUMANode uint64 `json:"numa_node" yaml:"numa_node"`

	// PCI address
	// Example: 0000:00:02.0
	PCIAddress string `json:"pci_address,omitempty" yaml:"pci_address,omitempty"`

	// Name of the vendor
	// Example: Intel Corporation
	Vendor string `json:"vendor,omitempty" yaml:"vendor,omitempty"`

	// PCI ID of the vendor
	// Example: 8086
	VendorID string `json:"vendor_id,omitempty" yaml:"vendor_id,omitempty"`

	// Name of the product
	// Example: HD Graphics 620
	Product string `json:"product,omitempty" yaml:"product,omitempty"`

	// PCI ID of the product
	// Example: 5916
	ProductID string `json:"product_id,omitempty" yaml:"product_id,omitempty"`
}

ResourcesGPUCard represents a GPU card on the system API extension: resources_v2

type ResourcesGPUCardDRM

type ResourcesGPUCardDRM struct {
	// DRM card ID
	// Example: 0
	ID uint64 `json:"id" yaml:"id"`

	// Card device name
	// Example: card0
	CardName string `json:"card_name" yaml:"card_name"`

	// Card device number
	// Example: 226:0
	CardDevice string `json:"card_device" yaml:"card_device"`

	// Control device name
	// Example: controlD64
	ControlName string `json:"control_name,omitempty" yaml:"control_name,omitempty"`

	// Control device number
	// Example: 226:0
	ControlDevice string `json:"control_device,omitempty" yaml:"control_device,omitempty"`

	// Render device name
	// Example: renderD128
	RenderName string `json:"render_name,omitempty" yaml:"render_name,omitempty"`

	// Render device number
	// Example: 226:128
	RenderDevice string `json:"render_device,omitempty" yaml:"render_device,omitempty"`
}

ResourcesGPUCardDRM represents the Linux DRM configuration of the GPU API extension: resources_v2

type ResourcesGPUCardMdev

type ResourcesGPUCardMdev struct {
	// The mechanism used by this device
	// Example: vfio-pci
	API string `json:"api" yaml:"api"`

	// Number of available devices of this profile
	// Example: 2
	Available uint64 `json:"available" yaml:"available"`

	// Profile name
	// Example: i915-GVTg_V5_8
	Name string `json:"name,omitempty" yaml:"name,omitempty"`

	// Profile description
	// Example: low_gm_size: 128MB\nhigh_gm_size: 512MB\nfence: 4\nresolution: 1920x1200\nweight: 4
	Description string `json:"description,omitempty" yaml:"description,omitempty"`

	// List of active devices (UUIDs)
	// Example: ["42200aac-0977-495c-8c9e-6c51b9092a01", "b4950c00-1437-41d9-88f6-28d61cf9b9ef"]
	Devices []string `json:"devices" yaml:"devices"`
}

ResourcesGPUCardMdev represents the mediated devices configuration of the GPU

API extension: resources_gpu_mdev

type ResourcesGPUCardNvidia

type ResourcesGPUCardNvidia struct {
	// Version of the CUDA API
	// Example: 11.0
	CUDAVersion string `json:"cuda_version,omitempty" yaml:"cuda_version,omitempty"`

	// Version of the NVRM (usually driver version)
	// Example: 450.102.04
	NVRMVersion string `json:"nvrm_version,omitempty" yaml:"nvrm_version,omitempty"`

	// Brand name
	// Example: GeForce
	Brand string `json:"brand" yaml:"brand"`

	// Model name
	// Example: GeForce GT 730
	Model string `json:"model" yaml:"model"`

	// GPU UUID
	// Example: GPU-6ddadebd-dafe-2db9-f10f-125719770fd3
	UUID string `json:"uuid,omitempty" yaml:"uuid,omitempty"`

	// Architecture (generation)
	// Example: 3.5
	Architecture string `json:"architecture,omitempty" yaml:"architecture,omitempty"`

	// Card device name
	// Example: nvidia0
	//
	// API extension: resources_v2
	CardName string `json:"card_name" yaml:"card_name"`

	// Card device number
	// Example: 195:0
	//
	// API extension: resources_v2
	CardDevice string `json:"card_device" yaml:"card_device"`
}

ResourcesGPUCardNvidia represents additional information for NVIDIA GPUs

API extension: resources_gpu

type ResourcesGPUCardSRIOV

type ResourcesGPUCardSRIOV struct {
	// Number of VFs currently configured
	// Example: 0
	CurrentVFs uint64 `json:"current_vfs" yaml:"current_vfs"`

	// Maximum number of supported VFs
	// Example: 0
	MaximumVFs uint64 `json:"maximum_vfs" yaml:"maximum_vfs"`

	// List of VFs (as additional GPU devices)
	// Example: null
	VFs []ResourcesGPUCard `json:"vfs" yaml:"vfs"`
}

ResourcesGPUCardSRIOV represents the SRIOV configuration of the GPU

API extension: resources_v2

type ResourcesMemory

type ResourcesMemory struct {
	// List of NUMA memory nodes
	//
	// API extension: resources_v2
	Nodes []ResourcesMemoryNode `json:"nodes,omitempty" yaml:"nodes,omitempty"`

	// Total of memory huge pages (bytes)
	// Example: 429284917248
	HugepagesTotal uint64 `json:"hugepages_total" yaml:"hugepages_total"`

	// Used memory huge pages (bytes)
	// Example: 429284917248
	HugepagesUsed uint64 `json:"hugepages_used" yaml:"hugepages_used"`

	// Size of memory huge pages (bytes)
	// Example: 2097152
	HugepagesSize uint64 `json:"hugepages_size" yaml:"hugepages_size"`

	// Used system memory (bytes)
	// Example: 557450502144
	Used uint64 `json:"used" yaml:"used"`

	// Total system memory (bytes)
	// Example: 687194767360
	Total uint64 `json:"total" yaml:"total"`
}

ResourcesMemory represents the memory resources available on the system

API extension: resources

type ResourcesMemoryNode

type ResourcesMemoryNode struct {
	// NUMA node identifier
	// Example: 0
	NUMANode uint64 `json:"numa_node" yaml:"numa_node"`

	// Used memory huge pages (bytes)
	// Example: 214536552448
	HugepagesUsed uint64 `json:"hugepages_used" yaml:"hugepages_used"`

	// Total of memory huge pages (bytes)
	// Example: 214536552448
	HugepagesTotal uint64 `json:"hugepages_total" yaml:"hugepages_total"`

	// Used system memory (bytes)
	// Example: 264880439296
	Used uint64 `json:"used" yaml:"used"`

	// Total system memory (bytes)
	// Example: 343597383680
	Total uint64 `json:"total" yaml:"total"`
}

ResourcesMemoryNode represents the node-specific memory resources available on the system API extension: resources_v2

type ResourcesNetwork

type ResourcesNetwork struct {
	// List of network cards
	Cards []ResourcesNetworkCard `json:"cards" yaml:"cards"`

	// Total number of network cards
	// Example: 1
	Total uint64 `json:"total" yaml:"total"`
}

ResourcesNetwork represents the network cards available on the system API extension: resources_v2

type ResourcesNetworkCard

type ResourcesNetworkCard struct {
	// Kernel driver currently associated with the card
	// Example: atlantic
	Driver string `json:"driver,omitempty" yaml:"driver,omitempty"`

	// Version of the kernel driver
	// Example: 5.8.0-36-generic
	DriverVersion string `json:"driver_version,omitempty" yaml:"driver_version,omitempty"`

	// List of ports on the card
	Ports []ResourcesNetworkCardPort `json:"ports,omitempty" yaml:"ports,omitempty"`

	// SRIOV information (when supported by the card)
	SRIOV *ResourcesNetworkCardSRIOV `json:"sriov,omitempty" yaml:"sriov,omitempty"`

	// NUMA node the card is a part of
	// Example: 0
	NUMANode uint64 `json:"numa_node" yaml:"numa_node"`

	// PCI address (for PCI cards)
	// Example: 0000:0d:00.0
	PCIAddress string `json:"pci_address,omitempty" yaml:"pci_address,omitempty"`

	// Name of the vendor
	// Example: Aquantia Corp.
	Vendor string `json:"vendor,omitempty" yaml:"vendor,omitempty"`

	// PCI ID of the vendor
	// Example: 1d6a
	VendorID string `json:"vendor_id,omitempty" yaml:"vendor_id,omitempty"`

	// Name of the product
	// Example: AQC107 NBase-T/IEEE
	Product string `json:"product,omitempty" yaml:"product,omitempty"`

	// PCI ID of the product
	// Example: 87b1
	ProductID string `json:"product_id,omitempty" yaml:"product_id,omitempty"`

	// Current firmware version
	// Example: 3.1.100
	//
	// API extension: resources_network_firmware
	FirmwareVersion string `json:"firmware_version,omitempty" yaml:"firmware_version,omitempty"`

	// USB address (for USB cards)
	// Example: 2:7
	//
	// API extension: resources_network_usb
	USBAddress string `json:"usb_address,omitempty" yaml:"usb_address,omitempty"`
}

ResourcesNetworkCard represents a network card on the system

API extension: resources_v2

type ResourcesNetworkCardPort

type ResourcesNetworkCardPort struct {
	// Port identifier (interface name)
	// Example: eth0
	ID string `json:"id" yaml:"id"`

	// MAC address
	// Example: 00:23:a4:01:01:6f
	Address string `json:"address,omitempty" yaml:"address,omitempty"`

	// Port number
	// Example: 0
	Port uint64 `json:"port" yaml:"port"`

	// Transport protocol
	// Example: ethernet
	Protocol string `json:"protocol" yaml:"protocol"`

	// List of supported modes
	// Example: ["100baseT/Full", "1000baseT/Full", "2500baseT/Full", "5000baseT/Full", "10000baseT/Full"]
	SupportedModes []string `json:"supported_modes,omitempty" yaml:"supported_modes,omitempty"`

	// List of supported port types
	// Example: ["twisted pair"]
	SupportedPorts []string `json:"supported_ports,omitempty" yaml:"supported_ports,omitempty"`

	// Current port type
	// Example: twisted pair
	PortType string `json:"port_type,omitempty" yaml:"port_type,omitempty"`

	// Type of transceiver used
	// Example: internal
	TransceiverType string `json:"transceiver_type,omitempty" yaml:"transceiver_type,omitempty"`

	// Whether auto negotiation is used
	// Example: true
	AutoNegotiation bool `json:"auto_negotiation" yaml:"auto_negotiation"`

	// Whether a link was detected
	// Example: true
	LinkDetected bool `json:"link_detected" yaml:"link_detected"`

	// Current speed (Mbit/s)
	// Example: 10000
	LinkSpeed uint64 `json:"link_speed,omitempty" yaml:"link_speed,omitempty"`

	// Duplex type
	// Example: full
	LinkDuplex string `json:"link_duplex,omitempty" yaml:"link_duplex,omitempty"`

	// Additional information for infiniband devices
	//
	// API extension: resources_infiniband
	Infiniband *ResourcesNetworkCardPortInfiniband `json:"infiniband,omitempty" yaml:"infiniband,omitempty"`
}

ResourcesNetworkCardPort represents a network port on the system

API extension: resources_v2

type ResourcesNetworkCardPortInfiniband

type ResourcesNetworkCardPortInfiniband struct {
	// ISSM device name
	// Example: issm0
	IsSMName string `json:"issm_name,omitempty" yaml:"issm_name,omitempty"`

	// ISSM device number
	// Example: 231:64
	IsSMDevice string `json:"issm_device,omitempty" yaml:"issm_device,omitempty"`

	// MAD device name
	// Example: umad0
	MADName string `json:"mad_name,omitempty" yaml:"mad_name,omitempty"`

	// MAD device number
	// Example: 231:0
	MADDevice string `json:"mad_device,omitempty" yaml:"mad_device,omitempty"`

	// Verb device name
	// Example: uverbs0
	VerbName string `json:"verb_name,omitempty" yaml:"verb_name,omitempty"`

	// Verb device number
	// Example: 231:192
	VerbDevice string `json:"verb_device,omitempty" yaml:"verb_device,omitempty"`
}

ResourcesNetworkCardPortInfiniband represents the Linux Infiniband configuration for the port API extension: resources_infiniband

type ResourcesNetworkCardSRIOV

type ResourcesNetworkCardSRIOV struct {
	// Number of VFs currently configured
	// Example: 0
	CurrentVFs uint64 `json:"current_vfs" yaml:"current_vfs"`

	// Maximum number of supported VFs
	// Example: 0
	MaximumVFs uint64 `json:"maximum_vfs" yaml:"maximum_vfs"`

	// List of VFs (as additional Network devices)
	// Example: null
	VFs []ResourcesNetworkCard `json:"vfs" yaml:"vfs"`
}

ResourcesNetworkCardSRIOV represents the SRIOV configuration of the network card

API extension: resources_v2

type ResourcesPCI

type ResourcesPCI struct {
	// List of PCI devices
	Devices []ResourcesPCIDevice `json:"devices" yaml:"devices"`

	// Total number of PCI devices
	// Example: 1
	Total uint64 `json:"total" yaml:"total"`
}

ResourcesPCI represents the PCI devices available on the system

API extension: resources_usb_pci

type ResourcesPCIDevice

type ResourcesPCIDevice struct {
	// Kernel driver currently associated with the GPU
	// Example: mgag200
	Driver string `json:"driver" yaml:"driver"`

	// Version of the kernel driver
	// Example: 5.8.0-36-generic
	DriverVersion string `json:"driver_version" yaml:"driver_version"`

	// NUMA node the card is a part of
	// Example: 0
	NUMANode uint64 `json:"numa_node" yaml:"numa_node"`

	// PCI address
	// Example: 0000:07:03.0
	PCIAddress string `json:"pci_address" yaml:"pci_address"`

	// Name of the vendor
	// Example: Matrox Electronics Systems Ltd.
	Vendor string `json:"vendor" yaml:"vendor"`

	// PCI ID of the vendor
	// Example: 102b
	VendorID string `json:"vendor_id" yaml:"vendor_id"`

	// Name of the product
	// Example: MGA G200eW WPCM450
	Product string `json:"product" yaml:"product"`

	// PCI ID of the product
	// Example: 0532
	ProductID string `json:"product_id" yaml:"product_id"`

	// IOMMU group number
	// Example: 20
	//
	// API extension: resources_pci_iommu
	IOMMUGroup uint64 `json:"iommu_group" yaml:"iommu_group"`
}

ResourcesPCIDevice represents a PCI device

API extension: resources_usb_pci

type ResourcesStorage

type ResourcesStorage struct {
	// List of disks
	Disks []ResourcesStorageDisk `json:"disks" yaml:"disks"`

	// Total number of partitions
	// Example: 1
	Total uint64 `json:"total" yaml:"total"`
}

ResourcesStorage represents the local storage

API extension: resources_v2

type ResourcesStorageDisk

type ResourcesStorageDisk struct {
	// ID of the disk (device name)
	// Example: nvme0n1
	ID string `json:"id" yaml:"id"`

	// Device number
	// Example: 259:0
	Device string `json:"device" yaml:"device"`

	// Disk model name
	// Example: INTEL SSDPEKKW256G7
	Model string `json:"model,omitempty" yaml:"model,omitempty"`

	// Storage type
	// Example: nvme
	Type string `json:"type,omitempty" yaml:"type,omitempty"`

	// Whether the disk is read-only
	// Example: false
	ReadOnly bool `json:"read_only" yaml:"read_only"`

	// Total size of the disk (bytes)
	// Example: 256060514304
	Size uint64 `json:"size" yaml:"size"`

	// Whether the disk is removable (hot-plug)
	// Example: false
	Removable bool `json:"removable" yaml:"removable"`

	// WWN identifier
	// Example: eui.0000000001000000e4d25cafae2e4c00
	WWN string `json:"wwn,omitempty" yaml:"wwn,omitempty"`

	// NUMA node the disk is a part of
	// Example: 0
	NUMANode uint64 `json:"numa_node" yaml:"numa_node"`

	// Device by-path identifier
	// Example: pci-0000:05:00.0-nvme-1
	//
	// API extension: resources_disk_sata
	DevicePath string `json:"device_path,omitempty" yaml:"device_path,omitempty"`

	// Block size
	// Example: 512
	//
	// API extension: resources_disk_sata
	BlockSize uint64 `json:"block_size" yaml:"block_size"`

	// Current firmware version
	// Example: PSF121C
	//
	// API extension: resources_disk_sata
	FirmwareVersion string `json:"firmware_version,omitempty" yaml:"firmware_version,omitempty"`

	// Rotation speed (RPM)
	// Example: 0
	//
	// API extension: resources_disk_sata
	RPM uint64 `json:"rpm" yaml:"rpm"`

	// Serial number
	// Example: BTPY63440ARH256D
	//
	// API extension: resources_disk_sata
	Serial string `json:"serial,omitempty" yaml:"serial,omitempty"`

	// Device by-id identifier
	// Example: nvme-eui.0000000001000000e4d25cafae2e4c00
	//
	// API extension: resources_disk_id
	DeviceID string `json:"device_id" yaml:"device_id"`

	// List of partitions
	Partitions []ResourcesStorageDiskPartition `json:"partitions" yaml:"partitions"`

	// PCI address
	// Example: 0000:05:00.0
	//
	// API extension: resources_disk_address
	PCIAddress string `json:"pci_address,omitempty" yaml:"pci_address,omitempty"`

	// USB address
	// Example: 3:5
	//
	// API extension: resources_disk_address
	USBAddress string `json:"usb_address,omitempty" yaml:"usb_address,omitempty"`
}

ResourcesStorageDisk represents a disk

API extension: resources_v2

type ResourcesStorageDiskPartition

type ResourcesStorageDiskPartition struct {
	// ID of the partition (device name)
	// Example: nvme0n1p1
	ID string `json:"id" yaml:"id"`

	// Device number
	// Example: 259:1
	Device string `json:"device" yaml:"device"`

	// Whether the partition is read-only
	// Example: false
	ReadOnly bool `json:"read_only" yaml:"read_only"`

	// Size of the partition (bytes)
	// Example: 254933278208
	Size uint64 `json:"size" yaml:"size"`

	// Partition number
	// Example: 1
	Partition uint64 `json:"partition" yaml:"partition"`
}

ResourcesStorageDiskPartition represents a partition on a disk

API extension: resources_v2

type ResourcesStoragePool

type ResourcesStoragePool struct {
	// Disk space usage
	Space ResourcesStoragePoolSpace `json:"space,omitempty" yaml:"space,omitempty"`

	// DIsk inode usage
	Inodes ResourcesStoragePoolInodes `json:"inodes,omitempty" yaml:"inodes,omitempty"`
}

ResourcesStoragePool represents the resources available to a given storage pool

API extension: resources

type ResourcesStoragePoolInodes

type ResourcesStoragePoolInodes struct {
	// Used inodes
	// Example: 23937695
	Used uint64 `json:"used" yaml:"used"`

	// Total inodes
	// Example: 30709993797
	Total uint64 `json:"total" yaml:"total"`
}

ResourcesStoragePoolInodes represents the inodes available to a given storage pool

API extension: resources

type ResourcesStoragePoolSpace

type ResourcesStoragePoolSpace struct {
	// Used disk space (bytes)
	// Example: 343537419776
	Used uint64 `json:"used,omitempty" yaml:"used,omitempty"`

	// Total disk space (bytes)
	// Example: 420100937728
	Total uint64 `json:"total" yaml:"total"`
}

ResourcesStoragePoolSpace represents the space available to a given storage pool

API extension: resources

type ResourcesSystem

type ResourcesSystem struct {
	// System UUID
	// Example: 7fa1c0cc-2271-11b2-a85c-aab32a05d71a
	UUID string `json:"uuid" yaml:"uuid"`

	// System vendor
	// Example: LENOVO
	Vendor string `json:"vendor" yaml:"vendor"`

	// System model
	// Example: 20HRCTO1WW
	Product string `json:"product" yaml:"product"`

	// System family
	// Example: ThinkPad X1 Carbon 5th
	Family string `json:"family" yaml:"family"`

	// System version
	// Example: ThinkPad X1 Carbon 5th
	Version string `json:"version" yaml:"version"`

	// System nanufacturer SKU
	// LENOVO_MT_20HR_BU_Think_FM_ThinkPad X1 Carbon 5th
	Sku string `json:"sku" yaml:"sku"`

	// System serial number
	// Example: PY3DD4X9
	Serial string `json:"serial" yaml:"serial"`

	// System type (unknown, physical, virtual-machine, container, ...)
	// Example: physical
	Type string `json:"type" yaml:"type"`

	// Firmware details
	Firmware *ResourcesSystemFirmware `json:"firmware" yaml:"firmware"`

	// Chassis details
	Chassis *ResourcesSystemChassis `json:"chassis" yaml:"chassis"`

	// Motherboard details
	Motherboard *ResourcesSystemMotherboard `json:"motherboard" yaml:"motherboard"`
}

ResourcesSystem represents the system

API extension: resources_system

type ResourcesSystemChassis

type ResourcesSystemChassis struct {
	// Chassis vendor
	// Example: Lenovo
	Vendor string `json:"vendor" yaml:"vendor"`

	// Chassis type
	// Example: Notebook
	Type string `json:"type" yaml:"type"`

	// Chassis serial number
	// Example: PY3DD4X9
	Serial string `json:"serial" yaml:"serial"`

	// Chassis version/revision
	// Example: None
	Version string `json:"version" yaml:"version"`
}

ResourcesSystemChassis represents the system chassis

API extension: resources_system

type ResourcesSystemFirmware

type ResourcesSystemFirmware struct {
	// Firmware vendor
	// Example: Lenovo
	Vendor string `json:"vendor" yaml:"vendor"`

	// Firmware build date
	// Example: 10/14/2020
	Date string `json:"date" yaml:"date"`

	// Firmware version
	// Example: N1MET64W (1.49)
	Version string `json:"version" yaml:"version"`
}

ResourcesSystemFirmware represents the system firmware

API extension: resources_system

type ResourcesSystemMotherboard

type ResourcesSystemMotherboard struct {
	// Motherboard vendor
	// Example: Lenovo
	Vendor string `json:"vendor" yaml:"vendor"`

	// Motherboard model
	// Example: 20HRCTO1WW
	Product string `json:"product" yaml:"product"`

	// Motherboard serial number
	// Example: L3CF4FX003A
	Serial string `json:"serial" yaml:"serial"`

	// Motherboard version/revision
	// Example: None
	Version string `json:"version" yaml:"version"`
}

ResourcesSystemMotherboard represents the motherboard

API extension: resources_system

type ResourcesUSB

type ResourcesUSB struct {
	// List of USB devices
	Devices []ResourcesUSBDevice `json:"devices" yaml:"devices"`

	// Total number of USB devices
	// Example: 1
	Total uint64 `json:"total" yaml:"total"`
}

ResourcesUSB represents the USB devices available on the system

API extension: resources_usb_pci

type ResourcesUSBDevice

type ResourcesUSBDevice struct {
	// USB address (bus)
	// Example: 1
	BusAddress uint64 `json:"bus_address" yaml:"bus_address"`

	// USB address (device)
	// Example: 3
	DeviceAddress uint64 `json:"device_address" yaml:"device_address"`

	// List of USB interfaces
	Interfaces []ResourcesUSBDeviceInterface `json:"interfaces" yaml:"interfaces"`

	// Name of the vendor
	// Example: ATEN International Co., Ltd
	Vendor string `json:"vendor" yaml:"vendor"`

	// USB ID of the vendor
	// Example: 0557
	VendorID string `json:"vendor_id" yaml:"vendor_id"`

	// Name of the product
	// Example: Hermon USB hidmouse Device
	Product string `json:"product" yaml:"product"`

	// USB ID of the product
	// Example: 2221
	ProductID string `json:"product_id" yaml:"product_id"`

	// Transfer speed (Mbit/s)
	// Example: 12
	Speed float64 `json:"speed" yaml:"speed"`
}

ResourcesUSBDevice represents a USB device

API extension: resources_usb_pci

type ResourcesUSBDeviceInterface

type ResourcesUSBDeviceInterface struct {
	// Class of USB interface
	// Example: Human Interface Device
	Class string `json:"class" yaml:"class"`

	// ID of the USB interface class
	// Example: 3
	ClassID uint64 `json:"class_id" yaml:"class_id"`

	// Kernel driver currently associated with the device
	// Example: usbhid
	Driver string `json:"driver" yaml:"driver"`

	// Version of the kernel driver
	// Example: 5.8.0-36-generic
	DriverVersion string `json:"driver_version" yaml:"driver_version"`

	// Interface number
	// Example: 0
	Number uint64 `json:"number" yaml:"number"`

	// Sub class of the interface
	// Example: Boot Interface Subclass
	SubClass string `json:"subclass" yaml:"subclass"`

	// ID of the USB interface sub class
	// Example: 1
	SubClassID uint64 `json:"subclass_id" yaml:"subclass_id"`
}

ResourcesUSBDeviceInterface represents a USB device interface

API extension: resources_usb_pci

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

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 {
	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"`

	Metadata interface{} `json:"metadata" yaml:"metadata"`
}

ResponseRaw represents a LXD operation in its original form

type ResponseType

type ResponseType string

ResponseType represents a valid LXD response type

const (
	SyncResponse  ResponseType = "sync"
	AsyncResponse ResponseType = "async"
	ErrorResponse ResponseType = "error"
)

LXD response types

type Server

type Server struct {
	ServerPut       `yaml:",inline"`
	ServerUntrusted `yaml:",inline"`

	// Read-only status/configuration information
	// Read only: true
	Environment ServerEnvironment `json:"environment" yaml:"environment"`
}

Server represents a LXD server

swagger:model

func (*Server) Writable

func (srv *Server) Writable() ServerPut

Writable converts a full Server struct into a ServerPut struct (filters read-only fields)

type ServerEnvironment

type ServerEnvironment struct {
	// List of addresses the server is listening on
	// Example: [":8443"]
	Addresses []string `json:"addresses" yaml:"addresses"`

	// List of architectures supported by the server
	// Example: ["x86_64", "i686"]
	Architectures []string `json:"architectures" yaml:"architectures"`

	// Server certificate as PEM encoded X509
	// Example: X509 PEM certificate
	Certificate string `json:"certificate" yaml:"certificate"`

	// Server certificate fingerprint as SHA256
	// Example: fd200419b271f1dc2a5591b693cc5774b7f234e1ff8c6b78ad703b6888fe2b69
	CertificateFingerprint string `json:"certificate_fingerprint" yaml:"certificate_fingerprint"`

	// List of supported instance drivers (separate by " | ")
	// Example: lxc | qemu
	Driver string `json:"driver" yaml:"driver"`

	// List of supported instance driver versions (separate by " | ")
	// Example: 4.0.7 | 5.2.0
	DriverVersion string `json:"driver_version" yaml:"driver_version"`

	// Current firewall driver
	// Example: nftables
	//
	// API extension: firewall_driver
	Firewall string `json:"firewall" yaml:"firewall"`

	// OS kernel name
	// Example: Linux
	Kernel string `json:"kernel" yaml:"kernel"`

	// OS kernel architecture
	// Example: x86_64
	KernelArchitecture string `json:"kernel_architecture" yaml:"kernel_architecture"`

	// Map of kernel features that were tested on startup
	// Example: {"netnsid_getifaddrs": "true", "seccomp_listener": "true"}
	//
	// API extension: kernel_features
	KernelFeatures map[string]string `json:"kernel_features" yaml:"kernel_features"`

	// Kernel version
	// Example: 5.4.0-36-generic
	KernelVersion string `json:"kernel_version" yaml:"kernel_version"`

	// Map of LXC features that were tested on startup
	// Example: {"cgroup2": "true", "devpts_fd": "true", "pidfd": "true"}
	//
	// API extension: lxc_features
	LXCFeatures map[string]string `json:"lxc_features" yaml:"lxc_features"`

	// Name of the operating system (Linux distribution)
	// Example: Ubuntu
	//
	// API extension: api_os
	OSName string `json:"os_name" yaml:"os_name"`

	// Version of the operating system (Linux distribution)
	// Example: 20.04
	//
	// API extension: api_os
	OSVersion string `json:"os_version" yaml:"os_version"`

	// Current project name
	// Example: default
	//
	// API extension: projects
	Project string `json:"project" yaml:"project"`

	// Server implementation name
	// Example: lxd
	Server string `json:"server" yaml:"server"`

	// Whether the server is part of a cluster
	// Example: false
	//
	// API extension: clustering
	ServerClustered bool `json:"server_clustered" yaml:"server_clustered"`

	// Server hostname
	// Example: castiana
	//
	// API extension: clustering
	ServerName string `json:"server_name" yaml:"server_name"`

	// PID of the LXD process
	// Example: 1453969
	ServerPid int `json:"server_pid" yaml:"server_pid"`

	// Server version
	// Example: 4.11
	ServerVersion string `json:"server_version" yaml:"server_version"`

	// List of active storage drivers (separate by " | ")
	// Example: dir | zfs
	Storage string `json:"storage" yaml:"storage"`

	// List of active storage driver versions (separate by " | ")
	// Example: 1 | 0.8.4-1ubuntu11
	StorageVersion string `json:"storage_version" yaml:"storage_version"`
}

ServerEnvironment represents the read-only environment fields of a LXD server

type ServerPut

type ServerPut struct {
	// Server configuration map (refer to doc/server.md)
	// Example: {"core.https_address": ":8443", "core.trust_password": true}
	Config map[string]interface{} `json:"config" yaml:"config"`
}

ServerPut represents the modifiable fields of a LXD server configuration

swagger:model

type ServerUntrusted

type ServerUntrusted struct {
	// List of supported API extensions
	// Read only: true
	// Example: ["etag", "patch", "network", "storage"]
	APIExtensions []string `json:"api_extensions" yaml:"api_extensions"`

	// Support status of the current API (one of "devel", "stable" or "deprecated")
	// Read only: true
	// Example: stable
	APIStatus string `json:"api_status" yaml:"api_status"`

	// API version number
	// Read only: true
	// Example: 1.0
	APIVersion string `json:"api_version" yaml:"api_version"`

	// Whether the client is trusted (one of "trusted" or "untrusted")
	// Read only: true
	// Example: untrusted
	Auth string `json:"auth" yaml:"auth"`

	// Whether the server is public-only (only public endpoints are implemented)
	// Read only: true
	// Example: false
	Public bool `json:"public" yaml:"public"`

	// List of supported authentication methods
	// Read only: true
	// Example: ["tls", "candid"]
	//
	// API extension: macaroon_authentication
	AuthMethods []string `json:"auth_methods" yaml:"auth_methods"`
}

ServerUntrusted represents a LXD server for an untrusted client

swagger:model

type StatusCode

type StatusCode int

StatusCode represents a valid LXD operation and container status

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
)

LXD 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

type StoragePool

type StoragePool struct {
	StoragePoolPut `yaml:",inline"`

	Name   string   `json:"name" yaml:"name"`
	Driver string   `json:"driver" yaml:"driver"`
	UsedBy []string `json:"used_by" yaml:"used_by"`

	// API extension: clustering
	Status    string   `json:"status" yaml:"status"`
	Locations []string `json:"locations" yaml:"locations"`
}

StoragePool represents the fields of a LXD storage pool.

API extension: storage

func (*StoragePool) Writable

func (storagePool *StoragePool) Writable() StoragePoolPut

Writable converts a full StoragePool struct into a StoragePoolPut struct (filters read-only fields).

type StoragePoolPut

type StoragePoolPut struct {
	Config map[string]string `json:"config" yaml:"config"`

	// API extension: entity_description
	Description string `json:"description" yaml:"description"`
}

StoragePoolPut represents the modifiable fields of a LXD storage pool.

API extension: storage

type StoragePoolVolumeBackup

type StoragePoolVolumeBackup struct {
	Name             string    `json:"name" yaml:"name"`
	CreatedAt        time.Time `json:"created_at" yaml:"created_at"`
	ExpiresAt        time.Time `json:"expires_at" yaml:"expires_at"`
	VolumeOnly       bool      `json:"volume_only" yaml:"volume_only"`
	OptimizedStorage bool      `json:"optimized_storage" yaml:"optimized_storage"`
}

StoragePoolVolumeBackup represents a LXD volume backup.

API extension: custom_volume_backup

type StoragePoolVolumeBackupPost

type StoragePoolVolumeBackupPost struct {
	Name string `json:"name" yaml:"name"`
}

StoragePoolVolumeBackupPost represents the fields available for the renaming of a volume backup.

API extension: custom_volume_backup

type StoragePoolVolumeBackupsPost

type StoragePoolVolumeBackupsPost struct {
	Name                 string    `json:"name" yaml:"name"`
	ExpiresAt            time.Time `json:"expires_at" yaml:"expires_at"`
	VolumeOnly           bool      `json:"volume_only" yaml:"volume_only"`
	OptimizedStorage     bool      `json:"optimized_storage" yaml:"optimized_storage"`
	CompressionAlgorithm string    `json:"compression_algorithm" yaml:"compression_algorithm"`
}

StoragePoolVolumeBackupsPost represents the fields available for a new LXD volume backup.

API extension: custom_volume_backup

type StoragePoolsPost

type StoragePoolsPost struct {
	StoragePoolPut `yaml:",inline"`

	Name   string `json:"name" yaml:"name"`
	Driver string `json:"driver" yaml:"driver"`
}

StoragePoolsPost represents the fields of a new LXD storage pool

API extension: storage

type StorageVolume

type StorageVolume struct {
	StorageVolumePut `yaml:",inline"`
	Name             string   `json:"name" yaml:"name"`
	Type             string   `json:"type" yaml:"type"`
	UsedBy           []string `json:"used_by" yaml:"used_by"`

	// API extension: clustering
	Location string `json:"location" yaml:"location"`

	// API extension: custom_block_volumes
	ContentType string `json:"content_type" yaml:"content_type"`
}

StorageVolume represents the fields of a LXD storage volume.

API extension: storage

func (*StorageVolume) Writable

func (storageVolume *StorageVolume) Writable() StorageVolumePut

Writable converts a full StorageVolume struct into a StorageVolumePut struct (filters read-only fields).

type StorageVolumePost

type StorageVolumePost struct {
	Name string `json:"name" yaml:"name"`

	// API extension: storage_api_local_volume_handling
	Pool string `json:"pool,omitempty" yaml:"pool,omitempty"`

	// API extension: storage_api_remote_volume_handling
	Migration bool `json:"migration" yaml:"migration"`

	// API extension: storage_api_remote_volume_handling
	Target *StorageVolumePostTarget `json:"target" yaml:"target"`

	// API extension: storage_api_remote_volume_snapshots
	VolumeOnly bool `json:"volume_only" yaml:"volume_only"`
}

StorageVolumePost represents the fields required to rename a LXD storage pool volume

API extension: storage_api_volume_rename

type StorageVolumePostTarget

type StorageVolumePostTarget struct {
	Certificate string            `json:"certificate" yaml:"certificate"`
	Operation   string            `json:"operation,omitempty" yaml:"operation,omitempty"`
	Websockets  map[string]string `json:"secrets,omitempty" yaml:"secrets,omitempty"`
}

StorageVolumePostTarget represents the migration target host and operation

API extension: storage_api_remote_volume_handling

type StorageVolumePut

type StorageVolumePut struct {
	Config map[string]string `json:"config" yaml:"config"`

	// API extension: entity_description
	Description string `json:"description" yaml:"description"`

	// API extension: storage_api_volume_snapshots
	Restore string `json:"restore,omitempty" yaml:"restore,omitempty"`
}

StorageVolumePut represents the modifiable fields of a LXD storage volume.

API extension: storage

type StorageVolumeSnapshot

type StorageVolumeSnapshot struct {
	StorageVolumeSnapshotPut `json:",inline" yaml:",inline"`

	Name   string            `json:"name" yaml:"name"`
	Config map[string]string `json:"config" yaml:"config"`

	// API extension: custom_block_volumes
	ContentType string `json:"content_type" yaml:"content_type"`
}

StorageVolumeSnapshot represents a LXD storage volume snapshot

API extension: storage_api_volume_snapshots

type StorageVolumeSnapshotPost

type StorageVolumeSnapshotPost struct {
	Name string `json:"name" yaml:"name"`
}

StorageVolumeSnapshotPost represents the fields required to rename/move a LXD storage volume snapshot

API extension: storage_api_volume_snapshots

type StorageVolumeSnapshotPut

type StorageVolumeSnapshotPut struct {
	Description string `json:"description" yaml:"description"`

	// API extension: custom_volume_snapshot_expiry
	ExpiresAt *time.Time `json:"expires_at" yaml:"expires_at"`
}

StorageVolumeSnapshotPut represents the modifiable fields of a LXD storage volume

API extension: storage_api_volume_snapshots

type StorageVolumeSnapshotsPost

type StorageVolumeSnapshotsPost struct {
	Name string `json:"name" yaml:"name"`

	// API extension: custom_volume_snapshot_expiry
	ExpiresAt *time.Time `json:"expires_at" yaml:"expires_at"`
}

StorageVolumeSnapshotsPost represents the fields available for a new LXD storage volume snapshot

API extension: storage_api_volume_snapshots

type StorageVolumeSource

type StorageVolumeSource struct {
	Name string `json:"name" yaml:"name"`
	Type string `json:"type" yaml:"type"`
	Pool string `json:"pool" yaml:"pool"`

	// API extension: storage_api_remote_volume_handling
	Certificate string            `json:"certificate" yaml:"certificate"`
	Mode        string            `json:"mode,omitempty" yaml:"mode,omitempty"`
	Operation   string            `json:"operation,omitempty" yaml:"operation,omitempty"`
	Websockets  map[string]string `json:"secrets,omitempty" yaml:"secrets,omitempty"`

	// API extension: storage_api_volume_snapshots
	VolumeOnly bool `json:"volume_only" yaml:"volume_only"`
}

StorageVolumeSource represents the creation source for a new storage volume.

API extension: storage_api_local_volume_handling

type StorageVolumeState

type StorageVolumeState struct {
	Usage *StorageVolumeStateUsage `json:"usage" yaml:"usage"`
}

StorageVolumeState represents the live state of the volume.

API extension: storage_volume_state

type StorageVolumeStateUsage

type StorageVolumeStateUsage struct {
	Used uint64 `json:"used,omitempty" yaml:"used,omitempty"`
}

StorageVolumeStateUsage represents the disk usage of a volume.

API extension: storage_volume_state

type StorageVolumesPost

type StorageVolumesPost struct {
	StorageVolumePut `yaml:",inline"`

	Name string `json:"name" yaml:"name"`
	Type string `json:"type" yaml:"type"`

	// API extension: storage_api_local_volume_handling
	Source StorageVolumeSource `json:"source" yaml:"source"`

	// API extension: custom_block_volumes
	ContentType string `json:"content_type" yaml:"content_type"`
}

StorageVolumesPost represents the fields of a new LXD storage pool volume

API extension: storage

Jump to

Keyboard shortcuts

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