[#XX] Update client add policy methods

Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
Denis Kirillov 2023-10-31 17:25:09 +03:00
parent e28c445a50
commit 27e837f551

View file

@ -7,6 +7,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/pkg/service/control"
controlSvc "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/pkg/service/control/server"
policyengine "git.frostfs.info/TrueCloudLab/policy-engine"
engineiam "git.frostfs.info/TrueCloudLab/policy-engine/iam"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"go.uber.org/zap"
@ -60,7 +61,7 @@ func (c *Client) Healthcheck(ctx context.Context) error {
return nil
}
func (c *Client) AddPolicy(ctx context.Context, policy string) error {
func (c *Client) AddPolicyIAM(ctx context.Context, policy string) error {
var p engineiam.Policy
if err := json.Unmarshal([]byte(policy), &p); err != nil {
return err
@ -71,6 +72,10 @@ func (c *Client) AddPolicy(ctx context.Context, policy string) error {
return err
}
return c.AddPolicy(ctx, chain)
}
func (c *Client) AddPolicy(ctx context.Context, chain *policyengine.Chain) error {
req := &control.AddPolicyRequest{
Body: chain.Bytes(),
}