Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsQualifiedModelName

func IsQualifiedModelName(name string) bool

    IsQualifiedModelName returns true if the provided model name is qualified with an owner. The name is assumed to be either a valid qualified model name, or a valid unqualified model name.

    func JoinOwnerModelName

    func JoinOwnerModelName(owner names.UserTag, modelName string) string

      JoinOwnerModelName returns a model name qualified with the model owner.

      func JujuAccountsPath

      func JujuAccountsPath() string

        JujuAccountsPath is the location where accounts information is expected to be found.

        func JujuBootstrapConfigPath

        func JujuBootstrapConfigPath() string

          JujuBootstrapConfigPath is the location where bootstrap config is expected to be found.

          func JujuControllersPath

          func JujuControllersPath() string

            JujuControllersPath is the location where controllers information is expected to be found.

            func JujuCookiePath

            func JujuCookiePath(controllerName string) string

              JujuCookiePath is the location where cookies associated with the given controller are 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 NewTokenStore

                  func NewTokenStore() *ussologin.FileTokenStore

                    NewTokenStore returns a FileTokenStore for storing the USSO oauth token

                    func ParseAccounts

                    func ParseAccounts(data []byte) (map[string]AccountDetails, error)

                      ParseAccounts parses the given YAML bytes into accounts metadata.

                      func ParseBootstrapConfig

                      func ParseBootstrapConfig(data []byte) (map[string]BootstrapConfig, error)

                        ParseBootstrapConfig parses the given YAML bytes into bootstrap config metadata.

                        func ParseModels

                        func ParseModels(data []byte) (map[string]*ControllerModels, error)

                          ParseModels parses the given YAML bytes into models metadata.

                          func ReadAccountsFile

                          func ReadAccountsFile(file string) (map[string]AccountDetails, error)

                            ReadAccountsFile loads all accounts defined in a given file. If the file is not found, it is not an error.

                            func ReadBootstrapConfigFile

                            func ReadBootstrapConfigFile(file string) (map[string]BootstrapConfig, error)

                              ReadBootstrapConfigFile loads all bootstrap configurations defined in a given file. If the file is not found, it is not an error.

                              func ReadCredentialsFile

                              func ReadCredentialsFile(file string) (*cloud.CredentialCollection, 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]*ControllerModels, error)

                                  ReadModelsFile loads all models defined in a given file. If the file is not found, it is not an error.

                                  func SplitModelName

                                  func SplitModelName(name string) (string, names.UserTag, error)

                                    SplitModelName splits a qualified model name into the model and owner name components.

                                    func ValidateAccountDetails

                                    func ValidateAccountDetails(details AccountDetails) error

                                      ValidateModelDetails ensures that given account details are valid.

                                      func ValidateBootstrapConfig

                                      func ValidateBootstrapConfig(cfg BootstrapConfig) error

                                        ValidateBootstrapConfig validates the given boostrap config.

                                        func ValidateControllerDetails

                                        func ValidateControllerDetails(details ControllerDetails) error

                                          ValidateControllerDetails ensures that given controller details are valid.

                                          func ValidateControllerName

                                          func ValidateControllerName(name string) error

                                            ValidateControllerName validates the given controller name.

                                            func ValidateModel

                                            func ValidateModel(name string, details ModelDetails) error

                                              ValidateModel validates the given model name and details.

                                              func ValidateModelDetails

                                              func ValidateModelDetails(details ModelDetails) error

                                                ValidateModelDetails ensures that given model details are valid.

                                                func ValidateModelName

                                                func ValidateModelName(name string) error

                                                  ValidateModelName validates the given model name.

                                                  func WriteAccountsFile

                                                  func WriteAccountsFile(controllerAccounts map[string]AccountDetails) error

                                                    WriteAccountsFile marshals to YAML details of the given accounts and writes it to the accounts file.

                                                    func WriteBootstrapConfigFile

                                                    func WriteBootstrapConfigFile(configs map[string]BootstrapConfig) error

                                                      WriteBootstrapConfigFile marshals to YAML details of the given bootstrap configurations and writes it to the bootstrap config file.

                                                      func WriteControllersFile

                                                      func WriteControllersFile(controllers *Controllers) error

                                                        WriteControllersFile marshals to YAML details of the given controllers and writes it to the controllers file.

                                                        func WriteCredentialsFile

                                                        func WriteCredentialsFile(credentials *cloud.CredentialCollection) error

                                                          WriteCredentialsFile marshals to YAML details of the given credentials and writes it to the credentials file.

                                                          func WriteModelsFile

                                                          func WriteModelsFile(models map[string]*ControllerModels) 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"`
                                                            
                                                            	// LastKnownAccess is the last known access level for the account.
                                                            	LastKnownAccess string `yaml:"last-known-access,omitempty"`
                                                            
                                                            	// Macaroons, if set, are used for the account login.
                                                            	// They are only set when using the MemStore implementation,
                                                            	// and are used by embedded commands. The are not written to disk.
                                                            	Macaroons []macaroon.Slice `yaml:"-"`
                                                            }

                                                              AccountDetails holds details of an account.

                                                              type AccountGetter

                                                              type AccountGetter interface {
                                                              	// AccountByName returns the account associated with the given
                                                              	// controller name. If no associated account exists, an error
                                                              	// satisfying errors.IsNotFound will be returned.
                                                              	AccountDetails(controllerName string) (*AccountDetails, error)
                                                              }

                                                                AccountGetter gets accounts.

                                                                type AccountRemover

                                                                type AccountRemover interface {
                                                                	// RemoveAccount removes the account associated with the given controller.
                                                                	// If there is no associated account with the
                                                                	// specified names, an errors satisfying errors.IsNotFound will be
                                                                	// returned.
                                                                	RemoveAccount(controllerName 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 updates the account associated with the
                                                                    	// given controller.
                                                                    	UpdateAccount(controllerName string, details AccountDetails) error
                                                                    }

                                                                      AccountUpdater stores account details.

                                                                      type BootstrapConfig

                                                                      type BootstrapConfig struct {
                                                                      	// ControllerConfig is the controller configuration.
                                                                      	ControllerConfig controller.Config `yaml:"controller-config"`
                                                                      
                                                                      	// Config is the complete configuration for the provider.
                                                                      	Config map[string]interface{} `yaml:"model-config"`
                                                                      
                                                                      	// ControllerModelUUID is the controller model UUID.
                                                                      	ControllerModelUUID string `yaml:"controller-model-uuid"`
                                                                      
                                                                      	// Credential is the name of the credential used to bootstrap.
                                                                      	//
                                                                      	// This will be empty if an auto-detected credential was used.
                                                                      	Credential string `yaml:"credential,omitempty"`
                                                                      
                                                                      	// Cloud is the name of the cloud to create the Juju controller in.
                                                                      	Cloud string `yaml:"cloud"`
                                                                      
                                                                      	// CloudType is the type of the cloud to create the Juju controller in.
                                                                      	CloudType string `yaml:"type"`
                                                                      
                                                                      	// CloudRegion is the name of the region of the cloud to create
                                                                      	// the Juju controller in. This will be empty for clouds without
                                                                      	// regions.
                                                                      	CloudRegion string `yaml:"region,omitempty"`
                                                                      
                                                                      	// CloudEndpoint is the location of the primary API endpoint to
                                                                      	// use when communicating with the cloud.
                                                                      	CloudEndpoint string `yaml:"endpoint,omitempty"`
                                                                      
                                                                      	// CloudIdentityEndpoint is the location of the API endpoint to use
                                                                      	// when communicating with the cloud's identity service. This will
                                                                      	// be empty for clouds that have no identity-specific API endpoint.
                                                                      	CloudIdentityEndpoint string `yaml:"identity-endpoint,omitempty"`
                                                                      
                                                                      	// CloudStorageEndpoint is the location of the API endpoint to use
                                                                      	// when communicating with the cloud's storage service. This will
                                                                      	// be empty for clouds that have no storage-specific API endpoint.
                                                                      	CloudStorageEndpoint string `yaml:"storage-endpoint,omitempty"`
                                                                      
                                                                      	// CloudCACertificates contains the CACertificates necessary to
                                                                      	// communicate with the cloud infrastructure.
                                                                      	CloudCACertificates []string `yaml:"ca-certificates,omitempty"`
                                                                      }

                                                                        BootstrapConfig holds the configuration used to bootstrap a controller.

                                                                        This includes all non-sensitive information required to regenerate the bootstrap configuration. A reference to the credential used will be stored, rather than the credential itself.

                                                                        type BootstrapConfigGetter

                                                                        type BootstrapConfigGetter interface {
                                                                        	// BootstrapConfigForController gets bootstrap config for the named
                                                                        	// controller.
                                                                        	BootstrapConfigForController(string) (*BootstrapConfig, error)
                                                                        }

                                                                          BootstrapConfigGetter gets bootstrap config.

                                                                          type BootstrapConfigStore

                                                                          type BootstrapConfigStore interface {
                                                                          	BootstrapConfigUpdater
                                                                          	BootstrapConfigGetter
                                                                          }

                                                                            BootstrapConfigStore is an amalgamation of BootstrapConfigUpdater and BootstrapConfigGetter.

                                                                            type BootstrapConfigUpdater

                                                                            type BootstrapConfigUpdater interface {
                                                                            	// UpdateBootstrapConfig adds the given bootstrap config to the
                                                                            	// bootstrap config collection for the controller with the given
                                                                            	// name.
                                                                            	//
                                                                            	// If the bootstrap config does not already exist, it will be added.
                                                                            	// Otherwise, it will be overwritten with the new value.
                                                                            	UpdateBootstrapConfig(controller string, cfg BootstrapConfig) error
                                                                            }

                                                                              BootstrapConfigUpdater stores bootstrap config.

                                                                              type ClientStore

                                                                                ClientStore is an amalgamation of AccountStore, BootstrapConfigStore, ControllerStore, CredentialStore, and ModelStore.

                                                                                func NewFileClientStore

                                                                                func NewFileClientStore() ClientStore

                                                                                  NewFileClientStore returns a new filesystem-based client store that manages files in $XDG_DATA_HOME/juju.

                                                                                  type ControllerDetails

                                                                                  type ControllerDetails struct {
                                                                                  	// ControllerUUID is the unique ID for the controller.
                                                                                  	ControllerUUID string `yaml:"uuid"`
                                                                                  
                                                                                  	// APIEndpoints holds a list of API addresses. It may not be
                                                                                  	// current, and it will be empty if the environment has not been
                                                                                  	// bootstrapped.
                                                                                  	APIEndpoints []string `yaml:"api-endpoints,flow"`
                                                                                  
                                                                                  	// DNSCache holds a map of hostname to IP addresses, holding
                                                                                  	// a cache of the last time the API endpoints were looked up.
                                                                                  	// The information held here is strictly optional so that we
                                                                                  	// can avoid slow DNS queries in the usual case that the controller's
                                                                                  	// IP addresses haven't changed since the last time we connected.
                                                                                  	DNSCache map[string][]string `yaml:"dns-cache,omitempty,flow"`
                                                                                  
                                                                                  	// PublicDNSName holds the public host name associated with the controller.
                                                                                  	// If this is non-empty, it indicates that the controller will use an
                                                                                  	// officially signed certificate when connecting with this host name.
                                                                                  	PublicDNSName string `yaml:"public-hostname,omitempty"`
                                                                                  
                                                                                  	// CACert is a security certificate for this controller.
                                                                                  	CACert string `yaml:"ca-cert"`
                                                                                  
                                                                                  	// Cloud is the name of the cloud that this controller runs in.
                                                                                  	Cloud string `yaml:"cloud"`
                                                                                  
                                                                                  	// CloudRegion is the name of the cloud region that this controller
                                                                                  	// runs in. This will be empty for clouds without regions.
                                                                                  	CloudRegion string `yaml:"region,omitempty"`
                                                                                  
                                                                                  	// CloudType is the type of the cloud that this controller runs in.
                                                                                  	CloudType string `yaml:"type,omitempty"`
                                                                                  
                                                                                  	// AgentVersion is the version of the agent running on this controller.
                                                                                  	// While this isn't strictly needed to connect to a controller, it is used
                                                                                  	// in formatting show-controller output where this struct is also used.
                                                                                  	AgentVersion string `yaml:"agent-version,omitempty"`
                                                                                  
                                                                                  	// ControllerMachineCount represents the number of controller machines
                                                                                  	// It is cached here so under normal usage list-controllers
                                                                                  	// does not need to hit the server.
                                                                                  	ControllerMachineCount int `yaml:"controller-machine-count"`
                                                                                  
                                                                                  	// ActiveControllerMachineCount represents the number of controller machines
                                                                                  	// and which are active in the HA cluster.
                                                                                  	// It is cached here so under normal usage list-controllers
                                                                                  	// does not need to hit the server.
                                                                                  	ActiveControllerMachineCount int `yaml:"active-controller-machine-count"`
                                                                                  
                                                                                  	// MachineCount is the number of machines in all models to
                                                                                  	// which a user has access. It is cached here so under normal
                                                                                  	// usage list-controllers does not need to hit the server.
                                                                                  	MachineCount *int `yaml:"machine-count,omitempty"`
                                                                                  }

                                                                                    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)
                                                                                    
                                                                                    	// ControllerByAPIEndpoints returns the details and name of the
                                                                                    	// controller where the set of API endpoints contains any of the
                                                                                    	// provided endpoints. If no controller can be located, an error
                                                                                    	// satisfying errors.IsNotFound will be returned.
                                                                                    	ControllerByAPIEndpoints(endpoints ...string) (*ControllerDetails, string, error)
                                                                                    
                                                                                    	// CurrentController returns the name of the current controller.
                                                                                    	// If there is no current controller, an error satisfying
                                                                                    	// errors.IsNotFound will be returned.
                                                                                    	CurrentController() (string, error)
                                                                                    }

                                                                                      ControllerGetter gets controllers.

                                                                                      type ControllerModels

                                                                                      type ControllerModels struct {
                                                                                      	// Models is the collection of models for the account, indexed
                                                                                      	// by model name. This should be treated as a cache only, and
                                                                                      	// not the complete set of models for the account.
                                                                                      	Models map[string]ModelDetails `yaml:"models,omitempty"`
                                                                                      
                                                                                      	// CurrentModel is the name of the active model for the account.
                                                                                      	CurrentModel string `yaml:"current-model,omitempty"`
                                                                                      }

                                                                                        ControllerModels stores per-controller account-model information.

                                                                                        type ControllerRemover

                                                                                        type ControllerRemover interface {
                                                                                        	// RemoveController removes the controller with the given name from the
                                                                                        	// controllers collection. Any other controllers with matching UUIDs
                                                                                        	// will also be removed.
                                                                                        	//
                                                                                        	// Removing controllers will remove all information related to those
                                                                                        	// controllers (models, accounts, bootstrap config.)
                                                                                        	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 {
                                                                                            	// AddController adds the given controller to the controller
                                                                                            	// collection.
                                                                                            	//
                                                                                            	// Where UpdateController is concerned with the controller name,
                                                                                            	// AddController uses the controller UUID and will not add a
                                                                                            	// duplicate even if the name is different.
                                                                                            	AddController(controllerName string, details ControllerDetails) error
                                                                                            
                                                                                            	// UpdateController updates the given controller in the controller
                                                                                            	// collection.
                                                                                            	//
                                                                                            	// If a controller of controllerName exists it will be overwritten
                                                                                            	// with the new details.
                                                                                            	UpdateController(controllerName string, details ControllerDetails) error
                                                                                            
                                                                                            	// SetCurrentController sets the name of the current controller.
                                                                                            	// If there exists no controller with the specified name, an error
                                                                                            	// satisfying errors.IsNotFound will be returned.
                                                                                            	SetCurrentController(controllerName string) error
                                                                                            }

                                                                                              ControllerUpdater stores controller details.

                                                                                              type Controllers

                                                                                              type Controllers struct {
                                                                                              	// Controllers is the collection of controllers known to the client.
                                                                                              	Controllers map[string]ControllerDetails `yaml:"controllers"`
                                                                                              
                                                                                              	// CurrentController is the name of the active controller.
                                                                                              	CurrentController string `yaml:"current-controller,omitempty"`
                                                                                              }

                                                                                                Controllers stores per-client controller information.

                                                                                                func ParseControllers

                                                                                                func ParseControllers(data []byte) (*Controllers, error)

                                                                                                  ParseControllers parses the given YAML bytes into controllers metadata.

                                                                                                  func ReadControllersFile

                                                                                                  func ReadControllersFile(file string) (*Controllers, error)

                                                                                                    ReadControllersFile loads all controllers defined in a given file. If the file is not found, it is not an error.

                                                                                                    type CookieJar

                                                                                                    type CookieJar interface {
                                                                                                    	http.CookieJar
                                                                                                    
                                                                                                    	// RemoveAll removes all the cookies (note: this doesn't
                                                                                                    	// save the cookie file).
                                                                                                    	RemoveAll()
                                                                                                    
                                                                                                    	// Save saves the cookies.
                                                                                                    	Save() error
                                                                                                    }

                                                                                                      CookieJar is the interface implemented by cookie jars.

                                                                                                      type CookieStore

                                                                                                      type CookieStore interface {
                                                                                                      	CookieJar(controllerName string) (CookieJar, error)
                                                                                                      }

                                                                                                        CookieStore allows the retrieval of cookie jars for storage of per-controller authorization information.

                                                                                                        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 MemStore

                                                                                                                type MemStore struct {
                                                                                                                	Controllers           map[string]ControllerDetails
                                                                                                                	CurrentControllerName string
                                                                                                                	Models                map[string]*ControllerModels
                                                                                                                	Accounts              map[string]AccountDetails
                                                                                                                	Credentials           map[string]cloud.CloudCredential
                                                                                                                	BootstrapConfig       map[string]BootstrapConfig
                                                                                                                	CookieJars            map[string]*cookiejar.Jar
                                                                                                                	// contains filtered or unexported fields
                                                                                                                }

                                                                                                                  MemStore is an in-memory implementation of ClientStore.

                                                                                                                  func NewMemStore

                                                                                                                  func NewMemStore() *MemStore

                                                                                                                  func (*MemStore) AccountDetails

                                                                                                                  func (c *MemStore) AccountDetails(controllerName string) (*AccountDetails, error)

                                                                                                                    AccountDetails implements AccountGetter.

                                                                                                                    func (*MemStore) AddController

                                                                                                                    func (c *MemStore) AddController(name string, one ControllerDetails) error

                                                                                                                      AddController implements ControllerUpdater.AddController

                                                                                                                      func (*MemStore) AllControllers

                                                                                                                      func (c *MemStore) AllControllers() (map[string]ControllerDetails, error)

                                                                                                                        AllController implements ControllerGetter.AllController

                                                                                                                        func (*MemStore) AllCredentials

                                                                                                                        func (c *MemStore) AllCredentials() (map[string]cloud.CloudCredential, error)

                                                                                                                          AllCredentials implements CredentialsGetter.

                                                                                                                          func (*MemStore) AllModels

                                                                                                                          func (c *MemStore) AllModels(controller string) (map[string]ModelDetails, error)

                                                                                                                            AllModels implements ModelGetter.

                                                                                                                            func (*MemStore) BootstrapConfigForController

                                                                                                                            func (c *MemStore) BootstrapConfigForController(controllerName string) (*BootstrapConfig, error)

                                                                                                                              BootstrapConfigForController implements BootstrapConfigGetter.

                                                                                                                              func (*MemStore) ControllerByAPIEndpoints

                                                                                                                              func (c *MemStore) ControllerByAPIEndpoints(endpoints ...string) (*ControllerDetails, string, error)

                                                                                                                                ControllerByAPIEndpoints implements ControllersGetter.ControllerByAPIEndpoints

                                                                                                                                func (*MemStore) ControllerByName

                                                                                                                                func (c *MemStore) ControllerByName(name string) (*ControllerDetails, error)

                                                                                                                                  ControllerByName implements ControllerGetter.ControllerByName

                                                                                                                                  func (*MemStore) CookieJar

                                                                                                                                  func (c *MemStore) CookieJar(controllerName string) (CookieJar, error)

                                                                                                                                  func (*MemStore) CredentialForCloud

                                                                                                                                  func (c *MemStore) CredentialForCloud(cloudName string) (*cloud.CloudCredential, error)

                                                                                                                                    CredentialForCloud implements CredentialsGetter.

                                                                                                                                    func (*MemStore) CurrentController

                                                                                                                                    func (c *MemStore) CurrentController() (string, error)

                                                                                                                                      CurrentController implements ControllerGetter.CurrentController

                                                                                                                                      func (*MemStore) CurrentModel

                                                                                                                                      func (c *MemStore) CurrentModel(controller string) (string, error)

                                                                                                                                        CurrentModel implements ModelGetter.

                                                                                                                                        func (*MemStore) ModelByName

                                                                                                                                        func (c *MemStore) ModelByName(controller, model string) (*ModelDetails, error)

                                                                                                                                          ModelByName implements ModelGetter.

                                                                                                                                          func (*MemStore) RemoveAccount

                                                                                                                                          func (c *MemStore) RemoveAccount(controllerName string) error

                                                                                                                                            RemoveAccount implements AccountRemover.

                                                                                                                                            func (*MemStore) RemoveController

                                                                                                                                            func (c *MemStore) RemoveController(name string) error

                                                                                                                                              RemoveController implements ControllerRemover.RemoveController

                                                                                                                                              func (*MemStore) RemoveModel

                                                                                                                                              func (c *MemStore) RemoveModel(controller, model string) error

                                                                                                                                                RemoveModel implements ModelRemover.

                                                                                                                                                func (*MemStore) SetCurrentController

                                                                                                                                                func (c *MemStore) SetCurrentController(name string) error

                                                                                                                                                  SetCurrentController implements ControllerUpdater.SetCurrentController

                                                                                                                                                  func (*MemStore) SetCurrentModel

                                                                                                                                                  func (c *MemStore) SetCurrentModel(controllerName, modelName string) error

                                                                                                                                                    SetCurrentModel implements ModelUpdater.

                                                                                                                                                    func (*MemStore) SetModels

                                                                                                                                                    func (c *MemStore) SetModels(controller string, models map[string]ModelDetails) error

                                                                                                                                                      SetModels implements ModelUpdater.

                                                                                                                                                      func (*MemStore) UpdateAccount

                                                                                                                                                      func (c *MemStore) UpdateAccount(controllerName string, details AccountDetails) error

                                                                                                                                                        UpdateAccount implements AccountUpdater.

                                                                                                                                                        func (*MemStore) UpdateBootstrapConfig

                                                                                                                                                        func (c *MemStore) UpdateBootstrapConfig(controllerName string, cfg BootstrapConfig) error

                                                                                                                                                          UpdateBootstrapConfig implements BootstrapConfigUpdater.

                                                                                                                                                          func (*MemStore) UpdateController

                                                                                                                                                          func (c *MemStore) UpdateController(name string, one ControllerDetails) error

                                                                                                                                                            UpdateController implements ControllerUpdater.UpdateController

                                                                                                                                                            func (*MemStore) UpdateCredential

                                                                                                                                                            func (c *MemStore) UpdateCredential(cloudName string, details cloud.CloudCredential) error

                                                                                                                                                              UpdateCredential implements CredentialsUpdater.

                                                                                                                                                              func (*MemStore) UpdateModel

                                                                                                                                                              func (c *MemStore) UpdateModel(controller, model string, details ModelDetails) error

                                                                                                                                                                UpdateModel implements ModelUpdater.

                                                                                                                                                                type ModelDetails

                                                                                                                                                                type ModelDetails struct {
                                                                                                                                                                	// ModelUUID is the unique ID for the model.
                                                                                                                                                                	ModelUUID string `yaml:"uuid"`
                                                                                                                                                                
                                                                                                                                                                	// ModelType is the type of model.
                                                                                                                                                                	ModelType model.ModelType `yaml:"type"`
                                                                                                                                                                
                                                                                                                                                                	// Active branch is the current working branch for the model.
                                                                                                                                                                	ActiveBranch string `yaml:"branch"`
                                                                                                                                                                }

                                                                                                                                                                  ModelDetails holds details of a model.

                                                                                                                                                                  type ModelGetter

                                                                                                                                                                  type ModelGetter interface {
                                                                                                                                                                  	// AllModels gets all models for the specified controller as a map
                                                                                                                                                                  	// from model name to its details.
                                                                                                                                                                  	//
                                                                                                                                                                  	// If there is no controller with the specified
                                                                                                                                                                  	// name, or no models cached for the controller and account,
                                                                                                                                                                  	// an error satisfying errors.IsNotFound will be returned.
                                                                                                                                                                  	AllModels(controllerName string) (map[string]ModelDetails, error)
                                                                                                                                                                  
                                                                                                                                                                  	// CurrentModel returns the name of the current model for
                                                                                                                                                                  	// the specified controller. If there is no current
                                                                                                                                                                  	// model for the controller, an error satisfying
                                                                                                                                                                  	// errors.IsNotFound is returned.
                                                                                                                                                                  	CurrentModel(controllerName string) (string, error)
                                                                                                                                                                  
                                                                                                                                                                  	// ModelByName returns the model with the specified controller,
                                                                                                                                                                  	// and model name. If a model with the specified name does not
                                                                                                                                                                  	// exist, an error satisfying errors.IsNotFound will be
                                                                                                                                                                  	// returned.
                                                                                                                                                                  	ModelByName(controllerName, 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, 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, modelName string, details ModelDetails) error
                                                                                                                                                                        
                                                                                                                                                                        	// SetModels updates the list of currently stored controller
                                                                                                                                                                        	// models in model store - models will be added, updated or removed from the
                                                                                                                                                                        	// store based on the supplied models collection.
                                                                                                                                                                        	SetModels(controllerName string, models map[string]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 satisfying
                                                                                                                                                                        	// errors.IsNotFound will be returned.
                                                                                                                                                                        	SetCurrentModel(controllerName, 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
                                                                                                                                                                          
                                                                                                                                                                          	// ControllerName contains the name that the controller has for the
                                                                                                                                                                          	// caller of "juju add-user" that will be used to suggest a name for
                                                                                                                                                                          	// the caller of "juju register".
                                                                                                                                                                          	ControllerName string
                                                                                                                                                                          }

                                                                                                                                                                            RegistrationInfo contains the user/controller registration information printed by "juju add-user", and consumed by "juju register".

                                                                                                                                                                            Directories

                                                                                                                                                                            Path Synopsis