forked from TrueCloudLab/frostfs-node
[#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:
parent
cdab2fc520
commit
687af30c05
1 changed files with 15 additions and 4 deletions
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue