diff --git a/api/http/handler/endpoints/endpoint_status_inspect.go b/api/http/handler/endpoints/endpoint_status_inspect.go new file mode 100644 index 000000000..c166c0199 --- /dev/null +++ b/api/http/handler/endpoints/endpoint_status_inspect.go @@ -0,0 +1,21 @@ +package endpoints + +import ( + "fmt" + "net/http" + + httperror "github.com/portainer/libhttp/error" + "github.com/portainer/libhttp/request" +) + +// DEPRECATED +func (handler *Handler) endpointStatusInspect(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { + endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") + if err != nil { + return &httperror.HandlerError{http.StatusBadRequest, "Invalid environment identifier route variable", err} + } + + url := fmt.Sprintf("/api/endpoints/%d/edge/status", endpointID) + http.Redirect(w, r, url, http.StatusPermanentRedirect) + return nil +} diff --git a/api/http/handler/endpoints/handler.go b/api/http/handler/endpoints/handler.go index e4de0bad3..6c8adc093 100644 --- a/api/http/handler/endpoints/handler.go +++ b/api/http/handler/endpoints/handler.go @@ -68,5 +68,9 @@ func NewHandler(bouncer *security.RequestBouncer) *Handler { bouncer.AuthenticatedAccess(httperror.LoggerHandler(h.endpointRegistriesList))).Methods(http.MethodGet) h.Handle("/endpoints/{id}/registries/{registryId}", bouncer.AuthenticatedAccess(httperror.LoggerHandler(h.endpointRegistryAccess))).Methods(http.MethodPut) + + // DEPRECATED + h.Handle("/endpoints/{id}/status", httperror.LoggerHandler(h.endpointStatusInspect)).Methods(http.MethodGet) + return h }