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 NewConfigCommand() cmd.Command
- func NewConsumeCommand() cmd.Command
- func NewDefaultDeployCommand() cmd.Command
- func NewDeployCommand(newAPIRoot NewAPIRootFn, steps []DeployStep) cmd.Command
- func NewDeployCommandWithDefaultAPI(steps []DeployStep) cmd.Command
- func NewExposeCommand() cmd.Command
- func NewRemoveApplicationCommand() cmd.Command
- func NewRemoveRelationCommand() cmd.Command
- func NewRemoveUnitCommand() cmd.Command
- func NewServiceGetConstraintsCommand() cmd.Command
- func NewServiceSetConstraintsCommand() cmd.Command
- func NewUnexposeCommand() cmd.Command
- func NewUpgradeCharmCommand() cmd.Command
- type ApplicationAPI
- type ApplicationAddRelationAPI
- type ApplicationDestroyRelationAPI
- type CharmAdder
- type CharmClient
- type CharmUpgradeClient
- type DeployAPI
- type DeployCommand
- type DeployStep
- type DeploymentInfo
- type MeteredDeployAPI
- type ModelAPI
- type ModelConfigGetter
- type NewAPIRootFn
- type NewCharmAdderFunc
- type RegisterMeteredCharm
- func (r *RegisterMeteredCharm) RunPost(api MeteredDeployAPI, bakeryClient *httpbakery.Client, ctx *cmd.Context, ...) error
- func (r *RegisterMeteredCharm) RunPre(api MeteredDeployAPI, bakeryClient *httpbakery.Client, ctx *cmd.Context, ...) error
- func (r *RegisterMeteredCharm) SetFlags(f *gnuflag.FlagSet)
- type ResolveCharmFunc
- type ResourceLister
- type UnitCommandBase
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 services.
func NewAddUnitCommand ¶
NewAddUnitCommand returns a command that adds a unit[s] to an application.
func NewConfigCommand ¶
NewConfigCommand returns a command used to get, reset, and set application attributes.
func NewConsumeCommand ¶
NewConsumeCommand returns a command to add remote applications to the model.
func NewDefaultDeployCommand ¶
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 ¶
NewExposeCommand returns a command to expose services.
func NewRemoveApplicationCommand ¶
NewRemoveApplicationCommand returns a command which removes an application.
func NewRemoveRelationCommand ¶
NewRemoveRelationCommand returns a command to remove a relation between 2 services.
func NewRemoveUnitCommand ¶
NewRemoveUnitCommand returns a command which removes an application's units.
func NewServiceGetConstraintsCommand ¶
NewServiceGetConstraintsCommand returns a command which gets application constraints.
func NewServiceSetConstraintsCommand ¶
NewServiceSetConstraintsCommand returns a command which sets application constraints.
func NewUnexposeCommand ¶
NewUnexposeCommand returns a command to unexpose services.
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 ...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
// CHECK
BestAPIVersion() int
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 CharmClient ¶
CharmClient defines a subset of the charms facade, as required by the upgrade-charm command.
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) 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 ModelConfigGetter ¶
type NewAPIRootFn ¶
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 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)