Files
vctp2/server/router/docs/swagger.json
Nathan Coad a81613a8c2
Some checks failed
continuous-integration/drone/push Build was killed
fix drone and sqlc generation
2026-01-13 19:49:13 +11:00

739 lines
24 KiB
JSON

{
"swagger": "2.0",
"info": {
"contact": {}
},
"paths": {
"/": {
"get": {
"description": "Renders the main UI page.",
"produces": [
"text/html"
],
"tags": [
"ui"
],
"summary": "Home page",
"responses": {
"200": {
"description": "HTML page",
"schema": {
"type": "string"
}
},
"500": {
"description": "Render failed",
"schema": {
"type": "string"
}
}
}
}
},
"/api/cleanup/updates": {
"delete": {
"description": "Removes update records that are no longer associated with a VM.",
"produces": [
"text/plain"
],
"tags": [
"maintenance"
],
"summary": "Cleanup updates",
"responses": {
"200": {
"description": "Cleanup completed",
"schema": {
"type": "string"
}
},
"500": {
"description": "Server error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/cleanup/vcenter": {
"delete": {
"description": "Removes all inventory entries associated with a vCenter URL.",
"produces": [
"application/json"
],
"tags": [
"maintenance"
],
"summary": "Cleanup vCenter inventory",
"parameters": [
{
"type": "string",
"description": "vCenter URL",
"name": "vc_url",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "Cleanup completed",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Invalid request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/encrypt": {
"post": {
"description": "Encrypts a plaintext value and returns the ciphertext.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"crypto"
],
"summary": "Encrypt data",
"parameters": [
{
"description": "Plaintext payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
],
"responses": {
"200": {
"description": "Ciphertext response",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/event/vm/create": {
"post": {
"description": "Parses a VM create CloudEvent and stores the event data.",
"consumes": [
"application/json"
],
"produces": [
"text/plain"
],
"tags": [
"events"
],
"summary": "Record VM create event",
"parameters": [
{
"description": "CloudEvent payload",
"name": "event",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.CloudEventReceived"
}
}
],
"responses": {
"200": {
"description": "Create event processed",
"schema": {
"type": "string"
}
},
"400": {
"description": "Invalid request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Server error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/event/vm/delete": {
"post": {
"description": "Parses a VM delete CloudEvent and marks the VM as deleted in inventory.",
"consumes": [
"application/json"
],
"produces": [
"text/plain"
],
"tags": [
"events"
],
"summary": "Record VM delete event",
"parameters": [
{
"description": "CloudEvent payload",
"name": "event",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.CloudEventReceived"
}
}
],
"responses": {
"200": {
"description": "Delete event processed",
"schema": {
"type": "string"
}
},
"400": {
"description": "Invalid request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Server error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/event/vm/modify": {
"post": {
"description": "Parses a VM modify CloudEvent and creates an update record when relevant changes are detected.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"events"
],
"summary": "Record VM modify event",
"parameters": [
{
"description": "CloudEvent payload",
"name": "event",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.CloudEventReceived"
}
}
],
"responses": {
"200": {
"description": "Modify event processed",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"202": {
"description": "No relevant changes",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/event/vm/move": {
"post": {
"description": "Parses a VM move CloudEvent and creates an update record.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"events"
],
"summary": "Record VM move event",
"parameters": [
{
"description": "CloudEvent payload",
"name": "event",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.CloudEventReceived"
}
}
],
"responses": {
"200": {
"description": "Move event processed",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Invalid request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/import/vm": {
"post": {
"description": "Imports existing VM inventory data in bulk.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"inventory"
],
"summary": "Import VMs",
"parameters": [
{
"description": "Bulk import payload",
"name": "import",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ImportReceived"
}
}
],
"responses": {
"200": {
"description": "Import processed",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/inventory/vm/delete": {
"delete": {
"description": "Removes a VM inventory entry by VM ID and datacenter name.",
"produces": [
"application/json"
],
"tags": [
"inventory"
],
"summary": "Cleanup VM inventory entry",
"parameters": [
{
"type": "string",
"description": "VM ID",
"name": "vm_id",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Datacenter name",
"name": "datacenter_name",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "Cleanup completed",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Invalid request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/inventory/vm/update": {
"post": {
"description": "Queries vCenter and updates inventory records with missing details.",
"produces": [
"text/plain"
],
"tags": [
"inventory"
],
"summary": "Refresh VM details",
"responses": {
"200": {
"description": "Update completed",
"schema": {
"type": "string"
}
},
"500": {
"description": "Server error",
"schema": {
"type": "string"
}
}
}
}
},
"/api/report/inventory": {
"get": {
"description": "Generates an inventory XLSX report and returns it as a file download.",
"produces": [
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
],
"tags": [
"reports"
],
"summary": "Download inventory report",
"responses": {
"200": {
"description": "Inventory XLSX report",
"schema": {
"type": "file"
}
},
"500": {
"description": "Report generation failed",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/report/snapshot": {
"get": {
"description": "Downloads a snapshot table as an XLSX file.",
"produces": [
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
],
"tags": [
"snapshots"
],
"summary": "Download snapshot report",
"parameters": [
{
"type": "string",
"description": "Snapshot table name",
"name": "table",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "Snapshot XLSX report",
"schema": {
"type": "file"
}
},
"400": {
"description": "Invalid request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/api/report/updates": {
"get": {
"description": "Generates an updates XLSX report and returns it as a file download.",
"produces": [
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
],
"tags": [
"reports"
],
"summary": "Download updates report",
"responses": {
"200": {
"description": "Updates XLSX report",
"schema": {
"type": "file"
}
},
"500": {
"description": "Report generation failed",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/snapshots/daily": {
"get": {
"description": "Lists daily summary snapshot tables.",
"produces": [
"text/html"
],
"tags": [
"snapshots"
],
"summary": "List daily snapshots",
"responses": {
"200": {
"description": "HTML page",
"schema": {
"type": "string"
}
},
"500": {
"description": "Server error",
"schema": {
"type": "string"
}
}
}
}
},
"/snapshots/hourly": {
"get": {
"description": "Lists hourly inventory snapshot tables.",
"produces": [
"text/html"
],
"tags": [
"snapshots"
],
"summary": "List hourly snapshots",
"responses": {
"200": {
"description": "HTML page",
"schema": {
"type": "string"
}
},
"500": {
"description": "Server error",
"schema": {
"type": "string"
}
}
}
}
},
"/snapshots/monthly": {
"get": {
"description": "Lists monthly summary snapshot tables.",
"produces": [
"text/html"
],
"tags": [
"snapshots"
],
"summary": "List monthly snapshots",
"responses": {
"200": {
"description": "HTML page",
"schema": {
"type": "string"
}
},
"500": {
"description": "Server error",
"schema": {
"type": "string"
}
}
}
}
}
},
"definitions": {
"models.CloudEventReceived": {
"type": "object"
},
"models.CloudEventResourcePool": {
"type": "object",
"properties": {
"Name": {
"type": "string"
},
"ResourcePool": {
"type": "object",
"properties": {
"Type": {
"type": "string"
},
"Value": {
"type": "string"
}
}
}
}
},
"models.CloudEventVm": {
"type": "object",
"properties": {
"Name": {
"type": "string"
},
"Vm": {
"type": "object",
"properties": {
"Type": {
"type": "string"
},
"Value": {
"type": "string"
}
}
}
}
},
"models.ImportReceived": {
"type": "object",
"properties": {
"Cluster": {
"type": "string"
},
"CreationTime": {
"type": "integer"
},
"Datacenter": {
"type": "string"
},
"Folder": {
"type": "string"
},
"InitialRam": {
"type": "integer"
},
"InitialVcpus": {
"type": "integer"
},
"Name": {
"type": "string"
},
"PowerState": {
"type": "integer"
},
"ProvisionedDisk": {
"type": "number"
},
"ResourcePool": {
"type": "string"
},
"Vcenter": {
"type": "string"
},
"VmId": {
"type": "string"
}
}
}
}
}