0bb138e39e
Signed-off-by: Tiger Wang <tigerwang@outlook.com>
26 lines
597 B
Go
26 lines
597 B
Go
package v2
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/IceWhaleTech/CasaOS/codegen"
|
|
"github.com/IceWhaleTech/CasaOS/service"
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
func (s *CasaOS) GetHealthServices(ctx echo.Context) error {
|
|
services, err := service.MyService.Health().Services()
|
|
if err != nil {
|
|
message := err.Error()
|
|
return ctx.JSON(http.StatusInternalServerError, codegen.ResponseInternalServerError{
|
|
Message: &message,
|
|
})
|
|
}
|
|
|
|
return ctx.JSON(http.StatusOK, codegen.GetHealthServicesOK{
|
|
Data: &codegen.HealthServices{
|
|
Running: services[true],
|
|
NotRunning: services[false],
|
|
},
|
|
})
|
|
}
|