feat: adjust openapi endpoint
This commit is contained in:
@@ -58,7 +58,7 @@ func (ec *EnvController) CreateEnvVar(c *gin.Context) {
|
||||
// @Tags 环境变量
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BearerAuth
|
||||
// @Param name query string false "按名称模糊查询"
|
||||
// @Param page query int false "页码"
|
||||
// @Param page_size query int false "每页数量"
|
||||
@@ -78,7 +78,7 @@ func (ec *EnvController) GetEnvVars(c *gin.Context) {
|
||||
// @Tags 环境变量
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BearerAuth
|
||||
// @Success 200 {object} utils.Response{data=[]vo.EnvVO}
|
||||
// @Router /env/all [get]
|
||||
func (ec *EnvController) GetAllEnvVars(c *gin.Context) {
|
||||
@@ -93,7 +93,7 @@ func (ec *EnvController) GetAllEnvVars(c *gin.Context) {
|
||||
// @Tags 环境变量
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BearerAuth
|
||||
// @Param id path string true "环境变量ID"
|
||||
// @Success 200 {object} utils.Response{data=vo.EnvVO}
|
||||
// @Failure 404 {object} utils.Response
|
||||
@@ -210,7 +210,7 @@ func (ec *EnvController) DeleteEnvVar(c *gin.Context) {
|
||||
// @Tags 环境变量
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BearerAuth
|
||||
// @Param id path string true "环境变量ID"
|
||||
// @Success 200 {object} utils.Response{data=[]vo.TaskVO}
|
||||
// @Router /env/{id}/tasks [get]
|
||||
|
||||
@@ -21,10 +21,10 @@ func NewExecutorController(executorService *tasks.ExecutorService) *ExecutorCont
|
||||
// ExecuteTask 运行任务
|
||||
// @Summary 运行任务
|
||||
// @Description 立即执行指定的任务
|
||||
// @Tags 任务
|
||||
// @Tags 任务执行
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BearerAuth
|
||||
// @Param id path string true "任务ID"
|
||||
// @Param body body object false "执行参数 (envs: 环境变量字典)"
|
||||
// @Success 200 {object} utils.Response{data=vo.ExecutionResultVO}
|
||||
@@ -85,7 +85,7 @@ func (ec *ExecutorController) ExecuteCommand(c *gin.Context) {
|
||||
// @Tags 任务执行
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BearerAuth
|
||||
// @Param count query int false "数量 (默认 10)"
|
||||
// @Success 200 {object} utils.Response{data=[]vo.ExecutionResultVO}
|
||||
// @Router /execute/results [get]
|
||||
|
||||
@@ -19,10 +19,10 @@ func NewLogController() *LogController {
|
||||
// GetLogs 获取任务日志列表
|
||||
// @Summary 获取任务日志列表
|
||||
// @Description 分页获取任务日志列表,支持按任务 ID、任务名称、状态筛选
|
||||
// @Tags 日志
|
||||
// @Tags 日志管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BearerAuth
|
||||
// @Param task_id query string false "任务 ID"
|
||||
// @Param task_name query string false "任务名称"
|
||||
// @Param status query string false "状态"
|
||||
@@ -102,10 +102,10 @@ func (lc *LogController) GetLogs(c *gin.Context) {
|
||||
// GetLogDetail 获取日志详情
|
||||
// @Summary 获取日志详情
|
||||
// @Description 根据 ID 获取任务日志详细内容(包含输出)
|
||||
// @Tags 日志
|
||||
// @Tags 日志管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BearerAuth
|
||||
// @Param id path string true "日志ID"
|
||||
// @Success 200 {object} utils.Response{data=vo.TaskLogVO}
|
||||
// @Failure 404 {object} utils.Response
|
||||
|
||||
@@ -108,10 +108,10 @@ func (tc *TaskController) CreateTask(c *gin.Context) {
|
||||
// GetTasks 获取任务列表
|
||||
// @Summary 获取任务列表
|
||||
// @Description 分页获取任务列表,支持按名称、Agent ID、标签、类型筛选
|
||||
// @Tags 任务
|
||||
// @Tags 任务管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BearerAuth
|
||||
// @Param name query string false "任务名称"
|
||||
// @Param agent_id query string false "Agent ID"
|
||||
// @Param tags query string false "标签"
|
||||
@@ -140,10 +140,10 @@ func (tc *TaskController) GetTasks(c *gin.Context) {
|
||||
// GetTask 获取任务详情
|
||||
// @Summary 获取任务详情
|
||||
// @Description 根据 ID 获取任务详情
|
||||
// @Tags 任务
|
||||
// @Tags 任务管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BearerAuth
|
||||
// @Param id path string true "任务ID"
|
||||
// @Success 200 {object} utils.Response{data=vo.TaskVO}
|
||||
// @Failure 404 {object} utils.Response
|
||||
@@ -167,10 +167,10 @@ func (tc *TaskController) GetTask(c *gin.Context) {
|
||||
// UpdateTask 更新任务
|
||||
// @Summary 更新任务
|
||||
// @Description 根据 ID 更新任务信息
|
||||
// @Tags 任务
|
||||
// @Tags 任务管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BearerAuth
|
||||
// @Param id path string true "任务ID"
|
||||
// @Param body body object true "任务更新信息"
|
||||
// @Success 200 {object} utils.Response{data=vo.TaskVO}
|
||||
@@ -262,10 +262,10 @@ func (tc *TaskController) UpdateTask(c *gin.Context) {
|
||||
// DeleteTask 删除任务
|
||||
// @Summary 删除任务
|
||||
// @Description 根据 ID 删除任务
|
||||
// @Tags 任务
|
||||
// @Tags 任务管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BearerAuth
|
||||
// @Param id path string true "任务ID"
|
||||
// @Success 200 {object} utils.Response
|
||||
// @Failure 404 {object} utils.Response
|
||||
@@ -303,10 +303,10 @@ func (tc *TaskController) DeleteTask(c *gin.Context) {
|
||||
// StopTask 停止任务
|
||||
// @Summary 停止任务
|
||||
// @Description 根据运行日志 ID 停止正在执行的任务
|
||||
// @Tags 任务
|
||||
// @Tags 任务管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Security BearerAuth
|
||||
// @Param logID path string true "运行日志ID"
|
||||
// @Success 200 {object} utils.Response
|
||||
// @Failure 400 {object} utils.Response
|
||||
|
||||
@@ -24,11 +24,6 @@ func AuthRequired() gin.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
// 校验 OpenAPI Token
|
||||
if checkOpenapiToken(c, settingsSvc) {
|
||||
return
|
||||
}
|
||||
|
||||
token, err := c.Cookie(constant.CookieName)
|
||||
if err != nil || token == "" {
|
||||
utils.Unauthorized(c, "请先登录")
|
||||
@@ -111,14 +106,40 @@ func checkApiToken(c *gin.Context, settingsSvc *services.SettingsService) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// OpenapiRequired OpenAPI 认证中间件
|
||||
func OpenapiRequired() gin.HandlerFunc {
|
||||
settingsSvc := services.NewSettingsService()
|
||||
return func(c *gin.Context) {
|
||||
if checkOpenapiToken(c, settingsSvc) {
|
||||
return
|
||||
}
|
||||
utils.Unauthorized(c, "无效的 OpenAPI 令牌")
|
||||
c.Abort()
|
||||
}
|
||||
}
|
||||
|
||||
// checkOpenapiToken 校验 OpenAPI Token
|
||||
// 返回 true 表示校验通过并已放行请求
|
||||
func checkOpenapiToken(c *gin.Context, settingsSvc *services.SettingsService) bool {
|
||||
authHeader := c.GetHeader("Authorization")
|
||||
if authHeader == "" || len(authHeader) < 8 || authHeader[:7] != "Bearer " {
|
||||
if authHeader == "" {
|
||||
return false
|
||||
}
|
||||
|
||||
// 提取 token:支持 "Bearer <token>" 和直接 "<token>" 两种格式
|
||||
var openapiToken string
|
||||
if len(authHeader) > 7 && authHeader[:7] == "Bearer " {
|
||||
// 标准格式:Bearer <token>
|
||||
openapiToken = authHeader[7:]
|
||||
} else {
|
||||
// 直接使用 token
|
||||
openapiToken = authHeader
|
||||
}
|
||||
|
||||
// Token 不能为空
|
||||
if openapiToken == "" {
|
||||
return false
|
||||
}
|
||||
openapiToken := authHeader[7:]
|
||||
|
||||
siteConfig := settingsSvc.GetSection(constant.SectionSite)
|
||||
tokenJson, ok := siteConfig[constant.KeyOpenapiToken]
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/engigu/baihu-panel/internal/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// initOpenAPIV1Routes 初始化 OpenAPI v1 路由
|
||||
// 只注册有 @Tags OpenAPI 注释的接口
|
||||
func initOpenAPIV1Routes(root *gin.RouterGroup, c *Controllers) {
|
||||
// OpenAPI v1 路由组 (使用 Bearer Token)
|
||||
open := root.Group("/open2api/v1")
|
||||
open.Use(middleware.OpenapiRequired())
|
||||
{
|
||||
// 任务相关接口
|
||||
registerOpenAPITaskRoutes(open, c)
|
||||
// 环境变量相关接口
|
||||
registerOpenAPIEnvRoutes(open, c)
|
||||
// 日志相关接口
|
||||
registerOpenAPILogRoutes(open, c)
|
||||
// 任务执行相关接口
|
||||
registerOpenAPIExecutorRoutes(open, c)
|
||||
}
|
||||
}
|
||||
|
||||
// registerOpenAPITaskRoutes 注册 OpenAPI 任务路由(只包含有 @Tags OpenAPI 注释的接口)
|
||||
func registerOpenAPITaskRoutes(g *gin.RouterGroup, c *Controllers) {
|
||||
tasks := g.Group("/tasks")
|
||||
{
|
||||
tasks.GET("", c.Task.GetTasks)
|
||||
tasks.GET("/:id", c.Task.GetTask)
|
||||
tasks.PUT("/:id", c.Task.UpdateTask)
|
||||
tasks.DELETE("/:id", c.Task.DeleteTask)
|
||||
tasks.POST("/stop/:logID", c.Task.StopTask)
|
||||
}
|
||||
}
|
||||
|
||||
// registerOpenAPIEnvRoutes 注册 OpenAPI 环境变量路由(只包含有 @Tags OpenAPI 注释的接口)
|
||||
func registerOpenAPIEnvRoutes(g *gin.RouterGroup, c *Controllers) {
|
||||
env := g.Group("/env")
|
||||
{
|
||||
env.GET("", c.Env.GetEnvVars)
|
||||
env.GET("/all", c.Env.GetAllEnvVars)
|
||||
env.GET("/:id", c.Env.GetEnvVar)
|
||||
env.GET("/:id/tasks", c.Env.GetAssociatedTasks)
|
||||
}
|
||||
}
|
||||
|
||||
// registerOpenAPILogRoutes 注册 OpenAPI 日志路由(只包含有 @Tags OpenAPI 注释的接口)
|
||||
func registerOpenAPILogRoutes(g *gin.RouterGroup, c *Controllers) {
|
||||
logs := g.Group("/logs")
|
||||
{
|
||||
logs.GET("", c.Log.GetLogs)
|
||||
logs.GET("/:id", c.Log.GetLogDetail)
|
||||
}
|
||||
}
|
||||
|
||||
// registerOpenAPIExecutorRoutes 注册 OpenAPI 任务执行路由(只包含有 @Tags OpenAPI 注释的接口)
|
||||
func registerOpenAPIExecutorRoutes(g *gin.RouterGroup, c *Controllers) {
|
||||
execution := g.Group("/execute")
|
||||
{
|
||||
execution.POST("/task/:id", c.Executor.ExecuteTask)
|
||||
execution.GET("/results", c.Executor.GetLastResults)
|
||||
}
|
||||
}
|
||||
@@ -77,6 +77,7 @@ func Setup(c *Controllers) *gin.Engine {
|
||||
initPublicAPIRoutes(apiV1, c)
|
||||
initAuthorizedAPIRoutes(apiV1, c)
|
||||
initAgentAPIRoutes(root, c)
|
||||
initOpenAPIV1Routes(root, c)
|
||||
|
||||
// SPA 兜底路由 - 返回 index.html(HTML禁用缓存以保证实时同步)
|
||||
// 必须在最后注册,作为兜底路由
|
||||
@@ -332,7 +333,7 @@ func registerLogRoutes(g *gin.RouterGroup, c *Controllers) {
|
||||
|
||||
func registerTerminalRoutes(g *gin.RouterGroup, c *Controllers) {
|
||||
g.GET("/terminal/ws", c.Terminal.HandleWebSocket)
|
||||
g.POST("/terminal/exec", c.Terminal.ExecuteShellCommand)
|
||||
// g.POST("/terminal/exec", c.Terminal.ExecuteShellCommand) // 暂未使用,已注释
|
||||
g.GET("/terminal/cmds", c.Terminal.GetCommands)
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
// @title Baihu Panel API
|
||||
// @version 1.0
|
||||
// @description Baihu Panel API Server documentation.
|
||||
// @description Baihu Panel OpenAPI Server documentation.
|
||||
// @termsOfService http://swagger.io/terms/
|
||||
|
||||
// @contact.name API Support
|
||||
@@ -23,12 +23,13 @@ import (
|
||||
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
// @host localhost:8052
|
||||
// @BasePath /api/v1
|
||||
// @BasePath /open2api/v1
|
||||
// @query.collection.format multi
|
||||
|
||||
// @securityDefinitions.apikey ApiKeyAuth
|
||||
// @securityDefinitions.apikey BearerAuth
|
||||
// @in header
|
||||
// @name Authorization
|
||||
// @description Type "Bearer" followed by a space and the API token.
|
||||
|
||||
func printHelp() {
|
||||
fmt.Println("Usage: baihu <command> [arguments]")
|
||||
|
||||
+76
-75
@@ -28,7 +28,7 @@ const docTemplate = `{
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "分页获取环境变量列表,支持按名称筛选",
|
||||
@@ -68,7 +68,7 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -81,7 +81,7 @@ const docTemplate = `{
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"list": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/vo.EnvVO"
|
||||
@@ -132,7 +132,7 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -148,7 +148,7 @@ const docTemplate = `{
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,7 +158,7 @@ const docTemplate = `{
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "获取当前用户的所有环境变量(不分页)",
|
||||
@@ -178,7 +178,7 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -201,7 +201,7 @@ const docTemplate = `{
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据 ID 获取环境变量详情",
|
||||
@@ -230,7 +230,7 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -246,7 +246,7 @@ const docTemplate = `{
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -292,7 +292,7 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -308,7 +308,7 @@ const docTemplate = `{
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -349,7 +349,7 @@ const docTemplate = `{
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
@@ -357,7 +357,7 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -380,7 +380,7 @@ const docTemplate = `{
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "获取引用了该环境变量的任务列表",
|
||||
@@ -409,7 +409,7 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -463,7 +463,7 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -479,7 +479,7 @@ const docTemplate = `{
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -489,7 +489,7 @@ const docTemplate = `{
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "获取最新任务或命令执行的结果列表",
|
||||
@@ -517,7 +517,7 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -540,7 +540,7 @@ const docTemplate = `{
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "立即执行指定的任务",
|
||||
@@ -551,7 +551,7 @@ const docTemplate = `{
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"任务"
|
||||
"任务执行"
|
||||
],
|
||||
"summary": "运行任务",
|
||||
"parameters": [
|
||||
@@ -577,7 +577,7 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -593,7 +593,7 @@ const docTemplate = `{
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -603,7 +603,7 @@ const docTemplate = `{
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "分页获取任务日志列表,支持按任务 ID、任务名称、状态筛选",
|
||||
@@ -614,7 +614,7 @@ const docTemplate = `{
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"日志"
|
||||
"日志管理"
|
||||
],
|
||||
"summary": "获取任务日志列表",
|
||||
"parameters": [
|
||||
@@ -655,7 +655,7 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -668,7 +668,7 @@ const docTemplate = `{
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"list": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/vo.TaskLogVO"
|
||||
@@ -718,13 +718,13 @@ const docTemplate = `{
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -734,7 +734,7 @@ const docTemplate = `{
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据 ID 获取任务日志详细内容(包含输出)",
|
||||
@@ -745,7 +745,7 @@ const docTemplate = `{
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"日志"
|
||||
"日志管理"
|
||||
],
|
||||
"summary": "获取日志详情",
|
||||
"parameters": [
|
||||
@@ -763,7 +763,7 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -779,7 +779,7 @@ const docTemplate = `{
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -814,13 +814,13 @@ const docTemplate = `{
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -830,7 +830,7 @@ const docTemplate = `{
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "分页获取任务列表,支持按名称、Agent ID、标签、类型筛选",
|
||||
@@ -841,7 +841,7 @@ const docTemplate = `{
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"任务"
|
||||
"任务管理"
|
||||
],
|
||||
"summary": "获取任务列表",
|
||||
"parameters": [
|
||||
@@ -888,7 +888,7 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -901,7 +901,7 @@ const docTemplate = `{
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"list": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/vo.TaskVO"
|
||||
@@ -923,7 +923,7 @@ const docTemplate = `{
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据运行日志 ID 停止正在执行的任务",
|
||||
@@ -934,7 +934,7 @@ const docTemplate = `{
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"任务"
|
||||
"任务管理"
|
||||
],
|
||||
"summary": "停止任务",
|
||||
"parameters": [
|
||||
@@ -950,13 +950,13 @@ const docTemplate = `{
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -966,7 +966,7 @@ const docTemplate = `{
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据 ID 获取任务详情",
|
||||
@@ -977,7 +977,7 @@ const docTemplate = `{
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"任务"
|
||||
"任务管理"
|
||||
],
|
||||
"summary": "获取任务详情",
|
||||
"parameters": [
|
||||
@@ -995,7 +995,7 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -1011,7 +1011,7 @@ const docTemplate = `{
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1019,7 +1019,7 @@ const docTemplate = `{
|
||||
"put": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据 ID 更新任务信息",
|
||||
@@ -1030,7 +1030,7 @@ const docTemplate = `{
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"任务"
|
||||
"任务管理"
|
||||
],
|
||||
"summary": "更新任务",
|
||||
"parameters": [
|
||||
@@ -1057,7 +1057,7 @@ const docTemplate = `{
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -1073,7 +1073,7 @@ const docTemplate = `{
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1081,7 +1081,7 @@ const docTemplate = `{
|
||||
"delete": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据 ID 删除任务",
|
||||
@@ -1092,7 +1092,7 @@ const docTemplate = `{
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"任务"
|
||||
"任务管理"
|
||||
],
|
||||
"summary": "删除任务",
|
||||
"parameters": [
|
||||
@@ -1108,13 +1108,13 @@ const docTemplate = `{
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1122,22 +1122,7 @@ const docTemplate = `{
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"utils.PaginationData": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"list": {},
|
||||
"page": {
|
||||
"type": "integer"
|
||||
},
|
||||
"page_size": {
|
||||
"type": "integer"
|
||||
},
|
||||
"total": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"utils.Response": {
|
||||
"github_com_engigu_baihu-panel_internal_utils.Response": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
@@ -1149,6 +1134,21 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"utils.PaginationData": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {},
|
||||
"page": {
|
||||
"type": "integer"
|
||||
},
|
||||
"page_size": {
|
||||
"type": "integer"
|
||||
},
|
||||
"total": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"vo.EnvVO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -1336,7 +1336,8 @@ const docTemplate = `{
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
"ApiKeyAuth": {
|
||||
"BearerAuth": {
|
||||
"description": "Type \"Bearer\" followed by a space and the API token.",
|
||||
"type": "apiKey",
|
||||
"name": "Authorization",
|
||||
"in": "header"
|
||||
@@ -1348,10 +1349,10 @@ const docTemplate = `{
|
||||
var SwaggerInfo = &swag.Spec{
|
||||
Version: "1.0",
|
||||
Host: "localhost:8052",
|
||||
BasePath: "/api/v1",
|
||||
BasePath: "/open2api/v1",
|
||||
Schemes: []string{},
|
||||
Title: "Baihu Panel API",
|
||||
Description: "Baihu Panel API Server documentation.",
|
||||
Description: "Baihu Panel OpenAPI Server documentation.",
|
||||
InfoInstanceName: "swagger",
|
||||
SwaggerTemplate: docTemplate,
|
||||
LeftDelim: "{{",
|
||||
|
||||
+76
-75
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "Baihu Panel API Server documentation.",
|
||||
"description": "Baihu Panel OpenAPI Server documentation.",
|
||||
"title": "Baihu Panel API",
|
||||
"termsOfService": "http://swagger.io/terms/",
|
||||
"contact": {
|
||||
@@ -16,13 +16,13 @@
|
||||
"version": "1.0"
|
||||
},
|
||||
"host": "localhost:8052",
|
||||
"basePath": "/api/v1",
|
||||
"basePath": "/open2api/v1",
|
||||
"paths": {
|
||||
"/env": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "分页获取环境变量列表,支持按名称筛选",
|
||||
@@ -62,7 +62,7 @@
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -75,7 +75,7 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"list": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/vo.EnvVO"
|
||||
@@ -126,7 +126,7 @@
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -142,7 +142,7 @@
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -152,7 +152,7 @@
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "获取当前用户的所有环境变量(不分页)",
|
||||
@@ -172,7 +172,7 @@
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -195,7 +195,7 @@
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据 ID 获取环境变量详情",
|
||||
@@ -224,7 +224,7 @@
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -240,7 +240,7 @@
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -286,7 +286,7 @@
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -302,7 +302,7 @@
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -343,7 +343,7 @@
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
@@ -351,7 +351,7 @@
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -374,7 +374,7 @@
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "获取引用了该环境变量的任务列表",
|
||||
@@ -403,7 +403,7 @@
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -457,7 +457,7 @@
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -473,7 +473,7 @@
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -483,7 +483,7 @@
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "获取最新任务或命令执行的结果列表",
|
||||
@@ -511,7 +511,7 @@
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -534,7 +534,7 @@
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "立即执行指定的任务",
|
||||
@@ -545,7 +545,7 @@
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"任务"
|
||||
"任务执行"
|
||||
],
|
||||
"summary": "运行任务",
|
||||
"parameters": [
|
||||
@@ -571,7 +571,7 @@
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -587,7 +587,7 @@
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -597,7 +597,7 @@
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "分页获取任务日志列表,支持按任务 ID、任务名称、状态筛选",
|
||||
@@ -608,7 +608,7 @@
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"日志"
|
||||
"日志管理"
|
||||
],
|
||||
"summary": "获取任务日志列表",
|
||||
"parameters": [
|
||||
@@ -649,7 +649,7 @@
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -662,7 +662,7 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"list": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/vo.TaskLogVO"
|
||||
@@ -712,13 +712,13 @@
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -728,7 +728,7 @@
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据 ID 获取任务日志详细内容(包含输出)",
|
||||
@@ -739,7 +739,7 @@
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"日志"
|
||||
"日志管理"
|
||||
],
|
||||
"summary": "获取日志详情",
|
||||
"parameters": [
|
||||
@@ -757,7 +757,7 @@
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -773,7 +773,7 @@
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -808,13 +808,13 @@
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -824,7 +824,7 @@
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "分页获取任务列表,支持按名称、Agent ID、标签、类型筛选",
|
||||
@@ -835,7 +835,7 @@
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"任务"
|
||||
"任务管理"
|
||||
],
|
||||
"summary": "获取任务列表",
|
||||
"parameters": [
|
||||
@@ -882,7 +882,7 @@
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -895,7 +895,7 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"list": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/vo.TaskVO"
|
||||
@@ -917,7 +917,7 @@
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据运行日志 ID 停止正在执行的任务",
|
||||
@@ -928,7 +928,7 @@
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"任务"
|
||||
"任务管理"
|
||||
],
|
||||
"summary": "停止任务",
|
||||
"parameters": [
|
||||
@@ -944,13 +944,13 @@
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -960,7 +960,7 @@
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据 ID 获取任务详情",
|
||||
@@ -971,7 +971,7 @@
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"任务"
|
||||
"任务管理"
|
||||
],
|
||||
"summary": "获取任务详情",
|
||||
"parameters": [
|
||||
@@ -989,7 +989,7 @@
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -1005,7 +1005,7 @@
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1013,7 +1013,7 @@
|
||||
"put": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据 ID 更新任务信息",
|
||||
@@ -1024,7 +1024,7 @@
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"任务"
|
||||
"任务管理"
|
||||
],
|
||||
"summary": "更新任务",
|
||||
"parameters": [
|
||||
@@ -1051,7 +1051,7 @@
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
@@ -1067,7 +1067,7 @@
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1075,7 +1075,7 @@
|
||||
"delete": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据 ID 删除任务",
|
||||
@@ -1086,7 +1086,7 @@
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"任务"
|
||||
"任务管理"
|
||||
],
|
||||
"summary": "删除任务",
|
||||
"parameters": [
|
||||
@@ -1102,13 +1102,13 @@
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/utils.Response"
|
||||
"$ref": "#/definitions/github_com_engigu_baihu-panel_internal_utils.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1116,22 +1116,7 @@
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"utils.PaginationData": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"list": {},
|
||||
"page": {
|
||||
"type": "integer"
|
||||
},
|
||||
"page_size": {
|
||||
"type": "integer"
|
||||
},
|
||||
"total": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"utils.Response": {
|
||||
"github_com_engigu_baihu-panel_internal_utils.Response": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
@@ -1143,6 +1128,21 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"utils.PaginationData": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {},
|
||||
"page": {
|
||||
"type": "integer"
|
||||
},
|
||||
"page_size": {
|
||||
"type": "integer"
|
||||
},
|
||||
"total": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"vo.EnvVO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -1330,7 +1330,8 @@
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
"ApiKeyAuth": {
|
||||
"BearerAuth": {
|
||||
"description": "Type \"Bearer\" followed by a space and the API token.",
|
||||
"type": "apiKey",
|
||||
"name": "Authorization",
|
||||
"in": "header"
|
||||
|
||||
+71
-70
@@ -1,16 +1,6 @@
|
||||
basePath: /api/v1
|
||||
basePath: /open2api/v1
|
||||
definitions:
|
||||
utils.PaginationData:
|
||||
properties:
|
||||
list: {}
|
||||
page:
|
||||
type: integer
|
||||
page_size:
|
||||
type: integer
|
||||
total:
|
||||
type: integer
|
||||
type: object
|
||||
utils.Response:
|
||||
github_com_engigu_baihu-panel_internal_utils.Response:
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
@@ -18,6 +8,16 @@ definitions:
|
||||
msg:
|
||||
type: string
|
||||
type: object
|
||||
utils.PaginationData:
|
||||
properties:
|
||||
data: {}
|
||||
page:
|
||||
type: integer
|
||||
page_size:
|
||||
type: integer
|
||||
total:
|
||||
type: integer
|
||||
type: object
|
||||
vo.EnvVO:
|
||||
properties:
|
||||
created_at:
|
||||
@@ -146,7 +146,7 @@ info:
|
||||
email: support@swagger.io
|
||||
name: API Support
|
||||
url: http://www.swagger.io/support
|
||||
description: Baihu Panel API Server documentation.
|
||||
description: Baihu Panel OpenAPI Server documentation.
|
||||
license:
|
||||
name: Apache 2.0
|
||||
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
@@ -179,20 +179,20 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.Response'
|
||||
- $ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
- properties:
|
||||
data:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.PaginationData'
|
||||
- properties:
|
||||
list:
|
||||
data:
|
||||
items:
|
||||
$ref: '#/definitions/vo.EnvVO'
|
||||
type: array
|
||||
type: object
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: 获取环境变量列表
|
||||
tags:
|
||||
- 环境变量
|
||||
@@ -214,7 +214,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.Response'
|
||||
- $ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/vo.EnvVO'
|
||||
@@ -222,7 +222,7 @@ paths:
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/utils.Response'
|
||||
$ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 创建环境变量
|
||||
@@ -249,12 +249,12 @@ paths:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/utils.Response'
|
||||
$ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
"409":
|
||||
description: 引用冲突
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.Response'
|
||||
- $ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
@@ -283,7 +283,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.Response'
|
||||
- $ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/vo.EnvVO'
|
||||
@@ -291,9 +291,9 @@ paths:
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/utils.Response'
|
||||
$ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: 获取环境变量详情
|
||||
tags:
|
||||
- 环境变量
|
||||
@@ -320,7 +320,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.Response'
|
||||
- $ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/vo.EnvVO'
|
||||
@@ -328,7 +328,7 @@ paths:
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/utils.Response'
|
||||
$ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 更新环境变量
|
||||
@@ -352,7 +352,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.Response'
|
||||
- $ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
@@ -360,7 +360,7 @@ paths:
|
||||
type: array
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: 获取关联任务
|
||||
tags:
|
||||
- 环境变量
|
||||
@@ -376,7 +376,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.Response'
|
||||
- $ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
@@ -384,7 +384,7 @@ paths:
|
||||
type: array
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: 获取所有环境变量
|
||||
tags:
|
||||
- 环境变量
|
||||
@@ -407,7 +407,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.Response'
|
||||
- $ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/vo.ExecutionResultVO'
|
||||
@@ -415,7 +415,7 @@ paths:
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/utils.Response'
|
||||
$ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 执行命令
|
||||
@@ -438,7 +438,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.Response'
|
||||
- $ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
- properties:
|
||||
data:
|
||||
items:
|
||||
@@ -446,7 +446,7 @@ paths:
|
||||
type: array
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: 获取最新执行结果
|
||||
tags:
|
||||
- 任务执行
|
||||
@@ -473,7 +473,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.Response'
|
||||
- $ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/vo.ExecutionResultVO'
|
||||
@@ -481,12 +481,12 @@ paths:
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/utils.Response'
|
||||
$ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: 运行任务
|
||||
tags:
|
||||
- 任务
|
||||
- 任务执行
|
||||
/logs:
|
||||
get:
|
||||
consumes:
|
||||
@@ -520,23 +520,23 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.Response'
|
||||
- $ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
- properties:
|
||||
data:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.PaginationData'
|
||||
- properties:
|
||||
list:
|
||||
data:
|
||||
items:
|
||||
$ref: '#/definitions/vo.TaskLogVO'
|
||||
type: array
|
||||
type: object
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: 获取任务日志列表
|
||||
tags:
|
||||
- 日志
|
||||
- 日志管理
|
||||
/logs/{id}:
|
||||
delete:
|
||||
consumes:
|
||||
@@ -554,11 +554,11 @@ paths:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/utils.Response'
|
||||
$ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/utils.Response'
|
||||
$ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 删除日志
|
||||
@@ -581,7 +581,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.Response'
|
||||
- $ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/vo.TaskLogVO'
|
||||
@@ -589,12 +589,12 @@ paths:
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/utils.Response'
|
||||
$ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: 获取日志详情
|
||||
tags:
|
||||
- 日志
|
||||
- 日志管理
|
||||
/logs/clear:
|
||||
post:
|
||||
consumes:
|
||||
@@ -612,11 +612,11 @@ paths:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/utils.Response'
|
||||
$ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/utils.Response'
|
||||
$ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 清空日志
|
||||
@@ -659,23 +659,23 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.Response'
|
||||
- $ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
- properties:
|
||||
data:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.PaginationData'
|
||||
- properties:
|
||||
list:
|
||||
data:
|
||||
items:
|
||||
$ref: '#/definitions/vo.TaskVO'
|
||||
type: array
|
||||
type: object
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: 获取任务列表
|
||||
tags:
|
||||
- 任务
|
||||
- 任务管理
|
||||
/tasks/{id}:
|
||||
delete:
|
||||
consumes:
|
||||
@@ -693,16 +693,16 @@ paths:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/utils.Response'
|
||||
$ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/utils.Response'
|
||||
$ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: 删除任务
|
||||
tags:
|
||||
- 任务
|
||||
- 任务管理
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
@@ -720,7 +720,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.Response'
|
||||
- $ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/vo.TaskVO'
|
||||
@@ -728,12 +728,12 @@ paths:
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/utils.Response'
|
||||
$ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: 获取任务详情
|
||||
tags:
|
||||
- 任务
|
||||
- 任务管理
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
@@ -757,7 +757,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/definitions/utils.Response'
|
||||
- $ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
- properties:
|
||||
data:
|
||||
$ref: '#/definitions/vo.TaskVO'
|
||||
@@ -765,12 +765,12 @@ paths:
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/utils.Response'
|
||||
$ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: 更新任务
|
||||
tags:
|
||||
- 任务
|
||||
- 任务管理
|
||||
/tasks/stop/{logID}:
|
||||
post:
|
||||
consumes:
|
||||
@@ -788,18 +788,19 @@ paths:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/utils.Response'
|
||||
$ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/utils.Response'
|
||||
$ref: '#/definitions/github_com_engigu_baihu-panel_internal_utils.Response'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: 停止任务
|
||||
tags:
|
||||
- 任务
|
||||
- 任务管理
|
||||
securityDefinitions:
|
||||
ApiKeyAuth:
|
||||
BearerAuth:
|
||||
description: Type "Bearer" followed by a space and the API token.
|
||||
in: header
|
||||
name: Authorization
|
||||
type: apiKey
|
||||
|
||||
Reference in New Issue
Block a user