Documentation ¶
Overview ¶
Copyright 2016 Canonical Ltd. Licensed under the AGPLv3, see LICENCE file for details.
Index ¶
- func IsMachineOrNewContainer(spec string) bool
- func NewAddRelationCommand() cmd.Command
- func NewAddUnitCommand() cmd.Command
- func NewApplicationGetConstraintsCommand() modelcmd.ModelCommand
- func NewApplicationSetConstraintsCommand() modelcmd.ModelCommand
- func NewBundleDiffCommand() cmd.Command
- func NewConfigCommand() cmd.Command
- func NewConfigCommandForTest(api applicationAPI, store jujuclient.ClientStore) modelcmd.ModelCommand
- func NewConsumeCommand() cmd.Command
- func NewDeployCommand() modelcmd.ModelCommand
- func NewDeployCommandForTest(newAPIRoot func() (DeployAPI, error), steps []DeployStep) modelcmd.ModelCommand
- func NewExposeCommand() modelcmd.ModelCommand
- func NewRemoveApplicationCommand() cmd.Command
- func NewRemoveRelationCommand() cmd.Command
- func NewRemoveSaasCommand() cmd.Command
- func NewRemoveUnitCommand() modelcmd.ModelCommand
- func NewResolvedCommand() cmd.Command
- func NewResumeRelationCommand() cmd.Command
- func NewScaleApplicationCommand() modelcmd.ModelCommand
- func NewSetSeriesCommand() cmd.Command
- func NewShowApplicationCommand() cmd.Command
- func NewSuspendRelationCommand() cmd.Command
- func NewTrustCommand() cmd.Command
- func NewUnexposeCommand() modelcmd.ModelCommand
- func NewUpgradeCharmCommand() cmd.Command
- type ApplicationAPI
- type ApplicationDestroyRelationAPI
- type ApplicationInfo
- type ApplicationsInfoAPI
- type BundleResolver
- type CharmAPIClient
- type CharmAdder
- type CharmClient
- type CharmDeployAPI
- type CharmUpgradeClient
- type DeployAPI
- type DeployCommand
- type DeployStep
- type DeployStepAPI
- type DeploymentInfo
- type MeteredDeployAPI
- type ModelAPI
- type ModelConfigGetter
- type ModelExtractor
- type NewCharmAdderFunc
- type RegisterMeteredCharm
- func (r *RegisterMeteredCharm) RunPost(api DeployStepAPI, bakeryClient *httpbakery.Client, ctx *cmd.Context, ...) error
- func (r *RegisterMeteredCharm) RunPre(api DeployStepAPI, bakeryClient *httpbakery.Client, ctx *cmd.Context, ...) error
- func (r *RegisterMeteredCharm) SetFlags(f *gnuflag.FlagSet)
- func (r *RegisterMeteredCharm) SetPlanURL(planURL string)
- type RemoveSaasAPI
- type ResolveCharmFunc
- type ResourceLister
- type SeriesConfig
- type SetRelationSuspendedAPI
- type URLResolver
- type UnitCommandBase
- type ValidateLXDProfileCharm
- func (r *ValidateLXDProfileCharm) RunPost(api DeployStepAPI, bakeryClient *httpbakery.Client, ctx *cmd.Context, ...) error
- func (r *ValidateLXDProfileCharm) RunPre(api DeployStepAPI, bakeryClient *httpbakery.Client, ctx *cmd.Context, ...) error
- func (r *ValidateLXDProfileCharm) SetFlags(f *gnuflag.FlagSet)
- func (r *ValidateLXDProfileCharm) SetPlanURL(planURL string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsMachineOrNewContainer ¶
IsMachineOrNewContainer returns whether spec is a valid machine id or new container definition.
func NewAddRelationCommand ¶
NewAddRelationCommand returns a command to add a relation between 2 applications.
func NewAddUnitCommand ¶
NewAddUnitCommand returns a command that adds a unit[s] to an application.
func NewApplicationGetConstraintsCommand ¶
func NewApplicationGetConstraintsCommand() modelcmd.ModelCommand
NewApplicationGetConstraintsCommand returns a command which gets application constraints.
func NewApplicationSetConstraintsCommand ¶
func NewApplicationSetConstraintsCommand() modelcmd.ModelCommand
NewApplicationSetConstraintsCommand returns a command which sets application constraints.
func NewBundleDiffCommand ¶
NewBundleDiffCommand returns a command to compare a bundle against the selected model.
func NewConfigCommand ¶
NewConfigCommand returns a command used to get, reset, and set application charm attributes.
func NewConfigCommandForTest ¶
func NewConfigCommandForTest(api applicationAPI, store jujuclient.ClientStore) modelcmd.ModelCommand
NewConfigCommandForTest returns a SetCommand with the api provided as specified.
func NewConsumeCommand ¶
NewConsumeCommand returns a command to add remote offers to the model.
func NewDeployCommand ¶
func NewDeployCommand() modelcmd.ModelCommand
NewDeployCommand returns a command to deploy applications.
func NewDeployCommandForTest ¶
func NewDeployCommandForTest(newAPIRoot func() (DeployAPI, error), steps []DeployStep) modelcmd.ModelCommand
NewDeployCommandForTest returns a command to deploy applications intended to be used only in tests.
func NewExposeCommand ¶
func NewExposeCommand() modelcmd.ModelCommand
NewExposeCommand returns a command to expose applications.
func NewRemoveApplicationCommand ¶
NewRemoveApplicationCommand returns a command which removes an application.
func NewRemoveRelationCommand ¶
NewRemoveRelationCommand returns a command to remove a relation between 2 applications.
func NewRemoveSaasCommand ¶
NewRemoveSaasCommand returns a command which removes a consumed application.
func NewRemoveUnitCommand ¶
func NewRemoveUnitCommand() modelcmd.ModelCommand
NewRemoveUnitCommand returns a command which removes an application's units.
func NewResolvedCommand ¶
func NewResumeRelationCommand ¶
NewResumeRelationCommand returns a command to resume a relation.
func NewScaleApplicationCommand ¶
func NewScaleApplicationCommand() modelcmd.ModelCommand
NewScaleApplicationCommand returns a command which scales an application's units.
func NewSetSeriesCommand ¶
NewSetSeriesCommand returns a command which updates the series of an application.
func NewShowApplicationCommand ¶
NewShowApplicationCommand returns a command that displays applications info.
func NewSuspendRelationCommand ¶
NewSuspendRelationCommand returns a command to suspend a relation.
func NewTrustCommand ¶
func NewUnexposeCommand ¶
func NewUnexposeCommand() modelcmd.ModelCommand
NewUnexposeCommand returns a command to unexpose applications.
func NewUpgradeCharmCommand ¶
NewUpgradeCharmCommand returns a command which upgrades application's charm.
Types ¶
type ApplicationAPI ¶
type ApplicationAPI interface { AddMachines(machineParams []apiparams.AddMachineParams) ([]apiparams.AddMachinesResult, error) AddRelation(endpoints, viaCIDRs []string) (*apiparams.AddRelationResults, error) AddUnits(application.AddUnitsParams) ([]string, error) Expose(application string) error GetAnnotations(tags []string) ([]apiparams.AnnotationsGetResult, error) GetConfig(generation model.GenerationVersion, appNames ...string) ([]map[string]interface{}, error) GetConstraints(appNames ...string) ([]constraints.Value, error) SetAnnotation(annotations map[string]map[string]string) ([]apiparams.ErrorResult, error) SetCharm(model.GenerationVersion, application.SetCharmConfig) error SetConstraints(application string, constraints constraints.Value) error Update(apiparams.ApplicationUpdate) error ScaleApplication(application.ScaleApplicationParams) (apiparams.ScaleApplicationResult, error) }
type ApplicationDestroyRelationAPI ¶
type ApplicationDestroyRelationAPI interface { Close() error BestAPIVersion() int DestroyRelation(endpoints ...string) error DestroyRelationId(relationId int) error }
ApplicationDestroyRelationAPI defines the API methods that application remove relation command uses.
type ApplicationInfo ¶
type ApplicationInfo struct { Charm string `yaml:"charm,omitempty" json:"charm,omitempty"` Series string `yaml:"series,omitempty" json:"series,omitempty"` Channel string `yaml:"channel,omitempty" json:"channel,omitempty"` Constraints constraints.Value `yaml:"constraints,omitempty" json:"constraints,omitempty"` Principal bool `yaml:"principal" json:"principal"` Exposed bool `yaml:"exposed" json:"exposed"` Remote bool `yaml:"remote" json:"remote"` EndpointBindings map[string]string `yaml:"endpoint-bindings,omitempty" json:"endpoint-bindings,omitempty"` }
ApplicationInfo defines the serialization behaviour of the application information.
type ApplicationsInfoAPI ¶
type ApplicationsInfoAPI interface { Close() error BestAPIVersion() int ApplicationsInfo([]names.ApplicationTag) ([]params.ApplicationInfoResult, error) }
ApplicationsInfoAPI defines the API methods that show-application command uses.
type BundleResolver ¶
type BundleResolver interface { URLResolver GetBundle(*charm.URL) (charm.Bundle, error) }
BundleResolver defines what we need from a charm store to resolve a bundle and read the bundle data.
type CharmAPIClient ¶
type CharmAPIClient interface { CharmUpgradeClient }
CharmAPIClient defines a subset of the application facade that deals with charm related upgrades.
type CharmAdder ¶
type CharmClient ¶
CharmClient defines a subset of the charms facade, as required by the upgrade-charm command.
type CharmDeployAPI ¶
CharmDeployAPI represents the methods of the API the deploy command needs for charms.
type CharmUpgradeClient ¶
type CharmUpgradeClient interface { GetCharmURL(model.GenerationVersion, string) (*charm.URL, error) Get(model.GenerationVersion, string) (*params.ApplicationGetResults, error) SetCharm(model.GenerationVersion, 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 CharmDeployAPI ApplicationAPI ModelAPI // ApplicationClient Deploy(application.DeployArgs) error Status(patterns []string) (*apiparams.FullStatus, error) ResolveWithChannel(*charm.URL) (*charm.URL, params.Channel, []string, error) GetBundle(*charm.URL) (charm.Bundle, error) WatchAll() (*api.AllWatcher, error) // PlanURL returns the configured URL prefix for the metering plan API. PlanURL() string }
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 // BundleOverlay refers to config files that specify additional bundle // configuration to be merged with the main bundle. BundleOverlayFile []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 // DryRun is used to specify that the bundle shouldn't actually be // deployed but just output the changes. DryRun bool ApplicationName string ConfigOptions common.ConfigFlag 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 // Devices is a mapping of device constraints, keyed on the device name // defined in charm devices metadata. Devices map[string]devices.Constraints // BundleDevices maps application names to maps of device constraints keyed on // the device name defined in that application's charm devices metadata. BundleDevices map[string]map[string]devices.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 // UseExisting machines when deploying the bundle. UseExisting bool // BundleMachines is a mapping for machines in the bundle to machines // in the model. BundleMachines map[string]string // NewAPIRoot stores a function which returns a new API root. NewAPIRoot func() (DeployAPI, error) // Trust signifies that the charm should be deployed with access to // trusted credentials. That is, hooks run by the charm can access // cloud credentials and other trusted access credentials. Trust bool // 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) SetFlags ¶
func (c *DeployCommand) SetFlags(f *gnuflag.FlagSet)
type DeployStep ¶
type DeployStep interface { // SetFlags sets flags necessary for the deploy step. SetFlags(*gnuflag.FlagSet) // SetPlanURL sets the plan URL prefix. SetPlanURL(planURL string) // RunPre runs before the call is made to add the charm to the environment. RunPre(DeployStepAPI, *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(DeployStepAPI, *httpbakery.Client, *cmd.Context, DeploymentInfo, error) error }
DeployStep is an action that needs to be taken during charm deployment.
type DeployStepAPI ¶
type DeployStepAPI interface { MeteredDeployAPI }
DeployStepAPI represents a API required for deploying using the step deployment code.
type DeploymentInfo ¶
type DeploymentInfo struct { CharmID charmstore.CharmID ApplicationName string ModelUUID string CharmInfo *apicharms.CharmInfo ApplicationPlan string Force bool }
DeploymentInfo is used to maintain all deployment information for deployment steps.
type MeteredDeployAPI ¶
type MeteredDeployAPI interface { IsMetered(charmURL string) (bool, error) SetMetricCredentials(application string, credentials []byte) error }
MeteredDeployAPI represents the methods of the API the deploy command needs for metered charms.
type ModelConfigGetter ¶
type ModelExtractor ¶
type ModelExtractor interface { GetAnnotations(tags []string) ([]params.AnnotationsGetResult, error) GetConstraints(applications ...string) ([]constraints.Value, error) GetConfig(generation model.GenerationVersion, applications ...string) ([]map[string]interface{}, error) Sequences() (map[string]int, error) }
ModelExtractor provides everything we need to build a bundlechanges.Model from a model API connection.
type NewCharmAdderFunc ¶
type NewCharmAdderFunc func( api.Connection, *httpbakery.Client, string, csclientparams.Channel, ) CharmAdder
NewCharmAdderFunc is the type of a function used to construct a new CharmAdder.
type RegisterMeteredCharm ¶
type RegisterMeteredCharm struct { Plan string IncreaseBudget int RegisterPath string QueryPath string PlanURL string // contains filtered or unexported fields }
RegisterMeteredCharm implements the DeployStep interface.
func (*RegisterMeteredCharm) RunPost ¶
func (r *RegisterMeteredCharm) RunPost(api DeployStepAPI, 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 DeployStepAPI, 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)
SetFlags implements DeployStep.
func (*RegisterMeteredCharm) SetPlanURL ¶
func (r *RegisterMeteredCharm) SetPlanURL(planURL string)
SetPlanURL implements DeployStep.
type RemoveSaasAPI ¶
type RemoveSaasAPI interface { Close() error BestAPIVersion() int DestroyConsumedApplication(...string) ([]params.ErrorResult, error) }
RemoveSaasAPI defines the API methods that the remove-saas command uses.
type ResolveCharmFunc ¶
type ResolveCharmFunc func( resolveWithChannel func(*charm.URL) (*charm.URL, csparams.Channel, []string, error), 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.ApplicationResources, error)
}
ResourceLister defines a subset of the resources facade, as required by the upgrade-charm command.
type SeriesConfig ¶
type SeriesConfig interface { // DefaultSeries returns the configured default Ubuntu series for the environment, // and whether the default series was explicitly configured on the environment. DefaultSeries() (string, bool) }
SeriesConfig defines the single config method that we need to resolve changes.
type SetRelationSuspendedAPI ¶
type SetRelationSuspendedAPI interface { Close() error BestAPIVersion() int SetRelationSuspended(relationIds []int, suspended bool, message string) error }
SetRelationSuspendedAPI defines the API methods that the suspend/resume relation commands use.
type URLResolver ¶
type URLResolver interface {
ResolveWithChannel(*charm.URL) (*charm.URL, params.Channel, []string, error)
}
URLResolver is the part of charmrepo.Charmstore that we need to resolve a charm url.
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 // AttachStorage is a list of storage IDs, identifying storage to // attach to the unit created by deploy. AttachStorage []string }
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)
type ValidateLXDProfileCharm ¶
type ValidateLXDProfileCharm struct{}
ValidateLXDProfileCharm implements the DeployStep interface.
func (*ValidateLXDProfileCharm) RunPost ¶
func (r *ValidateLXDProfileCharm) RunPost(api DeployStepAPI, bakeryClient *httpbakery.Client, ctx *cmd.Context, deployInfo DeploymentInfo, prevErr error) error
RunPost sends credentials obtained during the call to RunPre to the controller.
func (*ValidateLXDProfileCharm) RunPre ¶
func (r *ValidateLXDProfileCharm) RunPre(api DeployStepAPI, 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 (*ValidateLXDProfileCharm) SetFlags ¶
func (r *ValidateLXDProfileCharm) SetFlags(f *gnuflag.FlagSet)
SetFlags implements DeployStep.
func (*ValidateLXDProfileCharm) SetPlanURL ¶
func (r *ValidateLXDProfileCharm) SetPlanURL(planURL string)
SetPlanURL implements DeployStep.
Source Files ¶
- addrelation.go
- addunit.go
- application.go
- bundle.go
- bundlediff.go
- config.go
- constraints.go
- consume.go
- deploy.go
- expose.go
- flags.go
- register.go
- removeapplication.go
- removerelation.go
- removesaas.go
- removeunit.go
- resolved.go
- resumerelation.go
- scaleapplication.go
- series_selector.go
- setseries.go
- show.go
- store.go
- suspendrelation.go
- trust.go
- unexpose.go
- upgradecharm.go
- validate.go