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 ¶
- type Certificate
- type CertificatePut
- type CertificatesPost
- type Cluster
- type ClusterMember
- type ClusterMemberConfigKey
- type ClusterMemberPost
- type ClusterPut
- type Container
- type ContainerBackup
- type ContainerBackupPost
- type ContainerBackupsPost
- type ContainerConsoleControl
- type ContainerConsolePost
- type ContainerExecControl
- type ContainerExecPost
- type ContainerFull
- type ContainerPost
- type ContainerPostTarget
- type ContainerPut
- type ContainerSnapshot
- type ContainerSnapshotPost
- type ContainerSnapshotPut
- type ContainerSnapshotsPost
- type ContainerSource
- type ContainerState
- type ContainerStateCPU
- type ContainerStateDisk
- type ContainerStateMemory
- type ContainerStateNetwork
- type ContainerStateNetworkAddress
- type ContainerStateNetworkCounters
- type ContainerStatePut
- type ContainersPost
- type Event
- type EventLifecycle
- type EventLogging
- type Image
- type ImageAlias
- type ImageAliasesEntry
- type ImageAliasesEntryPost
- type ImageAliasesEntryPut
- type ImageAliasesPost
- type ImageMetadata
- type ImageMetadataTemplate
- type ImagePut
- type ImageSource
- type ImagesPost
- type ImagesPostSource
- type Network
- type NetworkLease
- type NetworkPost
- type NetworkPut
- type NetworkState
- type NetworkStateAddress
- type NetworkStateCounters
- type NetworksPost
- type Operation
- type Profile
- type ProfilePost
- type ProfilePut
- type ProfilesPost
- type Project
- type ProjectPost
- type ProjectPut
- type ProjectsPost
- type Resources
- type ResourcesCPU
- type ResourcesCPUSocket
- type ResourcesGPU
- type ResourcesGPUCard
- type ResourcesGPUCardNvidia
- type ResourcesMemory
- type ResourcesStoragePool
- type ResourcesStoragePoolInodes
- type ResourcesStoragePoolSpace
- type Response
- type ResponseRaw
- type ResponseType
- type Server
- type ServerEnvironment
- type ServerPut
- type ServerUntrusted
- type StatusCode
- type StoragePool
- type StoragePoolPut
- type StoragePoolsPost
- type StorageVolume
- type StorageVolumePost
- type StorageVolumePostTarget
- type StorageVolumePut
- type StorageVolumeSnapshot
- type StorageVolumeSnapshotPost
- type StorageVolumeSnapshotPut
- type StorageVolumeSnapshotsPost
- type StorageVolumeSource
- type StorageVolumesPost
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Certificate ¶
type Certificate struct { CertificatePut `yaml:",inline"` Certificate string `json:"certificate" yaml:"certificate"` Fingerprint string `json:"fingerprint" yaml:"fingerprint"` }
Certificate represents a LXD certificate
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 string `json:"name" yaml:"name"` Type string `json:"type" yaml:"type"` }
CertificatePut represents the modifiable fields of a LXD certificate
API extension: certificate_update
type CertificatesPost ¶
type CertificatesPost struct { CertificatePut `yaml:",inline"` Certificate string `json:"certificate" yaml:"certificate"` Password string `json:"password" yaml:"password"` }
CertificatesPost represents the fields of a new LXD certificate
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 { 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
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 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 ¶
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"` CreationDate time.Time `json:"creation_date" yaml:"creation_date"` ExpiryDate time.Time `json:"expiry_date" yaml:"expiry_date"` 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"` ExpiryDate time.Time `json:"expiry" yaml:"expiry"` 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"` }
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 ¶
func (c *ContainerSnapshot) Writable() ContainerSnapshotPut
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" json:"location"` }
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"` CreatedAt time.Time `json:"created_at" yaml:"created_at"` ExpiresAt time.Time `json:"expires_at" yaml:"expires_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
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"` }
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 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"` }
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"` }
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 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 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"` }
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 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 NetworksPost ¶
type NetworksPost struct { NetworkPut `yaml:",inline"` Managed bool `json:"managed" yaml:"managed"` 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 ResourcesCPU `json:"cpu,omitempty" yaml:"cpu,omitempty"` Memory ResourcesMemory `json:"memory,omitempty" yaml:"memory,omitempty"` // API extension: resources_gpu GPU ResourcesGPU `json:"gpu,omitempty" yaml:"gpu,omitempty"` }
Resources represents the system resources avaible for LXD API extension: resources
type ResourcesCPU ¶
type ResourcesCPU struct { Sockets []ResourcesCPUSocket `json:"sockets" yaml:"sockets"` Total uint64 `json:"total" yaml:"total"` }
ResourcesCPU represents the cpu resources available on the system API extension: resources
type ResourcesCPUSocket ¶
type ResourcesCPUSocket struct { Cores uint64 `json:"cores" yaml:"cores"` Frequency uint64 `json:"frequency,omitempty" yaml:"frequency,omitempty"` FrequencyTurbo uint64 `json:"frequency_turbo,omitempty" yaml:"frequency_turbo,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` Vendor string `json:"vendor,omitempty" yaml:"vendor,omitempty"` Threads uint64 `json:"threads" yaml:"threads"` // API extension: resources_cpu_socket Socket uint64 `json:"socket" yaml:"socket"` // API extension: resources_numa NUMANode uint64 `json:"numa_node" yaml:"numa_node"` }
ResourcesCPUSocket represents a cpu socket on the system API extension: resources
type ResourcesGPU ¶
type ResourcesGPU struct { Cards []ResourcesGPUCard `json:"cards" yaml:"cards"` Total uint64 `json:"total" yaml:"total"` }
ResourcesGPU represents the GPU resources available on the system API extension: resources_gpu
type ResourcesGPUCard ¶
type ResourcesGPUCard struct { Driver string `json:"driver" yaml:"driver"` DriverVersion string `json:"driver_version" yaml:"driver_version"` ID uint64 `json:"id" yaml:"id"` Nvidia *ResourcesGPUCardNvidia `json:"nvidia,omitempty" yaml:"nvidia,omitempty"` PCIAddress string `json:"pci_address" yaml:"pci_address"` Vendor string `json:"vendor,omitempty" yaml:"vendor,omitempty"` VendorID string `json:"vendor_id,omitempty" yaml:"vendor_id,omitempty"` Product string `json:"product,omitempty" yaml:"product,omitempty"` ProductID string `json:"product_id,omitempty" yaml:"product_id,omitempty"` // API extension: resources_numa NUMANode uint64 `json:"numa_node" yaml:"numa_node"` }
ResourcesGPUCard represents a GPU card on the system API extension: resources_gpu
type ResourcesGPUCardNvidia ¶
type ResourcesGPUCardNvidia struct { CUDAVersion string `json:"cuda_version" yaml:"cuda_version"` NVRMVersion string `json:"nvrm_version" yaml:"nvrm_version"` Brand string `json:"brand" yaml:"brand"` Model string `json:"model" yaml:"model"` UUID string `json:"uuid" yaml:"uuid"` Architecture string `json:"architecture" yaml:"architecture"` }
ResourcesGPUCardNvidia represents additional information for NVIDIA GPUs API extension: resources_gpu
type ResourcesMemory ¶
type ResourcesMemory struct { Used uint64 `json:"used" yaml:"used"` Total uint64 `json:"total" yaml:"total"` }
ResourcesMemory represents the memory resources available on the system API extension: resources
type ResourcesStoragePool ¶
type ResourcesStoragePool struct { Space ResourcesStoragePoolSpace `json:"space,omitempty" yaml:"space,omitempty"` 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 uint64 `json:"used" yaml:"used"` 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 uint64 `json:"used,omitempty" yaml:"used,omitempty"` Total uint64 `json:"total" yaml:"total"` }
ResourcesStoragePoolSpace represents the space available to a given storage pool API extension: resources
type Response ¶
type Response struct { Type ResponseType `json:"type" yaml:"type"` // Valid only for Sync responses Status string `json:"status" yaml:"status"` StatusCode int `json:"status_code" yaml:"status_code"` // Valid only for Async responses Operation string `json:"operation" yaml:"operation"` // Valid only for Error responses Code int `json:"error_code" yaml:"error_code"` Error string `json:"error" yaml:"error"` // Valid for Sync and Error responses Metadata json.RawMessage `json:"metadata" yaml:"metadata"` }
Response represents a LXD operation
func (*Response) MetadataAsMap ¶
MetadataAsMap parses the Response metadata into a map
func (*Response) MetadataAsOperation ¶
MetadataAsOperation turns the Response metadata into an Operation
func (*Response) MetadataAsStringSlice ¶
MetadataAsStringSlice parses the Response metadata into a slice of string
func (*Response) MetadataAsStruct ¶
MetadataAsStruct parses the Response metadata into a provided struct
type ResponseRaw ¶
type ResponseRaw struct { 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"` Environment ServerEnvironment `json:"environment" yaml:"environment"` }
Server represents a LXD server
type ServerEnvironment ¶
type ServerEnvironment struct { Addresses []string `json:"addresses" yaml:"addresses"` Architectures []string `json:"architectures" yaml:"architectures"` Certificate string `json:"certificate" yaml:"certificate"` CertificateFingerprint string `json:"certificate_fingerprint" yaml:"certificate_fingerprint"` Driver string `json:"driver" yaml:"driver"` DriverVersion string `json:"driver_version" yaml:"driver_version"` Kernel string `json:"kernel" yaml:"kernel"` KernelArchitecture string `json:"kernel_architecture" yaml:"kernel_architecture"` // API extension: kernel_features KernelFeatures map[string]string `json:"kernel_features" yaml:"kernel_features"` KernelVersion string `json:"kernel_version" yaml:"kernel_version"` // API extension: lxc_features LXCFeatures map[string]string `json:"lxc_features" yaml:"lxc_features"` // API extension: projects Project string `json:"project" yaml:"project"` Server string `json:"server" yaml:"server"` // API extension: clustering ServerClustered bool `json:"server_clustered" yaml:"server_clustered"` ServerName string `json:"server_name" yaml:"server_name"` ServerPid int `json:"server_pid" yaml:"server_pid"` ServerVersion string `json:"server_version" yaml:"server_version"` Storage string `json:"storage" yaml:"storage"` StorageVersion string `json:"storage_version" yaml:"storage_version"` }
ServerEnvironment represents the read-only environment fields of a LXD server
type ServerPut ¶
type ServerPut struct {
Config map[string]interface{} `json:"config" yaml:"config"`
}
ServerPut represents the modifiable fields of a LXD server configuration
type ServerUntrusted ¶
type ServerUntrusted struct { APIExtensions []string `json:"api_extensions" yaml:"api_extensions"` APIStatus string `json:"api_status" yaml:"api_status"` APIVersion string `json:"api_version" yaml:"api_version"` Auth string `json:"auth" yaml:"auth"` Public bool `json:"public" yaml:"public"` // API extension: macaroon_authentication AuthMethods []string `json:"auth_methods" yaml:"auth_methods"` }
ServerUntrusted represents a LXD server for an untrusted client
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 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"` }
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 { Name string `json:"name" yaml:"name"` Config map[string]string `json:"config" yaml:"config"` Description string `json:"description" yaml:"description"` }
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"`
}
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"`
}
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 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"` }
StorageVolumesPost represents the fields of a new LXD storage pool volume
API extension: storage
Source Files
¶
- certificate.go
- cluster.go
- container.go
- container_backup.go
- container_console.go
- container_exec.go
- container_snapshot.go
- container_state.go
- doc.go
- event.go
- image.go
- network.go
- operation.go
- profile.go
- project.go
- resource.go
- response.go
- server.go
- status_code.go
- storage_pool.go
- storage_pool_volume.go
- storage_pool_volume_snapshot.go