Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AgentConfigParams ¶
type Config ¶
type Config interface {
// DataDir returns the data directory. Each agent has a subdirectory
// containing the configuration files.
DataDir() string
// Tag returns the tag of the entity on whose behalf the state connection
// will be made.
Tag() string
// Dir returns the agent's directory.
Dir() string
// Nonce returns the nonce saved when the machine was provisioned
// TODO: make this one of the key/value pairs.
Nonce() string
// CACert returns the CA certificate that is used to validate the state or
// API servier's certificate.
CACert() []byte
// OpenAPI tries to connect to an API end-point. If a non-empty
// newPassword is returned, the password used to connect to the state
// should be changed accordingly - the caller should set the entity's
// password accordingly.
OpenAPI(dialOpts api.DialOpts) (st *api.State, newPassword string, err error)
// OpenState tries to open a direct connection to the state database using
// the given Conf.
OpenState() (*state.State, error)
// Write writes the agent configuration.
Write() error
// WriteCommands returns shell commands to write the agent configuration.
// It returns an error if the configuration does not have all the right
// elements.
WriteCommands() ([]string, error)
// GenerateNewPassword creates a new random password and saves this. The
// new password string is returned.
GenerateNewPassword() (string, error)
// PasswordHash returns a hash of the password that is stored for state and
// api connections.
PasswordHash() string
// APIServerDetails returns the details needed to run an API server.
APIServerDetails() (port int, cert, key []byte)
}
func NewAgentConfig ¶
func NewAgentConfig(params AgentConfigParams) (Config, error)
NewAgentConfig returns a new config object suitable for use for a unit agent. As the unit agent becomes entirely APIified, we should remove the state addresses from here.
func NewStateMachineConfig ¶
func NewStateMachineConfig(params StateMachineConfigParams) (Config, error)
type StateMachineConfigParams ¶
type StateMachineConfigParams struct {
AgentConfigParams
StateServerCert []byte
StateServerKey []byte
StatePort int
APIPort int
}
Click to show internal directories.
Click to hide internal directories.