api

package
v0.0.0-...-3c2809b Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: AGPL-3.0, Apache-2.0 Imports: 9 Imported by: 95

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

Examples

Constants

View Source
const (
	// AuthenticationMethodTLS is the default authentication method for interacting with LXD remotely.
	AuthenticationMethodTLS = "tls"

	// AuthenticationMethodOIDC is a token based authentication method.
	AuthenticationMethodOIDC = "oidc"
)
View Source
const (
	// IdentityTypeCertificateClientRestricted represents identities that authenticate using TLS and are not privileged.
	IdentityTypeCertificateClientRestricted = "Client certificate (restricted)"

	// IdentityTypeCertificateClientUnrestricted represents identities that authenticate using TLS and are privileged.
	IdentityTypeCertificateClientUnrestricted = "Client certificate (unrestricted)"

	// IdentityTypeCertificateClient represents identities that authenticate using TLS and whose permissions are managed via group membership.
	IdentityTypeCertificateClient = "Client certificate"

	// IdentityTypeCertificateClientPending represents identities for which a token has been issued but who have not yet authenticated with LXD.
	IdentityTypeCertificateClientPending = "Client certificate (pending)"

	// IdentityTypeCertificateServer represents cluster member authentication.
	IdentityTypeCertificateServer = "Server certificate"

	// IdentityTypeCertificateMetricsRestricted represents identities that may only view metrics and are not privileged.
	IdentityTypeCertificateMetricsRestricted = "Metrics certificate (restricted)"

	// IdentityTypeCertificateMetricsUnrestricted represents identities that may only view metrics and are privileged.
	IdentityTypeCertificateMetricsUnrestricted = "Metrics certificate (unrestricted)"

	// IdentityTypeOIDCClient represents an identity that authenticates with OIDC.
	IdentityTypeOIDCClient = "OIDC client"
)
View Source
const (
	EventTypeLifecycle = "lifecycle"
	EventTypeLogging   = "logging"
	EventTypeOperation = "operation"
	EventTypeOVN       = "ovn"
)

LXD event types.

View Source
const (
	EventLifecycleCertificateCreated                = "certificate-created"
	EventLifecycleCertificateDeleted                = "certificate-deleted"
	EventLifecycleCertificateUpdated                = "certificate-updated"
	EventLifecycleClusterCertificateUpdated         = "cluster-certificate-updated"
	EventLifecycleClusterDisabled                   = "cluster-disabled"
	EventLifecycleClusterEnabled                    = "cluster-enabled"
	EventLifecycleClusterGroupCreated               = "cluster-group-created"
	EventLifecycleClusterGroupDeleted               = "cluster-group-deleted"
	EventLifecycleClusterGroupRenamed               = "cluster-group-renamed"
	EventLifecycleClusterGroupUpdated               = "cluster-group-updated"
	EventLifecycleClusterMemberAdded                = "cluster-member-added"
	EventLifecycleClusterMemberRemoved              = "cluster-member-removed"
	EventLifecycleClusterMemberRenamed              = "cluster-member-renamed"
	EventLifecycleClusterMemberUpdated              = "cluster-member-updated"
	EventLifecycleClusterTokenCreated               = "cluster-token-created"
	EventLifecycleConfigUpdated                     = "config-updated"
	EventLifecycleImageAliasCreated                 = "image-alias-created"
	EventLifecycleImageAliasDeleted                 = "image-alias-deleted"
	EventLifecycleImageAliasRenamed                 = "image-alias-renamed"
	EventLifecycleImageAliasUpdated                 = "image-alias-updated"
	EventLifecycleImageCreated                      = "image-created"
	EventLifecycleImageDeleted                      = "image-deleted"
	EventLifecycleImageRefreshed                    = "image-refreshed"
	EventLifecycleImageRetrieved                    = "image-retrieved"
	EventLifecycleImageSecretCreated                = "image-secret-created"
	EventLifecycleImageUpdated                      = "image-updated"
	EventLifecycleInstanceBackupCreated             = "instance-backup-created"
	EventLifecycleInstanceBackupDeleted             = "instance-backup-deleted"
	EventLifecycleInstanceBackupRenamed             = "instance-backup-renamed"
	EventLifecycleInstanceBackupRetrieved           = "instance-backup-retrieved"
	EventLifecycleInstanceConsole                   = "instance-console"
	EventLifecycleInstanceConsoleReset              = "instance-console-reset"
	EventLifecycleInstanceConsoleRetrieved          = "instance-console-retrieved"
	EventLifecycleInstanceCreated                   = "instance-created"
	EventLifecycleInstanceDeleted                   = "instance-deleted"
	EventLifecycleInstanceExec                      = "instance-exec"
	EventLifecycleInstanceFileDeleted               = "instance-file-deleted"
	EventLifecycleInstanceFilePushed                = "instance-file-pushed"
	EventLifecycleInstanceFileRetrieved             = "instance-file-retrieved"
	EventLifecycleInstanceLogDeleted                = "instance-log-deleted"
	EventLifecycleInstanceLogRetrieved              = "instance-log-retrieved"
	EventLifecycleInstanceMetadataRetrieved         = "instance-metadata-retrieved"
	EventLifecycleInstanceMetadataTemplateCreated   = "instance-metadata-template-created"
	EventLifecycleInstanceMetadataTemplateDeleted   = "instance-metadata-template-deleted"
	EventLifecycleInstanceMetadataTemplateRetrieved = "instance-metadata-template-retrieved"
	EventLifecycleInstanceMetadataUpdated           = "instance-metadata-updated"
	EventLifecycleInstancePaused                    = "instance-paused"
	EventLifecycleInstanceReady                     = "instance-ready"
	EventLifecycleInstanceRenamed                   = "instance-renamed"
	EventLifecycleInstanceRestarted                 = "instance-restarted"
	EventLifecycleInstanceRestored                  = "instance-restored"
	EventLifecycleInstanceResumed                   = "instance-resumed"
	EventLifecycleInstanceShutdown                  = "instance-shutdown"
	EventLifecycleInstanceSnapshotCreated           = "instance-snapshot-created"
	EventLifecycleInstanceSnapshotDeleted           = "instance-snapshot-deleted"
	EventLifecycleInstanceSnapshotRenamed           = "instance-snapshot-renamed"
	EventLifecycleInstanceSnapshotUpdated           = "instance-snapshot-updated"
	EventLifecycleInstanceStarted                   = "instance-started"
	EventLifecycleInstanceStopped                   = "instance-stopped"
	EventLifecycleInstanceUpdated                   = "instance-updated"
	EventLifecycleNetworkACLCreated                 = "network-acl-created"
	EventLifecycleNetworkACLDeleted                 = "network-acl-deleted"
	EventLifecycleNetworkACLRenamed                 = "network-acl-renamed"
	EventLifecycleNetworkACLUpdated                 = "network-acl-updated"
	EventLifecycleNetworkCreated                    = "network-created"
	EventLifecycleNetworkDeleted                    = "network-deleted"
	EventLifecycleNetworkForwardCreated             = "network-forward-created"
	EventLifecycleNetworkForwardDeleted             = "network-forward-deleted"
	EventLifecycleNetworkForwardUpdated             = "network-forward-updated"
	EventLifecycleNetworkLoadBalancerCreated        = "network-load-balancer-created"
	EventLifecycleNetworkLoadBalancerDeleted        = "network-load-balancer-deleted"
	EventLifecycleNetworkLoadBalancerUpdated        = "network-load-balancer-updated"
	EventLifecycleNetworkPeerCreated                = "network-peer-created"
	EventLifecycleNetworkPeerDeleted                = "network-peer-deleted"
	EventLifecycleNetworkPeerUpdated                = "network-peer-updated"
	EventLifecycleNetworkRenamed                    = "network-renamed"
	EventLifecycleNetworkUpdated                    = "network-updated"
	EventLifecycleNetworkZoneCreated                = "network-zone-created"
	EventLifecycleNetworkZoneDeleted                = "network-zone-deleted"
	EventLifecycleNetworkZoneRecordCreated          = "network-zone-record-created"
	EventLifecycleNetworkZoneRecordDeleted          = "network-zone-record-deleted"
	EventLifecycleNetworkZoneRecordUpdated          = "network-zone-record-updated"
	EventLifecycleNetworkZoneUpdated                = "network-zone-updated"
	EventLifecycleOperationCancelled                = "operation-cancelled"
	EventLifecycleProfileCreated                    = "profile-created"
	EventLifecycleProfileDeleted                    = "profile-deleted"
	EventLifecycleProfileRenamed                    = "profile-renamed"
	EventLifecycleProfileUpdated                    = "profile-updated"
	EventLifecycleProjectCreated                    = "project-created"
	EventLifecycleProjectDeleted                    = "project-deleted"
	EventLifecycleProjectRenamed                    = "project-renamed"
	EventLifecycleProjectUpdated                    = "project-updated"
	EventLifecycleStoragePoolCreated                = "storage-pool-created"
	EventLifecycleStoragePoolDeleted                = "storage-pool-deleted"
	EventLifecycleStoragePoolUpdated                = "storage-pool-updated"
	EventLifecycleStorageBucketCreated              = "storage-bucket-created"
	EventLifecycleStorageBucketUpdated              = "storage-bucket-updated"
	EventLifecycleStorageBucketDeleted              = "storage-bucket-deleted"
	EventLifecycleStorageBucketKeyCreated           = "storage-bucket-key-created"
	EventLifecycleStorageBucketKeyUpdated           = "storage-bucket-key-updated"
	EventLifecycleStorageBucketKeyDeleted           = "storage-bucket-key-deleted"
	EventLifecycleStorageVolumeCreated              = "storage-volume-created"
	EventLifecycleStorageVolumeBackupCreated        = "storage-volume-backup-created"
	EventLifecycleStorageVolumeBackupDeleted        = "storage-volume-backup-deleted"
	EventLifecycleStorageVolumeBackupRenamed        = "storage-volume-backup-renamed"
	EventLifecycleStorageVolumeBackupRetrieved      = "storage-volume-backup-retrieved"
	EventLifecycleStorageVolumeDeleted              = "storage-volume-deleted"
	EventLifecycleStorageVolumeRenamed              = "storage-volume-renamed"
	EventLifecycleStorageVolumeRestored             = "storage-volume-restored"
	EventLifecycleStorageVolumeSnapshotCreated      = "storage-volume-snapshot-created"
	EventLifecycleStorageVolumeSnapshotDeleted      = "storage-volume-snapshot-deleted"
	EventLifecycleStorageVolumeSnapshotRenamed      = "storage-volume-snapshot-renamed"
	EventLifecycleStorageVolumeSnapshotUpdated      = "storage-volume-snapshot-updated"
	EventLifecycleStorageVolumeUpdated              = "storage-volume-updated"
	EventLifecycleWarningAcknowledged               = "warning-acknowledged"
	EventLifecycleWarningDeleted                    = "warning-deleted"
	EventLifecycleWarningReset                      = "warning-reset"
	EventLifecycleIdentityCreated                   = "identity-created"
	EventLifecycleIdentityUpdated                   = "identity-updated"
	EventLifecycleIdentityDeleted                   = "identity-deleted"
	EventLifecycleAuthGroupCreated                  = "auth-group-created"
	EventLifecycleAuthGroupUpdated                  = "auth-group-updated"
	EventLifecycleAuthGroupRenamed                  = "auth-group-renamed"
	EventLifecycleAuthGroupDeleted                  = "auth-group-deleted"
	EventLifecycleIdentityProviderGroupCreated      = "identity-provider-group-created"
	EventLifecycleIdentityProviderGroupUpdated      = "identity-provider-group-updated"
	EventLifecycleIdentityProviderGroupRenamed      = "identity-provider-group-renamed"
	EventLifecycleIdentityProviderGroupDeleted      = "identity-provider-group-deleted"
)

Define consts for all the lifecycle events.

View Source
const CertificateTypeClient = "client"

CertificateTypeClient indicates a client certificate type.

View Source
const CertificateTypeMetrics = "metrics"

CertificateTypeMetrics indicates a metrics certificate type.

View Source
const CertificateTypeServer = "server"

CertificateTypeServer indicates a server certificate type.

View Source
const CertificateTypeUnknown = "unknown"

CertificateTypeUnknown indicates an unknown certificate type.

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 NetworkStatusUnavailable = "Unavailable"

NetworkStatusUnavailable network failed to initialize.

View Source
const NetworkStatusUnknown = "Unknown"

NetworkStatusUnknown network is in unknown status.

View Source
const OperationClassTask = "task"

OperationClassTask represents the Task OperationClass.

View Source
const OperationClassToken = "token"

OperationClassToken represents the Token OperationClass.

View Source
const OperationClassWebsocket = "websocket"

OperationClassWebsocket represents the Websocket OperationClass.

View Source
const ProjectDefaultName = "default"

ProjectDefaultName is the name of the default project that can never be deleted.

View Source
const SecretNameControl = "control"

SecretNameControl is the secret name used for the migration control connection.

View Source
const SecretNameFilesystem = "fs"

SecretNameFilesystem is the secret name used for the migration filesystem connection.

View Source
const SecretNameState = "criu" // Legacy value used for backward compatibility for clients.

SecretNameState is the secret name used for the migration state connection.

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.

View Source
const StoragePoolStatusUnvailable = "Unavailable"

StoragePoolStatusUnvailable storage pool failed to initialize.

Variables

View Source
var StatusCodeNames = map[StatusCode]string{
	OperationCreated: "Operation created",
	Started:          "Started",
	Stopped:          "Stopped",
	Running:          "Running",
	Cancelling:       "Cancelling",
	Pending:          "Pending",
	Success:          "Success",
	Failure:          "Failure",
	Cancelled:        "Cancelled",
	Starting:         "Starting",
	Stopping:         "Stopping",
	Aborting:         "Aborting",
	Freezing:         "Freezing",
	Frozen:           "Frozen",
	Thawed:           "Thawed",
	Error:            "Error",
	Ready:            "Ready",
}

StatusCodeNames associates a status code to its name.

Functions

func GetAllStatusCodeStrings

func GetAllStatusCodeStrings() []string

GetAllStatusCodeStrings returns a slice of all status code strings.

func GetParentAndSnapshotName

func GetParentAndSnapshotName(name string) (parentName string, snapshotName string, isSnapshot bool)

GetParentAndSnapshotName returns the parent name, snapshot name, and whether it actually was a snapshot name.

func StatusErrorCheck

func StatusErrorCheck(err error, matchStatusCodes ...int) bool

StatusErrorCheck returns whether or not err was caused by a StatusError and if it matches one of the optional status codes.

func StatusErrorMatch

func StatusErrorMatch(err error, matchStatusCodes ...int) (int, bool)

StatusErrorMatch checks if err was caused by StatusError. Can optionally also check whether the StatusError's status code matches one of the supplied status codes in matchStatus. Returns the matched StatusError status code and true if match criteria are met, otherwise false.

Types

type AuthGroup

type AuthGroup struct {
	// Name is the name of the group.
	// Example: default-c1-viewers
	Name string `json:"name" yaml:"name"`

	// Description is a short description of the group.
	// Example: Viewers of instance c1 in the default project.
	Description string `json:"description" yaml:"description"`

	// Permissions are a list of permissions.
	Permissions []Permission `json:"permissions" yaml:"permissions"`

	// Identities is a map of authentication method to slice of identity identifiers.
	Identities map[string][]string `json:"identities" yaml:"identities"`

	// IdentityProviderGroups are a list of groups from the IdP whose mapping
	// includes this group.
	// Example: ["sales", "operations"]
	IdentityProviderGroups []string `json:"identity_provider_groups" yaml:"identity_provider_groups"`
}

AuthGroup is the type for a LXD group.

swagger:model

API extension: access_management.

func (*AuthGroup) SetWritable

func (g *AuthGroup) SetWritable(put AuthGroupPut)

SetWritable sets applicable values from AuthGroupPut struct to AuthGroup struct.

func (AuthGroup) Writable

func (g AuthGroup) Writable() AuthGroupPut

Writable converts a AuthGroup struct into a AuthGroupPut struct (filters read-only fields).

type AuthGroupPost

type AuthGroupPost struct {
	// Name is the name of the group.
	// Example: default-c1-viewers
	Name string `json:"name" yaml:"name"`
}

AuthGroupPost is used for renaming a group.

swagger:model

API extension: access_management.

type AuthGroupPut

type AuthGroupPut struct {
	// Description is a short description of the group.
	// Example: Viewers of instance c1 in the default project.
	Description string `json:"description" yaml:"description"`

	// Permissions are a list of permissions.
	Permissions []Permission `json:"permissions" yaml:"permissions"`
}

AuthGroupPut contains the editable fields of a group.

swagger:model

API extension: access_management.

type AuthGroupsPost

type AuthGroupsPost struct {
	AuthGroupPost `yaml:",inline"`
	AuthGroupPut  `yaml:",inline"`
}

AuthGroupsPost is used for creating a new group.

swagger:model

API extension: access_management.

type Certificate

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

	// Usage type for the certificate
	// 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"`

	// The certificate itself, as PEM encoded X509 certificate
	// Example: X509 PEM certificate
	//
	// API extension: certificate_self_renewal
	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) SetWritable

func (c *Certificate) SetWritable(put CertificatePut)

SetWritable sets applicable values from CertificatePut struct to Certificate struct.

func (*Certificate) URL

func (c *Certificate) URL(apiVersion string) *URL

URL returns the URL for the certificate.

func (*Certificate) Writable

func (c *Certificate) Writable() CertificatePut

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

type CertificateAddToken

type CertificateAddToken struct {
	// The name of the new client
	// Example: user@host
	ClientName string `json:"client_name" yaml:"client_name"`

	// The fingerprint of the network certificate
	// Example: 57bb0ff4340b5bb28517e062023101adf788c37846dc8b619eb2c3cb4ef29436
	Fingerprint string `json:"fingerprint" yaml:"fingerprint"`

	// The addresses of the server
	// Example: ["10.98.30.229:8443"]
	Addresses []string `json:"addresses" yaml:"addresses"`

	// The random join secret
	// Example: 2b2284d44db32675923fe0d2020477e0e9be11801ff70c435e032b97028c35cd
	Secret string `json:"secret" yaml:"secret"`

	// The token's expiry date.
	// Example: 2021-03-23T17:38:37.753398689-04:00
	ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"`

	// Type is an indicator for which API (certificates or identities) to send the token.
	// Example: Client certificate
	//
	// API extension: access_management_tls
	Type string `json:"type" yaml:"type"`
}

CertificateAddToken represents the fields contained within an encoded certificate add token.

swagger:model

API extension: certificate_token.

func (*CertificateAddToken) String

func (t *CertificateAddToken) String() string

String encodes the certificate add token as JSON and then base64.

type CertificatePut

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

	// Usage type for the certificate
	// 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"`

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

CertificatePut represents the modifiable fields of a LXD certificate

swagger:model

API extension: certificate_update.

type CertificatesPost

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

	// Usage type for the certificate
	// 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"`

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

	// Server trust password (used to add an untrusted client, deprecated, use trust_token)
	// Example: blah
	Password string `json:"password" yaml:"password"` // Deprecated, use TrustToken.

	// Trust token (used to add an untrusted client)
	// Example: blah
	//
	// API extension: explicit_trust_token
	TrustToken string `json:"trust_token" yaml:"trust_token"`

	// Whether to create a certificate add token
	// Example: true
	//
	// API extension: certificate_token
	Token bool `json:"token" yaml:"token"`
}

CertificatesPost represents the fields of a new LXD certificate

swagger:model

type Cluster

type Cluster struct {
	// Name of the cluster member answering the request
	// Example: lxd01
	ServerName string `json:"server_name" yaml:"server_name"`

	// Whether clustering is enabled
	// Example: true
	Enabled bool `json:"enabled" yaml:"enabled"`

	// List of member configuration keys (used during join)
	// Example: []
	//
	// API extension: clustering_join
	MemberConfig []ClusterMemberConfigKey `json:"member_config" yaml:"member_config"`
}

Cluster represents high-level information about a LXD cluster.

swagger:model

API extension: clustering.

type ClusterCertificatePut

type ClusterCertificatePut struct {
	// The new certificate (X509 PEM encoded) for the cluster
	// Example: X509 PEM certificate
	ClusterCertificate string `json:"cluster_certificate" yaml:"cluster_certificate"`

	// The new certificate key (X509 PEM encoded) for the cluster
	// Example: X509 PEM certificate key
	ClusterCertificateKey string `json:"cluster_certificate_key" yaml:"cluster_certificate_key"`
}

ClusterCertificatePut represents the certificate and key pair for all members in a LXD Cluster

swagger:model

API extension: clustering_update_certs.

type ClusterGroup

type ClusterGroup struct {
	// The new name of the cluster group
	// Example: group1
	Name string `json:"name" yaml:"name"`

	// The description of the cluster group
	// Example: amd64 servers
	Description string `json:"description" yaml:"description"`

	// List of members in this group
	// Example: ["node1", "node3"]
	Members []string `json:"members" yaml:"members"`
}

ClusterGroup represents a cluster group.

swagger:model

API extension: clustering_groups.

func (*ClusterGroup) SetWritable

func (c *ClusterGroup) SetWritable(put ClusterGroupPut)

SetWritable sets applicable values from ClusterGroupPut struct to ClusterGroup struct.

func (*ClusterGroup) Writable

func (c *ClusterGroup) Writable() ClusterGroupPut

Writable converts a full ClusterGroup struct into a ClusterGroupPut struct (filters read-only fields).

type ClusterGroupPost

type ClusterGroupPost struct {
	// The new name of the cluster group
	// Example: group1
	Name string `json:"name" yaml:"name"`
}

ClusterGroupPost represents the fields required to rename a cluster group.

swagger:model

API extension: clustering_groups.

type ClusterGroupPut

type ClusterGroupPut struct {
	// The description of the cluster group
	// Example: amd64 servers
	Description string `json:"description" yaml:"description"`

	// List of members in this group
	// Example: ["node1", "node3"]
	Members []string `json:"members" yaml:"members"`
}

ClusterGroupPut represents the modifiable fields of a cluster group.

swagger:model

API extension: clustering_groups.

type ClusterGroupsPost

type ClusterGroupsPost struct {
	ClusterGroupPut

	// The new name of the cluster group
	// Example: group1
	Name string `json:"name" yaml:"name"`
}

ClusterGroupsPost represents the fields available for a new cluster group.

swagger:model

API extension: clustering_groups.

type ClusterMember

type ClusterMember struct {
	// Name of the cluster member
	// Example: lxd01
	ServerName string `json:"server_name" yaml:"server_name"`

	// URL at which the cluster member can be reached
	// Example: https://10.0.0.1:8443
	URL string `json:"url" yaml:"url"`

	// Whether the cluster member is a database server
	// Example: true
	Database bool `json:"database" yaml:"database"`

	// Current status
	// Example: Online
	Status string `json:"status" yaml:"status"`

	// Additional status information
	// Example: fully operational
	Message string `json:"message" yaml:"message"`

	// The primary architecture of the cluster member
	// Example: x86_64
	//
	// API extension: clustering_architecture
	Architecture string `json:"architecture" yaml:"architecture"`

	// List of roles held by this cluster member
	// Example: ["database"]
	//
	// API extension: clustering_roles
	Roles []string `json:"roles" yaml:"roles"`

	// Name of the failure domain for this cluster member
	// Example: rack1
	//
	// API extension: clustering_failure_domains
	FailureDomain string `json:"failure_domain" yaml:"failure_domain"`

	// Cluster member description
	// Example: AMD Epyc 32c/64t
	//
	// API extension: clustering_description
	Description string `json:"description" yaml:"description"`

	// Additional configuration information
	// Example: {"scheduler.instance": "all"}
	//
	// API extension: clustering_config
	Config map[string]string `json:"config" yaml:"config"`

	// List of cluster groups this member belongs to
	// Example: ["group1", "group2"]
	//
	// API extension: clustering_groups
	Groups []string `json:"groups" yaml:"groups"`
}

ClusterMember represents the a LXD node in the cluster.

swagger:model

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 {
	// The kind of configuration key (network, storage-pool, ...)
	// Example: storage-pool
	Entity string `json:"entity" yaml:"entity"`

	// The name of the object requiring this key
	// Example: local
	Name string `json:"name" yaml:"name"`

	// The name of the key
	// Example: source
	Key string `json:"key" yaml:"key"`

	// The value on the answering cluster member
	// Example: /dev/sdb
	Value string `json:"value" yaml:"value"`

	// A human friendly description key
	// Example: "source" property for storage pool "local"
	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.

swagger:model

API extension: clustering_join.

type ClusterMemberJoinToken

type ClusterMemberJoinToken struct {
	// The name of the new cluster member
	// Example: lxd02
	ServerName string `json:"server_name" yaml:"server_name"`

	// The fingerprint of the network certificate
	// Example: 57bb0ff4340b5bb28517e062023101adf788c37846dc8b619eb2c3cb4ef29436
	Fingerprint string `json:"fingerprint" yaml:"fingerprint"`

	// The addresses of existing online cluster members
	// Example: ["10.98.30.229:8443"]
	Addresses []string `json:"addresses" yaml:"addresses"`

	// The random join secret.
	// Example: 2b2284d44db32675923fe0d2020477e0e9be11801ff70c435e032b97028c35cd
	Secret string `json:"secret" yaml:"secret"`

	// The token's expiry date.
	// Example: 2021-03-23T17:38:37.753398689-04:00
	ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"`
}

ClusterMemberJoinToken represents the fields contained within an encoded cluster member join token.

swagger:model

API extension: clustering_join_token.

func (*ClusterMemberJoinToken) String

func (t *ClusterMemberJoinToken) String() string

String encodes the cluster member join token as JSON and then base64.

type ClusterMemberPost

type ClusterMemberPost struct {
	// The new name of the cluster member
	// Example: lxd02
	ServerName string `json:"server_name" yaml:"server_name"`
}

ClusterMemberPost represents the fields required to rename a LXD node.

swagger:model

API extension: clustering.

type ClusterMemberPut

type ClusterMemberPut struct {
	// List of roles held by this cluster member
	// Example: ["database"]
	//
	// API extension: clustering_roles
	Roles []string `json:"roles" yaml:"roles"`

	// Name of the failure domain for this cluster member
	// Example: rack1
	//
	// API extension: clustering_failure_domains
	FailureDomain string `json:"failure_domain" yaml:"failure_domain"`

	// Cluster member description
	// Example: AMD Epyc 32c/64t
	//
	// API extension: clustering_description
	Description string `json:"description" yaml:"description"`

	// Additional configuration information
	// Example: {"scheduler.instance": "all"}
	//
	// API extension: clustering_config
	Config map[string]string `json:"config" yaml:"config"`

	// List of cluster groups this member belongs to
	// Example: ["group1", "group2"]
	//
	// API extension: clustering_groups
	Groups []string `json:"groups" yaml:"groups"`
}

ClusterMemberPut represents the modifiable fields of a LXD cluster member

swagger:model

API extension: clustering_edit_roles.

type ClusterMemberState

type ClusterMemberState struct {
	SysInfo      ClusterMemberSysInfo        `json:"sysinfo" yaml:"sysinfo"`
	StoragePools map[string]StoragePoolState `json:"storage_pools" yaml:"storage_pools"`
}

ClusterMemberState represents the state of a cluster member.

swagger:model

API extension: cluster_member_state.

type ClusterMemberStatePost

type ClusterMemberStatePost struct {
	// The action to be performed. Valid actions are "evacuate" and "restore".
	// Example: evacuate
	Action string `json:"action" yaml:"action"`

	// Override the configured evacuation mode.
	// Example: stop
	//
	// API extension: clustering_evacuate_mode
	Mode string `json:"mode" yaml:"mode"`
}

ClusterMemberStatePost represents the fields required to evacuate a cluster member.

swagger:model

API extension: clustering_evacuation.

type ClusterMemberSysInfo

type ClusterMemberSysInfo struct {
	Uptime       int64     `json:"uptime" yaml:"uptime"`
	LoadAverages []float64 `json:"load_averages" yaml:"load_averages"`
	TotalRAM     uint64    `json:"total_ram" yaml:"total_ram"`
	FreeRAM      uint64    `json:"free_ram" yaml:"free_ram"`
	SharedRAM    uint64    `json:"shared_ram" yaml:"shared_ram"`
	BufferRAM    uint64    `json:"buffered_ram" yaml:"buffered_ram"`
	TotalSwap    uint64    `json:"total_swap" yaml:"total_swap"`
	FreeSwap     uint64    `json:"free_swap" yaml:"free_swap"`
	Processes    uint16    `json:"processes" yaml:"processes"`
	LogicalCPUs  uint64    `json:"logical_cpus" yaml:"logical_cpus"`
}

ClusterMemberSysInfo represents the sysinfo of a cluster member.

swagger:model

API extension: cluster_member_state.

type ClusterMembersPost

type ClusterMembersPost struct {
	// The name of the new cluster member
	// Example: lxd02
	ServerName string `json:"server_name" yaml:"server_name"`
}

ClusterMembersPost represents the fields required to request a join token to add a member to the cluster.

swagger:model

API extension: clustering_join_token.

type ClusterPut

type ClusterPut struct {
	Cluster `yaml:",inline"`

	// The address of the cluster you wish to join
	// Example: 10.0.0.1:8443
	ClusterAddress string `json:"cluster_address" yaml:"cluster_address"`

	// The expected certificate (X509 PEM encoded) for the cluster
	// Example: X509 PEM certificate
	ClusterCertificate string `json:"cluster_certificate" yaml:"cluster_certificate"`

	// The local address to use for cluster communication
	// Example: 10.0.0.2:8443
	//
	// API extension: clustering_join
	ServerAddress string `json:"server_address" yaml:"server_address"`

	// The trust password of the cluster you're trying to join (deprecated, use cluster_token)
	// Example: blah
	//
	// API extension: clustering_join
	ClusterPassword string `json:"cluster_password" yaml:"cluster_password"` // Deprecated, use ClusterToken.

	// The cluster join token for the cluster you're trying to join
	// Example: blah
	//
	// API extension: explicit_trust_token
	ClusterToken string `json:"cluster_token" yaml:"cluster_token"`
}

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

swagger:model

API extension: clustering.

type Container

type Container 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
	Stateful bool `json:"stateful" yaml:"stateful"`

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

	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) SetWritable

func (c *Container) SetWritable(put ContainerPut)

SetWritable sets applicable values from ContainerPut struct to Container struct.

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 {
	Name            string                       `json:"name" yaml:"name"`
	Stateful        bool                         `json:"stateful" yaml:"stateful"`
	Ephemeral       bool                         `json:"ephemeral" yaml:"ephemeral"`
	Architecture    string                       `json:"architecture" yaml:"architecture"`
	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"`
	Profiles        []string                     `json:"profiles" yaml:"profiles"`
	Config          map[string]string            `json:"config" yaml:"config"`
	Devices         map[string]map[string]string `json:"devices" yaml:"devices"`
	ExpandedConfig  map[string]string            `json:"expanded_config" yaml:"expanded_config"`
	ExpandedDevices map[string]map[string]string `json:"expanded_devices" yaml:"expanded_devices"`
}

ContainerSnapshot represents a LXD conainer snapshot.

func (*ContainerSnapshot) SetWritable

func (c *ContainerSnapshot) SetWritable(put ContainerSnapshotPut)

SetWritable sets applicable values from ContainerSnapshotPut struct to ContainerSnapshot struct.

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 DevLXDGet

type DevLXDGet struct {
	DevLXDPut

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

	// Type (container or virtual-machine)
	// Example: container
	InstanceType string `json:"instance_type" yaml:"instance_type"`

	// What cluster member this instance is located on
	// Example: lxd01
	Location string `json:"location" yaml:"location"`
}

DevLXDGet represents the server data which is returned as the root of the devlxd API.

type DevLXDPut

type DevLXDPut struct {
	// Instance state
	// Example: Started
	State string `json:"state" yaml:"state"`
}

DevLXDPut represents the modifiable data.

type Event

type Event struct {
	// Event type (one of operation, logging or lifecycle)
	// Example: lifecycle
	Type string `yaml:"type" json:"type"`

	// Time at which the event was sent
	// Example: 2021-02-24T19:00:45.452649098-05:00
	Timestamp time.Time `yaml:"timestamp" json:"timestamp"`

	// JSON encoded metadata (see EventLogging, EventLifecycle or Operation)
	// Example: {"action": "instance-started", "source": "/1.0/instances/c1", "context": {}}
	Metadata json.RawMessage `yaml:"metadata" json:"metadata"`

	// Originating cluster member
	// Example: lxd01
	//
	// API extension: event_location
	Location string `yaml:"location,omitempty" json:"location,omitempty"`

	// Project the event belongs to.
	// Example: default
	//
	// API extension: event_project
	Project string `yaml:"project,omitempty" json:"project,omitempty"`
}

Event represents an event entry (over websocket)

swagger:model

func (*Event) ToLogging

func (event *Event) ToLogging() (EventLogRecord, error)

ToLogging creates log record for the event.

type EventLifecycle

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

	// API extension: event_lifecycle_requestor
	Requestor *EventLifecycleRequestor `yaml:"requestor,omitempty" json:"requestor,omitempty"`

	// API extension: event_lifecycle_name_and_project
	Name    string `yaml:"name,omitempty" json:"name,omitempty"`
	Project string `yaml:"project,omitempty" json:"project,omitempty"`
}

EventLifecycle represets a lifecycle type event entry

API extension: event_lifecycle.

type EventLifecycleRequestor

type EventLifecycleRequestor struct {
	Username string `yaml:"username" json:"username"`
	Protocol string `yaml:"protocol" json:"protocol"`

	// Requestor address
	// Example: 10.0.2.15
	//
	// API extension: event_lifecycle_requestor_address
	Address string `yaml:"address" json:"address"`
}

EventLifecycleRequestor represents the initial requestor for an event

API extension: event_lifecycle_requestor.

type EventLogRecord

type EventLogRecord struct {
	Time time.Time
	Lvl  string
	Msg  string
	Ctx  []any
}

EventLogRecord represents single log record.

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 IdentitiesTLSPost

type IdentitiesTLSPost struct {
	// Name associated with the identity
	// Example: foo
	Name string `json:"name" yaml:"name"`

	// Trust token (used to add an untrusted client)
	// Example: blah
	TrustToken string `json:"trust_token" yaml:"trust_token"`

	// Whether to create a certificate add token
	// Example: true
	Token bool `json:"token" yaml:"token"`

	// The PEM encoded x509 certificate of the identity
	Certificate string `json:"certificate" yaml:"certificate"`

	// Groups is the list of groups for which the identity is a member.
	// Example: ["foo", "bar"]
	Groups []string `json:"groups" yaml:"groups"`
}

IdentitiesTLSPost contains required information for the creation of a TLS identity.

swagger:model

API extension: access_management_tls.

type Identity

type Identity struct {
	// AuthenticationMethod is the authentication method that the identity
	// authenticates to LXD with.
	// Example: tls
	AuthenticationMethod string `json:"authentication_method" yaml:"authentication_method"`

	// Type is the type of identity.
	// Example: oidc-service-account
	Type string `json:"type" yaml:"type"`

	// Identifier is a unique identifier for the identity (e.g. certificate fingerprint or email for OIDC).
	// Example: jane.doe@example.com
	Identifier string `json:"id" yaml:"id"`

	// Name is the Name claim of the identity if authenticated via OIDC, or the name
	// of the certificate if authenticated with TLS.
	// Example: Jane Doe
	Name string `json:"name" yaml:"name"`

	// Groups is the list of groups for which the identity is a member.
	// Example: ["foo", "bar"]
	Groups []string `json:"groups" yaml:"groups"`

	// TLSCertificate is a PEM encoded x509 certificate. This is only set if the AuthenticationMethod is AuthenticationMethodTLS.
	//
	// API extension: access_management_tls.
	TLSCertificate string `json:"tls_certificate" yaml:"tls_certificate"`
}

Identity is the type for an authenticated party that can make requests to the HTTPS API.

swagger:model

API extension: access_management.

func (*Identity) SetWritable

func (i *Identity) SetWritable(put IdentityPut)

SetWritable sets applicable values from IdentityPut struct to Identity struct.

func (Identity) Writable

func (i Identity) Writable() IdentityPut

Writable converts a Identity struct into a IdentityPut struct (filters read-only fields).

type IdentityInfo

type IdentityInfo struct {
	Identity `yaml:",inline"`

	// Effective groups is the combined and deduplicated list of LXD groups that the identity is a direct member of, and
	// the LXD groups that the identity is an effective member of via identity provider group mappings.
	// Example: ["foo", "bar"]
	EffectiveGroups []string `json:"effective_groups" yaml:"effective_groups"`

	// Effective permissions is the combined and deduplicated list of permissions that the identity has by virtue of
	// direct membership to a LXD group, or effective membership of a LXD group via identity provider group mappings.
	EffectivePermissions []Permission `json:"effective_permissions" yaml:"effective_permissions"`
}

IdentityInfo expands an Identity to include effective group membership and effective permissions. These fields can only be evaluated for the currently authenticated identity.

swagger:model

API extension: access_management.

type IdentityProviderGroup

type IdentityProviderGroup struct {
	// Name is the name of the IdP group.
	Name string `json:"name" yaml:"name"`

	// Groups are the groups the IdP group resolves to.
	// Example: ["foo", "bar"]
	Groups []string `json:"groups" yaml:"groups"`
}

IdentityProviderGroup represents a mapping between LXD groups and groups defined by an identity provider.

swagger:model

API extension: access_management.

func (*IdentityProviderGroup) SetWritable

func (ipg *IdentityProviderGroup) SetWritable(put IdentityProviderGroupPut)

SetWritable sets applicable values from IdentityProviderGroupPut struct to IdentityProviderGroup struct.

func (IdentityProviderGroup) Writable

Writable converts a IdentityProviderGroup struct into a IdentityProviderGroupPut struct (filters read-only fields).

type IdentityProviderGroupPost

type IdentityProviderGroupPost struct {
	// Name is the name of the IdP group.
	Name string `json:"name" yaml:"name"`
}

IdentityProviderGroupPost is used for renaming an IdentityProviderGroup.

swagger:model

API extension: access_management.

type IdentityProviderGroupPut

type IdentityProviderGroupPut struct {
	// Groups are the groups the IdP group resolves to.
	// Example: ["foo", "bar"]
	Groups []string `json:"groups" yaml:"groups"`
}

IdentityProviderGroupPut contains the editable fields of an IdentityProviderGroup.

swagger:model

API extension: access_management.

type IdentityPut

type IdentityPut struct {
	// Groups is the list of groups for which the identity is a member.
	// Example: ["foo", "bar"]
	Groups []string `json:"groups" yaml:"groups"`

	// TLSCertificate is a base64 encoded x509 certificate. This can only be set if the authentication method of the identity is AuthenticationMethodTLS.
	//
	// API extension: access_management_tls.
	TLSCertificate string `json:"tls_certificate" yaml:"tls_certificate"`
}

IdentityPut contains the editable fields of an IdentityInfo.

swagger:model

API extension: access_management.

type Image

type Image struct {
	// List of aliases
	Aliases []ImageAlias `json:"aliases" yaml:"aliases"`

	// Architecture
	// Example: x86_64
	Architecture string `json:"architecture" yaml:"architecture"`

	// Whether the image is an automatically cached remote image
	// Example: true
	Cached bool `json:"cached" yaml:"cached"`

	// Whether the image is available to unauthenticated users
	// Example: false
	Public bool `json:"public" yaml:"public"`

	// Original filename
	// Example: 06b86454720d36b20f94e31c6812e05ec51c1b568cf3a8abd273769d213394bb.rootfs
	Filename string `json:"filename" yaml:"filename"`

	// Full SHA-256 fingerprint
	// Example: 06b86454720d36b20f94e31c6812e05ec51c1b568cf3a8abd273769d213394bb
	Fingerprint string `json:"fingerprint" yaml:"fingerprint"`

	// Size of the image in bytes
	// Example: 272237676
	Size int64 `json:"size" yaml:"size"`

	// Where the image came from
	UpdateSource *ImageSource `json:"update_source,omitempty" yaml:"update_source,omitempty"`

	// Whether the image should auto-update when a new build is available
	// Example: true
	AutoUpdate bool `json:"auto_update" yaml:"auto_update"`

	// Type of image (container or virtual-machine)
	// Example: container
	//
	// API extension: image_types
	Type string `json:"type" yaml:"type"`

	// When the image was originally created
	// Example: 2021-03-23T20:00:00-04:00
	CreatedAt time.Time `json:"created_at" yaml:"created_at"`

	// When the image becomes obsolete
	// Example: 2025-03-23T20:00:00-04:00
	//
	// API extension: images_expiry
	ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"`

	// Last time the image was used
	// Example: 2021-03-22T20:39:00.575185384-04:00
	LastUsedAt time.Time `json:"last_used_at" yaml:"last_used_at"`

	// When the image was added to this LXD server
	// Example: 2021-03-24T14:18:15.115036787-04:00
	UploadedAt time.Time `json:"uploaded_at" yaml:"uploaded_at"`

	// Descriptive properties
	// Example: {"os": "Ubuntu", "release": "jammy", "variant": "cloud"}
	Properties map[string]string `json:"properties" yaml:"properties"`

	// List of profiles to use when creating from this image (if none provided by user)
	// Example: ["default"]
	//
	// API extension: image_profiles
	Profiles []string `json:"profiles" yaml:"profiles"`
}

Image represents a LXD image

swagger:model

func (*Image) SetWritable

func (img *Image) SetWritable(put ImagePut)

SetWritable sets applicable values from ImagePut struct to Image struct.

func (*Image) URL

func (img *Image) URL(apiVersion string, project string) *URL

URL returns the URL for the 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 of the alias
	// Example: ubuntu-24.04
	Name string `json:"name" yaml:"name"`

	// Description of the alias
	// Example: Our preferred Ubuntu image
	Description string `json:"description" yaml:"description"`
}

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

swagger:model

type ImageAliasesEntry

type ImageAliasesEntry struct {
	// Alias name
	// Example: ubuntu-24.04
	Name string `json:"name" yaml:"name"`

	// Alias description
	// Example: Our preferred Ubuntu image
	Description string `json:"description" yaml:"description"`

	// Alias type (container or virtual-machine)
	// Example: container
	//
	// API extension: image_types
	Type string `json:"type" yaml:"type"`

	// Target fingerprint for the alias
	// Example: 06b86454720d36b20f94e31c6812e05ec51c1b568cf3a8abd273769d213394bb
	Target string `json:"target" yaml:"target"`
}

ImageAliasesEntry represents a LXD image alias

swagger:model

type ImageAliasesEntryPost

type ImageAliasesEntryPost struct {
	// Alias name
	// Example: ubuntu-24.04
	Name string `json:"name" yaml:"name"`
}

ImageAliasesEntryPost represents the required fields to rename a LXD image alias

swagger:model

type ImageAliasesEntryPut

type ImageAliasesEntryPut struct {
	// Alias description
	// Example: Our preferred Ubuntu image
	Description string `json:"description" yaml:"description"`

	// Target fingerprint for the alias
	// Example: 06b86454720d36b20f94e31c6812e05ec51c1b568cf3a8abd273769d213394bb
	Target string `json:"target" yaml:"target"`
}

ImageAliasesEntryPut represents the modifiable fields of a LXD image alias

swagger:model

type ImageAliasesPost

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

ImageAliasesPost represents a new LXD image alias

swagger:model

type ImageExportPost

type ImageExportPost struct {
	// Target server URL
	// Example: https://1.2.3.4:8443
	Target string `json:"target" yaml:"target"`

	// Image receive secret
	// Example: RANDOM-STRING
	Secret string `json:"secret" yaml:"secret"`

	// Remote server certificate
	// Example: X509 PEM certificate
	Certificate string `json:"certificate" yaml:"certificate"`

	// List of aliases to set on the image
	Aliases []ImageAlias `json:"aliases" yaml:"aliases"`

	// Project name
	// Example: project1
	//
	// API extension: image_target_project
	Project string `json:"project" yaml:"project"`

	// List of profiles to use
	// Example: ["default"]
	//
	// API extension: image_copy_profile
	Profiles []string `json:"profiles" yaml:"profiles"`
}

ImageExportPost represents the fields required to export a LXD image

swagger:model

API extension: images_push_relay.

type ImageMetadata

type ImageMetadata struct {
	// Architecture name
	// Example: x86_64
	Architecture string `json:"architecture" yaml:"architecture"`

	// Image creation data (as UNIX epoch)
	// Example: 1620655439
	CreationDate int64 `json:"creation_date" yaml:"creation_date"`

	// Image expiry data (as UNIX epoch)
	// Example: 1620685757
	ExpiryDate int64 `json:"expiry_date" yaml:"expiry_date"`

	// Descriptive properties
	// Example: {"os": "Ubuntu", "release": "jammy", "variant": "cloud"}
	Properties map[string]string `json:"properties" yaml:"properties"`

	// Template for files in the image
	Templates map[string]*ImageMetadataTemplate `json:"templates" yaml:"templates"`
}

ImageMetadata represents LXD image metadata (used in image tarball)

swagger:model

type ImageMetadataTemplate

type ImageMetadataTemplate struct {
	// When to trigger the template (create, copy or start)
	// Example: create
	When []string `json:"when" yaml:"when"`

	// Whether to trigger only if the file is missing
	// Example: false
	CreateOnly bool `json:"create_only" yaml:"create_only"`

	// The template itself as a valid pongo2 template
	// Example: pongo2-template
	Template string `json:"template" yaml:"template"`

	// Key/value properties to pass to the template
	// Example: {"foo": "bar"}
	Properties map[string]string `json:"properties" yaml:"properties"`
}

ImageMetadataTemplate represents a template entry in image metadata (used in image tarball)

swagger:model

type ImagePut

type ImagePut struct {
	// Whether the image should auto-update when a new build is available
	// Example: true
	AutoUpdate bool `json:"auto_update" yaml:"auto_update"`

	// Descriptive properties
	// Example: {"os": "Ubuntu", "release": "jammy", "variant": "cloud"}
	Properties map[string]string `json:"properties" yaml:"properties"`

	// Whether the image is available to unauthenticated users
	// Example: false
	Public bool `json:"public" yaml:"public"`

	// When the image becomes obsolete
	// Example: 2025-03-23T20:00:00-04:00
	//
	// API extension: images_expiry
	ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"`

	// List of profiles to use when creating from this image (if none provided by user)
	// Example: ["default"]
	//
	// API extension: image_profiles
	Profiles []string `json:"profiles" yaml:"profiles"`
}

ImagePut represents the modifiable fields of a LXD image

swagger:model

type ImageSource

type ImageSource struct {
	// Source alias to download from
	// Example: jammy
	Alias string `json:"alias" yaml:"alias"`

	// Source server certificate (if not trusted by system CA)
	// Example: X509 PEM certificate
	Certificate string `json:"certificate" yaml:"certificate"`

	// Source server protocol
	// Example: simplestreams
	Protocol string `json:"protocol" yaml:"protocol"`

	// URL of the source server
	// Example: https://cloud-images.ubuntu.com/releases/
	Server string `json:"server" yaml:"server"`

	// Type of image (container or virtual-machine)
	// Example: container
	//
	// API extension: image_types
	ImageType string `json:"image_type" yaml:"image_type"`
}

ImageSource represents the source of a LXD image

swagger:model

type ImagesPost

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

	// Original filename of the image
	// Example: lxd.tar.xz
	Filename string `json:"filename" yaml:"filename"`

	// Source of the image
	Source *ImagesPostSource `json:"source" yaml:"source"`

	// Compression algorithm to use when turning an instance into an image
	// Example: gzip
	//
	// API extension: image_compression_algorithm
	CompressionAlgorithm string `json:"compression_algorithm" yaml:"compression_algorithm"`

	// Aliases to add to the image
	// Example: [{"name": "foo"}, {"name": "bar"}]
	//
	// API extension: image_create_aliases
	Aliases []ImageAlias `json:"aliases" yaml:"aliases"`
}

ImagesPost represents the fields available for a new LXD image

swagger:model

type ImagesPostSource

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

	// Transfer mode (push or pull)
	// Example: pull
	Mode string `json:"mode" yaml:"mode"`

	// Type of image source (instance, snapshot, image or url)
	// Example: instance
	Type string `json:"type" yaml:"type"`

	// Source URL (for type "url")
	// Example: https://some-server.com/some-directory/
	URL string `json:"url" yaml:"url"`

	// Instance name (for type "instance" or "snapshot")
	// Example: c1/snap0
	Name string `json:"name" yaml:"name"`

	// Source image fingerprint (for type "image")
	// Example: 8ae945c52bb2f2df51c923b04022312f99bbb72c356251f54fa89ea7cf1df1d0
	Fingerprint string `json:"fingerprint" yaml:"fingerprint"`

	// Source image server secret token (when downloading private images)
	// Example: RANDOM-STRING
	Secret string `json:"secret" yaml:"secret"`

	// Source project name
	// Example: project1
	//
	// API extension: image_source_project
	Project string `json:"project" yaml:"project"`
}

ImagesPostSource represents the source of a new LXD image

swagger:model

type InitClusterPreseed

type InitClusterPreseed struct {
	ClusterPut `yaml:",inline"`

	// The path to the cluster certificate
	// Example: /tmp/cluster.crt
	ClusterCertificatePath string `json:"cluster_certificate_path" yaml:"cluster_certificate_path"`
}

InitClusterPreseed represents initialization configuration for the LXD cluster.

swagger:model

API extension: preseed.

type InitLocalPreseed

type InitLocalPreseed struct {
	ServerPut `yaml:",inline"`

	// Networks by project to add to LXD
	// Example: Network on the "default" project
	Networks []InitNetworksProjectPost `json:"networks" yaml:"networks"`

	// Storage Pools to add to LXD
	// Example: local dir storage pool
	StoragePools []StoragePoolsPost `json:"storage_pools" yaml:"storage_pools"`

	// Storage Volumes to add to LXD
	// Example: local dir storage volume
	StorageVolumes []InitStorageVolumesProjectPost `json:"storage_volumes" yaml:"storage_volumes"`

	// Profiles to add to LXD
	// Example: "default" profile with a root disk device
	Profiles []ProfilesPost `json:"profiles" yaml:"profiles"`

	// Projects to add to LXD
	// Example: "default" project
	Projects []ProjectsPost `json:"projects" yaml:"projects"`
}

InitLocalPreseed represents initialization configuration for the local LXD.

swagger:model

API extension: preseed.

type InitNetworksProjectPost

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

	// Project in which the network will reside
	// Example: "default"
	Project string
}

InitNetworksProjectPost represents the fields of a new LXD network along with its associated project.

swagger:model

API extension: preseed.

type InitPreseed

type InitPreseed struct {
	Node    InitLocalPreseed    `yaml:",inline"`
	Cluster *InitClusterPreseed `json:"cluster" yaml:"cluster"`
}

InitPreseed represents initialization configuration that can be supplied to `lxd init`.

swagger:model

API extension: preseed.

type InitStorageVolumesProjectPost

type InitStorageVolumesProjectPost struct {
	StorageVolumesPost `yaml:",inline"`
	// Storage pool in which the volume will reside
	// Example: "default"
	Pool string
	// Project in which the volume will reside
	// Example: "default"
	Project string
}

InitStorageVolumesProjectPost represents the fields of a new LXD storage volume along with its associated pool.

swagger:model

API extension: init_preseed_storage_volumes.

type Instance

type Instance struct {
	// Instance name
	// Example: foo
	Name string `json:"name" yaml:"name"`

	// Instance description
	// Example: My test instance
	Description string `json:"description" yaml:"description"`

	// Instance status (see instance_state)
	// Example: Running
	Status string `json:"status" yaml:"status"`

	// Instance status code (see instance_state)
	// Example: 101
	StatusCode StatusCode `json:"status_code" yaml:"status_code"`

	// Instance creation timestamp
	// Example: 2021-03-23T20:00:00-04:00
	CreatedAt time.Time `json:"created_at" yaml:"created_at"`

	// Last start timestamp
	// Example: 2021-03-23T20:00:00-04:00
	LastUsedAt time.Time `json:"last_used_at" yaml:"last_used_at"`

	// What cluster member this instance is located on
	// Example: lxd01
	Location string `json:"location" yaml:"location"`

	// The type of instance (container or virtual-machine)
	// Example: container
	Type string `json:"type" yaml:"type"`

	// Instance project name
	// Example: foo
	//
	// API extension: instance_all_projects
	Project string `json:"project" yaml:"project"`

	// Architecture name
	// Example: x86_64
	Architecture string `json:"architecture" yaml:"architecture"`

	// Whether the instance is ephemeral (deleted on shutdown)
	// Example: false
	Ephemeral bool `json:"ephemeral" yaml:"ephemeral"`

	// Whether the instance currently has saved state on disk
	// Example: false
	Stateful bool `json:"stateful" yaml:"stateful"`

	// List of profiles applied to the instance
	// Example: ["default"]
	Profiles []string `json:"profiles" yaml:"profiles"`

	// Instance configuration (see doc/instances.md)
	// Example: {"security.nesting": "true"}
	Config map[string]string `json:"config" yaml:"config"`

	// Instance devices (see doc/instances.md)
	// Example: {"root": {"type": "disk", "pool": "default", "path": "/"}}
	Devices map[string]map[string]string `json:"devices" yaml:"devices"`

	// Expanded configuration (all profiles and local config merged)
	// Example: {"security.nesting": "true"}
	ExpandedConfig map[string]string `json:"expanded_config,omitempty" yaml:"expanded_config,omitempty"`

	// Expanded devices (all profiles and local devices merged)
	// Example: {"root": {"type": "disk", "pool": "default", "path": "/"}}
	ExpandedDevices map[string]map[string]string `json:"expanded_devices,omitempty" yaml:"expanded_devices,omitempty"`
}

Instance represents a LXD instance.

swagger:model

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) SetWritable

func (c *Instance) SetWritable(put InstancePut)

SetWritable sets applicable values from InstancePut struct to Instance struct.

func (*Instance) URL

func (c *Instance) URL(apiVersion string, project string) *URL

URL returns the URL for the instance.

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 {
	// Backup name
	// Example: backup0
	Name string `json:"name" yaml:"name"`

	// When the backup was created
	// Example: 2021-03-23T16:38:37.753398689-04:00
	CreatedAt time.Time `json:"created_at" yaml:"created_at"`

	// When the backup expires (gets auto-deleted)
	// Example: 2021-03-23T17:38:37.753398689-04:00
	ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"`

	// Whether to ignore snapshots
	// Example: false
	InstanceOnly bool `json:"instance_only" yaml:"instance_only"`

	// Whether to ignore snapshots (deprecated, use instance_only)
	// Example: false
	ContainerOnly bool `json:"container_only" yaml:"container_only"` // Deprecated, use InstanceOnly.

	// Whether to use a pool-optimized binary format (instead of plain tarball)
	// Example: true
	OptimizedStorage bool `json:"optimized_storage" yaml:"optimized_storage"`
}

InstanceBackup represents a LXD instance backup.

swagger:model

API extension: instances.

type InstanceBackupPost

type InstanceBackupPost struct {
	// New backup name
	// Example: backup1
	Name string `json:"name" yaml:"name"`
}

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

swagger:model

API extension: instances.

type InstanceBackupsPost

type InstanceBackupsPost struct {
	// Backup name
	// Example: backup0
	Name string `json:"name" yaml:"name"`

	// When the backup expires (gets auto-deleted)
	// Example: 2021-03-23T17:38:37.753398689-04:00
	ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"`

	// Whether to ignore snapshots
	// Example: false
	InstanceOnly bool `json:"instance_only" yaml:"instance_only"`

	// Whether to ignore snapshots (deprecated, use instance_only)
	// Example: false
	ContainerOnly bool `json:"container_only" yaml:"container_only"` // Deprecated, use InstanceOnly.

	// Whether to use a pool-optimized binary format (instead of plain tarball)
	// Example: true
	OptimizedStorage bool `json:"optimized_storage" yaml:"optimized_storage"`

	// What compression algorithm to use
	// Example: gzip
	//
	// API extension: backup_compression_algorithm
	CompressionAlgorithm string `json:"compression_algorithm" yaml:"compression_algorithm"`
}

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

swagger:model

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 {
	// Console width in columns (console type only)
	// Example: 80
	Width int `json:"width" yaml:"width"`

	// Console height in rows (console type only)
	// Example: 24
	Height int `json:"height" yaml:"height"`

	// Type of console to attach to (console or vga)
	// Example: console
	//
	// API extension: console_vga_type
	Type string `json:"type" yaml:"type"`
}

InstanceConsolePost represents a LXD instance console request.

swagger:model

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 and its arguments
	// Example: ["bash"]
	Command []string `json:"command" yaml:"command"`

	// Whether to wait for all websockets to be connected before spawning the command
	// Example: true
	WaitForWS bool `json:"wait-for-websocket" yaml:"wait-for-websocket"`

	// Whether the command is to be spawned in interactive mode (singled PTY instead of 3 PIPEs)
	// Example: true
	Interactive bool `json:"interactive" yaml:"interactive"`

	// Additional environment to pass to the command
	// Example: {"FOO": "BAR"}
	Environment map[string]string `json:"environment" yaml:"environment"`

	// Terminal width in characters (for interactive)
	// Example: 80
	Width int `json:"width" yaml:"width"`

	// Terminal height in rows (for interactive)
	// Example: 24
	Height int `json:"height" yaml:"height"`

	// Whether to capture the output for later download (requires non-interactive)
	RecordOutput bool `json:"record-output" yaml:"record-output"`

	// UID of the user to spawn the command as
	// Example: 1000
	User uint32 `json:"user" yaml:"user"`

	// GID of the user to spawn the command as
	// Example: 1000
	Group uint32 `json:"group" yaml:"group"`

	// Current working directory for the command
	// Example: /home/foo/
	Cwd string `json:"cwd" yaml:"cwd"`
}

InstanceExecPost represents a LXD instance exec request.

swagger:model

API extension: instances.

type InstanceFull

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

	// List of backups.
	Backups []InstanceBackup `json:"backups" yaml:"backups"`

	// Current state.
	State *InstanceState `json:"state" yaml:"state"`

	// List of snapshots.
	Snapshots []InstanceSnapshot `json:"snapshots" yaml:"snapshots"`
}

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

swagger:model

API extension: instances.

type InstancePost

type InstancePost struct {
	// New name for the instance
	// Example: bar
	Name string `json:"name" yaml:"name"`

	// Whether the instance is being migrated to another server
	// Example: false
	Migration bool `json:"migration" yaml:"migration"`

	// Whether to perform a live migration (migration only)
	// Example: false
	Live bool `json:"live" yaml:"live"`

	// Whether snapshots should be discarded (migration only)
	// Example: false
	InstanceOnly bool `json:"instance_only" yaml:"instance_only"`

	// Whether snapshots should be discarded (migration only, deprecated, use instance_only)
	// Example: false
	ContainerOnly bool `json:"container_only" yaml:"container_only"` // Deprecated, use InstanceOnly.

	// Target for the migration, will use pull mode if not set (migration only)
	Target *InstancePostTarget `json:"target" yaml:"target"`

	// Target pool for local cross-pool move
	// Example: baz
	//
	// API extension: instance_pool_move
	Pool string `json:"pool" yaml:"pool"`

	// Target project for local cross-project move
	// Example: foo
	//
	// API extension: instance_project_move
	Project string `json:"project" yaml:"project"`

	// AllowInconsistent allow inconsistent copies when migrating.
	// Example: false
	//
	// API extension: instance_allow_inconsistent_copy
	AllowInconsistent bool `json:"allow_inconsistent" yaml:"allow_inconsistent"`

	// Instance configuration file.
	// Example: {"security.nesting": "true"}
	//
	// API extension: instance_move_config
	Config map[string]string

	// Instance devices.
	// Example: {"root": {"type": "disk", "pool": "default", "path": "/"}}
	//
	// API extension: instance_move_config
	Devices map[string]map[string]string

	// List of profiles applied to the instance.
	// Example: ["default"]
	//
	// API extension: instance_move_config
	Profiles []string
}

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

swagger:model

API extension: instances.

type InstancePostTarget

type InstancePostTarget struct {
	// The certificate of the migration target
	// Example: X509 PEM certificate
	Certificate string `json:"certificate" yaml:"certificate"`

	// The operation URL on the remote target
	// Example: https://1.2.3.4:8443/1.0/operations/5e8e1638-5345-4c2d-bac9-2c79c8577292
	Operation string `json:"operation,omitempty" yaml:"operation,omitempty"`

	// Migration websockets credentials
	// Example: {"migration": "random-string", "criu": "random-string"}
	Websockets map[string]string `json:"secrets,omitempty" yaml:"secrets,omitempty"`
}

InstancePostTarget represents the migration target host and operation.

swagger:model

API extension: instances.

type InstancePut

type InstancePut struct {
	// Architecture name
	// Example: x86_64
	Architecture string `json:"architecture" yaml:"architecture"`

	// Instance configuration (see doc/instances.md)
	// Example: {"security.nesting": "true"}
	Config map[string]string `json:"config" yaml:"config"`

	// Instance devices (see doc/instances.md)
	// Example: {"root": {"type": "disk", "pool": "default", "path": "/"}}
	Devices map[string]map[string]string `json:"devices" yaml:"devices"`

	// Whether the instance is ephemeral (deleted on shutdown)
	// Example: false
	Ephemeral bool `json:"ephemeral" yaml:"ephemeral"`

	// List of profiles applied to the instance
	// Example: ["default"]
	Profiles []string `json:"profiles" yaml:"profiles"`

	// If set, instance will be restored to the provided snapshot name
	// Example: snap0
	Restore string `json:"restore,omitempty" yaml:"restore,omitempty"`

	// Whether the instance currently has saved state on disk
	// Example: false
	Stateful bool `json:"stateful" yaml:"stateful"`

	// Instance description
	// Example: My test instance
	Description string `json:"description" yaml:"description"`
}

InstancePut represents the modifiable fields of a LXD instance.

swagger:model

API extension: instances.

type InstanceRebuildPost

type InstanceRebuildPost struct {
	// Rebuild source
	Source InstanceSource `json:"source" yaml:"source"`
}

InstanceRebuildPost indicates how to rebuild an instance.

swagger:model

API extension: instances_rebuild.

type InstanceSnapshot

type InstanceSnapshot struct {
	// Architecture name
	// Example: x86_64
	Architecture string `json:"architecture" yaml:"architecture"`

	// Instance configuration (see doc/instances.md)
	// Example: {"security.nesting": "true"}
	Config map[string]string `json:"config" yaml:"config"`

	// Instance creation timestamp
	// Example: 2021-03-23T20:00:00-04:00
	CreatedAt time.Time `json:"created_at" yaml:"created_at"`

	// When the snapshot expires (gets auto-deleted)
	// Example: 2021-03-23T17:38:37.753398689-04:00
	ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"`

	// Instance devices (see doc/instances.md)
	// Example: {"root": {"type": "disk", "pool": "default", "path": "/"}}
	Devices map[string]map[string]string `json:"devices" yaml:"devices"`

	// Whether the instance is ephemeral (deleted on shutdown)
	// Example: false
	Ephemeral bool `json:"ephemeral" yaml:"ephemeral"`

	// Expanded configuration (all profiles and local config merged)
	// Example: {"security.nesting": "true"}
	ExpandedConfig map[string]string `json:"expanded_config,omitempty" yaml:"expanded_config,omitempty"`

	// Expanded devices (all profiles and local devices merged)
	// Example: {"root": {"type": "disk", "pool": "default", "path": "/"}}
	ExpandedDevices map[string]map[string]string `json:"expanded_devices,omitempty" yaml:"expanded_devices,omitempty"`

	// Last start timestamp
	// Example: 2021-03-23T20:00:00-04:00
	LastUsedAt time.Time `json:"last_used_at" yaml:"last_used_at"`

	// Snapshot name
	// Example: foo
	Name string `json:"name" yaml:"name"`

	// List of profiles applied to the instance
	// Example: ["default"]
	Profiles []string `json:"profiles" yaml:"profiles"`

	// Whether the instance currently has saved state on disk
	// Example: false
	Stateful bool `json:"stateful" yaml:"stateful"`

	// Size of the snapshot in bytes
	// Example: 143360
	//
	// API extension: snapshot_disk_usage
	Size int64 `json:"size" yaml:"size"`
}

InstanceSnapshot represents a LXD instance snapshot.

swagger:model

API extension: instances.

func (*InstanceSnapshot) SetWritable

func (c *InstanceSnapshot) SetWritable(put InstanceSnapshotPut)

SetWritable sets applicable values from InstanceSnapshotPut struct to InstanceSnapshot struct.

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 {
	// New name for the snapshot
	// Example: foo
	Name string `json:"name" yaml:"name"`

	// Whether this is a migration request
	// Example: false
	Migration bool `json:"migration" yaml:"migration"`

	// Migration target for push migration (requires migration)
	Target *InstancePostTarget `json:"target" yaml:"target"`

	// Whether to perform a live migration (requires migration)
	// Example: false
	Live bool `json:"live,omitempty" yaml:"live,omitempty"`
}

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

swagger:model

API extension: instances.

type InstanceSnapshotPut

type InstanceSnapshotPut struct {
	// When the snapshot expires (gets auto-deleted)
	// Example: 2021-03-23T17:38:37.753398689-04:00
	ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"`
}

InstanceSnapshotPut represents the modifiable fields of a LXD instance snapshot.

swagger:model

API extension: instances.

type InstanceSnapshotsPost

type InstanceSnapshotsPost struct {
	// Snapshot name
	// Example: snap0
	Name string `json:"name" yaml:"name"`

	// Whether the snapshot should include runtime state
	// Example: false
	Stateful bool `json:"stateful" yaml:"stateful"`

	// When the snapshot expires (gets auto-deleted)
	// Example: 2021-03-23T17:38:37.753398689-04:00
	//
	// 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.

swagger:model

API extension: instances.

type InstanceSource

type InstanceSource struct {
	// Source type
	// Example: image
	Type string `json:"type" yaml:"type"`

	// Certificate (for remote images or migration)
	// Example: X509 PEM certificate
	Certificate string `json:"certificate" yaml:"certificate"`

	// Image alias name (for image source)
	// Example: ubuntu/24.04
	Alias string `json:"alias,omitempty" yaml:"alias,omitempty"`

	// Image fingerprint (for image source)
	// Example: ed56997f7c5b48e8d78986d2467a26109be6fb9f2d92e8c7b08eb8b6cec7629a
	Fingerprint string `json:"fingerprint,omitempty" yaml:"fingerprint,omitempty"`

	// Image filters (for image source)
	// Example: {"os": "Ubuntu", "release": "jammy", "variant": "cloud"}
	Properties map[string]string `json:"properties,omitempty" yaml:"properties,omitempty"`

	// Remote server URL (for remote images)
	// Example: https://cloud-images.ubuntu.com/releases/
	Server string `json:"server,omitempty" yaml:"server,omitempty"`

	// Remote server secret (for remote private images)
	// Example: RANDOM-STRING
	Secret string `json:"secret,omitempty" yaml:"secret,omitempty"`

	// Protocol name (for remote image)
	// Example: simplestreams
	Protocol string `json:"protocol,omitempty" yaml:"protocol,omitempty"`

	// Base image fingerprint (for faster migration)
	// Example: ed56997f7c5b48e8d78986d2467a26109be6fb9f2d92e8c7b08eb8b6cec7629a
	BaseImage string `json:"base-image,omitempty" yaml:"base-image,omitempty"`

	// Whether to use pull or push mode (for migration)
	// Example: pull
	Mode string `json:"mode,omitempty" yaml:"mode,omitempty"`

	// Remote operation URL (for migration)
	// Example: https://1.2.3.4:8443/1.0/operations/1721ae08-b6a8-416a-9614-3f89302466e1
	Operation string `json:"operation,omitempty" yaml:"operation,omitempty"`

	// Map of migration websockets (for migration)
	// Example: {"criu": "RANDOM-STRING", "rsync": "RANDOM-STRING"}
	Websockets map[string]string `json:"secrets,omitempty" yaml:"secrets,omitempty"`

	// Existing instance name or snapshot (for copy)
	// Example: foo/snap0
	Source string `json:"source,omitempty" yaml:"source,omitempty"`

	// Whether this is a live migration (for migration)
	// Example: false
	Live bool `json:"live,omitempty" yaml:"live,omitempty"`

	// Whether the copy should skip the snapshots (for copy)
	// Example: false
	InstanceOnly bool `json:"instance_only,omitempty" yaml:"instance_only,omitempty"`

	// Whether the copy should skip the snapshots (for copy, deprecated, use instance_only)
	// Example: false
	ContainerOnly bool `json:"container_only,omitempty" yaml:"container_only,omitempty"` // Deprecated, use InstanceOnly.

	// Whether this is refreshing an existing instance (for migration and copy)
	// Example: false
	Refresh bool `json:"refresh,omitempty" yaml:"refresh,omitempty"`

	// Source project name (for copy and local image)
	// Example: blah
	Project string `json:"project,omitempty" yaml:"project,omitempty"`

	// Whether to ignore errors when copying (e.g. for volatile files)
	// Example: false
	//
	// API extension: instance_allow_inconsistent_copy
	AllowInconsistent bool `json:"allow_inconsistent" yaml:"allow_inconsistent"`

	// Source disk size in bytes used to set the instance's volume size to accommodate the transferred root
	// disk. This value is ignored if the root disk device has a size explicitly configured (for conversion).
	// Example: 12345
	//
	// API extension: instance_import_conversion
	SourceDiskSize int64 `json:"source_disk_size" yaml:"source_disk_size"`

	// Optional list of options that are used during image conversion (for conversion).
	// Example: ["format"]
	//
	// API extension: instance_import_conversion
	ConversionOptions []string `json:"conversion_options" yaml:"conversion_options"`
}

InstanceSource represents the creation source for a new instance.

swagger:model

API extension: instances.

type InstanceState

type InstanceState struct {
	// Current status (Running, Stopped, Frozen or Error)
	// Example: Running
	Status string `json:"status" yaml:"status"`

	// Numeric status code (101, 102, 110, 112)
	// Example: 101
	StatusCode StatusCode `json:"status_code" yaml:"status_code"`

	// Disk usage key/value pairs
	Disk map[string]InstanceStateDisk `json:"disk" yaml:"disk"`

	// Memory usage information
	Memory InstanceStateMemory `json:"memory" yaml:"memory"`

	// Network usage key/value pairs
	Network map[string]InstanceStateNetwork `json:"network" yaml:"network"`

	// PID of the runtime
	// Example: 7281
	Pid int64 `json:"pid" yaml:"pid"`

	// Number of processes in the instance
	// Example: 50
	Processes int64 `json:"processes" yaml:"processes"`

	// CPU usage information
	CPU InstanceStateCPU `json:"cpu" yaml:"cpu"`
}

InstanceState represents a LXD instance's state.

swagger:model

API extension: instances.

type InstanceStateCPU

type InstanceStateCPU struct {
	// CPU usage in nanoseconds
	// Example: 3637691016
	Usage int64 `json:"usage" yaml:"usage"`
}

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

swagger:model

API extension: instances.

type InstanceStateDisk

type InstanceStateDisk struct {
	// Disk usage in bytes
	// Example: 502239232
	Usage int64 `json:"usage" yaml:"usage"`

	// Total size in bytes
	// Example: 502239232
	//
	// API extension: instances_state_total
	Total int64 `json:"total" yaml:"total"`
}

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

swagger:model

API extension: instances.

type InstanceStateMemory

type InstanceStateMemory struct {
	// Memory usage in bytes
	// Example: 73248768
	Usage int64 `json:"usage" yaml:"usage"`

	// Peak memory usage in bytes
	// Example: 73785344
	UsagePeak int64 `json:"usage_peak" yaml:"usage_peak"`

	// Total memory size in bytes
	// Example: 12297557
	//
	// API extension: instances_state_total
	Total int64 `json:"total" yaml:"total"`

	// SWAP usage in bytes
	// Example: 12297557
	SwapUsage int64 `json:"swap_usage" yaml:"swap_usage"`

	// Peak SWAP usage in bytes
	// Example: 12297557
	SwapUsagePeak int64 `json:"swap_usage_peak" yaml:"swap_usage_peak"`
}

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

swagger:model

API extension: instances.

type InstanceStateNetwork

type InstanceStateNetwork struct {
	// List of IP addresses
	Addresses []InstanceStateNetworkAddress `json:"addresses" yaml:"addresses"`

	// Traffic counters
	Counters InstanceStateNetworkCounters `json:"counters" yaml:"counters"`

	// MAC address
	// Example: 00:16:3e:0c:ee:dd
	Hwaddr string `json:"hwaddr" yaml:"hwaddr"`

	// Name of the interface on the host
	// Example: vethbbcd39c7
	HostName string `json:"host_name" yaml:"host_name"`

	// MTU (maximum transmit unit) for the interface
	// Example: 1500
	Mtu int `json:"mtu" yaml:"mtu"`

	// Administrative state of the interface (up/down)
	// Example: up
	State string `json:"state" yaml:"state"`

	// Type of interface (broadcast, loopback, point-to-point, ...)
	// Example: broadcast
	Type string `json:"type" yaml:"type"`
}

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

swagger:model

API extension: instances.

type InstanceStateNetworkAddress

type InstanceStateNetworkAddress struct {
	// Network family (inet or inet6)
	// Example: inet6
	Family string `json:"family" yaml:"family"`

	// IP address
	// Example: fd42:4c81:5770:1eaf:216:3eff:fe0c:eedd
	Address string `json:"address" yaml:"address"`

	// Network mask
	// Example: 64
	Netmask string `json:"netmask" yaml:"netmask"`

	// Address scope (local, link or global)
	// Example: global
	Scope string `json:"scope" yaml:"scope"`
}

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

swagger:model

API extension: instances.

type InstanceStateNetworkCounters

type InstanceStateNetworkCounters struct {
	// Number of bytes received
	// Example: 192021
	BytesReceived int64 `json:"bytes_received" yaml:"bytes_received"`

	// Number of bytes sent
	// Example: 10888579
	BytesSent int64 `json:"bytes_sent" yaml:"bytes_sent"`

	// Number of packets received
	// Example: 1748
	PacketsReceived int64 `json:"packets_received" yaml:"packets_received"`

	// Number of packets sent
	// Example: 964
	PacketsSent int64 `json:"packets_sent" yaml:"packets_sent"`

	// Number of errors received
	// Example: 14
	ErrorsReceived int64 `json:"errors_received" yaml:"errors_received"`

	// Number of errors sent
	// Example: 41
	ErrorsSent int64 `json:"errors_sent" yaml:"errors_sent"`

	// Number of outbound packets dropped
	// Example: 541
	PacketsDroppedOutbound int64 `json:"packets_dropped_outbound" yaml:"packets_dropped_outbound"`

	// Number of inbound packets dropped
	// Example: 179
	PacketsDroppedInbound int64 `json:"packets_dropped_inbound" yaml:"packets_dropped_inbound"`
}

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

swagger:model

API extension: instances.

type InstanceStatePut

type InstanceStatePut struct {
	// State change action (start, stop, restart, freeze, unfreeze)
	// Example: start
	Action string `json:"action" yaml:"action"`

	// How long to wait (in s) before giving up (when force isn't set)
	// Example: 30
	Timeout int `json:"timeout" yaml:"timeout"`

	// Whether to force the action (for stop and restart)
	// Example: false
	Force bool `json:"force" yaml:"force"`

	// Whether to store the runtime state (for stop)
	// Example: false
	Stateful bool `json:"stateful" yaml:"stateful"`
}

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

swagger:model

API extension: instances.

type InstanceType

type InstanceType string

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

type InstanceUEFIVariable

type InstanceUEFIVariable struct {
	// UEFI variable data (HEX-encoded)
	// example: 01
	Data string `json:"data" yaml:"data"`

	// UEFI variable attributes
	// example: 7
	Attr uint32 `json:"attr" yaml:"attr"`

	// UEFI variable timestamp (HEX-encoded)
	Timestamp string `json:"timestamp" yaml:"timestamp"`

	// UEFI variable digest (HEX-encoded)
	Digest string `json:"digest" yaml:"digest"`
}

InstanceUEFIVariable represents an EFI variable entry

swagger:model

API extension: instances_uefi_vars.

type InstanceUEFIVars

type InstanceUEFIVars struct {
	// UEFI variables map
	// Hashmap key format is <uefi-variable-name>-<UUID>
	// Example: { "SecureBootEnable-f0a30bc7-af08-4556-99c4-001009c93a44": { "data": "01", "attr": 3 } }
	Variables map[string]InstanceUEFIVariable `json:"variables" yaml:"variables"`
}

InstanceUEFIVars represents the UEFI variables of a LXD virtual machine.

swagger:model

API extension: instances_uefi_vars.

type InstancesPost

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

	// Instance name
	// Example: foo
	Name string `json:"name" yaml:"name"`

	// Creation source
	Source InstanceSource `json:"source" yaml:"source"`

	// Cloud instance type (AWS, GCP, Azure, ...) to emulate with limits
	// Example: t1.micro
	InstanceType string `json:"instance_type" yaml:"instance_type"`

	// Type (container or virtual-machine)
	// Example: container
	Type InstanceType `json:"type" yaml:"type"`

	// Whether to start the instance after creation
	// Example: true
	//
	// API extension: instance_create_start
	Start bool `json:"start" yaml:"start"`
}

InstancesPost represents the fields available for a new LXD instance.

swagger:model

API extension: instances.

type InstancesPut

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

InstancesPut represents the fields available for a mass update.

swagger:model

API extension: instance_bulk_state_change.

type MetadataConfiguration

type MetadataConfiguration struct {
	// Configs contains all server configuration metadata.
	Configs map[string]map[string]MetadataConfigurationConfigKeys `json:"configs" yaml:"configs"`

	// Entities contains all authorization related metadata.
	//
	// API extension: metadata_configuration_entity_types
	Entities map[string]MetadataConfigurationEntity `json:"entities" yaml:"entities"`
}

MetadataConfiguration contains metadata about the LXD server configuration options.

swagger:model

API extension: metadata_configuration.

type MetadataConfigurationConfigKey

type MetadataConfigurationConfigKey struct {
	// DefaultDescription contains a description of the configuration key.
	//
	// Example: A general description of a configuration key.
	DefaultDescription string `json:"defaultdesc" yaml:"defaultdesc"`

	// LongDescription contains a long-form description of the configuration key.
	//
	// Example: A much more in-depth description of the configuration key, including where and how it is used.
	LongDescription string `json:"longdesc" yaml:"longdesc"`

	// ShortDescription contains a short-form description of the configuration key.
	//
	// Example: A key for doing X.
	ShortDescription string `json:"shortdesc" yaml:"shortdesc"`

	// Type describes the type of the key.
	//
	// Example: Comma delimited CIDR format subnets.
	Type string `json:"type" yaml:"type"`

	// Condition describes conditions under which the configuration key can be applied.
	//
	// Example: Virtual machines only.
	Condition string `json:"condition" yaml:"condition"`

	// Required describes conditions under which the configuration key is required.
	//
	// Example: On device creation.
	Required string `json:"required" yaml:"required"`

	// Managed describes whether the configuration key is managed by LXD.
	//
	// Example: yes.
	Managed string `json:"managed"`
}

MetadataConfigurationConfigKey contains metadata about a LXD server configuration option.

swagger:model

API extension: metadata_configuration.

type MetadataConfigurationConfigKeys

type MetadataConfigurationConfigKeys struct {
	Keys []map[string]MetadataConfigurationConfigKey `json:"keys" yaml:"keys"`
}

MetadataConfigurationConfigKeys contains metadata about LXD server configuration options.

swagger:model

API extension: metadata_configuration.

type MetadataConfigurationEntity

type MetadataConfigurationEntity struct {
	// ProjectSpecific indicates whether the entity is project specific.
	//
	// Example: true
	ProjectSpecific bool `json:"project_specific" yaml:"project_specific"`

	// Entitlements contains a list of entitlements that apply to a specific entity type.
	Entitlements []MetadataConfigurationEntityEntitlement `json:"entitlements" yaml:"entitlements"`
}

MetadataConfigurationEntity contains metadata about LXD server entities and available entitlements for authorization.

swagger:model

API extension: metadata_configuration_entity_types.

type MetadataConfigurationEntityEntitlement

type MetadataConfigurationEntityEntitlement struct {
	// Name contains the name of the entitlement.
	//
	// Example: can_edit
	Name string `json:"name" yaml:"name"`

	// Description describes the entitlement.
	//
	// Example: Grants permission to do X, Y, and Z.
	Description string `json:"description" yaml:"description"`
}

MetadataConfigurationEntityEntitlement contains metadata about a LXD server entitlement.

swagger:model

API extension: metadata_configuration_entity_types.

type Network

type Network struct {
	// The network name
	// Read only: true
	// Example: lxdbr0
	Name string `json:"name" yaml:"name"`

	// Description of the profile
	// Example: My new LXD bridge
	//
	// API extension: entity_description
	Description string `json:"description" yaml:"description"`

	// The network type
	// Read only: true
	// Example: bridge
	Type string `json:"type" yaml:"type"`

	// Whether this is a LXD managed network
	// Read only: true
	// Example: true
	//
	// API extension: network
	Managed bool `json:"managed" yaml:"managed"`

	// The state of the network (for managed network in clusters)
	// Read only: true
	// Example: Created
	//
	// API extension: clustering
	Status string `json:"status" yaml:"status"`

	// Network configuration map (refer to doc/networks.md)
	// Example: {"ipv4.address": "10.0.0.1/24", "ipv4.nat": "true", "ipv6.address": "none"}
	Config map[string]string `json:"config" yaml:"config"`

	// List of URLs of objects using this profile
	// Read only: true
	// Example: ["/1.0/profiles/default", "/1.0/instances/c1"]
	UsedBy []string `json:"used_by" yaml:"used_by"`

	// Cluster members on which the network has been defined
	// Read only: true
	// Example: ["lxd01", "lxd02", "lxd03"]
	//
	// API extension: clustering
	Locations []string `json:"locations" yaml:"locations"`
}

Network represents a LXD network

swagger:model

func (*Network) SetWritable

func (network *Network) SetWritable(put NetworkPut)

SetWritable sets applicable values from NetworkPut struct to Network struct.

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 {
	// The new name for the ACL
	// Example: bar
	Name string `json:"name" yaml:"name"` // Name of ACL.

	// Description of the ACL
	// Example: Web servers
	Description string `json:"description" yaml:"description"`

	// List of egress rules (order independent)
	Egress []NetworkACLRule `json:"egress" yaml:"egress"`

	// List of ingress rules (order independent)
	Ingress []NetworkACLRule `json:"ingress" yaml:"ingress"`

	// ACL configuration map (refer to doc/network-acls.md)
	// Example: {"user.mykey": "foo"}
	Config map[string]string `json:"config" yaml:"config"`

	// List of URLs of objects using this profile
	// Read only: true
	// Example: ["/1.0/instances/c1", "/1.0/instances/v1", "/1.0/networks/lxdbr0"]
	UsedBy []string `json:"used_by" yaml:"used_by"` // Resources that use the ACL.
}

NetworkACL used for displaying an ACL.

swagger:model

API extension: network_acl.

func (*NetworkACL) SetWritable

func (acl *NetworkACL) SetWritable(put NetworkACLPut)

SetWritable sets applicable values from NetworkACLPut struct to NetworkACL struct.

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 {

	// The new name for the ACL
	// Example: bar
	Name string `json:"name" yaml:"name"` // Name of ACL.
}

NetworkACLPost used for renaming an ACL.

swagger:model

API extension: network_acl.

type NetworkACLPut

type NetworkACLPut struct {

	// Description of the ACL
	// Example: Web servers
	Description string `json:"description" yaml:"description"`

	// List of egress rules (order independent)
	Egress []NetworkACLRule `json:"egress" yaml:"egress"`

	// List of ingress rules (order independent)
	Ingress []NetworkACLRule `json:"ingress" yaml:"ingress"`

	// ACL configuration map (refer to doc/network-acls.md)
	// Example: {"user.mykey": "foo"}
	Config map[string]string `json:"config" yaml:"config"`
}

NetworkACLPut used for updating an ACL.

swagger:model

API extension: network_acl.

type NetworkACLRule

type NetworkACLRule struct {

	// Action to perform on rule match
	// Example: allow
	Action string `json:"action" yaml:"action"`

	// Source address
	// Example: @internal
	Source string `json:"source,omitempty" yaml:"source,omitempty"`

	// Destination address
	// Example: 8.8.8.8/32,8.8.4.4/32
	Destination string `json:"destination,omitempty" yaml:"destination,omitempty"`

	// Protocol
	// Example: udp
	Protocol string `json:"protocol,omitempty" yaml:"protocol,omitempty"`

	// Source port
	// Example: 1234
	SourcePort string `json:"source_port,omitempty" yaml:"source_port,omitempty"`

	// Destination port
	// Example: 53
	DestinationPort string `json:"destination_port,omitempty" yaml:"destination_port,omitempty"`

	// Type of ICMP message (for ICMP protocol)
	// Example: 8
	ICMPType string `json:"icmp_type,omitempty" yaml:"icmp_type,omitempty"`

	// ICMP message code (for ICMP protocol)
	// Example: 0
	ICMPCode string `json:"icmp_code,omitempty" yaml:"icmp_code,omitempty"`

	// Description of the rule
	// Example: Allow DNS queries to Google DNS
	Description string `json:"description,omitempty" yaml:"description,omitempty"`

	// State of the rule
	// Example: enabled
	State string `json:"state" yaml:"state"`
}

NetworkACLRule represents a single rule in an ACL ruleset. Refer to doc/network-acls.md for details.

swagger:model

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.

swagger:model

API extension: network_acl.

type NetworkAllocations

type NetworkAllocations struct {
	// The network address of the allocation (in CIDR format)
	// Example: 192.0.2.1/24
	Address string `json:"addresses" yaml:"addresses"`
	// Name of the entity consuming the network address
	UsedBy string `json:"used_by" yaml:"used_by"`
	// Type of the entity consuming the network address
	Type string `json:"type" yaml:"type"`
	// Whether the entity comes from a network that LXD performs egress source NAT on
	NAT bool `json:"nat" yaml:"nat"`
	// Hwaddr is the MAC address of the entity consuming the network address
	Hwaddr string `json:"hwaddr" yaml:"hwaddr"`
	// Network is the name of the network the allocated address belongs to
	Network string `json:"network" yaml:"network"`
}

NetworkAllocations used for displaying network addresses used by a consuming entity e.g, instance, network forward, load-balancer, network...

swagger:model

API extension: network_allocations.

type NetworkForward

type NetworkForward struct {
	// The listen address of the forward
	// Example: 192.0.2.1
	ListenAddress string `json:"listen_address" yaml:"listen_address"`

	// What cluster member this record was found on
	// Example: lxd01
	Location string `json:"location" yaml:"location"`

	// Description of the forward listen IP
	// Example: My public IP forward
	Description string `json:"description" yaml:"description"`

	// Forward configuration map (refer to doc/network-forwards.md)
	// Example: {"user.mykey": "foo"}
	Config map[string]string `json:"config" yaml:"config"`

	// Port forwards (optional)
	Ports []NetworkForwardPort `json:"ports" yaml:"ports"`
}

NetworkForward used for displaying an network address forward.

swagger:model

API extension: network_forward.

func (*NetworkForward) Etag

func (f *NetworkForward) Etag() []any

Etag returns the values used for etag generation.

func (*NetworkForward) Normalise

func (f *NetworkForward) Normalise()

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

func (*NetworkForward) SetWritable

func (f *NetworkForward) SetWritable(put NetworkForwardPut)

SetWritable sets applicable values from NetworkForwardPut struct to NetworkForward struct.

func (*NetworkForward) Writable

func (f *NetworkForward) Writable() NetworkForwardPut

Writable converts a full NetworkForward struct into a NetworkForwardPut struct (filters read-only fields).

type NetworkForwardPort

type NetworkForwardPort struct {

	// Description of the forward port
	// Example: My web server forward
	Description string `json:"description" yaml:"description"`

	// Protocol for port forward (either tcp or udp)
	// Example: tcp
	Protocol string `json:"protocol" yaml:"protocol"`

	// ListenPort(s) to forward (comma delimited ranges)
	// Example: 80,81,8080-8090
	ListenPort string `json:"listen_port" yaml:"listen_port"`

	// TargetPort(s) to forward ListenPorts to (allows for many-to-one)
	// Example: 80,81,8080-8090
	TargetPort string `json:"target_port" yaml:"target_port"`

	// TargetAddress to forward ListenPorts to
	// Example: 198.51.100.2
	TargetAddress string `json:"target_address" yaml:"target_address"`
}

NetworkForwardPort represents a port specification in a network address forward

swagger:model

API extension: network_forward.

func (*NetworkForwardPort) Normalise

func (p *NetworkForwardPort) Normalise()

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

type NetworkForwardPut

type NetworkForwardPut struct {

	// Description of the forward listen IP
	// Example: My public IP forward
	Description string `json:"description" yaml:"description"`

	// Forward configuration map (refer to doc/network-forwards.md)
	// Example: {"user.mykey": "foo"}
	Config map[string]string `json:"config" yaml:"config"`

	// Port forwards (optional)
	Ports []NetworkForwardPort `json:"ports" yaml:"ports"`
}

NetworkForwardPut represents the modifiable fields of a LXD network address forward

swagger:model

API extension: network_forward.

func (*NetworkForwardPut) Normalise

func (f *NetworkForwardPut) Normalise()

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

type NetworkForwardsPost

type NetworkForwardsPost struct {
	NetworkForwardPut `yaml:",inline"`

	// The listen address of the forward
	// Example: 192.0.2.1
	ListenAddress string `json:"listen_address" yaml:"listen_address"`
}

NetworkForwardsPost represents the fields of a new LXD network address forward

swagger:model

API extension: network_forward.

func (*NetworkForwardsPost) Normalise

func (f *NetworkForwardsPost) Normalise()

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

type NetworkLease

type NetworkLease struct {
	// The hostname associated with the record
	// Example: c1
	Hostname string `json:"hostname" yaml:"hostname"`

	// The MAC address
	// Example: 00:16:3e:2c:89:d9
	Hwaddr string `json:"hwaddr" yaml:"hwaddr"`

	// The IP address
	// Example: 10.0.0.98
	Address string `json:"address" yaml:"address"`

	// The type of record (static or dynamic)
	// Example: dynamic
	Type string `json:"type" yaml:"type"`

	// What cluster member this record was found on
	// Example: lxd01
	//
	// API extension: network_leases_location
	Location string `json:"location" yaml:"location"`

	// Name of the project of the entity related to the hostname
	// Example: default
	//
	// API extension: network_allocations_ovn_uplink
	Project string `json:"project" yaml:"project"`
}

NetworkLease represents a DHCP lease

swagger:model

API extension: network_leases.

type NetworkLoadBalancer

type NetworkLoadBalancer struct {
	// The listen address of the load balancer
	// Example: 192.0.2.1
	ListenAddress string `json:"listen_address" yaml:"listen_address"`

	// What cluster member this record was found on
	// Example: lxd01
	Location string `json:"location" yaml:"location"`

	// Description of the load balancer listen IP
	// Example: My public IP load balancer
	Description string `json:"description" yaml:"description"`

	// Load balancer configuration map (refer to doc/network-load-balancers.md)
	// Example: {"user.mykey": "foo"}
	Config map[string]string `json:"config" yaml:"config"`

	// Backends (optional)
	Backends []NetworkLoadBalancerBackend `json:"backends" yaml:"backends"`

	// Port forwards (optional)
	Ports []NetworkLoadBalancerPort `json:"ports" yaml:"ports"`
}

NetworkLoadBalancer used for displaying a network load balancer

swagger:model

API extension: network_load_balancer.

func (*NetworkLoadBalancer) Etag

func (lb *NetworkLoadBalancer) Etag() []any

Etag returns the values used for etag generation.

func (*NetworkLoadBalancer) Normalise

func (lb *NetworkLoadBalancer) Normalise()

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

func (*NetworkLoadBalancer) SetWritable

func (lb *NetworkLoadBalancer) SetWritable(put NetworkLoadBalancerPut)

SetWritable sets applicable values from NetworkLoadBalancerPut struct to NetworkLoadBalancer struct.

func (*NetworkLoadBalancer) Writable

Writable converts a full NetworkLoadBalancer struct into a NetworkLoadBalancerPut struct (filters read-only fields).

type NetworkLoadBalancerBackend

type NetworkLoadBalancerBackend struct {

	// Name of the load balancer backend
	// Example: c1-http
	Name string `json:"name" yaml:"name"`

	// Description of the load balancer backend
	// Example: C1 webserver
	Description string `json:"description" yaml:"description"`

	// TargetPort(s) to forward ListenPorts to (allows for many-to-one)
	// Example: 80,81,8080-8090
	TargetPort string `json:"target_port" yaml:"target_port"`

	// TargetAddress to forward ListenPorts to
	// Example: 198.51.100.2
	TargetAddress string `json:"target_address" yaml:"target_address"`
}

NetworkLoadBalancerBackend represents a target backend specification in a network load balancer

swagger:model

API extension: network_load_balancer.

func (*NetworkLoadBalancerBackend) Normalise

func (b *NetworkLoadBalancerBackend) Normalise()

Normalise normalises the fields in the load balancer backend so that they are comparable with ones stored.

type NetworkLoadBalancerPort

type NetworkLoadBalancerPort struct {

	// Description of the load balancer port
	// Example: My web server load balancer
	Description string `json:"description" yaml:"description"`

	// Protocol for load balancer port (either tcp or udp)
	// Example: tcp
	Protocol string `json:"protocol" yaml:"protocol"`

	// ListenPort(s) of load balancer (comma delimited ranges)
	// Example: 80,81,8080-8090
	ListenPort string `json:"listen_port" yaml:"listen_port"`

	// TargetBackend backend names to load balance ListenPorts to
	// Example: ["c1-http","c2-http"]
	TargetBackend []string `json:"target_backend" yaml:"target_backend"`
}

NetworkLoadBalancerPort represents a port specification in a network load balancer

swagger:model

API extension: network_load_balancer.

func (*NetworkLoadBalancerPort) Normalise

func (p *NetworkLoadBalancerPort) Normalise()

Normalise normalises the fields in the load balancer port so that they are comparable with ones stored.

type NetworkLoadBalancerPut

type NetworkLoadBalancerPut struct {

	// Description of the load balancer listen IP
	// Example: My public IP load balancer
	Description string `json:"description" yaml:"description"`

	// Load balancer configuration map (refer to doc/network-load-balancers.md)
	// Example: {"user.mykey": "foo"}
	Config map[string]string `json:"config" yaml:"config"`

	// Backends (optional)
	Backends []NetworkLoadBalancerBackend `json:"backends" yaml:"backends"`

	// Port forwards (optional)
	Ports []NetworkLoadBalancerPort `json:"ports" yaml:"ports"`
}

NetworkLoadBalancerPut represents the modifiable fields of a LXD network load balancer

swagger:model

API extension: network_load_balancer.

func (*NetworkLoadBalancerPut) Normalise

func (f *NetworkLoadBalancerPut) Normalise()

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

type NetworkLoadBalancersPost

type NetworkLoadBalancersPost struct {
	NetworkLoadBalancerPut `yaml:",inline"`

	// The listen address of the load balancer
	// Example: 192.0.2.1
	ListenAddress string `json:"listen_address" yaml:"listen_address"`
}

NetworkLoadBalancersPost represents the fields of a new LXD network load balancer

swagger:model

API extension: network_load_balancer.

type NetworkPeer

type NetworkPeer struct {
	// Name of the peer
	// Read only: true
	// Example: project1-network1
	Name string `json:"name" yaml:"name"`

	// Description of the peer
	// Example: Peering with network1 in project1
	Description string `json:"description" yaml:"description"`

	// Name of the target project
	// Read only: true
	// Example: project1
	TargetProject string `json:"target_project" yaml:"target_project"`

	// Name of the target network
	// Read only: true
	// Example: network1
	TargetNetwork string `json:"target_network" yaml:"target_network"`

	// The state of the peering
	// Read only: true
	// Example: Pending
	Status string `json:"status" yaml:"status"`

	// Peer configuration map (refer to doc/network-peers.md)
	// Example: {"user.mykey": "foo"}
	Config map[string]string `json:"config" yaml:"config"`

	// List of URLs of objects using this network peering
	// Read only: true
	// Example: ["/1.0/network-acls/test", "/1.0/network-acls/foo"]
	UsedBy []string `json:"used_by" yaml:"used_by"`
}

NetworkPeer used for displaying a LXD network peering.

swagger:model

API extension: network_forward.

func (*NetworkPeer) Etag

func (p *NetworkPeer) Etag() []any

Etag returns the values used for etag generation.

func (*NetworkPeer) SetWritable

func (p *NetworkPeer) SetWritable(put NetworkPeerPut)

SetWritable sets applicable values from NetworkPeerPut struct to NetworkPeer struct.

func (*NetworkPeer) Writable

func (p *NetworkPeer) Writable() NetworkPeerPut

Writable converts a full NetworkPeer struct into a NetworkPeerPut struct (filters read-only fields).

type NetworkPeerPut

type NetworkPeerPut struct {

	// Description of the peer
	// Example: Peering with network1 in project1
	Description string `json:"description" yaml:"description"`

	// Peer configuration map (refer to doc/network-peers.md)
	// Example: {"user.mykey": "foo"}
	Config map[string]string `json:"config" yaml:"config"`
}

NetworkPeerPut represents the modifiable fields of a LXD network peering

swagger:model

API extension: network_peer.

type NetworkPeersPost

type NetworkPeersPost struct {
	NetworkPeerPut `yaml:",inline"`

	// Name of the peer
	// Example: project1-network1
	Name string `json:"name" yaml:"name"`

	// Name of the target project
	// Example: project1
	TargetProject string `json:"target_project" yaml:"target_project"`

	// Name of the target network
	// Example: network1
	TargetNetwork string `json:"target_network" yaml:"target_network"`
}

NetworkPeersPost represents the fields of a new LXD network peering

swagger:model

API extension: network_peer.

type NetworkPost

type NetworkPost struct {
	// The new name for the network
	// Example: lxdbr1
	Name string `json:"name" yaml:"name"`
}

NetworkPost represents the fields required to rename a LXD network

swagger:model

API extension: network.

type NetworkPut

type NetworkPut struct {
	// Network configuration map (refer to doc/networks.md)
	// Example: {"ipv4.address": "10.0.0.1/24", "ipv4.nat": "true", "ipv6.address": "none"}
	Config map[string]string `json:"config" yaml:"config"`

	// Description of the profile
	// Example: My new LXD bridge
	//
	// API extension: entity_description
	Description string `json:"description" yaml:"description"`
}

NetworkPut represents the modifiable fields of a LXD network

swagger:model

API extension: network.

type NetworkState

type NetworkState struct {
	// List of addresses
	Addresses []NetworkStateAddress `json:"addresses" yaml:"addresses"`

	// Interface counters
	Counters NetworkStateCounters `json:"counters" yaml:"counters"`

	// MAC address
	// Example: 00:16:3e:5a:83:57
	Hwaddr string `json:"hwaddr" yaml:"hwaddr"`

	// MTU
	// Example: 1500
	Mtu int `json:"mtu" yaml:"mtu"`

	// Link state
	// Example: up
	State string `json:"state" yaml:"state"`

	// Interface type
	// Example: broadcast
	Type string `json:"type" yaml:"type"`

	// Additional bond interface information
	//
	// API extension: network_state_bond_bridge
	Bond *NetworkStateBond `json:"bond" yaml:"bond"`

	// Additional bridge interface information
	//
	// API extension: network_state_bond_bridge
	Bridge *NetworkStateBridge `json:"bridge" yaml:"bridge"`

	// Additional vlan interface information
	//
	// API extension: network_state_vlan
	VLAN *NetworkStateVLAN `json:"vlan" yaml:"vlan"`

	// Additional OVN network information
	//
	// API extension: network_state_ovn
	OVN *NetworkStateOVN `json:"ovn" yaml:"ovn"`
}

NetworkState represents the network state

swagger:model

type NetworkStateAddress

type NetworkStateAddress struct {
	// Address family
	// Example: inet
	Family string `json:"family" yaml:"family"`

	// IP address
	// Example: 10.0.0.1
	Address string `json:"address" yaml:"address"`

	// IP netmask (CIDR)
	// Example: 24
	Netmask string `json:"netmask" yaml:"netmask"`

	// Address scope
	// Example: global
	Scope string `json:"scope" yaml:"scope"`
}

NetworkStateAddress represents a network address

swagger:model

type NetworkStateBond

type NetworkStateBond struct {
	// Bonding mode
	// Example: 802.3ad
	Mode string `json:"mode" yaml:"mode"`

	// Transmit balancing policy
	// Example: layer3+4
	TransmitPolicy string `json:"transmit_policy" yaml:"transmit_policy"`

	// Delay on link up (ms)
	// Example: 0
	UpDelay uint64 `json:"up_delay" yaml:"up_delay"`

	// Delay on link down (ms)
	// Example: 0
	DownDelay uint64 `json:"down_delay" yaml:"down_delay"`

	// How often to check for link state (ms)
	// Example: 100
	MIIFrequency uint64 `json:"mii_frequency" yaml:"mii_frequency"`

	// Bond link state
	// Example: up
	MIIState string `json:"mii_state" yaml:"mii_state"`

	// List of devices that are part of the bond
	// Example: ["eth0", "eth1"]
	LowerDevices []string `json:"lower_devices" yaml:"lower_devices"`
}

NetworkStateBond represents bond specific state

swagger:model

API extension: network_state_bond_bridge.

type NetworkStateBridge

type NetworkStateBridge struct {
	// Bridge ID
	// Example: 8000.0a0f7c6edbd9
	ID string `json:"id" yaml:"id"`

	// Whether STP is enabled
	// Example: false
	STP bool `json:"stp" yaml:"stp"`

	// Delay on port join (ms)
	// Example: 1500
	ForwardDelay uint64 `json:"forward_delay" yaml:"forward_delay"`

	// Default VLAN ID
	// Example: 1
	VLANDefault uint64 `json:"vlan_default" yaml:"vlan_default"`

	// Whether VLAN filtering is enabled
	// Example: false
	VLANFiltering bool `json:"vlan_filtering" yaml:"vlan_filtering"`

	// List of devices that are in the bridge
	// Example: ["eth0", "eth1"]
	UpperDevices []string `json:"upper_devices" yaml:"upper_devices"`
}

NetworkStateBridge represents bridge specific state

swagger:model

API extension: network_state_bond_bridge.

type NetworkStateCounters

type NetworkStateCounters struct {
	// Number of bytes received
	// Example: 250542118
	BytesReceived int64 `json:"bytes_received" yaml:"bytes_received"`

	// Number of bytes sent
	// Example: 17524040140
	BytesSent int64 `json:"bytes_sent" yaml:"bytes_sent"`

	// Number of packets received
	// Example: 1182515
	PacketsReceived int64 `json:"packets_received" yaml:"packets_received"`

	// Number of packets sent
	// Example: 1567934
	PacketsSent int64 `json:"packets_sent" yaml:"packets_sent"`
}

NetworkStateCounters represents packet counters

swagger:model

type NetworkStateOVN

type NetworkStateOVN struct {
	// OVN network chassis name
	Chassis string `json:"chassis" yaml:"chassis"`
}

NetworkStateOVN represents OVN specific state

swagger:model

API extension: network_state_ovn.

type NetworkStateVLAN

type NetworkStateVLAN struct {
	// Parent device
	// Example: eth0
	LowerDevice string `json:"lower_device" yaml:"lower_device"`

	// VLAN ID
	// Example: 100
	VID uint64 `json:"vid" yaml:"vid"`
}

NetworkStateVLAN represents VLAN specific state

swagger:model

API extension: network_state_vlan.

type NetworkZone

type NetworkZone struct {
	// The name of the zone (DNS domain name)
	// Example: example.net
	Name string `json:"name" yaml:"name"`

	// Description of the network zone
	// Example: Internal domain
	Description string `json:"description" yaml:"description"`

	// Zone configuration map (refer to doc/network-zones.md)
	// Example: {"user.mykey": "foo"}
	Config map[string]string `json:"config" yaml:"config"`

	// List of URLs of objects using this network zone
	// Read only: true
	// Example: ["/1.0/networks/foo", "/1.0/networks/bar"]
	UsedBy []string `json:"used_by" yaml:"used_by"` // Resources that use the zone.
}

NetworkZone represents a network zone (DNS).

swagger:model

API extension: network_dns.

func (*NetworkZone) SetWritable

func (zone *NetworkZone) SetWritable(put NetworkZonePut)

SetWritable sets applicable values from NetworkZonePut struct to NetworkZone struct.

func (*NetworkZone) Writable

func (zone *NetworkZone) Writable() NetworkZonePut

Writable converts a full NetworkZone struct into a NetworkZonePut struct (filters read-only fields).

type NetworkZonePut

type NetworkZonePut struct {
	// Description of the network zone
	// Example: Internal domain
	Description string `json:"description" yaml:"description"`

	// Zone configuration map (refer to doc/network-zones.md)
	// Example: {"user.mykey": "foo"}
	Config map[string]string `json:"config" yaml:"config"`
}

NetworkZonePut represents the modifiable fields of a LXD network zone

swagger:model

API extension: network_dns.

type NetworkZoneRecord

type NetworkZoneRecord struct {
	// The name of the record
	// Example: @
	Name string `json:"name" yaml:"name"`

	// Description of the record
	// Example: SPF record
	Description string `json:"description" yaml:"description"`

	// Entries in the record
	Entries []NetworkZoneRecordEntry `json:"entries" yaml:"entries"`

	// Advanced configuration for the record
	// Example: {"user.mykey": "foo"}
	Config map[string]string `json:"config" yaml:"config"`
}

NetworkZoneRecord represents a network zone (DNS) record.

swagger:model

API extension: network_dns_records.

func (*NetworkZoneRecord) SetWritable

func (record *NetworkZoneRecord) SetWritable(put NetworkZoneRecordPut)

SetWritable sets applicable values from NetworkZoneRecordPut struct to NetworkZoneRecord struct.

func (*NetworkZoneRecord) Writable

func (record *NetworkZoneRecord) Writable() NetworkZoneRecordPut

Writable converts a full NetworkZoneRecord struct into a NetworkZoneRecordPut struct (filters read-only fields).

type NetworkZoneRecordEntry

type NetworkZoneRecordEntry struct {
	// Type of DNS entry
	// Example: TXT
	Type string `json:"type" yaml:"type"`

	// TTL for the entry
	// Example: 3600
	TTL uint64 `json:"ttl,omitempty" yaml:"ttl,omitempty"`

	// Value for the record
	// Example: v=spf1 mx ~all
	Value string `json:"value" yaml:"value"`
}

NetworkZoneRecordEntry represents the fields in a record entry

swagger:model

API extension: network_dns_records.

type NetworkZoneRecordPut

type NetworkZoneRecordPut struct {
	// Description of the record
	// Example: SPF record
	Description string `json:"description" yaml:"description"`

	// Entries in the record
	Entries []NetworkZoneRecordEntry `json:"entries" yaml:"entries"`

	// Advanced configuration for the record
	// Example: {"user.mykey": "foo"}
	Config map[string]string `json:"config" yaml:"config"`
}

NetworkZoneRecordPut represents the modifiable fields of a LXD network zone record

swagger:model

API extension: network_dns_records.

type NetworkZoneRecordsPost

type NetworkZoneRecordsPost struct {
	NetworkZoneRecordPut `yaml:",inline"`

	// The record name in the zone
	// Example: @
	Name string `json:"name" yaml:"name"`
}

NetworkZoneRecordsPost represents the fields of a new LXD network zone record

swagger:model

API extension: network_dns_records.

type NetworkZonesPost

type NetworkZonesPost struct {
	NetworkZonePut `yaml:",inline"`

	// The name of the zone (DNS domain name)
	// Example: example.net
	Name string `json:"name" yaml:"name"`
}

NetworkZonesPost represents the fields of a new LXD network zone

swagger:model

API extension: network_dns.

type NetworksPost

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

	// The name of the new network
	// Example: lxdbr1
	Name string `json:"name" yaml:"name"`

	// The network type (refer to doc/networks.md)
	// Example: bridge
	Type string `json:"type" yaml:"type"`
}

NetworksPost represents the fields of a new LXD network

swagger:model

API extension: network.

type Operation

type Operation struct {
	// UUID of the operation
	// Example: 6916c8a6-9b7d-4abd-90b3-aedfec7ec7da
	ID string `json:"id" yaml:"id"`

	// Type of operation (task, token or websocket)
	// Example: websocket
	Class string `json:"class" yaml:"class"`

	// Description of the operation
	// Example: Executing command
	Description string `json:"description" yaml:"description"`

	// Operation creation time
	// Example: 2021-03-23T17:38:37.753398689-04:00
	CreatedAt time.Time `json:"created_at" yaml:"created_at"`

	// Operation last change
	// Example: 2021-03-23T17:38:37.753398689-04:00
	UpdatedAt time.Time `json:"updated_at" yaml:"updated_at"`

	// Status name
	// Example: Running
	Status string `json:"status" yaml:"status"`

	// Status code
	// Example: 103
	StatusCode StatusCode `json:"status_code" yaml:"status_code"`

	// Affected resourcs
	// Example: {"containers": ["/1.0/containers/foo"], "instances": ["/1.0/instances/foo"]}
	Resources map[string][]string `json:"resources" yaml:"resources"`

	// Operation specific metadata
	// Example: {"command": ["bash"], "environment": {"HOME": "/root", "LANG": "C.UTF-8", "PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "TERM": "xterm", "USER": "root"}, "fds": {"0": "da3046cf02c0116febf4ef3fe4eaecdf308e720c05e5a9c730ce1a6f15417f66", "1": "05896879d8692607bd6e4a09475667da3b5f6714418ab0ee0e5720b4c57f754b"}, "interactive": true}
	Metadata map[string]any `json:"metadata" yaml:"metadata"`

	// Whether the operation can be canceled
	// Example: false
	MayCancel bool `json:"may_cancel" yaml:"may_cancel"`

	// Operation error mesage
	// Example: Some error message
	Err string `json:"err" yaml:"err"`

	// What cluster member this record was found on
	// Example: lxd01
	//
	// API extension: operation_location
	Location string `json:"location" yaml:"location"`
}

Operation represents a LXD background operation

swagger:model

func (*Operation) ToCertificateAddToken

func (op *Operation) ToCertificateAddToken() (*CertificateAddToken, error)

ToCertificateAddToken creates a certificate add token from the operation metadata.

func (*Operation) ToClusterJoinToken

func (op *Operation) ToClusterJoinToken() (*ClusterMemberJoinToken, error)

ToClusterJoinToken creates a cluster join token from the operation metadata.

type Permission

type Permission struct {
	// EntityType is the string representation of the entity type.
	// Example: instance
	EntityType string `json:"entity_type" yaml:"entity_type"`

	// EntityReference is the URL of the entity that the permission applies to.
	// Example: /1.0/instances/c1?project=default
	EntityReference string `json:"url" yaml:"url"`

	// Entitlement is the entitlement define for the entity type.
	// Example: can_view
	Entitlement string `json:"entitlement" yaml:"entitlement"`
}

Permission represents a permission that may be granted to a group.

swagger:model

API extension: access_management.

type PermissionInfo

type PermissionInfo struct {
	Permission `yaml:",inline"`

	// Groups is a list of groups that have the Entitlement on the Entity.
	// Example: ["foo", "bar"]
	Groups []string `json:"groups" yaml:"groups"`
}

PermissionInfo expands a Permission to include any groups that may have the specified Permission.

swagger:model

API extension: access_management.

type Profile

type Profile struct {
	// The profile name
	// Read only: true
	// Example: foo
	Name string `json:"name" yaml:"name" db:"primary=yes"`

	// Description of the profile
	// Example: Medium size instances
	Description string `json:"description" yaml:"description"`

	// Instance configuration map (refer to doc/instances.md)
	// Example: {"limits.cpu": "4", "limits.memory": "4GiB"}
	Config map[string]string `json:"config" yaml:"config"`

	// List of devices
	// Example: {"root": {"type": "disk", "pool": "default", "path": "/"}, "eth0": {"type": "nic", "network": "lxdbr0", "name": "eth0"}}
	Devices map[string]map[string]string `json:"devices" yaml:"devices"`

	// List of URLs of objects using this profile
	// Read only: true
	// Example: ["/1.0/instances/c1", "/1.0/instances/v1"]
	//
	// API extension: profile_usedby
	UsedBy []string `json:"used_by" yaml:"used_by"`
}

Profile represents a LXD profile

swagger:model

func (*Profile) SetWritable

func (profile *Profile) SetWritable(put ProfilePut)

SetWritable sets applicable values from ProfilePut struct to Profile struct.

func (*Profile) URL

func (profile *Profile) URL(apiVersion string, projectName string) *URL

URL returns the URL for the 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 {
	// The new name for the profile
	// Example: bar
	Name string `json:"name" yaml:"name"`
}

ProfilePost represents the fields required to rename a LXD profile

swagger:model

type ProfilePut

type ProfilePut struct {
	// Instance configuration map (refer to doc/instances.md)
	// Example: {"limits.cpu": "4", "limits.memory": "4GiB"}
	Config map[string]string `json:"config" yaml:"config"`

	// Description of the profile
	// Example: Medium size instances
	Description string `json:"description" yaml:"description"`

	// List of devices
	// Example: {"root": {"type": "disk", "pool": "default", "path": "/"}, "eth0": {"type": "nic", "network": "lxdbr0", "name": "eth0"}}
	Devices map[string]map[string]string `json:"devices" yaml:"devices"`
}

ProfilePut represents the modifiable fields of a LXD profile

swagger:model

type ProfilesPost

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

	// The name of the new profile
	// Example: foo
	Name string `json:"name" yaml:"name" db:"primary=yes"`
}

ProfilesPost represents the fields of a new LXD profile

swagger:model

type Project

type Project struct {
	// The project name
	// Read only: true
	// Example: foo
	Name string `json:"name" yaml:"name"`

	// Description of the project
	// Example: My new project
	Description string `json:"description" yaml:"description"`

	// Project configuration map (refer to doc/projects.md)
	// Example: {"features.profiles": "true", "features.networks": "false"}
	Config map[string]string `json:"config" yaml:"config"`

	// List of URLs of objects using this project
	// Read only: true
	// Example: ["/1.0/images/0e60015346f06627f10580d56ac7fffd9ea775f6d4f25987217d5eed94910a20", "/1.0/instances/c1", "/1.0/networks/lxdbr0", "/1.0/profiles/default", "/1.0/storage-pools/default/volumes/custom/blah"]
	UsedBy []string `json:"used_by" yaml:"used_by"`
}

Project represents a LXD project

swagger:model

API extension: projects.

func (*Project) SetWritable

func (project *Project) SetWritable(put ProjectPut)

SetWritable sets applicable values from ProjectPut struct to Project struct.

func (*Project) URL

func (project *Project) URL(apiVersion string) *URL

URL returns the URL for the project.

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 {
	// The new name for the project
	// Example: bar
	Name string `json:"name" yaml:"name"`
}

ProjectPost represents the fields required to rename a LXD project

swagger:model

API extension: projects.

type ProjectPut

type ProjectPut struct {
	// Project configuration map (refer to doc/projects.md)
	// Example: {"features.profiles": "true", "features.networks": "false"}
	Config map[string]string `json:"config" yaml:"config"`

	// Description of the project
	// Example: My new project
	Description string `json:"description" yaml:"description"`
}

ProjectPut represents the modifiable fields of a LXD project

swagger:model

API extension: projects.

type ProjectState

type ProjectState struct {
	// Allocated and used resources
	// Read only: true
	// Example: {"containers": {"limit": 10, "usage": 4}, "cpu": {"limit": 20, "usage": 16}}
	Resources map[string]ProjectStateResource `json:"resources" yaml:"resources"`
}

ProjectState represents the current running state of a LXD project

swagger:model

API extension: project_usage.

type ProjectStateResource

type ProjectStateResource struct {
	// Limit for the resource (-1 if none)
	// Example: 10
	Limit int64

	// Current usage for the resource
	// Example: 4
	Usage int64
}

ProjectStateResource represents the state of a particular resource in a LXD project

swagger:model

API extension: project_usage.

type ProjectsPost

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

	// The name of the new project
	// Example: foo
	Name string `json:"name" yaml:"name"`
}

ProjectsPost represents the fields of a new LXD project

swagger:model

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

swagger:model

API extension: resources.

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

swagger:model

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

swagger:model

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

swagger:model

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

swagger:model

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

swagger:model

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

swagger:model

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

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

ResourcesGPUCard represents a GPU card on the system

swagger:model

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

swagger:model

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

swagger:model

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

swagger:model

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

swagger:model

API extension: resources_v2.

type ResourcesMemory

type ResourcesMemory struct {
	// List of NUMA memory nodes
	// Example: null
	//
	// 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

swagger:model

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

swagger:model

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

swagger:model

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

	// vDPA information (when supported by the card)
	//
	// API extension: ovn_nic_acceleration_vdpa
	VDPA *ResourcesNetworkCardVDPA `json:"vdpa,omitempty" yaml:"vdpa,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

swagger:model

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

swagger:model

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

swagger:model

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

swagger:model

API extension: resources_v2.

type ResourcesNetworkCardVDPA

type ResourcesNetworkCardVDPA struct {
	// Name of the VDPA device
	Name string `json:"name" yaml:"name"`

	// Device identifier of the VDPA device
	Device string `json:"device" yaml:"device"`
}

ResourceNetworkCardVDPA represents the VDPA configuration of the network card

swagger:model

API extension: ovn_nic_acceleration_vdpa.

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

swagger:model

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

	// Vital Product Data
	// Example:
	//
	// API extension: resources_pci_vpd
	VPD ResourcesPCIVPD `json:"vpd" yaml:"vpd"`
}

ResourcesPCIDevice represents a PCI device

swagger:model

API extension: resources_usb_pci.

type ResourcesPCIVPD

type ResourcesPCIVPD struct {
	// Hardware provided product name.
	// Example: HP Ethernet 1Gb 4-port 331i Adapter
	ProductName string `json:"product_name,omitempty" yaml:"product_name,omitempty"`

	// Vendor provided key/value pairs.
	// Example: {"EC": ""A-5545", "MN": "103C", "V0": "5W PCIeGen2"}
	Entries map[string]string `json:"entries,omitempty" yaml:"entries,omitempty"`
}

ResourcesPCIVPD represents VPD entries for a device

swagger:model

API extension: resources_pci_vpd.

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

swagger:model

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

	// Mounted status of the disk
	// Example: true
	Mounted bool `json:"mounted" yaml:"mounted"`

	// 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

swagger:model

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

	// Mounted status of the partition.
	// Example: true
	Mounted bool `json:"mounted" yaml:"mounted"`
}

ResourcesStorageDiskPartition represents a partition on a disk

swagger:model

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

swagger:model

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

swagger:model

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

swagger:model

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

swagger:model

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

swagger:model

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

swagger:model

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

swagger:model

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

swagger:model

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

	// USB serial number
	// Example: DAE005fp
	//
	// API extension: device_usb_serial.
	Serial string `json:"serial" yaml:"serial"`

	// 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

swagger:model

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

swagger:model

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]any, 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 any) 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 any `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"`

	// The current user username as seen by LXD
	// Read only: true
	// Example: uid=201105
	//
	// API extension: auth_user
	AuthUserName string `json:"auth_user_name" yaml:"auth_user_name"`

	// The current user login method as seen by LXD
	// Read only: true
	// Example: unix
	//
	// API extension: auth_user
	AuthUserMethod string `json:"auth_user_method" yaml:"auth_user_method"`

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

	// List of supported instance types
	// Example: ["container", "virtual-machine"]
	//
	// API extension: server_instance_type_info
	InstanceTypes []string `json:"instance_types" yaml:"instance_types"`

	// 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: 24.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"`

	// Mode that the event distribution subsystem is operating in on this server.
	// Either "full-mesh", "hub-server" or "hub-client".
	// Example: full-mesh
	//
	// API extension: event_hub
	ServerEventMode string `json:"server_event_mode" yaml:"server_event_mode"`

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

	// Whether the version is an LTS release
	// Example: false
	ServerLTS bool `json:"server_lts" yaml:"server_lts"`

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

	// List of supported storage drivers
	StorageSupportedDrivers []ServerStorageDriverInfo `json:"storage_supported_drivers" yaml:"storage_supported_drivers"`
}

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"}
	Config map[string]any `json:"config" yaml:"config"`
}

ServerPut represents the modifiable fields of a LXD server configuration

swagger:model

type ServerStorageDriverInfo

type ServerStorageDriverInfo struct {
	// Name of the driver
	// Example: zfs
	//
	// API extension: server_supported_storage_drivers
	Name string

	// Version of the driver
	// Example: 0.8.4-1ubuntu11
	//
	// API extension: server_supported_storage_drivers
	Version string

	// Whether the driver has remote volumes
	// Example: false
	//
	// API extension: server_supported_storage_drivers
	Remote bool
}

ServerStorageDriverInfo represents the read-only info about a storage driver

swagger:model

API extension: server_supported_storage_drivers.

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", "oidc"]
	//
	// API extension: oidc
	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
	Ready            StatusCode = 113

	Success StatusCode = 200

	Failure   StatusCode = 400
	Cancelled StatusCode = 401
)

LXD status codes.

func StatusCodeFromString

func StatusCodeFromString(status string) StatusCode

StatusCodeFromString returns the status code of the giving status name.

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 StatusError

type StatusError struct {
	// contains filtered or unexported fields
}

StatusError error type that contains an HTTP status code and message.

func NewGenericStatusError

func NewGenericStatusError(status int) StatusError

NewGenericStatusError returns a new StatusError with the given status code. The generic http.StatusText will be used for the error message.

func NewStatusError

func NewStatusError(status int, msg string) StatusError

NewStatusError returns a new StatusError with the given message and status code.

func StatusErrorf

func StatusErrorf(status int, format string, a ...any) StatusError

StatusErrorf returns a new StatusError containing the specified status and message.

func (StatusError) Error

func (e StatusError) Error() string

Error returns the error message or the http.StatusText() of the status code if error message is empty.

func (StatusError) Status

func (e StatusError) Status() int

Status returns the HTTP status code.

func (StatusError) Unwrap

func (e StatusError) Unwrap() error

Unwrap implements the xerrors.Wrapper interface for StatusError.

type StorageBucket

type StorageBucket struct {
	// Bucket name
	// Example: foo
	//
	// API extension: storage_buckets
	Name string `json:"name" yaml:"name"`

	// Description of the storage bucket
	// Example: My custom bucket
	//
	// API extension: storage_buckets
	Description string `json:"description" yaml:"description"`

	// Bucket S3 URL
	// Example: https://127.0.0.1:8080/foo
	//
	// API extension: storage_buckets
	S3URL string `json:"s3_url" yaml:"s3_url"`

	// What cluster member this record was found on
	// Example: lxd01
	//
	// API extension: storage_buckets
	Location string `json:"location" yaml:"location"`

	// Storage bucket configuration map
	// Example: {"size": "50GiB"}
	//
	// API extension: storage_buckets
	Config map[string]string `json:"config" yaml:"config"`
}

StorageBucket represents the fields of a LXD storage pool bucket

swagger:model

API extension: storage_buckets.

func (*StorageBucket) Etag

func (b *StorageBucket) Etag() []any

Etag returns the values used for etag generation.

func (*StorageBucket) SetWritable

func (b *StorageBucket) SetWritable(put StorageBucketPut)

SetWritable sets applicable values from StorageBucketPut struct to StorageBucket struct.

func (*StorageBucket) URL

func (b *StorageBucket) URL(apiVersion string, poolName string, projectName string) *URL

URL returns the URL for the bucket.

func (*StorageBucket) Writable

func (b *StorageBucket) Writable() StorageBucketPut

Writable converts a full StorageBucket struct into a StorageBucketPut struct (filters read-only fields).

type StorageBucketKey

type StorageBucketKey struct {
	// Key name
	// Example: my-read-only-key
	//
	// API extension: storage_buckets
	Name string `json:"name" yaml:"name"`

	// Description of the storage bucket key
	// Example: My read-only bucket key
	//
	// API extension: storage_buckets
	Description string `json:"description" yaml:"description"`

	// Whether the key can perform write actions or not.
	// Example: read-only
	//
	// API extension: storage_buckets
	Role string `json:"role" yaml:"role"`

	// Access key
	// Example: 33UgkaIBLBIxb7O1
	//
	// API extension: storage_buckets
	AccessKey string `json:"access-key" yaml:"access-key"`

	// Secret key
	// Example: kDQD6AOgwHgaQI1UIJBJpPaiLgZuJbq0
	//
	// API extension: storage_buckets
	SecretKey string `json:"secret-key" yaml:"secret-key"`
}

StorageBucketKey represents the fields of a LXD storage pool bucket key

swagger:model

API extension: storage_buckets.

func (*StorageBucketKey) Etag

func (b *StorageBucketKey) Etag() []any

Etag returns the values used for etag generation.

func (*StorageBucketKey) SetWritable

func (b *StorageBucketKey) SetWritable(put StorageBucketKeyPut)

SetWritable sets applicable values from StorageBucketKeyPut struct to StorageBucketKey struct.

func (*StorageBucketKey) URL

func (b *StorageBucketKey) URL(apiVersion string, poolName string, projectName string, bucketName string) *URL

URL for the deployment instance set.

func (*StorageBucketKey) Writable

func (b *StorageBucketKey) Writable() StorageBucketKeyPut

Writable converts a full StorageBucketKey struct into a StorageBucketKeyPut struct (filters read-only fields).

type StorageBucketKeyPut

type StorageBucketKeyPut struct {
	// Description of the storage bucket key
	// Example: My read-only bucket key
	//
	// API extension: storage_buckets
	Description string `json:"description" yaml:"description"`

	// Whether the key can perform write actions or not.
	// Example: read-only
	//
	// API extension: storage_buckets
	Role string `json:"role" yaml:"role"`

	// Access key
	// Example: 33UgkaIBLBIxb7O1
	//
	// API extension: storage_buckets
	AccessKey string `json:"access-key" yaml:"access-key"`

	// Secret key
	// Example: kDQD6AOgwHgaQI1UIJBJpPaiLgZuJbq0
	//
	// API extension: storage_buckets
	SecretKey string `json:"secret-key" yaml:"secret-key"`
}

StorageBucketKeyPut represents the modifiable fields of a LXD storage pool bucket key

swagger:model

API extension: storage_buckets.

type StorageBucketKeysPost

type StorageBucketKeysPost struct {
	StorageBucketKeyPut `yaml:",inline"`

	// Key name
	// Example: my-read-only-key
	//
	// API extension: storage_buckets
	Name string `json:"name" yaml:"name"`
}

StorageBucketKeysPost represents the fields of a new LXD storage pool bucket key

swagger:model

API extension: storage_buckets.

type StorageBucketPut

type StorageBucketPut struct {
	// Storage bucket configuration map
	// Example: {"size": "50GiB"}
	//
	// API extension: storage_buckets
	Config map[string]string `json:"config" yaml:"config"`

	// Description of the storage bucket
	// Example: My custom bucket
	//
	// API extension: storage_buckets
	Description string `json:"description" yaml:"description"`
}

StorageBucketPut represents the modifiable fields of a LXD storage pool bucket

swagger:model

API extension: storage_buckets.

type StorageBucketsPost

type StorageBucketsPost struct {
	StorageBucketPut `yaml:",inline"`

	// Bucket name
	// Example: foo
	//
	// API extension: storage_buckets
	Name string `json:"name" yaml:"name"`
}

StorageBucketsPost represents the fields of a new LXD storage pool bucket

swagger:model

API extension: storage_buckets.

type StoragePool

type StoragePool struct {
	// Storage pool name
	// Example: local
	Name string `json:"name" yaml:"name"`

	// Description of the storage pool
	// Example: Local SSD pool
	//
	// API extension: entity_description
	Description string `json:"description" yaml:"description"`

	// Storage pool driver (btrfs, ceph, cephfs, dir, lvm or zfs)
	// Example: zfs
	Driver string `json:"driver" yaml:"driver"`

	// Pool status (Pending, Created, Errored or Unknown)
	// Read only: true
	// Example: Created
	//
	// API extension: clustering
	Status string `json:"status" yaml:"status"`

	// Storage pool configuration map (refer to doc/storage.md)
	// Example: {"volume.block.filesystem": "ext4", "volume.size": "50GiB"}
	Config map[string]string `json:"config" yaml:"config"`

	// List of URLs of objects using this storage pool
	// Example: ["/1.0/profiles/default", "/1.0/instances/c1"]
	UsedBy []string `json:"used_by" yaml:"used_by"`

	// Cluster members on which the storage pool has been defined
	// Read only: true
	// Example: ["lxd01", "lxd02", "lxd03"]
	//
	// API extension: clustering
	Locations []string `json:"locations" yaml:"locations"`
}

StoragePool represents the fields of a LXD storage pool.

swagger:model

API extension: storage.

func (*StoragePool) SetWritable

func (storagePool *StoragePool) SetWritable(put StoragePoolPut)

SetWritable sets applicable values from StoragePoolPut struct to StoragePool struct.

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 {
	// Storage pool configuration map (refer to doc/storage.md)
	// Example: {"volume.block.filesystem": "ext4", "volume.size": "50GiB"}
	Config map[string]string `json:"config" yaml:"config"`

	// Description of the storage pool
	// Example: Local SSD pool
	//
	// API extension: entity_description
	Description string `json:"description" yaml:"description"`
}

StoragePoolPut represents the modifiable fields of a LXD storage pool.

swagger:model

API extension: storage.

type StoragePoolState

type StoragePoolState struct {
	ResourcesStoragePool `yaml:",inline"`
}

StoragePoolState represents the state of a storage pool.

swagger:model

API extension: cluster_member_state.

type StoragePoolVolumeBackup

type StoragePoolVolumeBackup struct {
	// Backup name
	// Example: backup0
	Name string `json:"name" yaml:"name"`

	// When the backup was created
	// Example: 2021-03-23T16:38:37.753398689-04:00
	CreatedAt time.Time `json:"created_at" yaml:"created_at"`

	// When the backup expires (gets auto-deleted)
	// Example: 2021-03-23T17:38:37.753398689-04:00
	ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"`

	// Whether to ignore snapshots
	// Example: false
	VolumeOnly bool `json:"volume_only" yaml:"volume_only"`

	// Whether to use a pool-optimized binary format (instead of plain tarball)
	// Example: true
	OptimizedStorage bool `json:"optimized_storage" yaml:"optimized_storage"`
}

StoragePoolVolumeBackup represents a LXD volume backup

swagger:model

API extension: custom_volume_backup.

type StoragePoolVolumeBackupPost

type StoragePoolVolumeBackupPost struct {
	// New backup name
	// Example: backup1
	Name string `json:"name" yaml:"name"`
}

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

swagger:model

API extension: custom_volume_backup.

type StoragePoolVolumeBackupsPost

type StoragePoolVolumeBackupsPost struct {
	// Backup name
	// Example: backup0
	Name string `json:"name" yaml:"name"`

	// When the backup expires (gets auto-deleted)
	// Example: 2021-03-23T17:38:37.753398689-04:00
	ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"`

	// Whether to ignore snapshots
	// Example: false
	VolumeOnly bool `json:"volume_only" yaml:"volume_only"`

	// Whether to use a pool-optimized binary format (instead of plain tarball)
	// Example: true
	OptimizedStorage bool `json:"optimized_storage" yaml:"optimized_storage"`

	// What compression algorithm to use
	// Example: gzip
	CompressionAlgorithm string `json:"compression_algorithm" yaml:"compression_algorithm"`
}

StoragePoolVolumeBackupsPost represents the fields available for a new LXD volume backup

swagger:model

API extension: custom_volume_backup.

type StoragePoolsPost

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

	// Storage pool name
	// Example: local
	Name string `json:"name" yaml:"name"`

	// Storage pool driver (btrfs, ceph, cephfs, dir, lvm or zfs)
	// Example: zfs
	Driver string `json:"driver" yaml:"driver"`
}

StoragePoolsPost represents the fields of a new LXD storage pool

swagger:model

API extension: storage.

type StorageVolume

type StorageVolume struct {
	// Volume name
	// Example: foo
	Name string `json:"name" yaml:"name"`

	// Description of the storage volume
	// Example: My custom volume
	//
	// API extension: entity_description
	Description string `json:"description" yaml:"description"`

	// Volume type
	// Example: custom
	Type string `json:"type" yaml:"type"`

	// Name of the pool the volume is using
	// Example: "default"
	//
	// API extension: storage_volumes_all
	Pool string `json:"pool" yaml:"pool"`

	// Volume content type (filesystem or block)
	// Example: filesystem
	//
	// API extension: custom_block_volumes
	ContentType string `json:"content_type" yaml:"content_type"`

	// Project containing the volume.
	// Example: default
	//
	// API extension: storage_volumes_all_projects
	Project string `json:"project" yaml:"project"`

	// What cluster member this record was found on
	// Example: lxd01
	//
	// API extension: clustering
	Location string `json:"location" yaml:"location"`

	// Volume creation timestamp
	// Example: 2021-03-23T20:00:00-04:00
	// API extension: storage_volumes_created_at
	CreatedAt time.Time `json:"created_at" yaml:"created_at"`

	// Storage volume configuration map (refer to doc/storage.md)
	// Example: {"zfs.remove_snapshots": "true", "size": "50GiB"}
	Config map[string]string `json:"config" yaml:"config"`

	// List of URLs of objects using this storage volume
	// Example: ["/1.0/instances/blah"]
	UsedBy []string `json:"used_by" yaml:"used_by"`
}

StorageVolume represents the fields of a LXD storage volume.

swagger:model

API extension: storage.

func (*StorageVolume) SetWritable

func (v *StorageVolume) SetWritable(put StorageVolumePut)

SetWritable sets applicable values from StorageVolumePut struct to StorageVolume struct.

func (*StorageVolume) URL

func (v *StorageVolume) URL(apiVersion string) *URL

URL returns the URL for the volume.

func (*StorageVolume) Writable

func (v *StorageVolume) Writable() StorageVolumePut

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

type StorageVolumePost

type StorageVolumePost struct {
	// New volume name
	// Example: foo
	Name string `json:"name" yaml:"name"`

	// New storage pool
	// Example: remote
	//
	// API extension: storage_api_local_volume_handling
	Pool string `json:"pool,omitempty" yaml:"pool,omitempty"`

	// Initiate volume migration
	// Example: false
	//
	// API extension: storage_api_remote_volume_handling
	Migration bool `json:"migration" yaml:"migration"`

	// Migration target (for push mode)
	//
	// API extension: storage_api_remote_volume_handling
	Target *StorageVolumePostTarget `json:"target" yaml:"target"`

	// Whether snapshots should be discarded (migration only)
	// Example: false
	//
	// API extension: storage_api_remote_volume_snapshots
	VolumeOnly bool `json:"volume_only" yaml:"volume_only"`

	// New project name
	// Example: foo
	//
	// API extension: storage_volume_project_move
	Project string `json:"project,omitempty" yaml:"project,omitempty"`

	// Migration source
	//
	// API extension: cluster_internal_custom_volume_copy
	Source StorageVolumeSource `json:"source" yaml:"source"`
}

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

swagger:model

API extension: storage_api_volume_rename.

type StorageVolumePostTarget

type StorageVolumePostTarget struct {
	// The certificate of the migration target
	// Example: X509 PEM certificate
	Certificate string `json:"certificate" yaml:"certificate"`

	// Remote operation URL (for migration)
	// Example: https://1.2.3.4:8443/1.0/operations/1721ae08-b6a8-416a-9614-3f89302466e1
	Operation string `json:"operation,omitempty" yaml:"operation,omitempty"`

	// Migration websockets credentials
	// Example: {"migration": "random-string"}
	Websockets map[string]string `json:"secrets,omitempty" yaml:"secrets,omitempty"`
}

StorageVolumePostTarget represents the migration target host and operation

swagger:model

API extension: storage_api_remote_volume_handling.

type StorageVolumePut

type StorageVolumePut struct {
	// Storage volume configuration map (refer to doc/storage.md)
	// Example: {"zfs.remove_snapshots": "true", "size": "50GiB"}
	Config map[string]string `json:"config" yaml:"config"`

	// Description of the storage volume
	// Example: My custom volume
	//
	// API extension: entity_description
	Description string `json:"description" yaml:"description"`

	// Name of a snapshot to restore
	// Example: snap0
	//
	// API extension: storage_api_volume_snapshots
	Restore string `json:"restore,omitempty" yaml:"restore,omitempty"`
}

StorageVolumePut represents the modifiable fields of a LXD storage volume

swagger:model

API extension: storage.

type StorageVolumeSnapshot

type StorageVolumeSnapshot struct {
	// Snapshot name
	// Example: snap0
	Name string `json:"name" yaml:"name"`

	// Description of the storage volume
	// Example: My custom volume
	Description string `json:"description" yaml:"description"`

	// The content type (filesystem or block)
	// Example: filesystem
	//
	// API extension: custom_block_volumes
	ContentType string `json:"content_type" yaml:"content_type"`

	// Volume snapshot creation timestamp
	// Example: 2021-03-23T20:00:00-04:00
	// API extension: storage_volumes_created_at
	CreatedAt time.Time `json:"created_at" yaml:"created_at"`

	// When the snapshot expires (gets auto-deleted)
	// Example: 2021-03-23T17:38:37.753398689-04:00
	//
	// API extension: custom_volume_snapshot_expiry
	ExpiresAt *time.Time `json:"expires_at" yaml:"expires_at"`

	// Storage volume configuration map (refer to doc/storage.md)
	// Example: {"zfs.remove_snapshots": "true", "size": "50GiB"}
	Config map[string]string `json:"config" yaml:"config"`
}

StorageVolumeSnapshot represents a LXD storage volume snapshot

swagger:model

API extension: storage_api_volume_snapshots.

func (*StorageVolumeSnapshot) SetWritable

func (storageVolumeSnapshot *StorageVolumeSnapshot) SetWritable(put StorageVolumeSnapshotPut)

SetWritable sets applicable values from StorageVolumeSnapshotPut struct to StorageVolumeSnapshot struct.

func (*StorageVolumeSnapshot) Writable

func (storageVolumeSnapshot *StorageVolumeSnapshot) Writable() StorageVolumeSnapshotPut

Writable converts a full StorageVolumeSnapshot struct into a StorageVolumeSnapshotPut struct (filters read-only fields).

type StorageVolumeSnapshotPost

type StorageVolumeSnapshotPost struct {
	// New snapshot name
	// Example: snap1
	Name string `json:"name" yaml:"name"`

	// Initiate volume snapshot migration
	// Example: false
	//
	// API extension: storage_api_remote_volume_snapshot_copy
	Migration bool `json:"migration" yaml:"migration"`

	// Migration target (for push mode)
	//
	// API extension: storage_api_remote_volume_snapshot_copy
	Target *StorageVolumePostTarget `json:"target" yaml:"target"`
}

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

swagger:model

API extension: storage_api_volume_snapshots.

type StorageVolumeSnapshotPut

type StorageVolumeSnapshotPut struct {
	// Description of the storage volume
	// Example: My custom volume
	Description string `json:"description" yaml:"description"`

	// When the snapshot expires (gets auto-deleted)
	// Example: 2021-03-23T17:38:37.753398689-04:00
	//
	// 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

swagger:model

API extension: storage_api_volume_snapshots.

type StorageVolumeSnapshotsPost

type StorageVolumeSnapshotsPost struct {
	// Snapshot name
	// Example: snap0
	Name string `json:"name" yaml:"name"`

	// Description of the storage volume snapshot
	// Example: My custom snapshot
	Description string `json:"description" yaml:"description"`

	// When the snapshot expires (gets auto-deleted)
	// Example: 2021-03-23T17:38:37.753398689-04:00
	//
	// 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

swagger:model

API extension: storage_api_volume_snapshots.

type StorageVolumeSource

type StorageVolumeSource struct {
	// Source volume name (for copy)
	// Example: foo
	Name string `json:"name" yaml:"name"`

	// Source type (copy or migration)
	// Example: copy
	Type string `json:"type" yaml:"type"`

	// Source storage pool (for copy)
	// Example: local
	Pool string `json:"pool" yaml:"pool"`

	// Certificate (for migration)
	// Example: X509 PEM certificate
	//
	// API extension: storage_api_remote_volume_handling
	Certificate string `json:"certificate" yaml:"certificate"`

	// Whether to use pull or push mode (for migration)
	// Example: pull
	//
	// API extension: storage_api_remote_volume_handling
	Mode string `json:"mode,omitempty" yaml:"mode,omitempty"`

	// Remote operation URL (for migration)
	// Example: https://1.2.3.4:8443/1.0/operations/1721ae08-b6a8-416a-9614-3f89302466e1
	//
	// API extension: storage_api_remote_volume_handling
	Operation string `json:"operation,omitempty" yaml:"operation,omitempty"`

	// Map of migration websockets (for migration)
	// Example: {"rsync": "RANDOM-STRING"}
	//
	// API extension: storage_api_remote_volume_handling
	Websockets map[string]string `json:"secrets,omitempty" yaml:"secrets,omitempty"`

	// Whether snapshots should be discarded (for migration)
	// Example: false
	//
	// API extension: storage_api_volume_snapshots
	VolumeOnly bool `json:"volume_only" yaml:"volume_only"`

	// Whether existing destination volume should be refreshed
	// Example: false
	//
	// API extension: custom_volume_refresh
	Refresh bool `json:"refresh" yaml:"refresh"`

	// Source project name
	// Example: foo
	//
	// API extension: storage_api_project
	Project string `json:"project,omitempty" yaml:"project,omitempty"`

	// What cluster member this record was found on
	// Example: lxd01
	//
	// API extension: cluster_internal_custom_volume_copy
	Location string `json:"location" yaml:"location"`
}

StorageVolumeSource represents the creation source for a new storage volume

swagger:model

API extension: storage_api_local_volume_handling.

type StorageVolumeState

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

StorageVolumeState represents the live state of the volume

swagger:model

API extension: storage_volume_state.

type StorageVolumeStateUsage

type StorageVolumeStateUsage struct {
	// Used space in bytes
	// Example: 1693552640
	Used uint64 `json:"used,omitempty" yaml:"used,omitempty"`

	// Storage volume size in bytes
	// Example: 5189222192
	//
	// API extension: storage_volume_state_total
	Total int64 `json:"total" yaml:"total"`
}

StorageVolumeStateUsage represents the disk usage of a volume

swagger:model

API extension: storage_volume_state.

type StorageVolumesPost

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

	// Volume name
	// Example: foo
	Name string `json:"name" yaml:"name"`

	// Volume type (container, custom, image or virtual-machine)
	// Example: custom
	Type string `json:"type" yaml:"type"`

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

	// Volume content type (filesystem or block)
	// Example: filesystem
	//
	// API extension: custom_block_volumes
	ContentType string `json:"content_type" yaml:"content_type"`
}

StorageVolumesPost represents the fields of a new LXD storage pool volume

swagger:model

API extension: storage.

type URL

type URL struct {
	url.URL
}

URL represents an endpoint for the LXD API.

Example
u := NewURL()
fmt.Println(u.Path("1.0", "networks", "name-with-/-in-it"))
fmt.Println(u.Project("default"))
fmt.Println(u.Project("project-with-%-in-it"))
fmt.Println(u.Target(""))
fmt.Println(u.Target("member-with-%-in-it"))
fmt.Println(u.Host("example.com"))
fmt.Println(u.Scheme("https"))
Output:

/1.0/networks/name-with-%2F-in-it
/1.0/networks/name-with-%2F-in-it
/1.0/networks/name-with-%2F-in-it?project=project-with-%25-in-it
/1.0/networks/name-with-%2F-in-it?project=project-with-%25-in-it
/1.0/networks/name-with-%2F-in-it?project=project-with-%25-in-it&target=member-with-%25-in-it
//example.com/1.0/networks/name-with-%2F-in-it?project=project-with-%25-in-it&target=member-with-%25-in-it
https://example.com/1.0/networks/name-with-%2F-in-it?project=project-with-%25-in-it&target=member-with-%25-in-it

func NewURL

func NewURL() *URL

NewURL creates a new URL.

func (*URL) Host

func (u *URL) Host(host string) *URL

Host sets the host of the URL.

func (*URL) Path

func (u *URL) Path(pathParts ...string) *URL

Path sets the path of the URL from one or more path parts. It appends each of the pathParts (escaped using url.PathEscape) prefixed with "/" to the URL path.

func (*URL) Project

func (u *URL) Project(projectName string) *URL

Project sets the "project" query parameter in the URL if the projectName is not empty or "default".

func (*URL) Scheme

func (u *URL) Scheme(scheme string) *URL

Scheme sets the scheme of the URL.

func (*URL) Target

func (u *URL) Target(clusterMemberName string) *URL

Target sets the "target" query parameter in the URL if the clusterMemberName is not empty or "default".

func (*URL) WithQuery

func (u *URL) WithQuery(key string, value string) *URL

WithQuery adds a given query parameter with its value to the URL.

type Warning

type Warning struct {
	// UUID of the warning
	// Example: e9e9da0d-2538-4351-8047-46d4a8ae4dbb
	UUID string `json:"uuid" yaml:"uuid"`

	// What cluster member this warning occurred on
	// Example: node1
	Location string `json:"location" yaml:"location"`

	// The project the warning occurred in
	// Example: default
	Project string `json:"project" yaml:"project"`

	// Type type of warning
	// Example: Couldn't find CGroup
	Type string `json:"type" yaml:"type"`

	// The number of times this warning occurred
	// Example: 1
	Count int `json:"count" yaml:"count"`

	// The first time this warning occurred
	// Example: 2021-03-23T17:38:37.753398689-04:00
	FirstSeenAt time.Time `json:"first_seen_at" yaml:"first_seen_at"`

	// The last time this warning occurred
	// Example: 2021-03-23T17:38:37.753398689-04:00
	LastSeenAt time.Time `json:"last_seen_at" yaml:"last_seen_at"`

	// The warning message
	// Example: Couldn't find the CGroup blkio.weight, disk priority will be ignored
	LastMessage string `json:"last_message" yaml:"last_message"`

	// The severity of this warning
	// Example: low
	Severity string `json:"severity" yaml:"severity"`

	// Status of the warning (new, acknowledged, or resolved)
	// Example: new
	Status string `json:"status" yaml:"status"`

	// The entity affected by this warning
	// Example: /1.0/instances/c1?project=default
	EntityURL string `json:"entity_url" yaml:"entity_url"`
}

Warning represents a warning entry.

swagger:model

API extension: warnings.

type WarningPut

type WarningPut struct {
	// Status of the warning (new, acknowledged, or resolved)
	// Example: new
	Status string `json:"status" yaml:"status"`
}

WarningPut represents the modifiable fields of a warning.

swagger:model

API extension: warnings.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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