234 lines
6.9 KiB
JSON
234 lines
6.9 KiB
JSON
{
|
|
"openapi": "3.0.0",
|
|
"info": {
|
|
"title": "Container Management API",
|
|
"version": "0.0.5",
|
|
"description": "API for managing containers and system resources."
|
|
},
|
|
"servers": [
|
|
{ "url": "http://localhost:8888" }
|
|
],
|
|
"components": {
|
|
"securitySchemes": {
|
|
"ApiKeyAuth": {
|
|
"type": "apiKey",
|
|
"in": "header",
|
|
"name": "X-API-Key"
|
|
}
|
|
},
|
|
"schemas": {
|
|
"ContainerModel": {
|
|
"type": "object",
|
|
"properties": {
|
|
"UUID": { "type": "string" },
|
|
"email": { "type": "string" },
|
|
"expires": { "type": "string", "format": "date" },
|
|
"tags": { "type": "string" },
|
|
"env": { "type": "string" },
|
|
"affiliate": { "type": "string" },
|
|
"image": { "type": "string" },
|
|
"history": { "type": "string" },
|
|
"comment": { "type": "string" },
|
|
"domains": { "type": "string" },
|
|
"status": { "type": "string" },
|
|
"created": { "type": "string", "format": "date" },
|
|
"bump": { "type": "string", "format": "date" }
|
|
},
|
|
"required": ["UUID", "email", "expires", "status", "created"]
|
|
},
|
|
"ContainerIDRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"container_id": { "type": "string" }
|
|
},
|
|
"required": ["container_id"]
|
|
},
|
|
"InfoContainerRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"container_id": { "type": "string" }
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [{ "ApiKeyAuth": [] }],
|
|
"paths": {
|
|
"/": {
|
|
"get": {
|
|
"summary": "Root redirect",
|
|
"responses": {
|
|
"302": { "description": "Redirect to ODOO4PROJECTS.com" }
|
|
}
|
|
}
|
|
},
|
|
"/container/update": {
|
|
"post": {
|
|
"summary": "Create or update container",
|
|
"security": [{ "ApiKeyAuth": [] }],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": { "$ref": "#/components/schemas/ContainerModel" }
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Container updated or created",
|
|
"content": { "application/json": { "example": { "message": "Container updated or created" } } }
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/container/start": {
|
|
"post": {
|
|
"summary": "Start a container",
|
|
"security": [{ "ApiKeyAuth": [] }],
|
|
"requestBody": {
|
|
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ContainerIDRequest" } } }
|
|
},
|
|
"responses": { "200": { "description": "Container started" } }
|
|
}
|
|
},
|
|
"/container/stop": {
|
|
"post": {
|
|
"summary": "Stop a container",
|
|
"security": [{ "ApiKeyAuth": [] }],
|
|
"requestBody": {
|
|
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ContainerIDRequest" } } }
|
|
},
|
|
"responses": { "200": { "description": "Container stopped" } }
|
|
}
|
|
},
|
|
"/container/nuke": {
|
|
"post": {
|
|
"summary": "Nuke a container",
|
|
"description": "Permanently deletes container if its status is 'nuke'.",
|
|
"security": [{ "ApiKeyAuth": [] }],
|
|
"requestBody": {
|
|
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ContainerIDRequest" } } }
|
|
},
|
|
"responses": {
|
|
"200": { "description": "Container nuked" },
|
|
"400": { "description": "Container status is not 'nuke'" }
|
|
}
|
|
}
|
|
},
|
|
"/container/info": {
|
|
"post": {
|
|
"summary": "Get container info",
|
|
"security": [{ "ApiKeyAuth": [] }],
|
|
"requestBody": {
|
|
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/InfoContainerRequest" } } }
|
|
},
|
|
"responses": { "200": { "description": "Container info list" } }
|
|
}
|
|
},
|
|
"/container/bump": {
|
|
"post": {
|
|
"summary": "Bump a container",
|
|
"description": "Updates bump date and runs bump script.",
|
|
"security": [{ "ApiKeyAuth": [] }],
|
|
"requestBody": {
|
|
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ContainerIDRequest" } } }
|
|
},
|
|
"responses": {
|
|
"200": { "description": "Bump successful", "content": { "application/json": {} } }
|
|
}
|
|
}
|
|
},
|
|
"/container/quota": {
|
|
"post": {
|
|
"summary": "Get container quota",
|
|
"security": [{ "ApiKeyAuth": [] }],
|
|
"requestBody": {
|
|
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ContainerIDRequest" } } }
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Quota usage",
|
|
"content": {
|
|
"application/json": {
|
|
"example": {
|
|
"memory_usage": "50MiB / 2GiB",
|
|
"disk_io": "10MB / 200MB"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/system/containers": {
|
|
"get": {
|
|
"summary": "List running containers",
|
|
"security": [{ "ApiKeyAuth": [] }],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Containers in system",
|
|
"content": { "application/json": {} }
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/system/images": {
|
|
"get": {
|
|
"summary": "List system images",
|
|
"security": [{ "ApiKeyAuth": [] }],
|
|
"responses": {
|
|
"200": {
|
|
"description": "List of docker images",
|
|
"content": {
|
|
"application/json": {
|
|
"example": {
|
|
"images": ["repo1:tag", "repo2:tag"]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/system/info": {
|
|
"get": {
|
|
"summary": "Get system info",
|
|
"security": [{ "ApiKeyAuth": [] }],
|
|
"responses": {
|
|
"200": {
|
|
"description": "System resource info",
|
|
"content": {
|
|
"application/json": {
|
|
"example": {
|
|
"alpine_version": "3.18.2",
|
|
"last_update": "2025-08-01",
|
|
"latest_bump": "2025-08-10",
|
|
"version": "API: 0.0.5",
|
|
"resources": {
|
|
"memory": { "total": 16777216, "available": 8388608, "used": 8388608 },
|
|
"disk": { "total": 100000000, "used": 50000000, "free": 50000000 },
|
|
"cpu_count": 8
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/system/pull": {
|
|
"post": {
|
|
"summary": "Pull all images",
|
|
"security": [{ "ApiKeyAuth": [] }],
|
|
"responses": {
|
|
"200": {
|
|
"description": "All images pulled",
|
|
"content": { "application/json": { "example": { "message": "All images pulled" } } }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|