lxd

package
v0.0.0-...-288c4de Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Overview

Package lxd implements a client for the LXD API

Overview

This package lets you connect to LXD daemons or SimpleStream image servers over a Unix socket or HTTPs. You can then interact with those remote servers, creating instances, images, moving them around, ...

Example - instance creation

This creates a container on a local LXD daemon and then starts it.

// Connect to LXD over the Unix socket
c, err := lxd.ConnectLXDUnix("", nil)
if err != nil {
  return err
}

// Instance creation request
req := api.InstancesPost{
  Name: "my-container",
  Source: api.InstanceSource{
    Type:  "image",
    Alias: "my-image",
  },
  Type: "container"
}

// Get LXD to create the instance (background operation)
op, err := c.CreateInstance(req)
if err != nil {
  return err
}

// Wait for the operation to complete
err = op.Wait()
if err != nil {
  return err
}

// Get LXD to start the instance (background operation)
reqState := api.InstanceStatePut{
  Action: "start",
  Timeout: -1,
}

op, err = c.UpdateInstanceState(name, reqState, "")
if err != nil {
  return err
}

// Wait for the operation to complete
err = op.Wait()
if err != nil {
  return err
}

Example - command execution

This executes an interactive bash terminal

// Connect to LXD over the Unix socket
c, err := lxd.ConnectLXDUnix("", nil)
if err != nil {
  return err
}

// Setup the exec request
req := api.InstanceExecPost{
  Command: []string{"bash"},
  WaitForWS: true,
  Interactive: true,
  Width: 80,
  Height: 15,
}

// Setup the exec arguments (fds)
args := lxd.InstanceExecArgs{
  Stdin: os.Stdin,
  Stdout: os.Stdout,
  Stderr: os.Stderr,
}

// Setup the terminal (set to raw mode)
if req.Interactive {
  cfd := int(syscall.Stdin)
  oldttystate, err := termios.MakeRaw(cfd)
  if err != nil {
    return err
  }

  defer termios.Restore(cfd, oldttystate)
}

// Get the current state
op, err := c.ExecInstance("c1", req, &args)
if err != nil {
  return err
}

// Wait for it to complete
err = op.Wait()
if err != nil {
  return err
}

Example - image copy

This copies an image from a simplestreams server to a local LXD daemon

// Connect to LXD over the Unix socket
c, err := lxd.ConnectLXDUnix("", nil)
if err != nil {
  return err
}

// Connect to the remote SimpleStreams server
d, err = lxd.ConnectSimpleStreams("https://images.linuxcontainers.org", nil)
if err != nil {
  return err
}

// Resolve the alias
alias, _, err := d.GetImageAlias("centos/7")
if err != nil {
  return err
}

// Get the image information
image, _, err := d.GetImage(alias.Target)
if err != nil {
  return err
}

// Ask LXD to copy the image from the remote server
op, err := d.CopyImage(*image, c, nil)
if err != nil {
  return err
}

// And wait for it to finish
err = op.Wait()
if err != nil {
  return err
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupFileRequest

type BackupFileRequest struct {
	// Writer for the backup file
	BackupFile io.WriteSeeker

	// Progress handler (called whenever some progress is made)
	ProgressHandler func(progress ioprogress.ProgressData)

	// A canceler that can be used to interrupt some part of the image download request
	Canceler *cancel.HTTPRequestCanceller
}

The BackupFileRequest struct is used for a backup download request.

type BackupFileResponse

type BackupFileResponse struct {
	// Size of backup file
	Size int64
}

The BackupFileResponse struct is used as the response for backup downloads.

type ConnectionArgs

type ConnectionArgs struct {
	// TLS certificate of the remote server. If not specified, the system CA is used.
	TLSServerCert string

	// TLS certificate to use for client authentication.
	TLSClientCert string

	// TLS key to use for client authentication.
	TLSClientKey string

	// TLS CA to validate against when in PKI mode.
	TLSCA string

	// User agent string
	UserAgent string

	// Authentication type
	AuthType string

	// Authentication interactor
	AuthInteractor []httpbakery.Interactor

	// Custom proxy
	Proxy func(*http.Request) (*url.URL, error)

	// Custom HTTP Client (used as base for the connection)
	HTTPClient *http.Client

	// TransportWrapper wraps the *http.Transport set by lxd
	TransportWrapper func(*http.Transport) HTTPTransporter

	// Controls whether a client verifies the server's certificate chain and host name.
	InsecureSkipVerify bool

	// Cookie jar
	CookieJar http.CookieJar

	// OpenID Connect tokens
	OIDCTokens *oidc.Tokens[*oidc.IDTokenClaims]

	// Skip automatic GetServer request upon connection
	SkipGetServer bool

	// Caching support for image servers
	CachePath   string
	CacheExpiry time.Duration
}

ConnectionArgs represents a set of common connection properties.

type ConnectionInfo

type ConnectionInfo struct {
	Addresses   []string
	Certificate string
	Protocol    string
	URL         string
	SocketPath  string
	Project     string
	Target      string
}

The ConnectionInfo struct represents general information for a connection.

type ContainerBackupArgs

type ContainerBackupArgs struct {
	// The backup file
	BackupFile io.Reader

	// Storage pool to use
	PoolName string
}

The ContainerBackupArgs struct is used when creating a container from a backup.

type ContainerConsoleArgs

type ContainerConsoleArgs struct {
	// Bidirectional fd to pass to the container
	Terminal io.ReadWriteCloser

	// Control message handler (window resize)
	Control func(conn *websocket.Conn)

	// Closing this Channel causes a disconnect from the container's console
	ConsoleDisconnect chan bool
}

The ContainerConsoleArgs struct is used to pass additional options during a container console session.

type ContainerConsoleLogArgs

type ContainerConsoleLogArgs struct {
}

The ContainerConsoleLogArgs struct is used to pass additional options during a container console log request.

type ContainerCopyArgs

type ContainerCopyArgs struct {
	// If set, the container will be renamed on copy
	Name string

	// If set, the container running state will be transferred (live migration)
	Live bool

	// If set, only the container will copied, its snapshots won't
	ContainerOnly bool

	// The transfer mode, can be "pull" (default), "push" or "relay"
	Mode string

	// API extension: container_incremental_copy
	// Perform an incremental copy
	Refresh bool
}

The ContainerCopyArgs struct is used to pass additional options during container copy.

type ContainerExecArgs

type ContainerExecArgs struct {
	// Standard input
	Stdin io.ReadCloser

	// Standard output
	Stdout io.WriteCloser

	// Standard error
	Stderr io.WriteCloser

	// Control message handler (window resize, signals, ...)
	Control func(conn *websocket.Conn)

	// Channel that will be closed when all data operations are done
	DataDone chan bool
}

The ContainerExecArgs struct is used to pass additional options during container exec.

type ContainerFileArgs

type ContainerFileArgs struct {
	// File content
	Content io.ReadSeeker

	// User id that owns the file
	UID int64

	// Group id that owns the file
	GID int64

	// File permissions
	Mode int

	// File type (file or directory)
	Type string

	// File write mode (overwrite or append)
	WriteMode string
}

The ContainerFileArgs struct is used to pass the various options for a container file upload.

type ContainerFileResponse

type ContainerFileResponse struct {
	// User id that owns the file
	UID int64

	// Group id that owns the file
	GID int64

	// File permissions
	Mode int

	// File type (file or directory)
	Type string

	// If a directory, the list of files inside it
	Entries []string
}

The ContainerFileResponse struct is used as part of the response for a container file download.

type ContainerServer

type ContainerServer InstanceServer

The ContainerServer type is the legacy name for InstanceServer.

type ContainerSnapshotCopyArgs

type ContainerSnapshotCopyArgs struct {
	// If set, the container will be renamed on copy
	Name string

	// The transfer mode, can be "pull" (default), "push" or "relay"
	Mode string

	// API extension: container_snapshot_stateful_migration
	// If set, the container running state will be transferred (live migration)
	Live bool
}

The ContainerSnapshotCopyArgs struct is used to pass additional options during container copy.

type EventListener

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

The EventListener struct is used to interact with a LXD event stream.

func (*EventListener) AddHandler

func (e *EventListener) AddHandler(types []string, function func(api.Event)) (*EventTarget, error)

AddHandler adds a function to be called whenever an event is received.

func (*EventListener) Disconnect

func (e *EventListener) Disconnect()

Disconnect must be used once done listening for events.

func (*EventListener) IsActive

func (e *EventListener) IsActive() bool

IsActive returns true if this listener is still connected, false otherwise.

func (*EventListener) RemoveHandler

func (e *EventListener) RemoveHandler(target *EventTarget) error

RemoveHandler removes a function to be called whenever an event is received.

func (*EventListener) Wait

func (e *EventListener) Wait() error

Wait blocks until the server disconnects the connection or Disconnect() is called.

type EventTarget

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

The EventTarget struct is returned to the caller of AddHandler and used in RemoveHandler.

type HTTPTransporter

type HTTPTransporter interface {
	http.RoundTripper

	// Transport what this struct wraps
	Transport() *http.Transport
}

HTTPTransporter represents a wrapper around *http.Transport. It is used to add some pre and postprocessing logic to http requests / responses.

type ImageCopyArgs

type ImageCopyArgs struct {
	// Aliases to add to the copied image.
	Aliases []api.ImageAlias

	// Whether to have LXD keep this image up to date
	AutoUpdate bool

	// Whether to copy the source image aliases to the target
	CopyAliases bool

	// Whether this image is to be made available to unauthenticated users
	Public bool

	// The image type to use for resolution
	Type string

	// The transfer mode, can be "pull" (default), "push" or "relay"
	Mode string

	// List of profiles to apply on the target.
	Profiles []string
}

The ImageCopyArgs struct is used to pass additional options during image copy.

type ImageCreateArgs

type ImageCreateArgs struct {
	// Reader for the meta file
	MetaFile io.Reader

	// Filename for the meta file
	MetaName string

	// Reader for the rootfs file
	RootfsFile io.Reader

	// Filename for the rootfs file
	RootfsName string

	// Progress handler (called with upload progress)
	ProgressHandler func(progress ioprogress.ProgressData)

	// Type of the image (container or virtual-machine)
	Type string
}

The ImageCreateArgs struct is used for direct image upload.

type ImageFileRequest

type ImageFileRequest struct {
	// Writer for the metadata file
	MetaFile io.WriteSeeker

	// Writer for the rootfs file
	RootfsFile io.WriteSeeker

	// Progress handler (called whenever some progress is made)
	ProgressHandler func(progress ioprogress.ProgressData)

	// A canceler that can be used to interrupt some part of the image download request
	Canceler *cancel.HTTPRequestCanceller

	// Path retriever for image delta downloads
	// If set, it must return the path to the image file or an empty string if not available
	DeltaSourceRetriever func(fingerprint string, file string) string
}

The ImageFileRequest struct is used for an image download request.

type ImageFileResponse

type ImageFileResponse struct {
	// Filename for the metadata file
	MetaName string

	// Size of the metadata file
	MetaSize int64

	// Filename for the rootfs file
	RootfsName string

	// Size of the rootfs file
	RootfsSize int64
}

The ImageFileResponse struct is used as the response for image downloads.

type ImageServer

type ImageServer interface {
	Server

	// Image handling functions
	GetImages() (images []api.Image, err error)
	GetImageFingerprints() (fingerprints []string, err error)
	GetImagesWithFilter(filters []string) (images []api.Image, err error)

	GetImage(fingerprint string) (image *api.Image, ETag string, err error)
	GetImageFile(fingerprint string, req ImageFileRequest) (resp *ImageFileResponse, err error)
	GetImageSecret(fingerprint string) (secret string, err error)

	GetPrivateImage(fingerprint string, secret string) (image *api.Image, ETag string, err error)
	GetPrivateImageFile(fingerprint string, secret string, req ImageFileRequest) (resp *ImageFileResponse, err error)

	GetImageAliases() (aliases []api.ImageAliasesEntry, err error)
	GetImageAliasNames() (names []string, err error)

	GetImageAlias(name string) (alias *api.ImageAliasesEntry, ETag string, err error)
	GetImageAliasType(imageType string, name string) (alias *api.ImageAliasesEntry, ETag string, err error)
	GetImageAliasArchitectures(imageType string, name string) (entries map[string]*api.ImageAliasesEntry, err error)

	ExportImage(fingerprint string, image api.ImageExportPost) (Operation, error)
}

The ImageServer type represents a read-only image server.

func ConnectPublicLXD

func ConnectPublicLXD(url string, args *ConnectionArgs) (ImageServer, error)

ConnectPublicLXD lets you connect to a remote public LXD daemon over HTTPs.

Unless the remote server is trusted by the system CA, the remote certificate must be provided (TLSServerCert).

func ConnectPublicLXDWithContext

func ConnectPublicLXDWithContext(ctx context.Context, url string, args *ConnectionArgs) (ImageServer, error)

ConnectPublicLXDWithContext lets you connect to a remote public LXD daemon over HTTPs with context.Context.

Unless the remote server is trusted by the system CA, the remote certificate must be provided (TLSServerCert).

func ConnectSimpleStreams

func ConnectSimpleStreams(url string, args *ConnectionArgs) (ImageServer, error)

ConnectSimpleStreams lets you connect to a remote SimpleStreams image server over HTTPs.

Unless the remote server is trusted by the system CA, the remote certificate must be provided (TLSServerCert).

type InstanceBackupArgs

type InstanceBackupArgs struct {
	// The backup file
	BackupFile io.Reader

	// Storage pool to use
	PoolName string

	// Name to import backup as
	Name string
}

The InstanceBackupArgs struct is used when creating a instance from a backup.

type InstanceConsoleArgs

type InstanceConsoleArgs struct {
	// Bidirectional fd to pass to the instance
	Terminal io.ReadWriteCloser

	// Control message handler (window resize)
	Control func(conn *websocket.Conn)

	// Closing this Channel causes a disconnect from the instance's console
	ConsoleDisconnect chan bool
}

The InstanceConsoleArgs struct is used to pass additional options during a instance console session.

type InstanceConsoleLogArgs

type InstanceConsoleLogArgs struct {
}

The InstanceConsoleLogArgs struct is used to pass additional options during a instance console log request.

type InstanceCopyArgs

type InstanceCopyArgs struct {
	// If set, the instance will be renamed on copy
	Name string

	// If set, the instance running state will be transferred (live migration)
	Live bool

	// If set, only the instance will copied, its snapshots won't
	InstanceOnly bool

	// The transfer mode, can be "pull" (default), "push" or "relay"
	Mode string

	// API extension: container_incremental_copy
	// Perform an incremental copy
	Refresh bool

	// API extension: instance_allow_inconsistent_copy
	AllowInconsistent bool
}

The InstanceCopyArgs struct is used to pass additional options during instance copy.

type InstanceExecArgs

type InstanceExecArgs struct {
	// Standard input
	Stdin io.ReadCloser

	// Standard output
	Stdout io.WriteCloser

	// Standard error
	Stderr io.WriteCloser

	// Control message handler (window resize, signals, ...)
	Control func(conn *websocket.Conn)

	// Channel that will be closed when all data operations are done
	DataDone chan bool
}

The InstanceExecArgs struct is used to pass additional options during instance exec.

type InstanceFileArgs

type InstanceFileArgs struct {
	// File content
	Content io.ReadSeeker

	// User id that owns the file
	UID int64

	// Group id that owns the file
	GID int64

	// File permissions
	Mode int

	// File type (file or directory)
	Type string

	// File write mode (overwrite or append)
	WriteMode string
}

The InstanceFileArgs struct is used to pass the various options for a instance file upload.

type InstanceFileResponse

type InstanceFileResponse struct {
	// User id that owns the file
	UID int64

	// Group id that owns the file
	GID int64

	// File permissions
	Mode int

	// File type (file or directory)
	Type string

	// If a directory, the list of files inside it
	Entries []string
}

The InstanceFileResponse struct is used as part of the response for a instance file download.

type InstanceServer

type InstanceServer interface {
	ImageServer

	// Server functions
	GetMetrics() (metrics string, err error)
	GetServer() (server *api.Server, ETag string, err error)
	GetServerResources() (resources *api.Resources, err error)
	UpdateServer(server api.ServerPut, ETag string) (err error)
	HasExtension(extension string) (exists bool)
	RequireAuthenticated(authenticated bool)
	IsClustered() (clustered bool)
	UseTarget(name string) (client InstanceServer)
	UseProject(name string) (client InstanceServer)

	// Certificate functions
	GetCertificateFingerprints() (fingerprints []string, err error)
	GetCertificates() (certificates []api.Certificate, err error)
	GetCertificate(fingerprint string) (certificate *api.Certificate, ETag string, err error)
	CreateCertificate(certificate api.CertificatesPost) (err error)
	UpdateCertificate(fingerprint string, certificate api.CertificatePut, ETag string) (err error)
	DeleteCertificate(fingerprint string) (err error)
	CreateCertificateToken(certificate api.CertificatesPost) (op Operation, err error)

	// Container functions
	//
	// Deprecated: Those functions are deprecated and won't be updated anymore.
	// Please use the equivalent Instance function instead.
	GetContainerNames() (names []string, err error)
	GetContainers() (containers []api.Container, err error)
	GetContainersFull() (containers []api.ContainerFull, err error)
	GetContainer(name string) (container *api.Container, ETag string, err error)
	CreateContainer(container api.ContainersPost) (op Operation, err error)
	CreateContainerFromImage(source ImageServer, image api.Image, imgcontainer api.ContainersPost) (op RemoteOperation, err error)
	CopyContainer(source InstanceServer, container api.Container, args *ContainerCopyArgs) (op RemoteOperation, err error)
	UpdateContainer(name string, container api.ContainerPut, ETag string) (op Operation, err error)
	RenameContainer(name string, container api.ContainerPost) (op Operation, err error)
	MigrateContainer(name string, container api.ContainerPost) (op Operation, err error)
	DeleteContainer(name string) (op Operation, err error)

	ExecContainer(containerName string, exec api.ContainerExecPost, args *ContainerExecArgs) (op Operation, err error)
	ConsoleContainer(containerName string, console api.ContainerConsolePost, args *ContainerConsoleArgs) (op Operation, err error)
	GetContainerConsoleLog(containerName string, args *ContainerConsoleLogArgs) (content io.ReadCloser, err error)
	DeleteContainerConsoleLog(containerName string, args *ContainerConsoleLogArgs) (err error)

	GetContainerFile(containerName string, path string) (content io.ReadCloser, resp *ContainerFileResponse, err error)
	CreateContainerFile(containerName string, path string, args ContainerFileArgs) (err error)
	DeleteContainerFile(containerName string, path string) (err error)

	GetContainerSnapshotNames(containerName string) (names []string, err error)
	GetContainerSnapshots(containerName string) (snapshots []api.ContainerSnapshot, err error)
	GetContainerSnapshot(containerName string, name string) (snapshot *api.ContainerSnapshot, ETag string, err error)
	CreateContainerSnapshot(containerName string, snapshot api.ContainerSnapshotsPost) (op Operation, err error)
	CopyContainerSnapshot(source InstanceServer, containerName string, snapshot api.ContainerSnapshot, args *ContainerSnapshotCopyArgs) (op RemoteOperation, err error)
	RenameContainerSnapshot(containerName string, name string, container api.ContainerSnapshotPost) (op Operation, err error)
	MigrateContainerSnapshot(containerName string, name string, container api.ContainerSnapshotPost) (op Operation, err error)
	DeleteContainerSnapshot(containerName string, name string) (op Operation, err error)
	UpdateContainerSnapshot(containerName string, name string, container api.ContainerSnapshotPut, ETag string) (op Operation, err error)

	GetContainerBackupNames(containerName string) (names []string, err error)
	GetContainerBackups(containername string) (backups []api.ContainerBackup, err error)
	GetContainerBackup(containerName string, name string) (backup *api.ContainerBackup, ETag string, err error)
	CreateContainerBackup(containerName string, backup api.ContainerBackupsPost) (op Operation, err error)
	RenameContainerBackup(containerName string, name string, backup api.ContainerBackupPost) (op Operation, err error)
	DeleteContainerBackup(containerName string, name string) (op Operation, err error)
	GetContainerBackupFile(containerName string, name string, req *BackupFileRequest) (resp *BackupFileResponse, err error)
	CreateContainerFromBackup(args ContainerBackupArgs) (op Operation, err error)

	GetContainerState(name string) (state *api.ContainerState, ETag string, err error)
	UpdateContainerState(name string, state api.ContainerStatePut, ETag string) (op Operation, err error)

	GetContainerLogfiles(name string) (logfiles []string, err error)
	GetContainerLogfile(name string, filename string) (content io.ReadCloser, err error)
	DeleteContainerLogfile(name string, filename string) (err error)

	GetContainerMetadata(name string) (metadata *api.ImageMetadata, ETag string, err error)
	SetContainerMetadata(name string, metadata api.ImageMetadata, ETag string) (err error)

	GetContainerTemplateFiles(containerName string) (templates []string, err error)
	GetContainerTemplateFile(containerName string, templateName string) (content io.ReadCloser, err error)
	CreateContainerTemplateFile(containerName string, templateName string, content io.ReadSeeker) (err error)
	UpdateContainerTemplateFile(containerName string, templateName string, content io.ReadSeeker) (err error)
	DeleteContainerTemplateFile(name string, templateName string) (err error)

	// Instance functions.
	GetInstanceNames(instanceType api.InstanceType) (names []string, err error)
	GetInstanceNamesAllProjects(instanceType api.InstanceType) (names map[string][]string, err error)
	GetInstances(instanceType api.InstanceType) (instances []api.Instance, err error)
	GetInstancesFull(instanceType api.InstanceType) (instances []api.InstanceFull, err error)
	GetInstancesAllProjects(instanceType api.InstanceType) (instances []api.Instance, err error)
	GetInstancesFullAllProjects(instanceType api.InstanceType) (instances []api.InstanceFull, err error)
	GetInstancesWithFilter(instanceType api.InstanceType, filters []string) (instances []api.Instance, err error)
	GetInstancesFullWithFilter(instanceType api.InstanceType, filters []string) (instances []api.InstanceFull, err error)
	GetInstancesAllProjectsWithFilter(instanceType api.InstanceType, filters []string) (instances []api.Instance, err error)
	GetInstancesFullAllProjectsWithFilter(instanceType api.InstanceType, filters []string) (instances []api.InstanceFull, err error)
	GetInstance(name string) (instance *api.Instance, ETag string, err error)
	GetInstanceFull(name string) (instance *api.InstanceFull, ETag string, err error)
	CreateInstance(instance api.InstancesPost) (op Operation, err error)
	CreateInstanceFromImage(source ImageServer, image api.Image, req api.InstancesPost) (op RemoteOperation, err error)
	CopyInstance(source InstanceServer, instance api.Instance, args *InstanceCopyArgs) (op RemoteOperation, err error)
	UpdateInstance(name string, instance api.InstancePut, ETag string) (op Operation, err error)
	RenameInstance(name string, instance api.InstancePost) (op Operation, err error)
	MigrateInstance(name string, instance api.InstancePost) (op Operation, err error)
	DeleteInstance(name string) (op Operation, err error)
	UpdateInstances(state api.InstancesPut, ETag string) (op Operation, err error)
	RebuildInstance(instanceName string, req api.InstanceRebuildPost) (op Operation, err error)
	RebuildInstanceFromImage(source ImageServer, image api.Image, instanceName string, req api.InstanceRebuildPost) (op RemoteOperation, err error)

	ExecInstance(instanceName string, exec api.InstanceExecPost, args *InstanceExecArgs) (op Operation, err error)
	ConsoleInstance(instanceName string, console api.InstanceConsolePost, args *InstanceConsoleArgs) (op Operation, err error)
	ConsoleInstanceDynamic(instanceName string, console api.InstanceConsolePost, args *InstanceConsoleArgs) (Operation, func(io.ReadWriteCloser) error, error)

	GetInstanceConsoleLog(instanceName string, args *InstanceConsoleLogArgs) (content io.ReadCloser, err error)
	DeleteInstanceConsoleLog(instanceName string, args *InstanceConsoleLogArgs) (err error)

	GetInstanceFile(instanceName string, path string) (content io.ReadCloser, resp *InstanceFileResponse, err error)
	CreateInstanceFile(instanceName string, path string, args InstanceFileArgs) (err error)
	DeleteInstanceFile(instanceName string, path string) (err error)

	GetInstanceFileSFTPConn(instanceName string) (net.Conn, error)
	GetInstanceFileSFTP(instanceName string) (*sftp.Client, error)

	GetInstanceSnapshotNames(instanceName string) (names []string, err error)
	GetInstanceSnapshots(instanceName string) (snapshots []api.InstanceSnapshot, err error)
	GetInstanceSnapshot(instanceName string, name string) (snapshot *api.InstanceSnapshot, ETag string, err error)
	CreateInstanceSnapshot(instanceName string, snapshot api.InstanceSnapshotsPost) (op Operation, err error)
	CopyInstanceSnapshot(source InstanceServer, instanceName string, snapshot api.InstanceSnapshot, args *InstanceSnapshotCopyArgs) (op RemoteOperation, err error)
	RenameInstanceSnapshot(instanceName string, name string, instance api.InstanceSnapshotPost) (op Operation, err error)
	MigrateInstanceSnapshot(instanceName string, name string, instance api.InstanceSnapshotPost) (op Operation, err error)
	DeleteInstanceSnapshot(instanceName string, name string) (op Operation, err error)
	UpdateInstanceSnapshot(instanceName string, name string, instance api.InstanceSnapshotPut, ETag string) (op Operation, err error)

	GetInstanceBackupNames(instanceName string) (names []string, err error)
	GetInstanceBackups(instanceName string) (backups []api.InstanceBackup, err error)
	GetInstanceBackup(instanceName string, name string) (backup *api.InstanceBackup, ETag string, err error)
	CreateInstanceBackup(instanceName string, backup api.InstanceBackupsPost) (op Operation, err error)
	RenameInstanceBackup(instanceName string, name string, backup api.InstanceBackupPost) (op Operation, err error)
	DeleteInstanceBackup(instanceName string, name string) (op Operation, err error)
	GetInstanceBackupFile(instanceName string, name string, req *BackupFileRequest) (resp *BackupFileResponse, err error)
	CreateInstanceFromBackup(args InstanceBackupArgs) (op Operation, err error)

	GetInstanceState(name string) (state *api.InstanceState, ETag string, err error)
	UpdateInstanceState(name string, state api.InstanceStatePut, ETag string) (op Operation, err error)

	GetInstanceLogfiles(name string) (logfiles []string, err error)
	GetInstanceLogfile(name string, filename string) (content io.ReadCloser, err error)
	DeleteInstanceLogfile(name string, filename string) (err error)

	GetInstanceMetadata(name string) (metadata *api.ImageMetadata, ETag string, err error)
	UpdateInstanceMetadata(name string, metadata api.ImageMetadata, ETag string) (err error)

	GetInstanceTemplateFiles(instanceName string) (templates []string, err error)
	GetInstanceTemplateFile(instanceName string, templateName string) (content io.ReadCloser, err error)
	CreateInstanceTemplateFile(instanceName string, templateName string, content io.ReadSeeker) (err error)
	DeleteInstanceTemplateFile(name string, templateName string) (err error)

	// Event handling functions
	GetEvents() (listener *EventListener, err error)
	GetEventsAllProjects() (listener *EventListener, err error)
	SendEvent(event api.Event) error

	// Image functions
	CreateImage(image api.ImagesPost, args *ImageCreateArgs) (op Operation, err error)
	CopyImage(source ImageServer, image api.Image, args *ImageCopyArgs) (op RemoteOperation, err error)
	UpdateImage(fingerprint string, image api.ImagePut, ETag string) (err error)
	DeleteImage(fingerprint string) (op Operation, err error)
	RefreshImage(fingerprint string) (op Operation, err error)
	CreateImageSecret(fingerprint string) (op Operation, err error)
	CreateImageAlias(alias api.ImageAliasesPost) (err error)
	UpdateImageAlias(name string, alias api.ImageAliasesEntryPut, ETag string) (err error)
	RenameImageAlias(name string, alias api.ImageAliasesEntryPost) (err error)
	DeleteImageAlias(name string) (err error)

	// Network functions ("network" API extension)
	GetNetworkNames() (names []string, err error)
	GetNetworks() (networks []api.Network, err error)
	GetNetwork(name string) (network *api.Network, ETag string, err error)
	GetNetworkLeases(name string) (leases []api.NetworkLease, err error)
	GetNetworkState(name string) (state *api.NetworkState, err error)
	CreateNetwork(network api.NetworksPost) (err error)
	UpdateNetwork(name string, network api.NetworkPut, ETag string) (err error)
	RenameNetwork(name string, network api.NetworkPost) (err error)
	DeleteNetwork(name string) (err error)

	// Network forward functions ("network_forward" API extension)
	GetNetworkForwardAddresses(networkName string) ([]string, error)
	GetNetworkForwards(networkName string) ([]api.NetworkForward, error)
	GetNetworkForward(networkName string, listenAddress string) (forward *api.NetworkForward, ETag string, err error)
	CreateNetworkForward(networkName string, forward api.NetworkForwardsPost) error
	UpdateNetworkForward(networkName string, listenAddress string, forward api.NetworkForwardPut, ETag string) (err error)
	DeleteNetworkForward(networkName string, listenAddress string) (err error)

	// Network load balancer functions ("network_load_balancer" API extension)
	GetNetworkLoadBalancerAddresses(networkName string) ([]string, error)
	GetNetworkLoadBalancers(networkName string) ([]api.NetworkLoadBalancer, error)
	GetNetworkLoadBalancer(networkName string, listenAddress string) (forward *api.NetworkLoadBalancer, ETag string, err error)
	CreateNetworkLoadBalancer(networkName string, forward api.NetworkLoadBalancersPost) error
	UpdateNetworkLoadBalancer(networkName string, listenAddress string, forward api.NetworkLoadBalancerPut, ETag string) (err error)
	DeleteNetworkLoadBalancer(networkName string, listenAddress string) (err error)

	// Network peer functions ("network_peer" API extension)
	GetNetworkPeerNames(networkName string) ([]string, error)
	GetNetworkPeers(networkName string) ([]api.NetworkPeer, error)
	GetNetworkPeer(networkName string, peerName string) (peer *api.NetworkPeer, ETag string, err error)
	CreateNetworkPeer(networkName string, peer api.NetworkPeersPost) error
	UpdateNetworkPeer(networkName string, peerName string, peer api.NetworkPeerPut, ETag string) (err error)
	DeleteNetworkPeer(networkName string, peerName string) (err error)

	// Network ACL functions ("network_acl" API extension)
	GetNetworkACLNames() (names []string, err error)
	GetNetworkACLs() (acls []api.NetworkACL, err error)
	GetNetworkACL(name string) (acl *api.NetworkACL, ETag string, err error)
	GetNetworkACLLogfile(name string) (log io.ReadCloser, err error)
	CreateNetworkACL(acl api.NetworkACLsPost) (err error)
	UpdateNetworkACL(name string, acl api.NetworkACLPut, ETag string) (err error)
	RenameNetworkACL(name string, acl api.NetworkACLPost) (err error)
	DeleteNetworkACL(name string) (err error)

	// Network zone functions ("network_dns" API extension)
	GetNetworkZoneNames() (names []string, err error)
	GetNetworkZones() (zones []api.NetworkZone, err error)
	GetNetworkZone(name string) (zone *api.NetworkZone, ETag string, err error)
	CreateNetworkZone(zone api.NetworkZonesPost) (err error)
	UpdateNetworkZone(name string, zone api.NetworkZonePut, ETag string) (err error)
	DeleteNetworkZone(name string) (err error)

	GetNetworkZoneRecordNames(zone string) (names []string, err error)
	GetNetworkZoneRecords(zone string) (records []api.NetworkZoneRecord, err error)
	GetNetworkZoneRecord(zone string, name string) (record *api.NetworkZoneRecord, ETag string, err error)
	CreateNetworkZoneRecord(zone string, record api.NetworkZoneRecordsPost) (err error)
	UpdateNetworkZoneRecord(zone string, name string, record api.NetworkZoneRecordPut, ETag string) (err error)
	DeleteNetworkZoneRecord(zone string, name string) (err error)

	// Operation functions
	GetOperationUUIDs() (uuids []string, err error)
	GetOperations() (operations []api.Operation, err error)
	GetOperation(uuid string) (op *api.Operation, ETag string, err error)
	GetOperationWait(uuid string, timeout int) (op *api.Operation, ETag string, err error)
	GetOperationWaitSecret(uuid string, secret string, timeout int) (op *api.Operation, ETag string, err error)
	GetOperationWebsocket(uuid string, secret string) (conn *websocket.Conn, err error)
	DeleteOperation(uuid string) (err error)

	// Profile functions
	GetProfileNames() (names []string, err error)
	GetProfiles() (profiles []api.Profile, err error)
	GetProfile(name string) (profile *api.Profile, ETag string, err error)
	CreateProfile(profile api.ProfilesPost) (err error)
	UpdateProfile(name string, profile api.ProfilePut, ETag string) (err error)
	RenameProfile(name string, profile api.ProfilePost) (err error)
	DeleteProfile(name string) (err error)

	// Project functions
	GetProjectNames() (names []string, err error)
	GetProjects() (projects []api.Project, err error)
	GetProject(name string) (project *api.Project, ETag string, err error)
	GetProjectState(name string) (project *api.ProjectState, err error)
	CreateProject(project api.ProjectsPost) (err error)
	UpdateProject(name string, project api.ProjectPut, ETag string) (err error)
	RenameProject(name string, project api.ProjectPost) (op Operation, err error)
	DeleteProject(name string) (err error)

	// Storage pool functions ("storage" API extension)
	GetStoragePoolNames() (names []string, err error)
	GetStoragePools() (pools []api.StoragePool, err error)
	GetStoragePool(name string) (pool *api.StoragePool, ETag string, err error)
	GetStoragePoolResources(name string) (resources *api.ResourcesStoragePool, err error)
	CreateStoragePool(pool api.StoragePoolsPost) (err error)
	UpdateStoragePool(name string, pool api.StoragePoolPut, ETag string) (err error)
	DeleteStoragePool(name string) (err error)

	// Storage bucket functions ("storage_buckets" API extension)
	GetStoragePoolBucketNames(poolName string) ([]string, error)
	GetStoragePoolBuckets(poolName string) ([]api.StorageBucket, error)
	GetStoragePoolBucket(poolName string, bucketName string) (bucket *api.StorageBucket, ETag string, err error)
	CreateStoragePoolBucket(poolName string, bucket api.StorageBucketsPost) (*api.StorageBucketKey, error)
	UpdateStoragePoolBucket(poolName string, bucketName string, bucket api.StorageBucketPut, ETag string) (err error)
	DeleteStoragePoolBucket(poolName string, bucketName string) (err error)
	GetStoragePoolBucketKeyNames(poolName string, bucketName string) ([]string, error)
	GetStoragePoolBucketKeys(poolName string, bucketName string) ([]api.StorageBucketKey, error)
	GetStoragePoolBucketKey(poolName string, bucketName string, keyName string) (key *api.StorageBucketKey, ETag string, err error)
	CreateStoragePoolBucketKey(poolName string, bucketName string, key api.StorageBucketKeysPost) (newKey *api.StorageBucketKey, err error)
	UpdateStoragePoolBucketKey(poolName string, bucketName string, keyName string, key api.StorageBucketKeyPut, ETag string) (err error)
	DeleteStoragePoolBucketKey(poolName string, bucketName string, keyName string) (err error)

	// Storage volume functions ("storage" API extension)
	GetStoragePoolVolumeNames(pool string) (names []string, err error)
	GetStoragePoolVolumeNamesAllProjects(pool string) (names map[string][]string, err error)
	GetStoragePoolVolumes(pool string) (volumes []api.StorageVolume, err error)
	GetStoragePoolVolumesAllProjects(pool string) (volumes []api.StorageVolume, err error)
	GetStoragePoolVolumesWithFilter(pool string, filters []string) (volumes []api.StorageVolume, err error)
	GetStoragePoolVolumesWithFilterAllProjects(pool string, filters []string) (volumes []api.StorageVolume, err error)
	GetStoragePoolVolume(pool string, volType string, name string) (volume *api.StorageVolume, ETag string, err error)
	GetStoragePoolVolumeState(pool string, volType string, name string) (state *api.StorageVolumeState, err error)
	CreateStoragePoolVolume(pool string, volume api.StorageVolumesPost) (err error)
	UpdateStoragePoolVolume(pool string, volType string, name string, volume api.StorageVolumePut, ETag string) (err error)
	DeleteStoragePoolVolume(pool string, volType string, name string) (err error)
	RenameStoragePoolVolume(pool string, volType string, name string, volume api.StorageVolumePost) (err error)
	CopyStoragePoolVolume(pool string, source InstanceServer, sourcePool string, volume api.StorageVolume, args *StoragePoolVolumeCopyArgs) (op RemoteOperation, err error)
	MoveStoragePoolVolume(pool string, source InstanceServer, sourcePool string, volume api.StorageVolume, args *StoragePoolVolumeMoveArgs) (op RemoteOperation, err error)
	MigrateStoragePoolVolume(pool string, volume api.StorageVolumePost) (op Operation, err error)

	// Storage volume snapshot functions ("storage_api_volume_snapshots" API extension)
	CreateStoragePoolVolumeSnapshot(pool string, volumeType string, volumeName string, snapshot api.StorageVolumeSnapshotsPost) (op Operation, err error)
	DeleteStoragePoolVolumeSnapshot(pool string, volumeType string, volumeName string, snapshotName string) (op Operation, err error)
	GetStoragePoolVolumeSnapshotNames(pool string, volumeType string, volumeName string) (names []string, err error)
	GetStoragePoolVolumeSnapshots(pool string, volumeType string, volumeName string) (snapshots []api.StorageVolumeSnapshot, err error)
	GetStoragePoolVolumeSnapshot(pool string, volumeType string, volumeName string, snapshotName string) (snapshot *api.StorageVolumeSnapshot, ETag string, err error)
	RenameStoragePoolVolumeSnapshot(pool string, volumeType string, volumeName string, snapshotName string, snapshot api.StorageVolumeSnapshotPost) (op Operation, err error)
	UpdateStoragePoolVolumeSnapshot(pool string, volumeType string, volumeName string, snapshotName string, volume api.StorageVolumeSnapshotPut, ETag string) (err error)

	// Storage volume backup functions ("custom_volume_backup" API extension)
	GetStoragePoolVolumeBackupNames(pool string, volName string) (names []string, err error)
	GetStoragePoolVolumeBackups(pool string, volName string) (backups []api.StoragePoolVolumeBackup, err error)
	GetStoragePoolVolumeBackup(pool string, volName string, name string) (backup *api.StoragePoolVolumeBackup, ETag string, err error)
	CreateStoragePoolVolumeBackup(pool string, volName string, backup api.StoragePoolVolumeBackupsPost) (op Operation, err error)
	RenameStoragePoolVolumeBackup(pool string, volName string, name string, backup api.StoragePoolVolumeBackupPost) (op Operation, err error)
	DeleteStoragePoolVolumeBackup(pool string, volName string, name string) (op Operation, err error)
	GetStoragePoolVolumeBackupFile(pool string, volName string, name string, req *BackupFileRequest) (resp *BackupFileResponse, err error)
	CreateStoragePoolVolumeFromBackup(pool string, args StoragePoolVolumeBackupArgs) (op Operation, err error)

	// Storage volume ISO import function ("custom_volume_iso" API extension)
	CreateStoragePoolVolumeFromISO(pool string, args StoragePoolVolumeBackupArgs) (op Operation, err error)

	// Cluster functions ("cluster" API extensions)
	GetCluster() (cluster *api.Cluster, ETag string, err error)
	UpdateCluster(cluster api.ClusterPut, ETag string) (op Operation, err error)
	DeleteClusterMember(name string, force bool) (err error)
	GetClusterMemberNames() (names []string, err error)
	GetClusterMembers() (members []api.ClusterMember, err error)
	GetClusterMember(name string) (member *api.ClusterMember, ETag string, err error)
	UpdateClusterMember(name string, member api.ClusterMemberPut, ETag string) (err error)
	RenameClusterMember(name string, member api.ClusterMemberPost) (err error)
	CreateClusterMember(member api.ClusterMembersPost) (op Operation, err error)
	UpdateClusterCertificate(certs api.ClusterCertificatePut, ETag string) (err error)
	GetClusterMemberState(name string) (*api.ClusterMemberState, string, error)
	UpdateClusterMemberState(name string, state api.ClusterMemberStatePost) (op Operation, err error)
	GetClusterGroups() ([]api.ClusterGroup, error)
	GetClusterGroupNames() ([]string, error)
	RenameClusterGroup(name string, group api.ClusterGroupPost) error
	CreateClusterGroup(group api.ClusterGroupsPost) error
	DeleteClusterGroup(name string) error
	UpdateClusterGroup(name string, group api.ClusterGroupPut, ETag string) error
	GetClusterGroup(name string) (*api.ClusterGroup, string, error)

	// Warning functions
	GetWarningUUIDs() (uuids []string, err error)
	GetWarnings() (warnings []api.Warning, err error)
	GetWarning(UUID string) (warning *api.Warning, ETag string, err error)
	UpdateWarning(UUID string, warning api.WarningPut, ETag string) (err error)
	DeleteWarning(UUID string) (err error)

	// Internal functions (for internal use)
	RawQuery(method string, path string, data any, queryETag string) (resp *api.Response, ETag string, err error)
	RawWebsocket(path string) (conn *websocket.Conn, err error)
	RawOperation(method string, path string, data any, queryETag string) (op Operation, ETag string, err error)
}

The InstanceServer type represents a full featured LXD server.

func ConnectLXD

func ConnectLXD(url string, args *ConnectionArgs) (InstanceServer, error)

ConnectLXD lets you connect to a remote LXD daemon over HTTPs.

A client certificate (TLSClientCert) and key (TLSClientKey) must be provided.

If connecting to a LXD daemon running in PKI mode, the PKI CA (TLSCA) must also be provided.

Unless the remote server is trusted by the system CA, the remote certificate must be provided (TLSServerCert).

func ConnectLXDHTTP

func ConnectLXDHTTP(args *ConnectionArgs, client *http.Client) (InstanceServer, error)

ConnectLXDHTTP lets you connect to a VM agent over a VM socket.

func ConnectLXDHTTPWithContext

func ConnectLXDHTTPWithContext(ctx context.Context, args *ConnectionArgs, client *http.Client) (InstanceServer, error)

ConnectLXDHTTPWithContext lets you connect to a VM agent over a VM socket with context.Context.

func ConnectLXDUnix

func ConnectLXDUnix(path string, args *ConnectionArgs) (InstanceServer, error)

ConnectLXDUnix lets you connect to a remote LXD daemon over a local unix socket.

If the path argument is empty, then $LXD_SOCKET will be used, if unset $LXD_DIR/unix.socket will be used and if that one isn't set either, then the path will default to /var/lib/lxd/unix.socket.

func ConnectLXDUnixWithContext

func ConnectLXDUnixWithContext(ctx context.Context, path string, args *ConnectionArgs) (InstanceServer, error)

ConnectLXDUnixWithContext lets you connect to a remote LXD daemon over a local unix socket with context.Context.

If the path argument is empty, then $LXD_SOCKET will be used, if unset $LXD_DIR/unix.socket will be used and if that one isn't set either, then the path will default to /var/lib/lxd/unix.socket.

func ConnectLXDWithContext

func ConnectLXDWithContext(ctx context.Context, url string, args *ConnectionArgs) (InstanceServer, error)

ConnectLXDWithContext lets you connect to a remote LXD daemon over HTTPs with context.Context.

A client certificate (TLSClientCert) and key (TLSClientKey) must be provided.

If connecting to a LXD daemon running in PKI mode, the PKI CA (TLSCA) must also be provided.

Unless the remote server is trusted by the system CA, the remote certificate must be provided (TLSServerCert).

type InstanceSnapshotCopyArgs

type InstanceSnapshotCopyArgs struct {
	// If set, the instance will be renamed on copy
	Name string

	// The transfer mode, can be "pull" (default), "push" or "relay"
	Mode string

	// API extension: container_snapshot_stateful_migration
	// If set, the instance running state will be transferred (live migration)
	Live bool
}

The InstanceSnapshotCopyArgs struct is used to pass additional options during instance copy.

type Operation

type Operation interface {
	AddHandler(function func(api.Operation)) (target *EventTarget, err error)
	Cancel() (err error)
	Get() (op api.Operation)
	GetWebsocket(secret string) (conn *websocket.Conn, err error)
	RemoveHandler(target *EventTarget) (err error)
	Refresh() (err error)
	Wait() (err error)
	WaitContext(ctx context.Context) error
}

The Operation type represents a currently running operation.

type ProtocolLXD

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

ProtocolLXD represents a LXD API server.

func (*ProtocolLXD) CheckExtension

func (r *ProtocolLXD) CheckExtension(extensionName string) error

CheckExtension checks if the server has the specified extension.

func (*ProtocolLXD) ConsoleContainer

func (r *ProtocolLXD) ConsoleContainer(containerName string, console api.ContainerConsolePost, args *ContainerConsoleArgs) (Operation, error)

ConsoleContainer requests that LXD attaches to the console device of a container.

func (*ProtocolLXD) ConsoleInstance

func (r *ProtocolLXD) ConsoleInstance(instanceName string, console api.InstanceConsolePost, args *InstanceConsoleArgs) (Operation, error)

ConsoleInstance requests that LXD attaches to the console device of a instance.

func (*ProtocolLXD) ConsoleInstanceDynamic

func (r *ProtocolLXD) ConsoleInstanceDynamic(instanceName string, console api.InstanceConsolePost, args *InstanceConsoleArgs) (Operation, func(io.ReadWriteCloser) error, error)

ConsoleInstanceDynamic requests that LXD attaches to the console device of a instance with the possibility of opening multiple connections to it.

Every time the returned 'console' function is called, a new connection will be established and proxied to the given io.ReadWriteCloser.

func (*ProtocolLXD) CopyContainer

func (r *ProtocolLXD) CopyContainer(source InstanceServer, container api.Container, args *ContainerCopyArgs) (RemoteOperation, error)

CopyContainer copies a container from a remote server. Additional options can be passed using ContainerCopyArgs.

func (*ProtocolLXD) CopyContainerSnapshot

func (r *ProtocolLXD) CopyContainerSnapshot(source InstanceServer, containerName string, snapshot api.ContainerSnapshot, args *ContainerSnapshotCopyArgs) (RemoteOperation, error)

CopyContainerSnapshot copies a snapshot from a remote server into a new container. Additional options can be passed using ContainerCopyArgs.

func (*ProtocolLXD) CopyImage

func (r *ProtocolLXD) CopyImage(source ImageServer, image api.Image, args *ImageCopyArgs) (RemoteOperation, error)

CopyImage copies an image from a remote server. Additional options can be passed using ImageCopyArgs.

func (*ProtocolLXD) CopyInstance

func (r *ProtocolLXD) CopyInstance(source InstanceServer, instance api.Instance, args *InstanceCopyArgs) (RemoteOperation, error)

CopyInstance copies a instance from a remote server. Additional options can be passed using InstanceCopyArgs.

func (*ProtocolLXD) CopyInstanceSnapshot

func (r *ProtocolLXD) CopyInstanceSnapshot(source InstanceServer, instanceName string, snapshot api.InstanceSnapshot, args *InstanceSnapshotCopyArgs) (RemoteOperation, error)

CopyInstanceSnapshot copies a snapshot from a remote server into a new instance. Additional options can be passed using InstanceCopyArgs.

func (*ProtocolLXD) CopyStoragePoolVolume

func (r *ProtocolLXD) CopyStoragePoolVolume(pool string, source InstanceServer, sourcePool string, volume api.StorageVolume, args *StoragePoolVolumeCopyArgs) (RemoteOperation, error)

CopyStoragePoolVolume copies an existing storage volume.

func (*ProtocolLXD) CreateCertificate

func (r *ProtocolLXD) CreateCertificate(certificate api.CertificatesPost) error

CreateCertificate adds a new certificate to the LXD trust store.

func (*ProtocolLXD) CreateCertificateToken

func (r *ProtocolLXD) CreateCertificateToken(certificate api.CertificatesPost) (Operation, error)

CreateCertificateToken requests a certificate add token.

func (*ProtocolLXD) CreateClusterGroup

func (r *ProtocolLXD) CreateClusterGroup(group api.ClusterGroupsPost) error

CreateClusterGroup creates a new cluster group.

func (*ProtocolLXD) CreateClusterMember

func (r *ProtocolLXD) CreateClusterMember(member api.ClusterMembersPost) (Operation, error)

CreateClusterMember generates a join token to add a cluster member.

func (*ProtocolLXD) CreateContainer

func (r *ProtocolLXD) CreateContainer(container api.ContainersPost) (Operation, error)

CreateContainer requests that LXD creates a new container.

func (*ProtocolLXD) CreateContainerBackup

func (r *ProtocolLXD) CreateContainerBackup(containerName string, backup api.ContainerBackupsPost) (Operation, error)

CreateContainerBackup requests that LXD creates a new backup for the container.

func (*ProtocolLXD) CreateContainerFile

func (r *ProtocolLXD) CreateContainerFile(containerName string, path string, args ContainerFileArgs) error

CreateContainerFile tells LXD to create a file in the container.

func (*ProtocolLXD) CreateContainerFromBackup

func (r *ProtocolLXD) CreateContainerFromBackup(args ContainerBackupArgs) (Operation, error)

CreateContainerFromBackup is a convenience function to make it easier to create a container from a backup.

func (*ProtocolLXD) CreateContainerFromImage

func (r *ProtocolLXD) CreateContainerFromImage(source ImageServer, image api.Image, req api.ContainersPost) (RemoteOperation, error)

CreateContainerFromImage is a convenience function to make it easier to create a container from an existing image.

func (*ProtocolLXD) CreateContainerSnapshot

func (r *ProtocolLXD) CreateContainerSnapshot(containerName string, snapshot api.ContainerSnapshotsPost) (Operation, error)

CreateContainerSnapshot requests that LXD creates a new snapshot for the container.

func (*ProtocolLXD) CreateContainerTemplateFile

func (r *ProtocolLXD) CreateContainerTemplateFile(containerName string, templateName string, content io.ReadSeeker) error

CreateContainerTemplateFile creates an a template for a container.

func (*ProtocolLXD) CreateImage

func (r *ProtocolLXD) CreateImage(image api.ImagesPost, args *ImageCreateArgs) (Operation, error)

CreateImage requests that LXD creates, copies or import a new image.

func (*ProtocolLXD) CreateImageAlias

func (r *ProtocolLXD) CreateImageAlias(alias api.ImageAliasesPost) error

CreateImageAlias sets up a new image alias.

func (*ProtocolLXD) CreateImageSecret

func (r *ProtocolLXD) CreateImageSecret(fingerprint string) (Operation, error)

CreateImageSecret requests that LXD issues a temporary image secret.

func (*ProtocolLXD) CreateInstance

func (r *ProtocolLXD) CreateInstance(instance api.InstancesPost) (Operation, error)

CreateInstance requests that LXD creates a new instance.

func (*ProtocolLXD) CreateInstanceBackup

func (r *ProtocolLXD) CreateInstanceBackup(instanceName string, backup api.InstanceBackupsPost) (Operation, error)

CreateInstanceBackup requests that LXD creates a new backup for the instance.

func (*ProtocolLXD) CreateInstanceFile

func (r *ProtocolLXD) CreateInstanceFile(instanceName string, filePath string, args InstanceFileArgs) error

CreateInstanceFile tells LXD to create a file in the instance.

func (*ProtocolLXD) CreateInstanceFromBackup

func (r *ProtocolLXD) CreateInstanceFromBackup(args InstanceBackupArgs) (Operation, error)

CreateInstanceFromBackup is a convenience function to make it easier to create a instance from a backup.

func (*ProtocolLXD) CreateInstanceFromImage

func (r *ProtocolLXD) CreateInstanceFromImage(source ImageServer, image api.Image, req api.InstancesPost) (RemoteOperation, error)

CreateInstanceFromImage is a convenience function to make it easier to create a instance from an existing image.

func (*ProtocolLXD) CreateInstanceSnapshot

func (r *ProtocolLXD) CreateInstanceSnapshot(instanceName string, snapshot api.InstanceSnapshotsPost) (Operation, error)

CreateInstanceSnapshot requests that LXD creates a new snapshot for the instance.

func (*ProtocolLXD) CreateInstanceTemplateFile

func (r *ProtocolLXD) CreateInstanceTemplateFile(instanceName string, templateName string, content io.ReadSeeker) error

CreateInstanceTemplateFile creates an a template for a instance.

func (*ProtocolLXD) CreateNetwork

func (r *ProtocolLXD) CreateNetwork(network api.NetworksPost) error

CreateNetwork defines a new network using the provided Network struct.

func (*ProtocolLXD) CreateNetworkACL

func (r *ProtocolLXD) CreateNetworkACL(acl api.NetworkACLsPost) error

CreateNetworkACL defines a new network ACL using the provided struct.

func (*ProtocolLXD) CreateNetworkForward

func (r *ProtocolLXD) CreateNetworkForward(networkName string, forward api.NetworkForwardsPost) error

CreateNetworkForward defines a new network forward using the provided struct.

func (*ProtocolLXD) CreateNetworkLoadBalancer

func (r *ProtocolLXD) CreateNetworkLoadBalancer(networkName string, loadBalancer api.NetworkLoadBalancersPost) error

CreateNetworkLoadBalancer defines a new network load balancer using the provided struct.

func (*ProtocolLXD) CreateNetworkPeer

func (r *ProtocolLXD) CreateNetworkPeer(networkName string, peer api.NetworkPeersPost) error

CreateNetworkPeer defines a new network peer using the provided struct. Returns true if the peer connection has been mutually created. Returns false if peering has been only initiated.

func (*ProtocolLXD) CreateNetworkZone

func (r *ProtocolLXD) CreateNetworkZone(zone api.NetworkZonesPost) error

CreateNetworkZone defines a new Network zone using the provided struct.

func (*ProtocolLXD) CreateNetworkZoneRecord

func (r *ProtocolLXD) CreateNetworkZoneRecord(zone string, record api.NetworkZoneRecordsPost) error

CreateNetworkZoneRecord defines a new Network zone record using the provided struct.

func (*ProtocolLXD) CreateProfile

func (r *ProtocolLXD) CreateProfile(profile api.ProfilesPost) error

CreateProfile defines a new container profile.

func (*ProtocolLXD) CreateProject

func (r *ProtocolLXD) CreateProject(project api.ProjectsPost) error

CreateProject defines a new container project.

func (*ProtocolLXD) CreateStoragePool

func (r *ProtocolLXD) CreateStoragePool(pool api.StoragePoolsPost) error

CreateStoragePool defines a new storage pool using the provided StoragePool struct.

func (*ProtocolLXD) CreateStoragePoolBucket

func (r *ProtocolLXD) CreateStoragePoolBucket(poolName string, bucket api.StorageBucketsPost) (*api.StorageBucketKey, error)

CreateStoragePoolBucket defines a new storage bucket using the provided struct. If the server supports storage_buckets_create_credentials API extension, then this function will return the initial admin credentials. Otherwise it will be nil.

func (*ProtocolLXD) CreateStoragePoolBucketKey

func (r *ProtocolLXD) CreateStoragePoolBucketKey(poolName string, bucketName string, key api.StorageBucketKeysPost) (*api.StorageBucketKey, error)

CreateStoragePoolBucketKey adds a key to a storage bucket.

func (*ProtocolLXD) CreateStoragePoolVolume

func (r *ProtocolLXD) CreateStoragePoolVolume(pool string, volume api.StorageVolumesPost) error

CreateStoragePoolVolume defines a new storage volume.

func (*ProtocolLXD) CreateStoragePoolVolumeBackup

func (r *ProtocolLXD) CreateStoragePoolVolumeBackup(pool string, volName string, backup api.StoragePoolVolumeBackupsPost) (Operation, error)

CreateStoragePoolVolumeBackup creates new custom volume backup.

func (*ProtocolLXD) CreateStoragePoolVolumeFromBackup

func (r *ProtocolLXD) CreateStoragePoolVolumeFromBackup(pool string, args StoragePoolVolumeBackupArgs) (Operation, error)

CreateStoragePoolVolumeFromBackup creates a custom volume from a backup file.

func (*ProtocolLXD) CreateStoragePoolVolumeFromISO

func (r *ProtocolLXD) CreateStoragePoolVolumeFromISO(pool string, args StoragePoolVolumeBackupArgs) (Operation, error)

CreateStoragePoolVolumeFromISO creates a custom volume from an ISO file.

func (*ProtocolLXD) CreateStoragePoolVolumeSnapshot

func (r *ProtocolLXD) CreateStoragePoolVolumeSnapshot(pool string, volumeType string, volumeName string, snapshot api.StorageVolumeSnapshotsPost) (Operation, error)

CreateStoragePoolVolumeSnapshot defines a new storage volume.

func (*ProtocolLXD) DeleteCertificate

func (r *ProtocolLXD) DeleteCertificate(fingerprint string) error

DeleteCertificate removes a certificate from the LXD trust store.

func (*ProtocolLXD) DeleteClusterGroup

func (r *ProtocolLXD) DeleteClusterGroup(name string) error

DeleteClusterGroup deletes an existing cluster group.

func (*ProtocolLXD) DeleteClusterMember

func (r *ProtocolLXD) DeleteClusterMember(name string, force bool) error

DeleteClusterMember makes the given member leave the cluster (gracefully or not, depending on the force flag).

func (*ProtocolLXD) DeleteContainer

func (r *ProtocolLXD) DeleteContainer(name string) (Operation, error)

DeleteContainer requests that LXD deletes the container.

func (*ProtocolLXD) DeleteContainerBackup

func (r *ProtocolLXD) DeleteContainerBackup(containerName string, name string) (Operation, error)

DeleteContainerBackup requests that LXD deletes the container backup.

func (*ProtocolLXD) DeleteContainerConsoleLog

func (r *ProtocolLXD) DeleteContainerConsoleLog(containerName string, args *ContainerConsoleLogArgs) error

DeleteContainerConsoleLog deletes the requested container's console log.

func (*ProtocolLXD) DeleteContainerFile

func (r *ProtocolLXD) DeleteContainerFile(containerName string, path string) error

DeleteContainerFile deletes a file in the container.

func (*ProtocolLXD) DeleteContainerLogfile

func (r *ProtocolLXD) DeleteContainerLogfile(name string, filename string) error

DeleteContainerLogfile deletes the requested logfile.

func (*ProtocolLXD) DeleteContainerSnapshot

func (r *ProtocolLXD) DeleteContainerSnapshot(containerName string, name string) (Operation, error)

DeleteContainerSnapshot requests that LXD deletes the container snapshot.

func (*ProtocolLXD) DeleteContainerTemplateFile

func (r *ProtocolLXD) DeleteContainerTemplateFile(name string, templateName string) error

DeleteContainerTemplateFile deletes a template file for a container.

func (*ProtocolLXD) DeleteImage

func (r *ProtocolLXD) DeleteImage(fingerprint string) (Operation, error)

DeleteImage requests that LXD removes an image from the store.

func (*ProtocolLXD) DeleteImageAlias

func (r *ProtocolLXD) DeleteImageAlias(name string) error

DeleteImageAlias removes an alias from the LXD image store.

func (*ProtocolLXD) DeleteInstance

func (r *ProtocolLXD) DeleteInstance(name string) (Operation, error)

DeleteInstance requests that LXD deletes the instance.

func (*ProtocolLXD) DeleteInstanceBackup

func (r *ProtocolLXD) DeleteInstanceBackup(instanceName string, name string) (Operation, error)

DeleteInstanceBackup requests that LXD deletes the instance backup.

func (*ProtocolLXD) DeleteInstanceConsoleLog

func (r *ProtocolLXD) DeleteInstanceConsoleLog(instanceName string, args *InstanceConsoleLogArgs) error

DeleteInstanceConsoleLog deletes the requested instance's console log.

func (*ProtocolLXD) DeleteInstanceFile

func (r *ProtocolLXD) DeleteInstanceFile(instanceName string, filePath string) error

DeleteInstanceFile deletes a file in the instance.

func (*ProtocolLXD) DeleteInstanceLogfile

func (r *ProtocolLXD) DeleteInstanceLogfile(name string, filename string) error

DeleteInstanceLogfile deletes the requested logfile.

func (*ProtocolLXD) DeleteInstanceSnapshot

func (r *ProtocolLXD) DeleteInstanceSnapshot(instanceName string, name string) (Operation, error)

DeleteInstanceSnapshot requests that LXD deletes the instance snapshot.

func (*ProtocolLXD) DeleteInstanceTemplateFile

func (r *ProtocolLXD) DeleteInstanceTemplateFile(name string, templateName string) error

DeleteInstanceTemplateFile deletes a template file for a instance.

func (*ProtocolLXD) DeleteNetwork

func (r *ProtocolLXD) DeleteNetwork(name string) error

DeleteNetwork deletes an existing network.

func (*ProtocolLXD) DeleteNetworkACL

func (r *ProtocolLXD) DeleteNetworkACL(name string) error

DeleteNetworkACL deletes an existing network ACL.

func (*ProtocolLXD) DeleteNetworkForward

func (r *ProtocolLXD) DeleteNetworkForward(networkName string, listenAddress string) error

DeleteNetworkForward deletes an existing network forward.

func (*ProtocolLXD) DeleteNetworkLoadBalancer

func (r *ProtocolLXD) DeleteNetworkLoadBalancer(networkName string, listenAddress string) error

DeleteNetworkLoadBalancer deletes an existing network load balancer.

func (*ProtocolLXD) DeleteNetworkPeer

func (r *ProtocolLXD) DeleteNetworkPeer(networkName string, peerName string) error

DeleteNetworkPeer deletes an existing network peer.

func (*ProtocolLXD) DeleteNetworkZone

func (r *ProtocolLXD) DeleteNetworkZone(name string) error

DeleteNetworkZone deletes an existing network zone.

func (*ProtocolLXD) DeleteNetworkZoneRecord

func (r *ProtocolLXD) DeleteNetworkZoneRecord(zone string, name string) error

DeleteNetworkZoneRecord deletes an existing network zone record.

func (*ProtocolLXD) DeleteOperation

func (r *ProtocolLXD) DeleteOperation(uuid string) error

DeleteOperation deletes (cancels) a running operation.

func (*ProtocolLXD) DeleteProfile

func (r *ProtocolLXD) DeleteProfile(name string) error

DeleteProfile deletes a profile.

func (*ProtocolLXD) DeleteProject

func (r *ProtocolLXD) DeleteProject(name string) error

DeleteProject deletes a project.

func (*ProtocolLXD) DeleteStoragePool

func (r *ProtocolLXD) DeleteStoragePool(name string) error

DeleteStoragePool deletes a storage pool.

func (*ProtocolLXD) DeleteStoragePoolBucket

func (r *ProtocolLXD) DeleteStoragePoolBucket(poolName string, bucketName string) error

DeleteStoragePoolBucket deletes an existing storage bucket.

func (*ProtocolLXD) DeleteStoragePoolBucketKey

func (r *ProtocolLXD) DeleteStoragePoolBucketKey(poolName string, bucketName string, keyName string) error

DeleteStoragePoolBucketKey removes a key from a storage bucket.

func (*ProtocolLXD) DeleteStoragePoolVolume

func (r *ProtocolLXD) DeleteStoragePoolVolume(pool string, volType string, name string) error

DeleteStoragePoolVolume deletes a storage pool.

func (*ProtocolLXD) DeleteStoragePoolVolumeBackup

func (r *ProtocolLXD) DeleteStoragePoolVolumeBackup(pool string, volName string, name string) (Operation, error)

DeleteStoragePoolVolumeBackup deletes a custom volume backup.

func (*ProtocolLXD) DeleteStoragePoolVolumeSnapshot

func (r *ProtocolLXD) DeleteStoragePoolVolumeSnapshot(pool string, volumeType string, volumeName string, snapshotName string) (Operation, error)

DeleteStoragePoolVolumeSnapshot deletes a storage volume snapshot.

func (*ProtocolLXD) DeleteWarning

func (r *ProtocolLXD) DeleteWarning(UUID string) error

DeleteWarning deletes the provided warning.

func (*ProtocolLXD) Disconnect

func (r *ProtocolLXD) Disconnect()

Disconnect gets rid of any background goroutines.

func (*ProtocolLXD) DoHTTP

func (r *ProtocolLXD) DoHTTP(req *http.Request) (*http.Response, error)

DoHTTP performs a Request, using macaroon authentication if set.

func (*ProtocolLXD) ExecContainer

func (r *ProtocolLXD) ExecContainer(containerName string, exec api.ContainerExecPost, args *ContainerExecArgs) (Operation, error)

ExecContainer requests that LXD spawns a command inside the container.

func (*ProtocolLXD) ExecInstance

func (r *ProtocolLXD) ExecInstance(instanceName string, exec api.InstanceExecPost, args *InstanceExecArgs) (Operation, error)

ExecInstance requests that LXD spawns a command inside the instance.

func (*ProtocolLXD) ExportImage

func (r *ProtocolLXD) ExportImage(fingerprint string, image api.ImageExportPost) (Operation, error)

ExportImage exports (copies) an image to a remote server.

func (*ProtocolLXD) GetCertificate

func (r *ProtocolLXD) GetCertificate(fingerprint string) (*api.Certificate, string, error)

GetCertificate returns the certificate entry for the provided fingerprint.

func (*ProtocolLXD) GetCertificateFingerprints

func (r *ProtocolLXD) GetCertificateFingerprints() ([]string, error)

GetCertificateFingerprints returns a list of certificate fingerprints.

func (*ProtocolLXD) GetCertificates

func (r *ProtocolLXD) GetCertificates() ([]api.Certificate, error)

GetCertificates returns a list of certificates.

func (*ProtocolLXD) GetCluster

func (r *ProtocolLXD) GetCluster() (*api.Cluster, string, error)

GetCluster returns information about a cluster

If this client is not trusted, the password must be supplied.

func (*ProtocolLXD) GetClusterGroup

func (r *ProtocolLXD) GetClusterGroup(name string) (*api.ClusterGroup, string, error)

GetClusterGroup returns information about the given cluster group.

func (*ProtocolLXD) GetClusterGroupNames

func (r *ProtocolLXD) GetClusterGroupNames() ([]string, error)

GetClusterGroupNames returns the cluster group names.

func (*ProtocolLXD) GetClusterGroups

func (r *ProtocolLXD) GetClusterGroups() ([]api.ClusterGroup, error)

GetClusterGroups returns the cluster groups.

func (*ProtocolLXD) GetClusterMember

func (r *ProtocolLXD) GetClusterMember(name string) (*api.ClusterMember, string, error)

GetClusterMember returns information about the given member.

func (*ProtocolLXD) GetClusterMemberNames

func (r *ProtocolLXD) GetClusterMemberNames() ([]string, error)

GetClusterMemberNames returns the URLs of the current members in the cluster.

func (*ProtocolLXD) GetClusterMemberState

func (r *ProtocolLXD) GetClusterMemberState(name string) (*api.ClusterMemberState, string, error)

GetClusterMemberState gets state information about a cluster member.

func (*ProtocolLXD) GetClusterMembers

func (r *ProtocolLXD) GetClusterMembers() ([]api.ClusterMember, error)

GetClusterMembers returns the current members of the cluster.

func (*ProtocolLXD) GetConnectionInfo

func (r *ProtocolLXD) GetConnectionInfo() (*ConnectionInfo, error)

GetConnectionInfo returns the basic connection information used to interact with the server.

func (*ProtocolLXD) GetContainer

func (r *ProtocolLXD) GetContainer(name string) (*api.Container, string, error)

GetContainer returns the container entry for the provided name.

func (*ProtocolLXD) GetContainerBackup

func (r *ProtocolLXD) GetContainerBackup(containerName string, name string) (*api.ContainerBackup, string, error)

GetContainerBackup returns a Backup struct for the provided container and backup names.

func (*ProtocolLXD) GetContainerBackupFile

func (r *ProtocolLXD) GetContainerBackupFile(containerName string, name string, req *BackupFileRequest) (*BackupFileResponse, error)

GetContainerBackupFile requests the container backup content.

func (*ProtocolLXD) GetContainerBackupNames

func (r *ProtocolLXD) GetContainerBackupNames(containerName string) ([]string, error)

GetContainerBackupNames returns a list of backup names for the container.

func (*ProtocolLXD) GetContainerBackups

func (r *ProtocolLXD) GetContainerBackups(containerName string) ([]api.ContainerBackup, error)

GetContainerBackups returns a list of backups for the container.

func (*ProtocolLXD) GetContainerConsoleLog

func (r *ProtocolLXD) GetContainerConsoleLog(containerName string, args *ContainerConsoleLogArgs) (io.ReadCloser, error)

GetContainerConsoleLog requests that LXD attaches to the console device of a container.

Note that it's the caller's responsibility to close the returned ReadCloser.

func (*ProtocolLXD) GetContainerFile

func (r *ProtocolLXD) GetContainerFile(containerName string, path string) (io.ReadCloser, *ContainerFileResponse, error)

GetContainerFile retrieves the provided path from the container.

func (*ProtocolLXD) GetContainerLogfile

func (r *ProtocolLXD) GetContainerLogfile(name string, filename string) (io.ReadCloser, error)

GetContainerLogfile returns the content of the requested logfile

Note that it's the caller's responsibility to close the returned ReadCloser.

func (*ProtocolLXD) GetContainerLogfiles

func (r *ProtocolLXD) GetContainerLogfiles(name string) ([]string, error)

GetContainerLogfiles returns a list of logfiles for the container.

func (*ProtocolLXD) GetContainerMetadata

func (r *ProtocolLXD) GetContainerMetadata(name string) (*api.ImageMetadata, string, error)

GetContainerMetadata returns container metadata.

func (*ProtocolLXD) GetContainerNames

func (r *ProtocolLXD) GetContainerNames() ([]string, error)

GetContainerNames returns a list of container names.

func (*ProtocolLXD) GetContainerSnapshot

func (r *ProtocolLXD) GetContainerSnapshot(containerName string, name string) (*api.ContainerSnapshot, string, error)

GetContainerSnapshot returns a Snapshot struct for the provided container and snapshot names.

func (*ProtocolLXD) GetContainerSnapshotNames

func (r *ProtocolLXD) GetContainerSnapshotNames(containerName string) ([]string, error)

GetContainerSnapshotNames returns a list of snapshot names for the container.

func (*ProtocolLXD) GetContainerSnapshots

func (r *ProtocolLXD) GetContainerSnapshots(containerName string) ([]api.ContainerSnapshot, error)

GetContainerSnapshots returns a list of snapshots for the container.

func (*ProtocolLXD) GetContainerState

func (r *ProtocolLXD) GetContainerState(name string) (*api.ContainerState, string, error)

GetContainerState returns a ContainerState entry for the provided container name.

func (*ProtocolLXD) GetContainerTemplateFile

func (r *ProtocolLXD) GetContainerTemplateFile(containerName string, templateName string) (io.ReadCloser, error)

GetContainerTemplateFile returns the content of a template file for a container.

func (*ProtocolLXD) GetContainerTemplateFiles

func (r *ProtocolLXD) GetContainerTemplateFiles(containerName string) ([]string, error)

GetContainerTemplateFiles returns the list of names of template files for a container.

func (*ProtocolLXD) GetContainers

func (r *ProtocolLXD) GetContainers() ([]api.Container, error)

GetContainers returns a list of containers.

func (*ProtocolLXD) GetContainersFull

func (r *ProtocolLXD) GetContainersFull() ([]api.ContainerFull, error)

GetContainersFull returns a list of containers including snapshots, backups and state.

func (*ProtocolLXD) GetEvents

func (r *ProtocolLXD) GetEvents() (*EventListener, error)

GetEvents gets the events for the project defined on the client.

func (*ProtocolLXD) GetEventsAllProjects

func (r *ProtocolLXD) GetEventsAllProjects() (*EventListener, error)

GetEventsAllProjects gets events for all projects.

func (*ProtocolLXD) GetHTTPClient

func (r *ProtocolLXD) GetHTTPClient() (*http.Client, error)

GetHTTPClient returns the http client used for the connection. This can be used to set custom http options.

func (*ProtocolLXD) GetImage

func (r *ProtocolLXD) GetImage(fingerprint string) (*api.Image, string, error)

GetImage returns an Image struct for the provided fingerprint.

func (*ProtocolLXD) GetImageAlias

func (r *ProtocolLXD) GetImageAlias(name string) (*api.ImageAliasesEntry, string, error)

GetImageAlias returns an existing alias as an ImageAliasesEntry struct.

func (*ProtocolLXD) GetImageAliasArchitectures

func (r *ProtocolLXD) GetImageAliasArchitectures(imageType string, name string) (map[string]*api.ImageAliasesEntry, error)

GetImageAliasArchitectures returns a map of architectures / targets.

func (*ProtocolLXD) GetImageAliasNames

func (r *ProtocolLXD) GetImageAliasNames() ([]string, error)

GetImageAliasNames returns the list of available alias names.

func (*ProtocolLXD) GetImageAliasType

func (r *ProtocolLXD) GetImageAliasType(imageType string, name string) (*api.ImageAliasesEntry, string, error)

GetImageAliasType returns an existing alias as an ImageAliasesEntry struct.

func (*ProtocolLXD) GetImageAliases

func (r *ProtocolLXD) GetImageAliases() ([]api.ImageAliasesEntry, error)

GetImageAliases returns the list of available aliases as ImageAliasesEntry structs.

func (*ProtocolLXD) GetImageFile

func (r *ProtocolLXD) GetImageFile(fingerprint string, req ImageFileRequest) (*ImageFileResponse, error)

GetImageFile downloads an image from the server, returning an ImageFileRequest struct.

func (*ProtocolLXD) GetImageFingerprints

func (r *ProtocolLXD) GetImageFingerprints() ([]string, error)

GetImageFingerprints returns a list of available image fingerprints.

func (*ProtocolLXD) GetImageSecret

func (r *ProtocolLXD) GetImageSecret(fingerprint string) (string, error)

GetImageSecret is a helper around CreateImageSecret that returns a secret for the image.

func (*ProtocolLXD) GetImages

func (r *ProtocolLXD) GetImages() ([]api.Image, error)

GetImages returns a list of available images as Image structs.

func (*ProtocolLXD) GetImagesWithFilter

func (r *ProtocolLXD) GetImagesWithFilter(filters []string) ([]api.Image, error)

GetImagesWithFilter returns a filtered list of available images as Image structs.

func (*ProtocolLXD) GetInstance

func (r *ProtocolLXD) GetInstance(name string) (*api.Instance, string, error)

GetInstance returns the instance entry for the provided name.

func (*ProtocolLXD) GetInstanceBackup

func (r *ProtocolLXD) GetInstanceBackup(instanceName string, name string) (*api.InstanceBackup, string, error)

GetInstanceBackup returns a Backup struct for the provided instance and backup names.

func (*ProtocolLXD) GetInstanceBackupFile

func (r *ProtocolLXD) GetInstanceBackupFile(instanceName string, name string, req *BackupFileRequest) (*BackupFileResponse, error)

GetInstanceBackupFile requests the instance backup content.

func (*ProtocolLXD) GetInstanceBackupNames

func (r *ProtocolLXD) GetInstanceBackupNames(instanceName string) ([]string, error)

GetInstanceBackupNames returns a list of backup names for the instance.

func (*ProtocolLXD) GetInstanceBackups

func (r *ProtocolLXD) GetInstanceBackups(instanceName string) ([]api.InstanceBackup, error)

GetInstanceBackups returns a list of backups for the instance.

func (*ProtocolLXD) GetInstanceConsoleLog

func (r *ProtocolLXD) GetInstanceConsoleLog(instanceName string, args *InstanceConsoleLogArgs) (io.ReadCloser, error)

GetInstanceConsoleLog requests that LXD attaches to the console device of a instance.

Note that it's the caller's responsibility to close the returned ReadCloser.

func (*ProtocolLXD) GetInstanceFile

func (r *ProtocolLXD) GetInstanceFile(instanceName string, filePath string) (io.ReadCloser, *InstanceFileResponse, error)

GetInstanceFile retrieves the provided path from the instance.

func (*ProtocolLXD) GetInstanceFileSFTP

func (r *ProtocolLXD) GetInstanceFileSFTP(instanceName string) (*sftp.Client, error)

GetInstanceFileSFTP returns an SFTP connection to the instance.

func (*ProtocolLXD) GetInstanceFileSFTPConn

func (r *ProtocolLXD) GetInstanceFileSFTPConn(instanceName string) (net.Conn, error)

GetInstanceFileSFTPConn returns a connection to the instance's SFTP endpoint.

func (*ProtocolLXD) GetInstanceFull

func (r *ProtocolLXD) GetInstanceFull(name string) (*api.InstanceFull, string, error)

GetInstanceFull returns the instance entry for the provided name along with snapshot information.

func (*ProtocolLXD) GetInstanceLogfile

func (r *ProtocolLXD) GetInstanceLogfile(name string, filename string) (io.ReadCloser, error)

GetInstanceLogfile returns the content of the requested logfile.

Note that it's the caller's responsibility to close the returned ReadCloser.

func (*ProtocolLXD) GetInstanceLogfiles

func (r *ProtocolLXD) GetInstanceLogfiles(name string) ([]string, error)

GetInstanceLogfiles returns a list of logfiles for the instance.

func (*ProtocolLXD) GetInstanceMetadata

func (r *ProtocolLXD) GetInstanceMetadata(name string) (*api.ImageMetadata, string, error)

GetInstanceMetadata returns instance metadata.

func (*ProtocolLXD) GetInstanceNames

func (r *ProtocolLXD) GetInstanceNames(instanceType api.InstanceType) ([]string, error)

GetInstanceNames returns a list of instance names.

func (*ProtocolLXD) GetInstanceNamesAllProjects

func (r *ProtocolLXD) GetInstanceNamesAllProjects(instanceType api.InstanceType) (map[string][]string, error)

GetInstanceNamesAllProjects returns a list of instance names from all projects.

func (*ProtocolLXD) GetInstanceSnapshot

func (r *ProtocolLXD) GetInstanceSnapshot(instanceName string, name string) (*api.InstanceSnapshot, string, error)

GetInstanceSnapshot returns a Snapshot struct for the provided instance and snapshot names.

func (*ProtocolLXD) GetInstanceSnapshotNames

func (r *ProtocolLXD) GetInstanceSnapshotNames(instanceName string) ([]string, error)

GetInstanceSnapshotNames returns a list of snapshot names for the instance.

func (*ProtocolLXD) GetInstanceSnapshots

func (r *ProtocolLXD) GetInstanceSnapshots(instanceName string) ([]api.InstanceSnapshot, error)

GetInstanceSnapshots returns a list of snapshots for the instance.

func (*ProtocolLXD) GetInstanceState

func (r *ProtocolLXD) GetInstanceState(name string) (*api.InstanceState, string, error)

GetInstanceState returns a InstanceState entry for the provided instance name.

func (*ProtocolLXD) GetInstanceTemplateFile

func (r *ProtocolLXD) GetInstanceTemplateFile(instanceName string, templateName string) (io.ReadCloser, error)

GetInstanceTemplateFile returns the content of a template file for a instance.

func (*ProtocolLXD) GetInstanceTemplateFiles

func (r *ProtocolLXD) GetInstanceTemplateFiles(instanceName string) ([]string, error)

GetInstanceTemplateFiles returns the list of names of template files for a instance.

func (*ProtocolLXD) GetInstances

func (r *ProtocolLXD) GetInstances(instanceType api.InstanceType) ([]api.Instance, error)

GetInstances returns a list of instances.

func (*ProtocolLXD) GetInstancesAllProjects

func (r *ProtocolLXD) GetInstancesAllProjects(instanceType api.InstanceType) ([]api.Instance, error)

GetInstancesAllProjects returns a list of instances from all projects.

func (*ProtocolLXD) GetInstancesAllProjectsWithFilter

func (r *ProtocolLXD) GetInstancesAllProjectsWithFilter(instanceType api.InstanceType, filters []string) ([]api.Instance, error)

GetInstancesAllProjectsWithFilter returns a filtered list of instances from all projects.

func (*ProtocolLXD) GetInstancesFull

func (r *ProtocolLXD) GetInstancesFull(instanceType api.InstanceType) ([]api.InstanceFull, error)

GetInstancesFull returns a list of instances including snapshots, backups and state.

func (*ProtocolLXD) GetInstancesFullAllProjects

func (r *ProtocolLXD) GetInstancesFullAllProjects(instanceType api.InstanceType) ([]api.InstanceFull, error)

GetInstancesFullAllProjects returns a list of instances including snapshots, backups and state from all projects.

func (*ProtocolLXD) GetInstancesFullAllProjectsWithFilter

func (r *ProtocolLXD) GetInstancesFullAllProjectsWithFilter(instanceType api.InstanceType, filters []string) ([]api.InstanceFull, error)

GetInstancesFullAllProjectsWithFilter returns a filtered list of instances including snapshots, backups and state from all projects.

func (*ProtocolLXD) GetInstancesFullWithFilter

func (r *ProtocolLXD) GetInstancesFullWithFilter(instanceType api.InstanceType, filters []string) ([]api.InstanceFull, error)

GetInstancesFullWithFilter returns a filtered list of instances including snapshots, backups and state.

func (*ProtocolLXD) GetInstancesWithFilter

func (r *ProtocolLXD) GetInstancesWithFilter(instanceType api.InstanceType, filters []string) ([]api.Instance, error)

GetInstancesWithFilter returns a filtered list of instances.

func (*ProtocolLXD) GetMetrics

func (r *ProtocolLXD) GetMetrics() (string, error)

GetMetrics returns the text OpenMetrics data.

func (*ProtocolLXD) GetNetwork

func (r *ProtocolLXD) GetNetwork(name string) (*api.Network, string, error)

GetNetwork returns a Network entry for the provided name.

func (*ProtocolLXD) GetNetworkACL

func (r *ProtocolLXD) GetNetworkACL(name string) (*api.NetworkACL, string, error)

GetNetworkACL returns a Network ACL entry for the provided name.

func (*ProtocolLXD) GetNetworkACLLogfile

func (r *ProtocolLXD) GetNetworkACLLogfile(name string) (io.ReadCloser, error)

GetNetworkACLLogfile returns a reader for the ACL log file.

Note that it's the caller's responsibility to close the returned ReadCloser.

func (*ProtocolLXD) GetNetworkACLNames

func (r *ProtocolLXD) GetNetworkACLNames() ([]string, error)

GetNetworkACLNames returns a list of network ACL names.

func (*ProtocolLXD) GetNetworkACLs

func (r *ProtocolLXD) GetNetworkACLs() ([]api.NetworkACL, error)

GetNetworkACLs returns a list of Network ACL structs.

func (*ProtocolLXD) GetNetworkForward

func (r *ProtocolLXD) GetNetworkForward(networkName string, listenAddress string) (*api.NetworkForward, string, error)

GetNetworkForward returns a Network forward entry for the provided network and listen address.

func (*ProtocolLXD) GetNetworkForwardAddresses

func (r *ProtocolLXD) GetNetworkForwardAddresses(networkName string) ([]string, error)

GetNetworkForwardAddresses returns a list of network forward listen addresses.

func (*ProtocolLXD) GetNetworkForwards

func (r *ProtocolLXD) GetNetworkForwards(networkName string) ([]api.NetworkForward, error)

GetNetworkForwards returns a list of Network forward structs.

func (*ProtocolLXD) GetNetworkLeases

func (r *ProtocolLXD) GetNetworkLeases(name string) ([]api.NetworkLease, error)

GetNetworkLeases returns a list of Network struct.

func (*ProtocolLXD) GetNetworkLoadBalancer

func (r *ProtocolLXD) GetNetworkLoadBalancer(networkName string, listenAddress string) (*api.NetworkLoadBalancer, string, error)

GetNetworkLoadBalancer returns a Network load balancer entry for the provided network and listen address.

func (*ProtocolLXD) GetNetworkLoadBalancerAddresses

func (r *ProtocolLXD) GetNetworkLoadBalancerAddresses(networkName string) ([]string, error)

GetNetworkLoadBalancerAddresses returns a list of network load balancer listen addresses.

func (*ProtocolLXD) GetNetworkLoadBalancers

func (r *ProtocolLXD) GetNetworkLoadBalancers(networkName string) ([]api.NetworkLoadBalancer, error)

GetNetworkLoadBalancers returns a list of Network load balancer structs.

func (*ProtocolLXD) GetNetworkNames

func (r *ProtocolLXD) GetNetworkNames() ([]string, error)

GetNetworkNames returns a list of network names.

func (*ProtocolLXD) GetNetworkPeer

func (r *ProtocolLXD) GetNetworkPeer(networkName string, peerName string) (*api.NetworkPeer, string, error)

GetNetworkPeer returns a network peer entry for the provided network and peer name.

func (*ProtocolLXD) GetNetworkPeerNames

func (r *ProtocolLXD) GetNetworkPeerNames(networkName string) ([]string, error)

GetNetworkPeerNames returns a list of network peer names.

func (*ProtocolLXD) GetNetworkPeers

func (r *ProtocolLXD) GetNetworkPeers(networkName string) ([]api.NetworkPeer, error)

GetNetworkPeers returns a list of network peer structs.

func (*ProtocolLXD) GetNetworkState

func (r *ProtocolLXD) GetNetworkState(name string) (*api.NetworkState, error)

GetNetworkState returns metrics and information on the running network.

func (*ProtocolLXD) GetNetworkZone

func (r *ProtocolLXD) GetNetworkZone(name string) (*api.NetworkZone, string, error)

GetNetworkZone returns a Network zone entry for the provided name.

func (*ProtocolLXD) GetNetworkZoneNames

func (r *ProtocolLXD) GetNetworkZoneNames() ([]string, error)

GetNetworkZoneNames returns a list of network zone names.

func (*ProtocolLXD) GetNetworkZoneRecord

func (r *ProtocolLXD) GetNetworkZoneRecord(zone string, name string) (*api.NetworkZoneRecord, string, error)

GetNetworkZoneRecord returns a Network zone record entry for the provided zone and name.

func (*ProtocolLXD) GetNetworkZoneRecordNames

func (r *ProtocolLXD) GetNetworkZoneRecordNames(zone string) ([]string, error)

GetNetworkZoneRecordNames returns a list of network zone record names.

func (*ProtocolLXD) GetNetworkZoneRecords

func (r *ProtocolLXD) GetNetworkZoneRecords(zone string) ([]api.NetworkZoneRecord, error)

GetNetworkZoneRecords returns a list of Network zone record structs.

func (*ProtocolLXD) GetNetworkZones

func (r *ProtocolLXD) GetNetworkZones() ([]api.NetworkZone, error)

GetNetworkZones returns a list of Network zone structs.

func (*ProtocolLXD) GetNetworks

func (r *ProtocolLXD) GetNetworks() ([]api.Network, error)

GetNetworks returns a list of Network struct.

func (*ProtocolLXD) GetOperation

func (r *ProtocolLXD) GetOperation(uuid string) (*api.Operation, string, error)

GetOperation returns an Operation entry for the provided uuid.

func (*ProtocolLXD) GetOperationUUIDs

func (r *ProtocolLXD) GetOperationUUIDs() ([]string, error)

GetOperationUUIDs returns a list of operation uuids.

func (*ProtocolLXD) GetOperationWait

func (r *ProtocolLXD) GetOperationWait(uuid string, timeout int) (*api.Operation, string, error)

GetOperationWait returns an Operation entry for the provided uuid once it's complete or hits the timeout.

func (*ProtocolLXD) GetOperationWaitSecret

func (r *ProtocolLXD) GetOperationWaitSecret(uuid string, secret string, timeout int) (*api.Operation, string, error)

GetOperationWaitSecret returns an Operation entry for the provided uuid and secret once it's complete or hits the timeout.

func (*ProtocolLXD) GetOperationWebsocket

func (r *ProtocolLXD) GetOperationWebsocket(uuid string, secret string) (*websocket.Conn, error)

GetOperationWebsocket returns a websocket connection for the provided operation.

func (*ProtocolLXD) GetOperations

func (r *ProtocolLXD) GetOperations() ([]api.Operation, error)

GetOperations returns a list of Operation struct.

func (*ProtocolLXD) GetPrivateImage

func (r *ProtocolLXD) GetPrivateImage(fingerprint string, secret string) (*api.Image, string, error)

GetPrivateImage is similar to GetImage but allows passing a secret download token.

func (*ProtocolLXD) GetPrivateImageFile

func (r *ProtocolLXD) GetPrivateImageFile(fingerprint string, secret string, req ImageFileRequest) (*ImageFileResponse, error)

GetPrivateImageFile is similar to GetImageFile but allows passing a secret download token.

func (*ProtocolLXD) GetProfile

func (r *ProtocolLXD) GetProfile(name string) (*api.Profile, string, error)

GetProfile returns a Profile entry for the provided name.

func (*ProtocolLXD) GetProfileNames

func (r *ProtocolLXD) GetProfileNames() ([]string, error)

GetProfileNames returns a list of available profile names.

func (*ProtocolLXD) GetProfiles

func (r *ProtocolLXD) GetProfiles() ([]api.Profile, error)

GetProfiles returns a list of available Profile structs.

func (*ProtocolLXD) GetProject

func (r *ProtocolLXD) GetProject(name string) (*api.Project, string, error)

GetProject returns a Project entry for the provided name.

func (*ProtocolLXD) GetProjectNames

func (r *ProtocolLXD) GetProjectNames() ([]string, error)

GetProjectNames returns a list of available project names.

func (*ProtocolLXD) GetProjectState

func (r *ProtocolLXD) GetProjectState(name string) (*api.ProjectState, error)

GetProjectState returns a Project state for the provided name.

func (*ProtocolLXD) GetProjects

func (r *ProtocolLXD) GetProjects() ([]api.Project, error)

GetProjects returns a list of available Project structs.

func (*ProtocolLXD) GetServer

func (r *ProtocolLXD) GetServer() (*api.Server, string, error)

GetServer returns the server status as a Server struct.

func (*ProtocolLXD) GetServerResources

func (r *ProtocolLXD) GetServerResources() (*api.Resources, error)

GetServerResources returns the resources available to a given LXD server.

func (*ProtocolLXD) GetStoragePool

func (r *ProtocolLXD) GetStoragePool(name string) (*api.StoragePool, string, error)

GetStoragePool returns a StoragePool entry for the provided pool name.

func (*ProtocolLXD) GetStoragePoolBucket

func (r *ProtocolLXD) GetStoragePoolBucket(poolName string, bucketName string) (*api.StorageBucket, string, error)

GetStoragePoolBucket returns a storage bucket entry for the provided pool and bucket name.

func (*ProtocolLXD) GetStoragePoolBucketKey

func (r *ProtocolLXD) GetStoragePoolBucketKey(poolName string, bucketName string, keyName string) (*api.StorageBucketKey, string, error)

GetStoragePoolBucketKey returns a storage bucket key entry for the provided pool, bucket and key name.

func (*ProtocolLXD) GetStoragePoolBucketKeyNames

func (r *ProtocolLXD) GetStoragePoolBucketKeyNames(poolName string, bucketName string) ([]string, error)

GetStoragePoolBucketKeyNames returns a list of storage bucket key names.

func (*ProtocolLXD) GetStoragePoolBucketKeys

func (r *ProtocolLXD) GetStoragePoolBucketKeys(poolName string, bucketName string) ([]api.StorageBucketKey, error)

GetStoragePoolBucketKeys returns a list of storage bucket keys for the provided pool and bucket.

func (*ProtocolLXD) GetStoragePoolBucketNames

func (r *ProtocolLXD) GetStoragePoolBucketNames(poolName string) ([]string, error)

GetStoragePoolBucketNames returns a list of storage bucket names.

func (*ProtocolLXD) GetStoragePoolBuckets

func (r *ProtocolLXD) GetStoragePoolBuckets(poolName string) ([]api.StorageBucket, error)

GetStoragePoolBuckets returns a list of storage buckets for the provided pool.

func (*ProtocolLXD) GetStoragePoolNames

func (r *ProtocolLXD) GetStoragePoolNames() ([]string, error)

GetStoragePoolNames returns the names of all storage pools.

func (*ProtocolLXD) GetStoragePoolResources

func (r *ProtocolLXD) GetStoragePoolResources(name string) (*api.ResourcesStoragePool, error)

GetStoragePoolResources gets the resources available to a given storage pool.

func (*ProtocolLXD) GetStoragePoolVolume

func (r *ProtocolLXD) GetStoragePoolVolume(pool string, volType string, name string) (*api.StorageVolume, string, error)

GetStoragePoolVolume returns a StorageVolume entry for the provided pool and volume name.

func (*ProtocolLXD) GetStoragePoolVolumeBackup

func (r *ProtocolLXD) GetStoragePoolVolumeBackup(pool string, volName string, name string) (*api.StoragePoolVolumeBackup, string, error)

GetStoragePoolVolumeBackup returns a custom volume backup.

func (*ProtocolLXD) GetStoragePoolVolumeBackupFile

func (r *ProtocolLXD) GetStoragePoolVolumeBackupFile(pool string, volName string, name string, req *BackupFileRequest) (*BackupFileResponse, error)

GetStoragePoolVolumeBackupFile requests the custom volume backup content.

func (*ProtocolLXD) GetStoragePoolVolumeBackupNames

func (r *ProtocolLXD) GetStoragePoolVolumeBackupNames(pool string, volName string) ([]string, error)

GetStoragePoolVolumeBackupNames returns a list of volume backup names.

func (*ProtocolLXD) GetStoragePoolVolumeBackups

func (r *ProtocolLXD) GetStoragePoolVolumeBackups(pool string, volName string) ([]api.StoragePoolVolumeBackup, error)

GetStoragePoolVolumeBackups returns a list of custom volume backups.

func (*ProtocolLXD) GetStoragePoolVolumeNames

func (r *ProtocolLXD) GetStoragePoolVolumeNames(pool string) ([]string, error)

GetStoragePoolVolumeNames returns the names of all volumes in a pool.

func (*ProtocolLXD) GetStoragePoolVolumeNamesAllProjects

func (r *ProtocolLXD) GetStoragePoolVolumeNamesAllProjects(pool string) (map[string][]string, error)

GetStoragePoolVolumeNamesAllProjects returns the names of all volumes in a pool for all projects.

func (*ProtocolLXD) GetStoragePoolVolumeSnapshot

func (r *ProtocolLXD) GetStoragePoolVolumeSnapshot(pool string, volumeType string, volumeName string, snapshotName string) (*api.StorageVolumeSnapshot, string, error)

GetStoragePoolVolumeSnapshot returns a snapshots for the storage volume.

func (*ProtocolLXD) GetStoragePoolVolumeSnapshotNames

func (r *ProtocolLXD) GetStoragePoolVolumeSnapshotNames(pool string, volumeType string, volumeName string) ([]string, error)

GetStoragePoolVolumeSnapshotNames returns a list of snapshot names for the storage volume.

func (*ProtocolLXD) GetStoragePoolVolumeSnapshots

func (r *ProtocolLXD) GetStoragePoolVolumeSnapshots(pool string, volumeType string, volumeName string) ([]api.StorageVolumeSnapshot, error)

GetStoragePoolVolumeSnapshots returns a list of snapshots for the storage volume.

func (*ProtocolLXD) GetStoragePoolVolumeState

func (r *ProtocolLXD) GetStoragePoolVolumeState(pool string, volType string, name string) (*api.StorageVolumeState, error)

GetStoragePoolVolumeState returns a StorageVolumeState entry for the provided pool and volume name.

func (*ProtocolLXD) GetStoragePoolVolumes

func (r *ProtocolLXD) GetStoragePoolVolumes(pool string) ([]api.StorageVolume, error)

GetStoragePoolVolumes returns a list of StorageVolume entries for the provided pool.

func (*ProtocolLXD) GetStoragePoolVolumesAllProjects

func (r *ProtocolLXD) GetStoragePoolVolumesAllProjects(pool string) ([]api.StorageVolume, error)

GetStoragePoolVolumesAllProjects returns a list of StorageVolume entries for the provided pool for all projects.

func (*ProtocolLXD) GetStoragePoolVolumesWithFilter

func (r *ProtocolLXD) GetStoragePoolVolumesWithFilter(pool string, filters []string) ([]api.StorageVolume, error)

GetStoragePoolVolumesWithFilter returns a filtered list of StorageVolume entries for the provided pool.

func (*ProtocolLXD) GetStoragePoolVolumesWithFilterAllProjects

func (r *ProtocolLXD) GetStoragePoolVolumesWithFilterAllProjects(pool string, filters []string) ([]api.StorageVolume, error)

GetStoragePoolVolumesWithFilterAllProjects returns a filtered list of StorageVolume entries for the provided pool for all projects.

func (*ProtocolLXD) GetStoragePools

func (r *ProtocolLXD) GetStoragePools() ([]api.StoragePool, error)

GetStoragePools returns a list of StoragePool entries.

func (*ProtocolLXD) GetWarning

func (r *ProtocolLXD) GetWarning(UUID string) (*api.Warning, string, error)

GetWarning returns the warning with the given UUID.

func (*ProtocolLXD) GetWarningUUIDs

func (r *ProtocolLXD) GetWarningUUIDs() ([]string, error)

GetWarningUUIDs returns a list of operation uuids.

func (*ProtocolLXD) GetWarnings

func (r *ProtocolLXD) GetWarnings() ([]api.Warning, error)

GetWarnings returns a list of warnings.

func (*ProtocolLXD) HasExtension

func (r *ProtocolLXD) HasExtension(extension string) bool

HasExtension returns true if the server supports a given API extension.

func (*ProtocolLXD) IsAgent

func (r *ProtocolLXD) IsAgent() bool

IsAgent returns true if the server is a LXD agent.

func (*ProtocolLXD) IsClustered

func (r *ProtocolLXD) IsClustered() bool

IsClustered returns true if the server is part of a LXD cluster.

func (*ProtocolLXD) MigrateContainer

func (r *ProtocolLXD) MigrateContainer(name string, container api.ContainerPost) (Operation, error)

MigrateContainer requests that LXD prepares for a container migration.

func (*ProtocolLXD) MigrateContainerSnapshot

func (r *ProtocolLXD) MigrateContainerSnapshot(containerName string, name string, container api.ContainerSnapshotPost) (Operation, error)

MigrateContainerSnapshot requests that LXD prepares for a snapshot migration.

func (*ProtocolLXD) MigrateInstance

func (r *ProtocolLXD) MigrateInstance(name string, instance api.InstancePost) (Operation, error)

MigrateInstance requests that LXD prepares for a instance migration.

func (*ProtocolLXD) MigrateInstanceSnapshot

func (r *ProtocolLXD) MigrateInstanceSnapshot(instanceName string, name string, instance api.InstanceSnapshotPost) (Operation, error)

MigrateInstanceSnapshot requests that LXD prepares for a snapshot migration.

func (*ProtocolLXD) MigrateStoragePoolVolume

func (r *ProtocolLXD) MigrateStoragePoolVolume(pool string, volume api.StorageVolumePost) (Operation, error)

MigrateStoragePoolVolume requests that LXD prepares for a storage volume migration.

func (*ProtocolLXD) MoveStoragePoolVolume

func (r *ProtocolLXD) MoveStoragePoolVolume(pool string, source InstanceServer, sourcePool string, volume api.StorageVolume, args *StoragePoolVolumeMoveArgs) (RemoteOperation, error)

MoveStoragePoolVolume renames or moves an existing storage volume.

func (*ProtocolLXD) RawOperation

func (r *ProtocolLXD) RawOperation(method string, path string, data any, ETag string) (Operation, string, error)

RawOperation allows direct querying of a LXD API endpoint returning background operations.

func (*ProtocolLXD) RawQuery

func (r *ProtocolLXD) RawQuery(method string, path string, data any, ETag string) (*api.Response, string, error)

RawQuery allows directly querying the LXD API

This should only be used by internal LXD tools.

func (*ProtocolLXD) RawWebsocket

func (r *ProtocolLXD) RawWebsocket(path string) (*websocket.Conn, error)

RawWebsocket allows directly connection to LXD API websockets

This should only be used by internal LXD tools.

func (*ProtocolLXD) RebuildInstance

func (r *ProtocolLXD) RebuildInstance(instanceName string, instance api.InstanceRebuildPost) (op Operation, err error)

RebuildInstance rebuilds an instance as empty.

func (*ProtocolLXD) RebuildInstanceFromImage

func (r *ProtocolLXD) RebuildInstanceFromImage(source ImageServer, image api.Image, instanceName string, req api.InstanceRebuildPost) (RemoteOperation, error)

RebuildInstanceFromImage rebuilds an instance from an image.

func (*ProtocolLXD) RefreshImage

func (r *ProtocolLXD) RefreshImage(fingerprint string) (Operation, error)

RefreshImage requests that LXD issues an image refresh.

func (*ProtocolLXD) RenameClusterGroup

func (r *ProtocolLXD) RenameClusterGroup(name string, group api.ClusterGroupPost) error

RenameClusterGroup changes the name of an existing cluster group.

func (*ProtocolLXD) RenameClusterMember

func (r *ProtocolLXD) RenameClusterMember(name string, member api.ClusterMemberPost) error

RenameClusterMember changes the name of an existing member.

func (*ProtocolLXD) RenameContainer

func (r *ProtocolLXD) RenameContainer(name string, container api.ContainerPost) (Operation, error)

RenameContainer requests that LXD renames the container.

func (*ProtocolLXD) RenameContainerBackup

func (r *ProtocolLXD) RenameContainerBackup(containerName string, name string, backup api.ContainerBackupPost) (Operation, error)

RenameContainerBackup requests that LXD renames the backup.

func (*ProtocolLXD) RenameContainerSnapshot

func (r *ProtocolLXD) RenameContainerSnapshot(containerName string, name string, container api.ContainerSnapshotPost) (Operation, error)

RenameContainerSnapshot requests that LXD renames the snapshot.

func (*ProtocolLXD) RenameImageAlias

func (r *ProtocolLXD) RenameImageAlias(name string, alias api.ImageAliasesEntryPost) error

RenameImageAlias renames an existing image alias.

func (*ProtocolLXD) RenameInstance

func (r *ProtocolLXD) RenameInstance(name string, instance api.InstancePost) (Operation, error)

RenameInstance requests that LXD renames the instance.

func (*ProtocolLXD) RenameInstanceBackup

func (r *ProtocolLXD) RenameInstanceBackup(instanceName string, name string, backup api.InstanceBackupPost) (Operation, error)

RenameInstanceBackup requests that LXD renames the backup.

func (*ProtocolLXD) RenameInstanceSnapshot

func (r *ProtocolLXD) RenameInstanceSnapshot(instanceName string, name string, instance api.InstanceSnapshotPost) (Operation, error)

RenameInstanceSnapshot requests that LXD renames the snapshot.

func (*ProtocolLXD) RenameNetwork

func (r *ProtocolLXD) RenameNetwork(name string, network api.NetworkPost) error

RenameNetwork renames an existing network entry.

func (*ProtocolLXD) RenameNetworkACL

func (r *ProtocolLXD) RenameNetworkACL(name string, acl api.NetworkACLPost) error

RenameNetworkACL renames an existing network ACL entry.

func (*ProtocolLXD) RenameProfile

func (r *ProtocolLXD) RenameProfile(name string, profile api.ProfilePost) error

RenameProfile renames an existing profile entry.

func (*ProtocolLXD) RenameProject

func (r *ProtocolLXD) RenameProject(name string, project api.ProjectPost) (Operation, error)

RenameProject renames an existing project entry.

func (*ProtocolLXD) RenameStoragePoolVolume

func (r *ProtocolLXD) RenameStoragePoolVolume(pool string, volType string, name string, volume api.StorageVolumePost) error

RenameStoragePoolVolume renames a storage volume.

func (*ProtocolLXD) RenameStoragePoolVolumeBackup

func (r *ProtocolLXD) RenameStoragePoolVolumeBackup(pool string, volName string, name string, backup api.StoragePoolVolumeBackupPost) (Operation, error)

RenameStoragePoolVolumeBackup renames a custom volume backup.

func (*ProtocolLXD) RenameStoragePoolVolumeSnapshot

func (r *ProtocolLXD) RenameStoragePoolVolumeSnapshot(pool string, volumeType string, volumeName string, snapshotName string, snapshot api.StorageVolumeSnapshotPost) (Operation, error)

RenameStoragePoolVolumeSnapshot renames a storage volume snapshot.

func (*ProtocolLXD) RequireAuthenticated

func (r *ProtocolLXD) RequireAuthenticated(authenticated bool)

RequireAuthenticated sets whether we expect to be authenticated with the server.

func (*ProtocolLXD) SendEvent

func (r *ProtocolLXD) SendEvent(event api.Event) error

SendEvent send an event to the server via the client's event listener connection.

func (*ProtocolLXD) SetContainerMetadata

func (r *ProtocolLXD) SetContainerMetadata(name string, metadata api.ImageMetadata, ETag string) error

SetContainerMetadata sets the content of the container metadata file.

func (*ProtocolLXD) UpdateCertificate

func (r *ProtocolLXD) UpdateCertificate(fingerprint string, certificate api.CertificatePut, ETag string) error

UpdateCertificate updates the certificate definition.

func (*ProtocolLXD) UpdateCluster

func (r *ProtocolLXD) UpdateCluster(cluster api.ClusterPut, ETag string) (Operation, error)

UpdateCluster requests to bootstrap a new cluster or join an existing one.

func (*ProtocolLXD) UpdateClusterCertificate

func (r *ProtocolLXD) UpdateClusterCertificate(certs api.ClusterCertificatePut, ETag string) error

UpdateClusterCertificate updates the cluster certificate for every node in the cluster.

func (*ProtocolLXD) UpdateClusterGroup

func (r *ProtocolLXD) UpdateClusterGroup(name string, group api.ClusterGroupPut, ETag string) error

UpdateClusterGroup updates information about the given cluster group.

func (*ProtocolLXD) UpdateClusterMember

func (r *ProtocolLXD) UpdateClusterMember(name string, member api.ClusterMemberPut, ETag string) error

UpdateClusterMember updates information about the given member.

func (*ProtocolLXD) UpdateClusterMemberState

func (r *ProtocolLXD) UpdateClusterMemberState(name string, state api.ClusterMemberStatePost) (Operation, error)

UpdateClusterMemberState evacuates or restores a cluster member.

func (*ProtocolLXD) UpdateContainer

func (r *ProtocolLXD) UpdateContainer(name string, container api.ContainerPut, ETag string) (Operation, error)

UpdateContainer updates the container definition.

func (*ProtocolLXD) UpdateContainerSnapshot

func (r *ProtocolLXD) UpdateContainerSnapshot(containerName string, name string, container api.ContainerSnapshotPut, ETag string) (Operation, error)

UpdateContainerSnapshot requests that LXD updates the container snapshot.

func (*ProtocolLXD) UpdateContainerState

func (r *ProtocolLXD) UpdateContainerState(name string, state api.ContainerStatePut, ETag string) (Operation, error)

UpdateContainerState updates the container to match the requested state.

func (*ProtocolLXD) UpdateContainerTemplateFile

func (r *ProtocolLXD) UpdateContainerTemplateFile(containerName string, templateName string, content io.ReadSeeker) error

UpdateContainerTemplateFile updates the content for a container template file.

func (*ProtocolLXD) UpdateImage

func (r *ProtocolLXD) UpdateImage(fingerprint string, image api.ImagePut, ETag string) error

UpdateImage updates the image definition.

func (*ProtocolLXD) UpdateImageAlias

func (r *ProtocolLXD) UpdateImageAlias(name string, alias api.ImageAliasesEntryPut, ETag string) error

UpdateImageAlias updates the image alias definition.

func (*ProtocolLXD) UpdateInstance

func (r *ProtocolLXD) UpdateInstance(name string, instance api.InstancePut, ETag string) (Operation, error)

UpdateInstance updates the instance definition.

func (*ProtocolLXD) UpdateInstanceMetadata

func (r *ProtocolLXD) UpdateInstanceMetadata(name string, metadata api.ImageMetadata, ETag string) error

UpdateInstanceMetadata sets the content of the instance metadata file.

func (*ProtocolLXD) UpdateInstanceSnapshot

func (r *ProtocolLXD) UpdateInstanceSnapshot(instanceName string, name string, instance api.InstanceSnapshotPut, ETag string) (Operation, error)

UpdateInstanceSnapshot requests that LXD updates the instance snapshot.

func (*ProtocolLXD) UpdateInstanceState

func (r *ProtocolLXD) UpdateInstanceState(name string, state api.InstanceStatePut, ETag string) (Operation, error)

UpdateInstanceState updates the instance to match the requested state.

func (*ProtocolLXD) UpdateInstances

func (r *ProtocolLXD) UpdateInstances(state api.InstancesPut, ETag string) (Operation, error)

UpdateInstances updates all instances to match the requested state.

func (*ProtocolLXD) UpdateNetwork

func (r *ProtocolLXD) UpdateNetwork(name string, network api.NetworkPut, ETag string) error

UpdateNetwork updates the network to match the provided Network struct.

func (*ProtocolLXD) UpdateNetworkACL

func (r *ProtocolLXD) UpdateNetworkACL(name string, acl api.NetworkACLPut, ETag string) error

UpdateNetworkACL updates the network ACL to match the provided struct.

func (*ProtocolLXD) UpdateNetworkForward

func (r *ProtocolLXD) UpdateNetworkForward(networkName string, listenAddress string, forward api.NetworkForwardPut, ETag string) error

UpdateNetworkForward updates the network forward to match the provided struct.

func (*ProtocolLXD) UpdateNetworkLoadBalancer

func (r *ProtocolLXD) UpdateNetworkLoadBalancer(networkName string, listenAddress string, loadBalancer api.NetworkLoadBalancerPut, ETag string) error

UpdateNetworkLoadBalancer updates the network load balancer to match the provided struct.

func (*ProtocolLXD) UpdateNetworkPeer

func (r *ProtocolLXD) UpdateNetworkPeer(networkName string, peerName string, peer api.NetworkPeerPut, ETag string) error

UpdateNetworkPeer updates the network peer to match the provided struct.

func (*ProtocolLXD) UpdateNetworkZone

func (r *ProtocolLXD) UpdateNetworkZone(name string, zone api.NetworkZonePut, ETag string) error

UpdateNetworkZone updates the network zone to match the provided struct.

func (*ProtocolLXD) UpdateNetworkZoneRecord

func (r *ProtocolLXD) UpdateNetworkZoneRecord(zone string, name string, record api.NetworkZoneRecordPut, ETag string) error

UpdateNetworkZoneRecord updates the network zone record to match the provided struct.

func (*ProtocolLXD) UpdateProfile

func (r *ProtocolLXD) UpdateProfile(name string, profile api.ProfilePut, ETag string) error

UpdateProfile updates the profile to match the provided Profile struct.

func (*ProtocolLXD) UpdateProject

func (r *ProtocolLXD) UpdateProject(name string, project api.ProjectPut, ETag string) error

UpdateProject updates the project to match the provided Project struct.

func (*ProtocolLXD) UpdateServer

func (r *ProtocolLXD) UpdateServer(server api.ServerPut, ETag string) error

UpdateServer updates the server status to match the provided Server struct.

func (*ProtocolLXD) UpdateStoragePool

func (r *ProtocolLXD) UpdateStoragePool(name string, pool api.StoragePoolPut, ETag string) error

UpdateStoragePool updates the pool to match the provided StoragePool struct.

func (*ProtocolLXD) UpdateStoragePoolBucket

func (r *ProtocolLXD) UpdateStoragePoolBucket(poolName string, bucketName string, bucket api.StorageBucketPut, ETag string) error

UpdateStoragePoolBucket updates the storage bucket to match the provided struct.

func (*ProtocolLXD) UpdateStoragePoolBucketKey

func (r *ProtocolLXD) UpdateStoragePoolBucketKey(poolName string, bucketName string, keyName string, key api.StorageBucketKeyPut, ETag string) error

UpdateStoragePoolBucketKey updates an existing storage bucket key.

func (*ProtocolLXD) UpdateStoragePoolVolume

func (r *ProtocolLXD) UpdateStoragePoolVolume(pool string, volType string, name string, volume api.StorageVolumePut, ETag string) error

UpdateStoragePoolVolume updates the volume to match the provided StoragePoolVolume struct.

func (*ProtocolLXD) UpdateStoragePoolVolumeSnapshot

func (r *ProtocolLXD) UpdateStoragePoolVolumeSnapshot(pool string, volumeType string, volumeName string, snapshotName string, volume api.StorageVolumeSnapshotPut, ETag string) error

UpdateStoragePoolVolumeSnapshot updates the volume to match the provided StoragePoolVolume struct.

func (*ProtocolLXD) UpdateWarning

func (r *ProtocolLXD) UpdateWarning(UUID string, warning api.WarningPut, ETag string) error

UpdateWarning updates the warning with the given UUID.

func (*ProtocolLXD) UseProject

func (r *ProtocolLXD) UseProject(name string) InstanceServer

UseProject returns a client that will use a specific project.

func (*ProtocolLXD) UseTarget

func (r *ProtocolLXD) UseTarget(name string) InstanceServer

UseTarget returns a client that will target a specific cluster member. Use this member-specific operations such as specific container placement, preparing a new storage pool or network, ...

func (*ProtocolLXD) WithContext

func (r *ProtocolLXD) WithContext(ctx context.Context) InstanceServer

WithContext returns a client that will add context.Context.

type ProtocolSimpleStreams

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

ProtocolSimpleStreams implements a SimpleStreams API client.

func (*ProtocolSimpleStreams) Disconnect

func (r *ProtocolSimpleStreams) Disconnect()

Disconnect is a no-op for simplestreams.

func (*ProtocolSimpleStreams) DoHTTP

func (r *ProtocolSimpleStreams) DoHTTP(req *http.Request) (*http.Response, error)

DoHTTP performs a Request, using macaroon authentication if set.

func (*ProtocolSimpleStreams) ExportImage

func (r *ProtocolSimpleStreams) ExportImage(fingerprint string, image api.ImageExportPost) (Operation, error)

ExportImage exports (copies) an image to a remote server.

func (*ProtocolSimpleStreams) GetConnectionInfo

func (r *ProtocolSimpleStreams) GetConnectionInfo() (*ConnectionInfo, error)

GetConnectionInfo returns the basic connection information used to interact with the server.

func (*ProtocolSimpleStreams) GetHTTPClient

func (r *ProtocolSimpleStreams) GetHTTPClient() (*http.Client, error)

GetHTTPClient returns the http client used for the connection. This can be used to set custom http options.

func (*ProtocolSimpleStreams) GetImage

func (r *ProtocolSimpleStreams) GetImage(fingerprint string) (*api.Image, string, error)

GetImage returns an Image struct for the provided fingerprint.

func (*ProtocolSimpleStreams) GetImageAlias

func (r *ProtocolSimpleStreams) GetImageAlias(name string) (*api.ImageAliasesEntry, string, error)

GetImageAlias returns an existing alias as an ImageAliasesEntry struct.

func (*ProtocolSimpleStreams) GetImageAliasArchitectures

func (r *ProtocolSimpleStreams) GetImageAliasArchitectures(imageType string, name string) (map[string]*api.ImageAliasesEntry, error)

GetImageAliasArchitectures returns a map of architectures / targets.

func (*ProtocolSimpleStreams) GetImageAliasNames

func (r *ProtocolSimpleStreams) GetImageAliasNames() ([]string, error)

GetImageAliasNames returns the list of available alias names.

func (*ProtocolSimpleStreams) GetImageAliasType

func (r *ProtocolSimpleStreams) GetImageAliasType(imageType string, name string) (*api.ImageAliasesEntry, string, error)

GetImageAliasType returns an existing alias as an ImageAliasesEntry struct.

func (*ProtocolSimpleStreams) GetImageAliases

func (r *ProtocolSimpleStreams) GetImageAliases() ([]api.ImageAliasesEntry, error)

GetImageAliases returns the list of available aliases as ImageAliasesEntry structs.

func (*ProtocolSimpleStreams) GetImageFile

func (r *ProtocolSimpleStreams) GetImageFile(fingerprint string, req ImageFileRequest) (*ImageFileResponse, error)

GetImageFile downloads an image from the server, returning an ImageFileResponse struct.

func (*ProtocolSimpleStreams) GetImageFingerprints

func (r *ProtocolSimpleStreams) GetImageFingerprints() ([]string, error)

GetImageFingerprints returns a list of available image fingerprints.

func (*ProtocolSimpleStreams) GetImageSecret

func (r *ProtocolSimpleStreams) GetImageSecret(fingerprint string) (string, error)

GetImageSecret isn't relevant for the simplestreams protocol.

func (*ProtocolSimpleStreams) GetImages

func (r *ProtocolSimpleStreams) GetImages() ([]api.Image, error)

GetImages returns a list of available images as Image structs.

func (*ProtocolSimpleStreams) GetImagesWithFilter

func (r *ProtocolSimpleStreams) GetImagesWithFilter(filters []string) ([]api.Image, error)

GetImagesWithFilter returns a filtered list of available images as Image structs.

func (*ProtocolSimpleStreams) GetPrivateImage

func (r *ProtocolSimpleStreams) GetPrivateImage(fingerprint string, secret string) (*api.Image, string, error)

GetPrivateImage isn't relevant for the simplestreams protocol.

func (*ProtocolSimpleStreams) GetPrivateImageFile

func (r *ProtocolSimpleStreams) GetPrivateImageFile(fingerprint string, secret string, req ImageFileRequest) (*ImageFileResponse, error)

GetPrivateImageFile isn't relevant for the simplestreams protocol.

type RemoteOperation

type RemoteOperation interface {
	AddHandler(function func(api.Operation)) (target *EventTarget, err error)
	CancelTarget() (err error)
	GetTarget() (op *api.Operation, err error)
	Wait() (err error)
}

The RemoteOperation type represents an Operation that may be using multiple servers.

type Server

type Server interface {
	GetConnectionInfo() (info *ConnectionInfo, err error)
	GetHTTPClient() (client *http.Client, err error)
	DoHTTP(req *http.Request) (resp *http.Response, err error)
	Disconnect()
}

The Server type represents a generic read-only server.

type StoragePoolVolumeBackupArgs

type StoragePoolVolumeBackupArgs struct {
	// The backup file
	BackupFile io.Reader

	// Name to import backup as
	Name string
}

The StoragePoolVolumeBackupArgs struct is used when creating a storage volume from a backup. API extension: custom_volume_backup.

type StoragePoolVolumeCopyArgs

type StoragePoolVolumeCopyArgs struct {
	// New name for the target
	Name string

	// The transfer mode, can be "pull" (default), "push" or "relay"
	Mode string

	// API extension: storage_api_volume_snapshots
	VolumeOnly bool

	// API extension: custom_volume_refresh
	Refresh bool
}

The StoragePoolVolumeCopyArgs struct is used to pass additional options during storage volume copy.

type StoragePoolVolumeMoveArgs

type StoragePoolVolumeMoveArgs struct {
	StoragePoolVolumeCopyArgs

	// API extension: storage_volume_project_move
	Project string
}

The StoragePoolVolumeMoveArgs struct is used to pass additional options during storage volume move.

Jump to

Keyboard shortcuts

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