package nns import ( "math/big" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/commonflags" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/constants" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" "github.com/spf13/cobra" ) func initUpdateCmd() { Cmd.AddCommand(updateCmd) updateCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc) updateCmd.Flags().String(commonflags.AlphabetWalletsFlag, "", commonflags.AlphabetWalletsFlagDesc) updateCmd.Flags().String(nnsNameFlag, "", nnsNameFlagDesc) updateCmd.Flags().String(nnsEmailFlag, constants.FrostfsOpsEmail, "Domain owner email") updateCmd.Flags().Int64(nnsRefreshFlag, constants.NNSRefreshDefVal, "The number of seconds between update requests from secondary and slave name servers") updateCmd.Flags().Int64(nnsRetryFlag, constants.NNSRetryDefVal, "The number of seconds the secondary or slave will wait before retrying when the last attempt has failed") updateCmd.Flags().Int64(nnsExpireFlag, int64(constants.DefaultExpirationTime), "The number of seconds a master or slave will wait before considering the data stale "+ "if it cannot reach the primary name server") updateCmd.Flags().Int64(nnsTTLFlag, constants.NNSTtlDefVal, "The number of seconds a domain name is cached locally before expiration and return to authoritative "+ "nameservers for updated information") _ = cobra.MarkFlagRequired(updateCmd.Flags(), nnsNameFlag) } func updateSOA(cmd *cobra.Command, _ []string) { c, actor, _ := getRPCClient(cmd) name, _ := cmd.Flags().GetString(nnsNameFlag) email, _ := cmd.Flags().GetString(nnsEmailFlag) refresh, _ := cmd.Flags().GetInt64(nnsRefreshFlag) retry, _ := cmd.Flags().GetInt64(nnsRetryFlag) expire, _ := cmd.Flags().GetInt64(nnsExpireFlag) ttl, _ := cmd.Flags().GetInt64(nnsTTLFlag) h, vub, err := c.UpdateSOA(name, email, big.NewInt(refresh), big.NewInt(retry), big.NewInt(expire), big.NewInt(ttl)) commonCmd.ExitOnErr(cmd, "unable to send transaction: %w", err) cmd.Println("Waiting for transaction to persist...") _, err = actor.Wait(h, vub, err) commonCmd.ExitOnErr(cmd, "register domain error: %w", err) cmd.Println("SOA records updated successfully") }