From bee3741f4e6895b7dc0ee13258afcc15bc76ec44 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Thu, 1 Feb 2024 10:20:17 +0300 Subject: [PATCH] [#932] adm: Move cmd `morph ape` to `ape` package Signed-off-by: Anton Nikiforov --- .../internal/modules/morph/{ => ape}/ape.go | 17 ++++++----------- .../modules/morph/{ => ape}/ape_util.go | 2 +- .../internal/modules/morph/ape/root.go | 16 ++++++++++++++++ cmd/frostfs-adm/internal/modules/morph/root.go | 8 ++------ 4 files changed, 25 insertions(+), 18 deletions(-) rename cmd/frostfs-adm/internal/modules/morph/{ => ape}/ape.go (96%) rename cmd/frostfs-adm/internal/modules/morph/{ => ape}/ape_util.go (99%) create mode 100644 cmd/frostfs-adm/internal/modules/morph/ape/root.go diff --git a/cmd/frostfs-adm/internal/modules/morph/ape.go b/cmd/frostfs-adm/internal/modules/morph/ape/ape.go similarity index 96% rename from cmd/frostfs-adm/internal/modules/morph/ape.go rename to cmd/frostfs-adm/internal/modules/morph/ape/ape.go index f778a6944..de3765042 100644 --- a/cmd/frostfs-adm/internal/modules/morph/ape.go +++ b/cmd/frostfs-adm/internal/modules/morph/ape/ape.go @@ -1,4 +1,4 @@ -package morph +package ape import ( "bytes" @@ -33,11 +33,6 @@ const ( ) var ( - apeCmd = &cobra.Command{ - Use: "ape", - Short: "Section for APE configuration commands", - } - addRuleChainCmd = &cobra.Command{ Use: "add-rule-chain", Short: "Add rule chain", @@ -90,7 +85,7 @@ var ( ) func initAddRuleChainCmd() { - apeCmd.AddCommand(addRuleChainCmd) + Cmd.AddCommand(addRuleChainCmd) addRuleChainCmd.Flags().StringP(morphUtil.EndpointFlag, morphUtil.EndpointFlagShort, "", morphUtil.EndpointFlagDesc) addRuleChainCmd.Flags().String(morphUtil.AlphabetWalletsFlag, "", morphUtil.AlphabetWalletsFlagDesc) @@ -109,7 +104,7 @@ func initAddRuleChainCmd() { } func initRemoveRuleChainCmd() { - apeCmd.AddCommand(removeRuleChainCmd) + Cmd.AddCommand(removeRuleChainCmd) removeRuleChainCmd.Flags().StringP(morphUtil.EndpointFlag, morphUtil.EndpointFlagShort, "", morphUtil.EndpointFlagDesc) removeRuleChainCmd.Flags().String(morphUtil.AlphabetWalletsFlag, "", morphUtil.AlphabetWalletsFlagDesc) @@ -123,7 +118,7 @@ func initRemoveRuleChainCmd() { } func initListRuleChainsCmd() { - apeCmd.AddCommand(listRuleChainsCmd) + Cmd.AddCommand(listRuleChainsCmd) listRuleChainsCmd.Flags().StringP(morphUtil.EndpointFlag, morphUtil.EndpointFlagShort, "", morphUtil.EndpointFlagDesc) listRuleChainsCmd.Flags().String(morphUtil.AlphabetWalletsFlag, "", morphUtil.AlphabetWalletsFlagDesc) @@ -135,7 +130,7 @@ func initListRuleChainsCmd() { } func initSetAdminCmd() { - apeCmd.AddCommand(setAdminCmd) + Cmd.AddCommand(setAdminCmd) setAdminCmd.Flags().StringP(morphUtil.EndpointFlag, morphUtil.EndpointFlagShort, "", morphUtil.EndpointFlagDesc) setAdminCmd.Flags().String(morphUtil.AlphabetWalletsFlag, "", morphUtil.AlphabetWalletsFlagDesc) @@ -144,7 +139,7 @@ func initSetAdminCmd() { } func initGetAdminCmd() { - apeCmd.AddCommand(getAdminCmd) + Cmd.AddCommand(getAdminCmd) getAdminCmd.Flags().StringP(morphUtil.EndpointFlag, morphUtil.EndpointFlagShort, "", morphUtil.EndpointFlagDesc) getAdminCmd.Flags().String(morphUtil.AlphabetWalletsFlag, "", morphUtil.AlphabetWalletsFlagDesc) diff --git a/cmd/frostfs-adm/internal/modules/morph/ape_util.go b/cmd/frostfs-adm/internal/modules/morph/ape/ape_util.go similarity index 99% rename from cmd/frostfs-adm/internal/modules/morph/ape_util.go rename to cmd/frostfs-adm/internal/modules/morph/ape/ape_util.go index f9dcdffe8..21f27bfd7 100644 --- a/cmd/frostfs-adm/internal/modules/morph/ape_util.go +++ b/cmd/frostfs-adm/internal/modules/morph/ape/ape_util.go @@ -1,4 +1,4 @@ -package morph +package ape import ( "encoding/json" diff --git a/cmd/frostfs-adm/internal/modules/morph/ape/root.go b/cmd/frostfs-adm/internal/modules/morph/ape/root.go new file mode 100644 index 000000000..11b6894cf --- /dev/null +++ b/cmd/frostfs-adm/internal/modules/morph/ape/root.go @@ -0,0 +1,16 @@ +package ape + +import "github.com/spf13/cobra" + +var Cmd = &cobra.Command{ + Use: "ape", + Short: "Section for APE configuration commands", +} + +func init() { + initAddRuleChainCmd() + initRemoveRuleChainCmd() + initListRuleChainsCmd() + initSetAdminCmd() + initGetAdminCmd() +} diff --git a/cmd/frostfs-adm/internal/modules/morph/root.go b/cmd/frostfs-adm/internal/modules/morph/root.go index 5a4fa0063..328877967 100644 --- a/cmd/frostfs-adm/internal/modules/morph/root.go +++ b/cmd/frostfs-adm/internal/modules/morph/root.go @@ -1,6 +1,7 @@ package morph import ( + "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/ape" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -283,12 +284,7 @@ func init() { initDepositoryNotaryCmd() initNetmapCandidatesCmd() - RootCmd.AddCommand(apeCmd) - initAddRuleChainCmd() - initRemoveRuleChainCmd() - initListRuleChainsCmd() - initSetAdminCmd() - initGetAdminCmd() + RootCmd.AddCommand(ape.Cmd) initProxyAddAccount() initProxyRemoveAccount()