From 687af30c05f3d0c7b77deded6ad72f2fbc806574 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 10 Feb 2021 00:48:19 +0300 Subject: [PATCH] [#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 --- cmd/neofs-cli/modules/storagegroup.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/cmd/neofs-cli/modules/storagegroup.go b/cmd/neofs-cli/modules/storagegroup.go index cd76ed9add..ddde0b04b1 100644 --- a/cmd/neofs-cli/modules/storagegroup.go +++ b/cmd/neofs-cli/modules/storagegroup.go @@ -167,7 +167,10 @@ func putSG(cmd *cobra.Command, _ []string) error { oid, err := cli.PutObject(ctx, new(client.PutObjectParams). WithObject(obj.Object()), - client.WithSession(tok)) + append(globalCallOptions(), + client.WithSession(tok), + )..., + ) if err != nil { 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, new(client.GetObjectParams). WithAddress(addr), - client.WithSession(tok)) + append(globalCallOptions(), + client.WithSession(tok), + )..., + ) if err != nil { return fmt.Errorf("can't get storage group: %w", err) } @@ -252,7 +258,9 @@ func listSG(cmd *cobra.Command, _ []string) error { new(client.SearchObjectParams). WithContainerID(cid). WithSearchFilters(storagegroup.SearchQuery()), - client.WithSession(tok), + append(globalCallOptions(), + client.WithSession(tok), + )..., ) if err != nil { 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, new(client.DeleteObjectParams). WithAddress(addr), - client.WithSession(tok)) + append(globalCallOptions(), + client.WithSession(tok), + )..., + ) if err != nil { return fmt.Errorf("can't get storage group: %w", err) }