forked from TrueCloudLab/frostfs-node
[#747] client: Refactor PrmObjectPutInit usage
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
12b7cf2533
commit
58b6224dd8
2 changed files with 16 additions and 33 deletions
|
@ -392,24 +392,14 @@ func PutObject(ctx context.Context, prm PutObjectPrm) (*PutObjectRes, error) {
|
|||
ctx, span := tracing.StartSpanFromContext(ctx, "client.PutObject")
|
||||
defer span.End()
|
||||
|
||||
var prmCli client.PrmObjectPutInit
|
||||
|
||||
prmCli.MarkLocal()
|
||||
|
||||
if prm.key != nil {
|
||||
prmCli.UseKey(*prm.key)
|
||||
prmCli := client.PrmObjectPutInit{
|
||||
XHeaders: prm.xHeaders,
|
||||
BearerToken: prm.tokenBearer,
|
||||
Session: prm.tokenSession,
|
||||
Local: true,
|
||||
Key: prm.key,
|
||||
}
|
||||
|
||||
if prm.tokenSession != nil {
|
||||
prmCli.WithinSession(*prm.tokenSession)
|
||||
}
|
||||
|
||||
if prm.tokenBearer != nil {
|
||||
prmCli.WithBearerToken(*prm.tokenBearer)
|
||||
}
|
||||
|
||||
prmCli.WithXHeaders(prm.xHeaders...)
|
||||
|
||||
w, err := prm.cli.ObjectPutInit(ctx, prmCli)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init object writing on client: %w", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue