mirror of
https://github.com/tnb-labs/panel.git
synced 2026-09-01 14:55:12 +08:00
ea22c2f0a7
Replace the samber/do runtime container with explicit constructor dependencies and generated Wire graphs for ace and cli. Keep CLI application loading isolated and verify generated files in CI.
44 lines
1.9 KiB
Go
44 lines
1.9 KiB
Go
package route
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/acepanel/panel/v3/internal/request"
|
|
"github.com/acepanel/panel/v3/internal/service"
|
|
)
|
|
|
|
// SystemctlRoutes 系统服务路由
|
|
func SystemctlRoutes(systemctlService *service.SystemctlService) Endpoints {
|
|
svc := systemctlService
|
|
|
|
return Endpoints{
|
|
{Method: http.MethodGet, Path: "/api/systemctl/status", Handler: svc.Status,
|
|
Summary: "获取服务运行状态", Tags: []string{"系统服务"},
|
|
Request: request.SystemctlService{}},
|
|
{Method: http.MethodGet, Path: "/api/systemctl/is_enabled", Handler: svc.IsEnabled,
|
|
Summary: "获取服务自启状态", Tags: []string{"系统服务"},
|
|
Request: request.SystemctlService{}},
|
|
{Method: http.MethodPost, Path: "/api/systemctl/enable", Handler: svc.Enable,
|
|
Summary: "启用服务自启", Tags: []string{"系统服务"},
|
|
Request: request.SystemctlService{}},
|
|
{Method: http.MethodPost, Path: "/api/systemctl/disable", Handler: svc.Disable,
|
|
Summary: "禁用服务自启", Tags: []string{"系统服务"},
|
|
Request: request.SystemctlService{}},
|
|
{Method: http.MethodPost, Path: "/api/systemctl/restart", Handler: svc.Restart,
|
|
Summary: "重启服务", Tags: []string{"系统服务"},
|
|
Request: request.SystemctlService{}},
|
|
{Method: http.MethodPost, Path: "/api/systemctl/reload", Handler: svc.Reload,
|
|
Summary: "重载服务", Tags: []string{"系统服务"},
|
|
Request: request.SystemctlService{}},
|
|
{Method: http.MethodPost, Path: "/api/systemctl/start", Handler: svc.Start,
|
|
Summary: "启动服务", Tags: []string{"系统服务"},
|
|
Request: request.SystemctlService{}},
|
|
{Method: http.MethodPost, Path: "/api/systemctl/stop", Handler: svc.Stop,
|
|
Summary: "停止服务", Tags: []string{"系统服务"},
|
|
Request: request.SystemctlService{}},
|
|
{Method: http.MethodPost, Path: "/api/systemctl/clear_log", Handler: svc.ClearLog,
|
|
Summary: "清空服务日志", Tags: []string{"系统服务"},
|
|
Request: request.SystemctlService{}},
|
|
}
|
|
}
|