Documentation

Overview

    Copyright 2016 Canonical Ltd. Licensed under the AGPLv3, see LICENCE file for details.

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func IsMachineOrNewContainer

    func IsMachineOrNewContainer(spec string) bool

      IsMachineOrNewContainer returns whether spec is a valid machine id or new container definition.

      func NewAddRelationCommand

      func NewAddRelationCommand() cmd.Command

        NewAddRelationCommand returns a command to add a relation between 2 services.

        func NewAddUnitCommand

        func NewAddUnitCommand() cmd.Command

          NewAddUnitCommand returns a command that adds a unit[s] to an application.

          func NewConfigCommand

          func NewConfigCommand() cmd.Command

            NewConfigCommand returns a command used to get, reset, and set application attributes.

            func NewDefaultDeployCommand

            func NewDefaultDeployCommand() cmd.Command

            func NewDeployCommand

            func NewDeployCommand(newAPIRoot NewAPIRootFn, steps []DeployStep) cmd.Command

              NewDeployCommand returns a command to deploy services.

              func NewDeployCommandWithDefaultAPI

              func NewDeployCommandWithDefaultAPI(steps []DeployStep) cmd.Command

              func NewExposeCommand

              func NewExposeCommand() cmd.Command

                NewExposeCommand returns a command to expose services.

                func NewRemoveRelationCommand

                func NewRemoveRelationCommand() cmd.Command

                  NewRemoveRelationCommand returns a command to remove a relation between 2 services.

                  func NewRemoveServiceCommand

                  func NewRemoveServiceCommand() cmd.Command

                    NewRemoveServiceCommand returns a command which removes an application.

                    func NewRemoveUnitCommand

                    func NewRemoveUnitCommand() cmd.Command

                      NewRemoveUnitCommand returns a command which removes an application's units.

                      func NewServiceGetConstraintsCommand

                      func NewServiceGetConstraintsCommand() cmd.Command

                        NewServiceGetConstraintsCommand returns a command which gets application constraints.

                        func NewServiceSetConstraintsCommand

                        func NewServiceSetConstraintsCommand() cmd.Command

                          NewServiceSetConstraintsCommand returns a command which sets application constraints.

                          func NewUnexposeCommand

                          func NewUnexposeCommand() cmd.Command

                            NewUnexposeCommand returns a command to unexpose services.

                            func NewUpgradeCharmCommand

                            func NewUpgradeCharmCommand() cmd.Command

                              NewUpgradeCharmCommand returns a command which upgrades application's charm.

                              Types

                              type ApplicationAPI

                              type ApplicationAPI interface {
                              	AddMachines(machineParams []apiparams.AddMachineParams) ([]apiparams.AddMachinesResult, error)
                              	AddRelation(endpoints ...string) (*apiparams.AddRelationResults, error)
                              	AddUnits(application string, numUnits int, placement []*instance.Placement) ([]string, error)
                              	Expose(application string) error
                              	GetCharmURL(serviceName string) (*charm.URL, error)
                              	SetAnnotation(annotations map[string]map[string]string) ([]apiparams.ErrorResult, error)
                              	SetCharm(application.SetCharmConfig) error
                              	SetConstraints(application string, constraints constraints.Value) error
                              	Update(apiparams.ApplicationUpdate) error
                              }

                              type ApplicationAddRelationAPI

                              type ApplicationAddRelationAPI interface {
                              	Close() error
                              	AddRelation(endpoints ...string) (*params.AddRelationResults, error)
                              }

                                ApplicationAddRelationAPI defines the API methods that application add relation command uses.

                                type ApplicationDestroyRelationAPI

                                type ApplicationDestroyRelationAPI interface {
                                	Close() error
                                	DestroyRelation(endpoints ...string) error
                                }

                                  ApplicationDestroyRelationAPI defines the API methods that application remove relation command uses.

                                  type CharmAdder

                                  type CharmAdder interface {
                                  	AddLocalCharm(*charm.URL, charm.Charm) (*charm.URL, error)
                                  	AddCharm(*charm.URL, params.Channel) error
                                  	AddCharmWithAuthorization(*charm.URL, params.Channel, *macaroon.Macaroon) error
                                  	AuthorizeCharmstoreEntity(*charm.URL) (*macaroon.Macaroon, error)
                                  }

                                  type CharmClient

                                  type CharmClient interface {
                                  	CharmInfo(string) (*charms.CharmInfo, error)
                                  }

                                    CharmClient defines a subset of the charms facade, as required by the upgrade-charm command.

                                    type CharmRepository

                                    type CharmRepository interface {
                                    	Get(curl *charm.URL) (charm.Charm, error)
                                    	GetBundle(curl *charm.URL) (charm.Bundle, error)
                                    	Resolve(*charm.URL) (canonRef *charm.URL, supportedSeries []string, _ error)
                                    }

                                    type CharmUpgradeClient

                                    type CharmUpgradeClient interface {
                                    	GetCharmURL(string) (*charm.URL, error)
                                    	SetCharm(application.SetCharmConfig) error
                                    }

                                      CharmUpgradeClient defines a subset of the application facade, as required by the upgrade-charm command.

                                      type DeployAPI

                                      type DeployAPI interface {
                                      	// TODO(katco): Pair DeployAPI down to only the methods required
                                      	// by the deploy command.
                                      	api.Connection
                                      	CharmAdder
                                      	MeteredDeployAPI
                                      	ApplicationAPI
                                      	ModelAPI
                                      
                                      	// ApplicationClient
                                      	CharmInfo(string) (*apicharms.CharmInfo, error)
                                      	Deploy(application.DeployArgs) error
                                      	Status(patterns []string) (*apiparams.FullStatus, error)
                                      
                                      	Resolve(*config.Config, *charm.URL) (*charm.URL, params.Channel, []string, error)
                                      
                                      	GetBundle(*charm.URL) (charm.Bundle, error)
                                      
                                      	WatchAll() (*api.AllWatcher, error)
                                      }

                                        DeployAPI represents the methods of the API the deploy command needs.

                                        type DeployCommand

                                        type DeployCommand struct {
                                        	modelcmd.ModelCommandBase
                                        	UnitCommandBase
                                        
                                        	// CharmOrBundle is either a charm URL, a path where a charm can be found,
                                        	// or a bundle name.
                                        	CharmOrBundle string
                                        
                                        	// Channel holds the charmstore channel to use when obtaining
                                        	// the charm to be deployed.
                                        	Channel params.Channel
                                        
                                        	// Series is the series of the charm to deploy.
                                        	Series string
                                        
                                        	// Force is used to allow a charm to be deployed onto a machine
                                        	// running an unsupported series.
                                        	Force bool
                                        
                                        	ApplicationName string
                                        	Config          cmd.FileVar
                                        	ConstraintsStr  string
                                        	Constraints     constraints.Value
                                        	BindToSpaces    string
                                        
                                        	// TODO(axw) move this to UnitCommandBase once we support --storage
                                        	// on add-unit too.
                                        	//
                                        	// Storage is a map of storage constraints, keyed on the storage name
                                        	// defined in charm storage metadata.
                                        	Storage map[string]storage.Constraints
                                        
                                        	// BundleStorage maps application names to maps of storage constraints keyed on
                                        	// the storage name defined in that application's charm storage metadata.
                                        	BundleStorage map[string]map[string]storage.Constraints
                                        
                                        	// Resources is a map of resource name to filename to be uploaded on deploy.
                                        	Resources map[string]string
                                        
                                        	Bindings map[string]string
                                        	Steps    []DeployStep
                                        
                                        	// NewAPIRoot stores a function which returns a new API root.
                                        	NewAPIRoot NewAPIRootFn
                                        	// contains filtered or unexported fields
                                        }

                                        func (*DeployCommand) Info

                                        func (c *DeployCommand) Info() *cmd.Info

                                        func (*DeployCommand) Init

                                        func (c *DeployCommand) Init(args []string) error

                                        func (*DeployCommand) Run

                                        func (c *DeployCommand) Run(ctx *cmd.Context) error

                                        func (*DeployCommand) SetFlags

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

                                        type DeployStep

                                        type DeployStep interface {
                                        
                                        	// Set flags necessary for the deploy step.
                                        	SetFlags(*gnuflag.FlagSet)
                                        
                                        	// RunPre runs before the call is made to add the charm to the environment.
                                        	RunPre(MeteredDeployAPI, *httpbakery.Client, *cmd.Context, DeploymentInfo) error
                                        
                                        	// RunPost runs after the call is made to add the charm to the environment.
                                        	// The error parameter is used to notify the step of a previously occurred error.
                                        	RunPost(MeteredDeployAPI, *httpbakery.Client, *cmd.Context, DeploymentInfo, error) error
                                        }

                                          DeployStep is an action that needs to be taken during charm deployment.

                                          type DeploymentInfo

                                          type DeploymentInfo struct {
                                          	CharmID         charmstore.CharmID
                                          	ApplicationName string
                                          	ModelUUID       string
                                          	CharmInfo       *apicharms.CharmInfo
                                          }

                                            DeploymentInfo is used to maintain all deployment information for deployment steps.

                                            type MeteredDeployAPI

                                            type MeteredDeployAPI interface {
                                            	IsMetered(charmURL string) (bool, error)
                                            	SetMetricCredentials(service string, credentials []byte) error
                                            }

                                              MeteredDeployAPI represents the methods of the API the deploy command needs for metered charms.

                                              type ModelAPI

                                              type ModelAPI interface {
                                              	ModelUUID() (string, bool)
                                              	ModelGet() (map[string]interface{}, error)
                                              }

                                              type ModelConfigGetter

                                              type ModelConfigGetter interface {
                                              	ModelGet() (map[string]interface{}, error)
                                              }

                                              type NewAPIRootFn

                                              type NewAPIRootFn func() (DeployAPI, error)

                                              type NewCharmAdderFunc

                                              type NewCharmAdderFunc func(
                                              	api.Connection,
                                              	*httpbakery.Client,
                                              	csclientparams.Channel,
                                              ) CharmAdder

                                                NewCharmAdderFunc is the type of a function used to construct a new CharmAdder.

                                                type RegisterMeteredCharm

                                                type RegisterMeteredCharm struct {
                                                	AllocationSpec string
                                                	Plan           string
                                                	RegisterURL    string
                                                	QueryURL       string
                                                	// contains filtered or unexported fields
                                                }

                                                  RegisterMeteredCharm implements the DeployStep interface.

                                                  func (*RegisterMeteredCharm) RunPost

                                                  func (r *RegisterMeteredCharm) RunPost(api MeteredDeployAPI, bakeryClient *httpbakery.Client, ctx *cmd.Context, deployInfo DeploymentInfo, prevErr error) error

                                                    RunPost sends credentials obtained during the call to RunPre to the controller.

                                                    func (*RegisterMeteredCharm) RunPre

                                                    func (r *RegisterMeteredCharm) RunPre(api MeteredDeployAPI, bakeryClient *httpbakery.Client, ctx *cmd.Context, deployInfo DeploymentInfo) error

                                                      RunPre obtains authorization to deploy this charm. The authorization, if received is not sent to the controller, rather it is kept as an attribute on RegisterMeteredCharm.

                                                      func (*RegisterMeteredCharm) SetFlags

                                                      func (r *RegisterMeteredCharm) SetFlags(f *gnuflag.FlagSet)

                                                      type ResolveCharmFunc

                                                      type ResolveCharmFunc func(
                                                      	resolveWithChannel func(*charm.URL) (*charm.URL, csparams.Channel, []string, error),
                                                      	conf *config.Config,
                                                      	url *charm.URL,
                                                      ) (*charm.URL, csparams.Channel, []string, error)

                                                        ResolveCharmFunc is the type of a function that resolves a charm URL.

                                                        type ResourceLister

                                                        type ResourceLister interface {
                                                        	ListResources([]string) ([]resource.ServiceResources, error)
                                                        }

                                                          ResourceLister defines a subset of the resources facade, as required by the upgrade-charm command.

                                                          type ServiceAPI

                                                          type ServiceAPI interface {
                                                          	Close() error
                                                          	Destroy(serviceName string) error
                                                          	DestroyUnits(unitNames ...string) error
                                                          	GetCharmURL(serviceName string) (*charm.URL, error)
                                                          	ModelUUID() string
                                                          }

                                                          type UnitCommandBase

                                                          type UnitCommandBase struct {
                                                          	// PlacementSpec is the raw string command arg value used to specify placement directives.
                                                          	PlacementSpec string
                                                          	// Placement is the result of parsing the PlacementSpec arg value.
                                                          	Placement []*instance.Placement
                                                          	NumUnits  int
                                                          }

                                                            UnitCommandBase provides support for commands which deploy units. It handles the parsing and validation of --to and --num-units arguments.

                                                            func (*UnitCommandBase) Init

                                                            func (c *UnitCommandBase) Init(args []string) error

                                                            func (*UnitCommandBase) SetFlags

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