events

package
v0.0.0-...-8472d0d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2023 License: Apache-2.0 Imports: 2 Imported by: 60

Documentation

Index

Constants

View Source
const (
	Heartbeat     = "heartbeat"
	CoreState     = "core-state"
	DetailState   = "detail-state"
	Error         = "error"
	UserGenerated = "user-generated"
	AutoGenerated = "auto-generated"
	StartUp       = "startup"
	RoomDivide    = "roomdivide"
	Metrics       = "metrics"
	Internal      = "internal"
	RoomSystem    = "room-system"
	Alert         = "alert"
	Computer      = "computer"
	Mstatus       = "mstatus"
	Via           = "via"
	HardwareInfo  = "hardware-info"
	ActiveSignal  = "active-signal"
	Support       = "support"

	UICommunication = "ui-communication"
	UIEvent         = "ui-event"
	CherryUI        = "cherry-ui"
	BlueberryUI     = "blueberry-ui"
)

Event Tags const declarations

Variables

This section is empty.

Functions

func ContainsAllTags

func ContainsAllTags(e Event, tags ...string) bool

ContainsAllTags returns true if the event has all of the given tags

func ContainsAnyTags

func ContainsAnyTags(e Event, tags ...string) bool

ContainsAnyTags returns true if the event has at least one of the given tags

Types

type BasicDeviceInfo

type BasicDeviceInfo struct {
	BasicRoomInfo
	DeviceID string `json:"deviceID,omitempty"`
}

BasicDeviceInfo contains device information that is easy to aggregate on.

func GenerateBasicDeviceInfo

func GenerateBasicDeviceInfo(deviceID string) BasicDeviceInfo

GenerateBasicDeviceInfo takes a deviceID and generates a BasicDeviceInfo from it

type BasicRoomInfo

type BasicRoomInfo struct {
	BuildingID string `json:"buildingID,omitempty"`
	RoomID     string `json:"roomID,omitempty"`
}

BasicRoomInfo contains device information that is easy to aggregate on.

func GenerateBasicRoomInfo

func GenerateBasicRoomInfo(roomID string) BasicRoomInfo

GenerateBasicRoomInfo takes a roomID and generates a BasicRoomInfo from it

type Event

type Event struct {
	// GeneratingSystem is the system actually generating the event. i.e. For an API call against a raspberry pi this would be the hostname of the raspberry pi running the AV-API. If the call is against AWS, this would be 'AWS'
	GeneratingSystem string `json:"generating-system"`

	// Timestamp is the time the event took place
	Timestamp time.Time `json:"timestamp"`

	// EventTags is a collection of strings to give more information about what kind of event this is, used in routing and processing events. See the EventTags const delcaration for some common tags.
	EventTags []string `json:"event-tags"`

	// TargetDevice is the device being affected by the event. e.g. a power on event, this would be the device powering on
	TargetDevice BasicDeviceInfo `json:"target-device"`

	// AffectedRoom is the room being affected by the event. e.g. in events arising from an API call this is the room called in the API
	AffectedRoom BasicRoomInfo `json:"affected-room"`

	// Key of the event
	Key string `json:"key"`

	// Value of the event
	Value string `json:"value"`

	// User is the user associated with generating the event
	User string `json:"user"`

	// Data is an optional field to dump data that you wont necessarily want to aggregate on, but you may want to search on
	Data interface{} `json:"data,omitempty"`
}

An Event is generated as a result of something happening in a room and enables other systems to act on it, as well as collect metrics.

func (*Event) AddToTags

func (e *Event) AddToTags(tags ...string)

AddToTags takes one or more strings and adds them to the list of event tags on the event.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL