add enable/disable failover in nmctl command (#2857)

This commit is contained in:
Max Ma
2024-03-20 09:12:42 +01:00
committed by GitHub
parent 4871a0dd1c
commit b59658024c
5 changed files with 88 additions and 0 deletions

18
cli/functions/failover.go Normal file
View File

@@ -0,0 +1,18 @@
package functions
import (
"fmt"
"net/http"
"github.com/gravitl/netmaker/models"
)
// EnableNodeFailover - Enable failover for a given Node
func EnableNodeFailover(nodeID string) *models.SuccessResponse {
return request[models.SuccessResponse](http.MethodPost, fmt.Sprintf("/api/v1/node/%s/failover", nodeID), nil)
}
// DisableNodeFailover - Disable failover for a given Node
func DisableNodeFailover(nodeID string) *models.SuccessResponse {
return request[models.SuccessResponse](http.MethodDelete, fmt.Sprintf("/api/v1/node/%s/failover", nodeID), nil)
}