lxd: github.com/lxc/lxd/client Index | Files

package lxd

import "github.com/lxc/lxd/client"

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

Package Files

connection.go doc.go events.go interfaces.go lxd.go lxd_certificates.go lxd_cluster.go lxd_containers.go lxd_events.go lxd_images.go lxd_networks.go lxd_operations.go lxd_profiles.go lxd_projects.go lxd_server.go lxd_storage_pools.go lxd_storage_volumes.go operations.go simplestreams.go simplestreams_images.go util.go

type BackupFileRequest Uses

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 Uses

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

The BackupFileResponse struct is used as the response for backup downloads

type ConnectionArgs Uses

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
}

ConnectionArgs represents a set of common connection properties

type ConnectionInfo Uses

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

The ConnectionInfo struct represents general information for a connection

type ContainerBackupArgs Uses

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

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

type ContainerConsoleArgs Uses

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 Uses

type ContainerConsoleLogArgs struct {
}

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

type ContainerCopyArgs Uses

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 Uses

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 Uses

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 Uses

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 Uses

type ContainerServer 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 ContainerServer)
    UseProject(name string) (client ContainerServer)

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

    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)

    // 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)
    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 ContainerServer, sourcePool string, volume api.StorageVolume, args *StoragePoolVolumeCopyArgs) (op RemoteOperation, err error)
    MoveStoragePoolVolume(pool string, source ContainerServer, 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)
    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 ContainerServer type represents a full featured LXD server.

func ConnectLXD Uses

func ConnectLXD(url string, args *ConnectionArgs) (ContainerServer, 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 ConnectLXDUnix Uses

func ConnectLXDUnix(path string, args *ConnectionArgs) (ContainerServer, 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 ContainerSnapshotCopyArgs Uses

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 Uses

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

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

func (*EventListener) AddHandler Uses

func (e *EventListener) AddHandler(types []string, function func(interface{})) (*EventTarget, error)

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

func (*EventListener) Disconnect Uses

func (e *EventListener) Disconnect()

Disconnect must be used once done listening for events

func (*EventListener) IsActive Uses

func (e *EventListener) IsActive() bool

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

func (*EventListener) RemoveHandler Uses

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

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

func (*EventListener) Wait Uses

func (e *EventListener) Wait() error

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

type EventTarget Uses

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

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

type ImageCopyArgs Uses

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 ImageCopyArgs struct is used to pass additional options during image copy

type ImageCreateArgs Uses

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

The ImageCreateArgs struct is used for direct image upload

type ImageFileRequest Uses

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 Uses

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 Uses

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

The ImageServer type represents a read-only image server.

func ConnectPublicLXD Uses

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 Uses

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 Operation Uses

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 Uses

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

ProtocolLXD represents a LXD API server

func (*ProtocolLXD) ConsoleContainer Uses

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

func (r *ProtocolLXD) CopyContainer(source ContainerServer, 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 Uses

func (r *ProtocolLXD) CopyContainerSnapshot(source ContainerServer, 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 Uses

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

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

CopyStoragePoolVolume copies an existing storage volume

func (*ProtocolLXD) CreateCertificate Uses

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

CreateCertificate adds a new certificate to the LXD trust store

func (*ProtocolLXD) CreateContainer Uses

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

CreateContainer requests that LXD creates a new container

func (*ProtocolLXD) CreateContainerBackup Uses

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 Uses

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

CreateContainerFile tells LXD to create a file in the container

func (*ProtocolLXD) CreateContainerFromBackup Uses

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 Uses

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 Uses

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 Uses

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

CreateContainerTemplateFile creates an a template for a container.

func (*ProtocolLXD) CreateImage Uses

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 Uses

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

CreateImageAlias sets up a new image alias

func (*ProtocolLXD) CreateImageSecret Uses

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

CreateImageSecret requests that LXD issues a temporary image secret

func (*ProtocolLXD) CreateNetwork Uses

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

CreateNetwork defines a new network using the provided Network struct

func (*ProtocolLXD) CreateProfile Uses

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

CreateProfile defines a new container profile

func (*ProtocolLXD) CreateProject Uses

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

CreateProject defines a new container project

func (*ProtocolLXD) CreateStoragePool Uses

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

CreateStoragePool defines a new storage pool using the provided StoragePool struct

func (*ProtocolLXD) CreateStoragePoolVolume Uses

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

CreateStoragePoolVolume defines a new storage volume

func (*ProtocolLXD) CreateStoragePoolVolumeSnapshot Uses

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

CreateStoragePoolVolumeSnapshot defines a new storage volume

func (*ProtocolLXD) DeleteCertificate Uses

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

DeleteCertificate removes a certificate from the LXD trust store

func (*ProtocolLXD) DeleteClusterMember Uses

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 Uses

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

DeleteContainer requests that LXD deletes the container

func (*ProtocolLXD) DeleteContainerBackup Uses

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

DeleteContainerBackup requests that LXD deletes the container backup

func (*ProtocolLXD) DeleteContainerConsoleLog Uses

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

DeleteContainerConsoleLog deletes the requested container's console log

func (*ProtocolLXD) DeleteContainerFile Uses

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

DeleteContainerFile deletes a file in the container

func (*ProtocolLXD) DeleteContainerLogfile Uses

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

DeleteContainerLogfile deletes the requested logfile

func (*ProtocolLXD) DeleteContainerSnapshot Uses

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

DeleteContainerSnapshot requests that LXD deletes the container snapshot

func (*ProtocolLXD) DeleteContainerTemplateFile Uses

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

DeleteContainerTemplateFile deletes a template file for a container.

func (*ProtocolLXD) DeleteImage Uses

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

DeleteImage requests that LXD removes an image from the store

func (*ProtocolLXD) DeleteImageAlias Uses

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

DeleteImageAlias removes an alias from the LXD image store

func (*ProtocolLXD) DeleteNetwork Uses

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

DeleteNetwork deletes an existing network

func (*ProtocolLXD) DeleteOperation Uses

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

DeleteOperation deletes (cancels) a running operation

func (*ProtocolLXD) DeleteProfile Uses

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

DeleteProfile deletes a profile

func (*ProtocolLXD) DeleteProject Uses

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

DeleteProject deletes a project

func (*ProtocolLXD) DeleteStoragePool Uses

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

DeleteStoragePool deletes a storage pool

func (*ProtocolLXD) DeleteStoragePoolVolume Uses

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

DeleteStoragePoolVolume deletes a storage pool

func (*ProtocolLXD) DeleteStoragePoolVolumeSnapshot Uses

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

DeleteStoragePoolVolumeSnapshot deletes a storage volume snapshot

func (*ProtocolLXD) ExecContainer Uses

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

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

GetCertificate returns the certificate entry for the provided fingerprint

func (*ProtocolLXD) GetCertificateFingerprints Uses

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

GetCertificateFingerprints returns a list of certificate fingerprints

func (*ProtocolLXD) GetCertificates Uses

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

GetCertificates returns a list of certificates

func (*ProtocolLXD) GetCluster Uses

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 Uses

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

GetClusterMember returns information about the given member

func (*ProtocolLXD) GetClusterMemberNames Uses

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

GetClusterMemberNames returns the URLs of the current members in the cluster

func (*ProtocolLXD) GetClusterMembers Uses

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

GetClusterMembers returns the current members of the cluster

func (*ProtocolLXD) GetConnectionInfo Uses

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

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

func (*ProtocolLXD) GetContainer Uses

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

GetContainer returns the container entry for the provided name

func (*ProtocolLXD) GetContainerBackup Uses

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 Uses

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

GetContainerBackupFile requests the container backup content

func (*ProtocolLXD) GetContainerBackupNames Uses

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

GetContainerBackupNames returns a list of backup names for the container

func (*ProtocolLXD) GetContainerBackups Uses

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

GetContainerBackups returns a list of backups for the container

func (*ProtocolLXD) GetContainerConsoleLog Uses

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 Uses

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

GetContainerFile retrieves the provided path from the container

func (*ProtocolLXD) GetContainerLogfile Uses

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 Uses

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

GetContainerLogfiles returns a list of logfiles for the container

func (*ProtocolLXD) GetContainerMetadata Uses

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

GetContainerMetadata returns container metadata.

func (*ProtocolLXD) GetContainerNames Uses

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

GetContainerNames returns a list of container names

func (*ProtocolLXD) GetContainerSnapshot Uses

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 Uses

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

GetContainerSnapshotNames returns a list of snapshot names for the container

func (*ProtocolLXD) GetContainerSnapshots Uses

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

GetContainerSnapshots returns a list of snapshots for the container

func (*ProtocolLXD) GetContainerState Uses

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

GetContainerState returns a ContainerState entry for the provided container name

func (*ProtocolLXD) GetContainerTemplateFile Uses

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 Uses

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

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

func (*ProtocolLXD) GetContainers Uses

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

GetContainers returns a list of containers

func (*ProtocolLXD) GetContainersFull Uses

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

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

func (*ProtocolLXD) GetEvents Uses

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

GetEvents connects to the LXD monitoring interface

func (*ProtocolLXD) GetHTTPClient Uses

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 Uses

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

GetImage returns an Image struct for the provided fingerprint

func (*ProtocolLXD) GetImageAlias Uses

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

GetImageAlias returns an existing alias as an ImageAliasesEntry struct

func (*ProtocolLXD) GetImageAliasNames Uses

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

GetImageAliasNames returns the list of available alias names

func (*ProtocolLXD) GetImageAliases Uses

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

GetImageAliases returns the list of available aliases as ImageAliasesEntry structs

func (*ProtocolLXD) GetImageFile Uses

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

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

func (*ProtocolLXD) GetImageFingerprints Uses

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

GetImageFingerprints returns a list of available image fingerprints

func (*ProtocolLXD) GetImageSecret Uses

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

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

func (*ProtocolLXD) GetImages Uses

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

GetImages returns a list of available images as Image structs

func (*ProtocolLXD) GetNetwork Uses

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

GetNetwork returns a Network entry for the provided name

func (*ProtocolLXD) GetNetworkLeases Uses

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

GetNetworkLeases returns a list of Network struct

func (*ProtocolLXD) GetNetworkNames Uses

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

GetNetworkNames returns a list of network names

func (*ProtocolLXD) GetNetworkState Uses

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

GetNetworkState returns metrics and information on the running network

func (*ProtocolLXD) GetNetworks Uses

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

GetNetworks returns a list of Network struct

func (*ProtocolLXD) GetOperation Uses

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

GetOperation returns an Operation entry for the provided uuid

func (*ProtocolLXD) GetOperationUUIDs Uses

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

GetOperationUUIDs returns a list of operation uuids

func (*ProtocolLXD) GetOperationWait Uses

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

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

GetOperationWebsocket returns a websocket connection for the provided operation

func (*ProtocolLXD) GetOperations Uses

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

GetOperations returns a list of Operation struct

func (*ProtocolLXD) GetPrivateImage Uses

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 Uses

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 Uses

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

GetProfile returns a Profile entry for the provided name

func (*ProtocolLXD) GetProfileNames Uses

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

GetProfileNames returns a list of available profile names

func (*ProtocolLXD) GetProfiles Uses

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

GetProfiles returns a list of available Profile structs

func (*ProtocolLXD) GetProject Uses

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

GetProject returns a Project entry for the provided name

func (*ProtocolLXD) GetProjectNames Uses

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

GetProjectNames returns a list of available project names

func (*ProtocolLXD) GetProjects Uses

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

GetProjects returns a list of available Project structs

func (*ProtocolLXD) GetServer Uses

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

GetServer returns the server status as a Server struct

func (*ProtocolLXD) GetServerResources Uses

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

GetServerResources returns the resources available to a given LXD server

func (*ProtocolLXD) GetStoragePool Uses

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

GetStoragePool returns a StoragePool entry for the provided pool name

func (*ProtocolLXD) GetStoragePoolNames Uses

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

GetStoragePoolNames returns the names of all storage pools

func (*ProtocolLXD) GetStoragePoolResources Uses

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

GetStoragePoolResources gets the resources available to a given storage pool

func (*ProtocolLXD) GetStoragePoolVolume Uses

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 Uses

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

GetStoragePoolVolumeNames returns the names of all volumes in a pool

func (*ProtocolLXD) GetStoragePoolVolumeSnapshot Uses

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 Uses

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 Uses

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 Uses

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

GetStoragePoolVolumes returns a list of StorageVolume entries for the provided pool

func (*ProtocolLXD) GetStoragePools Uses

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

GetStoragePools returns a list of StoragePool entries

func (*ProtocolLXD) HasExtension Uses

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

HasExtension returns true if the server supports a given API extension

func (*ProtocolLXD) IsClustered Uses

func (r *ProtocolLXD) IsClustered() bool

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

func (*ProtocolLXD) MigrateContainer Uses

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

MigrateContainer requests that LXD prepares for a container migration

func (*ProtocolLXD) MigrateContainerSnapshot Uses

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

MigrateContainerSnapshot requests that LXD prepares for a snapshot migration

func (*ProtocolLXD) MigrateStoragePoolVolume Uses

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

MigrateStoragePoolVolume requests that LXD prepares for a storage volume migration

func (*ProtocolLXD) MoveStoragePoolVolume Uses

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

MoveStoragePoolVolume renames or moves an existing storage volume

func (*ProtocolLXD) RawOperation Uses

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 Uses

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 Uses

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 Uses

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

RefreshImage requests that LXD issues an image refresh

func (*ProtocolLXD) RenameClusterMember Uses

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

RenameClusterMember changes the name of an existing member

func (*ProtocolLXD) RenameContainer Uses

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

RenameContainer requests that LXD renames the container

func (*ProtocolLXD) RenameContainerBackup Uses

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

RenameContainerBackup requests that LXD renames the backup

func (*ProtocolLXD) RenameContainerSnapshot Uses

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

RenameContainerSnapshot requests that LXD renames the snapshot

func (*ProtocolLXD) RenameImageAlias Uses

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

RenameImageAlias renames an existing image alias

func (*ProtocolLXD) RenameNetwork Uses

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

RenameNetwork renames an existing network entry

func (*ProtocolLXD) RenameProfile Uses

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

RenameProfile renames an existing profile entry

func (*ProtocolLXD) RenameProject Uses

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

RenameProject renames an existing project entry

func (*ProtocolLXD) RenameStoragePoolVolume Uses

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

RenameStoragePoolVolume renames a storage volume

func (*ProtocolLXD) RenameStoragePoolVolumeSnapshot Uses

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 Uses

func (r *ProtocolLXD) RequireAuthenticated(authenticated bool)

RequireAuthenticated sets whether we expect to be authenticated with the server

func (*ProtocolLXD) SetContainerMetadata Uses

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

SetContainerMetadata sets the content of the container metadata file.

func (*ProtocolLXD) UpdateCertificate Uses

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

UpdateCertificate updates the certificate definition

func (*ProtocolLXD) UpdateCluster Uses

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

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

UpdateContainer updates the container definition

func (*ProtocolLXD) UpdateContainerState Uses

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 Uses

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

UpdateContainerTemplateFile updates the content for a container template file.

func (*ProtocolLXD) UpdateImage Uses

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

UpdateImage updates the image definition

func (*ProtocolLXD) UpdateImageAlias Uses

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

UpdateImageAlias updates the image alias definition

func (*ProtocolLXD) UpdateNetwork Uses

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 Uses

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 Uses

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 Uses

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

UpdateServer updates the server status to match the provided Server struct

func (*ProtocolLXD) UpdateStoragePool Uses

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 Uses

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 Uses

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 Uses

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

UseProject returns a client that will use a specific project.

func (*ProtocolLXD) UseTarget Uses

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

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 Uses

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

ProtocolSimpleStreams implements a SimpleStreams API client

func (*ProtocolSimpleStreams) GetConnectionInfo Uses

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

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

func (*ProtocolSimpleStreams) GetHTTPClient Uses

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 Uses

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

GetImage returns an Image struct for the provided fingerprint

func (*ProtocolSimpleStreams) GetImageAlias Uses

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

GetImageAlias returns an existing alias as an ImageAliasesEntry struct

func (*ProtocolSimpleStreams) GetImageAliasNames Uses

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

GetImageAliasNames returns the list of available alias names

func (*ProtocolSimpleStreams) GetImageAliases Uses

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

GetImageAliases returns the list of available aliases as ImageAliasesEntry structs

func (*ProtocolSimpleStreams) GetImageFile Uses

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

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

func (*ProtocolSimpleStreams) GetImageFingerprints Uses

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

GetImageFingerprints returns a list of available image fingerprints

func (*ProtocolSimpleStreams) GetImageSecret Uses

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

GetImageSecret isn't relevant for the simplestreams protocol

func (*ProtocolSimpleStreams) GetImages Uses

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

GetImages returns a list of available images as Image structs

func (*ProtocolSimpleStreams) GetPrivateImage Uses

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

GetPrivateImage isn't relevant for the simplestreams protocol

func (*ProtocolSimpleStreams) GetPrivateImageFile Uses

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

GetPrivateImageFile isn't relevant for the simplestreams protocol

type RemoteOperation Uses

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 Uses

type Server interface {
    GetConnectionInfo() (info *ConnectionInfo, err error)
    GetHTTPClient() (client *http.Client, err error)
}

The Server type represents a generic read-only server.

type StoragePoolVolumeCopyArgs Uses

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 Uses

type StoragePoolVolumeMoveArgs struct {
    StoragePoolVolumeCopyArgs
}

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

Package lxd imports 27 packages (graph) and is imported by 54 packages. Updated 2018-11-09. Refresh now. Tools for package owners.