flappingrule

package
v0.0.0-...-9b5cd94 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	Get(ctx context.Context) ([]Rule, error)
}

Adapter interface is used to implement a storage adapter.

func NewAdapter

func NewAdapter(client mongo.DbClient) Adapter

NewAdapter creates new rule adapter.

type Rule

type Rule struct {
	ID          string                    `bson:"_id"`
	Name        string                    `bson:"name"`
	Description string                    `bson:"description"`
	FreqLimit   int                       `bson:"freq_limit"`
	Duration    datetime.DurationWithUnit `bson:"duration"`
	Priority    int64                     `bson:"priority"`
	Author      string                    `bson:"author"`
	Created     datetime.CpsTime          `bson:"created"`
	Updated     datetime.CpsTime          `bson:"updated"`

	savedpattern.EntityPatternFields `bson:",inline"`
	savedpattern.AlarmPatternFields  `bson:",inline"`
}

func (*Rule) Matches

func (r *Rule) Matches(alarmWithEntity types.AlarmWithEntity) (bool, error)

Matches returns true if alarm and entity match field patterns.

Jump to

Keyboard shortcuts

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