[#372] cli/sg: Support X-headers in storagegroup command

Attach X-headers to all requests of storagegroup commands (put,
get, list, delete).

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-02-10 00:48:19 +03:00 committed by Alex Vanin
parent cdab2fc520
commit 687af30c05

View file

@ -167,7 +167,10 @@ func putSG(cmd *cobra.Command, _ []string) error {
oid, err := cli.PutObject(ctx, oid, err := cli.PutObject(ctx,
new(client.PutObjectParams). new(client.PutObjectParams).
WithObject(obj.Object()), WithObject(obj.Object()),
client.WithSession(tok)) append(globalCallOptions(),
client.WithSession(tok),
)...,
)
if err != nil { if err != nil {
return fmt.Errorf("can't put storage group: %w", err) return fmt.Errorf("can't put storage group: %w", err)
} }
@ -210,7 +213,10 @@ func getSG(cmd *cobra.Command, _ []string) error {
obj, err := cli.GetObject(ctx, obj, err := cli.GetObject(ctx,
new(client.GetObjectParams). new(client.GetObjectParams).
WithAddress(addr), WithAddress(addr),
client.WithSession(tok)) append(globalCallOptions(),
client.WithSession(tok),
)...,
)
if err != nil { if err != nil {
return fmt.Errorf("can't get storage group: %w", err) return fmt.Errorf("can't get storage group: %w", err)
} }
@ -252,7 +258,9 @@ func listSG(cmd *cobra.Command, _ []string) error {
new(client.SearchObjectParams). new(client.SearchObjectParams).
WithContainerID(cid). WithContainerID(cid).
WithSearchFilters(storagegroup.SearchQuery()), WithSearchFilters(storagegroup.SearchQuery()),
client.WithSession(tok), append(globalCallOptions(),
client.WithSession(tok),
)...,
) )
if err != nil { if err != nil {
return fmt.Errorf("can't search storage groups: %w", err) return fmt.Errorf("can't search storage groups: %w", err)
@ -292,7 +300,10 @@ func delSG(cmd *cobra.Command, _ []string) error {
tombstone, err := client.DeleteObject(ctx, cli, tombstone, err := client.DeleteObject(ctx, cli,
new(client.DeleteObjectParams). new(client.DeleteObjectParams).
WithAddress(addr), WithAddress(addr),
client.WithSession(tok)) append(globalCallOptions(),
client.WithSession(tok),
)...,
)
if err != nil { if err != nil {
return fmt.Errorf("can't get storage group: %w", err) return fmt.Errorf("can't get storage group: %w", err)
} }