Documentation
¶
Index ¶
- func JujuAccountsPath() string
- func JujuControllersPath() string
- func JujuCredentialsPath() string
- func JujuModelsPath() string
- func ParseAccounts(data []byte) (map[string]*ControllerAccounts, error)
- func ParseControllers(data []byte) (map[string]ControllerDetails, error)
- func ParseModels(data []byte) (map[string]ControllerAccountModels, error)
- func ReadAccountsFile(file string) (map[string]*ControllerAccounts, error)
- func ReadControllersFile(file string) (map[string]ControllerDetails, error)
- func ReadCredentialsFile(file string) (map[string]cloud.CloudCredential, error)
- func ReadModelsFile(file string) (map[string]ControllerAccountModels, error)
- func ValidateAccountDetails(details AccountDetails) error
- func ValidateAccountName(name string) error
- func ValidateControllerDetails(details ControllerDetails) error
- func ValidateControllerName(name string) error
- func ValidateModelDetails(details ModelDetails) error
- func ValidateModelName(name string) error
- func WriteAccountsFile(controllerAccounts map[string]*ControllerAccounts) error
- func WriteControllersFile(controllers map[string]ControllerDetails) error
- func WriteCredentialsFile(credentials map[string]cloud.CloudCredential) error
- func WriteModelsFile(models map[string]ControllerAccountModels) error
- type AccountDetails
- type AccountGetter
- type AccountModels
- type AccountRemover
- type AccountStore
- type AccountUpdater
- type ClientStore
- type ControllerAccountModels
- type ControllerAccounts
- type ControllerDetails
- type ControllerGetter
- type ControllerRemover
- type ControllerStore
- type ControllerUpdater
- type CredentialGetter
- type CredentialStore
- type CredentialUpdater
- type ModelDetails
- type ModelGetter
- type ModelRemover
- type ModelStore
- type ModelUpdater
- type RegistrationInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JujuAccountsPath ¶
func JujuAccountsPath() string
JujuAccountsPath is the location where accounts information is expected to be found.
func JujuControllersPath ¶
func JujuControllersPath() string
JujuControllersPath is the location where controllers information is expected to be found.
func JujuCredentialsPath ¶
func JujuCredentialsPath() string
JujuCredentialsPath is the location where controllers information is expected to be found.
func JujuModelsPath ¶
func JujuModelsPath() string
JujuModelsPath is the location where models information is expected to be found.
func ParseAccounts ¶
func ParseAccounts(data []byte) (map[string]*ControllerAccounts, error)
ParseAccounts parses the given YAML bytes into accounts metadata.
func ParseControllers ¶
func ParseControllers(data []byte) (map[string]ControllerDetails, error)
ParseControllers parses the given YAML bytes into controllers metadata.
func ParseModels ¶
func ParseModels(data []byte) (map[string]ControllerAccountModels, error)
ParseModels parses the given YAML bytes into models metadata.
func ReadAccountsFile ¶
func ReadAccountsFile(file string) (map[string]*ControllerAccounts, error)
ReadAccountsFile loads all accounts defined in a given file. If the file is not found, it is not an error.
func ReadControllersFile ¶
func ReadControllersFile(file string) (map[string]ControllerDetails, error)
ReadControllersFile loads all controllers defined in a given file. If the file is not found, it is not an error.
func ReadCredentialsFile ¶
func ReadCredentialsFile(file string) (map[string]cloud.CloudCredential, error)
ReadCredentialsFile loads all credentials defined in a given file. If the file is not found, it is not an error.
func ReadModelsFile ¶
func ReadModelsFile(file string) (map[string]ControllerAccountModels, error)
ReadModelsFile loads all models defined in a given file. If the file is not found, it is not an error.
func ValidateAccountDetails ¶
func ValidateAccountDetails(details AccountDetails) error
ValidateModelDetails ensures that given account details are valid.
func ValidateAccountName ¶
ValidateAccountName validates the given account name.
func ValidateControllerDetails ¶
func ValidateControllerDetails(details ControllerDetails) error
ValidateControllerDetails ensures that given controller details are valid.
func ValidateControllerName ¶
ValidateControllerName validates the given controller name.
func ValidateModelDetails ¶
func ValidateModelDetails(details ModelDetails) error
ValidateModelDetails ensures that given model details are valid.
func ValidateModelName ¶
ValidateModelName validates the given model name.
func WriteAccountsFile ¶
func WriteAccountsFile(controllerAccounts map[string]*ControllerAccounts) error
WriteAccountsFile marshals to YAML details of the given accounts and writes it to the accounts file.
func WriteControllersFile ¶
func WriteControllersFile(controllers map[string]ControllerDetails) error
WriteControllersFile marshals to YAML details of the given controllers and writes it to the controllers file.
func WriteCredentialsFile ¶
func WriteCredentialsFile(credentials map[string]cloud.CloudCredential) error
WriteCredentialsFile marshals to YAML details of the given credentials and writes it to the credentials file.
func WriteModelsFile ¶
func WriteModelsFile(models map[string]ControllerAccountModels) error
WriteModelsFile marshals to YAML details of the given models and writes it to the models file.
Types ¶
type AccountDetails ¶
type AccountDetails struct {
// User is the username for the account.
User string `yaml:"user"`
// Password is the password for the account.
Password string `yaml:"password,omitempty"`
}
AccountDetails holds details of an account.
type AccountGetter ¶
type AccountGetter interface {
// AllAccounts gets all accounts for the specified controller.
//
// If there is no controller with the specified name, or
// no accounts cached for the controller, an error satisfying
// errors.IsNotFound will be returned.
AllAccounts(controllerName string) (map[string]AccountDetails, error)
// CurrentAccount returns the name of the current account for
// the specified controller. If there is no current account
// for the controller, an error satisfying errors.IsNotFound
// is returned.
CurrentAccount(controllerName string) (string, error)
// AccountByName returns the account with the specified controller
// and account names. If there exists no account with the specified
// names, an error satisfying errors.IsNotFound will be returned.
AccountByName(controllerName, accountName string) (*AccountDetails, error)
}
AccountGetter gets accounts.
type AccountModels ¶
type AccountModels struct {
// Models is the collection of models for the account. This should
// be treated as a cache only, and not the complete set of models
// for the account.
Models map[string]ModelDetails `yaml:"models"`
// CurrentModel is the name of the active model for the account.
CurrentModel string `yaml:"current-model,omitempty"`
}
AccountModels stores per-account model information.
type AccountRemover ¶
type AccountRemover interface {
// RemoveAccount removes the account with the given controller and account
// names from the accounts collection. If there is no account with the
// specified names, an errors satisfying errors.IsNotFound will be
// returned.
RemoveAccount(controllerName, accountName string) error
}
AccountRemover removes accounts.
type AccountStore ¶
type AccountStore interface {
AccountUpdater
AccountRemover
AccountGetter
}
AccountStore is an amalgamation of AccountUpdater, AccountRemover, and AccountGetter.
type AccountUpdater ¶
type AccountUpdater interface {
// UpdateAccount adds the given account to the account collection.
//
// If the account does not already exist, it will be added.
// Otherwise, it will be overwritten with the new details.
UpdateAccount(controllerName, accountName string, details AccountDetails) error
// SetCurrentAccount sets the name of the current account for
// the specified controller. If there exists no account with
// the specified names, an error satisfing errors.IsNotFound
// will be returned.
SetCurrentAccount(controllerName, accountName string) error
}
AccountUpdater stores account details.
type ClientStore ¶
type ClientStore interface {
AccountStore
ControllerStore
ModelStore
}
ClientStore is an amalgamation of AccountStore, ControllerStore, and ModelStore.
func NewFileClientStore ¶
func NewFileClientStore() ClientStore
NewFileClientStore returns a new filesystem-based client store that manages files in $XDG_DATA_HOME/juju.
type ControllerAccountModels ¶
type ControllerAccountModels struct {
// AccountModels is the collection of account-models for the
// controller.
AccountModels map[string]*AccountModels `yaml:"accounts"`
}
ControllerAccountModels stores per-controller account-model information.
type ControllerAccounts ¶
type ControllerAccounts struct {
// Accounts is the collection of accounts for the controller.
Accounts map[string]AccountDetails `yaml:"accounts"`
// CurrentAccount is the name of the active account for the controller.
CurrentAccount string `yaml:"current-account,omitempty"`
}
ControllerAccounts stores per-controller account information.
type ControllerDetails ¶
type ControllerDetails struct {
// Servers contains the addresses of hosts that form the Juju controller
// cluster.
Servers []string `yaml:"servers,flow"`
// ControllerUUID is the unique ID for the controller.
ControllerUUID string `yaml:"uuid"`
// APIEndpoints is the collection of API endpoints running in this controller.
APIEndpoints []string `yaml:"api-endpoints,flow"`
// CACert is a security certificate for this controller.
CACert string `yaml:"ca-cert"`
}
ControllerDetails holds the details needed to connect to a controller.
type ControllerGetter ¶
type ControllerGetter interface {
// AllControllers gets all controllers.
AllControllers() (map[string]ControllerDetails, error)
// ControllerByName returns the controller with the specified name.
// If there exists no controller with the specified name, an error
// satisfying errors.IsNotFound will be returned.
ControllerByName(controllerName string) (*ControllerDetails, error)
}
ControllerGetter gets controllers.
type ControllerRemover ¶
type ControllerRemover interface {
// RemoveController removes the controller with the given name from the
// controllers collection.
RemoveController(controllerName string) error
}
ControllerRemover removes controllers.
type ControllerStore ¶
type ControllerStore interface {
ControllerUpdater
ControllerRemover
ControllerGetter
}
ControllerStore is an amalgamation of ControllerUpdater, ControllerRemover, and ControllerGetter.
type ControllerUpdater ¶
type ControllerUpdater interface {
// UpdateController adds the given controller to the controller
// collection.
//
// If the controller does not already exist, it will be added.
// Otherwise, it will be overwritten with the new details.
UpdateController(controllerName string, details ControllerDetails) error
}
ControllerUpdater stores controller details.
type CredentialGetter ¶
type CredentialGetter interface {
// CredentialForCloud gets credentials for the named cloud.
CredentialForCloud(string) (*cloud.CloudCredential, error)
// AllCredentials gets all credentials.
AllCredentials() (map[string]cloud.CloudCredential, error)
}
CredentialGetter gets credentials.
type CredentialStore ¶
type CredentialStore interface {
CredentialGetter
CredentialUpdater
}
CredentialStore is an amalgamation of CredentialsUpdater, and CredentialsGetter.
func NewFileCredentialStore ¶
func NewFileCredentialStore() CredentialStore
NewFileCredentialStore returns a new filesystem-based credentials store that manages credentials in $XDG_DATA_HOME/juju.
type CredentialUpdater ¶
type CredentialUpdater interface {
// UpdateCredential adds the given credentials to the credentials
// collection.
//
// If the cloud or credential name does not already exist, it will be added.
// Otherwise, it will be overwritten with the new details.
UpdateCredential(cloudName string, details cloud.CloudCredential) error
}
CredentialUpdater stores credentials.
type ModelDetails ¶
type ModelDetails struct {
// ModelUUID holds the details of a model.
ModelUUID string `yaml:"uuid"`
}
ModelDetails holds details of a model.
type ModelGetter ¶
type ModelGetter interface {
// AllModels gets all models for the specified controller and
// account.
//
// If there is no controller or account with the specified
// names, or no models cached for the controller and account,
// an error satisfying errors.IsNotFound will be returned.
AllModels(controllerName, accountName string) (map[string]ModelDetails, error)
// CurrentModel returns the name of the current model for
// the specified controller and account. If there is no current
// model for the controller and account, an error satisfying
// errors.IsNotFound is returned.
CurrentModel(controllerName, accountName string) (string, error)
// ModelByName returns the model with the specified controller,
// account, and model names. If there exists no model with the
// specified names, an error satisfying errors.IsNotFound will
// be returned.
ModelByName(controllerName, accountName, modelName string) (*ModelDetails, error)
}
ModelGetter gets models.
type ModelRemover ¶
type ModelRemover interface {
// RemoveModel removes the model with the given controller, account,
// and model names from the models collection. If there is no model
// with the specified names, an errors satisfying errors.IsNotFound
// will be returned.
RemoveModel(controllerName, accountName, modelName string) error
}
ModelRemover removes models.
type ModelStore ¶
type ModelStore interface {
ModelUpdater
ModelRemover
ModelGetter
}
ModelStore is an amalgamation of ModelUpdater, ModelRemover, and ModelGetter.
type ModelUpdater ¶
type ModelUpdater interface {
// UpdateModel adds the given model to the model collection.
//
// If the model does not already exist, it will be added.
// Otherwise, it will be overwritten with the new details.
UpdateModel(controllerName, accountName, modelName string, details ModelDetails) error
// SetCurrentModel sets the name of the current model for
// the specified controller and account. If there exists no
// model with the specified names, an error satisfing
// errors.IsNotFound will be returned.
SetCurrentModel(controllerName, accountName, modelName string) error
}
ModelUpdater stores model details.
type RegistrationInfo ¶
type RegistrationInfo struct {
// User is the user name to log in as.
User string
// Addrs contains the "host:port" addresses of the Juju
// controller.
Addrs []string
// SecretKey contains the secret key to use when encrypting
// and decrypting registration requests and responses.
SecretKey []byte
}
RegistrationInfo contains the user/controller registration information printed by "juju add-user", and consumed by "juju register".
Source Files
¶
- accounts.go
- controllers.go
- credentials.go
- file.go
- interface.go
- models.go
- registration.go
- validation.go