feat(proxmox): add LXC container control endpoints

Add start, stop, and restart endpoints for LXC containers via the Proxmox API:
- POST /api/v1/proxmox/lxc/:node/:vmid/start
- POST /api/v1/proxmox/lxc/:node/:vmid/stop
- POST /api/v1/proxmox/lxc/:node/:vmid/restart
This commit is contained in:
yusing
2026-01-25 12:13:08 +08:00
parent c202e26559
commit c29798a48b
9 changed files with 404 additions and 2 deletions

View File

@@ -310,6 +310,168 @@
"operationId": "journalctl"
}
},
"/api/v1/proxmox/lxc/:node/:vmid/restart": {
"post": {
"description": "Restart LXC container by node and vmid",
"produces": [
"application/json"
],
"tags": [
"proxmox"
],
"summary": "Restart LXC container",
"parameters": [
{
"type": "string",
"name": "node",
"in": "path",
"required": true
},
{
"type": "integer",
"name": "vmid",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/SuccessResponse"
}
},
"400": {
"description": "Invalid request",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"404": {
"description": "Node not found",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
},
"x-id": "lxcRestart",
"operationId": "lxcRestart"
}
},
"/api/v1/proxmox/lxc/:node/:vmid/start": {
"post": {
"description": "Start LXC container by node and vmid",
"produces": [
"application/json"
],
"tags": [
"proxmox"
],
"summary": "Start LXC container",
"parameters": [
{
"type": "string",
"name": "node",
"in": "path",
"required": true
},
{
"type": "integer",
"name": "vmid",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/SuccessResponse"
}
},
"400": {
"description": "Invalid request",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"404": {
"description": "Node not found",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
},
"x-id": "lxcStart",
"operationId": "lxcStart"
}
},
"/api/v1/proxmox/lxc/:node/:vmid/stop": {
"post": {
"description": "Stop LXC container by node and vmid",
"produces": [
"application/json"
],
"tags": [
"proxmox"
],
"summary": "Stop LXC container",
"parameters": [
{
"type": "string",
"name": "node",
"in": "path",
"required": true
},
{
"type": "integer",
"name": "vmid",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/SuccessResponse"
}
},
"400": {
"description": "Invalid request",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"404": {
"description": "Node not found",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
},
"x-id": "lxcStop",
"operationId": "lxcStop"
}
},
"/api/v1/proxmox/stats/{node}/{vmid}": {
"get": {
"description": "Get proxmox stats in format of \"STATUS|CPU%%|MEM USAGE/LIMIT|MEM%%|NET I/O|BLOCK I/O\"",

View File

@@ -2183,6 +2183,111 @@ paths:
- proxmox
- websocket
x-id: journalctl
/api/v1/proxmox/lxc/:node/:vmid/restart:
post:
description: Restart LXC container by node and vmid
parameters:
- in: path
name: node
required: true
type: string
- in: path
name: vmid
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/SuccessResponse'
"400":
description: Invalid request
schema:
$ref: '#/definitions/ErrorResponse'
"404":
description: Node not found
schema:
$ref: '#/definitions/ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ErrorResponse'
summary: Restart LXC container
tags:
- proxmox
x-id: lxcRestart
/api/v1/proxmox/lxc/:node/:vmid/start:
post:
description: Start LXC container by node and vmid
parameters:
- in: path
name: node
required: true
type: string
- in: path
name: vmid
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/SuccessResponse'
"400":
description: Invalid request
schema:
$ref: '#/definitions/ErrorResponse'
"404":
description: Node not found
schema:
$ref: '#/definitions/ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ErrorResponse'
summary: Start LXC container
tags:
- proxmox
x-id: lxcStart
/api/v1/proxmox/lxc/:node/:vmid/stop:
post:
description: Stop LXC container by node and vmid
parameters:
- in: path
name: node
required: true
type: string
- in: path
name: vmid
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/SuccessResponse'
"400":
description: Invalid request
schema:
$ref: '#/definitions/ErrorResponse'
"404":
description: Node not found
schema:
$ref: '#/definitions/ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ErrorResponse'
summary: Stop LXC container
tags:
- proxmox
x-id: lxcStop
/api/v1/proxmox/stats/{node}/{vmid}:
get:
consumes: