apparmor.d/pkg/aa/blocks.go

38 lines
607 B
Go
Raw Normal View History

2024-05-25 23:17:32 +02:00
// apparmor.d - Full set of apparmor profiles
// Copyright (C) 2021-2024 Alexandre Pujol <alexandre@pujol.io>
// SPDX-License-Identifier: GPL-2.0-only
package aa
const (
HAT Kind = "hat"
2024-05-25 23:17:32 +02:00
)
// Hat represents a single AppArmor hat.
type Hat struct {
Base
2024-05-25 23:17:32 +02:00
Name string
Rules Rules
}
func (p *Hat) Kind() Kind {
return HAT
}
func (p *Hat) Constraint() constraint {
return blockKind
2024-05-25 23:17:32 +02:00
}
func (p *Hat) String() string {
return renderTemplate(p.Kind(), p)
}
func (r *Hat) Validate() error {
return nil
2024-05-25 23:17:32 +02:00
}
func (r *Hat) Compare(other Rule) int {
o, _ := other.(*Hat)
return compare(r.Name, o.Name)
2024-05-25 23:17:32 +02:00
}