Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetClientConfig = func(client ServiceAddUnitAPI) (*config.Config, error) {

	attrs, err := client.EnvironmentGet()
	if err != nil {
		return nil, err
	}

	return config.New(config.NoDefaults, attrs)
}

TODO(cherylj) Unexport GetClientConfig and make it a standard function once deploy is moved under service

Functions

func IsMachineOrNewContainer

func IsMachineOrNewContainer(spec string) bool

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

func NewSuperCommand

func NewSuperCommand() cmd.Command

NewSuperCommand creates the service supercommand and registers the subcommands that it supports.

Types

type AddUnitCommand

type AddUnitCommand struct {
	envcmd.EnvCommandBase
	UnitCommandBase
	ServiceName string
	// contains filtered or unexported fields
}

AddUnitCommand is responsible adding additional units to a service.

func (*AddUnitCommand) Info

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

func (*AddUnitCommand) Init

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

func (*AddUnitCommand) Run

func (c *AddUnitCommand) Run(_ *cmd.Context) error

Run connects to the environment specified on the command line and calls AddServiceUnits for the given service.

func (*AddUnitCommand) SetFlags

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

type GetCommand

type GetCommand struct {
	envcmd.EnvCommandBase
	ServiceName string
	// contains filtered or unexported fields
}

GetCommand retrieves the configuration of a service.

func (*GetCommand) Info

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

func (*GetCommand) Init

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

func (*GetCommand) Run

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

Run fetches the configuration of the service and formats the result as a YAML string.

func (*GetCommand) SetFlags

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

type GetServiceAPI

type GetServiceAPI interface {
	Close() error
	ServiceGet(service string) (*params.ServiceGetResults, error)
}

GetServiceAPI defines the methods on the client API that the service get command calls.

type ServiceAddUnitAPI

type ServiceAddUnitAPI interface {
	Close() error
	EnvironmentUUID() string
	AddServiceUnits(service string, numUnits int, machineSpec string) ([]string, error)
	AddServiceUnitsWithPlacement(service string, numUnits int, placement []*instance.Placement) ([]string, error)
	EnvironmentGet() (map[string]interface{}, error)
}

ServiceAddUnitAPI defines the methods on the client API that the service add-unit command calls.

type ServiceGetConstraintsCommand

type ServiceGetConstraintsCommand struct {
	common.GetConstraintsCommand
}

ServiceGetConstraintsCommand shows the constraints for a service. It is just a wrapper for the common GetConstraintsCommand which enforces that a service is specified.

func (*ServiceGetConstraintsCommand) Info

func (*ServiceGetConstraintsCommand) Init

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

type ServiceSetConstraintsCommand

type ServiceSetConstraintsCommand struct {
	common.SetConstraintsCommand
}

ServiceSetConstraintsCommand sets the constraints for a service. It is just a wrapper for the common SetConstraintsCommand which enforces that a service is specified.

func (*ServiceSetConstraintsCommand) Info

func (*ServiceSetConstraintsCommand) Init

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

func (*ServiceSetConstraintsCommand) SetFlags

SetFlags overrides SetFlags for SetConstraintsCommand since that will register a flag to specify the service, and the flag is not required with this service supercommand.

type SetCommand

type SetCommand struct {
	envcmd.EnvCommandBase
	ServiceName     string
	SettingsStrings map[string]string
	SettingsYAML    cmd.FileVar
	// contains filtered or unexported fields
}

SetCommand updates the configuration of a service.

func (*SetCommand) Info

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

func (*SetCommand) Init

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

func (*SetCommand) Run

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

Run updates the configuration of a service.

func (*SetCommand) SetFlags

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

type SetServiceAPI

type SetServiceAPI interface {
	Close() error
	ServiceSetYAML(service string, yaml string) error
	ServiceGet(service string) (*params.ServiceGetResults, error)
	ServiceSet(service string, options map[string]string) error
}

SetServiceAPI defines the methods on the client API that the service set command calls.

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) CheckProvider

func (c *UnitCommandBase) CheckProvider(conf *config.Config) error

TODO(anastasiamac) 2014-10-20 Bug#1383116 This exists to provide more context to the user about why they cannot allocate units to machine 0. Remove this when the local provider's machine 0 is a container. TODO(cherylj) Unexport CheckProvider once deploy is moved under service

func (*UnitCommandBase) Init

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

func (*UnitCommandBase) SetFlags

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

type UnsetCommand

type UnsetCommand struct {
	envcmd.EnvCommandBase
	ServiceName string
	Options     []string
	// contains filtered or unexported fields
}

UnsetCommand sets configuration values of a service back to their default.

func (*UnsetCommand) Info

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

func (*UnsetCommand) Init

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

func (*UnsetCommand) Run

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

Run resets the configuration of a service.

type UnsetServiceAPI

type UnsetServiceAPI interface {
	Close() error
	ServiceUnset(service string, options []string) error
}

UnsetServiceAPI defines the methods on the client API that the service unset command calls.