Documentation ¶
Index ¶
- Variables
- func ConfigPath(file string) string
- func SaveConfig(c *Config) error
- func ServerCertPath(name string) string
- func WebsocketDial(dialer websocket.Dialer, url string) (*websocket.Conn, error)
- type Client
- func (c *Client) Action(name string, action shared.ContainerAction, timeout int, force bool) (*Response, error)
- func (c *Client) AddMyCertToServer(pwd string) error
- func (c *Client) AmTrusted() bool
- func (c *Client) ApplyProfile(container, profile string) (*Response, error)
- func (c *Client) CertificateAdd(cert *x509.Certificate, name string) error
- func (c *Client) CertificateList() ([]string, error)
- func (c *Client) CertificateRemove(fingerprint string) error
- func (c *Client) ContainerDeviceAdd(container, devname, devtype string, props []string) (*Response, error)
- func (c *Client) ContainerDeviceDelete(container, devname string) (*Response, error)
- func (c *Client) ContainerListDevices(container string) ([]string, error)
- func (c *Client) ContainerStatus(name string, showLog bool) (*shared.ContainerState, error)
- func (c *Client) CopyImage(image string, dest *Client, copy_aliases bool, aliases []string, public bool) error
- func (c *Client) Delete(name string) (*Response, error)
- func (c *Client) DeleteAlias(alias string) error
- func (c *Client) DeleteImage(image string) error
- func (c *Client) Exec(name string, cmd []string, env map[string]string, stdin *os.File, ...) (int, error)
- func (c *Client) ExportImage(image string, target string) (*Response, string, error)
- func (c *Client) Finger() error
- func (c *Client) GetAlias(alias string) string
- func (c *Client) GetContainerConfig(container string) ([]string, error)
- func (c *Client) GetImageInfo(image string) (*shared.ImageInfo, error)
- func (c *Client) GetProfileConfig(profile string) (map[string]string, error)
- func (c *Client) GetServerConfig() (*Response, error)
- func (c *Client) Init(name string, imgremote string, image string, profiles *[]string, ephem bool) (*Response, error)
- func (c *Client) IsAlias(alias string) (bool, error)
- func (c *Client) ListAliases() ([]string, error)
- func (c *Client) ListContainers() ([]shared.ContainerInfo, error)
- func (c *Client) ListImages() ([]shared.ImageInfo, error)
- func (c *Client) ListProfiles() ([]string, error)
- func (c *Client) ListSnapshots(container string) ([]string, error)
- func (c *Client) LocalCopy(source string, name string, config map[string]string, profiles []string) (*Response, error)
- func (c *Client) MigrateFrom(name string, operation string, secrets map[string]string, ...) (*Response, error)
- func (c *Client) MigrateTo(container string) (*Response, error)
- func (c *Client) PostAlias(alias string, desc string, target string) error
- func (c *Client) PostImage(path string, properties []string, public bool, aliases []string) (string, error)
- func (c *Client) ProfileConfig(name string) (*shared.ProfileConfig, error)
- func (c *Client) ProfileCopy(name, newname string, dest *Client) error
- func (c *Client) ProfileCreate(p string) error
- func (c *Client) ProfileDelete(p string) error
- func (c *Client) ProfileDeviceAdd(profile, devname, devtype string, props []string) (*Response, error)
- func (c *Client) ProfileDeviceDelete(profile, devname string) (*Response, error)
- func (c *Client) ProfileListDevices(profile string) ([]string, error)
- func (c *Client) PullFile(container string, p string) (int, int, os.FileMode, io.ReadCloser, error)
- func (c *Client) PushFile(container string, p string, gid int, uid int, mode os.FileMode, ...) error
- func (c *Client) PutImageProperties(name string, p shared.ImageProperties) error
- func (c *Client) PutProfile(name string, profile shared.ProfileConfig) error
- func (c *Client) Rename(name string, newName string) (*Response, error)
- func (c *Client) SetContainerConfig(container, key, value string) (*Response, error)
- func (c *Client) SetProfileConfigItem(profile, key, value string) error
- func (c *Client) SetRemotePwd(password string) (*Response, error)
- func (c *Client) Snapshot(container string, snapshotName string, stateful bool) (*Response, error)
- func (c *Client) UpdateContainerConfig(container string, st shared.BriefContainerState) error
- func (c *Client) UserAuthServerCert(name string) error
- func (c *Client) WaitFor(waitURL string) (*shared.Operation, error)
- func (c *Client) WaitForSuccess(waitURL string) error
- type Config
- type RemoteConfig
- type Response
- type ResponseType
Constants ¶
This section is empty.
Variables ¶
var ConfigDir = "$HOME/.config/lxc"
var ( // LXDErrors are special errors; the client library hoists error codes // to these errors internally so that user code can compare against // them. We probably shouldn't hoist BadRequest or InternalError, since // LXD passes an error string along which is more informative than // whatever static error message we would put here. LXDErrors = map[int]error{ http.StatusNotFound: fmt.Errorf("not found"), } )
Functions ¶
func ConfigPath ¶
func SaveConfig ¶
SaveConfig writes the provided configuration to the config file.
func ServerCertPath ¶
Types ¶
type Client ¶
type Client struct { Remote *RemoteConfig BaseURL string BaseWSURL string // contains filtered or unexported fields }
Client can talk to a LXD daemon.
func (*Client) AddMyCertToServer ¶
func (*Client) ApplyProfile ¶
func (*Client) CertificateAdd ¶
func (c *Client) CertificateAdd(cert *x509.Certificate, name string) error
func (*Client) CertificateList ¶
func (*Client) CertificateRemove ¶
func (*Client) ContainerDeviceAdd ¶
func (*Client) ContainerDeviceDelete ¶
func (*Client) ContainerListDevices ¶
func (*Client) ContainerStatus ¶
func (*Client) DeleteAlias ¶
func (*Client) DeleteImage ¶
func (*Client) ExportImage ¶
func (*Client) GetContainerConfig ¶
* return string array representing a container's full configuration
func (*Client) GetImageInfo ¶
func (*Client) GetProfileConfig ¶
func (*Client) GetServerConfig ¶
func (*Client) Init ¶
func (c *Client) Init(name string, imgremote string, image string, profiles *[]string, ephem bool) (*Response, error)
Init creates a container from either a fingerprint or an alias; you must provide at least one.
func (*Client) ListAliases ¶
func (*Client) ListContainers ¶
func (c *Client) ListContainers() ([]shared.ContainerInfo, error)
func (*Client) ListProfiles ¶
func (*Client) MigrateFrom ¶
func (*Client) ProfileConfig ¶
func (c *Client) ProfileConfig(name string) (*shared.ProfileConfig, error)
func (*Client) ProfileCreate ¶
func (*Client) ProfileDelete ¶
func (*Client) ProfileDeviceAdd ¶
func (*Client) ProfileDeviceDelete ¶
func (*Client) ProfileListDevices ¶
func (*Client) PutImageProperties ¶
func (c *Client) PutImageProperties(name string, p shared.ImageProperties) error
func (*Client) PutProfile ¶
func (c *Client) PutProfile(name string, profile shared.ProfileConfig) error
func (*Client) SetContainerConfig ¶
func (*Client) SetProfileConfigItem ¶
func (*Client) UpdateContainerConfig ¶
func (c *Client) UpdateContainerConfig(container string, st shared.BriefContainerState) error
func (*Client) UserAuthServerCert ¶
func (*Client) WaitForSuccess ¶
type Config ¶
type Config struct { // 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 ¶
LoadConfig reads the configuration from the config path.
func (*Config) ParseRemote ¶
type RemoteConfig ¶
type RemoteConfig struct {
Addr string `yaml:"addr"`
}
RemoteConfig holds details for communication with a remote daemon.
type Response ¶
type Response struct { Type ResponseType `json:"type"` /* Valid only for Sync responses */ Status string `json:"status"` StatusCode int `json:"status_code"` /* Valid only for Async responses */ Operation string `json:"operation"` Resources map[string][]string `json:"resources"` /* Valid only for Error responses */ Code int `json:"error_code"` Error string `json:"error"` /* Valid for Sync and Error responses */ Metadata json.RawMessage `json:"metadata"` }
func HoistResponse ¶
func HoistResponse(r *http.Response, rtype ResponseType) (*Response, error)
HoistResponse hoists a regular http response into a response of type rtype or returns a golang error.
func ParseResponse ¶
ParseResponse parses a lxd style response out of an http.Response. Note that this does _not_ automatically convert error responses to golang errors. To do that, use ParseError. Internal client library uses should probably use HoistResponse, unless they are interested in accessing the underlying Error response (e.g. to inspect the error code).
type ResponseType ¶
type ResponseType string
const ( Sync ResponseType = "sync" Async ResponseType = "async" Error ResponseType = "error" )
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. |
This is a FLEXible file which can be used by both client and daemon.
|
This is a FLEXible file which can be used by both client and daemon. |