Documentation
¶
Index ¶
- Variables
- func DestroyEnvironment(st *state.State, environTag names.EnvironTag) error
- func EntityStatusFromState(status state.StatusInfo) params.EntityStatus
- func IsNoAddressSetError(err error) bool
- func IsUnknownEnviromentError(err error) bool
- func NewToolsURLGetter(envUUID string, a APIHostPortsGetter) *toolsURLGetter
- func NoAddressSetError(unitTag names.UnitTag, addressName string) error
- func NotSupportedError(tag names.Tag, operation string) error
- func RegisterFacade(name string, version int, factory FacadeFactory, facadeType reflect.Type)
- func RegisterFacadeForFeature(name string, version int, factory FacadeFactory, facadeType reflect.Type, ...)
- func RegisterStandardFacade(name string, version int, newFunc interface{})
- func RegisterStandardFacadeForFeature(name string, version int, newFunc interface{}, feature string)
- func ServerError(err error) *params.Error
- func StateJobs(jobs []multiwatcher.MachineJob) ([]state.MachineJob, error)
- func ToolsURL(serverRoot string, v version.Binary) string
- func UnknownEnvironmentError(uuid string) error
- type APIAddresser
- func (api *APIAddresser) APIAddresses() (params.StringsResult, error)
- func (api *APIAddresser) APIHostPorts() (params.APIHostPortsResult, error)
- func (a *APIAddresser) CACert() params.BytesResult
- func (a *APIAddresser) EnvironUUID() params.StringResult
- func (api *APIAddresser) WatchAPIHostPorts() (params.NotifyWatchResult, error)
- type APIHostPortsGetter
- type AddressAndCertGetter
- type AgentEntityWatcher
- type AuthFunc
- type Authorizer
- type BackingSpace
- type BackingSubnet
- type BackingSubnetInfo
- type BlockChecker
- type BlockGetter
- type DeadEnsurer
- type EnvironConfigGetter
- type EnvironMachinesWatcher
- type EnvironWatcher
- type FacadeDescription
- type FacadeFactory
- type FacadeRegistry
- func (f *FacadeRegistry) Discard(name string, version int)
- func (f *FacadeRegistry) GetFactory(name string, version int) (FacadeFactory, error)
- func (f *FacadeRegistry) GetType(name string, version int) (reflect.Type, error)
- func (f *FacadeRegistry) List() []FacadeDescription
- func (f *FacadeRegistry) Register(name string, version int, factory FacadeFactory, facadeType reflect.Type, ...) error
- type GetAuthFunc
- type InstanceIdGetter
- type LifeGetter
- type MultiNotifyWatcher
- type NetworkBacking
- type PasswordChanger
- type RebootActionGetter
- type RebootFlagClearer
- type RebootRequester
- type Remover
- type Resource
- type Resources
- type ServiceStatusGetter
- type ServiceStatusSetter
- type StateAddresser
- type StatusGetter
- type StatusSetter
- type StringResource
- type ToolsFinder
- type ToolsGetter
- type ToolsSetter
- type ToolsStorageGetter
- type ToolsURLGetter
- type UnitsWatcher
Constants ¶
This section is empty.
Variables ¶
var ( ErrBadId = stderrors.New("id not found") ErrBadCreds = stderrors.New("invalid entity name or password") ErrPerm = stderrors.New("permission denied") ErrNotLoggedIn = stderrors.New("not logged in") ErrUnknownWatcher = stderrors.New("unknown watcher id") ErrUnknownPinger = stderrors.New("unknown pinger id") ErrStoppedWatcher = stderrors.New("watcher has been stopped") ErrBadRequest = stderrors.New("invalid request") ErrTryAgain = stderrors.New("try again") ErrActionNotAvailable = stderrors.New("action no longer available") ErrOperationBlocked = func(msg string) *params.Error { if msg == "" { msg = "The operation has been blocked." } return ¶ms.Error{ Code: params.CodeOperationBlocked, Message: msg, } } )
var ErrIsNotLeader = errors.Errorf("this unit is not the leader")
ErrIsNotLeader is an error for operations that require for a unit to be the leader but it was not the case. TODO(fwereade) why do we have an alternative implementation of ErrPerm that is exported (implying people will be able to meaningfully check it) but not actually handled anywhere or converted into an error code by the api server?
var Facades = &FacadeRegistry{}
Facades is the registry that tracks all of the Facades that will be exposed in the API. It can be used to List/Get/Register facades. Most implementers of a facade will probably want to use RegisterStandardFacade rather than Facades.Register, as it provides much cleaner syntax and semantics for calling during init().
Functions ¶
func DestroyEnvironment ¶
func DestroyEnvironment(st *state.State, environTag names.EnvironTag) error
DestroyEnvironment destroys all services and non-manager machine instances in the specified environment. This function assumes that all necessary authentication checks have been done.
func EntityStatusFromState ¶
func EntityStatusFromState(status state.StatusInfo) params.EntityStatus
EntityStatusFromState converts a state.StatusInfo into a params.EntityStatus.
func IsNoAddressSetError ¶
func NewToolsURLGetter ¶
func NewToolsURLGetter(envUUID string, a APIHostPortsGetter) *toolsURLGetter
NewToolsURLGetter creates a new ToolsURLGetter that returns tools URLs pointing at an API server.
func RegisterFacade ¶
func RegisterFacade(name string, version int, factory FacadeFactory, facadeType reflect.Type)
RegisterFacade updates the global facade registry with a new version of a new type.
func RegisterFacadeForFeature ¶
func RegisterFacadeForFeature(name string, version int, factory FacadeFactory, facadeType reflect.Type, feature string)
RegisterFacadeForFeature updates the global facade registry with a new version of a new type. If the feature is non-empty, this facade is only available when the specified feature flag is set.
func RegisterStandardFacade ¶
RegisterStandardFacade registers a factory function for a normal New* style function. This requires that the function has the form: NewFoo(*state.State, *common.Resources, common.Authorizer) (*Type, error) With that syntax, we will create a helper function that wraps calling NewFoo with the right parameters, and returns the *Type correctly.
func RegisterStandardFacadeForFeature ¶
func RegisterStandardFacadeForFeature(name string, version int, newFunc interface{}, feature string)
RegisterStandardFacadeForFeature registers a factory function for a normal New* style function. This requires that the function has the form: NewFoo(*state.State, *common.Resources, common.Authorizer) (*Type, error) With that syntax, we will create a helper function that wraps calling NewFoo with the right parameters, and returns the *Type correctly. If the feature is non-empty, this facade is only available when the specified feature flag is set.
func ServerError ¶
ServerError returns an error suitable for returning to an API client, with an error code suitable for various kinds of errors generated in packages outside the API.
func StateJobs ¶
func StateJobs(jobs []multiwatcher.MachineJob) ([]state.MachineJob, error)
StateJobs translates a slice of multiwatcher jobs to their equivalents in state.
func UnknownEnvironmentError ¶
Types ¶
type APIAddresser ¶
type APIAddresser struct {
// contains filtered or unexported fields
}
APIAddresser implements the APIAddresses method
func NewAPIAddresser ¶
func NewAPIAddresser(getter AddressAndCertGetter, resources *Resources) *APIAddresser
NewAPIAddresser returns a new APIAddresser that uses the given getter to fetch its addresses.
func (*APIAddresser) APIAddresses ¶
func (api *APIAddresser) APIAddresses() (params.StringsResult, error)
APIAddresses returns the list of addresses used to connect to the API.
func (*APIAddresser) APIHostPorts ¶
func (api *APIAddresser) APIHostPorts() (params.APIHostPortsResult, error)
APIHostPorts returns the API server addresses.
func (*APIAddresser) CACert ¶
func (a *APIAddresser) CACert() params.BytesResult
CACert returns the certificate used to validate the state connection.
func (*APIAddresser) EnvironUUID ¶
func (a *APIAddresser) EnvironUUID() params.StringResult
EnvironUUID returns the environment UUID to connect to the environment that the current connection is for.
func (*APIAddresser) WatchAPIHostPorts ¶
func (api *APIAddresser) WatchAPIHostPorts() (params.NotifyWatchResult, error)
WatchAPIHostPorts watches the API server addresses.
type APIHostPortsGetter ¶
type APIHostPortsGetter interface { // APIHostPorst returns the HostPorts for each API server. APIHostPorts() ([][]network.HostPort, error) }
APIHostPortsGetter is an interface providing the APIHostPorts method.
type AddressAndCertGetter ¶
type AddressAndCertGetter interface { Addresses() ([]string, error) APIAddressesFromMachines() ([]string, error) CACert() string EnvironUUID() string APIHostPorts() ([][]network.HostPort, error) WatchAPIHostPorts() state.NotifyWatcher }
AddressAndCertGetter can be used to find out state server addresses and the CA public certificate.
type AgentEntityWatcher ¶
type AgentEntityWatcher struct {
// contains filtered or unexported fields
}
AgentEntityWatcher implements a common Watch method for use by various facades.
func NewAgentEntityWatcher ¶
func NewAgentEntityWatcher(st state.EntityFinder, resources *Resources, getCanWatch GetAuthFunc) *AgentEntityWatcher
NewAgentEntityWatcher returns a new AgentEntityWatcher. The GetAuthFunc will be used on each invocation of Watch to determine current permissions.
func (*AgentEntityWatcher) Watch ¶
func (a *AgentEntityWatcher) Watch(args params.Entities) (params.NotifyWatchResults, error)
Watch starts an NotifyWatcher for each given entity.
type Authorizer ¶
type Authorizer interface { // AuthMachineAgent returns whether the authenticated entity is a // machine agent. AuthMachineAgent() bool // AuthUnitAgent returns whether the authenticated entity is a // unit agent. AuthUnitAgent() bool // AuthOwner returns whether the authenticated entity is the same // as the given entity. AuthOwner(tag names.Tag) bool // AuthEnvironManager returns whether the authenticated entity is // a machine running the environment manager job. AuthEnvironManager() bool // AuthClient returns whether the authenticated entity // is a client user. AuthClient() bool // GetAuthTag returns the tag of the authenticated entity. GetAuthTag() names.Tag }
Authorizer represents a value that can be asked for authorization information on its associated authenticated entity. It is implemented by an API server to allow an API implementation to ask questions about the client that is currently connected.
type BackingSpace ¶
type BackingSpace interface { // Name returns the space name. Name() string // Subnets returns the subnets in the space Subnets() ([]BackingSubnet, error) // ProviderId returns the network ID of the provider ProviderId() network.Id // Zones returns a list of availability zone(s) that this // space is in. It can be empty if the provider does not support // availability zones. Zones() []string // Life returns the lifecycle state of the space Life() params.Life }
BackingSpace defines the methods supported by a Space entity stored persistently.
type BackingSubnet ¶
type BackingSubnet interface { CIDR() string VLANTag() int ProviderId() string AvailabilityZones() []string Status() string SpaceName() string Life() params.Life }
BackingSubnet defines the methods supported by a Subnet entity stored persistently.
TODO(dimitern): Once the state backing is implemented, remove this and just use *state.Subnet.
type BackingSubnetInfo ¶
type BackingSubnetInfo struct { // ProviderId is a provider-specific network id. This may be empty. ProviderId string // CIDR of the network, in 123.45.67.89/24 format. CIDR string // VLANTag needs to be between 1 and 4094 for VLANs and 0 for normal // networks. It's defined by IEEE 802.1Q standard. VLANTag int // AllocatableIPHigh and Low describe the allocatable portion of the // subnet. The remainder, if any, is reserved by the provider. // Either both of these must be set or neither, if they're empty it // means that none of the subnet is allocatable. If present they must // be valid IP addresses within the subnet CIDR. AllocatableIPHigh string AllocatableIPLow string // AvailabilityZones describes which availability zone(s) this // subnet is in. It can be empty if the provider does not support // availability zones. AvailabilityZones []string // SpaceName holds the juju network space this subnet is // associated with. Can be empty if not supported. SpaceName string // Status holds the status of the subnet. Normally this will be // calculated from the reference count and Life of a subnet. Status string // Live holds the life of the subnet Life params.Life }
BackingSubnetInfo describes a single subnet to be added in the backing store.
TODO(dimitern): Replace state.SubnetInfo with this and remove BackingSubnetInfo, once the rest of state backing methods and the following pre-reqs are done:
- subnetDoc.AvailabilityZone becomes subnetDoc.AvailabilityZones, adding an upgrade step to migrate existing non empty zones on subnet docs. Also change state.Subnet.AvailabilityZone to
- add subnetDoc.SpaceName - no upgrade step needed, as it will only be used for new space-aware subnets.
- Subnets need a reference count to calculate Status.
- ensure EC2 and MAAS providers accept empty IDs as Subnets() args and return all subnets, including the AvailabilityZones (for EC2; empty for MAAS as zones are orthogonal to networks).
type BlockChecker ¶
type BlockChecker struct {
// contains filtered or unexported fields
}
BlockChecker checks for current blocks if any.
func NewBlockChecker ¶
func NewBlockChecker(s BlockGetter) *BlockChecker
func (*BlockChecker) ChangeAllowed ¶
func (c *BlockChecker) ChangeAllowed() error
ChangeAllowed checks if change block is in place. Change block prevents all operations that may change current environment in any way from running successfully.
func (*BlockChecker) DestroyAllowed ¶
func (c *BlockChecker) DestroyAllowed() error
DestroyAllowed checks if destroy block is in place. Destroy block prevents destruction of current environment.
func (*BlockChecker) RemoveAllowed ¶
func (c *BlockChecker) RemoveAllowed() error
RemoveAllowed checks if remove block is in place. Remove block prevents removal of machine, service, unit and relation from current environment.
type BlockGetter ¶
type DeadEnsurer ¶
type DeadEnsurer struct {
// contains filtered or unexported fields
}
DeadEnsurer implements a common EnsureDead method for use by various facades.
func NewDeadEnsurer ¶
func NewDeadEnsurer(st state.EntityFinder, getCanModify GetAuthFunc) *DeadEnsurer
NewDeadEnsurer returns a new DeadEnsurer. The GetAuthFunc will be used on each invocation of EnsureDead to determine current permissions.
func (*DeadEnsurer) EnsureDead ¶
func (d *DeadEnsurer) EnsureDead(args params.Entities) (params.ErrorResults, error)
EnsureDead calls EnsureDead on each given entity from state. It will fail if the entity is not present. If it's Alive, nothing will happen (see state/EnsureDead() for units or machines).
type EnvironConfigGetter ¶
type EnvironMachinesWatcher ¶
type EnvironMachinesWatcher struct {
// contains filtered or unexported fields
}
EnvironMachinesWatcher implements a common WatchEnvironMachines method for use by various facades.
func NewEnvironMachinesWatcher ¶
func NewEnvironMachinesWatcher(st state.EnvironMachinesWatcher, resources *Resources, authorizer Authorizer) *EnvironMachinesWatcher
NewEnvironMachinesWatcher returns a new EnvironMachinesWatcher. The GetAuthFunc will be used on each invocation of WatchUnits to determine current permissions.
func (*EnvironMachinesWatcher) WatchEnvironMachines ¶
func (e *EnvironMachinesWatcher) WatchEnvironMachines() (params.StringsWatchResult, error)
WatchEnvironMachines returns a StringsWatcher that notifies of changes to the life cycles of the top level machines in the current environment.
type EnvironWatcher ¶
type EnvironWatcher struct {
// contains filtered or unexported fields
}
EnvironWatcher implements two common methods for use by various facades - WatchForEnvironConfigChanges and EnvironConfig.
func NewEnvironWatcher ¶
func NewEnvironWatcher(st state.EnvironAccessor, resources *Resources, authorizer Authorizer) *EnvironWatcher
NewEnvironWatcher returns a new EnvironWatcher. Active watchers will be stored in the provided Resources. The two GetAuthFunc callbacks will be used on each invocation of the methods to determine current permissions. Right now, environment tags are not used, so both created AuthFuncs are called with "" for tag, which means "the current environment".
func (*EnvironWatcher) EnvironConfig ¶
func (e *EnvironWatcher) EnvironConfig() (params.EnvironConfigResult, error)
EnvironConfig returns the current environment's configuration.
func (*EnvironWatcher) WatchForEnvironConfigChanges ¶
func (e *EnvironWatcher) WatchForEnvironConfigChanges() (params.NotifyWatchResult, error)
WatchForEnvironConfigChanges returns a NotifyWatcher that observes changes to the environment configuration. Note that although the NotifyWatchResult contains an Error field, it's not used because we are only returning a single watcher, so we use the regular error return.
type FacadeDescription ¶
FacadeDescription describes the name and what versions of a facade have been registered.
type FacadeFactory ¶
type FacadeFactory func( st *state.State, resources *Resources, authorizer Authorizer, id string, ) ( interface{}, error, )
FacadeFactory represent a way of creating a Facade from the current connection to the State.
type FacadeRegistry ¶
type FacadeRegistry struct {
// contains filtered or unexported fields
}
FacadeRegistry is responsible for tracking what Facades are going to be exported in the API. See the variable "Facades" for the singleton that tracks them. It would be possible to have multiple registries if we decide to change how the API exposes methods based on Login information.
func (*FacadeRegistry) Discard ¶
func (f *FacadeRegistry) Discard(name string, version int)
Discard gets rid of a registration that has already been done. Calling discard on an entry that is not present is not considered an error.
func (*FacadeRegistry) GetFactory ¶
func (f *FacadeRegistry) GetFactory(name string, version int) (FacadeFactory, error)
GetFactory returns just the FacadeFactory for a given Facade name and version. See also GetType for getting the type information instead of the creation factory.
func (*FacadeRegistry) GetType ¶
GetType returns the type information for a given Facade name and version. This can be used for introspection purposes (to determine what methods are available, etc).
func (*FacadeRegistry) List ¶
func (f *FacadeRegistry) List() []FacadeDescription
List returns a slice describing each of the registered Facades.
func (*FacadeRegistry) Register ¶
func (f *FacadeRegistry) Register(name string, version int, factory FacadeFactory, facadeType reflect.Type, feature string) error
Register adds a single named facade at a given version to the registry. FacadeFactory will be called when someone wants to instantiate an object of this facade, and facadeType defines the concrete type that the returned object will be. The Type information is used to define what methods will be exported in the API, and it must exactly match the actual object returned by the factory.
type GetAuthFunc ¶
GetAuthFunc returns an AuthFunc.
func AuthAlways ¶
func AuthAlways() GetAuthFunc
AuthAlways returns an authentication function that always returns true iff it is passed a valid tag.
func AuthEither ¶
func AuthEither(a, b GetAuthFunc) GetAuthFunc
AuthEither returns an AuthFunc generator that returns an AuthFunc that accepts any tag authorized by either of its arguments.
func AuthFuncForTagKind ¶
func AuthFuncForTagKind(kind string) GetAuthFunc
AuthFuncForTagKind returns a GetAuthFunc which creates an AuthFunc allowing only the given tag kind and denies all others. Passing an empty kind is an error.
func AuthNever ¶
func AuthNever() GetAuthFunc
AuthNever returns an authentication function that never returns true.
type InstanceIdGetter ¶
type InstanceIdGetter struct {
// contains filtered or unexported fields
}
InstanceIdGetter implements a common InstanceId method for use by various facades.
func NewInstanceIdGetter ¶
func NewInstanceIdGetter(st state.EntityFinder, getCanRead GetAuthFunc) *InstanceIdGetter
NewInstanceIdGetter returns a new InstanceIdGetter. The GetAuthFunc will be used on each invocation of InstanceId to determine current permissions.
func (*InstanceIdGetter) InstanceId ¶
func (ig *InstanceIdGetter) InstanceId(args params.Entities) (params.StringResults, error)
InstanceId returns the provider specific instance id for each given machine or an CodeNotProvisioned error, if not set.
type LifeGetter ¶
type LifeGetter struct {
// contains filtered or unexported fields
}
LifeGetter implements a common Life method for use by various facades.
func NewLifeGetter ¶
func NewLifeGetter(st state.EntityFinder, getCanRead GetAuthFunc) *LifeGetter
NewLifeGetter returns a new LifeGetter. The GetAuthFunc will be used on each invocation of Life to determine current permissions.
func (*LifeGetter) Life ¶
func (lg *LifeGetter) Life(args params.Entities) (params.LifeResults, error)
Life returns the life status of every supplied entity, where available.
type MultiNotifyWatcher ¶
type MultiNotifyWatcher struct {
// contains filtered or unexported fields
}
MultiNotifyWatcher implements state.NotifyWatcher, combining multiple NotifyWatchers.
func NewMultiNotifyWatcher ¶
func NewMultiNotifyWatcher(w ...state.NotifyWatcher) *MultiNotifyWatcher
NewMultiNotifyWatcher creates a NotifyWatcher that combines each of the NotifyWatchers passed in. Each watcher's initial event is consumed, and a single initial event is sent. Subsequent events are not coalesced.
func (*MultiNotifyWatcher) Changes ¶
func (w *MultiNotifyWatcher) Changes() <-chan struct{}
func (*MultiNotifyWatcher) Err ¶
func (w *MultiNotifyWatcher) Err() error
func (*MultiNotifyWatcher) Kill ¶
func (w *MultiNotifyWatcher) Kill()
func (*MultiNotifyWatcher) Stop ¶
func (w *MultiNotifyWatcher) Stop() error
func (*MultiNotifyWatcher) Wait ¶
func (w *MultiNotifyWatcher) Wait() error
type NetworkBacking ¶
type NetworkBacking interface { // EnvironConfig returns the current environment config. EnvironConfig() (*config.Config, error) // AvailabilityZones returns all cached availability zones (i.e. // not from the provider, but in state). AvailabilityZones() ([]providercommon.AvailabilityZone, error) // SetAvailabilityZones replaces the cached list of availability // zones with the given zones. SetAvailabilityZones([]providercommon.AvailabilityZone) error // AddSpace creates a space AddSpace(Name string, Subnets []string, Public bool) error // AllSpaces returns all known Juju network spaces. AllSpaces() ([]BackingSpace, error) // AddSubnet creates a backing subnet for an existing subnet. AddSubnet(BackingSubnetInfo) (BackingSubnet, error) // AllSubnets returns all backing subnets. AllSubnets() ([]BackingSubnet, error) }
Backing defines the methods needed by the API facade to store and retrieve information from the underlying persistency layer (state DB).
type PasswordChanger ¶
type PasswordChanger struct {
// contains filtered or unexported fields
}
PasswordChanger implements a common SetPasswords method for use by various facades.
func NewPasswordChanger ¶
func NewPasswordChanger(st state.EntityFinder, getCanChange GetAuthFunc) *PasswordChanger
NewPasswordChanger returns a new PasswordChanger. The GetAuthFunc will be used on each invocation of SetPasswords to determine current permissions.
func (*PasswordChanger) SetPasswords ¶
func (pc *PasswordChanger) SetPasswords(args params.EntityPasswords) (params.ErrorResults, error)
SetPasswords sets the given password for each supplied entity, if possible.
type RebootActionGetter ¶
type RebootActionGetter struct {
// contains filtered or unexported fields
}
RebootActionGetter implements the GetRebootAction API method
func NewRebootActionGetter ¶
func NewRebootActionGetter(st state.EntityFinder, auth GetAuthFunc) *RebootActionGetter
func (*RebootActionGetter) GetRebootAction ¶
func (r *RebootActionGetter) GetRebootAction(args params.Entities) (params.RebootActionResults, error)
GetRebootAction returns the action a machine agent should take. If a reboot flag is set on the machine, then that machine is expected to reboot (params.ShouldReboot). a reboot flag set on the machine parent or grandparent, will cause the machine to shutdown (params.ShouldShutdown). If no reboot flag is set, the machine should do nothing (params.ShouldDoNothing).
type RebootFlagClearer ¶
type RebootFlagClearer struct {
// contains filtered or unexported fields
}
RebootFlagClearer implements the ClearReboot API call
func NewRebootFlagClearer ¶
func NewRebootFlagClearer(st state.EntityFinder, auth GetAuthFunc) *RebootFlagClearer
func (*RebootFlagClearer) ClearReboot ¶
func (r *RebootFlagClearer) ClearReboot(args params.Entities) (params.ErrorResults, error)
ClearReboot will clear the reboot flag on provided machines, if it exists.
type RebootRequester ¶
type RebootRequester struct {
// contains filtered or unexported fields
}
RebootRequester implements the RequestReboot API method
func NewRebootRequester ¶
func NewRebootRequester(st state.EntityFinder, auth GetAuthFunc) *RebootRequester
func (*RebootRequester) RequestReboot ¶
func (r *RebootRequester) RequestReboot(args params.Entities) (params.ErrorResults, error)
RequestReboot sets the reboot flag on the provided machines
type Remover ¶
type Remover struct {
// contains filtered or unexported fields
}
Remover implements a common Remove method for use by various facades.
func NewRemover ¶
func NewRemover(st state.EntityFinder, callEnsureDead bool, getCanModify GetAuthFunc) *Remover
NewRemover returns a new Remover. The callEnsureDead flag specifies whether EnsureDead should be called on an entity before removing. The GetAuthFunc will be used on each invocation of Remove to determine current permissions.
type Resource ¶
type Resource interface {
Stop() error
}
Resource represents any resource that should be cleaned up when an API connection terminates. The Stop method will be called when that happens.
type Resources ¶
type Resources struct {
// contains filtered or unexported fields
}
Resources holds all the resources for a connection. It allows the registration of resources that will be cleaned up when a connection terminates.
func NewResources ¶
func NewResources() *Resources
func (*Resources) Get ¶
Get returns the resource for the given id, or nil if there is no such resource.
func (*Resources) Register ¶
Register registers the given resource. It returns a unique identifier for the resource which can then be used in subsequent API requests to refer to the resource.
func (*Resources) RegisterNamed ¶
RegisterNamed registers the given resource. Callers must supply a unique name for the given resource. It is an error to try to register another resource with the same name as an already registered name. (This could be softened that you can overwrite an existing one and it will be Stopped and replaced, but we don't have a need for that yet.) It is also an error to supply a name that is an integer string, since that collides with the auto-naming from Register.
type ServiceStatusGetter ¶
type ServiceStatusGetter struct {
// contains filtered or unexported fields
}
ServiceStatusGetter is a StatusGetter for combined service and unit statuses. TODO(fwereade) this is completely evil and should never have been created. We have a perfectly adequate StatusGetter already, that accepts bulk args; all this does is break the user model, break the api model, and lie about unit statuses).
func NewServiceStatusGetter ¶
func NewServiceStatusGetter(st *state.State, getCanAccess GetAuthFunc) *ServiceStatusGetter
NewServiceStatusGetter returns a ServiceStatusGetter.
func (*ServiceStatusGetter) Status ¶
func (s *ServiceStatusGetter) Status(args params.Entities) (params.ServiceStatusResults, error)
Status returns the status of the Service for each given Unit tag.
type ServiceStatusSetter ¶
type ServiceStatusSetter struct {
// contains filtered or unexported fields
}
ServiceStatusSetter implements a SetServiceStatus method to be used by facades that can change a service status. This is only slightly less evil than ServiceStatusGetter. We have StatusSetter already; all this does is set the status for the wrong entity, and render the auth so confused as to be ~worthless.
func NewServiceStatusSetter ¶
func NewServiceStatusSetter(st *state.State, getCanModify GetAuthFunc) *ServiceStatusSetter
NewServiceStatusSetter returns a ServiceStatusSetter.
func (*ServiceStatusSetter) SetStatus ¶
func (s *ServiceStatusSetter) SetStatus(args params.SetStatus) (params.ErrorResults, error)
SetStatus sets the status on the service given by the unit in args if the unit is the leader.
type StateAddresser ¶
type StateAddresser struct {
// contains filtered or unexported fields
}
StateAddresser implements a common set of methods for getting state server addresses, and the CA certificate used to authenticate them.
func NewStateAddresser ¶
func NewStateAddresser(getter AddressAndCertGetter) *StateAddresser
NewStateAddresser returns a new StateAddresser that uses the given st value to fetch its addresses.
func (*StateAddresser) StateAddresses ¶
func (a *StateAddresser) StateAddresses() (params.StringsResult, error)
StateAddresses returns the list of addresses used to connect to the state.
type StatusGetter ¶
type StatusGetter struct {
// contains filtered or unexported fields
}
StatusGetter implements a common Status method for use by various facades.
func NewStatusGetter ¶
func NewStatusGetter(st state.EntityFinder, getCanAccess GetAuthFunc) *StatusGetter
NewStatusGetter returns a new StatusGetter. The GetAuthFunc will be used on each invocation of Status to determine current permissions.
func (*StatusGetter) Status ¶
func (s *StatusGetter) Status(args params.Entities) (params.StatusResults, error)
Status returns the status of each given entity.
type StatusSetter ¶
type StatusSetter struct {
// contains filtered or unexported fields
}
StatusSetter implements a common SetStatus method for use by various facades.
func NewStatusSetter ¶
func NewStatusSetter(st state.EntityFinder, getCanModify GetAuthFunc) *StatusSetter
NewStatusSetter returns a new StatusSetter. The GetAuthFunc will be used on each invocation of SetStatus to determine current permissions.
func (*StatusSetter) SetStatus ¶
func (s *StatusSetter) SetStatus(args params.SetStatus) (params.ErrorResults, error)
SetStatus sets the status of each given entity.
func (*StatusSetter) UpdateStatus ¶
func (s *StatusSetter) UpdateStatus(args params.SetStatus) (params.ErrorResults, error)
UpdateStatus updates the status data of each given entity. TODO(fwereade): WTF. This method exists *only* for the convenience of the *client* API -- and is itself completely broken -- but we still expose it in every facade with a StatusSetter? FFS.
type StringResource ¶
type StringResource string
StringResource is just a regular 'string' that matches the Resource interface.
func (StringResource) Stop ¶
func (StringResource) Stop() error
func (StringResource) String ¶
func (s StringResource) String() string
type ToolsFinder ¶
type ToolsFinder struct {
// contains filtered or unexported fields
}
func NewToolsFinder ¶
func NewToolsFinder(c EnvironConfigGetter, s ToolsStorageGetter, t ToolsURLGetter) *ToolsFinder
NewToolsFinder returns a new ToolsFinder, returning tools with their URLs pointing at the API server.
func (*ToolsFinder) FindTools ¶
func (f *ToolsFinder) FindTools(args params.FindToolsParams) (params.FindToolsResult, error)
FindTools returns a List containing all tools matching the given parameters.
type ToolsGetter ¶
type ToolsGetter struct {
// contains filtered or unexported fields
}
ToolsGetter implements a common Tools method for use by various facades.
func NewToolsGetter ¶
func NewToolsGetter(f state.EntityFinder, c EnvironConfigGetter, s ToolsStorageGetter, t ToolsURLGetter, getCanRead GetAuthFunc) *ToolsGetter
NewToolsGetter returns a new ToolsGetter. The GetAuthFunc will be used on each invocation of Tools to determine current permissions.
func (*ToolsGetter) Tools ¶
func (t *ToolsGetter) Tools(args params.Entities) (params.ToolsResults, error)
Tools finds the tools necessary for the given agents.
type ToolsSetter ¶
type ToolsSetter struct {
// contains filtered or unexported fields
}
ToolsSetter implements a common Tools method for use by various facades.
func NewToolsSetter ¶
func NewToolsSetter(st state.EntityFinder, getCanWrite GetAuthFunc) *ToolsSetter
NewToolsSetter returns a new ToolsGetter. The GetAuthFunc will be used on each invocation of Tools to determine current permissions.
func (*ToolsSetter) SetTools ¶
func (t *ToolsSetter) SetTools(args params.EntitiesVersion) (params.ErrorResults, error)
SetTools updates the recorded tools version for the agents.
type ToolsStorageGetter ¶
type ToolsStorageGetter interface { // ToolsStorage returns a toolstorage.StorageCloser. ToolsStorage() (toolstorage.StorageCloser, error) }
ToolsStorageGetter is an interface providing the ToolsStorage method.
type ToolsURLGetter ¶
type ToolsURLGetter interface { // ToolsURL returns a URL for the tools with // the specified binary version. ToolsURL(v version.Binary) (string, error) }
ToolsURLGetter is an interface providing the ToolsURL method.
type UnitsWatcher ¶
type UnitsWatcher struct {
// contains filtered or unexported fields
}
UnitsWatcher implements a common WatchUnits method for use by various facades.
func NewUnitsWatcher ¶
func NewUnitsWatcher(st state.EntityFinder, resources *Resources, getCanWatch GetAuthFunc) *UnitsWatcher
NewUnitsWatcher returns a new UnitsWatcher. The GetAuthFunc will be used on each invocation of WatchUnits to determine current permissions.
func (*UnitsWatcher) WatchUnits ¶
func (u *UnitsWatcher) WatchUnits(args params.Entities) (params.StringsWatchResults, error)
WatchUnits starts a StringsWatcher to watch all units belonging to to any entity (machine or service) passed in args.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package storagecommon provides common storage-related services for API server facades.
|
Package storagecommon provides common storage-related services for API server facades. |