Documentation ¶
Index ¶
- Variables
- func CharmOnlyFlags() []string
- type ApplicationAPI
- type Bundle
- type CharmDeployAPI
- type CharmReader
- type ConsumeDetails
- type DeployConfigFlag
- type DeployStep
- type DeployStepAPI
- type Deployer
- type DeployerAPI
- type DeployerConfig
- type DeployerDependencies
- type DeployerFactory
- type DeploymentInfo
- type MeteredDeployAPI
- type MetricRegistrationPost
- type ModelAPI
- type ModelCommand
- type ModelConfigGetter
- type OfferAPI
- type RegisterMeteredCharm
- func (r *RegisterMeteredCharm) RunPost(api DeployStepAPI, _ *httpbakery.Client, _ *cmd.Context, ...) error
- func (r *RegisterMeteredCharm) RunPre(api DeployStepAPI, bakeryClient *httpbakery.Client, ctx *cmd.Context, ...) error
- func (r *RegisterMeteredCharm) SetFlags(f *gnuflag.FlagSet)
- func (r *RegisterMeteredCharm) SetPlanURL(planURL string)
- type Resolver
- type ValidateLXDProfileCharm
- func (r *ValidateLXDProfileCharm) RunPost(api DeployStepAPI, bakeryClient *httpbakery.Client, ctx *cmd.Context, ...) error
- func (r *ValidateLXDProfileCharm) RunPre(api DeployStepAPI, bakeryClient *httpbakery.Client, ctx *cmd.Context, ...) error
- func (r *ValidateLXDProfileCharm) SetFlags(f *gnuflag.FlagSet)
- func (r *ValidateLXDProfileCharm) SetPlanURL(planURL string)
Constants ¶
This section is empty.
Variables ¶
var ( // BundleOnlyFlags represents what flags are used for bundles only. // TODO(thumper): support dry-run for apps as well as bundles. BundleOnlyFlags = []string{ "overlay", "dry-run", "map-machines", } )
Functions ¶
func CharmOnlyFlags ¶
func CharmOnlyFlags() []string
CharmOnlyFlags and BundleOnlyFlags are used to validate flags based on whether we are deploying a charm or a bundle.
Types ¶
type ApplicationAPI ¶
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, exposedEndpoints map[string]apiparams.ExposedEndpoint) error GetAnnotations(tags []string) ([]apiparams.AnnotationsGetResult, error) SetAnnotation(annotations map[string]map[string]string) ([]apiparams.ErrorResult, error) GetCharmURLOrigin(string, string) (*charm.URL, commoncharm.Origin, error) SetCharm(string, application.SetCharmConfig) error GetConfig(branchName string, appNames ...string) ([]map[string]interface{}, error) SetConfig(branchName string, application, configYAML string, config map[string]string) error GetConstraints(appNames ...string) ([]constraints.Value, error) SetConstraints(application string, constraints constraints.Value) error ScaleApplication(application.ScaleApplicationParams) (apiparams.ScaleApplicationResult, error) Consume(arg crossmodel.ConsumeApplicationArgs) (string, error) }
type Bundle ¶
type Bundle interface { // Data returns the contents of the bundle's bundle.yaml file. Data() *charm.BundleData // yes // ReadMe returns the contents of the bundle's README.md file. ReadMe() string // ContainsOverlays returns true if the bundle contains any overlays. ContainsOverlays() bool }
Bundle is a local version of the charm.Bundle interface, for test with the Resolver interface.
type CharmDeployAPI ¶
CharmDeployAPI represents the methods of the API the deploy command needs for charms.
type CharmReader ¶
type CharmReader interface { // ReadCharm reads a given charm from the filesystem. ReadCharm(string) (charm.Charm, error) }
CharmReader aims to read a charm from the filesystem.
type ConsumeDetails ¶
type ConsumeDetails interface { GetConsumeDetails(url string) (apiparams.ConsumeOfferDetails, error) Close() error }
ConsumeDetails
type DeployConfigFlag ¶
type DeployConfigFlag interface { // AbsoluteFileNames returns the absolute path of any file names specified. AbsoluteFileNames(ctx *cmd.Context) ([]string, error) // ReadConfigPairs returns just the k=v attributes ReadConfigPairs(ctx *cmd.Context) (map[string]interface{}, error) }
DeployConfigFlag defines methods required for charm config when deploying a charm.
type DeployStep ¶
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.
func Steps ¶
func Steps() []DeployStep
type DeployStepAPI ¶
type DeployStepAPI interface { MeteredDeployAPI }
DeployStepAPI represents a API required for deploying using the step deployment code.
type Deployer ¶
type Deployer interface { // PrepareAndDeploy finishes preparing to deploy a charm or bundle, // then deploys it. This is done as one step to accommodate the // call being wrapped by block.ProcessBlockedError. PrepareAndDeploy(*cmd.Context, DeployerAPI, Resolver, store.MacaroonGetter) error // String returns a string description of the deployer. String() string }
Deployer defines the functionality of a deployer returned by the factory.
type DeployerAPI ¶
type DeployerAPI interface { // Needed for BestFacadeVersion and for the DeployResourcesFunc. base.APICallCloser ApplicationAPI store.CharmAdder DeployStepAPI CharmDeployAPI ModelAPI OfferAPI Deploy(application.DeployArgs) error Status(patterns []string) (*apiparams.FullStatus, error) WatchAll() (api.AllWatch, error) }
type DeployerConfig ¶
type DeployerConfig struct { Model ModelCommand ApplicationName string AttachStorage []string Bindings map[string]string BindToSpaces string BundleDevices map[string]map[string]devices.Constraints BundleMachines map[string]string BundleOverlayFile []string BundleStorage map[string]map[string]storage.Constraints Channel charm.Channel CharmOrBundle string DefaultCharmSchema charm.Schema ConfigOptions common.ConfigFlag ConstraintsStr string Constraints constraints.Value ModelConstraints constraints.Value Devices map[string]devices.Constraints DeployResources resourceadapters.DeployResourcesFunc DryRun bool FlagSet *gnuflag.FlagSet Force bool NewConsumeDetailsAPI func(url *charm.OfferURL) (ConsumeDetails, error) NumUnits int PlacementSpec string Placement []*instance.Placement Resources map[string]string Revision int Series string Storage map[string]storage.Constraints Trust bool UseExisting bool }
DeployerConfig is the data required to choose a deployer and then run PrepareAndDeploy. TODO (hml) 2020-08-14 Is there a better structure for this config?
type DeployerDependencies ¶
type DeployerDependencies struct { DeployResources resourceadapters.DeployResourcesFunc Model ModelCommand FileSystem modelcmd.Filesystem CharmReader CharmReader NewConsumeDetailsAPI func(url *charm.OfferURL) (ConsumeDetails, error) Steps []DeployStep }
DeployerDependencies are required for any deployer to be run.
type DeployerFactory ¶
type DeployerFactory interface {
GetDeployer(DeployerConfig, ModelConfigGetter, Resolver) (Deployer, error)
}
DeployerFactory contains a method to get a deployer.
func NewDeployerFactory ¶
func NewDeployerFactory(dep DeployerDependencies) DeployerFactory
NewDeployerFactory returns a factory setup with the API and function dependencies required by every deployer.
type DeploymentInfo ¶
type DeploymentInfo struct { CharmID application.CharmID ApplicationName string ModelUUID string CharmInfo *apicommoncharms.CharmInfo ApplicationPlan string Force bool }
DeploymentInfo is used to maintain all deployment information for deployment steps.
type MeteredDeployAPI ¶
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 MetricRegistrationPost ¶
type ModelCommand ¶
type ModelCommand interface { // BakeryClient returns a macaroon bakery client that // uses the same HTTP client returned by HTTPClient. BakeryClient() (*httpbakery.Client, error) // ControllerName returns the name of the controller that contains // the model returned by ModelName(). ControllerName() (string, error) // CurrentAccountDetails returns details of the account associated with // the current controller. CurrentAccountDetails() (*jujuclient.AccountDetails, error) // ModelDetails returns details from the file store for the model indicated by // the currently set controller name and model identifier. ModelDetails() (string, *jujuclient.ModelDetails, error) // ModelType returns the type of the model. ModelType() (model.ModelType, error) // Filesystem returns an instance that provides access to // the filesystem, either delegating to calling os functions // or functions which always return an error. Filesystem() modelcmd.Filesystem }
type ModelConfigGetter ¶
type OfferAPI ¶
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 ¶
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 ¶
func (r *RegisterMeteredCharm) RunPost(api DeployStepAPI, _ *httpbakery.Client, _ *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 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 ¶
func (r *RegisterMeteredCharm) SetFlags(f *gnuflag.FlagSet)
SetFlags implements DeployStep.
func (*RegisterMeteredCharm) SetPlanURL ¶
func (r *RegisterMeteredCharm) SetPlanURL(planURL string)
SetPlanURL implements DeployStep.
type Resolver ¶
type Resolver interface { GetBundle(*charm.URL, commoncharm.Origin, string) (charm.Bundle, error) ResolveBundleURL(*charm.URL, commoncharm.Origin) (*charm.URL, commoncharm.Origin, error) ResolveCharm(url *charm.URL, preferredOrigin commoncharm.Origin, switchCharm bool) (*charm.URL, commoncharm.Origin, []string, error) }
Resolver defines what we need to resolve a charm or bundle and read the bundle data.
type ValidateLXDProfileCharm ¶
type ValidateLXDProfileCharm struct{}
ValidateLXDProfileCharm implements the DeployStep interface.
func (*ValidateLXDProfileCharm) RunPost ¶
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 ¶
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 ¶
func (r *ValidateLXDProfileCharm) SetFlags(f *gnuflag.FlagSet)
SetFlags implements DeployStep.
func (*ValidateLXDProfileCharm) SetPlanURL ¶
func (r *ValidateLXDProfileCharm) SetPlanURL(planURL string)
SetPlanURL implements DeployStep.