forked from TrueCloudLab/frostfs-s3-gw
[#XX] Update client add policy methods
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
parent
e28c445a50
commit
27e837f551
1 changed files with 6 additions and 1 deletions
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/pkg/service/control"
|
"git.frostfs.info/TrueCloudLab/frostfs-s3-gw/pkg/service/control"
|
||||||
controlSvc "git.frostfs.info/TrueCloudLab/frostfs-s3-gw/pkg/service/control/server"
|
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"
|
engineiam "git.frostfs.info/TrueCloudLab/policy-engine/iam"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
@ -60,7 +61,7 @@ func (c *Client) Healthcheck(ctx context.Context) error {
|
||||||
return nil
|
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
|
var p engineiam.Policy
|
||||||
if err := json.Unmarshal([]byte(policy), &p); err != nil {
|
if err := json.Unmarshal([]byte(policy), &p); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -71,6 +72,10 @@ func (c *Client) AddPolicy(ctx context.Context, policy string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return c.AddPolicy(ctx, chain)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) AddPolicy(ctx context.Context, chain *policyengine.Chain) error {
|
||||||
req := &control.AddPolicyRequest{
|
req := &control.AddPolicyRequest{
|
||||||
Body: chain.Bytes(),
|
Body: chain.Bytes(),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue