mirror of
https://github.com/gravitl/netmaker.git
synced 2026-04-23 00:17:10 +08:00
c3c3ed1fb8
* NM-254: add bulk delete apis for users, hosts, nodes and optimise postgres connection settings * NM-254: rm debug logs * NM-254: add bulk delete apis, remove old acl code * NM-254: rm unused flag * NM-254: fix bulk delete bugs, add security and performance improvements - Fix host delete notifying peers before confirming deletion from DB - Fix self-delete vulnerability in bulk user delete - Fix DissasociateNodeFromHost failing when host.Nodes is empty - Fix AssociateNodeToHost/DissasociateNodeFromHost stale read race - Hoist GetAllExtClients outside loop in bulk user delete/status - Move initializeUUID outside master-pod guard for HA correctness * NM-254: return 202 Accepted for async bulk APIs, fix relay allowedIPs and host association error handling - Change all bulk endpoints (hosts, nodes, users, ext clients) from 200 OK to 202 Accepted to correctly signal async processing - Add ReturnAcceptedResponse helper in logic/errors.go - Fix GetAllowedIpsForRelayed returning empty allowedIPs slice, restoring relay connectivity - Make AssociateNodeToHost and DissasociateNodeFromHost return an error when the host DB re-fetch fails instead of silently using stale data - Add bulk-apis.md documenting all five bulk endpoints * NM-254: rm coredns container * NM-254: add bulk apis for node,extclient status, add activity logs to bulk apis * NM-254: add bulk api for connection toggle * NM-254: add network check * Update controllers/hosts.go Co-authored-by: tenki-reviewer[bot] <262613592+tenki-reviewer[bot]@users.noreply.github.com> * NM-254: optimise bulk extclient deletion --------- Co-authored-by: tenki-reviewer[bot] <262613592+tenki-reviewer[bot]@users.noreply.github.com>
62 lines
1.9 KiB
Go
62 lines
1.9 KiB
Go
package cmd
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/gravitl/netmaker/cli/cmd/access_token"
|
|
"github.com/gravitl/netmaker/cli/cmd/commons"
|
|
"github.com/gravitl/netmaker/cli/cmd/context"
|
|
"github.com/gravitl/netmaker/cli/cmd/dns"
|
|
"github.com/gravitl/netmaker/cli/cmd/enrollment_key"
|
|
"github.com/gravitl/netmaker/cli/cmd/ext_client"
|
|
"github.com/gravitl/netmaker/cli/cmd/failover"
|
|
"github.com/gravitl/netmaker/cli/cmd/gateway"
|
|
"github.com/gravitl/netmaker/cli/cmd/host"
|
|
"github.com/gravitl/netmaker/cli/cmd/metrics"
|
|
"github.com/gravitl/netmaker/cli/cmd/network"
|
|
"github.com/gravitl/netmaker/cli/cmd/node"
|
|
"github.com/gravitl/netmaker/cli/cmd/server"
|
|
"github.com/gravitl/netmaker/cli/cmd/user"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// rootCmd represents the base command when called without any subcommands
|
|
var rootCmd = &cobra.Command{
|
|
Use: "nmctl",
|
|
Short: "CLI for interacting with Netmaker Server",
|
|
Long: `CLI for interacting with Netmaker Server`,
|
|
}
|
|
|
|
// GetRoot returns the root of all subcommands
|
|
func GetRoot() *cobra.Command {
|
|
return rootCmd
|
|
}
|
|
|
|
// Execute adds all child commands to the root command and sets flags appropriately.
|
|
// This is called by main.main(). It only needs to happen once to the rootCmd.
|
|
func Execute() {
|
|
err := rootCmd.Execute()
|
|
if err != nil {
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.PersistentFlags().StringVarP(&commons.OutputFormat, "output", "o", "", "List output in specific format (Enum:- json)")
|
|
// Bind subcommands here
|
|
rootCmd.AddCommand(network.GetRoot())
|
|
rootCmd.AddCommand(context.GetRoot())
|
|
rootCmd.AddCommand(node.GetRoot())
|
|
rootCmd.AddCommand(dns.GetRoot())
|
|
rootCmd.AddCommand(server.GetRoot())
|
|
rootCmd.AddCommand(ext_client.GetRoot())
|
|
rootCmd.AddCommand(user.GetRoot())
|
|
rootCmd.AddCommand(metrics.GetRoot())
|
|
rootCmd.AddCommand(host.GetRoot())
|
|
rootCmd.AddCommand(enrollment_key.GetRoot())
|
|
rootCmd.AddCommand(failover.GetRoot())
|
|
rootCmd.AddCommand(gateway.GetRoot())
|
|
rootCmd.AddCommand(access_token.GetRoot())
|
|
}
|