Documentation
¶
Overview ¶
Package application contains API calls for functionality related to deploying and managing applications and their related charms.
Index ¶
- Variables
- func ConfigSchema() (configschema.Fields, schema.Defaults, error)
- func Register(registry facade.FacadeRegistry)
- func StateCharmOrigin(origin corecharm.Origin) (*state.CharmOrigin, error)
- type APIBase
- func (api *APIBase) AddRelation(ctx context.Context, args params.AddRelation) (_ params.AddRelationResults, err error)
- func (api *APIBase) AddUnits(ctx context.Context, args params.AddApplicationUnits) (params.AddApplicationUnitsResults, error)
- func (api *APIBase) ApplicationsInfo(ctx context.Context, in params.Entities) (params.ApplicationInfoResults, error)
- func (api *APIBase) CharmConfig(ctx context.Context, args params.ApplicationGetArgs) (params.ApplicationGetConfigResults, error)
- func (api *APIBase) CharmRelations(ctx context.Context, p params.ApplicationCharmRelations) (params.ApplicationCharmRelationsResults, error)
- func (api *APIBase) Consume(ctx context.Context, args params.ConsumeApplicationArgsV5) (params.ErrorResults, error)
- func (api *APIBase) Deploy(ctx context.Context, args params.ApplicationsDeploy) (params.ErrorResults, error)
- func (api *APIBase) DeployFromRepository(ctx context.Context, args params.DeployFromRepositoryArgs) (params.DeployFromRepositoryResults, error)
- func (api *APIBase) DestroyApplication(ctx context.Context, args params.DestroyApplicationsParams) (params.DestroyApplicationResults, error)
- func (api *APIBase) DestroyConsumedApplications(ctx context.Context, args params.DestroyConsumedApplicationsParams) (params.ErrorResults, error)
- func (api *APIBase) DestroyRelation(ctx context.Context, args params.DestroyRelation) (err error)
- func (api *APIBase) DestroyUnit(ctx context.Context, args params.DestroyUnitsParams) (params.DestroyUnitResults, error)
- func (api *APIBase) Expose(ctx context.Context, args params.ApplicationExpose) error
- func (api *APIBase) Get(ctx context.Context, args params.ApplicationGet) (params.ApplicationGetResults, error)
- func (api *APIBase) GetCharmURLOrigin(ctx context.Context, args params.ApplicationGet) (params.CharmURLOriginResult, error)
- func (api *APIBase) GetConfig(ctx context.Context, args params.Entities) (params.ApplicationGetConfigResults, error)
- func (api *APIBase) GetConstraints(ctx context.Context, args params.Entities) (params.ApplicationGetConstraintsResults, error)
- func (api *APIBase) Leader(ctx context.Context, entity params.Entity) (params.StringResult, error)
- func (api *APIBase) MergeBindings(ctx context.Context, in params.ApplicationMergeBindingsArgs) (params.ErrorResults, error)
- func (api *APIBase) ResolveUnitErrors(ctx context.Context, p params.UnitsResolved) (params.ErrorResults, error)
- func (api *APIBase) ScaleApplications(ctx context.Context, args params.ScaleApplicationsParams) (params.ScaleApplicationResults, error)
- func (api *APIBase) SetCharm(ctx context.Context, args params.ApplicationSetCharmV2) error
- func (api *APIBase) SetConfigs(ctx context.Context, args params.ConfigSetArgs) (params.ErrorResults, error)
- func (api *APIBase) SetConstraints(ctx context.Context, args params.SetConstraints) error
- func (api *APIBase) SetRelationsSuspended(ctx context.Context, args params.RelationSuspendedArgs) (params.ErrorResults, error)
- func (api *APIBase) Unexpose(ctx context.Context, args params.ApplicationUnexpose) error
- func (api *APIBase) UnitsInfo(ctx context.Context, in params.Entities) (params.UnitInfoResults, error)
- func (api *APIBase) UnsetApplicationsConfig(ctx context.Context, args params.ApplicationConfigUnsetArgs) (params.ErrorResults, error)
- type APIv19
- type APIv20
- type AgentTools
- type AgentVersioner
- type Application
- type ApplicationDeployer
- type ApplicationService
- type Backend
- type Bindings
- type BlockChecker
- type CaasBrokerInterface
- type Charm
- type CharmMeta
- type CredentialService
- type DeployApplicationFunc
- type DeployApplicationParams
- type DeployFromRepository
- type DeployFromRepositoryAPI
- type DeployFromRepositoryState
- type DeployFromRepositoryValidator
- type ExternalControllerService
- type Leadership
- type Machine
- type MachinePlacementBackend
- type MachineService
- type Model
- type ModelConfigService
- type ModelService
- type NetworkService
- type OfferConnection
- type PortService
- type RelationService
- type RemoteApplication
- type ResourceService
- type Services
- type StorageInterface
- type StorageService
- type StubService
- type Subnet
- type Unit
- type UnitAdder
Constants ¶
This section is empty.
Variables ¶
var ClassifyDetachedStorage = storagecommon.ClassifyDetachedStorage
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-model to upgrade the current model to match your controller.") )
Functions ¶
func ConfigSchema ¶
func ConfigSchema() (configschema.Fields, schema.Defaults, error)
ConfigSchema returns the config schema and defaults for an application.
func Register ¶
func Register(registry facade.FacadeRegistry)
Register is called to expose a package of facades onto a given registry.
func StateCharmOrigin ¶
func StateCharmOrigin(origin corecharm.Origin) (*state.CharmOrigin, error)
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.
func NewAPIBase ¶
func NewAPIBase( backend Backend, services Services, storageAccess StorageInterface, authorizer facade.Authorizer, blockChecker BlockChecker, model Model, modelInfo model.ModelInfo, leadershipReader Leadership, repoDeploy DeployFromRepository, deployApplication DeployApplicationFunc, registry storage.ProviderRegistry, resources facade.Resources, caasBroker CaasBrokerInterface, store objectstore.ObjectStore, logger corelogger.Logger, ) (*APIBase, error)
NewAPIBase returns a new application API facade.
func (*APIBase) AddRelation ¶
func (api *APIBase) AddRelation(ctx context.Context, 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(ctx context.Context, args params.AddApplicationUnits) (params.AddApplicationUnitsResults, error)
AddUnits adds a given number of units to an application.
func (*APIBase) ApplicationsInfo ¶
func (api *APIBase) ApplicationsInfo(ctx context.Context, in params.Entities) (params.ApplicationInfoResults, error)
ApplicationsInfo returns applications information.
func (*APIBase) CharmConfig ¶
func (api *APIBase) CharmConfig(ctx context.Context, args params.ApplicationGetArgs) (params.ApplicationGetConfigResults, error)
CharmConfig returns charm config for the input list of applications.
func (*APIBase) CharmRelations ¶
func (api *APIBase) CharmRelations(ctx context.Context, p params.ApplicationCharmRelations) (params.ApplicationCharmRelationsResults, error)
CharmRelations implements the server side of Application.CharmRelations.
func (*APIBase) Consume ¶
func (api *APIBase) Consume(ctx context.Context, args params.ConsumeApplicationArgsV5) (params.ErrorResults, error)
Consume adds remote applications to the model without creating any relations.
func (*APIBase) Deploy ¶
func (api *APIBase) Deploy(ctx context.Context, args params.ApplicationsDeploy) (params.ErrorResults, error)
Deploy fetches the charms from the charm store and deploys them using the specified placement directives.
func (*APIBase) DeployFromRepository ¶
func (api *APIBase) DeployFromRepository(ctx context.Context, args params.DeployFromRepositoryArgs) (params.DeployFromRepositoryResults, error)
DeployFromRepository is a one-stop deployment method for repository charms. Only a charm name is required to deploy. If argument validation fails, a list of all errors found in validation will be returned. If a local resource is provided, details required for uploading the validated resource will be returned.
func (*APIBase) DestroyApplication ¶
func (api *APIBase) DestroyApplication(ctx context.Context, args params.DestroyApplicationsParams) (params.DestroyApplicationResults, error)
DestroyApplication removes a given set of applications.
func (*APIBase) DestroyConsumedApplications ¶
func (api *APIBase) DestroyConsumedApplications(ctx context.Context, args params.DestroyConsumedApplicationsParams) (params.ErrorResults, error)
DestroyConsumedApplications removes a given set of consumed (remote) applications.
func (*APIBase) DestroyRelation ¶
DestroyRelation removes the relation between the specified endpoints or an id.
func (*APIBase) DestroyUnit ¶
func (api *APIBase) DestroyUnit(ctx context.Context, args params.DestroyUnitsParams) (params.DestroyUnitResults, error)
DestroyUnit removes a given set of application units.
func (*APIBase) Expose ¶
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(ctx context.Context, args params.ApplicationGet) (params.ApplicationGetResults, error)
Get returns the charm configuration for an application.
func (*APIBase) GetCharmURLOrigin ¶
func (api *APIBase) GetCharmURLOrigin(ctx context.Context, args params.ApplicationGet) (params.CharmURLOriginResult, error)
GetCharmURLOrigin returns the charm URL and charm origin the given application is running at present.
func (*APIBase) GetConfig ¶
func (api *APIBase) GetConfig(ctx context.Context, args params.Entities) (params.ApplicationGetConfigResults, error)
GetConfig returns the charm config for each of the input applications.
func (*APIBase) GetConstraints ¶
func (api *APIBase) GetConstraints(ctx context.Context, args params.Entities) (params.ApplicationGetConstraintsResults, error)
GetConstraints returns the constraints for a given application.
func (*APIBase) MergeBindings ¶
func (api *APIBase) MergeBindings(ctx context.Context, 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(ctx context.Context, p params.UnitsResolved) (params.ErrorResults, error)
ResolveUnitErrors marks errors on the specified units as resolved.
func (*APIBase) ScaleApplications ¶
func (api *APIBase) ScaleApplications(ctx context.Context, args params.ScaleApplicationsParams) (params.ScaleApplicationResults, error)
ScaleApplications scales the specified application to the requested number of units.
func (*APIBase) SetConfigs ¶
func (api *APIBase) SetConfigs(ctx context.Context, 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 ¶
SetConstraints sets the constraints for a given application.
func (*APIBase) SetRelationsSuspended ¶
func (api *APIBase) SetRelationsSuspended(ctx context.Context, args params.RelationSuspendedArgs) (params.ErrorResults, error)
SetRelationsSuspended sets the suspended status of the specified relations.
func (*APIBase) Unexpose ¶
Unexpose changes the juju-managed firewall to unexpose any ports that were also explicitly marked by units as open.
func (*APIBase) UnitsInfo ¶
func (api *APIBase) UnitsInfo(ctx context.Context, in params.Entities) (params.UnitInfoResults, error)
UnitsInfo returns unit information for the given entities (units or applications).
func (*APIBase) UnsetApplicationsConfig ¶
func (api *APIBase) UnsetApplicationsConfig(ctx context.Context, args params.ApplicationConfigUnsetArgs) (params.ErrorResults, error)
UnsetApplicationsConfig implements the server side of Application.UnsetApplicationsConfig.
type APIv19 ¶
type APIv19 struct {
*APIv20
}
APIv19 provides the Application API facade for version 19.
type APIv20 ¶
type APIv20 struct {
*APIBase
}
APIv20 provides the Application API facade for version 20.
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() (coreconfig.ConfigAttributes, error) ApplicationTag() names.ApplicationTag CharmURL() (*string, bool) CharmOrigin() *state.CharmOrigin ClearExposed() error CharmConfig() (charm.Settings, error) DestroyOperation(objectstore.ObjectStore) *state.DestroyApplicationOperation EndpointBindings() (Bindings, error) ExposedEndpoints() map[string]state.ExposedEndpoint Endpoints() ([]relation.Endpoint, error) IsExposed() bool IsPrincipal() bool IsRemote() bool SetCharm(state.SetCharmConfig, objectstore.ObjectStore) error SetConstraints(constraints.Value) error MergeExposeSettings(map[string]state.ExposedEndpoint) error UnsetExposeSettings([]string) error UpdateCharmConfig(charm.Settings) error UpdateApplicationConfig(coreconfig.ConfigAttributes, []string, configschema.Fields, schema.Defaults) error MergeBindings(*state.Bindings, bool) 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( ctx context.Context, st ApplicationDeployer, model Model, modelInfo coremodel.ModelInfo, applicationService ApplicationService, store objectstore.ObjectStore, args DeployApplicationParams, logger corelogger.Logger, ) (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, objectstore.ObjectStore) (Application, error) // ReadSequence is a stop gap to allow the next unit number to be read from mongo // so that correctly matching units can be written to dqlite. ReadSequence(name string) (int, error) }
type ApplicationService ¶
type ApplicationService interface { // CreateApplication creates the specified application and units if required. CreateApplication(ctx context.Context, name string, charm internalcharm.Charm, origin corecharm.Origin, params applicationservice.AddApplicationArgs, units ...applicationservice.AddUnitArg) (coreapplication.ID, error) // AddUnits adds units to the application. AddUnits(ctx context.Context, name string, units ...applicationservice.AddUnitArg) error // SetApplicationCharm sets a new charm for the application, validating that aspects such // as storage are still viable with the new charm. SetApplicationCharm(ctx context.Context, name string, params applicationservice.UpdateCharmParams) error // SetApplicationScale sets the application's desired scale value. // This is used on CAAS models. SetApplicationScale(ctx context.Context, name string, scale int) error // ChangeApplicationScale alters the existing scale by the provided change amount, returning the new amount. // This is used on CAAS models. ChangeApplicationScale(ctx context.Context, name string, scaleChange int) (int, error) // DestroyApplication prepares an application for removal from the model. DestroyApplication(ctx context.Context, name string) error // DeleteApplication deletes the specified application, // TODO(units) - remove when destroy is fully implemented. DeleteApplication(ctx context.Context, name string) error // DestroyUnit prepares a unit for removal from the model. DestroyUnit(context.Context, unit.Name) error // GetApplicationLife looks up the life of the specified application. GetApplicationLife(ctx context.Context, name string) (life.Value, error) // GetUnitLife looks up the life of the specified unit. GetUnitLife(context.Context, unit.Name) (life.Value, error) // GetUnitUUID returns the UUID for the named unit. GetUnitUUID(context.Context, unit.Name) (unit.UUID, error) // GetSupportedFeatures returns the set of features that the model makes // available for charms to use. GetSupportedFeatures(context.Context) (assumes.FeatureSet, error) // GetCharmLocatorByApplicationName returns a CharmLocator by application name. // It returns an error if the charm can not be found by the name. This can also // be used as a cheap way to see if a charm exists without needing to load the // charm metadata. GetCharmLocatorByApplicationName(ctx context.Context, name string) (applicationcharm.CharmLocator, error) // GetCharm returns the charm by name, source and revision. Calling this method // will return all the data associated with the charm. It is not expected to // call this method for all calls, instead use the move focused and specific // methods. That's because this method is very expensive to call. This is // implemented for the cases where all the charm data is needed; model // migration, charm export, etc. GetCharm(ctx context.Context, locator applicationcharm.CharmLocator) (internalcharm.Charm, applicationcharm.CharmLocator, bool, error) // GetCharmMetadata returns the metadata for the charm using the charm name, // source and revision. GetCharmMetadata(ctx context.Context, locator applicationcharm.CharmLocator) (internalcharm.Meta, error) // GetCharmConfig returns the config for the charm using the charm name, // source and revision. GetCharmConfig(ctx context.Context, locator applicationcharm.CharmLocator) (internalcharm.Config, error) // GetCharmMetadataName returns the name for the charm using the // charm name, source and revision. GetCharmMetadataName(ctx context.Context, locator applicationcharm.CharmLocator) (string, error) // GetCharmDownloadInfo returns the download info for the charm using the // charm name, source and revision. GetCharmDownloadInfo(ctx context.Context, locator applicationcharm.CharmLocator) (*applicationcharm.DownloadInfo, error) // IsCharmAvailable returns whether the charm is available for use. This // indicates if the charm has been uploaded to the controller. // This will return true if the charm is available, and false otherwise. IsCharmAvailable(ctx context.Context, locator applicationcharm.CharmLocator) (bool, error) // GetApplicationIDByName returns an application ID by application name. It // returns an error if the application can not be found by the name. // // Returns [applicationerrors.ApplicationNameNotValid] if the name is not valid, // and [applicationerrors.ApplicationNotFound] if the application is not found. GetApplicationIDByName(ctx context.Context, name string) (coreapplication.ID, error) // GetApplicationConstraints returns the application constraints for the // specified application ID. // Empty constraints are returned if no constraints exist for the given // application ID. // If no application is found, an error satisfying // [applicationerrors.ApplicationNotFound] is returned. GetApplicationConstraints(ctx context.Context, appID coreapplication.ID) (constraints.Value, error) // SetApplicationConstraints sets the application constraints for the // specified application ID. // This method overwrites the full constraints on every call. // If invalid constraints are provided (e.g. invalid container type or // non-existing space), a [applicationerrors.InvalidApplicationConstraints] // error is returned. // If no application is found, an error satisfying // [applicationerrors.ApplicationNotFound] is returned. SetApplicationConstraints(ctx context.Context, appID coreapplication.ID, cons constraints.Value) error }
ApplicationService instances save an application to dqlite state.
type Backend ¶
type Backend interface { Application(string) (Application, error) ApplyOperation(state.ModelOperation) error AddApplication(state.AddApplicationArgs, objectstore.ObjectStore) (Application, error) RemoteApplication(string) (RemoteApplication, error) AddRemoteApplication(state.AddRemoteApplicationParams) (RemoteApplication, error) Machine(string) (Machine, error) Unit(string) (Unit, error) UnitsInError() ([]Unit, error) ControllerTag() names.ControllerTag // ReadSequence is a stop gap to allow the next unit number to be read from mongo // so that correctly matching units can be written to dqlite. ReadSequence(name string) (int, error) }
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 ¶
type BlockChecker interface { ChangeAllowed(context.Context) error RemoveAllowed(context.Context) error }
BlockChecker defines the block-checking functionality required by the application facade. This is implemented by apiserver/common.BlockChecker.
type CaasBrokerInterface ¶
type Charm ¶
type Charm interface { CharmMeta Config() *charm.Config Actions() *charm.Actions Revision() int URL() string Version() 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 CredentialService ¶
type CredentialService interface { // CloudCredential returns the cloud credential for the given tag. CloudCredential(ctx context.Context, key credential.Key) (cloud.Credential, error) // WatchCredential returns a watcher that observes changes to the specified // credential. WatchCredential(ctx context.Context, key credential.Key) (watcher.NotifyWatcher, error) }
CredentialService provides access to credentials.
type DeployApplicationFunc ¶
type DeployApplicationFunc = func( context.Context, ApplicationDeployer, Model, model.ModelInfo, ApplicationService, objectstore.ObjectStore, DeployApplicationParams, corelogger.Logger, ) (Application, error)
DeployApplicationFunc is a function that deploys an application.
type DeployApplicationParams ¶
type DeployApplicationParams struct { ApplicationName string Charm Charm CharmOrigin corecharm.Origin ApplicationConfig *config.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.Directive 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 DeployFromRepository ¶
type DeployFromRepository interface {
DeployFromRepository(context.Context, params.DeployFromRepositoryArg) (params.DeployFromRepositoryInfo, []*params.PendingResourceUpload, []error)
}
DeployFromRepository defines an interface for deploying a charm from a repository.
func NewDeployFromRepositoryAPI ¶
func NewDeployFromRepositoryAPI( state DeployFromRepositoryState, applicationService ApplicationService, store objectstore.ObjectStore, validator DeployFromRepositoryValidator, logger corelogger.Logger, ) DeployFromRepository
NewDeployFromRepositoryAPI creates a new DeployFromRepositoryAPI.
type DeployFromRepositoryAPI ¶
type DeployFromRepositoryAPI struct {
// contains filtered or unexported fields
}
DeployFromRepositoryAPI provides the deploy from repository API facade for any given version. It is expected that any API parameter changes should be performed before entering the API.
func (*DeployFromRepositoryAPI) DeployFromRepository ¶
func (api *DeployFromRepositoryAPI) DeployFromRepository(ctx context.Context, arg params.DeployFromRepositoryArg) (params.DeployFromRepositoryInfo, []*params.PendingResourceUpload, []error)
type DeployFromRepositoryState ¶
type DeployFromRepositoryState interface { AddApplication(state.AddApplicationArgs, objectstore.ObjectStore) (Application, error) Machine(string) (Machine, error) ReadSequence(name string) (int, error) }
DeployFromRepositoryState defines a common set of functions for retrieving state objects.
type DeployFromRepositoryValidator ¶
type DeployFromRepositoryValidator interface {
ValidateArg(context.Context, params.DeployFromRepositoryArg) (deployTemplate, []error)
}
DeployFromRepositoryValidator defines an deploy config validator.
type ExternalControllerService ¶
type ExternalControllerService interface { // UpdateExternalController persists the input controller // record. UpdateExternalController(ctx context.Context, ec crossmodel.ControllerInfo) error }
ExternalControllerService provides a subset of the external controller domain service methods.
type Leadership ¶
type Leadership interface { // Leaders returns all application leaders in the current model. // TODO (manadart 2019-02-27): The return in this signature includes error // in order to support state.ApplicationLeaders for legacy leases. // When legacy leases are removed, so can the error return. Leaders() (map[string]string, error) }
Leadership describes the capability to read the current state of leadership.
type Machine ¶
type Machine interface { Base() state.Base Id() string PublicAddress() (network.SpaceAddress, 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 MachinePlacementBackend ¶
type MachineService ¶
type MachineService interface { // CreateMachine creates the specified machine. CreateMachine(context.Context, machine.Name) (string, error) // GetMachineUUID returns the UUID of a machine identified by its name. GetMachineUUID(ctx context.Context, name machine.Name) (string, error) // HardwareCharacteristics returns the hardware characteristics of the // specified machine. HardwareCharacteristics(ctx context.Context, machineUUID string) (*instance.HardwareCharacteristics, error) }
MachineService defines the methods that the facade assumes from the Machine service.
type Model ¶
type Model interface { ModelTag() names.ModelTag Type() state.ModelType // The following methods are required for querying the featureset // supported by the model. CloudName() string CloudCredentialTag() (names.CloudCredentialTag, bool) 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 ModelConfigService ¶
type ModelConfigService interface { // ModelConfig returns the current config for the model. ModelConfig(context.Context) (*config.Config, error) }
ModelConfigService provides access to the model configuration.
type ModelService ¶
type ModelService interface { // GetSupportedFeatures returns the set of features that the model makes // available for charms to use. GetSupportedFeatures(ctx context.Context) (coreassumes.FeatureSet, error) }
ModelService provides access to the model state.
type NetworkService ¶
type NetworkService interface { // Space returns a space from state that matches the input ID. // An error is returned if the space does not exist or if there was a problem // accessing its information. Space(ctx context.Context, uuid string) (*network.SpaceInfo, error) // SpaceByName returns a space from state that matches the input name. // An error is returned that satisfied errors.NotFound if the space was not found // or an error static any problems fetching the given space. SpaceByName(ctx context.Context, name string) (*network.SpaceInfo, error) // GetAllSpaces returns all spaces for the model. GetAllSpaces(ctx context.Context) (network.SpaceInfos, error) }
NetworkService is the interface that is used to interact with the network spaces/subnets.
type OfferConnection ¶
type PortService ¶
type PortService interface { // GetUnitOpenedPorts returns the opened ports for a given unit uuid, // grouped by endpoint. GetUnitOpenedPorts(ctx context.Context, unitUUID unit.UUID) (network.GroupedPortRanges, error) }
PortService defines the methods that the facade assumes from the Port service.
type RelationService ¶
type RelationService interface { // AddRelation takes two endpoint identifiers of the form // <application>[:<endpoint>]. The identifiers will be used to infer two // endpoint between applications on the model. A new relation will be created // between these endpoints and the details of the endpoint returned. // // If the identifiers do not uniquely specify a relation, an error will be // returned. AddRelation(ctx context.Context, ep1, ep2 string) (relation.Endpoint, relation.Endpoint, error) // ApplicationRelationsInfo returns all EndpointRelationData for an application. ApplicationRelationsInfo(ctx context.Context, applicationID coreapplication.ID) ([]relation.EndpointRelationData, error) }
RelationService defines operations for managing relations between application endpoints.
type RemoteApplication ¶
type RemoteApplication interface { Name() string SourceModel() names.ModelTag Endpoints() ([]relation.Endpoint, error) AddEndpoints(eps []charm.Relation) error Destroy() error DestroyOperation(force bool) *state.DestroyRemoteApplicationOperation Status() (status.StatusInfo, error) Life() state.Life }
type ResourceService ¶
type ResourceService interface {
DeleteResourcesAddedBeforeApplication(ctx context.Context, resources []coreresource.UUID) error
}
ResourceService defines the methods that the facade assumes from the Resource service.
type Services ¶
type Services struct { ApplicationService ApplicationService ExternalControllerService ExternalControllerService MachineService MachineService ModelConfigService ModelConfigService NetworkService NetworkService PortService PortService RelationService RelationService ResourceService ResourceService StorageService StorageService StubService StubService }
Services represents all the services that the application facade requires.
type StorageInterface ¶
type StorageInterface interface { storagecommon.StorageAccess VolumeAccess() storagecommon.VolumeAccess FilesystemAccess() storagecommon.FilesystemAccess }
type StorageService ¶
type StorageService interface { // GetStoragePoolByName returns the storage pool with the specified name. GetStoragePoolByName(ctx context.Context, name string) (*storage.Config, error) }
StorageService instances get a storage pool by name.
type StubService ¶
type StubService interface { // AssignUnitsToMachines assigns the given units to the given machines but setting // unit net node to the machine net node. // // Deprecated: AssignUnitsToMachines will become redundant once the machine and // application domains have become fully implemented. AssignUnitsToMachines(context.Context, map[string][]unit.Name) error }
StubService is the interface used to interact with the stub service. A special service which collects temporary methods required to wire together together domains which are not completely implemented or wired up.
TODO: Remove this dependency once units are properly assigned to machines via net nodes.
type Unit ¶
type Unit interface { Name() string Tag() names.Tag UnitTag() names.UnitTag ApplicationName() string Destroy(objectstore.ObjectStore) error DestroyOperation(objectstore.ObjectStore) *state.DestroyUnitOperation IsPrincipal() bool Resolve(retryHooks bool) error AgentTools() (*tools.Tools, error) AssignedMachineId() (string, error) WorkloadVersion() (string, error) AssignUnit() error AssignWithPlacement(*instance.Placement, network.SpaceInfos) 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.