lxd

package
v0.0.0-...-b84de06 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: Apache-2.0 Imports: 28 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 containers, images, moving them around, ...

Example - container 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
}

// Container creation request
req := api.ContainersPost{
  Name: "my-container",
  Source: api.ContainerSource{
    Type:  "image",
    Alias: "my-image",
  },
}

// Get LXD to create the container (background operation)
op, err := c.CreateContainer(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 container (background operation)
reqState := api.ContainerStatePut{
  Action: "start",
  Timeout: -1,
}

op, err = c.UpdateContainerState(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.ContainerExecPost{
  Command: []string{"bash"},
  WaitForWS: true,
  Interactive: true,
  Width: 80,
  Height: 15,
}

// Setup the exec arguments (fds)
args := lxd.ContainerExecArgs{
  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.ExecContainer("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.Canceler
}

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

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

	// Cookie jar
	CookieJar http.CookieJar

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

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 hangs 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 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
}

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.Canceler

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

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

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
}

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

	// Container functions
	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)
	GetInstances(instanceType api.InstanceType) (instances []api.Instance, err error)
	GetInstancesFull(instanceType api.InstanceType) (instances []api.InstanceFull, err error)
	GetInstance(name string) (instance *api.Instance, 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)

	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)

	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)
	SetInstanceMetadata(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)
	UpdateInstanceTemplateFile(instanceName string, templateName string, content io.ReadSeeker) (err error)
	DeleteInstanceTemplateFile(name string, templateName string) (err error)

	// Event handling functions
	GetEvents() (listener *EventListener, err 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)

	// 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)
	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 volume functions ("storage" API extension)
	GetStoragePoolVolumeNames(pool string) (names []string, err error)
	GetStoragePoolVolumes(pool string) (volumes []api.StorageVolume, err error)
	GetStoragePoolVolume(pool string, volType string, name string) (volume *api.StorageVolume, ETag string, 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)

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

	// Internal functions (for internal use)
	RawQuery(method string, path string, data interface{}, queryETag string) (resp *api.Response, ETag string, err error)
	RawWebsocket(path string) (conn *websocket.Conn, err error)
	RawOperation(method string, path string, data interface{}, 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 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.

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

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

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

CreateStoragePoolVolume defines a new storage volume

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

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

DeleteStoragePoolVolume deletes a storage pool

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

func (r *ProtocolLXD) Disconnect()

Disconnect gets rid of any background goroutines

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) 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) 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 connects to the LXD monitoring interface

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

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

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

func (*ProtocolLXD) GetNetwork

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

GetNetwork returns a Network entry for the provided name

func (*ProtocolLXD) GetNetworkLeases

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

GetNetworkLeases returns a list of Network struct

func (*ProtocolLXD) GetNetworkNames

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

GetNetworkNames returns a list of network names

func (*ProtocolLXD) GetNetworkState

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

GetNetworkState returns metrics and information on the running network

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

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

GetStoragePoolVolumeNames returns the names of all volumes in a pool

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

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

GetStoragePoolVolumes returns a list of StorageVolume entries for the provided pool

func (*ProtocolLXD) GetStoragePools

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

GetStoragePools returns a list of StoragePool entries

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 interface{}, 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 interface{}, 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) RefreshImage

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

RefreshImage requests that LXD issues an image refresh

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

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

SetContainerMetadata sets the content of the container metadata file.

func (*ProtocolLXD) SetInstanceMetadata

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

SetInstanceMetadata sets the content of the instance 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) UpdateClusterMember

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

UpdateClusterMember updates information about the given 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) 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) UpdateInstanceTemplateFile

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

UpdateInstanceTemplateFile updates the content for a instance template file.

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) 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) 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) 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, ...

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) 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) 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)
	Disconnect()
}

The Server type represents a generic read-only server.

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
}

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

type StoragePoolVolumeMoveArgs

type StoragePoolVolumeMoveArgs struct {
	StoragePoolVolumeCopyArgs
}

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