[#191] pool: use bearer token

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2022-04-06 09:19:05 +03:00 committed by Angira Kekteeva
parent f18b4a2a75
commit e0281c3b34
2 changed files with 20 additions and 1 deletions

1
go.mod
View file

@ -13,5 +13,4 @@ require (
github.com/nspcc-dev/neofs-api-go/v2 v2.12.1
github.com/stretchr/testify v1.7.0
go.uber.org/zap v1.18.1
google.golang.org/grpc v1.41.0
)

View file

@ -1064,6 +1064,10 @@ func (p *Pool) DeleteObject(ctx context.Context, prm PrmObjectDelete) error {
cliPrm.ByID(*obj)
}
if prm.btoken != nil {
cliPrm.WithBearerToken(*prm.btoken)
}
cliPrm.UseKey(*cc.key)
return p.callWithRetry(&cc, func() error {
@ -1122,6 +1126,10 @@ func (p *Pool) GetObject(ctx context.Context, prm PrmObjectGet) (*ResGetObject,
cliPrm.ByID(*obj)
}
if prm.btoken != nil {
cliPrm.WithBearerToken(*prm.btoken)
}
var res ResGetObject
err = p.callWithRetry(&cc, func() error {
@ -1174,6 +1182,10 @@ func (p *Pool) HeadObject(ctx context.Context, prm PrmObjectHead) (*object.Objec
cliPrm.ByID(*obj)
}
if prm.btoken != nil {
cliPrm.WithBearerToken(*prm.btoken)
}
cliPrm.UseKey(*cc.key)
var obj object.Object
@ -1248,6 +1260,10 @@ func (p *Pool) ObjectRange(ctx context.Context, prm PrmObjectRange) (*ResObjectR
cliPrm.ByID(*obj)
}
if prm.btoken != nil {
cliPrm.WithBearerToken(*prm.btoken)
}
var res ResObjectRange
err = p.callWithRetry(&cc, func() error {
@ -1320,6 +1336,10 @@ func (p *Pool) SearchObjects(ctx context.Context, prm PrmObjectSearch) (*ResObje
cliPrm.InContainer(prm.cnrID)
cliPrm.SetFilters(prm.filters)
if prm.btoken != nil {
cliPrm.WithBearerToken(*prm.btoken)
}
var cc callContextWithRetry
cc.Context = ctx