From 0367c83f5a1382ed047d06698ddb8087d85d62de Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Wed, 6 Apr 2022 10:32:01 +0300 Subject: [PATCH] [#191] pool: use bearer token Signed-off-by: Denis Kirillov --- pool/pool.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pool/pool.go b/pool/pool.go index 471c97c..c47ae9d 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -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