feat(aa): add initial profile validation structure.

This commit is contained in:
Alexandre Pujol 2024-05-25 22:36:39 +01:00
parent 2dd6046697
commit 92641e7e28
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
20 changed files with 222 additions and 2 deletions

View file

@ -5,6 +5,7 @@
package aa
import (
"fmt"
"slices"
"strings"
)
@ -47,6 +48,16 @@ func newMqueueFromLog(log map[string]string) Rule {
}
}
func (r *Mqueue) Validate() error {
if err := validateValues(r.Kind(), "access", r.Access); err != nil {
return fmt.Errorf("%s: %w", r, err)
}
if err := validateValues(r.Kind(), "type", []string{r.Type}); err != nil {
return fmt.Errorf("%s: %w", r, err)
}
return nil
}
func (r *Mqueue) Less(other any) bool {
o, _ := other.(*Mqueue)
if len(r.Access) != len(o.Access) {