generated from TrueCloudLab/basic
a08f600d97
* Create pkg package * Move chain-relates structures to pkg/chain package * Move inmemory and interface files to pkg/engine package * Move resource structures to pkg/resource package * Move GlobMatch to util package Signed-off-by: Airat Arifullin <aarifullin@yadro.com>
35 lines
611 B
Go
35 lines
611 B
Go
package chain
|
|
|
|
import "fmt"
|
|
|
|
// Status is the status for policy application.
|
|
type Status byte
|
|
|
|
const (
|
|
Allow Status = iota
|
|
NoRuleFound
|
|
AccessDenied
|
|
QuotaLimitReached
|
|
last
|
|
)
|
|
|
|
// Valid returns true if the status is valid.
|
|
func (s Status) Valid() bool {
|
|
return s < last
|
|
}
|
|
|
|
// String implements the fmt.Stringer interface.
|
|
func (s Status) String() string {
|
|
switch s {
|
|
case Allow:
|
|
return "Allowed"
|
|
case NoRuleFound:
|
|
return "NoRuleFound"
|
|
case AccessDenied:
|
|
return "Access denied"
|
|
case QuotaLimitReached:
|
|
return "Quota limit reached"
|
|
default:
|
|
return fmt.Sprintf("Denied with status: %d", s)
|
|
}
|
|
}
|