Documentation ¶
Index ¶
- Variables
- func NewUnitMatcher(patterns []string) (unitMatcher, error)
- func Register(registry facade.FacadeRegistry)
- func SkipReplicaCheck(patcher Patcher)
- func UnitChainPredicateFn(predicate Predicate, getUnit func(string) *state.Unit) func(*state.Unit) (bool, error)
- type API
- type Application
- type Backend
- type Client
- func (c *Client) FindTools(args params.FindToolsParams) (params.FindToolsResult, error)
- func (c *Client) FullStatus(args params.StatusParams) (params.FullStatus, error)
- func (c *Client) StatusHistory(request params.StatusHistoryRequests) params.StatusHistoryResults
- func (c *Client) WatchAll() (params.AllWatcherId, error)
- type ClientV6
- type Model
- type MongoSession
- type MongoSessionShim
- type Patcher
- type Pool
- type Predicate
- type StorageInterface
- type Unit
Constants ¶
This section is empty.
Variables ¶
var InvalidFormatErr = errors.Errorf("the given filter did not match any known patterns.")
Functions ¶
func NewUnitMatcher ¶
NewUnitMatcher returns a unitMatcher that matches units with one of the specified patterns, or all units if no patterns are specified.
An error will be returned if any of the specified patterns is invalid. Patterns are valid if they contain only alpha-numeric characters, hyphens, or asterisks (and one optional '/' to separate service/unit).
func Register ¶
func Register(registry facade.FacadeRegistry)
Register is called to expose a package of facades onto a given registry.
func SkipReplicaCheck ¶
func SkipReplicaCheck(patcher Patcher)
SkipReplicaCheck is required for tests only as the test mongo isn't a replica.
func UnitChainPredicateFn ¶
func UnitChainPredicateFn( predicate Predicate, getUnit func(string) *state.Unit, ) func(*state.Unit) (bool, error)
UnitChainPredicateFn builds a function which runs the given predicate over a unit and all of its subordinates. If one unit in the chain matches, the entire chain matches.
Types ¶
type Application ¶
type Application interface {
StatusHistory(status.StatusHistoryFilter) ([]status.StatusInfo, error)
}
Application represents a state.Application.
type Backend ¶
type Backend interface { network.SpaceLookup AbortCurrentUpgrade() error AddControllerUser(state.UserAccessSpec) (permission.UserAccess, error) AddMachineInsideMachine(state.MachineTemplate, string, instance.ContainerType) (*state.Machine, error) AddMachineInsideNewMachine(template, parentTemplate state.MachineTemplate, containerType instance.ContainerType) (*state.Machine, error) AddOneMachine(state.MachineTemplate) (*state.Machine, error) AddRelation(...state.Endpoint) (*state.Relation, error) AllApplications() ([]*state.Application, error) AllApplicationOffers() ([]*crossmodel.ApplicationOffer, error) AllRemoteApplications() ([]*state.RemoteApplication, error) AllMachines() ([]*state.Machine, error) AllModelUUIDs() ([]string, error) AllIPAddresses() ([]*state.Address, error) AllLinkLayerDevices() ([]*state.LinkLayerDevice, error) AllRelations() ([]*state.Relation, error) AllSubnets() ([]*state.Subnet, error) Annotations(state.GlobalEntity) (map[string]string, error) APIHostPortsForClients() ([]network.SpaceHostPorts, error) Application(string) (Application, error) Charm(string) (*state.Charm, error) ControllerConfig() (controller.Config, error) ControllerNodes() ([]state.ControllerNode, error) ControllerTag() names.ControllerTag ControllerTimestamp() (*time.Time, error) EndpointsRelation(...state.Endpoint) (*state.Relation, error) FindEntity(names.Tag) (state.Entity, error) InferEndpoints(...string) ([]state.Endpoint, error) IsController() bool HAPrimaryMachine() (names.MachineTag, error) LatestMigration() (state.ModelMigration, error) LatestPlaceholderCharm(*charm.URL) (*state.Charm, error) Machine(string) (*state.Machine, error) Model() (Model, error) ModelConfig() (*config.Config, error) ModelConstraints() (constraints.Value, error) ModelTag() names.ModelTag ModelUUID() string MongoSession() MongoSession RemoteApplication(string) (*state.RemoteApplication, error) RemoteConnectionStatus(string) (*state.RemoteConnectionStatus, error) RemoveUserAccess(names.UserTag, names.Tag) error SetAnnotations(state.GlobalEntity, map[string]string) error SetModelAgentVersion(version.Number, *string, bool) error SetModelConstraints(constraints.Value) error Unit(string) (Unit, error) UpdateModelConfig(map[string]interface{}, []string, ...state.ValidateConfigFunc) error }
Backend contains the state.State methods used in this package, allowing stubs to be created for testing.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client serves client-specific API methods.
func NewClient ¶
func NewClient( backend Backend, pool Pool, storageAccessor StorageInterface, resources facade.Resources, authorizer facade.Authorizer, presence facade.Presence, toolsFinder common.ToolsFinder, newEnviron common.NewEnvironFunc, blockChecker *common.BlockChecker, callCtx context.ProviderCallContext, leadershipReader leadership.Reader, modelCache *cache.Model, factory multiwatcher.Factory, registryAPIFunc func(docker.ImageRepoDetails) (registry.Registry, error), ) (*Client, error)
NewClient creates a new instance of the Client Facade.
func NewFacade ¶
NewFacade creates a Client facade to handle API requests. Changes: - FindTools deals with CAAS models now;
func (*Client) FindTools ¶
func (c *Client) FindTools(args params.FindToolsParams) (params.FindToolsResult, error)
FindTools returns a List containing all tools matching the given parameters. TODO(juju 3.1) - remove, used by 2.9 client only
func (*Client) FullStatus ¶
func (c *Client) FullStatus(args params.StatusParams) (params.FullStatus, error)
FullStatus gives the information needed for juju status over the api
func (*Client) StatusHistory ¶
func (c *Client) StatusHistory(request params.StatusHistoryRequests) params.StatusHistoryResults
StatusHistory returns a slice of past statuses for several entities.
type ClientV6 ¶
type ClientV6 struct {
*Client
}
ClientV6 serves the (v6) client-specific API methods.
func (*ClientV6) FullStatus ¶
func (c *ClientV6) FullStatus(args params.StatusParams) (params.FullStatus, error)
FullStatus gives the information needed for juju status over the api
type Model ¶
type Model interface { Name() string Type() state.ModelType UUID() string Life() state.Life CloudName() string CloudRegion() string CloudCredentialTag() (names.CloudCredentialTag, bool) Config() (*config.Config, error) Owner() names.UserTag AddUser(state.UserAccessSpec) (permission.UserAccess, error) Users() ([]permission.UserAccess, error) StatusHistory(status.StatusHistoryFilter) ([]status.StatusInfo, error) SLAOwner() string SLALevel() string LatestToolsVersion() version.Number MeterStatus() state.MeterStatus Status() (status.StatusInfo, error) }
Model contains the state.Model methods used in this package.
type MongoSession ¶
type MongoSession interface {
CurrentStatus() (*replicaset.Status, error)
}
MongoSession provides a way to get the status for the mongo replicaset.
type MongoSessionShim ¶
type MongoSessionShim struct {
*mgo.Session
}
MongoSessionShim wraps a *mgo.Session to conform to the MongoSession interface.
func (MongoSessionShim) CurrentStatus ¶
func (s MongoSessionShim) CurrentStatus() (*replicaset.Status, error)
CurrentStatus returns the current status of the replicaset.
type Patcher ¶
type Patcher interface {
PatchValue(dest, value interface{})
}
Patcher is provided by the test suites to temporarily change values.
type Pool ¶
type Pool interface { GetModel(string) (*state.Model, func(), error) SystemState() (*state.State, error) }
Pool contains the StatePool functionality used in this package.
type Predicate ¶
Predicate is a function that when given a unit, machine, or service, will determine whether the unit meets some criteria.
func BuildPredicateFor ¶
BuildPredicate returns a Predicate which will evaluate a machine, service, or unit against the given patterns.
type StorageInterface ¶
type StorageInterface interface { storagecommon.StorageAccess storagecommon.VolumeAccess storagecommon.FilesystemAccess AllStorageInstances() ([]state.StorageInstance, error) AllFilesystems() ([]state.Filesystem, error) AllVolumes() ([]state.Volume, error) StorageAttachments(names.StorageTag) ([]state.StorageAttachment, error) FilesystemAttachments(names.FilesystemTag) ([]state.FilesystemAttachment, error) VolumeAttachments(names.VolumeTag) ([]state.VolumeAttachment, error) }
type Unit ¶
type Unit interface { status.StatusHistoryGetter Life() state.Life Destroy() (err error) IsPrincipal() bool PublicAddress() (network.SpaceAddress, error) PrivateAddress() (network.SpaceAddress, error) Resolve(retryHooks bool) error AgentHistory() status.StatusHistoryGetter }
Unit represents a state.Unit.