Documentation ¶
Overview ¶
Package idlerule contains idle rule model and adapter.
Index ¶
Constants ¶
View Source
const ( RuleTypeAlarm = "alarm" RuleTypeEntity = "entity" RuleAlarmConditionLastEvent = "last_event" // alarms which don't receive events after "now - duration" RuleAlarmConditionLastUpdate = "last_update" // alarms which don't change after "now - duration" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Operation ¶
type Operation struct { Type string `bson:"type" json:"type"` Parameters interface{} `bson:"parameters,omitempty" json:"parameters"` }
type Rule ¶
type Rule struct { ID string `bson:"_id,omitempty" json:"_id"` Name string `bson:"name" json:"name"` Description string `bson:"description" json:"description"` Author string `bson:"author" json:"author"` Enabled bool `bson:"enabled" json:"enabled"` Type string `bson:"type" json:"type"` Priority int64 `bson:"priority" json:"priority"` Duration types.DurationWithUnit `bson:"duration" json:"duration"` EntityPatterns pattern.EntityPatternList `bson:"entity_patterns" json:"entity_patterns"` // DisableDuringPeriods is an option that allows to disable the rule // when entity is in listed periods due pbehavior schedule. DisableDuringPeriods []string `bson:"disable_during_periods" json:"disable_during_periods"` Created types.CpsTime `bson:"created" json:"created"` Updated types.CpsTime `bson:"updated" json:"updated"` // Only for Alarm rules AlarmPatterns pattern.AlarmPatternList `bson:"alarm_patterns,omitempty" json:"alarm_patterns,omitempty"` AlarmCondition string `bson:"alarm_condition,omitempty" json:"alarm_condition,omitempty"` Operation *Operation `bson:"operation,omitempty" json:"operation,omitempty"` }
Rule represents alarm modification condition and operation.
type RuleAdapter ¶
type RuleAdapter interface { // GetEnabled returns all enabled rules. GetEnabled(ctx context.Context) ([]Rule, error) }
RuleAdapter interface is used to implement an storage adapter.
func NewRuleAdapter ¶
func NewRuleAdapter(client mongo.DbClient) RuleAdapter
NewRuleAdapter creates new rule adapter.
Click to show internal directories.
Click to hide internal directories.