diff --git a/pkg/aa/rules.go b/pkg/aa/rules.go index 4cfdda3b..7cb6dc1a 100644 --- a/pkg/aa/rules.go +++ b/pkg/aa/rules.go @@ -32,3 +32,24 @@ type Rules []Rule func (r Rules) String() string { return renderTemplate("rules", r) } + +func (r Rules) Get(filter string) Rules { + res := make(Rules, 0) + for _, rule := range r { + if rule.Kind() == filter { + res = append(res, rule) + } + } + return res +} + +func (r Rules) GetVariables() []*Variable { + res := make([]*Variable, 0) + for _, rule := range r { + switch rule.(type) { + case *Variable: + res = append(res, rule.(*Variable)) + } + } + return res +}