forked from TrueCloudLab/frostfs-sdk-go
[#48] client: Refactor ContainerSetEACL()
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
8bc8f1f365
commit
57619fbbe4
1 changed files with 10 additions and 17 deletions
|
@ -9,6 +9,7 @@ import (
|
||||||
rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc"
|
rpcapi "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client"
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client"
|
||||||
v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
|
v2session "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/signature"
|
||||||
frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto"
|
frostfscrypto "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto"
|
||||||
frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa"
|
frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/eacl"
|
||||||
|
@ -82,7 +83,7 @@ func (x *PrmContainerSetEACL) formRequest(c *Client) (*v2container.SetExtendedAC
|
||||||
|
|
||||||
var req v2container.SetExtendedACLRequest
|
var req v2container.SetExtendedACLRequest
|
||||||
req.SetBody(reqBody)
|
req.SetBody(reqBody)
|
||||||
req.SetMetaHeader(&meta)
|
c.prepareRequest(&req, &meta)
|
||||||
return &req, nil
|
return &req, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,24 +116,16 @@ func (c *Client) ContainerSetEACL(ctx context.Context, prm PrmContainerSetEACL)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// init call context
|
if err := signature.SignServiceMessage(&c.prm.key, req); err != nil {
|
||||||
|
return nil, fmt.Errorf("sign request: %w", err)
|
||||||
var (
|
|
||||||
cc contextCall
|
|
||||||
res ResContainerSetEACL
|
|
||||||
)
|
|
||||||
|
|
||||||
c.initCallContext(&cc)
|
|
||||||
cc.req = req
|
|
||||||
cc.statusRes = &res
|
|
||||||
cc.call = func() (responseV2, error) {
|
|
||||||
return rpcapi.SetEACL(&c.c, req, client.WithContext(ctx))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// process call
|
resp, err := rpcapi.SetEACL(&c.c, req, client.WithContext(ctx))
|
||||||
if !cc.processCall() {
|
if err != nil {
|
||||||
return nil, cc.err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &res, nil
|
var res ResContainerSetEACL
|
||||||
|
res.st, err = c.processResponse(resp)
|
||||||
|
return &res, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue