generated from TrueCloudLab/basic
[#7] engine: Set project structure pattern for files
* 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>
This commit is contained in:
parent
9472a7123e
commit
a08f600d97
15 changed files with 511 additions and 496 deletions
30
pkg/engine/interface.go
Normal file
30
pkg/engine/interface.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue