rules

package
v0.2.41 Latest Latest
Warning

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

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

Documentation

Index

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 RuleCreator

type RuleCreator interface {
	CreateRulesByTags(tags []string) []RuleEvaluator
	CreateRuleByID(id string) RuleEvaluator
	CreateRuleByName(name string) 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) CreateRulesByTags

func (r *RuleCreatorMock) CreateRulesByTags(tags []string) []RuleEvaluator

type RuleEvaluator

type RuleEvaluator interface {
	// Rule ID - this is the rules unique identifier
	ID() string
	// Rule Name
	Name() string
	// Rule processing
	ProcessEvent(event admission.Attributes, access objectcache.KubernetesCache) RuleFailure
	// 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 Rule Description
	GetRuleAlert() apitypes.RuleAlert
	// Get Admissions Details
	GetAdmissionsAlert() apitypes.AdmissionAlert
	// Get K8s Runtime Details
	GetRuntimeAlertK8sDetails() apitypes.RuntimeAlertK8sDetails
	// Get Rule ID
	GetRuleId() string

	// Set Workload Details
	SetWorkloadDetails(workloadDetails string)
	// Set Base Runtime Alert
	SetBaseRuntimeAlert(baseRuntimeAlert apitypes.BaseRuntimeAlert)
	// Set Runtime Process Details
	SetRuntimeProcessDetails(runtimeProcessDetails apitypes.ProcessTree)
	// Set Rule Description
	SetRuleAlert(ruleAlert apitypes.RuleAlert)
	// Set Admissions Details
	SetAdmissionsAlert(admissionsAlert apitypes.AdmissionAlert)
	// Set K8s Runtime Details
	SetRuntimeAlertK8sDetails(runtimeAlertK8sDetails apitypes.RuntimeAlertK8sDetails)
}

type RuleMock

type RuleMock struct {
	RuleParameters map[string]interface{}
	RuleName       string
	RuleID         string
}

func (*RuleMock) DeleteRule

func (rule *RuleMock) DeleteRule()

func (*RuleMock) GetParameters

func (rule *RuleMock) GetParameters() map[string]interface{}

func (*RuleMock) ID

func (rule *RuleMock) ID() string

func (*RuleMock) Name

func (rule *RuleMock) Name() string

func (*RuleMock) ProcessEvent

func (*RuleMock) SetParameters

func (rule *RuleMock) SetParameters(p map[string]interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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