juju: github.com/juju/juju/cmd/juju/application Index | Files | Directories

package application

import "github.com/juju/juju/cmd/juju/application"

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

Index

Package Files

addrelation.go addunit.go application.go binding.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 shim.go show.go store.go suspendrelation.go trust.go unexpose.go upgradecharm.go validate.go

func IsMachineOrNewContainer Uses

func IsMachineOrNewContainer(spec string) bool

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

func NewAddRelationCommand Uses

func NewAddRelationCommand() cmd.Command

NewAddRelationCommand returns a command to add a relation between 2 applications.

func NewAddUnitCommand Uses

func NewAddUnitCommand() cmd.Command

NewAddUnitCommand returns a command that adds a unit[s] to an application.

func NewApplicationGetConstraintsCommand Uses

func NewApplicationGetConstraintsCommand() modelcmd.ModelCommand

NewApplicationGetConstraintsCommand returns a command which gets application constraints.

func NewApplicationSetConstraintsCommand Uses

func NewApplicationSetConstraintsCommand() modelcmd.ModelCommand

NewApplicationSetConstraintsCommand returns a command which sets application constraints.

func NewBundleDiffCommand Uses

func NewBundleDiffCommand() cmd.Command

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

func NewConfigCommand Uses

func NewConfigCommand() cmd.Command

NewConfigCommand returns a command used to get, reset, and set application charm attributes.

func NewConfigCommandForTest Uses

func NewConfigCommandForTest(api applicationAPI, store jujuclient.ClientStore) modelcmd.ModelCommand

NewConfigCommandForTest returns a SetCommand with the api provided as specified.

func NewConsumeCommand Uses

func NewConsumeCommand() cmd.Command

NewConsumeCommand returns a command to add remote offers to the model.

func NewDeployCommand Uses

func NewDeployCommand() modelcmd.ModelCommand

NewDeployCommand returns a command to deploy applications.

func NewExposeCommand Uses

func NewExposeCommand() modelcmd.ModelCommand

NewExposeCommand returns a command to expose applications.

func NewRemoveApplicationCommand Uses

func NewRemoveApplicationCommand() cmd.Command

NewRemoveApplicationCommand returns a command which removes an application.

func NewRemoveRelationCommand Uses

func NewRemoveRelationCommand() cmd.Command

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

func NewRemoveSaasCommand Uses

func NewRemoveSaasCommand() cmd.Command

NewRemoveSaasCommand returns a command which removes a consumed application.

func NewRemoveUnitCommand Uses

func NewRemoveUnitCommand() modelcmd.ModelCommand

NewRemoveUnitCommand returns a command which removes an application's units.

func NewResolvedCommand Uses

func NewResolvedCommand() cmd.Command

func NewResumeRelationCommand Uses

func NewResumeRelationCommand() cmd.Command

NewResumeRelationCommand returns a command to resume a relation.

func NewScaleApplicationCommand Uses

func NewScaleApplicationCommand() modelcmd.ModelCommand

NewScaleApplicationCommand returns a command which scales an application's units.

func NewSetSeriesCommand Uses

func NewSetSeriesCommand() cmd.Command

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

func NewShowApplicationCommand Uses

func NewShowApplicationCommand() cmd.Command

NewShowApplicationCommand returns a command that displays applications info.

func NewSuspendRelationCommand Uses

func NewSuspendRelationCommand() cmd.Command

NewSuspendRelationCommand returns a command to suspend a relation.

func NewTrustCommand Uses

func NewTrustCommand() cmd.Command

func NewUnexposeCommand Uses

func NewUnexposeCommand() modelcmd.ModelCommand

NewUnexposeCommand returns a command to unexpose applications.

func NewUpgradeCharmCommand Uses

func NewUpgradeCharmCommand() cmd.Command

NewUpgradeCharmCommand returns a command which upgrades application's charm.

type ApplicationAPI Uses

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(branchName string, appNames ...string) ([]map[string]interface{}, error)
    GetConstraints(appNames ...string) ([]constraints.Value, error)
    SetAnnotation(annotations map[string]map[string]string) ([]apiparams.ErrorResult, error)
    SetCharm(string, application.SetCharmConfig) error
    SetConstraints(application string, constraints constraints.Value) error
    Update(apiparams.ApplicationUpdate) error
    ScaleApplication(application.ScaleApplicationParams) (apiparams.ScaleApplicationResult, error)
    Consume(arg crossmodel.ConsumeApplicationArgs) (string, error)
}

type ApplicationDestroyRelationAPI Uses

type ApplicationDestroyRelationAPI interface {
    Close() error
    BestAPIVersion() int
    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 Uses

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 Uses

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 Uses

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 Uses

type CharmAPIClient interface {
    CharmUpgradeClient
}

CharmAPIClient defines a subset of the application facade that deals with charm related upgrades.

type CharmAdder Uses

type CharmAdder interface {
    AddLocalCharm(*charm.URL, charm.Charm, bool) (*charm.URL, error)
    AddCharm(*charm.URL, params.Channel, bool) error
    AddCharmWithAuthorization(*charm.URL, params.Channel, *macaroon.Macaroon, bool) error
    AuthorizeCharmstoreEntity(*charm.URL) (*macaroon.Macaroon, error)
}

type CharmClient Uses

type CharmClient interface {
    CharmInfo(string) (*charms.CharmInfo, error)
}

CharmClient defines a subset of the charms facade, as required by the upgrade-charm command.

type CharmDeployAPI Uses

type CharmDeployAPI interface {
    CharmInfo(string) (*apicharms.CharmInfo, error)
}

CharmDeployAPI represents the methods of the API the deploy command needs for charms.

type CharmUpgradeClient Uses

type CharmUpgradeClient interface {
    GetCharmURL(string, string) (*charm.URL, error)
    Get(string, string) (*params.ApplicationGetResults, error)
    SetCharm(string, application.SetCharmConfig) error
}

CharmUpgradeClient defines a subset of the application facade, as required by the upgrade-charm command.

type ConsumeDetails Uses

type ConsumeDetails interface {
    GetConsumeDetails(url string) (apiparams.ConsumeOfferDetails, error)
    Close() error
}

type DeployAPI Uses

type DeployAPI interface {
    // TODO(katco): Pair DeployAPI down to only the methods required
    // by the deploy command.
    api.Connection
    CharmAdder
    MeteredDeployAPI
    CharmDeployAPI
    ApplicationAPI
    ModelAPI
    OfferAPI
    SpacesAPI

    // ApplicationClient
    Deploy(application.DeployArgs) error
    Status(patterns []string) (*apiparams.FullStatus, error)

    ResolveWithPreferredChannel(*charm.URL, params.Channel) (*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 Uses

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

    // 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) (ConsumeDetails, error)

    // 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 Uses

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

func (*DeployCommand) Init Uses

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

func (*DeployCommand) Run Uses

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

func (*DeployCommand) SetFlags Uses

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

type DeployStep Uses

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 Uses

type DeployStepAPI interface {
    MeteredDeployAPI
}

DeployStepAPI represents a API required for deploying using the step deployment code.

type DeploymentInfo Uses

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 Uses

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 ModelAPI Uses

type ModelAPI interface {
    ModelUUID() (string, bool)
    ModelGet() (map[string]interface{}, error)
    Sequences() (map[string]int, error)
}

type ModelConfigGetter Uses

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

type ModelExtractor Uses

type ModelExtractor interface {
    GetAnnotations(tags []string) ([]params.AnnotationsGetResult, error)
    GetConstraints(applications ...string) ([]constraints.Value, error)
    GetConfig(branchName string, 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 Uses

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 OfferAPI Uses

type OfferAPI interface {
    Offer(modelUUID, application string, endpoints []string, offerName, descr string) ([]apiparams.ErrorResult, error)
    GrantOffer(user, access string, offerURLs ...string) error
}

OfferAPI represents the methods of the API the deploy command needs for creating offers.

type RegisterMeteredCharm Uses

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 Uses

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 Uses

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 Uses

func (r *RegisterMeteredCharm) SetFlags(f *gnuflag.FlagSet)

SetFlags implements DeployStep.

func (*RegisterMeteredCharm) SetPlanURL Uses

func (r *RegisterMeteredCharm) SetPlanURL(planURL string)

SetPlanURL implements DeployStep.

type RemoveApplicationAPI Uses

type RemoveApplicationAPI interface {
    Close() error
    ScaleApplication(application.ScaleApplicationParams) (params.ScaleApplicationResult, error)
    DestroyApplications(application.DestroyApplicationsParams) ([]params.DestroyApplicationResult, error)
    DestroyDeprecated(appName string) error
    DestroyUnits(application.DestroyUnitsParams) ([]params.DestroyUnitResult, error)
    DestroyUnitsDeprecated(unitNames ...string) error
    ModelUUID() string
    BestAPIVersion() int
}

type RemoveSaasAPI Uses

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

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

type ResolveCharmFunc Uses

type ResolveCharmFunc func(
    resolveWithChannel func(*charm.URL, csparams.Channel) (*charm.URL, csparams.Channel, []string, error),
    url *charm.URL,
    preferredChannel csparams.Channel,
) (*charm.URL, csparams.Channel, []string, error)

ResolveCharmFunc is the type of a function that resolves a charm URL with an optionally specified preferred channel.

type ResourceLister Uses

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 Uses

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 Uses

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 SpacesAPI Uses

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

SpacesAPI defines the necessary API methods needed for listing spaces.

type URLResolver Uses

type URLResolver interface {
    ResolveWithPreferredChannel(*charm.URL, params.Channel) (*charm.URL, params.Channel, []string, error)
}

URLResolver is the part of charmrepo.Charmstore that we need to resolve a charm url.

type UnitCommandBase Uses

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 Uses

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

func (*UnitCommandBase) SetFlags Uses

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

type ValidateLXDProfileCharm Uses

type ValidateLXDProfileCharm struct{}

ValidateLXDProfileCharm implements the DeployStep interface.

func (*ValidateLXDProfileCharm) RunPost Uses

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 Uses

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 Uses

func (r *ValidateLXDProfileCharm) SetFlags(f *gnuflag.FlagSet)

SetFlags implements DeployStep.

func (*ValidateLXDProfileCharm) SetPlanURL Uses

func (r *ValidateLXDProfileCharm) SetPlanURL(planURL string)

SetPlanURL implements DeployStep.

Directories

PathSynopsis
mocksPackage mocks is a generated GoMock package.

Package application imports 74 packages (graph) and is imported by 17 packages. Updated 2019-10-14. Refresh now. Tools for package owners.