Documentation ¶
Index ¶
- Constants
- func JujuHome() string
- func JujuHomePath(names ...string) string
- func SetJujuHome(newJujuHome string) string
- func Validate(cfg, old *Config) error
- type Config
- func (c *Config) APIPort() int
- func (c *Config) AdminSecret() string
- func (c *Config) AgentVersion() (version.Number, bool)
- func (c *Config) AllAttrs() map[string]interface{}
- func (c *Config) Apply(attrs map[string]interface{}) (*Config, error)
- func (c *Config) AuthorizedKeys() string
- func (c *Config) CACert() ([]byte, bool)
- func (c *Config) CAPrivateKey() (key []byte, ok bool)
- func (c *Config) DefaultSeries() string
- func (c *Config) Development() bool
- func (c *Config) FirewallMode() FirewallMode
- func (cfg *Config) GenerateStateServerCertAndKey() ([]byte, []byte, error)
- func (c *Config) Name() string
- func (c *Config) SSLHostnameVerification() bool
- func (c *Config) StatePort() int
- func (c *Config) Type() string
- func (c *Config) UnknownAttrs() map[string]interface{}
- func (cfg *Config) ValidateUnknownAttrs(fields schema.Fields, defaults schema.Defaults) (map[string]interface{}, error)
- type FirewallMode
Constants ¶
const ( // FwDefault is the environment-specific default mode. FwDefault FirewallMode = "" // FwInstance requests the use of an individual firewall per instance. FwInstance FirewallMode = "instance" // FwGlobal requests the use of a single firewall group for all machines. // When ports are opened for one machine, all machines will have the same // port opened. FwGlobal FirewallMode = "global" // DefaultSeries returns the most recent Ubuntu LTS release name. DefaultSeries string = "precise" // DefaultStatePort is the default port the state server is listening on. DefaultStatePort int = 37017 // DefaultApiPort is the default port the API server is listening on. DefaultApiPort int = 17070 )
Variables ¶
This section is empty.
Functions ¶
func JujuHomePath ¶
JujuHomePath returns the path to a file in the current juju home.
func SetJujuHome ¶
SetJujuHome sets the value of juju home and returns the current one.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config holds an immutable environment configuration.
func New ¶
New returns a new configuration. Fields that are common to all environment providers are verified. The "authorized-keys-path" key is translated into "authorized-keys" by loading the content from respective file. Similarly, "ca-cert-path" and "ca-private-key-path" are translated into the "ca-cert" and "ca-private-key" values. If not specified, authorized SSH keys and CA details will be read from:
~/.ssh/id_dsa.pub ~/.ssh/id_rsa.pub ~/.ssh/identity.pub ~/.juju/<name>-cert.pem ~/.juju/<name>-private-key.pem
The required keys (after any files have been read) are "name", "type" and "authorized-keys", all of type string. Additional keys recognised are "agent-version" and "development", of types string and bool respectively.
func (*Config) AdminSecret ¶
AdminSecret returns the administrator password. It's empty if the password has not been set.
func (*Config) AgentVersion ¶
AgentVersion returns the proposed version number for the agent tools, and whether it has been set. Once an environment is bootstrapped, this must always be valid.
func (*Config) AuthorizedKeys ¶
AuthorizedKeys returns the content for ssh's authorized_keys file.
func (*Config) CACert ¶
CACert returns the certificate of the CA that signed the state server certificate, in PEM format, and whether the setting is available.
func (*Config) CAPrivateKey ¶
CAPrivateKey returns the private key of the CA that signed the state server certificate, in PEM format, and whether the setting is available.
func (*Config) DefaultSeries ¶
DefaultSeries returns the default Ubuntu series for the environment.
func (*Config) Development ¶
Development returns whether the environment is in development mode.
func (*Config) FirewallMode ¶
func (c *Config) FirewallMode() FirewallMode
FirewallMode returns whether the firewall should manage ports per machine or global.
func (*Config) GenerateStateServerCertAndKey ¶
GenerateStateServerCertAndKey makes sure that the config has a CACert and CAPrivateKey, generates and retruns new certificate and key.
func (*Config) SSLHostnameVerification ¶
SSLHostnameVerification returns weather the environment has requested SSL hostname verification to be enabled.
func (*Config) UnknownAttrs ¶
UnknownAttrs returns a copy of the raw configuration attributes that are supposedly specific to the environment type. They could also be wrong attributes, though. Only the specific environment implementation can tell.
func (*Config) ValidateUnknownAttrs ¶
func (cfg *Config) ValidateUnknownAttrs(fields schema.Fields, defaults schema.Defaults) (map[string]interface{}, error)
ValidateUnknownAttrs checks the unknown attributes of the config against the supplied fields and defaults, and returns an error if any fails to validate. Unknown fields are warned about, but preserved, on the basis that they are reasonably likely to have been written by or for a version of juju that does recognise the fields, but that their presence is still anomalous to some degree and should be flagged (and that there is thereby a mechanism for observing fields that really are typos etc).
type FirewallMode ¶
type FirewallMode string
FirewallMode defines the way in which the environment handles opening and closing of firewall ports.