lxdclient

package
v0.0.0-...-511b1a1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2020 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// All returns all existing LXD containers.
	All() ([]Container, error)
	// Get returns the LXD container with the given name.
	Get(name string) (Container, error)
	// Create creates a container using the LXD image with the given name.
	Create(image, name string, profiles ...string) (Container, error)
	// Delete removes the container with the given name. It assumes the
	// container exists and is not running.
	Delete(name string) error
}

Client describes an LXD client, which is used to create, delete and retrieve LXD containers.

func New

func New(socket string) (Client, error)

New returns an LXD client connected to the socket at the given path.

type Container

type Container interface {
	// Name returns the container name.
	Name() string
	// Addr returns the public ip address of the container.
	Addr() (string, error)
	// Started reports whether the container is running.
	Started() bool
	// Start starts the container.
	Start() error
	// Stop stops the container.
	Stop() error
	// WriteFile creates a file in the container at the given path and data.
	WriteFile(path string, data []byte) error
	// Exec executes the given command in the container and returns its output.
	Exec(command string, args ...string) (string, error)
}

Container describes an LXD container instance.

Jump to

Keyboard shortcuts

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