Airat Arifullin
542d3adcb2
* Introduce grpc server for apemanager service and its implementation in `pkg/services/apemanager`. Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
23 lines
559 B
Go
23 lines
559 B
Go
package apemanager
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/control/server/ape"
|
|
apechain "git.frostfs.info/TrueCloudLab/policy-engine/pkg/chain"
|
|
)
|
|
|
|
func decodeAndValidateChain(encodedChain []byte) (chain apechain.Chain, err error) {
|
|
if err = chain.DecodeBytes(encodedChain); err != nil {
|
|
return
|
|
}
|
|
for _, rule := range chain.Rules {
|
|
for _, name := range rule.Resources.Names {
|
|
if err = ape.ValidateResourceName(name); err != nil {
|
|
err = fmt.Errorf("invalid resource: %w", err)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
return
|
|
}
|