[#1865] cli/object: Do not open remote sessions in reading ops

It does not make sense to open remote sessions with the storage node in
`get`, `head`, `search`, `range` and `hash` sub-commands of `neofs-cli
object` command.

Do not use NeoFS API `SessionService` in mentioned commands. Decode
object session from JSON file specified `--session` flag. Perform some
sanity checks instantly on CLI side.

Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
This commit is contained in:
Leonard Lyubich 2022-10-10 22:31:19 +04:00 committed by fyrchik
parent 49eab6318c
commit 9a006ac14f
7 changed files with 112 additions and 9 deletions

View file

@ -95,9 +95,12 @@ func getObjectHash(cmd *cobra.Command, _ []string) {
return
}
cli := internalclient.GetSDKClientByFlag(cmd, pk, commonflags.RPC)
var hashPrm internalclient.HashPayloadRangesPrm
sessionCli.Prepare(cmd, cnr, &obj, pk, &hashPrm)
hashPrm.SetClient(cli)
Prepare(cmd, &hashPrm)
readSession(cmd, &hashPrm, pk, cnr, obj)
hashPrm.SetAddress(objAddr)
hashPrm.SetSalt(salt)
hashPrm.SetRanges(ranges)