forked from TrueCloudLab/frostfs-node
[#1301] adm/morph: Add 'delete' domains
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
parent
5a53f9c4fd
commit
53a90634fc
2 changed files with 30 additions and 0 deletions
|
@ -42,3 +42,23 @@ func registerDomain(cmd *cobra.Command, _ []string) {
|
||||||
commonCmd.ExitOnErr(cmd, "register domain error: %w", err)
|
commonCmd.ExitOnErr(cmd, "register domain error: %w", err)
|
||||||
cmd.Println("Domain registered successfully")
|
cmd.Println("Domain registered successfully")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func initDeleteCmd() {
|
||||||
|
Cmd.AddCommand(deleteCmd)
|
||||||
|
deleteCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
|
||||||
|
deleteCmd.Flags().String(commonflags.AlphabetWalletsFlag, "", commonflags.AlphabetWalletsFlagDesc)
|
||||||
|
deleteCmd.Flags().String(nnsNameFlag, "", nnsNameFlagDesc)
|
||||||
|
|
||||||
|
_ = cobra.MarkFlagRequired(deleteCmd.Flags(), nnsNameFlag)
|
||||||
|
}
|
||||||
|
|
||||||
|
func deleteDomain(cmd *cobra.Command, _ []string) {
|
||||||
|
c, actor, _ := getRPCClient(cmd)
|
||||||
|
|
||||||
|
name, _ := cmd.Flags().GetString(nnsNameFlag)
|
||||||
|
h, vub, err := c.DeleteDomain(name)
|
||||||
|
|
||||||
|
_, err = actor.Wait(h, vub, err)
|
||||||
|
commonCmd.ExitOnErr(cmd, "delete domain error: %w", err)
|
||||||
|
cmd.Println("Domain deleted successfully")
|
||||||
|
}
|
|
@ -42,6 +42,15 @@ var (
|
||||||
},
|
},
|
||||||
Run: registerDomain,
|
Run: registerDomain,
|
||||||
}
|
}
|
||||||
|
deleteCmd = &cobra.Command{
|
||||||
|
Use: "delete",
|
||||||
|
Short: "Delete a domain by name",
|
||||||
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
||||||
|
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
||||||
|
_ = viper.BindPFlag(commonflags.AlphabetWalletsFlag, cmd.Flags().Lookup(commonflags.AlphabetWalletsFlag))
|
||||||
|
},
|
||||||
|
Run: deleteDomain,
|
||||||
|
}
|
||||||
renewCmd = &cobra.Command{
|
renewCmd = &cobra.Command{
|
||||||
Use: "renew",
|
Use: "renew",
|
||||||
Short: "Increases domain expiration date",
|
Short: "Increases domain expiration date",
|
||||||
|
@ -91,6 +100,7 @@ var (
|
||||||
func init() {
|
func init() {
|
||||||
initTokensCmd()
|
initTokensCmd()
|
||||||
initRegisterCmd()
|
initRegisterCmd()
|
||||||
|
initDeleteCmd()
|
||||||
initRenewCmd()
|
initRenewCmd()
|
||||||
initUpdateCmd()
|
initUpdateCmd()
|
||||||
initAddRecordCmd()
|
initAddRecordCmd()
|
||||||
|
|
Loading…
Reference in a new issue