{ "schemes": [ "http" ], "swagger": "2.0", "info": { "description": "一键虚拟化管理平台API接口文档", "title": "OneClickVirt API", "termsOfService": "http://swagger.io/terms/", "contact": { "name": "API Support", "url": "http://www.swagger.io/support", "email": "support@swagger.io" }, "license": { "name": "MIT", "url": "https://opensource.org/licenses/MIT" }, "version": "1.0" }, "host": "localhost:8888", "basePath": "/api/v1", "paths": { "/admin/announcements": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取系统公告列表(分页)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "获取公告列表", "parameters": [ { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "default": 10, "description": "每页数量", "name": "pageSize", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "管理员创建新公告", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "创建公告", "parameters": [ { "description": "创建公告请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.CreateAnnouncementRequest" } } ], "responses": { "200": { "description": "创建成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "创建失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/announcements/batch-delete": { "delete": { "security": [ { "BearerAuth": [] } ], "description": "管理员批量删除公告", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "批量删除公告", "parameters": [ { "description": "批量操作请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.BatchAnnouncementRequest" } } ], "responses": { "200": { "description": "删除成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "删除失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/announcements/batch-status": { "put": { "security": [ { "BearerAuth": [] } ], "description": "管理员批量更新公告状态", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "批量更新公告状态", "parameters": [ { "description": "批量状态更新请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.BatchUpdateStatusRequest" } } ], "responses": { "200": { "description": "更新成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "更新失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/announcements/{id}": { "put": { "security": [ { "BearerAuth": [] } ], "description": "管理员更新公告信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "更新公告", "parameters": [ { "type": "integer", "description": "公告ID", "name": "id", "in": "path", "required": true }, { "description": "更新公告请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.UpdateAnnouncementRequest" } } ], "responses": { "200": { "description": "更新成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "更新失败", "schema": { "$ref": "#/definitions/common.Response" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "管理员删除公告", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "删除公告", "parameters": [ { "type": "integer", "description": "公告ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "删除成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "删除失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/api-tokens": { "get": { "security": [ { "BearerAuth": [] } ], "description": "管理员获取所有用户的API Token列表", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "API Token管理" ], "summary": "管理员获取API Token列表", "parameters": [ { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "default": 10, "description": "每页数量", "name": "pageSize", "in": "query" }, { "type": "string", "description": "搜索关键字", "name": "keyword", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/api-tokens/:id": { "delete": { "security": [ { "BearerAuth": [] } ], "description": "管理员删除(禁用)任意API Token", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "API Token管理" ], "summary": "管理员删除API Token", "parameters": [ { "type": "integer", "description": "Token ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "删除成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "删除失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/configuration-tasks": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取配置任务列表,支持分页和筛选", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "获取配置任务列表", "parameters": [ { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "default": 10, "description": "页大小", "name": "pageSize", "in": "query" }, { "type": "integer", "description": "Provider ID", "name": "providerId", "in": "query" }, { "type": "string", "description": "任务类型", "name": "taskType", "in": "query" }, { "type": "string", "description": "任务状态", "name": "status", "in": "query" }, { "type": "integer", "description": "执行者ID", "name": "executorId", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/admin.ConfigurationTaskListResponse" } } } ] } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/configuration-tasks/{id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取指定配置任务的详细信息,包括完整日志", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "获取配置任务详情", "parameters": [ { "type": "integer", "description": "任务ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/admin.ConfigurationTaskDetailResponse" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "404": { "description": "任务不存在", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/configuration-tasks/{id}/cancel": { "post": { "security": [ { "BearerAuth": [] } ], "description": "取消正在运行的配置任务", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "取消配置任务", "parameters": [ { "type": "integer", "description": "任务ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "取消成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "404": { "description": "任务不存在", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "取消失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/dashboard": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取管理员后台首页的统计数据", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "获取管理员仪表板", "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/database/stats": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "获取详细的数据库连接池统计信息", "produces": [ "application/json" ], "tags": [ "Health" ], "summary": "数据库统计信息", "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object", "additionalProperties": true } } } ] } } } } }, "/admin/instance-type-permissions": { "get": { "security": [ { "BearerAuth": [] } ], "description": "管理员获取实例类型最低等级要求配置", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "获取实例类型权限配置", "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "管理员更新实例类型最低等级要求配置", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "更新实例类型权限配置", "parameters": [ { "description": "权限配置参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.UpdateInstanceTypePermissionsRequest" } } ], "responses": { "200": { "description": "更新成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "更新失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/instances": { "get": { "security": [ { "BearerAuth": [] } ], "description": "管理员获取系统中所有实例的列表,支持分页和过滤", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "获取实例列表", "parameters": [ { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "default": 10, "description": "每页数量", "name": "pageSize", "in": "query" }, { "type": "string", "description": "实例名称", "name": "name", "in": "query" }, { "type": "string", "description": "实例状态", "name": "status", "in": "query" }, { "type": "string", "description": "节点名称", "name": "providerName", "in": "query" }, { "type": "string", "description": "所有者名称", "name": "ownerName", "in": "query" }, { "type": "string", "description": "实例类型", "name": "instance_type", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/instances/{id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "管理员获取指定实例的详细信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "获取实例详情", "parameters": [ { "type": "integer", "description": "实例ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "404": { "description": "实例不存在", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/instances/{id}/action": { "post": { "security": [ { "BearerAuth": [] } ], "description": "管理员对实例执行启动、停止、重启等操作", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "管理员执行实例操作", "parameters": [ { "type": "string", "description": "实例ID", "name": "id", "in": "path", "required": true }, { "description": "操作请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.InstanceActionRequest" } } ], "responses": { "200": { "description": "操作成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "403": { "description": "权限不足", "schema": { "$ref": "#/definitions/common.Response" } }, "404": { "description": "实例不存在", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/instances/{id}/password/{taskId}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "通过任务ID获取实例重置后的新密码", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "管理员获取实例重置后的新密码", "parameters": [ { "type": "integer", "description": "实例ID", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "任务ID", "name": "taskId", "in": "path", "required": true } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/admin.GetInstancePasswordResponse" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "404": { "description": "实例或任务不存在", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/instances/{id}/port-mappings": { "get": { "security": [ { "BearerAuth": [] } ], "description": "管理员获取指定实例的所有端口映射", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "端口映射管理" ], "summary": "获取实例端口映射", "parameters": [ { "type": "integer", "description": "实例ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/instances/{id}/reset-password": { "put": { "security": [ { "BearerAuth": [] } ], "description": "管理员重置指定实例的登录密码,创建异步任务执行密码重置操作", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "管理员重置实例密码", "parameters": [ { "type": "integer", "description": "实例ID", "name": "id", "in": "path", "required": true }, { "description": "重置实例密码请求参数(可为空对象)", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.ResetInstancePasswordRequest" } } ], "responses": { "200": { "description": "任务创建成功,返回任务ID", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/admin.ResetInstancePasswordResponse" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "404": { "description": "实例不存在", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "创建任务失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/invite-codes": { "get": { "security": [ { "BearerAuth": [] } ], "description": "管理员获取系统中的邀请码列表,支持分页和查询", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "邀请码管理" ], "summary": "获取邀请码列表", "parameters": [ { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "default": 10, "description": "每页数量", "name": "pageSize", "in": "query" }, { "type": "string", "description": "搜索关键字", "name": "keyword", "in": "query" }, { "type": "string", "description": "状态筛选", "name": "status", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "管理员创建新的邀请码", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "邀请码管理" ], "summary": "创建邀请码", "parameters": [ { "description": "创建邀请码请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.CreateInviteCodeRequest" } } ], "responses": { "200": { "description": "创建成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/invite-codes/batch-delete": { "post": { "security": [ { "BearerAuth": [] } ], "description": "管理员批量删除指定的邀请码", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "邀请码管理" ], "summary": "批量删除邀请码", "parameters": [ { "description": "批量删除邀请码请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.BatchDeleteInviteCodesRequest" } } ], "responses": { "200": { "description": "删除成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/invite-codes/export": { "get": { "security": [ { "BearerAuth": [] } ], "description": "导出选中的邀请码为文本格式(每行一个)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "邀请码管理" ], "summary": "导出邀请码", "parameters": [ { "type": "array", "items": { "type": "integer" }, "collectionFormat": "csv", "description": "邀请码ID列表,不传则导出全部", "name": "ids", "in": "query" } ], "responses": { "200": { "description": "导出成功,返回邀请码列表", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "string" } } } } ] } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/invite-codes/generate": { "post": { "security": [ { "BearerAuth": [] } ], "description": "管理员批量生成邀请码,可指定数量和权限等级", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "邀请码管理" ], "summary": "批量生成邀请码", "parameters": [ { "description": "生成邀请码请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.CreateInviteCodeRequest" } } ], "responses": { "200": { "description": "生成成功,返回邀请码列表", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "string" } } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/invite-codes/{id}": { "delete": { "security": [ { "BearerAuth": [] } ], "description": "管理员删除指定的邀请码", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "邀请码管理" ], "summary": "删除邀请码", "parameters": [ { "type": "integer", "description": "邀请码ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "删除成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/monitoring/health": { "get": { "security": [ { "BearerAuth": [] } ], "description": "检查各个组件的健康状态", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "系统监控" ], "summary": "获取系统健康检查", "responses": { "200": { "description": "检查成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "401": { "description": "认证失败", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "检查失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/monitoring/metrics": { "get": { "security": [ { "BearerAuth": [] } ], "description": "返回Prometheus格式的系统监控指标,用于监控系统集成", "consumes": [ "application/json" ], "produces": [ "text/plain" ], "tags": [ "系统监控" ], "summary": "获取Prometheus格式的指标", "responses": { "200": { "description": "Prometheus指标数据", "schema": { "type": "string" } }, "401": { "description": "认证失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/monitoring/provider": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取节点的监控和性能数据", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "系统监控" ], "summary": "获取节点监控数据", "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } } } } }, "/admin/monitoring/system": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取服务器的CPU、内存、磁盘、网络等系统资源使用情况", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "系统监控" ], "summary": "获取系统统计信息", "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/system.SystemStats" } } } ] } }, "401": { "description": "认证失败", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/port-mappings": { "get": { "security": [ { "BearerAuth": [] } ], "description": "管理员获取端口映射列表", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "端口映射管理" ], "summary": "获取端口映射列表", "parameters": [ { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "default": 10, "description": "每页数量", "name": "pageSize", "in": "query" }, { "type": "integer", "description": "Provider ID", "name": "providerId", "in": "query" }, { "type": "integer", "description": "实例ID", "name": "instanceId", "in": "query" }, { "type": "string", "description": "协议类型", "name": "protocol", "in": "query" }, { "type": "string", "description": "状态", "name": "status", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "管理员创建新的端口映射(异步执行)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "端口映射管理" ], "summary": "创建端口映射", "parameters": [ { "description": "创建端口映射请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.CreatePortMappingRequest" } } ], "responses": { "200": { "description": "创建成功,返回任务ID", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "创建失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/port-mappings/batch-delete": { "post": { "security": [ { "BearerAuth": [] } ], "description": "管理员批量删除端口映射(仅支持删除手动添加的端口,区间映射的端口不能删除)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "端口映射管理" ], "summary": "批量删除端口映射", "parameters": [ { "description": "批量删除端口映射请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.BatchDeletePortMappingRequest" } } ], "responses": { "200": { "description": "删除任务已创建", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "创建任务失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/port-mappings/sync": { "post": { "security": [ { "BearerAuth": [] } ], "description": "创建一个后台任务,检测并清理孤立的端口映射(实例已删除但数据库记录仍存在)。为每个Provider创建独立的同步任务", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Admin-Port-Mapping" ], "summary": "同步端口映射", "parameters": [ { "description": "同步参数(可选指定Provider IDs)", "name": "data", "in": "body", "schema": { "$ref": "#/definitions/admin.SyncPortMappingsTaskRequest" } } ], "responses": { "200": { "description": "同步任务已创建", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "未授权", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/port-mappings/{id}": { "delete": { "security": [ { "BearerAuth": [] } ], "description": "管理员删除端口映射(仅支持删除手动添加的端口,区间映射的端口不能删除)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "端口映射管理" ], "summary": "删除端口映射", "parameters": [ { "type": "integer", "description": "端口映射ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "删除任务已创建", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "创建任务失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/ports/check": { "post": { "security": [ { "BearerAuth": [] } ], "description": "检查指定Provider上的端口或端口段是否可用", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "端口映射管理" ], "summary": "检查端口可用性", "parameters": [ { "description": "检查端口可用性请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.CheckPortAvailabilityRequest" } } ], "responses": { "200": { "description": "检查成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/admin.CheckPortAvailabilityResponse" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "检查失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/provider/auto-configure": { "post": { "security": [ { "BearerAuth": [] } ], "description": "自动配置Provider,支持检查历史记录和防重复执行", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "自动配置Provider", "parameters": [ { "description": "自动配置请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.AutoConfigureRequest" } } ], "responses": { "200": { "description": "配置响应", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/admin.AutoConfigureResponse" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "403": { "description": "权限不足", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "配置失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/provider/traffic-monitor": { "post": { "security": [ { "BearerAuth": [] } ], "description": "批量启用、删除或检测Provider下所有实例的流量监控", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "流量监控管理" ], "summary": "流量监控操作", "parameters": [ { "description": "操作请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.TrafficMonitorOperationRequest" } } ], "responses": { "200": { "description": "操作成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/provider/traffic-monitor/latest": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取指定Provider的最新流量监控任务(用于显示运行中的任务)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "流量监控管理" ], "summary": "获取Provider的最新流量监控任务", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "providerId", "in": "query", "required": true } ], "responses": { "200": { "description": "查询成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/admin.TrafficMonitorTask" } } } ] } }, "404": { "description": "没有任务", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/provider/traffic-monitor/tasks": { "get": { "security": [ { "BearerAuth": [] } ], "description": "查询流量监控操作任务列表", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "流量监控管理" ], "summary": "获取流量监控任务列表", "parameters": [ { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "default": 10, "description": "每页数量", "name": "pageSize", "in": "query" }, { "type": "integer", "description": "Provider ID", "name": "providerId", "in": "query" }, { "type": "string", "description": "任务类型", "name": "taskType", "in": "query" }, { "type": "string", "description": "任务状态", "name": "status", "in": "query" } ], "responses": { "200": { "description": "查询成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/provider/traffic-monitor/tasks/{id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取指定任务的详细信息和输出日志", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "流量监控管理" ], "summary": "获取流量监控任务详情", "parameters": [ { "type": "integer", "description": "任务ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "查询成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/admin.TrafficMonitorTask" } } } ] } }, "404": { "description": "任务不存在", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/provider/{id}/port-config": { "put": { "security": [ { "BearerAuth": [] } ], "description": "管理员更新Provider的端口映射配置", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "端口映射管理" ], "summary": "更新Provider端口配置", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true }, { "description": "Provider端口配置请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.ProviderPortConfigRequest" } } ], "responses": { "200": { "description": "更新成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "更新失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/provider/{id}/port-usage": { "get": { "security": [ { "BearerAuth": [] } ], "description": "管理员获取Provider的端口使用统计", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "端口映射管理" ], "summary": "获取Provider端口使用情况", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/providers/{id}/discover": { "post": { "security": [ { "BearerAuth": [] } ], "description": "扫描Provider上所有已存在的实例,返回实例列表", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Provider管理" ], "summary": "发现Provider实例", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "发现成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/provider.DiscoveryResult" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/providers/{id}/hardware-report": { "get": { "security": [ { "BearerAuth": [] } ], "tags": [ "Admin-Provider" ], "summary": "获取Provider硬件测试报告", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.Response" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "tags": [ "Admin-Provider" ], "summary": "通过粘贴板URL保存Provider硬件报告", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true }, { "description": "请求体", "name": "data", "in": "body", "required": true, "schema": { "type": "object" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.Response" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "tags": [ "Admin-Provider" ], "summary": "删除Provider硬件报告", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/providers/{id}/import": { "post": { "security": [ { "BearerAuth": [] } ], "description": "将发现的实例导入到系统中进行管理", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Provider管理" ], "summary": "导入Provider实例", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true }, { "description": "导入选项", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/provider.ImportOptions" } } ], "responses": { "200": { "description": "导入成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/provider.ImportResult" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/providers/{id}/ipv4-pool": { "get": { "security": [ { "BearerAuth": [] } ], "description": "管理员获取指定服务商的IPv4地址池(分页)", "tags": [ "服务商管理" ], "summary": "获取IPv4地址池", "parameters": [ { "type": "integer", "description": "服务商ID", "name": "id", "in": "path", "required": true }, { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "default": 100, "description": "每页数量", "name": "pageSize", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "$ref": "#/definitions/common.Response" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "向指定服务商的IPv4地址池中追加IP(每行一个IP或CIDR)", "tags": [ "服务商管理" ], "summary": "设置IPv4地址池", "parameters": [ { "type": "integer", "description": "服务商ID", "name": "id", "in": "path", "required": true }, { "description": "地址列表(每行一个IP/CIDR,可含注释行)", "name": "body", "in": "body", "required": true, "schema": { "type": "object" } } ], "responses": { "200": { "description": "设置成功", "schema": { "$ref": "#/definitions/common.Response" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "清空指定服务商地址池中所有未分配的IP地址", "tags": [ "服务商管理" ], "summary": "清空未分配IPv4地址", "parameters": [ { "type": "integer", "description": "服务商ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "清空成功", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/providers/{id}/ipv4-pool/{entry_id}": { "delete": { "security": [ { "BearerAuth": [] } ], "tags": [ "服务商管理" ], "summary": "删除单个IPv4地址", "parameters": [ { "type": "integer", "description": "服务商ID", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "地址条目ID", "name": "entry_id", "in": "path", "required": true } ], "responses": { "200": { "description": "删除成功", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/providers/{id}/orphaned": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取Provider上已存在但未被系统纳管的实例列表", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Provider管理" ], "summary": "获取未纳管实例", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/provider.DiscoveredInstance" } } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/providers/{id}/sync-check": { "post": { "security": [ { "BearerAuth": [] } ], "description": "比较数据库实例与Provider远程实例,检测新增、删除和变化的实例", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Provider管理" ], "summary": "检查实例同步", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "检查成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/provider.InstanceSyncReport" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/redemption-codes": { "get": { "security": [ { "BearerAuth": [] } ], "description": "管理员获取兑换码列表,支持分页和筛选", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "兑换码管理" ], "summary": "获取兑换码列表", "parameters": [ { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "default": 10, "description": "每页数量", "name": "pageSize", "in": "query" }, { "type": "string", "description": "兑换码关键字", "name": "code", "in": "query" }, { "type": "string", "description": "状态筛选", "name": "status", "in": "query" }, { "type": "integer", "description": "节点ID筛选", "name": "providerId", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/redemption-codes/batch-create": { "post": { "security": [ { "BearerAuth": [] } ], "description": "管理员批量创建兑换码,触发后台实例创建任务", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "兑换码管理" ], "summary": "批量创建兑换码", "parameters": [ { "description": "批量创建请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.BatchCreateRedemptionCodesRequest" } } ], "responses": { "200": { "description": "创建成功", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/redemption-codes/batch-delete": { "post": { "security": [ { "BearerAuth": [] } ], "description": "管理员批量删除兑换码(硬删除)及关联实例", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "兑换码管理" ], "summary": "批量删除兑换码", "parameters": [ { "description": "批量删除请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.BatchDeleteRedemptionCodesRequest" } } ], "responses": { "200": { "description": "删除成功", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/redemption-codes/export": { "post": { "security": [ { "BearerAuth": [] } ], "description": "管理员导出指定兑换码的字符串列表", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "兑换码管理" ], "summary": "导出兑换码", "parameters": [ { "description": "导出请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.ExportRedemptionCodesRequest" } } ], "responses": { "200": { "description": "导出成功", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/system-images": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取系统镜像列表,支持分页和过滤条件", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "系统镜像管理" ], "summary": "获取系统镜像列表", "parameters": [ { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "default": 10, "description": "每页数量", "name": "pageSize", "in": "query" }, { "enum": [ "proxmox", "lxd", "incus", "docker" ], "type": "string", "description": "提供商类型", "name": "providerType", "in": "query" }, { "enum": [ "vm", "container" ], "type": "string", "description": "实例类型", "name": "instanceType", "in": "query" }, { "enum": [ "amd64", "arm64", "s390x" ], "type": "string", "description": "架构", "name": "architecture", "in": "query" }, { "enum": [ "active", "inactive" ], "type": "string", "description": "状态", "name": "status", "in": "query" }, { "type": "string", "description": "搜索关键字", "name": "search", "in": "query" }, { "type": "string", "description": "操作系统类型", "name": "osType", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "创建新的系统镜像配置", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "系统镜像管理" ], "summary": "创建系统镜像", "parameters": [ { "description": "创建系统镜像请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/system.CreateSystemImageRequest" } } ], "responses": { "200": { "description": "创建成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "认证失败", "schema": { "$ref": "#/definitions/common.Response" } }, "409": { "description": "镜像名称已存在", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/tasks": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取所有用户的任务列表,支持分页和筛选", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "获取管理员任务列表", "parameters": [ { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "default": 10, "description": "页大小", "name": "pageSize", "in": "query" }, { "type": "integer", "description": "Provider ID", "name": "providerId", "in": "query" }, { "type": "string", "description": "用户名", "name": "username", "in": "query" }, { "type": "string", "description": "任务类型", "name": "taskType", "in": "query" }, { "type": "string", "description": "任务状态", "name": "status", "in": "query" }, { "type": "string", "description": "实例类型", "name": "instanceType", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/admin.AdminTaskListResponse" } } } ] } }, "401": { "description": "权限不足", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/tasks/force-stop": { "post": { "security": [ { "BearerAuth": [] } ], "description": "管理员强制停止运行中的任务", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "强制停止任务", "parameters": [ { "description": "强制停止任务请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.ForceStopTaskRequest" } } ], "responses": { "200": { "description": "操作成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "权限不足", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "操作失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/tasks/overall-stats": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取所有任务的总体统计信息,包括各种状态的任务数量", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "获取任务总体统计信息", "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/admin.TaskStatsResponse" } } } ] } }, "401": { "description": "权限不足", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/tasks/stats": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取系统任务统计信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "获取任务统计", "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/admin.TaskStatsResponse" } } } ] } }, "401": { "description": "权限不足", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/tasks/{taskId}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "管理员获取指定任务的详细信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "获取任务详情", "parameters": [ { "type": "integer", "description": "任务ID", "name": "taskId", "in": "path", "required": true } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/admin.AdminTaskDetailResponse" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "权限不足", "schema": { "$ref": "#/definitions/common.Response" } }, "404": { "description": "任务不存在", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/tasks/{taskId}/cancel": { "post": { "security": [ { "BearerAuth": [] } ], "description": "管理员取消指定用户的任务", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "管理员取消用户任务", "parameters": [ { "type": "integer", "description": "任务ID", "name": "taskId", "in": "path", "required": true } ], "responses": { "200": { "description": "操作成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "权限不足", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "操作失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/traffic/sync/all": { "post": { "security": [ { "BearerAuth": [] } ], "description": "立即触发全系统所有实例的流量数据同步", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员-流量同步" ], "summary": "手动同步全系统流量数据", "responses": { "200": { "description": "同步成功", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/common.Response" } }, "403": { "description": "权限不足", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/traffic/sync/instance/{instance_id}": { "post": { "security": [ { "BearerAuth": [] } ], "description": "立即触发指定实例的流量数据同步", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员-流量同步" ], "summary": "手动同步单个实例的流量数据", "parameters": [ { "type": "integer", "description": "实例ID", "name": "instance_id", "in": "path", "required": true } ], "responses": { "200": { "description": "同步成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/common.Response" } }, "403": { "description": "权限不足", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/traffic/sync/provider/{provider_id}": { "post": { "security": [ { "BearerAuth": [] } ], "description": "立即触发指定Provider所有实例的流量数据同步", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员-流量同步" ], "summary": "手动同步Provider所有实例的流量数据", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "provider_id", "in": "path", "required": true } ], "responses": { "200": { "description": "同步成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/common.Response" } }, "403": { "description": "权限不足", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/traffic/sync/user/{user_id}": { "post": { "security": [ { "BearerAuth": [] } ], "description": "立即触发指定用户所有实例的流量数据同步", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员-流量同步" ], "summary": "手动同步用户所有实例的流量数据", "parameters": [ { "type": "integer", "description": "用户ID", "name": "user_id", "in": "path", "required": true } ], "responses": { "200": { "description": "同步成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "未认证", "schema": { "$ref": "#/definitions/common.Response" } }, "403": { "description": "权限不足", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/users": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取系统中所有用户的列表(分页)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "获取用户列表", "parameters": [ { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "default": 10, "description": "每页数量", "name": "pageSize", "in": "query" }, { "type": "string", "description": "用户名搜索", "name": "username", "in": "query" }, { "type": "string", "description": "昵称搜索", "name": "nickname", "in": "query" }, { "type": "string", "description": "邮箱搜索", "name": "email", "in": "query" }, { "type": "string", "description": "用户状态", "name": "status", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "管理员创建新用户账户", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "创建用户", "parameters": [ { "description": "创建用户请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.CreateUserRequest" } } ], "responses": { "200": { "description": "创建成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "创建失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/users/batch-delete": { "post": { "security": [ { "BearerAuth": [] } ], "description": "管理员批量删除用户", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "管理员批量删除用户", "parameters": [ { "description": "批量删除用户请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.BatchDeleteUsersRequest" } } ], "responses": { "200": { "description": "删除成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "删除失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/users/batch-level": { "put": { "security": [ { "BearerAuth": [] } ], "description": "管理员批量更新多个用户的等级", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "批量更新用户等级", "parameters": [ { "description": "批量更新用户等级请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.BatchUpdateUserLevelRequest" } } ], "responses": { "200": { "description": "更新成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "更新失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/users/batch-status": { "put": { "security": [ { "BearerAuth": [] } ], "description": "管理员批量更新用户状态(启用/禁用)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "管理员批量更新用户状态", "parameters": [ { "description": "批量更新用户状态请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.BatchUpdateUserStatusRequest" } } ], "responses": { "200": { "description": "更新成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "更新失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/users/{id}/level": { "put": { "security": [ { "BearerAuth": [] } ], "description": "管理员更新指定用户的等级", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "更新用户等级", "parameters": [ { "type": "integer", "description": "用户ID", "name": "id", "in": "path", "required": true }, { "description": "更新用户等级请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.UpdateUserLevelRequest" } } ], "responses": { "200": { "description": "更新成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "更新失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/users/{id}/reset-password": { "put": { "security": [ { "BearerAuth": [] } ], "description": "管理员强制重置指定用户的登录密码,系统自动生成符合安全策略的新密码", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "管理员强制重置用户密码", "parameters": [ { "type": "integer", "description": "用户ID", "name": "id", "in": "path", "required": true }, { "description": "重置密码请求参数(可为空对象)", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.ResetUserPasswordRequest" } } ], "responses": { "200": { "description": "重置成功,返回新密码", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/admin.ResetUserPasswordResponse" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "404": { "description": "用户不存在", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "重置失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/users/{id}/reset-password-notify": { "put": { "security": [ { "BearerAuth": [] } ], "description": "管理员重置指定用户的登录密码,系统自动生成符合安全策略的新密码并发送到用户绑定的通信渠道", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "管理员重置用户密码并发送到用户通信渠道", "parameters": [ { "type": "integer", "description": "用户ID", "name": "id", "in": "path", "required": true }, { "description": "重置密码请求参数(可为空对象)", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.ResetUserPasswordRequest" } } ], "responses": { "200": { "description": "重置成功,新密码已发送到用户绑定的通信渠道", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "404": { "description": "用户不存在", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "重置失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/admin/users/{id}/status": { "put": { "security": [ { "BearerAuth": [] } ], "description": "管理员更新用户状态(启用/禁用)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "更新用户状态", "parameters": [ { "type": "integer", "description": "用户ID", "name": "id", "in": "path", "required": true }, { "description": "更新用户状态请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/admin.UpdateUserStatusRequest" } } ], "responses": { "200": { "description": "更新成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "更新失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/api/v1/admin/logs/cleanup": { "post": { "security": [ { "BearerAuth": [] } ], "description": "根据配置的保留天数清理旧的日志文件", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "System" ], "summary": "清理旧日志文件", "responses": { "200": { "description": "success", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/api/v1/admin/logs/files": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取所有日志文件的信息,包括按日期分割的日志文件", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "System" ], "summary": "获取日志文件列表", "responses": { "200": { "description": "success", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/log.LogFileInfo" } } } } ] } } } } }, "/api/v1/admin/logs/read": { "get": { "security": [ { "BearerAuth": [] } ], "description": "读取指定日志文件的内容,支持指定返回行数", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "System" ], "summary": "读取日志文件内容", "parameters": [ { "type": "string", "description": "日志文件名", "name": "filename", "in": "query", "required": true }, { "type": "integer", "description": "返回行数,默认100行", "name": "lines", "in": "query" } ], "responses": { "200": { "description": "success", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "string" } } } } ] } } } } }, "/api/v1/admin/monitoring/audit-logs": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取用户操作审计日志", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员管理" ], "summary": "获取操作审计日志", "parameters": [ { "type": "integer", "description": "用户ID", "name": "user_id", "in": "query" }, { "type": "string", "description": "操作类型", "name": "action", "in": "query" }, { "type": "string", "description": "开始时间", "name": "start_time", "in": "query" }, { "type": "string", "description": "结束时间", "name": "end_time", "in": "query" }, { "type": "integer", "default": 100, "description": "返回条数", "name": "limit", "in": "query" }, { "type": "integer", "default": 0, "description": "偏移量", "name": "offset", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object" } } } } ] } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/api/v1/admin/monitoring/logs": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取系统运行日志", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "监控管理" ], "summary": "获取系统日志", "parameters": [ { "enum": [ "info", "warn", "error", "debug" ], "type": "string", "description": "日志级别", "name": "level", "in": "query" }, { "type": "integer", "default": 100, "description": "返回条数", "name": "limit", "in": "query" }, { "type": "integer", "default": 0, "description": "偏移量", "name": "offset", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object" } } } } ] } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/api/v1/admin/storage/cleanup": { "post": { "security": [ { "BearerAuth": [] } ], "description": "清理临时目录中的所有文件", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "System" ], "summary": "清理临时文件", "responses": { "200": { "description": "success", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/api/v1/admin/storage/info": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取存储目录结构和状态信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "System" ], "summary": "获取存储目录信息", "responses": { "200": { "description": "success", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object", "additionalProperties": true } } } ] } } } } }, "/api/v1/admin/storage/init": { "post": { "security": [ { "BearerAuth": [] } ], "description": "重新创建所有必要的存储目录", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "System" ], "summary": "重新初始化存储目录", "responses": { "200": { "description": "success", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/api/v1/admin/traffic/batch-manage": { "post": { "security": [ { "ApiKeyAuth": [] } ], "description": "批量设置或解除用户的流量限制", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员流量" ], "summary": "批量管理流量限制", "parameters": [ { "description": "批量流量限制管理请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/traffic.BatchManageTrafficLimitRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/api/v1/admin/traffic/batch-sync": { "post": { "security": [ { "ApiKeyAuth": [] } ], "description": "批量触发用户流量数据同步", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员流量" ], "summary": "批量同步用户流量", "parameters": [ { "description": "批量同步流量请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/traffic.BatchSyncTrafficRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/api/v1/admin/traffic/manage": { "post": { "security": [ { "ApiKeyAuth": [] } ], "description": "手动设置或解除用户/Provider的流量限制", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员流量" ], "summary": "管理流量限制", "parameters": [ { "description": "流量限制管理请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/traffic.ManageTrafficLimitRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/api/v1/admin/traffic/overview": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "获取整个系统的流量使用情况概览", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员流量" ], "summary": "获取系统流量概览", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/api/v1/admin/traffic/provider/{providerId}": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "获取指定Provider的流量使用情况", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员流量" ], "summary": "获取Provider流量统计", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "providerId", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/api/v1/admin/traffic/user/{userId}": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "获取指定用户的流量使用情况", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员流量" ], "summary": "获取用户流量统计", "parameters": [ { "type": "integer", "description": "用户ID", "name": "userId", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/api/v1/admin/traffic/user/{userId}/clear": { "delete": { "security": [ { "ApiKeyAuth": [] } ], "description": "删除指定用户的所有历史流量记录,用于重新计数", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员流量" ], "summary": "清空用户流量记录", "parameters": [ { "type": "integer", "description": "用户ID", "name": "userId", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/api/v1/admin/traffic/users/rank": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "获取系统中所有用户的流量使用排行榜,支持分页和搜索", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员流量" ], "summary": "获取用户流量排行榜", "parameters": [ { "type": "integer", "description": "页码,默认1", "name": "page", "in": "query" }, { "type": "integer", "description": "每页数量,默认10", "name": "pageSize", "in": "query" }, { "type": "string", "description": "按用户名搜索", "name": "username", "in": "query" }, { "type": "string", "description": "按昵称搜索", "name": "nickname", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/api/v1/user/traffic/instance/{instanceId}": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "获取指定实例的详细流量统计信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户流量" ], "summary": "获取实例流量详情", "parameters": [ { "type": "integer", "description": "实例ID", "name": "instanceId", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/api/v1/user/traffic/instances": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "获取用户所有实例的流量使用汇总信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户流量" ], "summary": "获取用户所有实例流量汇总", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/api/v1/user/traffic/limit-status": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "获取用户的流量限制状态和受限实例信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户流量" ], "summary": "获取流量限制状态", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/api/v1/user/traffic/overview": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "基于pmacct获取用户流量使用情况概览", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户流量" ], "summary": "获取用户流量概览", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/api/v1/user/traffic/pmacct/{instanceId}": { "get": { "security": [ { "ApiKeyAuth": [] } ], "description": "获取指定实例的原始pmacct统计数据", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户流量" ], "summary": "获取原始pmacct数据", "parameters": [ { "type": "integer", "description": "实例ID", "name": "instanceId", "in": "path", "required": true }, { "type": "string", "description": "网络接口名称", "name": "interface", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/auth/captcha": { "get": { "description": "生成图片验证码用于用户验证", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证管理" ], "summary": "获取验证码", "parameters": [ { "type": "integer", "default": 120, "description": "验证码宽度", "name": "width", "in": "query" }, { "type": "integer", "default": 40, "description": "验证码高度", "name": "height", "in": "query" } ], "responses": { "200": { "description": "验证码生成成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/auth/forgot-password": { "post": { "description": "发送密码重置邮件", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证管理" ], "summary": "忘记密码", "parameters": [ { "description": "忘记密码请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/auth.ForgotPasswordRequest" } } ], "responses": { "200": { "description": "重置邮件发送成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/auth/login": { "post": { "description": "用户登录接口,验证用户名密码并返回JWT token", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证管理" ], "summary": "用户登录", "parameters": [ { "description": "登录请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/auth.LoginRequest" } } ], "responses": { "200": { "description": "登录成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "认证失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/auth/logout": { "post": { "security": [ { "BearerAuth": [] } ], "description": "撤销当前用户的JWT token并登出", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证管理" ], "summary": "用户登出", "responses": { "200": { "description": "登出成功", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "用户未认证", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/auth/oauth2/callback": { "get": { "description": "处理OAuth2提供商的回调", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "OAuth2回调", "parameters": [ { "type": "string", "description": "授权码", "name": "code", "in": "query", "required": true }, { "type": "string", "description": "状态令牌", "name": "state", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object", "additionalProperties": true } } } ] } } } } }, "/auth/oauth2/login": { "get": { "description": "跳转到OAuth2提供商的授权页面", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证" ], "summary": "OAuth2登录", "parameters": [ { "type": "string", "description": "提供商名称(如linuxdo)", "name": "provider", "in": "query" }, { "type": "integer", "description": "提供商ID", "name": "provider_id", "in": "query" } ], "responses": { "302": { "description": "重定向到OAuth2授权页面", "schema": { "type": "string" } } } } }, "/auth/register": { "post": { "description": "创建新用户账户", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证管理" ], "summary": "用户注册", "parameters": [ { "description": "注册请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/auth.RegisterRequest" } } ], "responses": { "200": { "description": "注册成功,返回用户信息和token", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "请求参数错误或注册失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/auth/reset-password": { "post": { "description": "使用重置令牌自动生成新密码并通过用户绑定的通信渠道发送", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证管理" ], "summary": "重置密码", "parameters": [ { "description": "重置密码请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/auth.ResetPasswordRequest" } } ], "responses": { "200": { "description": "密码重置成功,新密码已发送到绑定的通信渠道", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/auth/send-verify-code": { "post": { "description": "向指定的邮箱/Telegram/QQ发送登录验证码", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "认证管理" ], "summary": "发送验证码", "parameters": [ { "description": "发送验证码请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/auth.SendVerifyCodeRequest" } } ], "responses": { "200": { "description": "验证码发送成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/config": { "get": { "security": [ { "BearerAuth": [] } ], "description": "根据用户权限返回相应的配置信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "配置管理" ], "summary": "获取系统配置", "parameters": [ { "enum": [ "public", "user", "admin" ], "type": "string", "default": "user", "description": "配置范围", "name": "scope", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": {} } } ] } }, "401": { "description": "认证失败", "schema": { "$ref": "#/definitions/common.Response" } }, "403": { "description": "权限不足", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "根据用户权限更新相应的配置信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "配置管理" ], "summary": "更新系统配置", "parameters": [ { "description": "配置更新请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/config.UnifiedConfigRequest" } } ], "responses": { "200": { "description": "更新成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "认证失败", "schema": { "$ref": "#/definitions/common.Response" } }, "403": { "description": "权限不足", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "更新失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/dashboard/stats": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取系统总体统计信息,包括用户数、实例数等", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "仪表板" ], "summary": "获取仪表板统计数据", "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/health": { "get": { "description": "检查数据库连接和系统状态", "produces": [ "application/json" ], "tags": [ "Health" ], "summary": "系统健康检查", "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object", "additionalProperties": true } } } ] } } } } }, "/oauth2/presets": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取所有可用的OAuth2预设配置(linuxdo, idcflare, github, generic)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "OAuth2" ], "summary": "获取OAuth2预设配置", "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object", "additionalProperties": { "$ref": "#/definitions/oauth2.PresetConfig" } } } } ] } } } } }, "/oauth2/presets/{name}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取指定名称的OAuth2预设配置详情", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "OAuth2" ], "summary": "获取指定预设配置", "parameters": [ { "enum": [ "linuxdo", "idcflare", "github", "generic" ], "type": "string", "description": "预设名称", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/oauth2.PresetConfig" } } } ] } } } } }, "/oauth2/providers": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取所有OAuth2提供商(包括禁用的)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "OAuth2" ], "summary": "获取OAuth2提供商列表", "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/oauth2.OAuth2Provider" } } } } ] } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "创建新的OAuth2提供商配置", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "OAuth2" ], "summary": "创建OAuth2提供商", "parameters": [ { "description": "提供商配置", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/oauth2.CreateProviderRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/oauth2.OAuth2Provider" } } } ] } } } } }, "/oauth2/providers/{id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取指定OAuth2提供商的详细信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "OAuth2" ], "summary": "获取OAuth2提供商详情", "parameters": [ { "type": "integer", "description": "提供商ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/oauth2.OAuth2Provider" } } } ] } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "更新OAuth2提供商配置", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "OAuth2" ], "summary": "更新OAuth2提供商", "parameters": [ { "type": "integer", "description": "提供商ID", "name": "id", "in": "path", "required": true }, { "description": "更新内容", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/oauth2.UpdateProviderRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.Response" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "删除OAuth2提供商(如有用户使用则无法删除)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "OAuth2" ], "summary": "删除OAuth2提供商", "parameters": [ { "type": "integer", "description": "提供商ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/oauth2/providers/{id}/reset-count": { "post": { "security": [ { "BearerAuth": [] } ], "description": "重置OAuth2提供商的注册计数", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "OAuth2" ], "summary": "重置注册计数", "parameters": [ { "type": "integer", "description": "提供商ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/provider/": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取系统中配置的所有虚拟化提供者", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "虚拟化管理" ], "summary": "获取所有Provider", "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object" } } } } ] } } } } }, "/provider/connect": { "post": { "security": [ { "BearerAuth": [] } ], "description": "连接到虚拟化提供者(如Docker、LXD、Proxmox等)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "虚拟化管理" ], "summary": "连接虚拟化Provider", "parameters": [ { "description": "连接参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/oneclickvirt_service_provider.ConnectProviderRequest" } } ], "responses": { "200": { "description": "连接成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "连接失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/provider/{id}/capabilities": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取指定Provider支持的功能和实例类型", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "虚拟化管理" ], "summary": "获取Provider能力", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "404": { "description": "Provider不存在", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/provider/{id}/instances": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取指定Provider下的所有实例", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "虚拟化管理" ], "summary": "获取实例列表", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object" } } } } ] } }, "404": { "description": "Provider不存在", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "在指定Provider上创建新的虚拟机或容器实例", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "虚拟化管理" ], "summary": "创建实例", "parameters": [ { "enum": [ "docker", "lxd", "incus", "proxmox" ], "type": "string", "description": "Provider类型", "name": "type", "in": "path", "required": true }, { "description": "创建实例请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/oneclickvirt_service_provider.CreateInstanceRequest" } } ], "responses": { "200": { "description": "创建成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "404": { "description": "Provider不存在", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "创建失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/provider/{id}/status": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取指定Provider的连接状态和支持的实例类型", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "虚拟化管理" ], "summary": "获取Provider状态", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "404": { "description": "Provider不存在", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/public/init": { "post": { "description": "进行系统的初始化设置,创建管理员和默认用户", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "系统初始化" ], "summary": "初始化系统", "parameters": [ { "description": "初始化请求参数", "name": "request", "in": "body", "required": true, "schema": { "type": "object" } } ], "responses": { "200": { "description": "初始化成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误或系统已初始化", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "初始化失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/public/init-progress": { "get": { "description": "轮询此接口获取系统初始化的实时进度,status 为 success 时初始化完成", "produces": [ "application/json" ], "tags": [ "系统初始化" ], "summary": "获取系统初始化进度", "responses": { "200": { "description": "进度信息", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/public/init/check": { "get": { "description": "检查系统是否需要进行初始化设置", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "系统初始化" ], "summary": "检查系统初始化状态", "responses": { "200": { "description": "检查成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } } } } }, "/public/oauth2/providers": { "get": { "description": "获取所有启用的OAuth2提供商(公开接口)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "OAuth2" ], "summary": "获取启用的OAuth2提供商", "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "additionalProperties": true } } } } ] } } } } }, "/public/providers/{id}/hardware-report": { "get": { "tags": [ "Public" ], "summary": "获取Provider硬件报告(用户端)", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/public/recommended-db-type": { "get": { "description": "根据系统架构获取推荐的数据库类型", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "系统初始化" ], "summary": "获取推荐的数据库类型", "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } } } } }, "/public/register-config": { "get": { "description": "获取注册页面所需的配置信息(不需要认证)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "系统初始化" ], "summary": "获取注册配置信息", "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } } } } }, "/public/system-config": { "get": { "description": "获取系统公开配置信息(不需要认证),如默认语言等,从内存配置读取", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "系统配置" ], "summary": "获取公开的系统配置信息", "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } } } } }, "/public/test-db-connection": { "post": { "description": "测试数据库连接是否可用,用于初始化前验证数据库配置", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "系统初始化" ], "summary": "测试数据库连接", "parameters": [ { "description": "数据库连接参数", "name": "request", "in": "body", "required": true, "schema": { "type": "object" } } ], "responses": { "200": { "description": "连接成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "连接失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/active-reservations": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前用户的所有活跃资源预留记录", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取用户的活跃资源预留", "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/resource.ResourceReservation" } } } } ] } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/api-tokens": { "get": { "security": [ { "BearerAuth": [] } ], "description": "用户获取自己的API Token列表", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "API Token管理" ], "summary": "获取API Token列表", "parameters": [ { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "default": 10, "description": "每页数量", "name": "pageSize", "in": "query" }, { "type": "string", "description": "搜索关键字", "name": "keyword", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "用户创建自己的API访问令牌", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "API Token管理" ], "summary": "创建API Token", "parameters": [ { "description": "创建Token请求", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/auth.ApiTokenCreateRequest" } } ], "responses": { "200": { "description": "创建成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/auth.ApiTokenCreateResponse" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "创建失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/api-tokens/:id": { "delete": { "security": [ { "BearerAuth": [] } ], "description": "用户删除(禁用)自己的API Token", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "API Token管理" ], "summary": "删除API Token", "parameters": [ { "type": "integer", "description": "Token ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "删除成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "删除失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/dashboard": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前登录用户的仪表板数据", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取用户仪表板", "responses": { "200": { "description": "获取成功", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/images": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前用户可以使用的系统镜像列表,支持按Provider和实例类型过滤", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取系统镜像列表", "parameters": [ { "type": "string", "description": "Provider类型", "name": "providerType", "in": "query" }, { "type": "integer", "description": "Provider ID", "name": "providerId", "in": "query" }, { "enum": [ "container", "vm" ], "type": "string", "description": "实例类型", "name": "instanceType", "in": "query" }, { "type": "string", "description": "架构", "name": "architecture", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/user.SystemImageResponse" } } } } ] } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/images/filtered": { "get": { "security": [ { "BearerAuth": [] } ], "description": "根据Provider ID和实例类型获取匹配的系统镜像列表", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取过滤后的系统镜像列表", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "provider_id", "in": "query", "required": true }, { "enum": [ "container", "vm" ], "type": "string", "description": "实例类型", "name": "instance_type", "in": "query", "required": true }, { "enum": [ "amd64", "arm64" ], "type": "string", "description": "架构类型", "name": "architecture", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/user.SystemImageResponse" } } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/info": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前登录用户的详细信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取用户信息", "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "401": { "description": "用户未授权", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/instance-config": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取可用的镜像、规格等实例创建配置选项", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取实例配置选项", "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/user.InstanceConfigResponse" } } } ] } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/instance-type-permissions": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前用户可以创建的实例类型权限配置,基于用户配额和Provider能力", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取实例类型权限配置", "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/instances": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前用户的所有实例", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取用户实例列表", "parameters": [ { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "default": 10, "description": "每页数量", "name": "pageSize", "in": "query" }, { "type": "string", "description": "实例状态", "name": "status", "in": "query" }, { "type": "string", "description": "实例类型", "name": "type", "in": "query" }, { "type": "string", "description": "节点名称", "name": "providerName", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "用户创建新的虚拟机或容器实例(异步处理)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "创建实例", "parameters": [ { "description": "创建实例请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/user.CreateInstanceRequest" } } ], "responses": { "200": { "description": "任务创建成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "创建失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/instances/action": { "post": { "security": [ { "BearerAuth": [] } ], "description": "对用户实例执行操作(启动、停止、重启等)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "实例操作", "parameters": [ { "description": "实例操作请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/user.InstanceActionRequest" } } ], "responses": { "200": { "description": "操作成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "操作失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/instances/{id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取用户实例的详细信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取用户实例详情", "parameters": [ { "type": "integer", "description": "实例ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/user.UserInstanceDetailResponse" } } } ] } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "403": { "description": "实例不存在或无权限", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/instances/{id}/monitoring": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取用户实例的监控数据,包括流量统计信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取实例监控数据", "parameters": [ { "type": "integer", "description": "实例ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/user.InstanceMonitoringResponse" } } } ] } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "403": { "description": "实例不存在或无权限", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/instances/{id}/password/{taskId}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "通过任务ID获取实例重置后的新密码", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取实例重置后的新密码", "parameters": [ { "type": "integer", "description": "实例ID", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "任务ID", "name": "taskId", "in": "path", "required": true } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/user.GetInstancePasswordResponse" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "403": { "description": "实例不存在或无权限", "schema": { "$ref": "#/definitions/common.Response" } }, "404": { "description": "任务不存在或未完成", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/instances/{id}/ports": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取指定实例的端口映射信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取实例端口映射", "parameters": [ { "type": "string", "description": "实例ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "获取成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "403": { "description": "无权限访问", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/instances/{id}/reset-password": { "put": { "security": [ { "BearerAuth": [] } ], "description": "用户重置自己实例的登录密码,创建异步任务执行密码重置操作", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "用户重置实例密码", "parameters": [ { "type": "integer", "description": "实例ID", "name": "id", "in": "path", "required": true }, { "description": "重置实例密码请求参数(可为空对象)", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/user.ResetInstancePasswordRequest" } } ], "responses": { "200": { "description": "任务创建成功,返回任务ID", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/user.ResetInstancePasswordResponse" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "403": { "description": "实例不存在或无权限", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "创建任务失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/instances/{instance_id}/pmacct/query": { "get": { "security": [ { "BearerAuth": [] } ], "description": "查询实例的pmacct流量数据", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "查询实例pmacct流量数据", "parameters": [ { "type": "integer", "description": "实例ID", "name": "instance_id", "in": "path", "required": true } ], "responses": { "200": { "description": "查询成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/monitoring.PmacctSummary" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "403": { "description": "无权限访问该实例", "schema": { "$ref": "#/definitions/common.Response" } }, "404": { "description": "实例不存在", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "查询失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/instances/{instance_id}/pmacct/summary": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取用户实例的pmacct流量汇总信息,包括今日、本月和总流量统计", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取实例pmacct流量汇总", "parameters": [ { "type": "integer", "description": "实例ID", "name": "instance_id", "in": "path", "required": true } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/monitoring.PmacctSummary" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "403": { "description": "无权限访问该实例", "schema": { "$ref": "#/definitions/common.Response" } }, "404": { "description": "实例不存在", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "获取失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/limits": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前登录用户的配额限制信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取用户配额限制", "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "$ref": "#/definitions/user.UserLimitsResponse" } } } ] } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/password": { "put": { "security": [ { "BearerAuth": [] } ], "description": "修改当前用户的登录密码", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "修改密码", "parameters": [ { "description": "修改密码请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/user.ChangePasswordRequest" } } ], "responses": { "200": { "description": "修改成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "修改失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/port-mappings": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前登录用户的所有端口映射", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取用户端口映射列表", "parameters": [ { "type": "integer", "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "description": "每页数量", "name": "limit", "in": "query" }, { "type": "string", "description": "搜索关键字", "name": "keyword", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/profile": { "put": { "security": [ { "BearerAuth": [] } ], "description": "更新当前用户的个人资料信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "更新个人信息", "parameters": [ { "description": "更新个人信息请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/user.UpdateProfileRequest" } } ], "responses": { "200": { "description": "更新成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "更新失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/provider/available": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前用户可以申领的节点列表,根据资源使用情况筛选", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取可用节点列表", "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/user.AvailableProviderResponse" } } } } ] } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/provider/{id}/capabilities": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取指定Provider支持的实例类型和架构信息", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取Provider能力信息", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/provider/{id}/gpus": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取指定Provider最后一次GPU检测的缓存结果(持久化存储),供用户申请时选择GPU设备", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取Provider GPU/NPU设备列表", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "GPU列表", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object" } } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "404": { "description": "Provider不存在或无缓存数据", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/redemption-codes/redeem": { "post": { "security": [ { "BearerAuth": [] } ], "description": "通过兑换码获取对应的云实例", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户实例管理" ], "summary": "兑换码兑换", "parameters": [ { "description": "兑换码请求 {\\", "name": "request", "in": "body", "required": true, "schema": { "type": "object" } } ], "responses": { "200": { "description": "兑换成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "未登录", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/reset-password": { "put": { "security": [ { "BearerAuth": [] } ], "description": "用户重置自己的登录密码,系统自动生成符合安全策略的新密码,并通过绑定的通信渠道发送", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "用户重置自己的密码", "parameters": [ { "description": "重置密码请求参数(可为空对象)", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/user.ResetPasswordRequest" } } ], "responses": { "200": { "description": "重置成功,新密码已发送到绑定的通信渠道", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "重置失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/resources/available": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前用户可以申领的资源列表", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取可申领资源", "parameters": [ { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "default": 10, "description": "每页数量", "name": "pageSize", "in": "query" }, { "type": "string", "description": "资源类型", "name": "resourceType", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/resources/claim": { "post": { "security": [ { "BearerAuth": [] } ], "description": "用户申领可用的资源实例", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "申领资源", "parameters": [ { "description": "申领资源请求参数", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/user.ClaimResourceRequest" } } ], "responses": { "200": { "description": "申领成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "申领失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/tasks": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前用户的任务列表", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "获取用户任务列表", "parameters": [ { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "integer", "default": 10, "description": "每页数量", "name": "pageSize", "in": "query" }, { "type": "string", "description": "任务类型", "name": "taskType", "in": "query" }, { "type": "string", "description": "任务状态", "name": "status", "in": "query" }, { "type": "string", "description": "节点ID", "name": "providerId", "in": "query" } ], "responses": { "200": { "description": "获取成功", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "object" } } } ] } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器内部错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/user/tasks/{taskId}/cancel": { "post": { "security": [ { "BearerAuth": [] } ], "description": "用户取消自己的等待中任务", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户管理" ], "summary": "取消用户任务", "parameters": [ { "type": "integer", "description": "任务ID", "name": "taskId", "in": "path", "required": true } ], "responses": { "200": { "description": "操作成功", "schema": { "$ref": "#/definitions/common.Response" } }, "400": { "description": "参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "用户未登录", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "操作失败", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/v1/admin/instances/{id}/ssh": { "get": { "description": "管理员通过WebSocket建立到任意实例的SSH连接", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "管理员/实例" ], "summary": "管理员WebSocket SSH连接", "parameters": [ { "type": "integer", "description": "实例ID", "name": "id", "in": "path", "required": true } ], "responses": { "101": { "description": "Switching Protocols", "schema": { "type": "string" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "未授权", "schema": { "$ref": "#/definitions/common.Response" } }, "404": { "description": "实例不存在", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/v1/admin/providers/{id}/agent-secret": { "post": { "description": "为 agent 连接模式的 Provider 生成新的鉴权密钥(仅首次),后续调用只返回已有密钥。密钥一旦创建即写死,需删除Provider重建才能刷新。", "produces": [ "application/json" ], "tags": [ "admin/providers" ], "summary": "生成或获取 Provider 的 Agent 密钥", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": {} } }, "/v1/admin/providers/{id}/exec": { "post": { "description": "通过 SSH(SSH模式)或 Agent WebSocket(Agent模式)在节点上执行 shell 命令", "produces": [ "application/json" ], "tags": [ "admin/providers" ], "summary": "在 Provider 节点上执行命令", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true }, { "description": "命令(JSON: {\\", "name": "command", "in": "body", "required": true, "schema": { "type": "string" } } ], "responses": {} } }, "/v1/admin/providers/{id}/stopped-containers": { "get": { "description": "通过SSH连接到LXD/Incus节点,返回所有Stopped状态的容器名称列表", "produces": [ "application/json" ], "tags": [ "admin/providers" ], "summary": "获取节点上已停止的容器列表(用于复制模式)", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": {} } }, "/v1/admin/providers/{provider_id}/traffic/history": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取指定Provider的历史流量数据,支持5分钟到24小时的灵活时间范围", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "流量管理-管理员" ], "summary": "获取Provider流量历史", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "provider_id", "in": "path", "required": true }, { "type": "string", "default": "1h", "description": "时间范围: 5m, 10m, 15m, 30m, 45m, 1h, 6h, 12h, 24h", "name": "period", "in": "query" }, { "type": "integer", "default": 0, "description": "数据点间隔(分钟),0表示自动选择", "name": "interval", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/monitoring.ProviderTrafficHistory" } } } } ] } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/v1/user/instances/{id}/exec": { "get": { "description": "通过WebSocket建立到容器的交互式终端连接(exec)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户/实例" ], "summary": "WebSocket Container Exec", "parameters": [ { "type": "integer", "description": "实例ID", "name": "id", "in": "path", "required": true } ], "responses": { "101": { "description": "Switching Protocols", "schema": { "type": "string" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "未授权", "schema": { "$ref": "#/definitions/common.Response" } }, "404": { "description": "实例不存在", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/v1/user/instances/{id}/ssh": { "get": { "description": "通过WebSocket建立到实例的SSH连接", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "用户/实例" ], "summary": "WebSocket SSH连接", "parameters": [ { "type": "integer", "description": "实例ID", "name": "id", "in": "path", "required": true } ], "responses": { "101": { "description": "Switching Protocols", "schema": { "type": "string" } }, "400": { "description": "请求参数错误", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "未授权", "schema": { "$ref": "#/definitions/common.Response" } }, "404": { "description": "实例不存在", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "服务器错误", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/v1/user/instances/{instance_id}/traffic/history": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取指定实例的历史流量数据,支持5分钟到24小时的灵活时间范围", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "流量管理" ], "summary": "获取实例流量历史", "parameters": [ { "type": "integer", "description": "实例ID", "name": "instance_id", "in": "path", "required": true }, { "type": "string", "default": "1h", "description": "时间范围: 5m, 10m, 15m, 30m, 45m, 1h, 6h, 12h, 24h", "name": "period", "in": "query" }, { "type": "integer", "default": 0, "description": "数据点间隔(分钟),0表示自动选择,可选: 5, 15, 30, 60", "name": "interval", "in": "query" }, { "type": "boolean", "default": false, "description": "是否包含已归档数据(重置前的历史记录)", "name": "includeArchived", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/monitoring.InstanceTrafficHistory" } } } } ] } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/v1/user/traffic/history": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前用户的历史流量数据,支持5分钟到24小时的灵活时间范围", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "流量管理" ], "summary": "获取用户流量历史", "parameters": [ { "type": "string", "default": "1h", "description": "时间范围: 5m, 10m, 15m, 30m, 45m, 1h, 6h, 12h, 24h", "name": "period", "in": "query" }, { "type": "integer", "default": 0, "description": "数据点间隔(分钟),0表示自动选择", "name": "interval", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "allOf": [ { "$ref": "#/definitions/common.Response" }, { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/monitoring.UserTrafficHistory" } } } } ] } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/common.Response" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/common.Response" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/common.Response" } } } } }, "/v1/ws/agent": { "get": { "description": "Rust Agent 通过此端点主动连回控制端,支持内网穿透模式", "tags": [ "agent" ], "summary": "Agent 反向 WebSocket 连接入口", "parameters": [ { "type": "string", "description": "Agent 鉴权密钥", "name": "secret", "in": "query", "required": true } ], "responses": {} } } }, "definitions": { "admin.AdminTaskDetailResponse": { "type": "object", "properties": { "canForceStop": { "type": "boolean" }, "cancelReason": { "description": "取消原因", "type": "string" }, "completedAt": { "type": "string" }, "createdAt": { "type": "string" }, "errorMessage": { "type": "string" }, "id": { "type": "integer" }, "instanceId": { "type": "integer" }, "instanceName": { "type": "string" }, "instanceType": { "type": "string" }, "isForceStoppable": { "type": "boolean" }, "preallocatedBandwidth": { "description": "预分配的带宽(Mbps)", "type": "integer" }, "preallocatedCpu": { "description": "预分配的实例配置信息", "type": "integer" }, "preallocatedDisk": { "description": "预分配的磁盘(MB)", "type": "integer" }, "preallocatedMemory": { "description": "预分配的内存(MB)", "type": "integer" }, "progress": { "type": "integer" }, "providerId": { "type": "integer" }, "providerName": { "type": "string" }, "remainingTime": { "description": "剩余时间(秒)", "type": "integer" }, "startedAt": { "type": "string" }, "status": { "type": "string" }, "statusMessage": { "type": "string" }, "taskData": { "description": "任务数据(JSON格式)", "type": "string" }, "taskType": { "type": "string" }, "timeoutDuration": { "type": "integer" }, "userId": { "type": "integer" }, "userName": { "type": "string" }, "uuid": { "type": "string" } } }, "admin.AdminTaskListResponse": { "type": "object", "properties": { "list": { "type": "array", "items": { "$ref": "#/definitions/admin.AdminTaskResponse" } }, "page": { "type": "integer" }, "pageSize": { "type": "integer" }, "total": { "type": "integer" } } }, "admin.AdminTaskResponse": { "type": "object", "properties": { "canForceStop": { "type": "boolean" }, "cancelReason": { "description": "取消原因", "type": "string" }, "completedAt": { "type": "string" }, "createdAt": { "type": "string" }, "errorMessage": { "type": "string" }, "id": { "type": "integer" }, "instanceId": { "type": "integer" }, "instanceName": { "type": "string" }, "instanceType": { "type": "string" }, "isForceStoppable": { "type": "boolean" }, "preallocatedBandwidth": { "description": "预分配的带宽(Mbps)", "type": "integer" }, "preallocatedCpu": { "description": "预分配的实例配置信息", "type": "integer" }, "preallocatedDisk": { "description": "预分配的磁盘(MB)", "type": "integer" }, "preallocatedMemory": { "description": "预分配的内存(MB)", "type": "integer" }, "progress": { "type": "integer" }, "providerId": { "type": "integer" }, "providerName": { "type": "string" }, "remainingTime": { "description": "剩余时间(秒)", "type": "integer" }, "startedAt": { "type": "string" }, "status": { "type": "string" }, "statusMessage": { "type": "string" }, "taskType": { "type": "string" }, "timeoutDuration": { "type": "integer" }, "userId": { "type": "integer" }, "userName": { "type": "string" }, "uuid": { "type": "string" } } }, "admin.AutoConfigureRequest": { "type": "object", "required": [ "providerId" ], "properties": { "force": { "description": "是否强制执行(即使有正在运行的任务)", "type": "boolean" }, "providerId": { "type": "integer" }, "showHistory": { "description": "是否显示历史记录", "type": "boolean" } } }, "admin.AutoConfigureResponse": { "type": "object", "properties": { "canProceed": { "type": "boolean" }, "historyTasks": { "description": "历史任务", "type": "array", "items": { "$ref": "#/definitions/admin.ConfigurationTaskResponse" } }, "message": { "type": "string" }, "runningTask": { "description": "当前运行的任务", "allOf": [ { "$ref": "#/definitions/admin.ConfigurationTaskResponse" } ] }, "status": { "type": "string" }, "streamUrl": { "description": "实时流URL", "type": "string" }, "taskId": { "type": "integer" } } }, "admin.BatchAnnouncementRequest": { "type": "object", "required": [ "ids" ], "properties": { "ids": { "type": "array", "items": { "type": "integer" } } } }, "admin.BatchCreateRedemptionCodesRequest": { "type": "object", "required": [ "count", "instanceType", "providerId" ], "properties": { "bandwidthId": { "type": "string" }, "count": { "type": "integer", "maximum": 100, "minimum": 1 }, "cpuId": { "type": "string" }, "creationMode": { "description": "复制模式(仅 LXD/Incus 节点)", "type": "string" }, "diskId": { "type": "string" }, "gpuDeviceIds": { "description": "GPU设备ID列表(逗号分隔),为空则附加所有GPU", "type": "string" }, "gpuEnabled": { "description": "GPU直通配置(仅 LXD/Incus 容器)", "type": "boolean" }, "imageId": { "type": "integer" }, "instanceType": { "type": "string", "enum": [ "container", "vm" ] }, "memoryId": { "type": "string" }, "providerId": { "type": "integer" }, "remark": { "type": "string" }, "sourceContainer": { "description": "复制模式下的源容器名称(仅 copy 模式)", "type": "string" } } }, "admin.BatchDeleteInviteCodesRequest": { "type": "object", "required": [ "ids" ], "properties": { "ids": { "type": "array", "minItems": 1, "items": { "type": "integer" } } } }, "admin.BatchDeletePortMappingRequest": { "type": "object", "required": [ "ids" ], "properties": { "ids": { "type": "array", "minItems": 1, "items": { "type": "integer" } } } }, "admin.BatchDeleteRedemptionCodesRequest": { "type": "object", "required": [ "ids" ], "properties": { "ids": { "type": "array", "minItems": 1, "items": { "type": "integer" } } } }, "admin.BatchDeleteUsersRequest": { "type": "object", "required": [ "userIds" ], "properties": { "userIds": { "type": "array", "items": { "type": "integer" } } } }, "admin.BatchUpdateStatusRequest": { "type": "object", "required": [ "ids" ], "properties": { "ids": { "type": "array", "items": { "type": "integer" } }, "status": { "type": "integer", "maximum": 1, "minimum": 0 } } }, "admin.BatchUpdateUserLevelRequest": { "type": "object", "required": [ "userIds" ], "properties": { "level": { "type": "integer", "maximum": 99, "minimum": 1 }, "userIds": { "type": "array", "items": { "type": "integer" } } } }, "admin.BatchUpdateUserStatusRequest": { "type": "object", "required": [ "userIds" ], "properties": { "status": { "type": "integer", "maximum": 1, "minimum": 0 }, "userIds": { "type": "array", "items": { "type": "integer" } } } }, "admin.CheckPortAvailabilityRequest": { "type": "object", "required": [ "hostPort", "protocol", "providerId" ], "properties": { "hostPort": { "description": "要检查的主机端口(起始端口)", "type": "integer", "maximum": 65535, "minimum": 1 }, "portCount": { "description": "端口数量(默认1,检查端口段时使用)", "type": "integer", "maximum": 1500, "minimum": 1 }, "protocol": { "description": "协议类型", "type": "string", "enum": [ "tcp", "udp", "both" ] }, "providerId": { "description": "Provider ID", "type": "integer" } } }, "admin.CheckPortAvailabilityResponse": { "type": "object", "properties": { "available": { "description": "是否所有端口都可用", "type": "boolean" }, "availablePorts": { "description": "可用的端口列表", "type": "array", "items": { "type": "integer" } }, "message": { "description": "检查结果描述", "type": "string" }, "portRange": { "description": "端口范围描述(如 \"10000-10009\")", "type": "string" }, "suggestion": { "description": "建议(如果有冲突,提供替代方案)", "type": "string" }, "unavailablePorts": { "description": "不可用的端口列表", "type": "array", "items": { "type": "integer" } } } }, "admin.ConfigurationTaskDetailResponse": { "type": "object", "properties": { "completedAt": { "type": "string" }, "createdAt": { "type": "string" }, "duration": { "description": "格式化的时长,如 \"2m30s\"", "type": "string" }, "errorMessage": { "type": "string" }, "executorId": { "type": "integer" }, "executorName": { "type": "string" }, "id": { "type": "integer" }, "logOutput": { "description": "完整日志", "type": "string" }, "logSummary": { "type": "string" }, "progress": { "type": "integer" }, "providerId": { "type": "integer" }, "providerName": { "type": "string" }, "providerType": { "type": "string" }, "resultData": { "description": "结果数据", "type": "object", "additionalProperties": true }, "startedAt": { "type": "string" }, "status": { "type": "string" }, "success": { "type": "boolean" }, "taskType": { "type": "string" }, "updatedAt": { "type": "string" } } }, "admin.ConfigurationTaskListResponse": { "type": "object", "properties": { "list": { "type": "array", "items": { "$ref": "#/definitions/admin.ConfigurationTaskResponse" } }, "total": { "type": "integer" } } }, "admin.ConfigurationTaskResponse": { "type": "object", "properties": { "completedAt": { "type": "string" }, "createdAt": { "type": "string" }, "duration": { "description": "格式化的时长,如 \"2m30s\"", "type": "string" }, "errorMessage": { "type": "string" }, "executorId": { "type": "integer" }, "executorName": { "type": "string" }, "id": { "type": "integer" }, "logSummary": { "type": "string" }, "progress": { "type": "integer" }, "providerId": { "type": "integer" }, "providerName": { "type": "string" }, "providerType": { "type": "string" }, "startedAt": { "type": "string" }, "status": { "type": "string" }, "success": { "type": "boolean" }, "taskType": { "type": "string" }, "updatedAt": { "type": "string" } } }, "admin.CreateAnnouncementRequest": { "type": "object", "required": [ "content", "title", "type" ], "properties": { "content": { "type": "string" }, "contentHtml": { "type": "string" }, "endTime": { "type": "string" }, "isSticky": { "type": "boolean" }, "priority": { "type": "integer" }, "startTime": { "type": "string" }, "title": { "type": "string" }, "type": { "description": "限制类型", "type": "string", "enum": [ "homepage", "topbar" ] } } }, "admin.CreateInviteCodeRequest": { "type": "object", "required": [ "count" ], "properties": { "code": { "description": "自定义邀请码,如果为空则自动生成", "type": "string" }, "count": { "type": "integer", "maximum": 100, "minimum": 1 }, "expiresAt": { "type": "string" }, "length": { "description": "邀请码长度,仅在自动生成时有效", "type": "integer" }, "maxUses": { "type": "integer" }, "remark": { "type": "string" } } }, "admin.CreatePortMappingRequest": { "type": "object", "required": [ "guestPort", "instanceId", "protocol" ], "properties": { "description": { "description": "端口用途描述", "type": "string" }, "guestPort": { "description": "起始端口", "type": "integer", "maximum": 65535, "minimum": 1 }, "hostPort": { "description": "可选,不指定则自动分配,指定时作为起始端口", "type": "integer" }, "instanceId": { "type": "integer" }, "internalHost": { "description": "控制端转发目标地址(容器IP)", "type": "string" }, "mappingType": { "description": "\"node\"(默认)或 \"controller\"(控制端转发)", "type": "string" }, "portCount": { "description": "端口数量,默认1(单端口),最多1500个", "type": "integer", "maximum": 1500, "minimum": 1 }, "protocol": { "description": "协议类型", "type": "string", "enum": [ "tcp", "udp", "both" ] } } }, "admin.CreateUserRequest": { "type": "object", "required": [ "password", "userType", "username" ], "properties": { "email": { "type": "string" }, "level": { "type": "integer" }, "nickname": { "type": "string" }, "password": { "type": "string" }, "phone": { "type": "string" }, "qq": { "type": "string" }, "roleId": { "type": "integer" }, "status": { "type": "integer" }, "telegram": { "type": "string" }, "totalQuota": { "type": "integer" }, "userType": { "type": "string" }, "username": { "type": "string" } } }, "admin.ExportRedemptionCodesRequest": { "type": "object", "properties": { "fields": { "description": "要导出的字段列表,为空则导出所有字段", "type": "array", "items": { "type": "string" } }, "ids": { "description": "为空则导出所有", "type": "array", "items": { "type": "integer" } }, "lang": { "description": "语言: zh-CN, en-US", "type": "string" } } }, "admin.ForceStopTaskRequest": { "type": "object", "required": [ "taskId" ], "properties": { "reason": { "description": "强制停止原因", "type": "string" }, "taskId": { "type": "integer" } } }, "admin.GetInstancePasswordResponse": { "type": "object", "properties": { "newPassword": { "type": "string" }, "resetTime": { "type": "integer" } } }, "admin.InstanceActionRequest": { "type": "object", "required": [ "action" ], "properties": { "action": { "type": "string" } } }, "admin.ProviderPortConfigRequest": { "type": "object", "properties": { "defaultPortCount": { "description": "每个实例默认映射端口数量", "type": "integer", "maximum": 1500, "minimum": 1 }, "networkType": { "description": "网络配置类型", "type": "string", "enum": [ "nat_ipv4", "nat_ipv4_ipv6", "dedicated_ipv4", "dedicated_ipv4_ipv6", "ipv6_only" ] }, "portRangeEnd": { "description": "端口映射范围结束", "type": "integer", "maximum": 65535, "minimum": 1024 }, "portRangeStart": { "description": "端口映射范围起始", "type": "integer", "maximum": 65535, "minimum": 1024 } } }, "admin.ResetInstancePasswordRequest": { "type": "object" }, "admin.ResetInstancePasswordResponse": { "type": "object", "properties": { "taskId": { "description": "异步任务ID", "type": "integer" } } }, "admin.ResetUserPasswordRequest": { "type": "object" }, "admin.ResetUserPasswordResponse": { "type": "object", "properties": { "newPassword": { "description": "生成的新密码", "type": "string" } } }, "admin.SyncPortMappingsTaskRequest": { "type": "object", "properties": { "providerIds": { "description": "指定要同步的Provider IDs(为空则同步所有)", "type": "array", "items": { "type": "integer" } } } }, "admin.TaskStatsResponse": { "type": "object", "properties": { "completedTasks": { "type": "integer" }, "failedTasks": { "type": "integer" }, "pendingTasks": { "type": "integer" }, "runningTasks": { "type": "integer" }, "timeoutTasks": { "type": "integer" }, "totalTasks": { "type": "integer" } } }, "admin.TrafficMonitorOperationRequest": { "type": "object", "required": [ "operation", "providerId" ], "properties": { "operation": { "description": "enable: 批量启用, disable: 批量删除, detect: 批量检测", "type": "string", "enum": [ "enable", "disable", "detect" ] }, "providerId": { "type": "integer" } } }, "admin.TrafficMonitorTask": { "type": "object", "properties": { "completedAt": { "description": "任务完成时间", "type": "string" }, "createdAt": { "type": "string" }, "errorMsg": { "description": "错误信息", "type": "string" }, "failedCount": { "description": "失败数量", "type": "integer" }, "id": { "type": "integer" }, "message": { "description": "当前状态消息", "type": "string" }, "output": { "description": "详细输出日志", "type": "string" }, "progress": { "description": "进度 0-100", "type": "integer" }, "providerId": { "description": "Provider ID", "type": "integer" }, "startedAt": { "description": "任务开始时间", "type": "string" }, "status": { "description": "状态: pending, running, completed, failed", "type": "string" }, "successCount": { "description": "成功数量", "type": "integer" }, "taskType": { "description": "任务类型: enable_all, disable_all, detect_all", "type": "string" }, "totalCount": { "description": "总实例数", "type": "integer" }, "updatedAt": { "type": "string" } } }, "admin.UpdateAnnouncementRequest": { "type": "object", "properties": { "content": { "type": "string" }, "contentHtml": { "type": "string" }, "endTime": { "type": "string" }, "id": { "type": "integer" }, "isSticky": { "type": "boolean" }, "priority": { "type": "integer" }, "startTime": { "type": "string" }, "status": { "type": "integer" }, "title": { "type": "string" }, "type": { "type": "string", "enum": [ "homepage", "topbar" ] } } }, "admin.UpdateInstanceTypePermissionsRequest": { "type": "object", "properties": { "minLevelForContainer": { "type": "integer", "maximum": 99, "minimum": 0 }, "minLevelForDeleteContainer": { "type": "integer", "maximum": 99, "minimum": 0 }, "minLevelForDeleteVM": { "type": "integer", "maximum": 99, "minimum": 0 }, "minLevelForResetContainer": { "type": "integer", "maximum": 99, "minimum": 0 }, "minLevelForResetVM": { "type": "integer", "maximum": 99, "minimum": 0 }, "minLevelForVM": { "type": "integer", "maximum": 99, "minimum": 0 } } }, "admin.UpdateUserLevelRequest": { "type": "object", "properties": { "level": { "type": "integer", "maximum": 99, "minimum": 1 } } }, "admin.UpdateUserStatusRequest": { "type": "object", "properties": { "status": { "type": "integer", "maximum": 1, "minimum": 0 } } }, "auth.ApiTokenCreateRequest": { "type": "object", "required": [ "name" ], "properties": { "expireDays": { "description": "过期天数(0=永久有效)", "type": "integer" }, "name": { "description": "Token名称", "type": "string" }, "scopes": { "description": "权限范围限制", "type": "array", "items": { "type": "string" } } } }, "auth.ApiTokenCreateResponse": { "type": "object", "properties": { "expiresAt": { "type": "string" }, "id": { "type": "integer" }, "name": { "type": "string" }, "token": { "description": "仅在创建时返回完整Token", "type": "string" }, "tokenPrefix": { "description": "Token前缀(用于列表显示)", "type": "string" } } }, "auth.ForgotPasswordRequest": { "type": "object", "required": [ "email" ], "properties": { "captcha": { "type": "string" }, "captchaId": { "type": "string" }, "email": { "type": "string", "example": "user@example.com" }, "userType": { "type": "string" } } }, "auth.LoginRequest": { "type": "object", "required": [ "password", "username" ], "properties": { "captcha": { "description": "图形验证码", "type": "string" }, "captchaId": { "description": "图形验证码ID", "type": "string" }, "loginType": { "description": "登录类型", "type": "string", "enum": [ "username", "email", "telegram", "qq" ] }, "password": { "description": "密码登录时必填", "type": "string", "example": "password" }, "target": { "description": "验证码登录时的目标", "type": "string" }, "userType": { "description": "用户类型", "type": "string", "enum": [ "admin", "user" ] }, "username": { "description": "用户名登录时必填", "type": "string", "example": "admin" }, "verifyCode": { "description": "验证码登录时的验证码", "type": "string" } } }, "auth.RegisterRequest": { "type": "object", "required": [ "password", "username" ], "properties": { "captcha": { "type": "string" }, "captchaId": { "type": "string" }, "email": { "type": "string", "example": "user@example.com" }, "inviteCode": { "type": "string", "example": "INVITE123" }, "nickname": { "type": "string", "example": "昵称" }, "password": { "type": "string", "example": "password123" }, "phone": { "type": "string", "example": "13800138000" }, "qq": { "type": "string" }, "registerType": { "description": "注册类型,前端兼容字段", "type": "string" }, "telegram": { "type": "string" }, "username": { "type": "string", "example": "user123" } } }, "auth.ResetPasswordRequest": { "type": "object", "required": [ "token" ], "properties": { "token": { "type": "string" } } }, "auth.SendVerifyCodeRequest": { "type": "object", "required": [ "target", "type" ], "properties": { "captcha": { "description": "图形验证码(可选,根据配置)", "type": "string" }, "captchaId": { "description": "图形验证码ID(可选,根据配置)", "type": "string" }, "target": { "description": "目标: 邮箱地址/TG用户名或ID/QQ号", "type": "string" }, "type": { "description": "验证码类型: email, telegram, qq", "type": "string" } } }, "common.Response": { "type": "object", "properties": { "code": { "type": "integer" }, "data": {}, "message": { "type": "string" }, "msg": { "type": "string" } } }, "config.UnifiedConfigRequest": { "type": "object", "required": [ "config", "scope" ], "properties": { "config": { "type": "object", "additionalProperties": true }, "scope": { "description": "public, user, admin", "type": "string" } } }, "log.LogFileInfo": { "type": "object", "properties": { "date": { "description": "日期字段,格式为 YYYY-MM-DD", "type": "string" }, "mod_time": { "type": "string" }, "name": { "type": "string" }, "path": { "type": "string" }, "size": { "type": "integer" } } }, "monitoring.InstanceTrafficHistory": { "type": "object", "properties": { "created_at": { "type": "string" }, "day": { "description": "日", "type": "integer" }, "hour": { "description": "小时(0-23),0表示日度汇总", "type": "integer" }, "id": { "type": "integer" }, "instance_id": { "description": "实例ID", "type": "integer" }, "month": { "description": "月", "type": "integer" }, "provider_id": { "description": "Provider ID", "type": "integer" }, "record_time": { "description": "记录时间", "type": "string" }, "total_used": { "description": "总流量", "type": "number" }, "traffic_in": { "description": "流量数据 (单位: MB)", "type": "number" }, "traffic_out": { "description": "出站流量", "type": "number" }, "updated_at": { "type": "string" }, "user_id": { "description": "用户ID", "type": "integer" }, "year": { "description": "时间维度\n添加唯一约束,防止重复聚合\nday=0, hour=0 表示月度汇总(用于快速查询缓存)", "type": "integer" } } }, "monitoring.PmacctSummary": { "type": "object", "properties": { "all_time": { "description": "总流量", "allOf": [ { "$ref": "#/definitions/monitoring.PmacctTrafficRecord" } ] }, "history": { "description": "历史记录", "type": "array", "items": { "$ref": "#/definitions/monitoring.PmacctTrafficRecord" } }, "instance_id": { "type": "integer" }, "mapped_ip": { "type": "string" }, "mapped_ipv6": { "type": "string" }, "this_month": { "description": "本月流量", "allOf": [ { "$ref": "#/definitions/monitoring.PmacctTrafficRecord" } ] }, "today": { "description": "今日流量", "allOf": [ { "$ref": "#/definitions/monitoring.PmacctTrafficRecord" } ] } } }, "monitoring.PmacctTrafficRecord": { "type": "object", "properties": { "created_at": { "type": "string" }, "day": { "description": "日期", "type": "integer" }, "hour": { "description": "小时", "type": "integer" }, "id": { "type": "integer" }, "instance_id": { "description": "实例ID", "type": "integer" }, "mapped_ip": { "description": "映射的公网IP地址", "type": "string" }, "minute": { "description": "分钟(0, 5, 10, ..., 55)", "type": "integer" }, "month": { "description": "月份", "type": "integer" }, "provider_id": { "description": "Provider ID", "type": "integer" }, "provider_type": { "description": "Provider类型", "type": "string" }, "record_time": { "description": "元数据", "type": "string" }, "rx_bytes": { "description": "流量统计数据 (单位: 字节)", "type": "integer" }, "timestamp": { "description": "时间维度(支持5分钟精度)\nyear和month添加到复合索引中,提升月度查询性能\n添加timestamp到复合索引以支持范围查询", "type": "string" }, "total_bytes": { "description": "总流量字节数", "type": "integer" }, "tx_bytes": { "description": "发送字节数(出站流量)", "type": "integer" }, "updated_at": { "type": "string" }, "user_id": { "description": "用户ID(冗余存储,避免JOIN)", "type": "integer" }, "year": { "description": "年份", "type": "integer" } } }, "monitoring.ProviderTrafficHistory": { "type": "object", "properties": { "created_at": { "type": "string" }, "day": { "description": "日", "type": "integer" }, "hour": { "description": "小时(0-23),0表示日度汇总", "type": "integer" }, "id": { "type": "integer" }, "instance_count": { "description": "实例统计", "type": "integer" }, "month": { "description": "月", "type": "integer" }, "provider_id": { "description": "Provider ID", "type": "integer" }, "record_time": { "description": "记录时间", "type": "string" }, "total_used": { "description": "总流量", "type": "number" }, "traffic_in": { "description": "流量数据 (单位: MB)", "type": "number" }, "traffic_out": { "description": "出站流量", "type": "number" }, "updated_at": { "type": "string" }, "year": { "description": "时间维度", "type": "integer" } } }, "monitoring.UserTrafficHistory": { "type": "object", "properties": { "created_at": { "type": "string" }, "day": { "description": "日", "type": "integer" }, "hour": { "description": "小时(0-23),0表示日度汇总", "type": "integer" }, "id": { "type": "integer" }, "instance_count": { "description": "实例统计", "type": "integer" }, "month": { "description": "月", "type": "integer" }, "record_time": { "description": "记录时间", "type": "string" }, "total_used": { "description": "总流量", "type": "number" }, "traffic_in": { "description": "流量数据 (单位: MB)", "type": "number" }, "traffic_out": { "description": "出站流量", "type": "number" }, "updated_at": { "type": "string" }, "user_id": { "description": "用户ID", "type": "integer" }, "year": { "description": "时间维度", "type": "integer" } } }, "oauth2.CreateProviderRequest": { "type": "object", "required": [ "authUrl", "clientId", "clientSecret", "displayName", "name", "providerType", "redirectUrl", "tokenUrl", "userInfoUrl" ], "properties": { "authUrl": { "type": "string" }, "avatarField": { "type": "string" }, "clientId": { "type": "string" }, "clientSecret": { "type": "string" }, "defaultLevel": { "type": "integer" }, "displayName": { "type": "string" }, "emailField": { "type": "string" }, "enabled": { "type": "boolean" }, "levelMapping": { "type": "object", "additionalProperties": { "type": "integer" } }, "maxRegistrations": { "type": "integer" }, "name": { "type": "string" }, "nicknameField": { "type": "string" }, "providerType": { "description": "preset 或 generic", "type": "string", "enum": [ "preset", "generic" ] }, "redirectUrl": { "type": "string" }, "sort": { "type": "integer" }, "tokenUrl": { "type": "string" }, "trustLevelField": { "type": "string" }, "userIdField": { "type": "string" }, "userInfoUrl": { "type": "string" }, "usernameField": { "type": "string" } } }, "oauth2.OAuth2Provider": { "type": "object", "properties": { "authUrl": { "description": "OAuth2授权地址", "type": "string" }, "avatarField": { "description": "头像字段映射", "type": "string" }, "clientId": { "description": "OAuth2配置", "type": "string" }, "clientSecret": { "description": "OAuth2客户端密钥", "type": "string" }, "createdAt": { "type": "string" }, "currentRegistrations": { "description": "当前注册数量", "type": "integer" }, "defaultLevel": { "description": "默认等级(当没有等级映射或无法提取等级时使用)", "type": "integer" }, "displayName": { "description": "显示名称", "type": "string" }, "emailField": { "description": "邮箱字段映射", "type": "string" }, "enabled": { "description": "是否启用", "type": "boolean" }, "id": { "type": "integer" }, "levelMapping": { "description": "等级映射(JSON字符串,如 {\"0\":1,\"1\":2,\"2\":3})\n映射外部信任等级到系统用户等级", "type": "string" }, "maxRegistrations": { "description": "注册限制", "type": "integer" }, "name": { "description": "基础信息", "type": "string" }, "nicknameField": { "description": "可选字段映射", "type": "string" }, "providerType": { "description": "提供商类型(preset:预设, generic:通用)", "type": "string" }, "redirectUrl": { "description": "OAuth2回调地址", "type": "string" }, "sort": { "description": "显示顺序", "type": "integer" }, "tokenUrl": { "description": "OAuth2令牌地址", "type": "string" }, "totalUsers": { "description": "统计信息", "type": "integer" }, "trustLevelField": { "description": "信任等级字段映射(可选,如LinuxDo的trust_level)", "type": "string" }, "updatedAt": { "type": "string" }, "userIdField": { "description": "字段映射(支持嵌套字段,如 user.profile.name)", "type": "string" }, "userInfoUrl": { "description": "OAuth2用户信息地址", "type": "string" }, "usernameField": { "description": "用户名字段映射", "type": "string" } } }, "oauth2.PresetConfig": { "type": "object", "properties": { "authURL": { "type": "string" }, "avatarField": { "type": "string" }, "defaultLevel": { "type": "integer" }, "displayName": { "type": "string" }, "emailField": { "type": "string" }, "levelMapping": { "type": "object", "additionalProperties": { "type": "integer" } }, "name": { "type": "string" }, "nicknameField": { "type": "string" }, "providerType": { "type": "string" }, "scopes": { "type": "array", "items": { "type": "string" } }, "tokenURL": { "type": "string" }, "trustLevelField": { "type": "string" }, "userIDField": { "type": "string" }, "userInfoURL": { "type": "string" }, "usernameField": { "type": "string" } } }, "oauth2.UpdateProviderRequest": { "type": "object", "properties": { "authUrl": { "type": "string" }, "avatarField": { "type": "string" }, "clientId": { "type": "string" }, "clientSecret": { "type": "string" }, "defaultLevel": { "type": "integer" }, "displayName": { "type": "string" }, "emailField": { "type": "string" }, "enabled": { "type": "boolean" }, "levelMapping": { "type": "object", "additionalProperties": { "type": "integer" } }, "maxRegistrations": { "type": "integer" }, "name": { "type": "string" }, "nicknameField": { "type": "string" }, "providerType": { "type": "string", "enum": [ "preset", "generic" ] }, "redirectUrl": { "type": "string" }, "sort": { "type": "integer" }, "tokenUrl": { "type": "string" }, "trustLevelField": { "type": "string" }, "userIdField": { "type": "string" }, "userInfoUrl": { "type": "string" }, "usernameField": { "type": "string" } } }, "oneclickvirt_model_provider.Instance": { "type": "object", "properties": { "bandwidth": { "description": "网络带宽(Mbps)", "type": "integer" }, "cpu": { "description": "资源配置", "type": "integer" }, "createdAt": { "description": "实例创建时间", "type": "string" }, "discoveredData": { "description": "发现时的原始数据(JSON格式,用于调试和审计)", "type": "string" }, "disk": { "description": "磁盘大小(MB)", "type": "integer" }, "expiresAt": { "description": "生命周期和冻结管理", "type": "string" }, "frozenAt": { "description": "冻结时间", "type": "string" }, "frozenReason": { "description": "冻结原因:expired(到期), node_frozen(节点冻结), manual(手动冻结)", "type": "string" }, "gpuDeviceIds": { "description": "GPU设备ID列表(逗号分隔)", "type": "string" }, "gpuEnabled": { "description": "GPU/NPU直通配置(从兑换码/导入时继承,用于展示和运维参考)", "type": "boolean" }, "hasPortConflict": { "description": "是否存在端口冲突", "type": "boolean" }, "id": { "description": "基础字段", "type": "integer" }, "image": { "description": "使用的镜像名称", "type": "string" }, "importedAt": { "description": "导入时间", "type": "string" }, "instance_type": { "description": "实例类型:container, vm", "type": "string" }, "ipv6Address": { "description": "内网IPv6地址", "type": "string" }, "isFrozen": { "description": "是否被冻结(冻结后无法操作,除了删除)", "type": "boolean" }, "isImported": { "description": "实例导入相关字段", "type": "boolean" }, "isManualExpiry": { "description": "是否手动设置了过期时间(手动设置的优先级高于节点)", "type": "boolean" }, "maxTraffic": { "description": "流量统计(实例层面)", "type": "integer" }, "memory": { "description": "内存大小(MB)", "type": "integer" }, "name": { "description": "基本信息\n添加覆盖索引,包含常用查询字段", "type": "string" }, "network": { "description": "网络配置", "type": "string" }, "networkType": { "description": "创建时继承的网络类型(用于reset时恢复IPv6配置)", "type": "string" }, "npuDeviceIds": { "description": "NPU设备ID列表(逗号分隔)", "type": "string" }, "npuEnabled": { "description": "是否启用NPU直通", "type": "boolean" }, "osType": { "description": "系统信息", "type": "string" }, "password": { "description": "登录密码", "type": "string" }, "pmacctInterfaceV4": { "description": "pmacct 监控的IPv4网络接口名称", "type": "string" }, "pmacctInterfaceV6": { "description": "pmacct 监控的IPv6网络接口名称", "type": "string" }, "portConflictDetail": { "description": "端口冲突详情(JSON格式记录冲突端口信息)", "type": "string" }, "portRangeEnd": { "description": "端口映射范围结束", "type": "integer" }, "portRangeStart": { "description": "端口映射范围起始", "type": "integer" }, "privateIP": { "description": "内网/私有IPv4地址", "type": "string" }, "provider": { "description": "Provider名称", "type": "string" }, "providerId": { "description": "关联的Provider ID(与name组合唯一)", "type": "integer" }, "providerVmId": { "description": "虚拟化平台的实例ID(Proxmox VMID/CTID等),用于接口检测", "type": "string" }, "publicIP": { "description": "公网IPv4地址", "type": "string" }, "publicIPv6": { "description": "公网IPv6地址", "type": "string" }, "region": { "description": "所在地区", "type": "string" }, "sshPort": { "description": "SSH访问端口", "type": "integer" }, "status": { "description": "实例状态:creating, running, stopped, failed等", "type": "string" }, "trafficLimitReason": { "description": "流量限制原因:instance(实例超限), user(用户超限), provider(Provider超限)", "type": "string" }, "trafficLimited": { "description": "是否因流量超限被停机", "type": "boolean" }, "updatedAt": { "description": "实例信息更新时间", "type": "string" }, "userId": { "description": "关联关系\n添加UserID索引以支持按用户查询", "type": "integer" }, "username": { "description": "访问凭据", "type": "string" }, "uuid": { "description": "实例唯一标识符", "type": "string" } } }, "oneclickvirt_service_provider.ConnectProviderRequest": { "type": "object", "required": [ "host", "name", "password", "type", "username" ], "properties": { "cert_path": { "type": "string" }, "containerLimitCpu": { "description": "容器资源限制配置(Provider层面)", "type": "boolean" }, "containerLimitDisk": { "description": "容器是否限制硬盘大小", "type": "boolean" }, "containerLimitMemory": { "description": "容器是否限制内存大小", "type": "boolean" }, "container_enabled": { "type": "boolean" }, "host": { "type": "string" }, "key_path": { "type": "string" }, "levelLimits": { "description": "节点级别的等级限制配置\n用于限制该节点上不同等级用户能创建的最大资源", "type": "object", "additionalProperties": { "type": "object", "additionalProperties": true } }, "name": { "type": "string" }, "networkType": { "description": "网络配置类型", "type": "string" }, "password": { "type": "string" }, "port": { "description": "兼容旧的port字段", "type": "integer" }, "sshKey": { "description": "SSH私钥内容,优先于密码使用", "type": "string" }, "sshPort": { "description": "新的sshPort字段", "type": "integer" }, "token": { "description": "API Token,用于ProxmoxVE等", "type": "string" }, "type": { "type": "string" }, "username": { "type": "string" }, "vmLimitCpu": { "description": "虚拟机资源限制配置(Provider层面)", "type": "boolean" }, "vmLimitDisk": { "description": "虚拟机是否限制硬盘大小", "type": "boolean" }, "vmLimitMemory": { "description": "虚拟机是否限制内存大小", "type": "boolean" }, "vm_enabled": { "type": "boolean" } } }, "oneclickvirt_service_provider.CreateInstanceRequest": { "type": "object", "properties": { "allowNesting": { "description": "容器嵌套", "type": "boolean" }, "copyMode": { "description": "复制模式(仅 LXD/Incus)", "type": "boolean" }, "copySourceName": { "description": "复制模式下的源容器名称", "type": "string" }, "cpu": { "type": "string" }, "cpuAllowance": { "description": "CPU限制", "type": "string" }, "disk": { "type": "string" }, "diskIoLimit": { "description": "磁盘IO限制", "type": "string" }, "enableLxcfs": { "description": "LXCFS资源视图", "type": "boolean" }, "env": { "type": "object", "additionalProperties": { "type": "string" } }, "gpuDeviceIds": { "description": "GPU设备ID列表(逗号分隔),为空则附加所有GPU", "type": "string" }, "gpuEnabled": { "description": "GPU直通配置(仅 LXD/Incus)", "type": "boolean" }, "image": { "type": "string" }, "image_path": { "description": "镜像文件路径", "type": "string" }, "image_url": { "description": "镜像下载URL", "type": "string" }, "instance_type": { "description": "container 或 vm", "type": "string" }, "maxProcesses": { "description": "最大进程数", "type": "integer" }, "memory": { "type": "string" }, "memorySwap": { "description": "内存交换", "type": "boolean" }, "metadata": { "type": "object", "additionalProperties": { "type": "string" } }, "name": { "type": "string" }, "network": { "type": "string" }, "ports": { "type": "array", "items": { "type": "string" } }, "privileged": { "description": "容器特殊配置选项(仅适用于 LXD 和 Incus 的容器实例)", "type": "boolean" }, "systemImageId": { "description": "系统镜像ID", "type": "integer" }, "use_cdn": { "description": "是否使用CDN加速下载镜像", "type": "boolean" } } }, "provider.DiscoveredAccelerator": { "type": "object", "properties": { "bus": { "description": "总线地址(可选)", "type": "string" }, "id": { "description": "设备ID(如索引或PCI地址)", "type": "string" }, "kind": { "description": "gpu / npu", "type": "string" }, "name": { "description": "设备名称", "type": "string" }, "source": { "description": "来源:devices/lspci/nvidia-smi/npu-smi", "type": "string" }, "vendor": { "description": "厂商", "type": "string" } } }, "provider.DiscoveredInstance": { "type": "object", "properties": { "accelerators": { "type": "array", "items": { "$ref": "#/definitions/provider.DiscoveredAccelerator" } }, "cpu": { "description": "资源配置", "type": "integer" }, "disk": { "description": "磁盘大小(MB)", "type": "integer" }, "extraPorts": { "description": "其他开放端口(向后兼容)", "type": "array", "items": { "type": "integer" } }, "gpuDeviceIds": { "type": "string" }, "gpuEnabled": { "description": "硬件加速配置(主要用于 LXD/Incus 导入场景)", "type": "boolean" }, "image": { "description": "系统信息", "type": "string" }, "instanceType": { "description": "实例类型(container或vm)", "type": "string" }, "ipv6Address": { "description": "IPv6地址", "type": "string" }, "macAddress": { "description": "MAC地址", "type": "string" }, "memory": { "description": "内存大小(MB)", "type": "integer" }, "name": { "description": "实例名称", "type": "string" }, "npuDeviceIds": { "type": "string" }, "npuEnabled": { "type": "boolean" }, "osType": { "description": "操作系统类型", "type": "string" }, "portMappings": { "description": "完整的端口映射信息", "type": "array", "items": { "$ref": "#/definitions/provider.DiscoveredPortMapping" } }, "privateIP": { "description": "网络配置", "type": "string" }, "publicIP": { "description": "公网IPv4地址", "type": "string" }, "rawData": { "description": "原始数据(用于调试)" }, "sshPort": { "description": "SSH端口", "type": "integer" }, "status": { "description": "实例状态(running, stopped等)", "type": "string" }, "uuid": { "description": "基本标识", "type": "string" } } }, "provider.DiscoveredPortMapping": { "type": "object", "properties": { "guestPort": { "description": "容器/虚拟机内部端口", "type": "integer" }, "hostPort": { "description": "宿主机端口", "type": "integer" }, "isSsh": { "description": "是否为SSH端口", "type": "boolean" }, "protocol": { "description": "tcp, udp, both", "type": "string" } } }, "provider.DiscoveryResult": { "type": "object", "properties": { "alreadyManaged": { "description": "已纳管的实例数", "type": "integer" }, "discoveredAt": { "type": "string" }, "discoveredInstances": { "type": "array", "items": { "$ref": "#/definitions/provider.DiscoveredInstance" } }, "error": { "type": "string" }, "newInstances": { "description": "新发现的实例数", "type": "integer" }, "providerId": { "type": "integer" }, "providerName": { "type": "string" }, "totalCount": { "type": "integer" } } }, "provider.ImportOptions": { "type": "object", "properties": { "adminUserId": { "description": "管理员用户ID,导入的实例将分配给该用户", "type": "integer" }, "autoAdjustQuota": { "description": "是否自动调整quota", "type": "boolean" }, "instanceUuids": { "description": "要导入的实例UUID列表,为空表示全部导入", "type": "array", "items": { "type": "string" } }, "markConflicts": { "description": "是否标记端口冲突", "type": "boolean" }, "providerId": { "description": "Provider ID", "type": "integer" } } }, "provider.ImportResult": { "type": "object", "properties": { "errors": { "description": "错误列表", "type": "array", "items": { "type": "string" } }, "failedCount": { "description": "失败数", "type": "integer" }, "importedAt": { "type": "string" }, "importedDetails": { "description": "导入详情", "type": "array", "items": { "$ref": "#/definitions/provider.ImportedInstanceInfo" } }, "portConflicts": { "description": "端口冲突数", "type": "integer" }, "providerId": { "type": "integer" }, "providerName": { "type": "string" }, "quotaAdjusted": { "description": "是否调整了quota", "type": "boolean" }, "skippedCount": { "description": "跳过数(已存在)", "type": "integer" }, "successCount": { "description": "成功导入数", "type": "integer" }, "totalAttempted": { "description": "尝试导入的实例数", "type": "integer" } } }, "provider.ImportedInstanceInfo": { "type": "object", "properties": { "conflictDetail": { "type": "string" }, "error": { "type": "string" }, "hasPortConflict": { "type": "boolean" }, "instanceId": { "type": "integer" }, "name": { "type": "string" }, "status": { "description": "success, skipped, failed", "type": "string" }, "uuid": { "type": "string" } } }, "provider.InstanceChange": { "type": "object", "properties": { "instanceId": { "type": "integer" }, "name": { "type": "string" }, "newStatus": { "type": "string" }, "oldStatus": { "type": "string" }, "uuid": { "type": "string" } } }, "provider.InstanceSyncReport": { "type": "object", "properties": { "changedInstances": { "description": "状态变化实例", "type": "array", "items": { "$ref": "#/definitions/provider.InstanceChange" } }, "checkedAt": { "type": "string" }, "deletedInstances": { "description": "已删除实例", "type": "array", "items": { "$ref": "#/definitions/oneclickvirt_model_provider.Instance" } }, "newInstances": { "description": "新增实例", "type": "array", "items": { "$ref": "#/definitions/provider.DiscoveredInstance" } }, "providerId": { "type": "integer" }, "providerName": { "type": "string" }, "totalDB": { "description": "数据库总实例数", "type": "integer" }, "totalRemote": { "description": "远程总实例数", "type": "integer" } } }, "resource.ResourceReservation": { "type": "object", "properties": { "bandwidth": { "description": "预留的带宽(Mbps)", "type": "integer" }, "cpu": { "description": "预留的CPU核心数", "type": "integer" }, "createdAt": { "type": "string" }, "disk": { "description": "预留的磁盘(MB)", "type": "integer" }, "expiresAt": { "description": "TTL管理", "type": "string" }, "id": { "type": "integer" }, "instanceType": { "description": "实例规格", "type": "string" }, "memory": { "description": "预留的内存(MB)", "type": "integer" }, "providerId": { "description": "Provider ID", "type": "integer" }, "sessionId": { "description": "会话标识,唯一主键", "type": "string" }, "updatedAt": { "type": "string" }, "userId": { "description": "核心标识字段", "type": "integer" }, "uuid": { "type": "string" } } }, "system.CPUStats": { "type": "object", "properties": { "cores": { "description": "CPU核心数", "type": "integer" }, "load_avg_1": { "description": "1分钟负载平均值", "type": "number" }, "load_avg_15": { "description": "15分钟负载平均值", "type": "number" }, "load_avg_5": { "description": "5分钟负载平均值", "type": "number" }, "usage": { "description": "CPU使用率", "type": "number" } } }, "system.CreateSystemImageRequest": { "type": "object", "required": [ "architecture", "instanceType", "minDiskMB", "minMemoryMB", "name", "providerType", "url" ], "properties": { "architecture": { "type": "string", "enum": [ "amd64", "arm64", "s390x" ] }, "checksum": { "type": "string" }, "description": { "type": "string" }, "instanceType": { "type": "string", "enum": [ "vm", "container" ] }, "minDiskMB": { "type": "integer", "minimum": 1 }, "minMemoryMB": { "type": "integer", "minimum": 1 }, "name": { "type": "string" }, "osType": { "type": "string" }, "osVersion": { "type": "string" }, "providerType": { "type": "string", "enum": [ "proxmox", "lxd", "incus", "docker", "qemu", "kubevirt" ] }, "size": { "type": "integer" }, "tags": { "type": "string" }, "url": { "type": "string" }, "useCdn": { "type": "boolean" } } }, "system.DatabaseStats": { "type": "object", "properties": { "connections": { "description": "当前连接数", "type": "integer" }, "max_connections": { "description": "最大连接数", "type": "integer" }, "queries_total": { "description": "总查询数", "type": "integer" }, "slow_queries": { "description": "慢查询数", "type": "integer" }, "uptime": { "description": "运行时间", "type": "string" } } }, "system.DiskStats": { "type": "object", "properties": { "free": { "description": "磁盘空闲", "type": "integer" }, "total": { "description": "磁盘总大小", "type": "integer" }, "usage": { "description": "磁盘使用率", "type": "number" }, "used": { "description": "磁盘已使用", "type": "integer" } } }, "system.MemoryStats": { "type": "object", "properties": { "free": { "description": "空闲内存", "type": "integer" }, "swap_total": { "description": "交换分区总大小", "type": "integer" }, "swap_used": { "description": "交换分区已使用", "type": "integer" }, "total": { "description": "总内存", "type": "integer" }, "usage": { "description": "内存使用率", "type": "number" }, "used": { "description": "已使用内存", "type": "integer" } } }, "system.NetworkStats": { "type": "object", "properties": { "bytes_received": { "description": "接收字节数", "type": "integer" }, "bytes_sent": { "description": "发送字节数", "type": "integer" }, "packets_recv": { "description": "接收包数", "type": "integer" }, "packets_sent": { "description": "发送包数", "type": "integer" } } }, "system.RuntimeStats": { "type": "object", "properties": { "gc_cycles": { "description": "GC循环次数", "type": "integer" }, "goroutines": { "description": "协程数量", "type": "integer" }, "heap_alloc": { "description": "堆内存分配", "type": "integer" }, "heap_idle": { "description": "堆内存空闲", "type": "integer" }, "heap_inuse": { "description": "堆内存使用中", "type": "integer" }, "heap_sys": { "description": "堆内存系统", "type": "integer" }, "last_gc": { "description": "最后GC时间", "type": "string" }, "uptime": { "description": "运行时间", "type": "string" } } }, "system.SystemStats": { "type": "object", "properties": { "cpu": { "$ref": "#/definitions/system.CPUStats" }, "database": { "$ref": "#/definitions/system.DatabaseStats" }, "disk": { "$ref": "#/definitions/system.DiskStats" }, "memory": { "$ref": "#/definitions/system.MemoryStats" }, "network": { "$ref": "#/definitions/system.NetworkStats" }, "runtime": { "$ref": "#/definitions/system.RuntimeStats" }, "timestamp": { "type": "string" } } }, "traffic.BatchManageTrafficLimitRequest": { "type": "object", "required": [ "action", "user_ids" ], "properties": { "action": { "description": "\"limit\" 或 \"unlimit\"", "type": "string" }, "reason": { "description": "限制原因(仅在action为limit时需要)", "type": "string" }, "user_ids": { "type": "array", "items": { "type": "integer" } } } }, "traffic.BatchSyncTrafficRequest": { "type": "object", "required": [ "user_ids" ], "properties": { "user_ids": { "type": "array", "items": { "type": "integer" } } } }, "traffic.ManageTrafficLimitRequest": { "type": "object", "required": [ "action", "target_id", "type" ], "properties": { "action": { "description": "\"limit\" 或 \"unlimit\"", "type": "string" }, "reason": { "description": "限制原因(仅在action为limit时需要)", "type": "string" }, "target_id": { "description": "目标用户ID或Provider ID", "type": "integer" }, "type": { "description": "\"user\" 或 \"provider\"", "type": "string" } } }, "user.AvailableProviderResponse": { "type": "object", "properties": { "availableContainerSlots": { "description": "可用容器槽位数,-1表示不限制", "type": "integer" }, "availableVMSlots": { "description": "可用虚拟机槽位数,-1表示不限制", "type": "integer" }, "city": { "type": "string" }, "containerEnabled": { "type": "boolean" }, "country": { "type": "string" }, "countryCode": { "type": "string" }, "cpu": { "type": "integer" }, "cpuUsage": { "type": "number" }, "disk": { "description": "总硬盘空间(MB)", "type": "integer" }, "groupDescription": { "description": "分组描述(HTML)", "type": "string" }, "groupName": { "description": "分组名称", "type": "string" }, "id": { "type": "integer" }, "maxContainerInstances": { "description": "最大容器数量,0表示不限制", "type": "integer" }, "maxVMInstances": { "description": "最大虚拟机数量,0表示不限制", "type": "integer" }, "memory": { "description": "总内存(MB)", "type": "integer" }, "memoryUsage": { "type": "number" }, "name": { "type": "string" }, "redeemCodeOnly": { "description": "是否仅支持兑换码兑换", "type": "boolean" }, "region": { "type": "string" }, "status": { "type": "string" }, "type": { "type": "string" }, "vmEnabled": { "type": "boolean" } } }, "user.BandwidthSpecResponse": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "speedMbps": { "type": "integer" } } }, "user.CPUSpecResponse": { "type": "object", "properties": { "cores": { "type": "integer" }, "id": { "type": "string" }, "name": { "type": "string" } } }, "user.ChangePasswordRequest": { "type": "object", "required": [ "newPassword", "oldPassword" ], "properties": { "newPassword": { "type": "string" }, "oldPassword": { "type": "string" } } }, "user.ClaimResourceRequest": { "type": "object", "required": [ "image", "instanceType", "name", "providerId" ], "properties": { "cpu": { "type": "integer" }, "disk": { "type": "integer" }, "image": { "type": "string" }, "instanceType": { "type": "string" }, "memory": { "type": "integer" }, "name": { "type": "string" }, "providerId": { "type": "integer" } } }, "user.CreateInstanceRequest": { "type": "object", "required": [ "bandwidthId", "cpuId", "diskId", "imageId", "memoryId", "providerId" ], "properties": { "bandwidthId": { "description": "带宽规格ID", "type": "string" }, "cpuId": { "description": "CPU规格ID", "type": "string" }, "description": { "description": "描述信息", "type": "string" }, "diskId": { "description": "磁盘规格ID", "type": "string" }, "gpuDeviceIds": { "description": "GPU设备ID列表(逗号分隔),为空则附加所有GPU", "type": "string" }, "gpuEnabled": { "description": "GPU直通配置(仅 LXD/Incus 容器实例支持)", "type": "boolean" }, "imageId": { "description": "镜像ID(从数据库获取)", "type": "integer" }, "memoryId": { "description": "内存规格ID", "type": "string" }, "providerId": { "description": "节点ID", "type": "integer" } } }, "user.DiskSpecResponse": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "sizeMB": { "type": "integer" } } }, "user.GetInstancePasswordResponse": { "type": "object", "properties": { "newPassword": { "type": "string" }, "resetTime": { "type": "integer" } } }, "user.InstanceActionRequest": { "type": "object", "required": [ "action", "instanceId" ], "properties": { "action": { "type": "string" }, "image": { "type": "string" }, "instanceId": { "type": "integer" } } }, "user.InstanceConfigResponse": { "type": "object", "properties": { "bandwidthSpecs": { "description": "可用带宽规格列表", "type": "array", "items": { "$ref": "#/definitions/user.BandwidthSpecResponse" } }, "cpuSpecs": { "description": "可用CPU规格列表", "type": "array", "items": { "$ref": "#/definitions/user.CPUSpecResponse" } }, "diskSpecs": { "description": "可用磁盘规格列表", "type": "array", "items": { "$ref": "#/definitions/user.DiskSpecResponse" } }, "images": { "description": "可用镜像列表(从数据库获取)", "type": "array", "items": { "$ref": "#/definitions/user.SystemImageResponse" } }, "memorySpecs": { "description": "可用内存规格列表", "type": "array", "items": { "$ref": "#/definitions/user.MemorySpecResponse" } } } }, "user.InstanceMonitoringResponse": { "type": "object", "properties": { "trafficData": { "description": "CPUUsage float64 `json:\"cpuUsage\"` // 已移除:硬件资源使用率监控\nMemoryUsage float64 `json:\"memoryUsage\"` // 已移除:硬件资源使用率监控\nDiskUsage float64 `json:\"diskUsage\"` // 已移除:硬件资源使用率监控", "allOf": [ { "$ref": "#/definitions/user.TrafficData" } ] } } }, "user.MemorySpecResponse": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "sizeMB": { "type": "integer" } } }, "user.ResetInstancePasswordRequest": { "type": "object" }, "user.ResetInstancePasswordResponse": { "type": "object", "properties": { "taskId": { "type": "integer" } } }, "user.ResetPasswordRequest": { "type": "object" }, "user.SystemImageResponse": { "type": "object", "properties": { "architecture": { "type": "string" }, "description": { "type": "string" }, "displayName": { "type": "string" }, "id": { "type": "integer" }, "imageUrl": { "type": "string" }, "instanceType": { "type": "string" }, "isActive": { "type": "boolean" }, "minDiskMB": { "type": "integer" }, "minMemoryMB": { "type": "integer" }, "name": { "type": "string" }, "osType": { "type": "string" }, "providerType": { "type": "string" }, "useCdn": { "type": "boolean" }, "version": { "type": "string" } } }, "user.TrafficData": { "type": "object", "properties": { "currentMonth": { "description": "当月已使用流量(MB)", "type": "integer" }, "history": { "description": "历史流量数据", "type": "array", "items": { "$ref": "#/definitions/user.TrafficHistoryItem" } }, "isLimited": { "description": "是否因流量超限被限制", "type": "boolean" }, "limitReason": { "description": "流量限制原因描述", "type": "string" }, "limitType": { "description": "流量限制类型: user, provider, both, unknown", "type": "string" }, "totalLimit": { "description": "流量限制(MB)", "type": "integer" }, "usagePercent": { "description": "使用百分比", "type": "number" } } }, "user.TrafficHistoryItem": { "type": "object", "properties": { "lastSync": { "description": "最后同步时间", "type": "string" }, "month": { "description": "月份", "type": "integer" }, "totalUsed": { "description": "总使用流量(MB)", "type": "integer" }, "trafficIn": { "description": "入站流量(MB)", "type": "integer" }, "trafficOut": { "description": "出站流量(MB)", "type": "integer" }, "year": { "description": "年份", "type": "integer" } } }, "user.UpdateProfileRequest": { "type": "object", "properties": { "email": { "type": "string" }, "nickname": { "type": "string", "maxLength": 50 }, "phone": { "type": "string" }, "telegram": { "type": "string" } } }, "user.UserInstanceDetailResponse": { "type": "object", "properties": { "bandwidth": { "type": "integer" }, "cpu": { "type": "integer" }, "createdAt": { "type": "string" }, "disk": { "type": "integer" }, "expiresAt": { "description": "实例过期时间", "type": "string" }, "hasSshMapping": { "description": "是否有可用的SSH端口映射(支持Web SSH连接)", "type": "boolean" }, "id": { "type": "integer" }, "image": { "description": "当前使用的镜像名称", "type": "string" }, "instance_type": { "description": "实例类型:container, vm", "type": "string" }, "ipv4MappingType": { "description": "IPv4映射类型:nat(NAT共享IP), dedicated(独立IPv4地址) (已弃用,保留向后兼容)", "type": "string" }, "ipv6Address": { "description": "内网IPv6地址", "type": "string" }, "memory": { "type": "integer" }, "name": { "type": "string" }, "networkType": { "description": "网络配置类型:nat_ipv4, nat_ipv4_ipv6, dedicated_ipv4, dedicated_ipv4_ipv6, ipv6_only", "type": "string" }, "osType": { "type": "string" }, "password": { "type": "string" }, "portRangeEnd": { "description": "端口范围结束", "type": "integer" }, "portRangeStart": { "description": "端口范围起始", "type": "integer" }, "privateIP": { "description": "内网IPv4地址", "type": "string" }, "providerName": { "type": "string" }, "providerStatus": { "description": "Provider状态:active, inactive, partial", "type": "string" }, "providerType": { "description": "Provider虚拟化类型:docker, lxd, incus, proxmox", "type": "string" }, "provider_id": { "description": "Provider ID", "type": "integer" }, "publicIP": { "description": "公网IPv4地址", "type": "string" }, "publicIPv6": { "description": "公网IPv6地址", "type": "string" }, "relatedTask": { "description": "关联任务信息", "allOf": [ { "$ref": "#/definitions/user.UserTaskResponse" } ] }, "sshPort": { "type": "integer" }, "status": { "type": "string" }, "type": { "type": "string" }, "username": { "type": "string" } } }, "user.UserLimitsResponse": { "type": "object", "properties": { "containerCount": { "description": "容器数量", "type": "integer" }, "level": { "type": "integer" }, "maxBandwidth": { "description": "最大带宽(Mbps)", "type": "integer" }, "maxCpu": { "description": "最大CPU核心数", "type": "integer" }, "maxDisk": { "description": "最大磁盘(MB)", "type": "integer" }, "maxInstances": { "type": "integer" }, "maxMemory": { "description": "最大内存(MB)", "type": "integer" }, "maxTraffic": { "description": "最大流量(MB)", "type": "integer" }, "usedBandwidth": { "description": "已使用带宽(Mbps)", "type": "integer" }, "usedCpu": { "description": "已使用CPU核心数", "type": "integer" }, "usedDisk": { "description": "已使用磁盘(MB)", "type": "integer" }, "usedInstances": { "type": "integer" }, "usedMemory": { "description": "已使用内存(MB)", "type": "integer" }, "usedTraffic": { "description": "已使用流量(MB)", "type": "integer" }, "vmCount": { "description": "虚拟机数量", "type": "integer" } } }, "user.UserTaskResponse": { "type": "object", "properties": { "canCancel": { "description": "是否可以取消", "type": "boolean" }, "cancelReason": { "description": "取消原因", "type": "string" }, "completedAt": { "type": "string" }, "createdAt": { "type": "string" }, "errorMessage": { "type": "string" }, "estimatedWaitTime": { "description": "预计等待时间(秒)", "type": "integer" }, "id": { "type": "integer" }, "instanceId": { "type": "integer" }, "instanceName": { "type": "string" }, "instanceType": { "description": "实例类型:container 或 vm", "type": "string" }, "isForceStoppable": { "description": "是否允许强制停止", "type": "boolean" }, "preallocatedBandwidth": { "description": "预分配的带宽(Mbps)", "type": "integer" }, "preallocatedCpu": { "description": "预分配的实例配置信息", "type": "integer" }, "preallocatedDisk": { "description": "预分配的磁盘(MB)", "type": "integer" }, "preallocatedMemory": { "description": "预分配的内存(MB)", "type": "integer" }, "progress": { "type": "integer" }, "providerId": { "type": "integer" }, "providerName": { "type": "string" }, "queuePosition": { "description": "排队信息", "type": "integer" }, "remainingTime": { "description": "剩余时间(秒)", "type": "integer" }, "startedAt": { "type": "string" }, "status": { "type": "string" }, "statusMessage": { "description": "状态描述", "type": "string" }, "taskType": { "type": "string" }, "timeoutDuration": { "description": "超时时间(秒)", "type": "integer" }, "updatedAt": { "type": "string" }, "uuid": { "type": "string" } } } }, "securityDefinitions": { "BearerAuth": { "type": "apiKey", "name": "Authorization", "in": "header" } } }