mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-19 06:59:50 +02:00
feat(api): support query parameters for proxmox journalctl endpoint
Refactored the journalctl API to accept `node`, `vmid`, and `service` parameters as query strings in addition to path parameters. Added a new route `/proxmox/journalctl` that accepts all parameters via query string while maintaining backward compatibility with existing path-parameter routes. - Changed `JournalctlRequest` struct binding from URI-only to query+URI - Simplified Swagger documentation by consolidating multiple route definitions - Existing path-parameter routes remain functional for backward compatibility
This commit is contained in:
@@ -2077,6 +2077,86 @@
|
||||
"operationId": "uptime"
|
||||
}
|
||||
},
|
||||
"/proxmox/journalctl": {
|
||||
"get": {
|
||||
"description": "Get journalctl output for node or LXC container. If vmid is not provided, streams node journalctl.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"proxmox",
|
||||
"websocket"
|
||||
],
|
||||
"summary": "Get journalctl output",
|
||||
"parameters": [
|
||||
{
|
||||
"maximum": 1000,
|
||||
"minimum": 1,
|
||||
"type": "integer",
|
||||
"default": 100,
|
||||
"description": "Limit output lines (1-1000)",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Node name",
|
||||
"name": "node",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Service name (e.g., 'pveproxy' for node, 'container@.service' format for LXC)",
|
||||
"name": "service",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Container VMID (optional - if not provided, streams node journalctl)",
|
||||
"name": "vmid",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Journalctl output",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ErrorResponse"
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ErrorResponse"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Node not found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ErrorResponse"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ErrorResponse"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-id": "journalctl",
|
||||
"operationId": "journalctl"
|
||||
}
|
||||
},
|
||||
"/proxmox/journalctl/{node}": {
|
||||
"get": {
|
||||
"description": "Get journalctl output for node or LXC container. If vmid is not provided, streams node journalctl.",
|
||||
@@ -2092,18 +2172,40 @@
|
||||
],
|
||||
"summary": "Get journalctl output",
|
||||
"parameters": [
|
||||
{
|
||||
"maximum": 1000,
|
||||
"minimum": 1,
|
||||
"type": "integer",
|
||||
"default": 100,
|
||||
"description": "Limit output lines (1-1000)",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Node name",
|
||||
"name": "node",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Service name (e.g., 'pveproxy' for node, 'container@.service' format for LXC)",
|
||||
"name": "service",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Container VMID (optional - if not provided, streams node journalctl)",
|
||||
"name": "vmid",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Node name",
|
||||
"name": "node",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Limit output lines (1-1000)",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -2157,6 +2259,34 @@
|
||||
],
|
||||
"summary": "Get journalctl output",
|
||||
"parameters": [
|
||||
{
|
||||
"maximum": 1000,
|
||||
"minimum": 1,
|
||||
"type": "integer",
|
||||
"default": 100,
|
||||
"description": "Limit output lines (1-1000)",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Node name",
|
||||
"name": "node",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Service name (e.g., 'pveproxy' for node, 'container@.service' format for LXC)",
|
||||
"name": "service",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Container VMID (optional - if not provided, streams node journalctl)",
|
||||
"name": "vmid",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Node name",
|
||||
@@ -2169,12 +2299,6 @@
|
||||
"description": "Container VMID (optional - if not provided, streams node journalctl)",
|
||||
"name": "vmid",
|
||||
"in": "path"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Limit output lines (1-1000)",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -2228,18 +2352,40 @@
|
||||
],
|
||||
"summary": "Get journalctl output",
|
||||
"parameters": [
|
||||
{
|
||||
"maximum": 1000,
|
||||
"minimum": 1,
|
||||
"type": "integer",
|
||||
"default": 100,
|
||||
"description": "Limit output lines (1-1000)",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Node name",
|
||||
"name": "node",
|
||||
"in": "path",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Service name (e.g., 'pveproxy' for node, 'container@.service' format for LXC)",
|
||||
"name": "service",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Container VMID (optional - if not provided, streams node journalctl)",
|
||||
"name": "vmid",
|
||||
"in": "path"
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Node name",
|
||||
"name": "node",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
@@ -2249,9 +2395,9 @@
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Limit output lines (1-1000)",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
"description": "Container VMID (optional - if not provided, streams node journalctl)",
|
||||
"name": "vmid",
|
||||
"in": "path"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
||||
@@ -3402,6 +3402,62 @@ paths:
|
||||
- metrics
|
||||
- websocket
|
||||
x-id: uptime
|
||||
/proxmox/journalctl:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Get journalctl output for node or LXC container. If vmid is not
|
||||
provided, streams node journalctl.
|
||||
parameters:
|
||||
- default: 100
|
||||
description: Limit output lines (1-1000)
|
||||
in: query
|
||||
maximum: 1000
|
||||
minimum: 1
|
||||
name: limit
|
||||
type: integer
|
||||
- description: Node name
|
||||
in: query
|
||||
name: node
|
||||
required: true
|
||||
type: string
|
||||
- description: Service name (e.g., 'pveproxy' for node, 'container@.service'
|
||||
format for LXC)
|
||||
in: query
|
||||
name: service
|
||||
type: string
|
||||
- description: Container VMID (optional - if not provided, streams node journalctl)
|
||||
in: query
|
||||
name: vmid
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Journalctl output
|
||||
schema:
|
||||
type: string
|
||||
"400":
|
||||
description: Invalid request
|
||||
schema:
|
||||
$ref: '#/definitions/ErrorResponse'
|
||||
"403":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/ErrorResponse'
|
||||
"404":
|
||||
description: Node not found
|
||||
schema:
|
||||
$ref: '#/definitions/ErrorResponse'
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/ErrorResponse'
|
||||
summary: Get journalctl output
|
||||
tags:
|
||||
- proxmox
|
||||
- websocket
|
||||
x-id: journalctl
|
||||
/proxmox/journalctl/{node}:
|
||||
get:
|
||||
consumes:
|
||||
@@ -3409,15 +3465,32 @@ paths:
|
||||
description: Get journalctl output for node or LXC container. If vmid is not
|
||||
provided, streams node journalctl.
|
||||
parameters:
|
||||
- default: 100
|
||||
description: Limit output lines (1-1000)
|
||||
in: query
|
||||
maximum: 1000
|
||||
minimum: 1
|
||||
name: limit
|
||||
type: integer
|
||||
- description: Node name
|
||||
in: query
|
||||
name: node
|
||||
required: true
|
||||
type: string
|
||||
- description: Service name (e.g., 'pveproxy' for node, 'container@.service'
|
||||
format for LXC)
|
||||
in: query
|
||||
name: service
|
||||
type: string
|
||||
- description: Container VMID (optional - if not provided, streams node journalctl)
|
||||
in: query
|
||||
name: vmid
|
||||
type: integer
|
||||
- description: Node name
|
||||
in: path
|
||||
name: node
|
||||
required: true
|
||||
type: string
|
||||
- description: Limit output lines (1-1000)
|
||||
in: query
|
||||
name: limit
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -3453,6 +3526,27 @@ paths:
|
||||
description: Get journalctl output for node or LXC container. If vmid is not
|
||||
provided, streams node journalctl.
|
||||
parameters:
|
||||
- default: 100
|
||||
description: Limit output lines (1-1000)
|
||||
in: query
|
||||
maximum: 1000
|
||||
minimum: 1
|
||||
name: limit
|
||||
type: integer
|
||||
- description: Node name
|
||||
in: query
|
||||
name: node
|
||||
required: true
|
||||
type: string
|
||||
- description: Service name (e.g., 'pveproxy' for node, 'container@.service'
|
||||
format for LXC)
|
||||
in: query
|
||||
name: service
|
||||
type: string
|
||||
- description: Container VMID (optional - if not provided, streams node journalctl)
|
||||
in: query
|
||||
name: vmid
|
||||
type: integer
|
||||
- description: Node name
|
||||
in: path
|
||||
name: node
|
||||
@@ -3462,10 +3556,6 @@ paths:
|
||||
in: path
|
||||
name: vmid
|
||||
type: integer
|
||||
- description: Limit output lines (1-1000)
|
||||
in: query
|
||||
name: limit
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -3501,23 +3591,40 @@ paths:
|
||||
description: Get journalctl output for node or LXC container. If vmid is not
|
||||
provided, streams node journalctl.
|
||||
parameters:
|
||||
- default: 100
|
||||
description: Limit output lines (1-1000)
|
||||
in: query
|
||||
maximum: 1000
|
||||
minimum: 1
|
||||
name: limit
|
||||
type: integer
|
||||
- description: Node name
|
||||
in: query
|
||||
name: node
|
||||
required: true
|
||||
type: string
|
||||
- description: Service name (e.g., 'pveproxy' for node, 'container@.service'
|
||||
format for LXC)
|
||||
in: query
|
||||
name: service
|
||||
type: string
|
||||
- description: Container VMID (optional - if not provided, streams node journalctl)
|
||||
in: query
|
||||
name: vmid
|
||||
type: integer
|
||||
- description: Node name
|
||||
in: path
|
||||
name: node
|
||||
required: true
|
||||
type: string
|
||||
- description: Container VMID (optional - if not provided, streams node journalctl)
|
||||
in: path
|
||||
name: vmid
|
||||
type: integer
|
||||
- description: Service name (e.g., 'pveproxy' for node, 'container@.service'
|
||||
format for LXC)
|
||||
in: path
|
||||
name: service
|
||||
type: string
|
||||
- description: Limit output lines (1-1000)
|
||||
in: query
|
||||
name: limit
|
||||
- description: Container VMID (optional - if not provided, streams node journalctl)
|
||||
in: path
|
||||
name: vmid
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
|
||||
Reference in New Issue
Block a user