Documentation ¶
Overview ¶
Package application contains api calls for functionality related to deploying and managing applications and their related charms.
Index ¶
- Constants
- Variables
- func AddTrustSchemaAndDefaults(schema environschema.Fields, defaults schema.Defaults) (environschema.Fields, schema.Defaults, error)
- func CharmToStateCharm(ch Charm) *state.Charm
- func StateCharmOrigin(origin corecharm.Origin) *state.CharmOrigin
- type APIBase
- func (api *APIBase) AddRelation(args params.AddRelation) (_ params.AddRelationResults, err error)
- func (api *APIBase) AddUnits(args params.AddApplicationUnits) (params.AddApplicationUnitsResults, error)
- func (api *APIBase) ApplicationsInfo(in params.Entities) (params.ApplicationInfoResults, error)
- func (api *APIBase) CharmConfig(args params.ApplicationGetArgs) (params.ApplicationGetConfigResults, error)
- func (api *APIBase) CharmRelations(p params.ApplicationCharmRelations) (params.ApplicationCharmRelationsResults, error)
- func (api *APIBase) Consume(args params.ConsumeApplicationArgs) (params.ErrorResults, error)
- func (api *APIBase) Deploy(args params.ApplicationsDeploy) (params.ErrorResults, error)
- func (api *APIBase) Destroy(in params.ApplicationDestroy) error
- func (api *APIBase) DestroyApplication(args params.DestroyApplicationsParams) (params.DestroyApplicationResults, error)
- func (api *APIBase) DestroyConsumedApplications(args params.DestroyConsumedApplicationsParams) (params.ErrorResults, error)
- func (api *APIBase) DestroyRelation(args params.DestroyRelation) (err error)
- func (api *APIBase) DestroyUnit(args params.DestroyUnitsParams) (params.DestroyUnitResults, error)
- func (api *APIBase) DestroyUnits(args params.DestroyApplicationUnits) error
- func (api *APIBase) Expose(args params.ApplicationExpose) error
- func (api *APIBase) Get(args params.ApplicationGet) (params.ApplicationGetResults, error)
- func (api *APIBase) GetCharmURLOrigin(args params.ApplicationGet) (params.CharmURLOriginResult, error)
- func (api *APIBase) GetConfig(args params.Entities) (params.ApplicationGetConfigResults, error)
- func (api *APIBase) GetConstraints(args params.Entities) (params.ApplicationGetConstraintsResults, error)
- func (api *APIBase) MergeBindings(in params.ApplicationMergeBindingsArgs) (params.ErrorResults, error)
- func (api *APIBase) ResolveUnitErrors(p params.UnitsResolved) (params.ErrorResults, error)
- func (api *APIBase) ScaleApplications(args params.ScaleApplicationsParams) (params.ScaleApplicationResults, error)
- func (api *APIBase) SetCharm(args params.ApplicationSetCharm) error
- func (api *APIBase) SetConfigs(args params.ConfigSetArgs) (params.ErrorResults, error)
- func (api *APIBase) SetConstraints(args params.SetConstraints) error
- func (api *APIBase) SetMetricCredentials(args params.ApplicationMetricCredentials) (params.ErrorResults, error)
- func (api *APIBase) SetRelationsSuspended(args params.RelationSuspendedArgs) (params.ErrorResults, error)
- func (api *APIBase) Unexpose(args params.ApplicationUnexpose) error
- func (api *APIBase) UnitsInfo(in params.Entities) (params.UnitInfoResults, error)
- func (api *APIBase) UnsetApplicationsConfig(args params.ApplicationConfigUnsetArgs) (params.ErrorResults, error)
- func (api *APIBase) UpdateApplicationSeries(args params.UpdateSeriesArgs) (params.ErrorResults, error)
- type APIv13
- type AgentTools
- type AgentVersioner
- type Application
- type ApplicationDeployer
- type Backend
- type Bindings
- type BlockChecker
- type Charm
- type CharmMeta
- type CharmhubClient
- type DeployApplicationParams
- type ExternalController
- type Generation
- type Machine
- type Model
- type OfferConnection
- type Relation
- type RelationUnit
- type RemoteApplication
- type Resources
- type Subnet
- type Unit
- type UnitAdder
- type UpdateSeries
- type UpdateSeriesAPI
- type UpdateSeriesState
- type UpdateSeriesValidator
Constants ¶
const TrustConfigOptionName = "trust"
TrustConfigOptionName is the option name used to set trust level in application configuration.
Variables ¶
var ( // ErrInvalidAgentVersions is a sentinal error for when we can no longer // upgrade juju using 2.5.x agents with 2.6 or greater controllers. ErrInvalidAgentVersions = errors.Errorf( "Unable to upgrade LXDProfile charms with the current model version. " + "Please run juju upgrade-juju to upgrade the current model to match your controller.") )
Functions ¶
func AddTrustSchemaAndDefaults ¶
func AddTrustSchemaAndDefaults(schema environschema.Fields, defaults schema.Defaults) (environschema.Fields, schema.Defaults, error)
AddTrustSchemaAndDefaults adds trust schema fields and defaults to an existing set of schema fields and defaults.
func CharmToStateCharm ¶
CharmToStateCharm converts a Charm into a state.Charm. This is a hack that is required until the State interface methods we deal with stop accepting state.Charms, and start accepting charm.Charm and charm.URL.
func StateCharmOrigin ¶
func StateCharmOrigin(origin corecharm.Origin) *state.CharmOrigin
StateCharmOrigin returns a state layer CharmOrigin given a core Origin.
Types ¶
type APIBase ¶
type APIBase struct {
// contains filtered or unexported fields
}
APIBase implements the shared application interface and is the concrete implementation of the api end point.
API provides the Application API facade for version 5.
func NewAPIBase ¶
func NewAPIBase( backend Backend, storageAccess storageInterface, authorizer facade.Authorizer, updateSeries UpdateSeries, blockChecker BlockChecker, model Model, leadershipReader leadership.Reader, stateCharm func(Charm) *state.Charm, deployApplication func(ApplicationDeployer, Model, DeployApplicationParams) (Application, error), storagePoolManager poolmanager.PoolManager, registry storage.ProviderRegistry, resources facade.Resources, caasBroker caasBrokerInterface, ) (*APIBase, error)
NewAPIBase returns a new application API facade.
func (*APIBase) AddRelation ¶
func (api *APIBase) AddRelation(args params.AddRelation) (_ params.AddRelationResults, err error)
AddRelation adds a relation between the specified endpoints and returns the relation info.
func (*APIBase) AddUnits ¶
func (api *APIBase) AddUnits(args params.AddApplicationUnits) (params.AddApplicationUnitsResults, error)
AddUnits adds a given number of units to an application.
func (*APIBase) ApplicationsInfo ¶
ApplicationsInfo returns applications information.
func (*APIBase) CharmConfig ¶
func (api *APIBase) CharmConfig(args params.ApplicationGetArgs) (params.ApplicationGetConfigResults, error)
CharmConfig returns charm config for the input list of applications and model generations.
func (*APIBase) CharmRelations ¶
func (api *APIBase) CharmRelations(p params.ApplicationCharmRelations) (params.ApplicationCharmRelationsResults, error)
CharmRelations implements the server side of Application.CharmRelations.
func (*APIBase) Consume ¶
func (api *APIBase) Consume(args params.ConsumeApplicationArgs) (params.ErrorResults, error)
Consume adds remote applications to the model without creating any relations.
func (*APIBase) Deploy ¶
func (api *APIBase) Deploy(args params.ApplicationsDeploy) (params.ErrorResults, error)
Deploy fetches the charms from the charm store and deploys them using the specified placement directives.
func (*APIBase) Destroy ¶
func (api *APIBase) Destroy(in params.ApplicationDestroy) error
Destroy destroys a given application, local or remote.
NOTE(axw) this exists only for backwards compatibility, for API facade versions 1-3; clients should prefer its successor, DestroyApplication, below. Until all consumers have been updated, or we bump a major version, we can't drop this.
TODO(axw) 2017-03-16 #1673323 Drop this in Juju 3.0.
func (*APIBase) DestroyApplication ¶
func (api *APIBase) DestroyApplication(args params.DestroyApplicationsParams) (params.DestroyApplicationResults, error)
DestroyApplication removes a given set of applications.
func (*APIBase) DestroyConsumedApplications ¶
func (api *APIBase) DestroyConsumedApplications(args params.DestroyConsumedApplicationsParams) (params.ErrorResults, error)
DestroyConsumedApplications removes a given set of consumed (remote) applications.
func (*APIBase) DestroyRelation ¶
func (api *APIBase) DestroyRelation(args params.DestroyRelation) (err error)
DestroyRelation removes the relation between the specified endpoints or an id.
func (*APIBase) DestroyUnit ¶
func (api *APIBase) DestroyUnit(args params.DestroyUnitsParams) (params.DestroyUnitResults, error)
DestroyUnit removes a given set of application units.
func (*APIBase) DestroyUnits ¶
func (api *APIBase) DestroyUnits(args params.DestroyApplicationUnits) error
DestroyUnits removes a given set of application units.
NOTE(axw) this exists only for backwards compatibility, for API facade versions 1-3; clients should prefer its successor, DestroyUnit, below. Until all consumers have been updated, or we bump a major version, we can't drop this.
TODO(axw) 2017-03-16 #1673323 Drop this in Juju 3.0.
func (*APIBase) Expose ¶
func (api *APIBase) Expose(args params.ApplicationExpose) error
Expose changes the juju-managed firewall to expose any ports that were also explicitly marked by units as open.
func (*APIBase) Get ¶
func (api *APIBase) Get(args params.ApplicationGet) (params.ApplicationGetResults, error)
Get returns the charm configuration for an application.
func (*APIBase) GetCharmURLOrigin ¶
func (api *APIBase) GetCharmURLOrigin(args params.ApplicationGet) (params.CharmURLOriginResult, error)
GetCharmURLOrigin returns the charm URL and charm origin the given application is running at present.
func (*APIBase) GetConstraints ¶
func (api *APIBase) GetConstraints(args params.Entities) (params.ApplicationGetConstraintsResults, error)
GetConstraints returns the constraints for a given application.
func (*APIBase) MergeBindings ¶
func (api *APIBase) MergeBindings(in params.ApplicationMergeBindingsArgs) (params.ErrorResults, error)
MergeBindings merges operator-defined bindings with the current bindings for one or more applications.
func (*APIBase) ResolveUnitErrors ¶
func (api *APIBase) ResolveUnitErrors(p params.UnitsResolved) (params.ErrorResults, error)
ResolveUnitErrors marks errors on the specified units as resolved.
func (*APIBase) ScaleApplications ¶
func (api *APIBase) ScaleApplications(args params.ScaleApplicationsParams) (params.ScaleApplicationResults, error)
ScaleApplications scales the specified application to the requested number of units.
func (*APIBase) SetCharm ¶
func (api *APIBase) SetCharm(args params.ApplicationSetCharm) error
SetCharm sets the charm for a given for the application.
func (*APIBase) SetConfigs ¶
func (api *APIBase) SetConfigs(args params.ConfigSetArgs) (params.ErrorResults, error)
SetConfigs implements the server side of Application.SetConfig. Both application and charm config are set. It does not unset values in Config map that are set to an empty string. Unset should be used for that.
func (*APIBase) SetConstraints ¶
func (api *APIBase) SetConstraints(args params.SetConstraints) error
SetConstraints sets the constraints for a given application.
func (*APIBase) SetMetricCredentials ¶
func (api *APIBase) SetMetricCredentials(args params.ApplicationMetricCredentials) (params.ErrorResults, error)
SetMetricCredentials sets credentials on the application.
func (*APIBase) SetRelationsSuspended ¶
func (api *APIBase) SetRelationsSuspended(args params.RelationSuspendedArgs) (params.ErrorResults, error)
SetRelationsSuspended sets the suspended status of the specified relations.
func (*APIBase) Unexpose ¶
func (api *APIBase) Unexpose(args params.ApplicationUnexpose) error
Unexpose changes the juju-managed firewall to unexpose any ports that were also explicitly marked by units as open.
func (*APIBase) UnsetApplicationsConfig ¶
func (api *APIBase) UnsetApplicationsConfig(args params.ApplicationConfigUnsetArgs) (params.ErrorResults, error)
UnsetApplicationsConfig implements the server side of Application.UnsetApplicationsConfig.
func (*APIBase) UpdateApplicationSeries ¶
func (api *APIBase) UpdateApplicationSeries(args params.UpdateSeriesArgs) (params.ErrorResults, error)
UpdateApplicationSeries updates the application series. Series for subordinates updated too.
type APIv13 ¶
type APIv13 struct {
*APIBase
}
APIv13 provides the Application API facade for version 13.
type AgentTools ¶
AgentTools is a point of use agent tools requester.
type AgentVersioner ¶
type AgentVersioner interface {
AgentVersion() (version.Number, error)
}
AgentVersioner is a point of use agent version object.
type Application ¶
type Application interface { Name() string AddUnit(state.AddUnitParams) (Unit, error) AllUnits() ([]Unit, error) ApplicationConfig() (application.ConfigAttributes, error) ApplicationTag() names.ApplicationTag Charm() (Charm, bool, error) CharmURL() (*charm.URL, bool) Channel() csparams.Channel CharmOrigin() *state.CharmOrigin ClearExposed() error CharmConfig(string) (charm.Settings, error) Constraints() (constraints.Value, error) Destroy() error DestroyOperation() *state.DestroyApplicationOperation EndpointBindings() (Bindings, error) ExposedEndpoints() map[string]state.ExposedEndpoint Endpoints() ([]state.Endpoint, error) IsExposed() bool IsPrincipal() bool IsRemote() bool Series() string SetCharm(state.SetCharmConfig) error SetConstraints(constraints.Value) error MergeExposeSettings(map[string]state.ExposedEndpoint) error UnsetExposeSettings([]string) error SetMetricCredentials([]byte) error SetMinUnits(int) error UpdateApplicationSeries(string, bool) error UpdateCharmConfig(string, charm.Settings) error UpdateApplicationConfig(application.ConfigAttributes, []string, environschema.Fields, schema.Defaults) error SetScale(int, int64, bool) error ChangeScale(int) (int, error) AgentTools() (*tools.Tools, error) MergeBindings(*state.Bindings, bool) error Relations() ([]Relation, error) }
Application defines a subset of the functionality provided by the state.Application type, as required by the application facade. For details on the methods, see the methods on state.Application with the same names.
func DeployApplication ¶
func DeployApplication(st ApplicationDeployer, model Model, args DeployApplicationParams) (Application, error)
DeployApplication takes a charm and various parameters and deploys it.
func NewStateApplication ¶
func NewStateApplication(st *state.State, app *state.Application) Application
NewStateApplication converts a state.Application into an Application.
type ApplicationDeployer ¶
type ApplicationDeployer interface { AddApplication(state.AddApplicationArgs) (Application, error) ControllerConfig() (controller.Config, error) }
type Backend ¶
type Backend interface { AllModelUUIDs() ([]string, error) Application(string) (Application, error) ApplyOperation(state.ModelOperation) error AddApplication(state.AddApplicationArgs) (Application, error) RemoteApplication(string) (RemoteApplication, error) AddRemoteApplication(state.AddRemoteApplicationParams) (RemoteApplication, error) AddRelation(...state.Endpoint) (Relation, error) Charm(*charm.URL) (Charm, error) EndpointsRelation(...state.Endpoint) (Relation, error) Relation(int) (Relation, error) InferEndpoints(...string) ([]state.Endpoint, error) Machine(string) (Machine, error) Model() (Model, error) Unit(string) (Unit, error) UnitsInError() ([]Unit, error) SaveController(info crossmodel.ControllerInfo, modelUUID string) (ExternalController, error) ControllerTag() names.ControllerTag ControllerConfig() (controller.Config, error) Resources() (Resources, error) OfferConnectionForRelation(string) (OfferConnection, error) SaveEgressNetworks(relationKey string, cidrs []string) (state.RelationNetworks, error) Branch(string) (Generation, error) state.EndpointBinding }
Backend defines the state functionality required by the application facade. For details on the methods, see the methods on state.State with the same names.
type Bindings ¶
type Bindings interface { Map() map[string]string MapWithSpaceNames(network.SpaceInfos) (map[string]string, error) }
Bindings defines a subset of the functionality provided by the state.Bindings type, as required by the application facade. For details on the methods, see the methods on state.Bindings with the same names.
type BlockChecker ¶
BlockChecker defines the block-checking functionality required by the application facade. This is implemented by apiserver/common.BlockChecker.
type Charm ¶
type Charm interface { charm.Charm URL() *charm.URL String() string }
Charm defines a subset of the functionality provided by the state.Charm type, as required by the application facade. For details on the methods, see the methods on state.Charm with the same names.
type CharmhubClient ¶
type CharmhubClient interface {
Refresh(ctx context.Context, config charmhub.RefreshConfig) ([]transport.RefreshResponse, error)
}
CharmhubClient represents a way for querying the charmhub api for information about the application charm.
type DeployApplicationParams ¶
type DeployApplicationParams struct { ApplicationName string Series string Charm *state.Charm CharmOrigin corecharm.Origin Channel csparams.Channel ApplicationConfig *application.Config CharmConfig charm.Settings Constraints constraints.Value NumUnits int // Placement is a list of placement directives which may be used // instead of a machine spec. Placement []*instance.Placement Storage map[string]storage.Constraints Devices map[string]devices.Constraints AttachStorage []names.StorageTag EndpointBindings map[string]string // Resources is a map of resource name to IDs of pending resources. Resources map[string]string // If set to true, any charm-specific requirements ("assumes" section) // will be ignored. Force bool }
DeployApplicationParams contains the arguments required to deploy the referenced charm.
type ExternalController ¶
type ExternalController state.ExternalController
type Generation ¶
type Machine ¶
type Machine interface { PublicAddress() (network.SpaceAddress, error) IsLockedForSeriesUpgrade() (bool, error) IsParentLockedForSeriesUpgrade() (bool, error) }
Machine defines a subset of the functionality provided by the state.Machine type, as required by the application facade. For details on the methods, see the methods on state.Machine with the same names.
type Model ¶
type Model interface { ModelTag() names.ModelTag Name() string Owner() names.UserTag Tag() names.Tag Type() state.ModelType UUID() string ModelConfig() (*config.Config, error) AgentVersion() (version.Number, error) OpenedPortRangesForMachine(string) (state.MachinePortRanges, error) // The following methods are required for querying the featureset // supported by the model. Config() (*config.Config, error) CloudName() string Cloud() (cloud.Cloud, error) CloudCredential() (state.Credential, bool, error) CloudRegion() string ControllerUUID() string }
Model defines a subset of the functionality provided by the state.Model type, as required by the application facade. For details on the methods, see the methods on state.Model with the same names.
type OfferConnection ¶
type OfferConnection interface{}
type Relation ¶
type Relation interface { status.StatusSetter Tag() names.Tag Destroy() error DestroyWithForce(bool, time.Duration) ([]error, error) Endpoints() []state.Endpoint RelatedEndpoints(applicationname string) ([]state.Endpoint, error) ApplicationSettings(appName string) (map[string]interface{}, error) AllRemoteUnits(appName string) ([]RelationUnit, error) Unit(string) (RelationUnit, error) Endpoint(string) (state.Endpoint, error) SetSuspended(bool, string) error Suspended() bool SuspendedReason() string }
Relation defines a subset of the functionality provided by the state.Relation type, as required by the application facade. For details on the methods, see the methods on state.Relation with the same names.
type RelationUnit ¶
type RemoteApplication ¶
type RemoteApplication interface { Name() string SourceModel() names.ModelTag Endpoints() ([]state.Endpoint, error) AddEndpoints(eps []charm.Relation) error Bindings() map[string]string Spaces() []state.RemoteSpace Destroy() error DestroyOperation(force bool) *state.DestroyRemoteApplicationOperation Status() (status.StatusInfo, error) Life() state.Life }
type Resources ¶
Resources defines a subset of the functionality provided by the state.Resources type, as required by the application facade. See the state.Resources type for details on the methods.
type Unit ¶
type Unit interface { Name() string Tag() names.Tag UnitTag() names.UnitTag ApplicationName() string Destroy() error DestroyOperation() *state.DestroyUnitOperation IsPrincipal() bool Life() state.Life Resolve(retryHooks bool) error AgentTools() (*tools.Tools, error) AssignedMachineId() (string, error) WorkloadVersion() (string, error) AssignWithPolicy(state.AssignmentPolicy) error AssignWithPlacement(*instance.Placement) error ContainerInfo() (state.CloudContainer, error) }
Unit defines a subset of the functionality provided by the state.Unit type, as required by the application facade. For details on the methods, see the methods on state.Unit with the same names.
type UpdateSeries ¶
type UpdateSeries interface { // UpdateSeries attempts to update an application series for deploying new // units. UpdateSeries(string, string, bool) error }
UpdateSeries defines an interface for interacting with updating a series.
type UpdateSeriesAPI ¶
type UpdateSeriesAPI struct {
// contains filtered or unexported fields
}
UpdateSeriesAPI provides the update series API facade for any given version. It is expected that any API parameter changes should be performed before entering the API.
func NewUpdateSeriesAPI ¶
func NewUpdateSeriesAPI( state UpdateSeriesState, validator UpdateSeriesValidator, ) *UpdateSeriesAPI
NewUpdateSeriesAPI creates a new UpdateSeriesAPI
func (*UpdateSeriesAPI) UpdateSeries ¶
func (a *UpdateSeriesAPI) UpdateSeries(tag, series string, force bool) error
type UpdateSeriesState ¶
type UpdateSeriesState interface { // Application returns a list of all the applications for a // given machine. This includes all the subordinates. Application(string) (Application, error) }
UpdateSeriesState defines a common set of functions for retrieving state objects.
type UpdateSeriesValidator ¶
type UpdateSeriesValidator interface { // ValidateApplication attempts to validate an application for // a given series. Using force to allow the overriding of the error to // ensure all application validate. // // I do question if you actually need to validate anything if force is // employed here? ValidateApplication(application Application, series string, force bool) error }
UpdateSeriesValidator defines an application validator.