287 lines
5.9 KiB
JSON
287 lines
5.9 KiB
JSON
{
|
|
"openapi": "3.1.0",
|
|
"info": {
|
|
"title": "VPS-Commander",
|
|
"version": "1.1.0"
|
|
},
|
|
"servers": [
|
|
{
|
|
"url": "https://vpstool.kory.kdns.fr"
|
|
}
|
|
],
|
|
"components": {
|
|
"securitySchemes": {
|
|
"bearerAuth": {
|
|
"type": "http",
|
|
"scheme": "bearer"
|
|
}
|
|
},
|
|
"schemas": {
|
|
"Device": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
},
|
|
"status": {
|
|
"type": "string"
|
|
},
|
|
"is_local": {
|
|
"type": "boolean"
|
|
},
|
|
"arch": {
|
|
"type": "string"
|
|
},
|
|
"os": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"ExecRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"command"
|
|
],
|
|
"properties": {
|
|
"device": {
|
|
"type": "string"
|
|
},
|
|
"command": {
|
|
"type": "string"
|
|
},
|
|
"workdir": {
|
|
"type": "string"
|
|
},
|
|
"timeout": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"ExecResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"device": {
|
|
"type": "string"
|
|
},
|
|
"exit_code": {
|
|
"type": "integer"
|
|
},
|
|
"stdout": {
|
|
"type": "string"
|
|
},
|
|
"stderr": {
|
|
"type": "string"
|
|
},
|
|
"duration_ms": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"FileReadRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"path"
|
|
],
|
|
"properties": {
|
|
"device": {
|
|
"type": "string"
|
|
},
|
|
"path": {
|
|
"type": "string"
|
|
},
|
|
"offset": {
|
|
"type": "integer"
|
|
},
|
|
"limit": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
},
|
|
"FileReadResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"device": {
|
|
"type": "string"
|
|
},
|
|
"path": {
|
|
"type": "string"
|
|
},
|
|
"offset": {
|
|
"type": "integer"
|
|
},
|
|
"content": {
|
|
"type": "string"
|
|
},
|
|
"bytes": {
|
|
"type": "integer"
|
|
},
|
|
"eof": {
|
|
"type": "boolean"
|
|
},
|
|
"total_size": {
|
|
"type": "integer"
|
|
},
|
|
"has_more": {
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
},
|
|
"FileWriteRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"path",
|
|
"content"
|
|
],
|
|
"properties": {
|
|
"device": {
|
|
"type": "string"
|
|
},
|
|
"path": {
|
|
"type": "string"
|
|
},
|
|
"content": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"FileWriteResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"device": {
|
|
"type": "string"
|
|
},
|
|
"path": {
|
|
"type": "string"
|
|
},
|
|
"bytes": {
|
|
"type": "integer"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"paths": {
|
|
"/api/v1/devices": {
|
|
"get": {
|
|
"operationId": "list_devices",
|
|
"security": [
|
|
{
|
|
"bearerAuth": []
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Devices",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/Device"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/exec": {
|
|
"post": {
|
|
"operationId": "exec_command",
|
|
"security": [
|
|
{
|
|
"bearerAuth": []
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ExecRequest"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Execution result",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ExecResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/file/read": {
|
|
"post": {
|
|
"operationId": "read_file",
|
|
"security": [
|
|
{
|
|
"bearerAuth": []
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/FileReadRequest"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "File content",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/FileReadResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/file/write": {
|
|
"post": {
|
|
"operationId": "write_file",
|
|
"security": [
|
|
{
|
|
"bearerAuth": []
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/FileWriteRequest"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Write result",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/FileWriteResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|