[#390] cli: Support more tree service API calls in CLI #488

Merged
fyrchik merged 3 commits from aarifullin/frostfs-node:feature/390-tree_cli into master 2023-07-11 14:11:31 +00:00
2 changed files with 12 additions and 2 deletions
Showing only changes of commit d92569f2df - Show all commits

View file

@ -55,13 +55,18 @@ func add(cmd *cobra.Command, _ []string) {
rawCID := make([]byte, sha256.Size)
cnr.Encode(rawCID)
var bt []byte
if t := common.ReadBearerToken(cmd, bearerFlagKey); t != nil {
bt = t.Marshal()
}
req := new(tree.AddRequest)
req.Body = &tree.AddRequest_Body{
ContainerId: rawCID,
TreeId: tid,
ParentId: pid,
Meta: meta,
BearerToken: common.ReadBearerToken(cmd, bearerFlagKey).Marshal(),
BearerToken: bt,
}
commonCmd.ExitOnErr(cmd, "signing message: %w", tree.SignMessage(req, pk))

View file

@ -63,6 +63,11 @@ func addByPath(cmd *cobra.Command, _ []string) {
path, _ := cmd.Flags().GetString(pathFlagKey)
var bt []byte
if t := common.ReadBearerToken(cmd, bearerFlagKey); t != nil {
bt = t.Marshal()
}
req := new(tree.AddByPathRequest)
req.Body = &tree.AddByPathRequest_Body{
ContainerId: rawCID,
@ -71,7 +76,7 @@ func addByPath(cmd *cobra.Command, _ []string) {
// PathAttribute: pAttr,
Path: strings.Split(path, "/"),
Meta: meta,
BearerToken: common.ReadBearerToken(cmd, bearerFlagKey).Marshal(),
BearerToken: bt,
}
commonCmd.ExitOnErr(cmd, "signing message: %w", tree.SignMessage(req, pk))