[#191] pool: use bearer token

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2022-04-06 10:32:01 +03:00
parent b006ade154
commit 0367c83f5a

View file

@ -807,6 +807,10 @@ func (p *Pool) DeleteObject(ctx context.Context, addr address.Address, opts ...C
prm.ByID(*obj)
}
if cfg.btoken != nil {
prm.WithBearerToken(*cfg.btoken)
}
prm.UseKey(*cc.key)
return p.callWithRetry(&cc, func() error {
@ -862,6 +866,10 @@ func (p *Pool) GetObject(ctx context.Context, addr address.Address, opts ...Call
prm.ByID(*obj)
}
if cfg.btoken != nil {
prm.WithBearerToken(*cfg.btoken)
}
var res ResGetObject
err = p.callWithRetry(&cc, func() error {
@ -914,6 +922,10 @@ func (p *Pool) HeadObject(ctx context.Context, addr address.Address, opts ...Cal
prm.ByID(*obj)
}
if cfg.btoken != nil {
prm.WithBearerToken(*cfg.btoken)
}
prm.UseKey(*cc.key)
var obj object.Object
@ -979,6 +991,10 @@ func (p *Pool) ObjectRange(ctx context.Context, addr address.Address, off, ln ui
prm.ByID(*obj)
}
if cfg.btoken != nil {
prm.WithBearerToken(*cfg.btoken)
}
var res ResObjectRange
err = p.callWithRetry(&cc, func() error {
@ -1037,6 +1053,10 @@ func (p *Pool) SearchObjects(ctx context.Context, idCnr cid.ID, filters object.S
prm.InContainer(idCnr)
prm.SetFilters(filters)
if cfg.btoken != nil {
prm.WithBearerToken(*cfg.btoken)
}
var cc callContextWithRetry
cc.Context = ctx