Documentation ¶
Index ¶
- Constants
- type RuleCondition
- type RuleCreator
- type RuleCreatorMock
- func (r *RuleCreatorMock) CreateRuleByID(id string) RuleEvaluator
- func (r *RuleCreatorMock) CreateRuleByName(name string) RuleEvaluator
- func (r *RuleCreatorMock) CreateRulesByEventType(eventType utils.EventType) []RuleEvaluator
- func (r *RuleCreatorMock) CreateRulesByTags(tags []string) []RuleEvaluator
- func (r *RuleCreatorMock) RegisterRule(rule RuleDescriptor)
- type RuleDescriptor
- type RuleEvaluator
- type RuleFailure
- type RuleMock
- func (rule *RuleMock) DeleteRule()
- func (rule *RuleMock) GetParameters() map[string]interface{}
- func (rule *RuleMock) ID() string
- func (rule *RuleMock) Name() string
- func (rule *RuleMock) ProcessEvent(_ utils.EventType, _ utils.K8sEvent, _ objectcache.ObjectCache) RuleFailure
- func (rule *RuleMock) Requirements() RuleSpec
- func (rule *RuleMock) SetParameters(p map[string]interface{})
- type RuleSpec
- type RuleSpecMock
Constants ¶
View Source
const ( RulePriorityNone = 0 RulePriorityLow = 1 RulePriorityMed = 5 RulePriorityHigh = 8 RulePriorityCritical = 10 RulePrioritySystemIssue = 1000 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RuleCondition ¶ added in v0.2.178
type RuleCondition interface { EvaluateRule(eventType utils.EventType, event utils.K8sEvent, k8sObjCache objectcache.K8sObjectCache) bool ID() string }
type RuleCreator ¶
type RuleCreator interface { CreateRulesByTags(tags []string) []RuleEvaluator CreateRuleByID(id string) RuleEvaluator CreateRuleByName(name string) RuleEvaluator RegisterRule(rule RuleDescriptor) CreateRulesByEventType(eventType utils.EventType) []RuleEvaluator }
RuleCreator is an interface for creating rules by tags, IDs, and names
type RuleCreatorMock ¶
type RuleCreatorMock struct { }
func (*RuleCreatorMock) CreateRuleByID ¶
func (r *RuleCreatorMock) CreateRuleByID(id string) RuleEvaluator
func (*RuleCreatorMock) CreateRuleByName ¶
func (r *RuleCreatorMock) CreateRuleByName(name string) RuleEvaluator
func (*RuleCreatorMock) CreateRulesByEventType ¶ added in v0.2.178
func (r *RuleCreatorMock) CreateRulesByEventType(eventType utils.EventType) []RuleEvaluator
func (*RuleCreatorMock) CreateRulesByTags ¶
func (r *RuleCreatorMock) CreateRulesByTags(tags []string) []RuleEvaluator
func (*RuleCreatorMock) RegisterRule ¶ added in v0.2.145
func (r *RuleCreatorMock) RegisterRule(rule RuleDescriptor)
type RuleDescriptor ¶ added in v0.2.145
type RuleDescriptor struct { // Rule ID ID string // Rule Name Name string // Rule Description Description string // Priority Priority int // Tags Tags []string // Rule requirements Requirements RuleSpec // Create a rule function RuleCreationFunc func() RuleEvaluator }
func (*RuleDescriptor) HasTags ¶ added in v0.2.145
func (r *RuleDescriptor) HasTags(tags []string) bool
type RuleEvaluator ¶
type RuleEvaluator interface { // Rule ID - this is the rules unique identifier ID() string // Rule Name Name() string // Rule processing ProcessEvent(eventType utils.EventType, event utils.K8sEvent, objCache objectcache.ObjectCache) RuleFailure // Rule requirements Requirements() RuleSpec // Set rule parameters SetParameters(parameters map[string]interface{}) // Get rule parameters GetParameters() map[string]interface{} }
type RuleFailure ¶
type RuleFailure interface { // Get Base Runtime Alert GetBaseRuntimeAlert() apitypes.BaseRuntimeAlert // Get Runtime Process Details GetRuntimeProcessDetails() apitypes.ProcessTree // Get Trigger Event GetTriggerEvent() igtypes.Event // Get Rule Description GetRuleAlert() apitypes.RuleAlert // Get K8s Runtime Details GetRuntimeAlertK8sDetails() apitypes.RuntimeAlertK8sDetails // Get Rule ID GetRuleId() string // Get Extra GetExtra() interface{} // Get Cloud Services GetCloudServices() []string // Set Workload Details SetWorkloadDetails(workloadDetails string) // Set Base Runtime Alert SetBaseRuntimeAlert(baseRuntimeAlert apitypes.BaseRuntimeAlert) // Set Runtime Process Details SetRuntimeProcessDetails(runtimeProcessDetails apitypes.ProcessTree) // Set Trigger Event SetTriggerEvent(triggerEvent igtypes.Event) // Set Rule Description SetRuleAlert(ruleAlert apitypes.RuleAlert) // Set K8s Runtime Details SetRuntimeAlertK8sDetails(runtimeAlertK8sDetails apitypes.RuntimeAlertK8sDetails) // Set Cloud Services SetCloudServices(cloudServices []string) }
type RuleMock ¶
type RuleMock struct { RuleRequirements RuleSpec RuleParameters map[string]interface{} RuleName string RuleID string }
func (*RuleMock) DeleteRule ¶
func (rule *RuleMock) DeleteRule()
func (*RuleMock) GetParameters ¶
func (*RuleMock) ProcessEvent ¶
func (rule *RuleMock) ProcessEvent(_ utils.EventType, _ utils.K8sEvent, _ objectcache.ObjectCache) RuleFailure
func (*RuleMock) Requirements ¶
func (*RuleMock) SetParameters ¶
type RuleSpec ¶
type RuleSpec interface { // Event types required for the rule RequiredEventTypes() []utils.EventType }
RuleSpec is an interface for rule requirements
type RuleSpecMock ¶
type RuleSpecMock struct { }
func (*RuleSpecMock) RequiredEventTypes ¶
func (ruleSpec *RuleSpecMock) RequiredEventTypes() []utils.EventType
Click to show internal directories.
Click to hide internal directories.