application

package
v0.0.0-...-9ec3720 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: AGPL-3.0 Imports: 69 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (
	// SeriesAll defines a platform that targets all series.
	SeriesAll = "all"
	// ArchAll defines a platform that targets all architectures.
	ArchAll = "all"
)

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 applications.

func NewAddUnitCommand

func NewAddUnitCommand() cmd.Command

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 NewBindCommand

func NewBindCommand() cmd.Command

NewBindCommand returns a command which changes the bindings for an application.

func NewConfigCommand

func NewConfigCommand() cmd.Command

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

func NewConsumeCommand() cmd.Command

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 NewDiffBundleCommand

func NewDiffBundleCommand() cmd.Command

NewDiffBundleCommand returns a command to compare a bundle against the selected model.

func NewExposeCommand

func NewExposeCommand() modelcmd.ModelCommand

NewExposeCommand returns a command to expose applications.

func NewRefreshCommand

func NewRefreshCommand() cmd.Command

NewRefreshCommand returns a command which upgrades application's charm.

func NewRemoveApplicationCommand

func NewRemoveApplicationCommand() cmd.Command

NewRemoveApplicationCommand returns a command which removes an application.

func NewRemoveRelationCommand

func NewRemoveRelationCommand() cmd.Command

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

func NewRemoveSaasCommand

func NewRemoveSaasCommand() cmd.Command

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 NewResolvedCommand() cmd.Command

func NewResumeRelationCommand

func NewResumeRelationCommand() cmd.Command

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

func NewSetSeriesCommand() cmd.Command

NewSetSeriesCommand returns a command which updates the series of an application.

func NewShowApplicationCommand

func NewShowApplicationCommand() cmd.Command

NewShowApplicationCommand returns a command that displays applications info.

func NewShowUnitCommand

func NewShowUnitCommand() cmd.Command

NewShowUnitCommand returns a command that displays unit info.

func NewSuspendRelationCommand

func NewSuspendRelationCommand() cmd.Command

NewSuspendRelationCommand returns a command to suspend a relation.

func NewTrustCommand

func NewTrustCommand() cmd.Command

func NewUnexposeCommand

func NewUnexposeCommand() modelcmd.ModelCommand

NewUnexposeCommand returns a command to unexpose applications.

Types

type ApplicationBindClient

type ApplicationBindClient interface {
	Get(string, string) (*params.ApplicationGetResults, error)
	MergeBindings(req params.ApplicationMergeBindingsArgs) error
}

ApplicationBindClient defines a subset of the application facade that deals with querying and updating application bindings.

type ApplicationDestroyRelationAPI

type ApplicationDestroyRelationAPI interface {
	Close() error
	DestroyRelation(force *bool, maxWait *time.Duration, endpoints ...string) error
	DestroyRelationId(relationId int, force *bool, maxWait *time.Duration) 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"`
	ExposedEndpoints map[string]ExposedEndpoint `yaml:"exposed-endpoints,omitempty" json:"exposed-endpoints,omitempty"`
	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
	ApplicationsInfo([]names.ApplicationTag) ([]params.ApplicationInfoResult, error)
}

ApplicationsInfoAPI defines the API methods that show-application command uses.

type BundleResolver

type BundleResolver interface {
	ResolveBundleURL(*charm.URL, commoncharm.Origin) (*charm.URL, commoncharm.Origin, error)
	GetBundle(*charm.URL, commoncharm.Origin, string) (charm.Bundle, error)
}

BundleResolver defines what we need from a charm store to resolve a bundle and read the bundle data.

type CharmRefreshClient

type CharmRefreshClient interface {
	GetCharmURLOrigin(string, string) (*charm.URL, commoncharm.Origin, error)
	Get(string, string) (*params.ApplicationGetResults, error)
	SetCharm(string, application.SetCharmConfig) error
}

CharmRefreshClient defines a subset of the application facade, as required by the refresh command.

type CharmResolver

type CharmResolver interface {
	ResolveCharm(url *charm.URL, preferredOrigin commoncharm.Origin) (*charm.URL, commoncharm.Origin, []string, error)
}

CharmResolver defines methods required to resolve charms, as required by the refresh command.

type DeployAPI

type DeployAPI interface {
	deployer.DeployerAPI
	SpacesAPI
	// PlanURL returns the configured URL prefix for the metering plan API.
	PlanURL() string
}

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 channel to use when obtaining
	// the charm to be deployed.
	Channel corecharm.Channel

	// Series is the series of the charm to deploy.
	Series string

	// Force is used to allow a charm/bundle 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
	ModelConstraints 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    []deployer.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)

	// NewCharmRepo stores a function which returns a charm store client.
	NewCharmRepo func() (*store.CharmStoreAdaptor, error)

	// NewDownloadClient stores a function for getting a charm/bundle.
	NewDownloadClient func() (store.DownloadBundleClient, error)

	// NewModelConfigClient stores a function which returns a new model config
	// client. This is used to get the model config.
	NewModelConfigClient func(base.APICallCloser) ModelConfigClient

	// NewResolver stores a function which returns a charm adaptor.
	NewResolver func(store.CharmsAPI, store.CharmStoreRepoFunc, store.DownloadBundleClientFunc) deployer.Resolver

	// NewDeployerFactory stores a function which returns a deployer factory.
	NewDeployerFactory func(dep deployer.DeployerDependencies) deployer.DeployerFactory

	// NewConsumeDetailsAPI stores a function which will return a new API
	// for consume details API using the url as the source.
	NewConsumeDetailsAPI func(url *charm.OfferURL) (deployer.ConsumeDetails, error)

	// DeployResources stores a function which deploys charm resources.
	DeployResources resourceadapters.DeployResourcesFunc

	// When deploying a charm, 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. On the other hand, when deploying a bundle, Trust
	// signifies that each application from the bundle that requires access
	// to trusted credentials will be granted access.
	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) Run

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

Run executes a deploy command with a given context.

func (*DeployCommand) SetFlags

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

type ExposedEndpoint

type ExposedEndpoint struct {
	ExposeToSpaces []string `yaml:"expose-to-spaces,omitempty" json:"expose-to-spaces,omitempty"`
	ExposeToCIDRs  []string `yaml:"expose-to-cidrs,omitempty" json:"expose-to-cidrs,omitempty"`
}

ExposedEndpoint defines the serialization behavior of the expose settings for an application endpoint.

type ModelConfigClient

type ModelConfigClient interface {
	ModelConfigGetter
	Close() error
}

ModelConfigClient represents a model config client for requesting model configurations.

type ModelConfigGetter

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

ModelConfigGetter defines an interface for getting model configuration.

type ModelConstraintsClient

type ModelConstraintsClient interface {
	ModelConstraintsGetter
	Close() error
}

ModelConstraintsClient represents a client for getting the constraints from a model.

type ModelConstraintsGetter

type ModelConstraintsGetter interface {
	GetModelConstraints() (constraints.Value, error)
}

ModelConstraintsGetter defines an interface for getting model constraints.

type NewCharmAdderFunc

type NewCharmAdderFunc func(
	api.Connection,
) store.CharmAdder

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

type NewCharmResolverFunc

NewCharmResolverFunc returns a client implementing CharmResolver.

type NewCharmStoreFunc

NewCharmStoreFunc constructs a charm store client.

type RelationData

type RelationData struct {
	Endpoint                string                      `yaml:"endpoint" json:"endpoint"`
	CrossModel              bool                        `yaml:"cross-model,omitempty" json:"cross-model,omitempty"`
	RelatedEndpoint         string                      `yaml:"related-endpoint" json:"related-endpoint"`
	ApplicationRelationData map[string]interface{}      `yaml:"application-data" json:"application-data"`
	MyData                  UnitRelationData            `yaml:"local-unit,omitempty" json:"local-unit,omitempty"`
	Data                    map[string]UnitRelationData `yaml:"related-units,omitempty" json:"related-units,omitempty"`
}

type RemoveSaasAPI

type RemoveSaasAPI interface {
	Close() error
	DestroyConsumedApplication(application.DestroyConsumedApplicationParams) ([]params.ErrorResult, error)
}

RemoveSaasAPI defines the API methods that the remove-saas command uses.

type SetRelationSuspendedAPI

type SetRelationSuspendedAPI interface {
	Close() error
	SetRelationSuspended(relationIds []int, suspended bool, message string) error
}

SetRelationSuspendedAPI defines the API methods that the suspend/resume relation commands use.

type SpacesAPI

type SpacesAPI interface {
	ListSpaces() ([]apiparams.Space, error)
}

SpacesAPI defines the necessary API methods needed for listing spaces.

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 UnitInfo

type UnitInfo struct {
	WorkloadVersion string         `yaml:"workload-version,omitempty" json:"workload-version,omitempty"`
	Machine         string         `yaml:"machine,omitempty" json:"machine,omitempty"`
	OpenedPorts     []string       `yaml:"opened-ports" json:"opened-ports"`
	PublicAddress   string         `yaml:"public-address,omitempty" json:"public-address,omitempty"`
	Charm           string         `yaml:"charm" json:"charm"`
	Leader          bool           `yaml:"leader" json:"leader"`
	RelationData    []RelationData `yaml:"relation-info,omitempty" json:"relation-info,omitempty"`

	// The following are for CAAS models.
	ProviderId string `yaml:"provider-id,omitempty" json:"provider-id,omitempty"`
	Address    string `yaml:"address,omitempty" json:"address,omitempty"`
}

ApplicationInfo defines the serialization behaviour of the application information.

type UnitRelationData

type UnitRelationData struct {
	InScope  bool                   `yaml:"in-scope" json:"in-scope"`
	UnitData map[string]interface{} `yaml:"data" json:"data"`
}

type UnitsInfoAPI

type UnitsInfoAPI interface {
	Close() error
	UnitsInfo([]names.UnitTag) ([]application.UnitInfo, error)
}

UnitsInfoAPI defines the API methods that show-unit command uses.

Directories

Path Synopsis
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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