From 99e1b9e2aa3979f22654d974f1eb6d43247b851a Mon Sep 17 00:00:00 2001 From: Aayush Date: Wed, 2 Mar 2022 15:39:20 -0500 Subject: [PATCH] Revert "add net stat and limit cli" This reverts commit 0de1566eaff66bbd4574ae9806968dde6c676a5f. --- cli/net.go | 85 ------------------------------------------------------ 1 file changed, 85 deletions(-) diff --git a/cli/net.go b/cli/net.go index 104b4b40e..fdd0a13d6 100644 --- a/cli/net.go +++ b/cli/net.go @@ -36,8 +36,6 @@ var NetCmd = &cli.Command{ NetReachability, NetBandwidthCmd, NetBlockCmd, - NetStatCmd, - NetLimitCmd, }, } @@ -608,86 +606,3 @@ var NetBlockListCmd = &cli.Command{ return nil }, } - -var NetStatCmd = &cli.Command{ - Name: "stat", - Usage: "report resource stat for a scope", - ArgsUsage: "scope", - Action: func(cctx *cli.Context) error { - api, closer, err := GetAPI(cctx) - if err != nil { - return err - } - defer closer() - ctx := ReqContext(cctx) - - args := cctx.Args().Slice() - if len(args) != 1 { - return xerrors.Errorf("must specify exactly one scope") - } - scope := args[0] - - result, err := api.NetStat(ctx, scope) - if err != nil { - return err - } - - enc := json.NewEncoder(os.Stdout) - enc.Encode(result) - - return nil - }, -} - -var NetLimitCmd = &cli.Command{ - Name: "limit", - Usage: "get or set resource limit for a scope", - ArgsUsage: "scope [limit]", - Flags: []cli.Flag{ - &cli.BoolFlag{ - Name: "set", - Usage: "set the limit for a scope", - }, - }, - Action: func(cctx *cli.Context) error { - api, closer, err := GetAPI(cctx) - if err != nil { - return err - } - defer closer() - ctx := ReqContext(cctx) - args := cctx.Args().Slice() - - if cctx.Bool("set") { - if len(args) != 2 { - return xerrors.Errorf("must specify exactly a scope and a limit") - } - scope := args[0] - limitStr := args[1] - - var limit atypes.NetLimit - err := json.Unmarshal([]byte(limitStr), &limit) - if err != nil { - return xerrors.Errorf("error decoding limit: %w", err) - } - - return api.NetSetLimit(ctx, scope, limit) - - } else { - if len(args) != 1 { - return xerrors.Errorf("must specify exactly one scope") - } - scope := args[0] - - result, err := api.NetLimit(ctx, scope) - if err != nil { - return err - } - - enc := json.NewEncoder(os.Stdout) - enc.Encode(result) - } - - return nil - }, -}