{ "openapi": "3.0.1", "info": { "title": "默认模块", "description": "", "version": "1.0.0" }, "tags": [ { "name": "KVM-UserNetworking" } ], "paths": { "/api/v1/admin/server/host_service/point/networking/create": { "post": { "summary": "创建用户组网", "deprecated": false, "description": "", "tags": [ "KVM-UserNetworking" ], "parameters": [ { "name": "Authorization", "in": "header", "description": "", "example": "Bearer {{token}}", "schema": { "type": "string", "default": "Bearer {{token}}" } } ], "requestBody": { "content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "service_id": { "description": "KVM 服务 ID", "example": 0, "type": "integer" }, "name": { "description": "组网名称", "example": "", "type": "string" }, "description": { "description": "组网描述", "example": "", "type": "string" }, "user_id": { "description": "用户 ID", "example": 0, "type": "integer" }, "host_id": { "description": "宿主机 ID", "example": 0, "type": "integer" }, "bridge_name": { "description": "网桥名称", "example": "", "type": "string" }, "gateway": { "description": "网关地址", "example": "", "type": "string" } }, "required": [ "service_id", "user_id", "host_id" ] } } } }, "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/UserNetworkingData" } } } } }, "headers": {} } }, "security": [] } }, "/api/v1/admin/server/host_service/point/networking/assign": { "post": { "summary": "为虚拟机分配组网 IP", "deprecated": false, "description": "", "tags": [ "KVM-UserNetworking" ], "parameters": [ { "name": "Authorization", "in": "header", "description": "", "example": "Bearer {{token}}", "schema": { "type": "string", "default": "Bearer {{token}}" } } ], "requestBody": { "content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "service_id": { "description": "KVM 服务 ID", "example": 0, "type": "integer" }, "networking_id": { "description": "组网 ID", "example": 0, "type": "integer" }, "vm_id": { "description": "虚拟机 ID", "example": 0, "type": "integer" }, "ip": { "description": "指定 IP,不传则自动分配", "example": "", "type": "string" } }, "required": [ "service_id", "networking_id", "vm_id" ] } } } }, "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "object", "properties": { "networking": { "$ref": "#/components/schemas/UserNetworkingData" }, "network": { "$ref": "#/components/schemas/Network" }, "task": { "$ref": "#/components/schemas/Task" } } } } }, "headers": {} } }, "security": [] } }, "/api/v1/admin/server/host_service/point/networking/list": { "get": { "summary": "获取组网列表", "deprecated": false, "description": "", "tags": [ "KVM-UserNetworking" ], "parameters": [ { "name": "service_id", "in": "query", "description": "KVM 服务 ID", "required": true, "schema": { "type": "integer" } }, { "name": "page", "in": "query", "description": "页码", "required": false, "schema": { "type": "integer" } }, { "name": "count", "in": "query", "description": "每页数量", "required": false, "schema": { "type": "integer" } }, { "name": "host_id", "in": "query", "description": "按宿主机 ID 筛选", "required": false, "schema": { "type": "integer" } }, { "name": "user_id", "in": "query", "description": "按用户 ID 筛选", "required": false, "schema": { "type": "integer" } }, { "name": "keyword", "in": "query", "description": "关键词搜索", "required": false, "schema": { "type": "string" } }, { "name": "Authorization", "in": "header", "description": "", "example": "Bearer {{token}}", "schema": { "type": "string", "default": "Bearer {{token}}" } } ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "object", "properties": { "meta": { "type": "object", "properties": { "count": { "type": "integer", "description": "总数" } } }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/UserNetworkingData" } } } } } }, "headers": {} } }, "security": [] } }, "/api/v1/admin/server/host_service/point/networking/detail": { "get": { "summary": "获取组网详情", "deprecated": false, "description": "", "tags": [ "KVM-UserNetworking" ], "parameters": [ { "name": "service_id", "in": "query", "description": "KVM 服务 ID", "required": true, "schema": { "type": "integer" } }, { "name": "networking_id", "in": "query", "description": "组网 ID", "required": true, "schema": { "type": "integer" } }, { "name": "Authorization", "in": "header", "description": "", "example": "Bearer {{token}}", "schema": { "type": "string", "default": "Bearer {{token}}" } } ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/UserNetworkingData" }, "networks": { "type": "array", "items": { "$ref": "#/components/schemas/NetworkingNetworkItem" } } } } } }, "headers": {} } }, "security": [] } }, "/api/v1/admin/server/host_service/point/networking/delete": { "delete": { "summary": "删除组网", "deprecated": false, "description": "", "tags": [ "KVM-UserNetworking" ], "parameters": [ { "name": "service_id", "in": "query", "description": "KVM 服务 ID", "required": true, "schema": { "type": "integer" } }, { "name": "networking_id", "in": "query", "description": "组网 ID", "required": true, "schema": { "type": "integer" } }, { "name": "Authorization", "in": "header", "description": "", "example": "Bearer {{token}}", "schema": { "type": "string", "default": "Bearer {{token}}" } } ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/UserNetworkingData" } } } } }, "headers": {} } }, "security": [] } }, "/api/v1/admin/server/host_service/point/networking/remove_network": { "post": { "summary": "删除组网下的指定网络", "deprecated": false, "description": "", "tags": [ "KVM-UserNetworking" ], "parameters": [ { "name": "Authorization", "in": "header", "description": "", "example": "Bearer {{token}}", "schema": { "type": "string", "default": "Bearer {{token}}" } } ], "requestBody": { "content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "service_id": { "description": "KVM 服务 ID", "example": 0, "type": "integer" }, "networking_id": { "description": "组网 ID", "example": 0, "type": "integer" }, "network_id": { "description": "网络 ID", "example": 0, "type": "integer" }, "vm_id": { "description": "虚拟机 ID(用于从 VM 中移除网络)", "example": 0, "type": "integer" } }, "required": [ "service_id", "networking_id", "network_id", "vm_id" ] } } } }, "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "$ref": "#/components/schemas/UserNetworkingData" } } } } }, "headers": {} } }, "security": [] } } }, "components": { "schemas": { "UserNetworkingData": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64" }, "name": { "type": "string" }, "description": { "type": "string" }, "user_id": { "type": "integer", "format": "int64" }, "host_id": { "type": "integer", "format": "int64" }, "bridge_name": { "type": "string" }, "gateway": { "type": "string" }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } } }, "NetworkingNetworkItem": { "type": "object", "properties": { "network": { "$ref": "#/components/schemas/Network" }, "vm_id": { "type": "integer", "format": "int64" }, "vm_name": { "type": "string" }, "vm_status": { "type": "string" } } }, "Network": { "type": "object", "description": "网络对象(来自 gRPC Network message)", "properties": {} }, "Task": { "type": "object", "description": "异步任务对象(字段同 gRPC Task message)", "properties": {} } }, "responses": {}, "securitySchemes": {} }, "servers": [], "security": [] }