mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-05 20:54:18 +08:00
* New Docs CSS update and Dockerfile to include docs folder flash of unrendered text fix markdown docs ignore docs/docs.go improving the docs generation github actions for docs generation go runner version fix updated docs.yml update repo action updated updated actions and dns docs dns complete More docs update Complete docs and updated workflow Update documentation Tue Aug 6 11:17:42 UTC 2024 Update documentation Thu Aug 8 12:26:57 UTC 2024 clean up clean up Dockerfile clean up Updated workflow Updated workflow Update docs.yml Update docs.yml * requested changes * changed ingress gateway to remote access gateway
31 lines
1,023 B
Go
31 lines
1,023 B
Go
package controller
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gorilla/mux"
|
|
"github.com/gravitl/netmaker/logger"
|
|
"github.com/gravitl/netmaker/logic"
|
|
)
|
|
|
|
func legacyHandlers(r *mux.Router) {
|
|
r.HandleFunc("/api/v1/legacy/nodes", logic.SecurityCheck(true, http.HandlerFunc(wipeLegacyNodes))).
|
|
Methods(http.MethodDelete)
|
|
}
|
|
|
|
// @Summary Delete all legacy nodes from DB.
|
|
// @Router /api/v1/legacy/nodes [delete]
|
|
// @Tags Nodes
|
|
// @Security oauth2
|
|
// @Success 200 {string} string "Wiped all legacy nodes."
|
|
// @Failure 400 {object} models.ErrorResponse
|
|
func wipeLegacyNodes(w http.ResponseWriter, r *http.Request) {
|
|
// Set header
|
|
w.Header().Set("Content-Type", "application/json")
|
|
if err := logic.RemoveAllLegacyNodes(); err != nil {
|
|
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "badrequest"))
|
|
logger.Log(0, "error occurred when removing legacy nodes", err.Error())
|
|
}
|
|
logger.Log(0, r.Header.Get("user"), "wiped legacy nodes")
|
|
logic.ReturnSuccessResponse(w, r, "wiped all legacy nodes")
|
|
}
|