forked from TrueCloudLab/frostfs-node
[#1933] cli: Support binary sessions
There is a need to support NeoFS-binary sessions along with JSON ones in NeoFS CLI. Provide generic `common.ReadBinaryOrJSON` functions which tries to decode NeoFS-binary structure and falls back to JSON format. Use this function in all places with token reading. Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
This commit is contained in:
parent
04b67f3ba5
commit
8bba490c30
24 changed files with 259 additions and 206 deletions
|
@ -9,7 +9,6 @@ import (
|
|||
"github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/commonflags"
|
||||
"github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/key"
|
||||
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/session"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@ -21,13 +20,7 @@ Only owner of the container has a permission to remove container.`,
|
|||
Run: func(cmd *cobra.Command, args []string) {
|
||||
id := parseContainerID(cmd)
|
||||
|
||||
var tok *session.Container
|
||||
|
||||
sessionTokenPath, _ := cmd.Flags().GetString(commonflags.SessionToken)
|
||||
if sessionTokenPath != "" {
|
||||
tok = new(session.Container)
|
||||
common.ReadSessionToken(cmd, tok, sessionTokenPath)
|
||||
}
|
||||
tok := getSession(cmd)
|
||||
|
||||
pk := key.Get(cmd)
|
||||
cli := internalclient.GetSDKClientByFlag(cmd, pk, commonflags.RPC)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue