2022-09-17 12:37:01 +00:00
|
|
|
package netmap
|
|
|
|
|
|
|
|
import (
|
2023-03-07 13:38:26 +00:00
|
|
|
internalclient "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/client"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key"
|
|
|
|
commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common"
|
2022-09-17 12:37:01 +00:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
var snapshotCmd = &cobra.Command{
|
|
|
|
Use: "snapshot",
|
|
|
|
Short: "Request current local snapshot of the network map",
|
|
|
|
Long: `Request current local snapshot of the network map`,
|
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
p := key.GetOrGenerate(cmd)
|
|
|
|
cli := internalclient.GetSDKClientByFlag(cmd, p, commonflags.RPC)
|
|
|
|
|
|
|
|
var prm internalclient.NetMapSnapshotPrm
|
|
|
|
prm.SetClient(cli)
|
|
|
|
|
2023-05-24 13:51:57 +00:00
|
|
|
res, err := internalclient.NetMapSnapshot(cmd.Context(), prm)
|
2023-01-16 09:20:16 +00:00
|
|
|
commonCmd.ExitOnErr(cmd, "rpc error: %w", err)
|
2022-09-17 12:37:01 +00:00
|
|
|
|
2023-01-16 09:20:16 +00:00
|
|
|
commonCmd.PrettyPrintNetMap(cmd, res.NetMap(), false)
|
2022-09-17 12:37:01 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
func initSnapshotCmd() {
|
|
|
|
commonflags.Init(snapshotCmd)
|
|
|
|
commonflags.InitAPI(snapshotCmd)
|
|
|
|
}
|