Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoControllersDefined is returned by commands that operate on
	// a controller if there is no current controller, no controller has been
	// explicitly specified, and there is no default controller.
	ErrNoControllersDefined = errors.New(`No controllers registered.

Please either create a new controller using "juju bootstrap" or connect to
another controller that you have been given access to using "juju register".
`)
	// ErrNoCurrentController is returned by commands that operate on
	// a controller if there is no current controller, no controller has been
	// explicitly specified, and there is no default controller but there are
	// controllers that client knows about.
	ErrNoCurrentController = errors.New(`No selected controller.

Please use "juju switch" to select a controller.
`)
)
View Source
var (
	// ErrMultipleCredentials is the error returned by DetectCredential
	// if more than one credential is detected.
	ErrMultipleCredentials = errors.New("more than one credential detected")
)
View Source
var ErrNoModelSpecified = errors.New(`No model in focus.

Please use "juju models" to see models available to you.
You can set current model by running "juju switch"
or specify any other model on the command line using the "-m" option.
`)

    ErrNoModelSpecified is returned by commands that operate on an environment if there is no current model, no model has been explicitly specified, and there is no default model.

    Functions

    func AnnotateWithFinalizationError

    func AnnotateWithFinalizationError(err error, credentialName, cloudName string) error

    func BootstrapContext

    func BootstrapContext(ctx context.Context, cmdContext *cmd.Context) environs.BootstrapContext

      BootstrapContext returns a new BootstrapContext constructed from a command Context.

      func BootstrapContextNoVerify

      func BootstrapContextNoVerify(ctx context.Context, cmdContext *cmd.Context) environs.BootstrapContext

        BootstrapContextNoVerify returns a new BootstrapContext constructed from a command Context where the validation of credentials is false.

        func DetectCredential

        func DetectCredential(cloudName string, provider environs.EnvironProvider) (*cloud.CloudCredential, error)

          DetectCredential detects credentials for the specified cloud type, and, if exactly one is detected, returns it.

          If no credentials are detected, an error satisfying errors.IsNotFound will be returned. If more than one credential is detected, ErrMultipleCredentials will be returned.

          func DetermineCurrentController

          func DetermineCurrentController(store jujuclient.ClientStore) (string, error)

            DetermineCurrentController returns current controller on this client. It considers commandline flags, environment variables, and current config.

            func FinalizeFileContent

            func FinalizeFileContent(credential *cloud.Credential, provider environs.EnvironProvider) (*cloud.Credential, error)

              FinalizeFileContent replaces the path content of cloud credentials "file" attribute with its content.

              func GetCredentials

              func GetCredentials(
              	ctx *cmd.Context,
              	store jujuclient.CredentialGetter,
              	args GetCredentialsParams,
              ) (_ *cloud.Credential, chosenCredentialName, regionName string, _ error)

                GetCredentials returns a curated set of credential values for a given cloud. The credential key values are read from the credentials store and the provider finalises the values to resolve things like json files. If region is not specified, the default credential region is used.

                func InnerCommand

                func InnerCommand(c cmd.Command) cmd.Command

                  InnerCommand returns the command that has been wrapped by one of the Wrap functions. This is useful for tests that wish to inspect internal details of a command instance. If c isn't wrapping anything, it returns c.

                  func IsModelMigratedError

                  func IsModelMigratedError(err error) bool

                    IsModelMigratedError returns true if err is of type modelMigratedError.

                    func JoinModelName

                    func JoinModelName(controller, model string) string

                      JoinModelName joins a controller and model name into a qualified model name.

                      func NewGetBootstrapConfigParamsFunc

                      func NewGetBootstrapConfigParamsFunc(
                      	ctx *cmd.Context,
                      	store jujuclient.ClientStore,
                      	providerRegistry environs.ProviderRegistry,
                      ) func(string) (*jujuclient.BootstrapConfig, *environs.PrepareConfigParams, error)

                        NewGetBootstrapConfigParamsFunc returns a function that, given a controller name, returns the params needed to bootstrap a fresh copy of that controller in the given client store.

                        func RegisterCredentials

                        func RegisterCredentials(provider environs.EnvironProvider, args RegisterCredentialsParams) (map[string]*cloud.CloudCredential, error)

                          RegisterCredentials returns any credentials that need to be registered for a provider.

                          func SplitModelName

                          func SplitModelName(name string) (controller, model string)

                            SplitModelName splits a model name into its controller and model parts. If the model is unqualified, then the returned controller string will be empty, and the returned model string will be identical to the input.

                            func VerifyCredentials

                            func VerifyCredentials(ctx *cmd.Context, aCloud *cloud.Cloud, credential *cloud.Credential, credentialName string, regionName string) (_ *cloud.Credential, _ error)

                              VerifyCredentials ensures that a given credential complies with the provider/cloud understanding of what its valid credential looks like.

                              Types

                              type AuthOpts

                              type AuthOpts struct {
                              	// NoBrowser specifies that web-browser-based auth should
                              	// not be used when authenticating.
                              	NoBrowser bool
                              	// Embedded is true for commands run inside a controller.
                              	Embedded bool
                              }

                                AuthOpts holds flags relating to authentication.

                                func (*AuthOpts) SetFlags

                                func (o *AuthOpts) SetFlags(f *gnuflag.FlagSet)

                                type CAASOnlyCommand

                                type CAASOnlyCommand interface {
                                	// contains filtered or unexported methods
                                }

                                  CAASOnlyCommand is used as a marker and is embedded by commands which should only run in CAAS models.

                                  type Command

                                  type Command interface {
                                  	cmd.Command
                                  
                                  	// SetAPIOpen sets the function used for opening an API connection.
                                  	SetAPIOpen(opener api.OpenFunc)
                                  
                                  	// SetModelAPI sets the api used to access model information.
                                  	SetModelAPI(api ModelAPI)
                                  
                                  	// SetEmbedded sets whether the command is being run inside a controller.
                                  	SetEmbedded(bool)
                                  	// contains filtered or unexported methods
                                  }

                                    Command extends cmd.Command with a closeContext method. It is implicitly implemented by any type that embeds CommandBase.

                                    func WrapBase

                                    func WrapBase(c Command) Command

                                      WrapBase wraps the specified Command. This should be used by any command that embeds CommandBase.

                                      type CommandBase

                                      type CommandBase struct {
                                      	cmd.CommandBase
                                      
                                      	// StdContext is the Go context.
                                      	StdContext context.Context
                                      
                                      	// CanClearCurrentModel indicates that this command can reset current model in local cache, aka client store.
                                      	CanClearCurrentModel bool
                                      
                                      	// Embedded is true if this command is being run inside a controller.
                                      	Embedded bool
                                      	// contains filtered or unexported fields
                                      }

                                        CommandBase is a convenience type for embedding that need an API connection.

                                        func (*CommandBase) APIOpen

                                        func (c *CommandBase) APIOpen(info *api.Info, opts api.DialOpts) (api.Connection, error)

                                          APIOpen establishes a connection to the API server using the the given api.Info and api.DialOpts, and associating any stored authorization tokens with the given controller name.

                                          func (*CommandBase) BakeryClient

                                          func (c *CommandBase) BakeryClient(store jujuclient.CookieStore, controllerName string) (*httpbakery.Client, error)

                                            BakeryClient returns a macaroon bakery client that uses the same HTTP client returned by HTTPClient.

                                            func (*CommandBase) ClearControllerMacaroons

                                            func (c *CommandBase) ClearControllerMacaroons(store jujuclient.CookieStore, controllerName string) error

                                              ClearControllerMacaroons will remove all macaroons stored for the given controller from the persistent cookie jar. This is called both from 'juju logout' and a failed 'juju register'.

                                              func (*CommandBase) ControllerUUID

                                              func (c *CommandBase) ControllerUUID(store jujuclient.ClientStore, controllerName string) (string, error)

                                                ControllerUUID returns the controller UUID for specified controller name.

                                                func (*CommandBase) CookieJar

                                                func (c *CommandBase) CookieJar(store jujuclient.CookieStore, controllerName string) (http.CookieJar, error)

                                                  CookieJar returns the cookie jar that is used to store auth credentials when connecting to the API.

                                                  func (*CommandBase) Filesystem

                                                  func (c *CommandBase) Filesystem() Filesystem

                                                    Filesystem returns an instance that provides access to the filesystem, either delegating to calling os functions or functions which always return an error.

                                                    func (*CommandBase) HTTPClient

                                                    func (c *CommandBase) HTTPClient(store jujuclient.ClientStore, controllerName string) (*http.Client, error)

                                                      HTTPClient returns an http.Client that contains the loaded persistent cookie jar. Note that this client is not good for connecting to the Juju API itself because it does not have the correct TLS setup - use api.Connection.HTTPClient for that.

                                                      func (*CommandBase) ModelUUIDs

                                                      func (c *CommandBase) ModelUUIDs(store jujuclient.ClientStore, controllerName string, modelNames []string) ([]string, error)

                                                        ModelUUIDs returns the model UUIDs for the given model names.

                                                        func (*CommandBase) NewAPIConnectionParams

                                                        func (c *CommandBase) NewAPIConnectionParams(
                                                        	store jujuclient.ClientStore,
                                                        	controllerName, modelName string,
                                                        	accountDetails *jujuclient.AccountDetails,
                                                        ) (juju.NewAPIConnectionParams, error)

                                                          NewAPIConnectionParams returns a juju.NewAPIConnectionParams with the given arguments such that a call to juju.NewAPIConnection with the result behaves the same as a call to CommandBase.NewAPIRoot with the same arguments.

                                                          func (*CommandBase) NewAPIRoot

                                                          func (c *CommandBase) NewAPIRoot(
                                                          	store jujuclient.ClientStore,
                                                          	controllerName, modelName string,
                                                          ) (api.Connection, error)

                                                            NewAPIRoot returns a new connection to the API server for the given model or controller.

                                                            func (*CommandBase) NewAPIRootWithDialOpts

                                                            func (c *CommandBase) NewAPIRootWithDialOpts(
                                                            	store jujuclient.ClientStore,
                                                            	controllerName, modelName string,
                                                            	dialOpts *api.DialOpts,
                                                            ) (api.Connection, error)

                                                              NewAPIRootWithDialOpts returns a new connection to the API server for the given model or controller (the default dial options will be overridden if dialOpts is not nil).

                                                              func (*CommandBase) RefreshModels

                                                              func (c *CommandBase) RefreshModels(store jujuclient.ClientStore, controllerName string) error

                                                                RefreshModels refreshes the local models cache for the current user on the specified controller.

                                                                func (*CommandBase) RemoveModelFromClientStore

                                                                func (c *CommandBase) RemoveModelFromClientStore(store jujuclient.ClientStore, controllerName, modelName string)

                                                                  RemoveModelFromClientStore removes given model from client cache, store, for a given controller. If this model has also been cached as current, it will be reset if the requesting command can modify current model. For example, commands such as add/destroy-model, login/register, etc. If the model was cached as current but the command is not expected to change current model, this call will still remove model details from the client cache but will keep current model name intact to allow subsequent calls to try to resolve model details on the controller.

                                                                  func (*CommandBase) SetAPIOpen

                                                                  func (c *CommandBase) SetAPIOpen(apiOpen api.OpenFunc)

                                                                    SetAPIOpen sets the function used for opening an API connection.

                                                                    func (*CommandBase) SetControllerModels

                                                                    func (c *CommandBase) SetControllerModels(store jujuclient.ClientStore, controllerName string, models []base.UserModel) error

                                                                    func (*CommandBase) SetEmbedded

                                                                    func (c *CommandBase) SetEmbedded(embedded bool)

                                                                      SetEmbedded sets whether the command is embedded.

                                                                      func (*CommandBase) SetFilesystem

                                                                      func (c *CommandBase) SetFilesystem(fs Filesystem)

                                                                        SetFilesystem sets the Filesystem instance on the command.

                                                                        func (*CommandBase) SetFlags

                                                                        func (c *CommandBase) SetFlags(f *gnuflag.FlagSet)

                                                                          SetFlags implements cmd.Command.SetFlags.

                                                                          func (*CommandBase) SetModelAPI

                                                                          func (c *CommandBase) SetModelAPI(api ModelAPI)

                                                                            SetModelAPI sets the api used to access model information.

                                                                            func (*CommandBase) SetModelRefresh

                                                                            func (c *CommandBase) SetModelRefresh(refresh func(jujuclient.ClientStore, string) error)

                                                                              SetModelRefresh sets the function used for refreshing models.

                                                                              type ControllerCommand

                                                                              type ControllerCommand interface {
                                                                              	Command
                                                                              
                                                                              	// SetClientStore is called prior to the wrapped command's Init method
                                                                              	// with the default controller store. It may also be called to override the
                                                                              	// default controller store for testing.
                                                                              	SetClientStore(jujuclient.ClientStore)
                                                                              
                                                                              	// ClientStore returns the controller store that the command is
                                                                              	// associated with.
                                                                              	ClientStore() jujuclient.ClientStore
                                                                              
                                                                              	// SetControllerName sets the name of the current controller.
                                                                              	SetControllerName(controllerName string, allowDefault bool) error
                                                                              
                                                                              	// ControllerName returns the name of the controller
                                                                              	// that the command should use. It must only be called
                                                                              	// after Run has been called.
                                                                              	ControllerName() (string, error)
                                                                              	// contains filtered or unexported methods
                                                                              }

                                                                                ControllerCommand is intended to be a base for all commands that need to operate on controllers as opposed to models.

                                                                                func WrapController

                                                                                func WrapController(c ControllerCommand, options ...WrapControllerOption) ControllerCommand

                                                                                  WrapController wraps the specified ControllerCommand, returning a Command that proxies to each of the ControllerCommand methods.

                                                                                  type ControllerCommandBase

                                                                                  type ControllerCommandBase struct {
                                                                                  	CommandBase
                                                                                  	// contains filtered or unexported fields
                                                                                  }

                                                                                    ControllerCommandBase is a convenience type for embedding in commands that wish to implement ControllerCommand.

                                                                                    func (*ControllerCommandBase) BakeryClient

                                                                                    func (c *ControllerCommandBase) BakeryClient() (*httpbakery.Client, error)

                                                                                    func (*ControllerCommandBase) ClientStore

                                                                                    func (c *ControllerCommandBase) ClientStore() jujuclient.ClientStore

                                                                                      ClientStore implements the ControllerCommand interface.

                                                                                      func (*ControllerCommandBase) ControllerName

                                                                                      func (c *ControllerCommandBase) ControllerName() (string, error)

                                                                                        ControllerName implements the ControllerCommand interface.

                                                                                        func (*ControllerCommandBase) CookieJar

                                                                                        func (c *ControllerCommandBase) CookieJar() (http.CookieJar, error)

                                                                                        func (*ControllerCommandBase) CurrentAccountDetails

                                                                                        func (c *ControllerCommandBase) CurrentAccountDetails() (*jujuclient.AccountDetails, error)

                                                                                          CurrentAccountDetails returns details of the account associated with the current controller.

                                                                                          func (*ControllerCommandBase) ModelUUIDs

                                                                                          func (c *ControllerCommandBase) ModelUUIDs(modelNames []string) ([]string, error)

                                                                                            ModelUUIDs returns the model UUIDs for the given model names.

                                                                                            func (*ControllerCommandBase) NewAPIRoot

                                                                                            func (c *ControllerCommandBase) NewAPIRoot() (api.Connection, error)

                                                                                              NewAPIRoot returns a restricted API for the current controller using the current credentials. Only the UserManager and ModelManager may be accessed through this API connection.

                                                                                              func (*ControllerCommandBase) NewControllerAPIClient

                                                                                              func (c *ControllerCommandBase) NewControllerAPIClient() (*controller.Client, error)

                                                                                                NewControllerAPIClient returns an API client for the Controller on the current controller using the current credentials.

                                                                                                func (*ControllerCommandBase) NewModelAPIRoot

                                                                                                func (c *ControllerCommandBase) NewModelAPIRoot(modelName string) (api.Connection, error)

                                                                                                  NewAPIRoot returns a new connection to the API server for the named model in the specified controller.

                                                                                                  func (*ControllerCommandBase) NewModelManagerAPIClient

                                                                                                  func (c *ControllerCommandBase) NewModelManagerAPIClient() (*modelmanager.Client, error)

                                                                                                    NewModelManagerAPIClient returns an API client for the ModelManager on the current controller using the current credentials.

                                                                                                    func (*ControllerCommandBase) NewUserManagerAPIClient

                                                                                                    func (c *ControllerCommandBase) NewUserManagerAPIClient() (*usermanager.Client, error)

                                                                                                      NewUserManagerAPIClient returns an API client for the UserManager on the current controller using the current credentials.

                                                                                                      func (*ControllerCommandBase) SetClientStore

                                                                                                      func (c *ControllerCommandBase) SetClientStore(store jujuclient.ClientStore)

                                                                                                        SetClientStore implements the ControllerCommand interface.

                                                                                                        func (*ControllerCommandBase) SetControllerName

                                                                                                        func (c *ControllerCommandBase) SetControllerName(controllerName string, allowDefault bool) error

                                                                                                          SetControllerName implements ControllerCommand.SetControllerName.

                                                                                                          type Filesystem

                                                                                                          type Filesystem interface {
                                                                                                          	Stat(name string) (os.FileInfo, error)
                                                                                                          	Open(name string) (ReadSeekCloser, error)
                                                                                                          	OpenFile(name string, flag int, perm os.FileMode) (*os.File, error)
                                                                                                          	Create(name string) (*os.File, error)
                                                                                                          	RemoveAll(path string) error
                                                                                                          }

                                                                                                            Filesystem is an interface providing access to the filesystem, either delegating to calling os functions or functions which always return an error.

                                                                                                            type GetCredentialsParams

                                                                                                            type GetCredentialsParams struct {
                                                                                                            	// Cloud is the cloud definition.
                                                                                                            	Cloud cloud.Cloud
                                                                                                            
                                                                                                            	// CloudRegion is the name of the region that the user has specified.
                                                                                                            	// If this is empty, then GetCredentials will determine the default
                                                                                                            	// region, and return that. The default region is the one set by the
                                                                                                            	// user in credentials.yaml, or if there is none set, the first region
                                                                                                            	// in the cloud's list.
                                                                                                            	CloudRegion string
                                                                                                            
                                                                                                            	// CredentialName is the name of the credential to get.
                                                                                                            	CredentialName string
                                                                                                            }

                                                                                                              GetCredentialsParams contains parameters for the GetCredentials function.

                                                                                                              type IAASOnlyCommand

                                                                                                              type IAASOnlyCommand interface {
                                                                                                              	// contains filtered or unexported methods
                                                                                                              }

                                                                                                                IAASOnlyCommand is used as a marker and is embedded by commands which should only run in IAAS models.

                                                                                                                type ModelAPI

                                                                                                                type ModelAPI interface {
                                                                                                                	ListModels(user string) ([]base.UserModel, error)
                                                                                                                	Close() error
                                                                                                                }

                                                                                                                  ModelAPI provides access to the model client facade methods.

                                                                                                                  type ModelCommand

                                                                                                                  type ModelCommand interface {
                                                                                                                  	Command
                                                                                                                  
                                                                                                                  	// SetClientStore is called prior to the wrapped command's Init method
                                                                                                                  	// with the default controller store. It may also be called to override the
                                                                                                                  	// default controller store for testing.
                                                                                                                  	SetClientStore(jujuclient.ClientStore)
                                                                                                                  
                                                                                                                  	// ClientStore returns the controller store that the command is
                                                                                                                  	// associated with.
                                                                                                                  	ClientStore() jujuclient.ClientStore
                                                                                                                  
                                                                                                                  	// SetModelIdentifier sets the model identifier for this command.
                                                                                                                  	// Setting the model identifier will also set the related controller name.
                                                                                                                  	// The model name can be qualified with a controller name
                                                                                                                  	// (controller:model), or unqualified, in which case it will be assumed
                                                                                                                  	// to be within the current controller.
                                                                                                                  	//
                                                                                                                  	// Passing an empty model name will choose the default
                                                                                                                  	// model, or return an error if there isn't one.
                                                                                                                  	//
                                                                                                                  	// SetModelIdentifier is called prior to the wrapped command's Init method
                                                                                                                  	// with the active model name.
                                                                                                                  	// The model identifier is guaranteed to be non-empty at entry of Init.
                                                                                                                  	SetModelIdentifier(modelIdentifier string, allowDefault bool) error
                                                                                                                  
                                                                                                                  	// ModelIdentifier returns a string identifying the target model.
                                                                                                                  	// It may be a model name, or a full or partial model UUID.
                                                                                                                  	ModelIdentifier() (string, error)
                                                                                                                  
                                                                                                                  	// ModelType returns the type of the model.
                                                                                                                  	ModelType() (model.ModelType, error)
                                                                                                                  
                                                                                                                  	// SetActiveBranch sets the branch to use for this command,
                                                                                                                  	// then updates the model's active branch in the local store.
                                                                                                                  	SetActiveBranch(string) error
                                                                                                                  
                                                                                                                  	// ActiveBranch returns the current active branch for this model.
                                                                                                                  	ActiveBranch() (string, error)
                                                                                                                  
                                                                                                                  	// ControllerName returns the name of the controller that contains
                                                                                                                  	// the model returned by ModelName().
                                                                                                                  	ControllerName() (string, error)
                                                                                                                  	// contains filtered or unexported methods
                                                                                                                  }

                                                                                                                    ModelCommand extends cmd.Command with a SetModelName method.

                                                                                                                    func Wrap

                                                                                                                    func Wrap(c ModelCommand, options ...WrapOption) ModelCommand

                                                                                                                      Wrap wraps the specified ModelCommand, returning a ModelCommand that proxies to each of the ModelCommand methods. Any provided options are applied to the wrapped command before it is returned.

                                                                                                                      type ModelCommandBase

                                                                                                                      type ModelCommandBase struct {
                                                                                                                      	CommandBase
                                                                                                                      	// contains filtered or unexported fields
                                                                                                                      }

                                                                                                                        ModelCommandBase is a convenience type for embedding in commands that wish to implement ModelCommand.

                                                                                                                        func (*ModelCommandBase) ActiveBranch

                                                                                                                        func (c *ModelCommandBase) ActiveBranch() (string, error)

                                                                                                                          ActiveBranch implements the ModelCommand interface.

                                                                                                                          func (*ModelCommandBase) BakeryClient

                                                                                                                          func (c *ModelCommandBase) BakeryClient() (*httpbakery.Client, error)

                                                                                                                          func (*ModelCommandBase) ClientStore

                                                                                                                          func (c *ModelCommandBase) ClientStore() jujuclient.ClientStore

                                                                                                                            ClientStore implements the ModelCommand interface.

                                                                                                                            func (*ModelCommandBase) ControllerName

                                                                                                                            func (c *ModelCommandBase) ControllerName() (string, error)

                                                                                                                              ControllerName implements the ModelCommand interface.

                                                                                                                              func (*ModelCommandBase) CookieJar

                                                                                                                              func (c *ModelCommandBase) CookieJar() (http.CookieJar, error)

                                                                                                                              func (*ModelCommandBase) CurrentAccountDetails

                                                                                                                              func (c *ModelCommandBase) CurrentAccountDetails() (*jujuclient.AccountDetails, error)

                                                                                                                                CurrentAccountDetails returns details of the account associated with the current controller.

                                                                                                                                func (*ModelCommandBase) ModelDetails

                                                                                                                                func (c *ModelCommandBase) ModelDetails() (string, *jujuclient.ModelDetails, error)

                                                                                                                                  ModelDetails returns details from the file store for the model indicated by the currently set controller name and model identifier.

                                                                                                                                  func (*ModelCommandBase) ModelIdentifier

                                                                                                                                  func (c *ModelCommandBase) ModelIdentifier() (string, error)

                                                                                                                                    ModelIdentifier implements the ModelCommand interface.

                                                                                                                                    func (*ModelCommandBase) ModelType

                                                                                                                                    func (c *ModelCommandBase) ModelType() (model.ModelType, error)

                                                                                                                                      ModelType implements the ModelCommand interface.

                                                                                                                                      func (*ModelCommandBase) ModelUUIDs

                                                                                                                                      func (c *ModelCommandBase) ModelUUIDs(modelNames []string) ([]string, error)

                                                                                                                                        ModelUUIDs returns the model UUIDs for the given model names.

                                                                                                                                        func (*ModelCommandBase) NewAPIClient

                                                                                                                                        func (c *ModelCommandBase) NewAPIClient() (*api.Client, error)

                                                                                                                                        func (*ModelCommandBase) NewAPIRoot

                                                                                                                                        func (c *ModelCommandBase) NewAPIRoot() (api.Connection, error)

                                                                                                                                          NewAPIRoot returns a new connection to the API server for the environment directed to the model specified on the command line.

                                                                                                                                          func (*ModelCommandBase) NewAPIRootWithDialOpts

                                                                                                                                          func (c *ModelCommandBase) NewAPIRootWithDialOpts(dialOpts *api.DialOpts) (api.Connection, error)

                                                                                                                                            NewAPIRootWithDialOpts returns a new connection to the API server for the environment directed to the model specified on the command line (and with the given dial options if non-nil).

                                                                                                                                            func (*ModelCommandBase) NewControllerAPIRoot

                                                                                                                                            func (c *ModelCommandBase) NewControllerAPIRoot() (api.Connection, error)

                                                                                                                                              NewControllerAPIRoot returns a new connection to the API server for the environment directed to the controller specified on the command line. This is for the use of model-centered commands that still want to talk to controller-only APIs.

                                                                                                                                              func (*ModelCommandBase) NewModelManagerAPIClient

                                                                                                                                              func (c *ModelCommandBase) NewModelManagerAPIClient() (*modelmanager.Client, error)

                                                                                                                                                NewModelManagerAPIClient returns an API client for the ModelManager on the current controller using the current credentials.

                                                                                                                                                func (*ModelCommandBase) SetActiveBranch

                                                                                                                                                func (c *ModelCommandBase) SetActiveBranch(branchName string) error

                                                                                                                                                  SetActiveBranch implements the ModelCommand interface.

                                                                                                                                                  func (*ModelCommandBase) SetClientStore

                                                                                                                                                  func (c *ModelCommandBase) SetClientStore(store jujuclient.ClientStore)

                                                                                                                                                    SetClientStore implements the ModelCommand interface.

                                                                                                                                                    func (*ModelCommandBase) SetModelIdentifier

                                                                                                                                                    func (c *ModelCommandBase) SetModelIdentifier(modelIdentifier string, allowDefault bool) error

                                                                                                                                                      SetModelIdentifier implements the ModelCommand interface.

                                                                                                                                                      type OptionalControllerCommand

                                                                                                                                                      type OptionalControllerCommand struct {
                                                                                                                                                      	CommandBase
                                                                                                                                                      	Store jujuclient.ClientStore
                                                                                                                                                      
                                                                                                                                                      	EnabledFlag string
                                                                                                                                                      
                                                                                                                                                      	// Local stores whether a client side (aka local) copy is requested.
                                                                                                                                                      	Local bool
                                                                                                                                                      
                                                                                                                                                      	// Client stores whether the command will operate on a client copy.
                                                                                                                                                      	Client bool
                                                                                                                                                      
                                                                                                                                                      	ControllerName string
                                                                                                                                                      
                                                                                                                                                      	// ReadOnly read only commands do not require to prompt the user for clarification
                                                                                                                                                      	// on whether the client or current controller is to be used.
                                                                                                                                                      	ReadOnly bool
                                                                                                                                                      }

                                                                                                                                                        OptionalControllerCommand is used as a base for commands which can act locally or on a controller. It is primarily intended to be used by cloud and credential related commands which can either update a local client cache, or a running controller.

                                                                                                                                                        func (*OptionalControllerCommand) Init

                                                                                                                                                        func (c *OptionalControllerCommand) Init(args []string) (err error)

                                                                                                                                                          Init populates the command with the args from the command line.

                                                                                                                                                          func (*OptionalControllerCommand) MaybePrompt

                                                                                                                                                          func (c *OptionalControllerCommand) MaybePrompt(ctxt *cmd.Context, action string) error

                                                                                                                                                            MaybePrompt checks if the command was give a --client or --controller options. If not, it will prompt user to clarify whether the operation is to take place on a client copy, a controller copy or both. When neither client nor controller is specified on the command, several scenarios need to be catered for when prompting: 1. there is a current controller to prompt user with; 2. there is no current controller but there are other controllers, so inform users how to use -c; 3. there is no current controller and there are no registered controllers, so inform users to bootstrap or register. When there is no current controller, the prompt becomes a Y/N client question instead of a multi-choice client/controller.

                                                                                                                                                            func (*OptionalControllerCommand) SetClientStore

                                                                                                                                                            func (c *OptionalControllerCommand) SetClientStore(store jujuclient.ClientStore)

                                                                                                                                                              SetClientStore sets the client store to use.

                                                                                                                                                              func (*OptionalControllerCommand) SetFlags

                                                                                                                                                              func (c *OptionalControllerCommand) SetFlags(f *gnuflag.FlagSet)

                                                                                                                                                                SetFlags initializes the flags supported by the command.

                                                                                                                                                                type QualifyingClientStore

                                                                                                                                                                type QualifyingClientStore struct {
                                                                                                                                                                	jujuclient.ClientStore
                                                                                                                                                                }

                                                                                                                                                                  QualifyingClientStore wraps a jujuclient.ClientStore, modifying model-related methods such that they accept unqualified model names, and automatically qualify them with the logged-in user name as necessary.

                                                                                                                                                                  func (QualifyingClientStore) ModelByName

                                                                                                                                                                  func (s QualifyingClientStore) ModelByName(controllerName, modelName string) (*jujuclient.ModelDetails, error)

                                                                                                                                                                    Implements jujuclient.ModelGetter.

                                                                                                                                                                    func (QualifyingClientStore) QualifiedModelName

                                                                                                                                                                    func (s QualifyingClientStore) QualifiedModelName(controllerName, modelName string) (string, error)

                                                                                                                                                                      QualifiedModelName returns a Qualified model name, given either an unqualified or qualified model name. If the input is a fully qualified name, it is returned untouched; otherwise it is return qualified with the logged-in user name.

                                                                                                                                                                      func (QualifyingClientStore) RemoveModel

                                                                                                                                                                      func (s QualifyingClientStore) RemoveModel(controllerName, modelName string) error

                                                                                                                                                                        Implements jujuclient.ModelRemover.

                                                                                                                                                                        func (QualifyingClientStore) SetCurrentModel

                                                                                                                                                                        func (s QualifyingClientStore) SetCurrentModel(controllerName, modelName string) error

                                                                                                                                                                          Implements jujuclient.ModelUpdater.

                                                                                                                                                                          func (QualifyingClientStore) SetModels

                                                                                                                                                                          func (s QualifyingClientStore) SetModels(controllerName string, models map[string]jujuclient.ModelDetails) error

                                                                                                                                                                            Implements jujuclient.ModelUpdater.

                                                                                                                                                                            func (QualifyingClientStore) UpdateModel

                                                                                                                                                                            func (s QualifyingClientStore) UpdateModel(controllerName, modelName string, details jujuclient.ModelDetails) error

                                                                                                                                                                              Implements jujuclient.ModelUpdater.

                                                                                                                                                                              type ReadSeekCloser

                                                                                                                                                                              type ReadSeekCloser interface {
                                                                                                                                                                              	io.ReadCloser
                                                                                                                                                                              	io.Seeker
                                                                                                                                                                              }

                                                                                                                                                                                ReadSeekCloser is a minimal interface used for os.File.

                                                                                                                                                                                type RegisterCredentialsParams

                                                                                                                                                                                type RegisterCredentialsParams struct {
                                                                                                                                                                                	// Cloud is the cloud definition.
                                                                                                                                                                                	Cloud cloud.Cloud
                                                                                                                                                                                }

                                                                                                                                                                                  RegisterCredentialsParams contains parameters for the RegisterCredentials function.

                                                                                                                                                                                  type TestCloudProvider

                                                                                                                                                                                  type TestCloudProvider interface {
                                                                                                                                                                                  	environs.EnvironProvider
                                                                                                                                                                                  	environs.ProviderCredentialsRegister
                                                                                                                                                                                  }

                                                                                                                                                                                    TestCloudProvider is used for testing.

                                                                                                                                                                                    type WrapControllerOption

                                                                                                                                                                                    type WrapControllerOption func(*controllerCommandWrapper)

                                                                                                                                                                                      WrapControllerOption specifies an option to the WrapController function.

                                                                                                                                                                                      var (
                                                                                                                                                                                      	// WrapControllerSkipControllerFlags specifies that the -c
                                                                                                                                                                                      	// and --controller flag flags should not be defined.
                                                                                                                                                                                      	WrapControllerSkipControllerFlags WrapControllerOption = wrapControllerSkipControllerFlags
                                                                                                                                                                                      
                                                                                                                                                                                      	// WrapSkipDefaultModel specifies that no default controller should
                                                                                                                                                                                      	// be used.
                                                                                                                                                                                      	WrapControllerSkipDefaultController WrapControllerOption = wrapControllerSkipDefaultController
                                                                                                                                                                                      )

                                                                                                                                                                                        Options for the WrapController call.

                                                                                                                                                                                        type WrapOption

                                                                                                                                                                                        type WrapOption func(*modelCommandWrapper)

                                                                                                                                                                                          WrapOption specifies an option to the Wrap function.

                                                                                                                                                                                          var (
                                                                                                                                                                                          	// WrapSkipModelFlags specifies that the -m and --model flags
                                                                                                                                                                                          	// should not be defined.
                                                                                                                                                                                          	WrapSkipModelFlags WrapOption = wrapSkipModelFlags
                                                                                                                                                                                          
                                                                                                                                                                                          	// WrapSkipModelInit specifies that then initial model won't be initialised,
                                                                                                                                                                                          	// but later requests to the model should work.
                                                                                                                                                                                          	WrapSkipModelInit WrapOption = wrapSkipModelInit
                                                                                                                                                                                          
                                                                                                                                                                                          	// WrapSkipDefaultModel specifies that no default model should
                                                                                                                                                                                          	// be used.
                                                                                                                                                                                          	WrapSkipDefaultModel WrapOption = wrapSkipDefaultModel
                                                                                                                                                                                          )

                                                                                                                                                                                            Options for the Wrap function.