forked from TrueCloudLab/policy-engine
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>
30 lines
1.2 KiB
Go
30 lines
1.2 KiB
Go
package engine
|
|
|
|
import (
|
|
"git.frostfs.info/TrueCloudLab/policy-engine/pkg/chain"
|
|
"git.frostfs.info/TrueCloudLab/policy-engine/pkg/resource"
|
|
)
|
|
|
|
// Engine ...
|
|
type Engine interface {
|
|
// IsAllowed returns status for the operation after all checks.
|
|
// The second return value signifies whether a matching rule was found.
|
|
IsAllowed(name chain.Name, namespace string, r resource.Request) (chain.Status, bool)
|
|
}
|
|
|
|
// CachedChainStorage ...
|
|
type CachedChainStorage interface {
|
|
Engine
|
|
// Adds a policy chain used for all operations with a specific resource.
|
|
AddResourceChain(name chain.Name, resource string, c *chain.Chain)
|
|
// Adds a policy chain used for all operations in the namespace.
|
|
AddNameSpaceChain(name chain.Name, namespace string, c *chain.Chain)
|
|
// Adds a local policy chain used for all operations with this service.
|
|
AddOverride(name chain.Name, c *chain.Chain)
|
|
// Gets the local override with given chain id.
|
|
GetOverride(name chain.Name, chainID chain.ID) (chain *chain.Chain, found bool)
|
|
// Remove the local override with given chain id.
|
|
RemoveOverride(name chain.Name, chainID chain.ID) (removed bool)
|
|
// ListOverrides returns the list of local overrides.
|
|
ListOverrides(name chain.Name) []*chain.Chain
|
|
}
|