feat(aa): add merge methods to the rule interface.

This commit is contained in:
Alexandre Pujol 2024-06-22 20:59:43 +01:00
parent a91e2ddf56
commit 6791dcde28
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
14 changed files with 192 additions and 11 deletions

View file

@ -97,6 +97,19 @@ func (r *Mqueue) Compare(other Rule) int {
return r.Qualifier.Compare(o.Qualifier)
}
func (r *Mqueue) Merge(other Rule) bool {
o, _ := other.(*Mqueue)
if !r.Qualifier.Equal(o.Qualifier) {
return false
}
if r.Type == o.Type && r.Label == o.Label && r.Name == o.Name {
r.Access = merge(r.Kind(), "access", r.Access, o.Access)
return r.RuleBase.merge(o.RuleBase)
}
return false
}
func (r *Mqueue) String() string {
return renderTemplate(r.Kind(), r)
}