interfaces

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionLogger added in v0.0.10

type ActionLogger interface {
	LogInit(logs []model.Next)
	LogRun(logs []model.Action)
	LogExit(logs []model.Next)
}

ActionLogger records the "play" result of each action, which is used for debugging and testing purposes. An ActionLogger should be created by the AlertLogger for each action. The AlertLogger is registered as an option within the chain.Chain.

type ActionMock

type ActionMock interface {
	GetResult(name types.ActionName) any
}

ActionMock is an interface for "play" mode. The mock should be registered as an option within the chain.Chain. This mock only returns the prepared result for each action ID.

type AlertHandler added in v0.0.15

type AlertHandler func(ctx *model.Context, schema types.Schema, data any) ([]*model.Alert, error)

AlertHandler is a function to handle the alert from data source. The handler is registered as an option within the chain.Chain.

type AlertLogger

type AlertLogger interface {
	NewActionLogger() ActionLogger
}

AlertLogger records the "play" Action results of the chain, which is used for debugging and testing purposes. An AlertLogger should be created by the ScenarioLogger for each alert. The ScenarioLogger is registered as an option within the chain.Chain.

type Database added in v0.0.7

type Database interface {
	GetAttrs(ctx *model.Context, ns types.Namespace) (model.Attributes, error)
	PutAttrs(ctx *model.Context, ns types.Namespace, attrs model.Attributes) error
	PutWorkflow(ctx *model.Context, workflow model.WorkflowRecord) error
	GetWorkflows(ctx *model.Context, offset, limit int) ([]model.WorkflowRecord, error)
	GetWorkflow(ctx *model.Context, id types.WorkflowID) (*model.WorkflowRecord, error)
	Lock(ctx *model.Context, ns types.Namespace, timeout time.Time) error
	Unlock(ctx *model.Context, ns types.Namespace) error
	Close() error
}

type Env

type Env func() types.EnvVars

type RunAction

type RunAction func(ctx *model.Context, alert model.Alert, args model.ActionArgs) (any, error)

RunAction is a function to run an action. The function is registered as an option within the chain.Chain.

type ScenarioLogger

type ScenarioLogger interface {
	NewAlertLogger(alert *model.Alert) AlertLogger
	LogError(err error)
	Flush() error
}

ScenarioLogger records the "play" result of the alert chain, which is used for debugging and testing purposes. A logger should be created by the LoggerFactory for each scenario. The LoggerFactory is registered as an option within the chain.Chain.

type TxProc added in v0.0.7

type TxProc func(ctx *model.Context, input model.Attributes) (model.Attributes, error)

Jump to

Keyboard shortcuts

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