package policy import ( "git.frostfs.info/TrueCloudLab/policy-engine/pkg/chain" "git.frostfs.info/TrueCloudLab/policy-engine/pkg/engine" "git.frostfs.info/TrueCloudLab/policy-engine/pkg/engine/inmemory" "git.frostfs.info/TrueCloudLab/policy-engine/pkg/resource" ) const S3ChainName chain.Name = "s3" type Storage struct { router engine.ChainRouter morph engine.MorphRuleChainStorage local engine.LocalOverrideStorage } var _ engine.LocalOverrideEngine = (*Storage)(nil) func NewStorage(morph engine.MorphRuleChainStorage) *Storage { local := inmemory.NewInmemoryLocalStorage() return &Storage{ router: engine.NewDefaultChainRouterWithLocalOverrides(morph, local), morph: morph, local: local, } } func (s Storage) IsAllowed(name chain.Name, target engine.RequestTarget, r resource.Request) (status chain.Status, found bool, err error) { return s.router.IsAllowed(name, target, r) } func (s Storage) MorphRuleChainStorage() engine.MorphRuleChainStorage { return s.morph } func (s Storage) LocalStorage() engine.LocalOverrideStorage { return s.local }