task

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EvaluationTypeRule       = "rule"
	EvaluationTypeJavascript = "javascript"
	EvaluationTypeWebhook    = "webhook"
)

Evaluation types

View Source
const (
	DampeningTypeNone           = "none"
	DampeningTypeConsecutive    = "consecutive"
	DampeningTypeEvaluation     = "evaluation"
	DampeningTypeActiveDuration = "active_duration"
)

dampening types

View Source
const (
	KeyIsTriggered = "isTriggered" // expected value from script or from webhook to trigger
)

keys used in script engine

Variables

This section is empty.

Functions

This section is empty.

Types

type Conditions

type Conditions struct {
	Variable string      `json:"variable" yaml:"variable"`
	Operator string      `json:"operator" yaml:"operator"`
	Value    interface{} `json:"value" yaml:"value"`
}

Conditions struct

type Config

type Config struct {
	ID                string                 `json:"id" yaml:"id"`
	Description       string                 `json:"description" yaml:"description"`
	Labels            cmap.CustomStringMap   `json:"labels" yaml:"labels"`
	Enabled           bool                   `json:"enabled" yaml:"enabled"`
	IgnoreDuplicate   bool                   `json:"ignoreDuplicate" yaml:"ignoreDuplicate"`
	AutoDisable       bool                   `json:"autoDisable" yaml:"autoDisable"`
	ReEnable          bool                   `json:"reEnable" yaml:"reEnable"`
	ReEnableDuration  string                 `json:"reEnableDuration" yaml:"reEnableDuration"`
	Variables         map[string]interface{} `json:"variables" yaml:"variables"`
	Dampening         DampeningConfig        `json:"dampening" yaml:"dampening"`
	TriggerOnEvent    bool                   `json:"triggerOnEvent" yaml:"triggerOnEvent"`
	EventFilter       EventFilter            `json:"eventFilter" yaml:"eventFilter"`
	ExecutionInterval string                 `json:"executionInterval" yaml:"executionInterval"`
	EvaluationType    string                 `json:"evaluationType" yaml:"evaluationType"`
	EvaluationConfig  EvaluationConfig       `json:"evaluationConfig" yaml:"evaluationConfig"`
	HandlerParameters map[string]interface{} `json:"handlerParameters" yaml:"handlerParameters"`
	Handlers          []string               `json:"handlers" yaml:"handlers"`
	ModifiedOn        time.Time              `json:"modifiedOn" yaml:"modifiedOn"`
	State             *State                 `json:"state" yaml:"state"`
}

Config struct

type DampeningConfig

type DampeningConfig struct {
	Type           string `json:"type" yaml:"type"`
	Occurrences    int64  `json:"occurrences" yaml:"occurrences"`
	Evaluation     int64  `json:"evaluation" yaml:"evaluation"`
	ActiveDuration string `json:"activeDuration" yaml:"activeDuration"`
}

DampeningConfig struct

type EvaluationConfig

type EvaluationConfig struct {
	Rule       Rule        `json:"rule" yaml:"rule"`
	Javascript string      `json:"javascript" yaml:"javascript"`
	Webhook    WebhookData `json:"webhook" yaml:"webhook"`
}

EvaluationConfig struct

type EventFilter

type EventFilter struct {
	EventTypes  []string             `json:"eventTypes" yaml:"eventTypes"`
	EntityTypes []string             `json:"entityTypes" yaml:"entityTypes"`
	Filters     cmap.CustomStringMap `json:"filters" yaml:"filters"`
}

EventFilter struct

type ExecutionState

type ExecutionState struct {
	Triggered bool      `json:"triggered" yaml:"triggered"`
	Timestamp time.Time `json:"timestamp" yaml:"timestamp"`
}

type Rule

type Rule struct {
	MatchAll   bool         `json:"matchAll" yaml:"matchAll"`
	Conditions []Conditions `json:"conditions" yaml:"conditions"`
}

Rule struct

type State

type State struct {
	LastEvaluation    time.Time        `json:"lastEvaluation" yaml:"lastEvaluation"`
	LastSuccess       time.Time        `json:"lastSuccess" yaml:"lastSuccess"`
	Message           string           `json:"message" yaml:"message"`
	LastDuration      string           `json:"lastDuration" yaml:"lastDuration"`
	LastStatus        bool             `json:"lastStatus" yaml:"lastStatus"`
	ExecutedCount     int64            `json:"executedCount" yaml:"executedCount"`
	ExecutionsHistory []ExecutionState `json:"executionsHistory" yaml:"executionsHistory"`
	ActiveSince       time.Time        `json:"activeSince" yaml:"activeSince"`
}

State struct

type WebhookData

type WebhookData struct {
	URL             string                 `json:"url" yaml:"url"`
	Method          string                 `json:"method" yaml:"method"`
	Insecure        bool                   `json:"insecure" yaml:"insecure"`
	Headers         map[string]string      `json:"headers" yaml:"headers"`
	QueryParameters map[string]interface{} `json:"queryParameters" yaml:"queryParameters"`
	IncludeConfig   bool                   `json:"includeConfig" yaml:"includeConfig"`
}

WebhookData struct

Jump to

Keyboard shortcuts

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