alert

package
v0.0.0-...-712da53 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AlertSource2Cluster = `SELECT * from clusters where id in
(select cluster_id from alert_source2_clusters where source_id = ?)`
)
View Source
const SchemaPrefix = "alert_input_schema_"

Variables

View Source
var AllowSchema = regexp.MustCompile("^[a-zA-Z0-9_-]{1,40}$")

Functions

func EscapeString

func EscapeString(input string) string

func NewAlertInputRepo

func NewAlertInputRepo(db *gorm.DB, cfg *config.Config) (*subRepo, error)

Types

type AlertInput

type AlertInput interface {
	// Manage Cluster
	CreateCluster(cluster *input.Cluster) error
	UpdateCluster(cluster *input.Cluster) error
	DeleteCluster(cluster *input.Cluster) error
	ListCluster() ([]input.Cluster, error)

	// Manage AlertSource
	CreateAlertSource(*input.AlertSource) error
	GetAlertSource(sourceId string) (*input.AlertSource, error)
	UpdateAlertSource(alertSource *input.AlertSource) error
	DeleteAlertSource(alertSource input.SourceFrom) (*input.AlertSource, error)
	ListAlertSource() ([]input.AlertSource, error)

	// Manage AlertEnrichRule
	AddAlertEnrichRule(enrichRule []input.AlertEnrichRule) error
	AddAlertEnrichConditions(enrichConditions []input.AlertEnrichCondition) error
	AddAlertEnrichSchemaTarget(enrichSchemaTarget []input.AlertEnrichSchemaTarget) error
	GetAlertEnrichRule(sourceId string) ([]input.AlertEnrichRule, error)
	GetAlertEnrichConditions(sourceId string) ([]input.AlertEnrichCondition, error)
	GetAlertEnrichSchemaTarget(sourceId string) ([]input.AlertEnrichSchemaTarget, error)
	DeleteAlertEnrichRule(ruleIds []string) error
	DeleteAlertEnrichRuleBySourceId(sourceId string) error
	DeleteAlertEnrichConditions(ruleIds []string) error
	DeleteAlertEnrichConditionsBySourceId(sourceId string) error
	DeleteAlertEnrichSchemaTarget(ruleIds []string) error
	DeleteAlertEnrichSchemaTargetBySourceId(sourceId string) error

	// Manage schema
	CreateSchema(schema string, columns []string) error
	DeleteSchema(string) error
	CheckSchemaIsUsed(schema string) ([]string, error)
	ListSchema() ([]string, error)
	ListSchemaColumns(schema string) ([]string, error)
	InsertSchemaData(schema string, columns []string, fullRows [][]string) error
	GetSchemaData(schema string) ([]string, map[int64][]string, error)
	UpdateSchemaData(schema string, columns []string, rows map[int][]string) error
	ClearSchemaData(schema string) error
	SearchSchemaTarget(schema string, sourceField string, sourceValue string, targets []input.AlertEnrichSchemaTarget) ([]string, error)

	ListAlertTargetTags() ([]input.TargetTag, error)

	// Load complate alertEnrichRule
	LoadAlertEnrichRule() ([]input.AlertSource, map[input.SourceFrom][]input.AlertEnrichRuleVO, error)
}

Jump to

Keyboard shortcuts

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