lxd

package module
v0.0.0-...-2687a32 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2014 License: Apache-2.0 Imports: 10 Imported by: 0

README

lxd

REST API, command line tool and OpenStack integration plugin for LXC

LXD is pronounced lex-dee

Obtaining the code

go get github.com/lxc/lxd

Running the tool

cd $GOPATH/src/github.com/lxc/lxd
go build

Documentation

Overview

This is a FLEXible file which can be used by both client and daemon. * Teehee.

Index

Constants

This section is empty.

Variables

View Source
var Version = "0.0.1"

* Please increment the version number every time you change the API. * * Version 0.0.1: ping

Functions

func Debugf

func Debugf(format string, args ...interface{})

Debugf sends to the logger registered via SetLogger the string resulting from running format and args through Sprintf, but only if debugging was enabled via SetDebug.

func Logf

func Logf(format string, args ...interface{})

Logf sends to the logger registered via SetLogger the string resulting from running format and args through Sprintf.

func SaveConfig

func SaveConfig(c *Config) error

SaveConfig writes the provided configuration to $HOME/.lxd/config.yaml.

func SetDebug

func SetDebug(enabled bool)

SetDebug defines whether debugging is enabled or not.

func SetLogger

func SetLogger(l Logger)

SetLogger defines the *log.Logger where log messages are sent to.

func VarPath

func VarPath(path ...string) string

VarPath returns the provided path elements joined by a slash and appended to the end of $LXD_DIR, which defaults to /var/lib/lxd.

Types

type Client

type Client struct {
	Remote *RemoteConfig
	// contains filtered or unexported fields
}

Client can talk to a lxd daemon.

func NewClient

func NewClient(config *Config, raw string) (*Client, string, error)

NewClient returns a new lxd client.

func (*Client) Ping

func (c *Client) Ping() error

Ping pings the daemon to see if it is up listening and working.

type Config

type Config struct {
	// TestOption is used only for testing purposes.
	TestOption string `yaml:"test-option,omitempty"`

	// DefaultRemote holds the remote daemon name from the Remotes map
	// that the client should communicate with by default.
	// If empty it defaults to "local".
	DefaultRemote string `yaml:"default-remote"`

	// Remotes defines a map of remote daemon names to the details for
	// communication with the named daemon.
	// The implicit "local" remote is always available and communicates
	// with the local daemon over a unix socket.
	Remotes map[string]RemoteConfig `yaml:"remotes"`

	// ListenAddr defines an alternative address for the local daemon
	// to listen on. If empty, the daemon will listen only on the local
	// unix socket address.
	ListenAddr string `yaml:"listen-addr"`
}

Config holds settings to be used by a client or daemon.

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig reads the configuration from $HOME/.lxd/config.yaml.

type Logger

type Logger interface {
	Output(calldepth int, s string) error
}

Logger is implemented by the standard *log.Logger.

type RemoteConfig

type RemoteConfig struct {
	Addr string `yaml:"addr"`
}

RemoteConfig holds details for communication with a remote daemon.

Directories

Path Synopsis
internal
gnuflag
Package flag implements command-line flag parsing in the GNU style.
Package flag implements command-line flag parsing in the GNU style.

Jump to

Keyboard shortcuts

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