rules

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyCondition = errors.New("rule condition cannot be empty")
	ErrInvalidSyntax  = errors.New("invalid rule syntax")
)

Functions

This section is empty.

Types

type EvaluationParams added in v0.5.2

type EvaluationParams struct {
	CertExpiryTime time.Time
	Downtime       time.Duration
	ResponseTime   time.Duration
}

type Rule

type Rule struct {
	Name            string   `yaml:"name"`
	Type            RuleType `yaml:"type"`
	Condition       string   `yaml:"condition,omitempty"`
	Tags            []string `yaml:"tags"`
	Notifications   []string `yaml:"notifications"`
	MinDaysValidity int      `yaml:"min_days_validity,omitempty"`
}

func (Rule) GetNotificationTypes

func (r Rule) GetNotificationTypes() []string

func (Rule) Validate added in v0.5.2

func (r Rule) Validate() error

type RuleResult

type RuleResult struct {
	Error     error
	Message   string
	Satisfied bool
}

func EvaluateRule

func EvaluateRule(rule Rule, params EvaluationParams) RuleResult

type RuleType added in v0.5.2

type RuleType string
const (
	StandardRule RuleType = "standard"
	CertRule     RuleType = "cert"
)

Jump to

Keyboard shortcuts

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