forked from TrueCloudLab/frostfs-sdk-go
[#191] pool: use bearer token
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
f18b4a2a75
commit
e0281c3b34
2 changed files with 20 additions and 1 deletions
1
go.mod
1
go.mod
|
@ -13,5 +13,4 @@ require (
|
||||||
github.com/nspcc-dev/neofs-api-go/v2 v2.12.1
|
github.com/nspcc-dev/neofs-api-go/v2 v2.12.1
|
||||||
github.com/stretchr/testify v1.7.0
|
github.com/stretchr/testify v1.7.0
|
||||||
go.uber.org/zap v1.18.1
|
go.uber.org/zap v1.18.1
|
||||||
google.golang.org/grpc v1.41.0
|
|
||||||
)
|
)
|
||||||
|
|
20
pool/pool.go
20
pool/pool.go
|
@ -1064,6 +1064,10 @@ func (p *Pool) DeleteObject(ctx context.Context, prm PrmObjectDelete) error {
|
||||||
cliPrm.ByID(*obj)
|
cliPrm.ByID(*obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if prm.btoken != nil {
|
||||||
|
cliPrm.WithBearerToken(*prm.btoken)
|
||||||
|
}
|
||||||
|
|
||||||
cliPrm.UseKey(*cc.key)
|
cliPrm.UseKey(*cc.key)
|
||||||
|
|
||||||
return p.callWithRetry(&cc, func() error {
|
return p.callWithRetry(&cc, func() error {
|
||||||
|
@ -1122,6 +1126,10 @@ func (p *Pool) GetObject(ctx context.Context, prm PrmObjectGet) (*ResGetObject,
|
||||||
cliPrm.ByID(*obj)
|
cliPrm.ByID(*obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if prm.btoken != nil {
|
||||||
|
cliPrm.WithBearerToken(*prm.btoken)
|
||||||
|
}
|
||||||
|
|
||||||
var res ResGetObject
|
var res ResGetObject
|
||||||
|
|
||||||
err = p.callWithRetry(&cc, func() error {
|
err = p.callWithRetry(&cc, func() error {
|
||||||
|
@ -1174,6 +1182,10 @@ func (p *Pool) HeadObject(ctx context.Context, prm PrmObjectHead) (*object.Objec
|
||||||
cliPrm.ByID(*obj)
|
cliPrm.ByID(*obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if prm.btoken != nil {
|
||||||
|
cliPrm.WithBearerToken(*prm.btoken)
|
||||||
|
}
|
||||||
|
|
||||||
cliPrm.UseKey(*cc.key)
|
cliPrm.UseKey(*cc.key)
|
||||||
|
|
||||||
var obj object.Object
|
var obj object.Object
|
||||||
|
@ -1248,6 +1260,10 @@ func (p *Pool) ObjectRange(ctx context.Context, prm PrmObjectRange) (*ResObjectR
|
||||||
cliPrm.ByID(*obj)
|
cliPrm.ByID(*obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if prm.btoken != nil {
|
||||||
|
cliPrm.WithBearerToken(*prm.btoken)
|
||||||
|
}
|
||||||
|
|
||||||
var res ResObjectRange
|
var res ResObjectRange
|
||||||
|
|
||||||
err = p.callWithRetry(&cc, func() error {
|
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.InContainer(prm.cnrID)
|
||||||
cliPrm.SetFilters(prm.filters)
|
cliPrm.SetFilters(prm.filters)
|
||||||
|
|
||||||
|
if prm.btoken != nil {
|
||||||
|
cliPrm.WithBearerToken(*prm.btoken)
|
||||||
|
}
|
||||||
|
|
||||||
var cc callContextWithRetry
|
var cc callContextWithRetry
|
||||||
|
|
||||||
cc.Context = ctx
|
cc.Context = ctx
|
||||||
|
|
Loading…
Reference in a new issue