forked from TrueCloudLab/frostfs-api-go
[#218] pkg/client: Add raw flag for object.Head
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
582cdd4ba3
commit
664ebfd8a7
1 changed files with 11 additions and 0 deletions
|
@ -40,6 +40,8 @@ type GetObjectParams struct {
|
||||||
type ObjectHeaderParams struct {
|
type ObjectHeaderParams struct {
|
||||||
addr *object.Address
|
addr *object.Address
|
||||||
|
|
||||||
|
raw bool
|
||||||
|
|
||||||
short bool
|
short bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,6 +496,14 @@ func (p *ObjectHeaderParams) WithMainFields() *ObjectHeaderParams {
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *ObjectHeaderParams) WithRawFlag(v bool) *ObjectHeaderParams {
|
||||||
|
if p != nil {
|
||||||
|
p.raw = v
|
||||||
|
}
|
||||||
|
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, opts ...CallOption) (*object.Object, error) {
|
func (c *Client) GetObjectHeader(ctx context.Context, p *ObjectHeaderParams, opts ...CallOption) (*object.Object, error) {
|
||||||
// check remote node version
|
// check remote node version
|
||||||
switch c.remoteNode.Version.Major() {
|
switch c.remoteNode.Version.Major() {
|
||||||
|
@ -540,6 +550,7 @@ func (c *Client) getObjectHeaderV2(ctx context.Context, p *ObjectHeaderParams, o
|
||||||
// fill body fields
|
// fill body fields
|
||||||
body.SetAddress(p.addr.ToV2())
|
body.SetAddress(p.addr.ToV2())
|
||||||
body.SetMainOnly(p.short)
|
body.SetMainOnly(p.short)
|
||||||
|
body.SetRaw(p.raw)
|
||||||
|
|
||||||
// sign the request
|
// sign the request
|
||||||
if err := signature.SignServiceMessage(c.key, req); err != nil {
|
if err := signature.SignServiceMessage(c.key, req); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue