Documentation ¶
Index ¶
- Variables
- func IsEnabled(event string) bool
- func MapCopy(dst, src interface{})
- func NewEventManager(storagePolicy StoragePolicy) *events
- func NewWrap(c EventsConfigMap) error
- type Addons
- type AfterFunc
- type AfterFuncs
- type AfterFuncsMap
- type Bill
- type Container
- type Event
- type EventChannel
- type EventManager
- type EventType
- type EventsConfigMap
- type EventsWriter
- type Machine
- type MultiEvent
- type Request
- type StoragePolicy
- type StoredEvent
- type User
- type Watcher
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func NewEventManager ¶
func NewEventManager(storagePolicy StoragePolicy) *events
returns a pointer to an initialized Events object.
func NewWrap ¶
func NewWrap(c EventsConfigMap) error
Types ¶
type Addons ¶
func (*Addons) OnboardFunc ¶
func (*Addons) Watch ¶
func (self *Addons) Watch(eventsChannel *EventChannel) error
Watches for new vms, or vms destroyed.
type AfterFunc ¶
AfterFunc represents a after alert function, that can be registered with NewUser function.
type AfterFuncs ¶
type AfterFuncs []AfterFunc
type AfterFuncsMap ¶
type AfterFuncsMap map[alerts.EventAction]AfterFuncs
type Bill ¶
func (*Bill) OnboardFunc ¶
func (*Bill) Watch ¶
func (self *Bill) Watch(eventsChannel *EventChannel) error
Watches for new vms, or vms destroyed.
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
func (*Container) Watch ¶
func (self *Container) Watch(eventsChannel *EventChannel) error
Watches for new vms, or vms destroyed.
type Event ¶
type Event struct { AccountsId string // the time at which the event occurred Timestamp time.Time // the type of event. EventType is an enumerated type EventType EventType //the action can be //bill create, bill delete EventAction alerts.EventAction // the original event object and all of its extraneous data, ex. an // OomInstance EventData alerts.EventData }
Event contains information general to events such as the time at which they occurred, their specific type, and the actual event. Event types are differentiated by the EventType field of Event.
type EventChannel ¶
type EventChannel struct {
// contains filtered or unexported fields
}
func NewEventChannel ¶
func NewEventChannel(watchId int) *EventChannel
func (*EventChannel) GetChannel ¶
func (self *EventChannel) GetChannel() chan *Event
func (*EventChannel) GetWatchId ¶
func (self *EventChannel) GetWatchId() int
type EventManager ¶
type EventManager interface { // WatchEvents() allows a caller to register for receiving events based on the specified request. // On successful registration, an EventChannel object is returned. WatchEvents(request *Request) (*EventChannel, error) // GetEvents() returns all detected events based on the filters specified in request. GetEvents(request *Request) ([]*Event, error) // AddEvent allows the caller to add an event to an EventManager // object AddEvent(e *Event) error // Cancels a previously requested watch event. StopWatch(watch_id int) }
EventManager is implemented by Events. It provides two ways to monitor events and one way to add events
type EventType ¶
type EventType string
EventType is an enumerated type which lists the categories under which events may fall. The Event field EventType is populated by this enum.
type EventsConfigMap ¶
type EventsWriter ¶
type EventsWriter struct {
H *events
}
var W *EventsWriter
func (*EventsWriter) Close ¶
func (ew *EventsWriter) Close()
func (*EventsWriter) CloseEventChannel ¶
func (ew *EventsWriter) CloseEventChannel(watch_id int)
func (*EventsWriter) GetPastEvents ¶
func (ew *EventsWriter) GetPastEvents(request *Request) ([]*Event, error)
can be called by the api which will return all events satisfying the request
func (*EventsWriter) WatchForEvents ¶
func (ew *EventsWriter) WatchForEvents(request *Request) (*EventChannel, error)
can be called by the api which will take events returned on the channel
func (*EventsWriter) Write ¶
func (ew *EventsWriter) Write(e *Event) error
can be called by the api which will take events returned on the channel
type Machine ¶
type Machine struct {
// contains filtered or unexported fields
}
func (*Machine) Watch ¶
func (self *Machine) Watch(eventsChannel *EventChannel) error
Watches for new vms, or vms destroyed.
type MultiEvent ¶
type MultiEvent struct {
Events []*Event
}
func NewMulti ¶
func NewMulti(ea []*Event) *MultiEvent
func (*MultiEvent) IsEnabled ¶
func (me *MultiEvent) IsEnabled() bool
func (*MultiEvent) String ¶
func (e *MultiEvent) String() string
func (*MultiEvent) Write ¶
func (me *MultiEvent) Write() error
type Request ¶
type Request struct { // events falling before StartTime do not satisfy the request. StartTime // must be left blank in calls to WatchEvents StartTime time.Time // events falling after EndTime do not satisfy the request. EndTime // must be left blank in calls to WatchEvents EndTime time.Time // EventType is a map that specifies the type(s) of events wanted EventType map[EventType]bool // contains filtered or unexported fields }
Request holds a set of parameters by which Event objects may be screened. The caller may want events that occurred within a specific timeframe or of a certain type, which may be specified in the *Request object they pass to an EventManager function
func NewRequest ¶
func NewRequest(opts *eventReqOpts) *Request
returns a pointer to an initialized Request object
type StoragePolicy ¶
type StoragePolicy struct { // Defaults limites, used if a per-event limit is not set. DefaultMaxAge time.Duration DefaultMaxNumEvents int // Per-event type limits. PerTypeMaxAge map[EventType]time.Duration PerTypeMaxNumEvents map[EventType]int }
Policy specifying how many events to store. MaxAge is the max duration for which to keep events. MaxNumEvents is the max number of events to keep (-1 for no limit).
func DefaultStoragePolicy ¶
func DefaultStoragePolicy() StoragePolicy
type StoredEvent ¶
type StoredEvent struct { Id string `json:"id"` AccountsId string `json:"AccountsId"` Type string `json:"type"` Action string `json:"action"` Inputs pairs.JsonPairs `json:"inputs"` CreatedAt string `json:"created_at"` }
func NewParseEvent ¶
func NewParseEvent(b []byte) (*StoredEvent, error)
func (*StoredEvent) AsEvent ¶
func (st *StoredEvent) AsEvent() (*Event, error)
type User ¶
type User struct {
// contains filtered or unexported fields
}
func NewUser ¶
func NewUser(e EventsConfigMap, fnmap AfterFuncsMap) *User
func (*User) Watch ¶
func (self *User) Watch(eventsChannel *EventChannel) error
Watches for new vms, or vms destroyed.
type Watcher ¶
type Watcher interface {
Watch(eventChannel *EventChannel) error
}
Interface for event operation handlers.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
** Copyright [2013-2017] [Megam Systems] ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License.
|
** Copyright [2013-2017] [Megam Systems] ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. |