Documentation ¶
Index ¶
- Constants
- func MakeInterestingRequestFilter(excludeMethods set.Strings) func(auditlog.Request) bool
- func NewAuditLogFilter(log auditlog.AuditLog, filter func(auditlog.Request) bool) auditlog.AuditLog
- func NewRecorderFactory(observerFactory rpc.ObserverFactory, recorder *auditlog.Recorder, ...) rpc.RecorderFactory
- type Hub
- type Multiplexer
- type Observer
- type ObserverFactory
- type RequestObserver
- type RequestObserverContext
Constants ¶
const ( // CaptureArgs means we'll serialize the API arguments and store // them in the audit log. CaptureArgs = true // NoCaptureArgs means don't do that. NoCaptureArgs = false )
Variables ¶
This section is empty.
Functions ¶
func MakeInterestingRequestFilter ¶
MakeInterestingRequestFilter takes a set of method names (as facade.method, e.g. "Client.FullStatus") that aren't very interesting from an auditing perspective, and returns a filter function for audit logging that will mark the request as interesting if it's a call to a method that isn't listed. If one of the entries is "ReadOnlyMethods", any method matching the fixed list of read-only methods below will also be considered uninteresting.
func NewAuditLogFilter ¶
NewAuditLogFilter returns an auditlog.AuditLog that will only log conversations to the underlying log passed in if they include a request that satisfies the filter function passed in.
func NewRecorderFactory ¶
func NewRecorderFactory( observerFactory rpc.ObserverFactory, recorder *auditlog.Recorder, captureArgs bool, ) rpc.RecorderFactory
NewRecorderFactory makes a new rpc.RecorderFactory to make recorders that that will update the observer and the auditlog recorder when it records a request or reply. The auditlog recorder can be nil.
Types ¶
type Multiplexer ¶
type Multiplexer struct {
// contains filtered or unexported fields
}
Multiplexer multiplexes calls to an arbitrary number of observers.
func NewMultiplexer ¶
func NewMultiplexer(observers ...Observer) *Multiplexer
NewMultiplexer creates a new Multiplexer with the provided observers.
func None ¶
func None() *Multiplexer
None is a wrapper around the Multiplexer factory to add clarity to code that doesn't need any observers.
func (*Multiplexer) Join ¶
func (m *Multiplexer) Join(req *http.Request, connectionID uint64)
Join is called when the connection to the API server's WebSocket is opened.
func (*Multiplexer) Login ¶
func (m *Multiplexer) Login(entity names.Tag, model names.ModelTag, fromController bool, userData string)
Login implements Observer.
func (*Multiplexer) RPCObserver ¶
func (m *Multiplexer) RPCObserver() rpc.Observer
RPCObserver implements Observer. It will create an rpc.ObserverMultiplexer by calling all the Observer's RPCObserver methods.
type Observer ¶
type Observer interface { rpc.ObserverFactory // Login informs an Observer that an entity has logged in. Login(entity names.Tag, model names.ModelTag, fromController bool, userData string) // Join is called when the connection to the API server's // WebSocket is opened. Join(req *http.Request, connectionID uint64) // Leave is called when the connection to the API server's // WebSocket is closed. Leave() }
Observer defines a type which will observe API server events as they happen.
type ObserverFactory ¶
type ObserverFactory func() Observer
ObserverFactory is a function which creates an Observer.
func ObserverFactoryMultiplexer ¶
func ObserverFactoryMultiplexer(factories ...ObserverFactory) ObserverFactory
ObserverFactoryMultiplexer returns an ObserverFactory which will return a Multiplexer of all the observers instantiated from the factories passed in.
type RequestObserver ¶
type RequestObserver struct {
// contains filtered or unexported fields
}
RequestObserver serves as a sink for API server requests and responses.
func NewRequestObserver ¶
func NewRequestObserver(ctx RequestObserverContext) *RequestObserver
NewRequestObserver returns a new RPCObserver.
func (*RequestObserver) Join ¶
func (n *RequestObserver) Join(req *http.Request, connectionID uint64)
Join implements Observer.
func (*RequestObserver) Login ¶
func (n *RequestObserver) Login(entity names.Tag, model names.ModelTag, fromController bool, userData string)
Login implements Observer.
func (*RequestObserver) RPCObserver ¶
func (n *RequestObserver) RPCObserver() rpc.Observer
RPCObserver implements Observer.
type RequestObserverContext ¶
type RequestObserverContext struct { // Clock is the clock to use for all time operations on this type. Clock clock.Clock // Hub refers to the pubsub Hub which will have connection // and disconnection events published. Hub Hub // Logger is the log to use to write log statements. Logger corelogger.Logger }
RequestObserverContext provides information needed for a RequestObserver to operate correctly.
Directories ¶
Path | Synopsis |
---|---|
Package metricobserver provides an implementation of apiserver/observer.ObserverFactory that maintains Prometheus metrics.
|
Package metricobserver provides an implementation of apiserver/observer.ObserverFactory that maintains Prometheus metrics. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |