feat: adjust openapi endpoint

This commit is contained in:
engigu
2026-03-06 17:24:39 +08:00
parent a04d6ab537
commit c251fa452d
11 changed files with 343 additions and 252 deletions
+76 -75
View File
@@ -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"