Documentation ¶
Overview ¶
Package application contains api calls for functionality related to deploying and managing applications and their related charms.
Index ¶
- Variables
- func AddCharmWithAuthorization(st *state.State, args params.AddCharmWithAuthorization) error
- func ApplicationSetSettingsStrings(application Application, settings map[string]string) error
- func CharmToStateCharm(ch Charm) *state.Charm
- func DeployApplication(backend Backend, args jjj.DeployApplicationParams) error
- func ResolveCharms(st *state.State, args params.ResolveCharms) (params.ResolveCharmResults, error)
- func StoreCharmArchive(st *state.State, archive CharmArchive) error
- type API
- func (api *API) AddRelation(args params.AddRelation) (params.AddRelationResults, error)
- func (api *API) AddUnits(args params.AddApplicationUnits) (params.AddApplicationUnitsResults, error)
- func (api *API) CharmRelations(p params.ApplicationCharmRelations) (params.ApplicationCharmRelationsResults, error)
- func (api *API) Consume(args params.ConsumeApplicationArgs) (params.ConsumeApplicationResults, error)
- func (api *API) Deploy(args params.ApplicationsDeploy) (params.ErrorResults, error)
- func (api *API) Destroy(args params.ApplicationDestroy) error
- func (api *API) DestroyApplication(args params.Entities) (params.DestroyApplicationResults, error)
- func (api *API) DestroyRelation(args params.DestroyRelation) error
- func (api *API) DestroyUnit(args params.Entities) (params.DestroyUnitResults, error)
- func (api *API) DestroyUnits(args params.DestroyApplicationUnits) error
- func (api *API) Expose(args params.ApplicationExpose) error
- func (api *API) Get(args params.ApplicationGet) (params.ApplicationGetResults, error)
- func (api *API) GetCharmURL(args params.ApplicationGet) (params.StringResult, error)
- func (api *API) GetConstraints(args params.GetApplicationConstraints) (params.GetConstraintsResults, error)
- func (api *API) RemoteApplicationInfo(args params.ApplicationURLs) (params.RemoteApplicationInfoResults, error)
- func (api *API) Set(p params.ApplicationSet) error
- func (api *API) SetCharm(args params.ApplicationSetCharm) error
- func (api *API) SetConstraints(args params.SetConstraints) error
- func (api *API) SetMetricCredentials(args params.ApplicationMetricCredentials) (params.ErrorResults, error)
- func (api *API) Unexpose(args params.ApplicationUnexpose) error
- func (api *API) Unset(p params.ApplicationUnset) error
- func (api *API) Update(args params.ApplicationUpdate) error
- type Application
- type Backend
- type BlockChecker
- type Charm
- type CharmArchive
- type Machine
- type Model
- type Relation
- type Unit
Constants ¶
This section is empty.
Variables ¶
var NewCharmStoreRepo = newCharmStoreFromClient
TODO - we really want to avoid this, which we can do by refactoring code requiring this to use interfaces. NewCharmStoreRepo instantiates a new charm store repository. It is exported for testing purposes.
Functions ¶
func AddCharmWithAuthorization ¶
func AddCharmWithAuthorization(st *state.State, args params.AddCharmWithAuthorization) error
AddCharmWithAuthorization adds the given charm URL (which must include revision) to the environment, if it does not exist yet. Local charms are not supported, only charm store URLs. See also AddLocalCharm().
The authorization macaroon, args.CharmStoreMacaroon, may be omitted, in which case this call is equivalent to AddCharm.
func ApplicationSetSettingsStrings ¶
func ApplicationSetSettingsStrings(application Application, settings map[string]string) error
ApplicationSetSettingsStrings updates the settings for the given application, taking the configuration from a map of strings.
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 DeployApplication ¶
func DeployApplication(backend Backend, args jjj.DeployApplicationParams) error
DeployApplication is a wrapper around juju.DeployApplication, to match the function signature expected by NewAPI.
func ResolveCharms ¶
func ResolveCharms(st *state.State, args params.ResolveCharms) (params.ResolveCharmResults, error)
ResolveCharm resolves the best available charm URLs with series, for charm locations without a series specified.
func StoreCharmArchive ¶
func StoreCharmArchive(st *state.State, archive CharmArchive) error
StoreCharmArchive stores a charm archive in environment storage.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API implements the application interface and is the concrete implementation of the api end point.
func NewAPI ¶
func NewAPI( backend Backend, authorizer facade.Authorizer, resources facade.Resources, statePool *state.StatePool, blockChecker BlockChecker, stateCharm func(Charm) *state.Charm, deployApplication func(Backend, jjj.DeployApplicationParams) error, ) (*API, error)
NewAPI returns a new application API facade.
func (*API) AddRelation ¶
func (api *API) AddRelation(args params.AddRelation) (params.AddRelationResults, error)
AddRelation adds a relation between the specified endpoints and returns the relation info.
func (*API) AddUnits ¶
func (api *API) AddUnits(args params.AddApplicationUnits) (params.AddApplicationUnitsResults, error)
AddUnits adds a given number of units to an application.
func (*API) CharmRelations ¶
func (api *API) CharmRelations(p params.ApplicationCharmRelations) (params.ApplicationCharmRelationsResults, error)
CharmRelations implements the server side of Application.CharmRelations.
func (*API) Consume ¶
func (api *API) Consume(args params.ConsumeApplicationArgs) (params.ConsumeApplicationResults, error)
Consume adds remote applications to the model without creating any relations.
func (*API) Deploy ¶
func (api *API) Deploy(args params.ApplicationsDeploy) (params.ErrorResults, error)
Deploy fetches the charms from the charm store and deploys them using the specified placement directives.
func (*API) Destroy ¶
func (api *API) Destroy(args 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.
TODO(axw) 2017-03-16 #1673323 Drop this in Juju 3.0.
func (*API) DestroyApplication ¶
DestroyApplication removes a given set of applications.
func (*API) DestroyRelation ¶
func (api *API) DestroyRelation(args params.DestroyRelation) error
DestroyRelation removes the relation between the specified endpoints.
func (*API) DestroyUnit ¶
DestroyUnit removes a given set of application units.
func (*API) DestroyUnits ¶
func (api *API) 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.
TODO(axw) 2017-03-16 #1673323 Drop this in Juju 3.0.
func (*API) Expose ¶
func (api *API) 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 (*API) Get ¶
func (api *API) Get(args params.ApplicationGet) (params.ApplicationGetResults, error)
Get returns the configuration for a service.
func (*API) GetCharmURL ¶
func (api *API) GetCharmURL(args params.ApplicationGet) (params.StringResult, error)
GetCharmURL returns the charm URL the given application is running at present.
func (*API) GetConstraints ¶
func (api *API) GetConstraints(args params.GetApplicationConstraints) (params.GetConstraintsResults, error)
GetConstraints returns the constraints for a given application.
func (*API) RemoteApplicationInfo ¶
func (api *API) RemoteApplicationInfo(args params.ApplicationURLs) (params.RemoteApplicationInfoResults, error)
RemoteApplicationInfo returns information about the requested remote application.
func (*API) Set ¶
func (api *API) Set(p params.ApplicationSet) error
Set implements the server side of Application.Set. It does not unset values that are set to an empty string. Unset should be used for that.
func (*API) SetCharm ¶
func (api *API) SetCharm(args params.ApplicationSetCharm) error
SetCharm sets the charm for a given for the application.
func (*API) SetConstraints ¶
func (api *API) SetConstraints(args params.SetConstraints) error
SetConstraints sets the constraints for a given application.
func (*API) SetMetricCredentials ¶
func (api *API) SetMetricCredentials(args params.ApplicationMetricCredentials) (params.ErrorResults, error)
SetMetricCredentials sets credentials on the application.
func (*API) Unexpose ¶
func (api *API) Unexpose(args params.ApplicationUnexpose) error
Unexpose changes the juju-managed firewall to unexpose any ports that were also explicitly marked by units as open.
type Application ¶
type Application interface { AddUnit() (*state.Unit, error) AllUnits() ([]Unit, error) Charm() (Charm, bool, error) CharmURL() (*charm.URL, bool) Channel() csparams.Channel ClearExposed() error ConfigSettings() (charm.Settings, error) Constraints() (constraints.Value, error) Destroy() error Endpoints() ([]state.Endpoint, error) IsPrincipal() bool Series() string SetCharm(state.SetCharmConfig) error SetConstraints(constraints.Value) error SetExposed() error SetMetricCredentials([]byte) error SetMinUnits(int) error UpdateConfigSettings(charm.Settings) 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.
type Backend ¶
type Backend interface { AllModels() ([]Model, error) Application(string) (Application, error) AddApplication(state.AddApplicationArgs) (*state.Application, error) RemoteApplication(name string) (*state.RemoteApplication, error) AddRemoteApplication(args state.AddRemoteApplicationParams) (*state.RemoteApplication, error) AddRelation(...state.Endpoint) (Relation, error) AssignUnit(*state.Unit, state.AssignmentPolicy) error AssignUnitWithPlacement(*state.Unit, *instance.Placement) error Charm(*charm.URL) (Charm, error) EndpointsRelation(...state.Endpoint) (Relation, error) InferEndpoints(...string) ([]state.Endpoint, error) Machine(string) (Machine, error) ModelTag() names.ModelTag Unit(string) (Unit, error) NewStorage() storage.Storage StorageInstance(names.StorageTag) (state.StorageInstance, error) UnitStorageAttachments(names.UnitTag) ([]state.StorageAttachment, 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.
func NewStateBackend ¶
NewStateBackend converts a state.State into a Backend.
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
StoragePath() 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 CharmArchive ¶
type CharmArchive struct { // ID is the charm URL for which we're storing the archive. ID *charm.URL // Charm is the metadata about the charm for the archive. Charm charm.Charm // Data contains the bytes of the archive. Data io.Reader // Size is the number of bytes in Data. Size int64 // SHA256 is the hash of the bytes in Data. SHA256 string // Macaroon is the authorization macaroon for accessing the charmstore. Macaroon macaroon.Slice }
CharmArchive is the data that needs to be stored for a charm archive in state.
type Machine ¶
type Machine interface { }
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 { Tag() names.Tag Name() string Owner() names.UserTag }
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 Relation ¶
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 Unit ¶
type Unit interface { UnitTag() names.UnitTag Destroy() error IsPrincipal() bool Life() state.Life }
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.