Documentation ¶
Index ¶
- Variables
- func GetObservedNetworkConfig(source NetworkConfigSource) ([]params.NetworkConfig, error)
- func Life(caller base.FacadeCaller, tags []names.Tag) ([]params.LifeResult, error)
- func OneLife(caller base.FacadeCaller, tag names.Tag) (params.Life, error)
- func StreamDebugLog(source base.StreamConnector, args DebugLogParams) (<-chan LogMessage, error)
- func Watch(facade base.FacadeCaller, method string, tag names.Tag) (watcher.NotifyWatcher, error)
- type APIAddresser
- type ControllerConfigAPI
- type DebugLogParams
- type LeadershipPinningAPI
- type LogMessage
- type ModelStatusAPI
- type ModelWatcher
- func (e *ModelWatcher) LogForwardConfig() (*syslog.RawConfig, bool, error)
- func (e *ModelWatcher) ModelConfig() (*config.Config, error)
- func (e *ModelWatcher) UpdateStatusHookInterval() (time.Duration, error)
- func (e *ModelWatcher) WatchForLogForwardConfigChanges() (watcher.NotifyWatcher, error)
- func (e *ModelWatcher) WatchForModelConfigChanges() (watcher.NotifyWatcher, error)
- func (e *ModelWatcher) WatchUpdateStatusHookInterval() (watcher.NotifyWatcher, error)
- type NetworkConfigSource
- type UpgradeSeriesAPI
Constants ¶
This section is empty.
Variables ¶
var (
ErrPartialResults = errors.New("API call only returned partial results")
)
Functions ¶
func GetObservedNetworkConfig ¶
func GetObservedNetworkConfig(source NetworkConfigSource) ([]params.NetworkConfig, error)
GetObservedNetworkConfig uses the given source to find all available network interfaces and their assigned addresses, and returns the result as []params.NetworkConfig. In addition to what the source returns, a few additional transformations are done:
- On any OS, the state (UP/DOWN) of each interface and the DeviceIndex field, will be correctly populated. Loopback interfaces are also properly detected and will have InterfaceType set LoopbackInterface.
- On Linux only, the InterfaceType field will be reliably detected for a few types: BondInterface, BridgeInterface, VLAN_8021QInterface.
- Also on Linux, for interfaces that are discovered to be ports on a bridge, the ParentInterfaceName will be populated with the name of the bridge.
- ConfigType fields will be set to ConfigManual when no address is detected, or ConfigStatic when it is.
- TODO: IPv6 link-local addresses will be ignored and treated as empty ATM.
Result entries will be grouped by InterfaceName, in the same order they are returned by the given source.
func Life ¶
func Life(caller base.FacadeCaller, tags []names.Tag) ([]params.LifeResult, error)
Life requests the life cycle of the given entities from the given server-side API facade via the given caller.
func OneLife ¶
func OneLife(caller base.FacadeCaller, tag names.Tag) (params.Life, error)
OneLife requests the life cycle of the given entity from the given server-side API facade via the given caller.
func StreamDebugLog ¶
func StreamDebugLog(source base.StreamConnector, args DebugLogParams) (<-chan LogMessage, error)
StreamDebugLog requests the specified debug log records from the server and returns a channel of the messages that come back.
func Watch ¶
func Watch(facade base.FacadeCaller, method string, tag names.Tag) (watcher.NotifyWatcher, error)
Watch starts a NotifyWatcher for the entity with the specified tag.
Types ¶
type APIAddresser ¶
type APIAddresser struct {
// contains filtered or unexported fields
}
APIAddresser provides common client-side API functions to call into apiserver.common.APIAddresser
func NewAPIAddresser ¶
func NewAPIAddresser(facade base.FacadeCaller) *APIAddresser
NewAPIAddresser returns a new APIAddresser that makes API calls using caller and the specified facade name.
func (*APIAddresser) APIAddresses ¶
func (a *APIAddresser) APIAddresses() ([]string, error)
APIAddresses returns the list of addresses used to connect to the API.
func (*APIAddresser) APIHostPorts ¶
func (a *APIAddresser) APIHostPorts() ([][]network.HostPort, error)
APIHostPorts returns the host/port addresses of the API servers.
func (*APIAddresser) ModelUUID ¶
func (a *APIAddresser) ModelUUID() (string, error)
ModelUUID returns the model UUID to connect to the model that the current connection is for.
TODO(axw) this has bugger all to do with addresses, and so should not be on this type. Get it from somewhere else, e.g. by passing it into the model-specific workers.
func (*APIAddresser) WatchAPIHostPorts ¶
func (a *APIAddresser) WatchAPIHostPorts() (watcher.NotifyWatcher, error)
WatchAPIHostPorts watches the host/port addresses of the API servers.
type ControllerConfigAPI ¶
type ControllerConfigAPI struct {
// contains filtered or unexported fields
}
ControllerConfigAPI provides common client-side API functions to call into apiserver.common.ControllerConfig.
func NewControllerConfig ¶
func NewControllerConfig(facade base.FacadeCaller) *ControllerConfigAPI
NewControllerConfig creates a ControllerConfig on the specified facade, and uses this name when calling through the caller.
func (*ControllerConfigAPI) ControllerConfig ¶
func (e *ControllerConfigAPI) ControllerConfig() (controller.Config, error)
ControllerConfig returns the current controller configuration.
type DebugLogParams ¶
type DebugLogParams struct { // IncludeEntity lists entity tags to include in the response. Tags may // finish with a '*' to match a prefix e.g.: unit-mysql-*, machine-2. If // none are set, then all lines are considered included. IncludeEntity []string // IncludeModule lists logging modules to include in the response. If none // are set all modules are considered included. If a module is specified, // all the submodules also match. IncludeModule []string // ExcludeEntity lists entity tags to exclude from the response. As with // IncludeEntity the values may finish with a '*'. ExcludeEntity []string // ExcludeModule lists logging modules to exclude from the resposne. If a // module is specified, all the submodules are also excluded. ExcludeModule []string // Limit defines the maximum number of lines to return. Once this many // have been sent, the socket is closed. If zero, all filtered lines are // sent down the connection until the client closes the connection. Limit uint // Backlog tells the server to try to go back this many lines before // starting filtering. If backlog is zero and replay is false, then there // may be an initial delay until the next matching log message is written. Backlog uint // Level specifies the minimum logging level to be sent back in the response. Level loggo.Level // Replay tells the server to start at the start of the log file rather // than the end. If replay is true, backlog is ignored. Replay bool // NoTail tells the server to only return the logs it has now, and not // to wait for new logs to arrive. NoTail bool // StartTime should be a time in the past - only records with a // log time on or after StartTime will be returned. StartTime time.Time }
DebugLogParams holds parameters for WatchDebugLog that control the filtering of the log messages. If the structure is zero initialized, the entire log file is sent back starting from the end, and until the user closes the connection.
func (DebugLogParams) URLQuery ¶
func (args DebugLogParams) URLQuery() url.Values
type LeadershipPinningAPI ¶
type LeadershipPinningAPI struct {
// contains filtered or unexported fields
}
LeadershipPinningAPI provides common client-side API functions for manipulating and querying application leadership pinning.
func NewLeadershipPinningAPI ¶
func NewLeadershipPinningAPI(caller base.APICaller) *LeadershipPinningAPI
NewLeadershipPinningAPI creates and returns a new leadership API client.
func NewLeadershipPinningAPIFromFacade ¶
func NewLeadershipPinningAPIFromFacade(facade base.FacadeCaller) *LeadershipPinningAPI
NewLeadershipPinningAPIFromFacade creates and returns a new leadership API client based on the input client facade and facade caller.
func (*LeadershipPinningAPI) PinMachineApplications ¶
func (a *LeadershipPinningAPI) PinMachineApplications() (map[string]error, error)
PinMachineApplications pins leadership for applications represented by units running on the local machine. If the caller is not a machine agent, an error will be returned. The return is a collection of applications determined to be running on the machine, with the result of each individual pin operation.
func (*LeadershipPinningAPI) PinnedLeadership ¶
func (a *LeadershipPinningAPI) PinnedLeadership() (map[string][]names.Tag, error)
PinnedLeadership returns a collection of application names for which leadership is currently pinned, with the entities requiring each application's pinned behaviour.
func (*LeadershipPinningAPI) UnpinMachineApplications ¶
func (a *LeadershipPinningAPI) UnpinMachineApplications() (map[string]error, error)
UnpinMachineApplications pins leadership for applications represented by units running on the local machine. If the caller is not a machine agent, an error will be returned. The return is a collection of applications determined to be running on the machine, with the result of each individual unpin operation.
type LogMessage ¶
type LogMessage struct { Entity string Timestamp time.Time Severity string Module string Location string Message string }
LogMessage is a structured logging entry.
type ModelStatusAPI ¶
type ModelStatusAPI struct {
// contains filtered or unexported fields
}
ModelStatusAPI provides common client-side API functions to call into apiserver.common.ModelStatusAPI.
func NewModelStatusAPI ¶
func NewModelStatusAPI(facade base.FacadeCaller) *ModelStatusAPI
NewModelStatusAPI creates a ModelStatusAPI on the specified facade, and uses this name when calling through the caller.
func (*ModelStatusAPI) ModelStatus ¶
func (c *ModelStatusAPI) ModelStatus(tags ...names.ModelTag) ([]base.ModelStatus, error)
ModelStatus returns a status summary for each model tag passed in.
type ModelWatcher ¶
type ModelWatcher struct {
// contains filtered or unexported fields
}
ModelWatcher provides common client-side API functions to call into apiserver.common.ModelWatcher.
func NewModelWatcher ¶
func NewModelWatcher(facade base.FacadeCaller) *ModelWatcher
NewModelWatcher creates a ModelWatcher on the specified facade, and uses this name when calling through the caller.
func (*ModelWatcher) LogForwardConfig ¶
func (e *ModelWatcher) LogForwardConfig() (*syslog.RawConfig, bool, error)
LogForwardConfig returns the current log forward syslog configuration.
func (*ModelWatcher) ModelConfig ¶
func (e *ModelWatcher) ModelConfig() (*config.Config, error)
ModelConfig returns the current model configuration.
func (*ModelWatcher) UpdateStatusHookInterval ¶
func (e *ModelWatcher) UpdateStatusHookInterval() (time.Duration, error)
UpdateStatusHookInterval returns the current update status hook interval.
func (*ModelWatcher) WatchForLogForwardConfigChanges ¶
func (e *ModelWatcher) WatchForLogForwardConfigChanges() (watcher.NotifyWatcher, error)
WatchForLogForwardConfigChanges return a NotifyWatcher waiting for the log forward syslog configuration to change.
func (*ModelWatcher) WatchForModelConfigChanges ¶
func (e *ModelWatcher) WatchForModelConfigChanges() (watcher.NotifyWatcher, error)
WatchForModelConfigChanges return a NotifyWatcher waiting for the model configuration to change.
func (*ModelWatcher) WatchUpdateStatusHookInterval ¶
func (e *ModelWatcher) WatchUpdateStatusHookInterval() (watcher.NotifyWatcher, error)
WatchUpdateStatusHookInterval returns a NotifyWatcher that fires when the update status hook interval changes.
type NetworkConfigSource ¶
type NetworkConfigSource interface { // SysClassNetPath returns the Linux kernel userspace SYSFS path used by // this source. DefaultNetworkConfigSource() uses network.SysClassNetPath. SysClassNetPath() string // Interfaces returns information about all network interfaces on the // machine as []net.Interface. Interfaces() ([]net.Interface, error) // InterfaceAddresses returns information about all addresses assigned to // the network interface with the given name. InterfaceAddresses(name string) ([]net.Addr, error) // DefaultRoute returns the gateway IP address and device name of the // default route on the machine. If there is no default route (known), // then zero values are returned. DefaultRoute() (net.IP, string, error) }
NetworkConfigSource defines the necessary calls to obtain the network configuration of a machine.
func DefaultNetworkConfigSource ¶
func DefaultNetworkConfigSource() NetworkConfigSource
DefaultNetworkConfigSource returns a NetworkConfigSource backed by the net package, to be used with GetObservedNetworkConfig().
type UpgradeSeriesAPI ¶
type UpgradeSeriesAPI struct {
// contains filtered or unexported fields
}
UpgradeSeriesAPI provides common agent-side API functions to call into apiserver.common/UpgradeSeries
func NewUpgradeSeriesAPI ¶
func NewUpgradeSeriesAPI(facade base.FacadeCaller, tag names.Tag) *UpgradeSeriesAPI
NewUpgradeSeriesAPI creates a UpgradeSeriesAPI on the specified facade, and uses this name when calling through the caller.
func (*UpgradeSeriesAPI) SetUpgradeSeriesUnitStatus ¶
func (u *UpgradeSeriesAPI) SetUpgradeSeriesUnitStatus(status model.UpgradeSeriesStatus, reason string) error
SetUpgradeSeriesUnitStatus sets the upgrade series status of the unit in the remote state.
func (*UpgradeSeriesAPI) UpgradeSeriesUnitStatus ¶
func (u *UpgradeSeriesAPI) UpgradeSeriesUnitStatus() ([]model.UpgradeSeriesStatus, error)
UpgradeSeriesUnitStatus returns the upgrade series status of a unit from remote state.
func (*UpgradeSeriesAPI) WatchUpgradeSeriesNotifications ¶
func (u *UpgradeSeriesAPI) WatchUpgradeSeriesNotifications() (watcher.NotifyWatcher, error)
WatchUpgradeSeriesNotifications returns a NotifyWatcher for observing the state of a series upgrade.