Documentation ¶
Index ¶
- Variables
- type Config
- func (c *Config) ConfigPath(paths ...string) string
- func (c *Config) CopyGlobalCert(src string, dst string) error
- func (c *Config) GenerateClientCertificate() error
- func (c *Config) GetImageServer(name string) (lxd.ImageServer, error)
- func (c *Config) GetInstanceServer(name string) (lxd.InstanceServer, error)
- func (c *Config) GetInstanceServerWithTransportWrapper(name string, wrapper func(*http.Transport) lxd.HTTPTransporter) (lxd.InstanceServer, error)
- func (c *Config) GlobalConfigPath(paths ...string) string
- func (c *Config) HasClientCertificate() bool
- func (c *Config) OIDCTokenPath(remote string) string
- func (c *Config) ParseRemote(raw string) (remoteName string, resourceName string, err error)
- func (c *Config) SaveConfig(path string) error
- func (c *Config) SaveOIDCTokens()
- func (c *Config) ServerCertPath(remote string) string
- type Remote
Constants ¶
This section is empty.
Variables ¶
var DefaultRemotes = map[string]Remote{ "local": LocalRemote, "images": ImagesRemote, "ubuntu": UbuntuRemote, "ubuntu-daily": UbuntuDailyRemote, "ubuntu-minimal": UbuntuMinimalRemote, "ubuntu-minimal-daily": UbuntuMinimalDailyRemote, }
DefaultRemotes is the list of default remotes.
var ErrNotLinux = fmt.Errorf("Can't connect to a local LXD server on a non-Linux system")
ErrNotLinux is returned when attemping to access the "local" remote on non-Linux systems.
var ImagesRemote = Remote{ Addr: "https://images.lxd.canonical.com", Public: true, Protocol: "simplestreams", }
ImagesRemote is the main image server (over simplestreams).
var LocalRemote = Remote{ Addr: "unix://", Static: true, Public: false, }
LocalRemote is the default local remote (over the LXD unix socket).
var StaticRemotes = map[string]Remote{ "local": LocalRemote, "images": ImagesRemote, "ubuntu": UbuntuRemote, "ubuntu-daily": UbuntuDailyRemote, "ubuntu-minimal": UbuntuMinimalRemote, "ubuntu-minimal-daily": UbuntuMinimalDailyRemote, }
StaticRemotes is the list of remotes which can't be removed.
var UbuntuDailyRemote = Remote{ Addr: "https://cloud-images.ubuntu.com/daily/", Static: true, Public: true, Protocol: "simplestreams", }
UbuntuDailyRemote is the Ubuntu daily image server (over simplestreams).
var UbuntuMinimalDailyRemote = Remote{ Addr: "https://cloud-images.ubuntu.com/minimal/daily/", Static: true, Public: true, Protocol: "simplestreams", }
UbuntuMinimalDailyRemote is the Ubuntu daily minimal image server (over simplestreams).
var UbuntuMinimalRemote = Remote{ Addr: "https://cloud-images.ubuntu.com/minimal/releases/", Static: true, Public: true, Protocol: "simplestreams", }
UbuntuMinimalRemote is the Ubuntu minimal image server (over simplestreams).
var UbuntuRemote = Remote{ Addr: "https://cloud-images.ubuntu.com/releases/", Static: true, Public: true, Protocol: "simplestreams", }
UbuntuRemote is the Ubuntu image server (over simplestreams).
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // DefaultRemote holds the remote daemon name from the Remotes map // that the client should communicate with by default DefaultRemote string `yaml:"default-remote"` // Remotes defines a map of remote daemon names to the details for // communication with the named daemon Remotes map[string]Remote `yaml:"remotes"` // Command line aliases for `lxc` Aliases map[string]string `yaml:"aliases"` // Configuration directory ConfigDir string `yaml:"-"` // The UserAgent to pass for all queries UserAgent string `yaml:"-"` // PromptPassword is a helper function used when encountering an encrypted key PromptPassword func(filename string) (string, error) `yaml:"-"` // ProjectOverride allows overriding the default project ProjectOverride string `yaml:"-"` // contains filtered or unexported fields }
Config holds settings to be used by a client or daemon.
func LoadConfig ¶
LoadConfig reads the configuration from the config path; if the path does not exist, it returns a default configuration.
func (*Config) ConfigPath ¶
ConfigPath returns a joined path of the configuration directory and passed arguments.
func (*Config) CopyGlobalCert ¶
CopyGlobalCert will copy global (system-wide) certificate to the user config path.
func (*Config) GenerateClientCertificate ¶
GenerateClientCertificate will generate the needed client.crt and client.key if needed.
func (*Config) GetImageServer ¶
GetImageServer returns a ImageServer struct for the remote.
func (*Config) GetInstanceServer ¶
GetInstanceServer returns a lxd.InstanceServer for the remote with the given name.
func (*Config) GetInstanceServerWithTransportWrapper ¶
func (c *Config) GetInstanceServerWithTransportWrapper(name string, wrapper func(*http.Transport) lxd.HTTPTransporter) (lxd.InstanceServer, error)
GetInstanceServerWithTransportWrapper returns a lxd.InstanceServer for the remote with the given name and adds the given transport wrapper to the lxd.ConnectionArgs.
func (*Config) GlobalConfigPath ¶
GlobalConfigPath returns a joined path of the global configuration directory and passed arguments.
func (*Config) HasClientCertificate ¶
HasClientCertificate will return true if a client certificate has already been generated.
func (*Config) OIDCTokenPath ¶
OIDCTokenPath returns the path for the remote's OIDC tokens.
func (*Config) ParseRemote ¶
ParseRemote splits remote and object.
func (*Config) SaveConfig ¶
SaveConfig writes the provided configuration to the config file.
func (*Config) SaveOIDCTokens ¶
func (c *Config) SaveOIDCTokens()
SaveOIDCTokens saves OIDC tokens to disk.
func (*Config) ServerCertPath ¶
ServerCertPath returns the path for the remote's server certificate.
type Remote ¶
type Remote struct { Addr string `yaml:"addr"` AuthType string `yaml:"auth_type,omitempty"` Project string `yaml:"project,omitempty"` Protocol string `yaml:"protocol,omitempty"` Public bool `yaml:"public"` Global bool `yaml:"-"` Static bool `yaml:"-"` }
Remote holds details for communication with a remote daemon.