forked from TrueCloudLab/frostfs-node
[#747] client: Refactor PrmObjectPutSingle usage
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
dc4d27201b
commit
12b7cf2533
3 changed files with 10 additions and 20 deletions
|
@ -449,25 +449,15 @@ func PutObjectSingle(ctx context.Context, prm PutObjectPrm) (*PutObjectRes, erro
|
|||
return nil, errors.New("missing object id")
|
||||
}
|
||||
|
||||
var prmCli client.PrmObjectPutSingle
|
||||
|
||||
prmCli.ExecuteLocal()
|
||||
|
||||
if prm.key != nil {
|
||||
prmCli.UseKey(prm.key)
|
||||
prmCli := client.PrmObjectPutSingle{
|
||||
XHeaders: prm.xHeaders,
|
||||
BearerToken: prm.tokenBearer,
|
||||
Session: prm.tokenSession,
|
||||
Local: true,
|
||||
Key: prm.key,
|
||||
Object: prm.obj,
|
||||
}
|
||||
|
||||
if prm.tokenSession != nil {
|
||||
prmCli.WithinSession(*prm.tokenSession)
|
||||
}
|
||||
|
||||
if prm.tokenBearer != nil {
|
||||
prmCli.WithBearerToken(*prm.tokenBearer)
|
||||
}
|
||||
|
||||
prmCli.WithXHeaders(prm.xHeaders...)
|
||||
prmCli.SetObject(prm.obj.ToV2())
|
||||
|
||||
res, err := prm.cli.ObjectPutSingle(ctx, prmCli)
|
||||
if err != nil {
|
||||
ReportError(prm.cli, err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue