{ "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": "Deprecated: Removes update records that are no longer associated with a VM.", "produces": [ "text/plain" ], "tags": [ "maintenance" ], "summary": "Cleanup updates (deprecated)", "deprecated": true, "responses": { "200": { "description": "Cleanup completed", "schema": { "type": "string" } }, "500": { "description": "Server error", "schema": { "type": "string" } } } } }, "/api/cleanup/vcenter": { "delete": { "description": "Deprecated: Removes all inventory entries associated with a vCenter URL.", "produces": [ "application/json" ], "tags": [ "maintenance" ], "summary": "Cleanup vCenter inventory (deprecated)", "deprecated": true, "parameters": [ { "type": "string", "description": "vCenter URL", "name": "vc_url", "in": "query", "required": true } ], "responses": { "200": { "description": "Cleanup completed", "schema": { "$ref": "#/definitions/models.StatusMessageResponse" } }, "400": { "description": "Invalid request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/api/diagnostics/daily-creation": { "get": { "description": "Returns counts of daily summary rows missing CreationTime and sample rows for the given date.", "produces": [ "application/json" ], "tags": [ "diagnostics" ], "summary": "Daily summary CreationTime diagnostics", "parameters": [ { "type": "string", "description": "Daily date (YYYY-MM-DD)", "name": "date", "in": "query", "required": true } ], "responses": { "200": { "description": "Diagnostics result", "schema": { "$ref": "#/definitions/models.DailyCreationDiagnosticsResponse" } }, "400": { "description": "Invalid request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "404": { "description": "Summary not found", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/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": { "$ref": "#/definitions/models.StatusMessageResponse" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/api/event/vm/create": { "post": { "description": "Deprecated: Parses a VM create CloudEvent and stores the event data.", "consumes": [ "application/json" ], "produces": [ "text/plain" ], "tags": [ "events" ], "summary": "Record VM create event (deprecated)", "deprecated": true, "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": "Deprecated: 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 (deprecated)", "deprecated": true, "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": "Deprecated: 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 (deprecated)", "deprecated": true, "parameters": [ { "description": "CloudEvent payload", "name": "event", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.CloudEventReceived" } } ], "responses": { "200": { "description": "Modify event processed", "schema": { "$ref": "#/definitions/models.StatusMessageResponse" } }, "202": { "description": "No relevant changes", "schema": { "$ref": "#/definitions/models.StatusMessageResponse" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/api/event/vm/move": { "post": { "description": "Deprecated: Parses a VM move CloudEvent and creates an update record.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "events" ], "summary": "Record VM move event (deprecated)", "deprecated": true, "parameters": [ { "description": "CloudEvent payload", "name": "event", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.CloudEventReceived" } } ], "responses": { "200": { "description": "Move event processed", "schema": { "$ref": "#/definitions/models.StatusMessageResponse" } }, "400": { "description": "Invalid request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/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": { "$ref": "#/definitions/models.StatusMessageResponse" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/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": { "$ref": "#/definitions/models.StatusMessageResponse" } }, "400": { "description": "Invalid request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/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": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/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": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/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": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/api/snapshots/aggregate": { "post": { "description": "Forces regeneration of a daily or monthly summary table for a specified date or month.", "produces": [ "application/json" ], "tags": [ "snapshots" ], "summary": "Force snapshot aggregation", "parameters": [ { "type": "string", "description": "Aggregation type: daily or monthly", "name": "type", "in": "query", "required": true }, { "type": "string", "description": "Daily date (YYYY-MM-DD) or monthly date (YYYY-MM)", "name": "date", "in": "query", "required": true }, { "type": "string", "description": "Monthly aggregation granularity: hourly or daily", "name": "granularity", "in": "query" } ], "responses": { "200": { "description": "Aggregation complete", "schema": { "$ref": "#/definitions/models.StatusResponse" } }, "400": { "description": "Invalid request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/api/snapshots/hourly/force": { "post": { "description": "Manually trigger an hourly snapshot for all configured vCenters. Requires confirmation text to avoid accidental execution.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "snapshots" ], "summary": "Trigger hourly snapshot (manual)", "parameters": [ { "type": "string", "description": "Confirmation text; must be 'FORCE'", "name": "confirm", "in": "query", "required": true } ], "responses": { "200": { "description": "Snapshot started", "schema": { "$ref": "#/definitions/models.StatusResponse" } }, "400": { "description": "Invalid request", "schema": { "$ref": "#/definitions/models.ErrorResponse" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/api/snapshots/migrate": { "post": { "description": "Rebuilds the snapshot registry from existing tables and renames hourly tables to epoch-based names.", "produces": [ "application/json" ], "tags": [ "snapshots" ], "summary": "Migrate snapshot registry", "responses": { "200": { "description": "Migration results", "schema": { "$ref": "#/definitions/models.SnapshotMigrationResponse" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/models.SnapshotMigrationResponse" } } } } }, "/api/snapshots/regenerate-hourly-reports": { "post": { "description": "Regenerates XLSX reports for hourly snapshots when the report files are missing or empty.", "produces": [ "application/json" ], "tags": [ "snapshots" ], "summary": "Regenerate hourly snapshot reports", "responses": { "200": { "description": "Regeneration summary", "schema": { "$ref": "#/definitions/models.SnapshotRegenerateReportsResponse" } }, "500": { "description": "Server error", "schema": { "$ref": "#/definitions/models.ErrorResponse" } } } } }, "/api/snapshots/repair": { "post": { "description": "Backfills SnapshotTime and lifecycle info for existing daily summary tables and reruns monthly lifecycle refinement using hourly data.", "produces": [ "application/json" ], "tags": [ "snapshots" ], "summary": "Repair daily summaries", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.SnapshotRepairResponse" } } } } }, "/api/snapshots/repair/all": { "post": { "description": "Rebuilds snapshot registry, backfills per-vCenter totals, repairs daily summaries (SnapshotTime/lifecycle), and refines monthly lifecycle.", "produces": [ "application/json" ], "tags": [ "snapshots" ], "summary": "Run full snapshot repair suite", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.SnapshotRepairSuiteResponse" } } } } }, "/metrics": { "get": { "description": "Exposes Prometheus metrics for vctp.", "produces": [ "text/plain" ], "tags": [ "metrics" ], "summary": "Prometheus metrics", "responses": { "200": { "description": "Prometheus metrics" } } } }, "/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" } } } } }, "/vcenters": { "get": { "description": "Lists all vCenters with recorded snapshot totals.", "produces": [ "text/html" ], "tags": [ "vcenters" ], "summary": "List vCenters", "responses": { "200": { "description": "HTML page", "schema": { "type": "string" } } } } }, "/vcenters/totals": { "get": { "description": "Shows per-snapshot totals for a vCenter.", "produces": [ "text/html" ], "tags": [ "vcenters" ], "summary": "vCenter totals", "parameters": [ { "type": "string", "description": "vCenter URL", "name": "vcenter", "in": "query", "required": true }, { "type": "string", "description": "hourly|daily|monthly (default: hourly)", "name": "type", "in": "query" }, { "type": "integer", "description": "Limit results (default 200)", "name": "limit", "in": "query" } ], "responses": { "200": { "description": "HTML page", "schema": { "type": "string" } }, "400": { "description": "Missing vcenter", "schema": { "type": "string" } } } } }, "/vm/trace": { "get": { "description": "Shows VM resource history across snapshots, with chart and table.", "produces": [ "text/html" ], "tags": [ "vm" ], "summary": "Trace VM history", "parameters": [ { "type": "string", "description": "VM ID", "name": "vm_id", "in": "query" }, { "type": "string", "description": "VM UUID", "name": "vm_uuid", "in": "query" }, { "type": "string", "description": "VM name", "name": "name", "in": "query" } ], "responses": { "200": { "description": "HTML page", "schema": { "type": "string" } }, "400": { "description": "Missing identifier", "schema": { "type": "string" } } } } } }, "definitions": { "models.CloudEventReceived": { "type": "object", "properties": { "cloudEvent": { "type": "object", "properties": { "data": { "type": "object", "properties": { "ChainId": { "type": "integer" }, "ChangeTag": { "type": "string" }, "ComputeResource": { "type": "object", "properties": { "ComputeResource": { "type": "object", "properties": { "Type": { "type": "string" }, "Value": { "type": "string" } } }, "Name": { "type": "string" } } }, "CreatedTime": { "description": "Modified from time.Time", "type": "string" }, "Datacenter": { "type": "object", "properties": { "Datacenter": { "type": "object", "properties": { "Type": { "type": "string" }, "Value": { "type": "string" } } }, "Name": { "type": "string" } } }, "Ds": {}, "Dvs": {}, "FullFormattedMessage": { "type": "string" }, "Host": { "type": "object", "properties": { "Host": { "type": "object", "properties": { "Type": { "type": "string" }, "Value": { "type": "string" } } }, "Name": { "type": "string" } } }, "Key": { "type": "integer" }, "Net": {}, "NewParent": { "$ref": "#/definitions/models.CloudEventResourcePool" }, "OldParent": { "$ref": "#/definitions/models.CloudEventResourcePool" }, "SrcTemplate": { "$ref": "#/definitions/models.CloudEventVm" }, "Template": { "type": "boolean" }, "UserName": { "type": "string" }, "Vm": { "type": "object", "properties": { "Name": { "type": "string" }, "Vm": { "type": "object", "properties": { "Type": { "type": "string" }, "Value": { "type": "string" } } } } }, "configChanges": { "description": "Modified to separate struct", "allOf": [ { "$ref": "#/definitions/models.ConfigChangesReceived" } ] }, "configSpec": { "type": "object" } } }, "id": { "type": "string" }, "source": { "type": "string" }, "specversion": { "type": "string" }, "time": { "description": "Modified from time.Time", "type": "string" }, "type": { "type": "string" } } } } }, "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.ConfigChangesReceived": { "type": "object", "properties": { "modified": { "type": "string" } } }, "models.DailyCreationDiagnosticsResponse": { "type": "object", "properties": { "avg_is_present_lt_one_count": { "type": "integer" }, "date": { "type": "string" }, "missing_by_vcenter": { "type": "array", "items": { "$ref": "#/definitions/models.DailyCreationMissingByVcenter" } }, "missing_creation_count": { "type": "integer" }, "missing_creation_partial_count": { "type": "integer" }, "missing_creation_partial_samples": { "type": "array", "items": { "$ref": "#/definitions/models.DailyCreationMissingSample" } }, "missing_creation_pct": { "type": "number" }, "samples": { "type": "array", "items": { "$ref": "#/definitions/models.DailyCreationMissingSample" } }, "status": { "type": "string" }, "table": { "type": "string" }, "total_rows": { "type": "integer" } } }, "models.DailyCreationMissingByVcenter": { "type": "object", "properties": { "missing_count": { "type": "integer" }, "vcenter": { "type": "string" } } }, "models.DailyCreationMissingSample": { "type": "object", "properties": { "avg_is_present": { "type": "number" }, "name": { "type": "string" }, "samples_present": { "type": "integer" }, "snapshot_time": { "type": "integer" }, "vcenter": { "type": "string" }, "vm_id": { "type": "string" }, "vm_uuid": { "type": "string" } } }, "models.ErrorResponse": { "type": "object", "properties": { "message": { "type": "string" }, "status": { "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" } } }, "models.SnapshotMigrationResponse": { "type": "object", "properties": { "error": { "type": "string" }, "stats": { "$ref": "#/definitions/models.SnapshotMigrationStats" }, "status": { "type": "string" } } }, "models.SnapshotMigrationStats": { "type": "object", "properties": { "DailyRegistered": { "type": "integer" }, "Errors": { "type": "integer" }, "HourlyRegistered": { "type": "integer" }, "HourlyRenamed": { "type": "integer" }, "MonthlyRegistered": { "type": "integer" } } }, "models.SnapshotRegenerateReportsResponse": { "type": "object", "properties": { "errors": { "type": "integer" }, "regenerated": { "type": "integer" }, "reports_dir": { "type": "string" }, "skipped": { "type": "integer" }, "snapshotType": { "type": "string" }, "status": { "type": "string" }, "total": { "type": "integer" } } }, "models.SnapshotRepairResponse": { "type": "object", "properties": { "failed": { "type": "string" }, "repaired": { "type": "string" }, "status": { "type": "string" } } }, "models.SnapshotRepairSuiteResponse": { "type": "object", "properties": { "daily_failed": { "type": "string" }, "daily_repaired": { "type": "string" }, "monthly_failed": { "type": "string" }, "monthly_refined": { "type": "string" }, "status": { "type": "string" } } }, "models.StatusMessageResponse": { "type": "object", "properties": { "message": { "type": "string" }, "status": { "type": "string" } } }, "models.StatusResponse": { "type": "object", "properties": { "status": { "type": "string" } } } } }