service

package
Version: v0.0.0-...-2608902 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2016 License: AGPL-3.0 Imports: 47 Imported by: 0

Documentation

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 a service.

func NewDeployCommand

func NewDeployCommand() cmd.Command

NewDeployCommand returns a command to deploy services.

func NewExposeCommand

func NewExposeCommand() cmd.Command

NewExposeCommand returns a command to expose services.

func NewGetCommand

func NewGetCommand() cmd.Command

NewGetCommand returns a command used to get service attributes.

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 a service.

func NewRemoveUnitCommand

func NewRemoveUnitCommand() cmd.Command

NewRemoveUnitCommand returns a command which removes a service's units.

func NewServiceGetConstraintsCommand

func NewServiceGetConstraintsCommand() cmd.Command

NewServiceGetConstraintsCommand returns a command which gets service constraints.

func NewServiceSetConstraintsCommand

func NewServiceSetConstraintsCommand() cmd.Command

NewServiceSetConstraintsCommand returns a command which sets service constraints.

func NewSetCommand

func NewSetCommand() cmd.Command

NewSetCommand returns a command used to set service attributes.

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 service's charm.

Types

type APICmd

type APICmd interface {
	NewAPIRoot() (api.Connection, error)
}

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 csclientparams.Channel

	Series string

	// Force is used to allow a charm to be deployed onto a machine
	// running an unsupported series.
	Force bool

	ServiceName  string
	Config       cmd.FileVar
	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 service names to maps of storage constraints keyed on
	// the storage name defined in that service'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
	// 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(api.Connection, *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(api.Connection, *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
	ServiceName string
	ModelUUID   string
}

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

type ModelConfigGetter

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

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(state api.Connection, 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(state api.Connection, 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 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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL