From f34f502660d9be2d693f55e37f3d6eb3bb6e9a9d Mon Sep 17 00:00:00 2001 From: yusing Date: Thu, 4 Sep 2025 06:41:04 +0800 Subject: [PATCH] chore(swagger): updated swagger docs --- internal/api/v1/docs/docs.go | 776 +++++++++++++++++++------ internal/api/v1/docs/swagger.json | 923 ++++++++++++++++++++++-------- internal/api/v1/docs/swagger.yaml | 539 +++++++++++++---- 3 files changed, 1684 insertions(+), 554 deletions(-) diff --git a/internal/api/v1/docs/docs.go b/internal/api/v1/docs/docs.go index 61471902..3da3bf2b 100644 --- a/internal/api/v1/docs/docs.go +++ b/internal/api/v1/docs/docs.go @@ -176,54 +176,6 @@ const docTemplate = `{ } }, "/auth/callback": { - "get": { - "description": "Handles the callback from the provider after successful authentication", - "produces": [ - "text/plain" - ], - "tags": [ - "auth" - ], - "summary": "Auth Callback", - "parameters": [ - { - "description": "Userpass only", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/auth.UserPassAuthCallbackRequest" - } - } - ], - "responses": { - "200": { - "description": "Userpass: OK", - "schema": { - "type": "string" - } - }, - "302": { - "description": "OIDC: Redirects to home page", - "schema": { - "type": "string" - } - }, - "400": { - "description": "Userpass: invalid request / credentials", - "schema": { - "type": "string" - } - }, - "500": { - "description": "Internal server error", - "schema": { - "type": "string" - } - } - }, - "x-id": "callback" - }, "post": { "description": "Handles the callback from the provider after successful authentication", "produces": [ @@ -427,6 +379,48 @@ const docTemplate = `{ "x-id": "renew" } }, + "/docker/container/{id}": { + "get": { + "description": "Get container by container id", + "produces": [ + "application/json" + ], + "tags": [ + "docker" + ], + "summary": "Get container", + "parameters": [ + { + "type": "string", + "description": "Container ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ContainerResponse" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-id": "container" + } + }, "/docker/containers": { "get": { "description": "Get containers", @@ -496,9 +490,9 @@ const docTemplate = `{ "x-id": "info" } }, - "/docker/logs/{server}/{container}": { + "/docker/logs/{id}": { "get": { - "description": "Get docker container logs", + "description": "Get docker container logs by container id", "consumes": [ "application/json" ], @@ -511,17 +505,10 @@ const docTemplate = `{ ], "summary": "Get docker container logs", "parameters": [ - { - "type": "string", - "description": "server name", - "name": "server", - "in": "path", - "required": true - }, { "type": "string", "description": "container id", - "name": "container", + "name": "id", "in": "path", "required": true }, @@ -983,6 +970,12 @@ const docTemplate = `{ ], "summary": "Homepage items", "parameters": [ + { + "type": "string", + "description": "Search query", + "name": "search", + "in": "query" + }, { "type": "string", "description": "Category filter", @@ -1000,7 +993,10 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/HomepageItems" + "type": "array", + "items": { + "$ref": "#/definitions/HomepageCategory" + } } }, "400": { @@ -1113,6 +1109,194 @@ const docTemplate = `{ "x-id": "set-item" } }, + "/homepage/set/item_all_sort_order": { + "post": { + "description": "Set homepage item all sort order.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "homepage" + ], + "summary": "Set homepage item all sort order", + "parameters": [ + { + "description": "Set item all sort order", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/HomepageOverrideItemAllSortOrderParams" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/SuccessResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-id": "set-item-all-sort-order" + } + }, + "/homepage/set/item_fav_sort_order": { + "post": { + "description": "Set homepage item fav sort order.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "homepage" + ], + "summary": "Set homepage item fav sort order", + "parameters": [ + { + "description": "Set item fav sort order", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/HomepageOverrideItemFavSortOrderParams" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/SuccessResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-id": "set-item-fav-sort-order" + } + }, + "/homepage/set/item_favorite": { + "post": { + "description": "Set homepage item favorite.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "homepage" + ], + "summary": "Set homepage item favorite", + "parameters": [ + { + "description": "Set item favorite", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/HomepageOverrideItemFavoriteParams" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/SuccessResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-id": "set-item-favorite" + } + }, + "/homepage/set/item_sort_order": { + "post": { + "description": "Set homepage item sort order.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "homepage" + ], + "summary": "Set homepage item sort order", + "parameters": [ + { + "description": "Set item sort order", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/HomepageOverrideItemSortOrderParams" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/SuccessResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-id": "set-item-sort-order" + } + }, "/homepage/set/item_visible": { "post": { "description": "POST list of item ids and visibility value.", @@ -1260,6 +1444,105 @@ const docTemplate = `{ "x-id": "icons" } }, + "/metrics/all_system_info": { + "get": { + "description": "Get system info", + "produces": [ + "application/json" + ], + "tags": [ + "metrics", + "websocket" + ], + "summary": "Get system info", + "parameters": [ + { + "enum": [ + "cpu_average", + "memory_usage", + "memory_usage_percent", + "disks_read_speed", + "disks_write_speed", + "disks_iops", + "disk_usage", + "network_speed", + "network_transfer", + "sensor_temperature" + ], + "type": "string", + "x-enum-varnames": [ + "SystemInfoAggregateModeCPUAverage", + "SystemInfoAggregateModeMemoryUsage", + "SystemInfoAggregateModeMemoryUsagePercent", + "SystemInfoAggregateModeDisksReadSpeed", + "SystemInfoAggregateModeDisksWriteSpeed", + "SystemInfoAggregateModeDisksIOPS", + "SystemInfoAggregateModeDiskUsage", + "SystemInfoAggregateModeNetworkSpeed", + "SystemInfoAggregateModeNetworkTransfer", + "SystemInfoAggregateModeSensorTemperature" + ], + "name": "aggregate", + "in": "query" + }, + { + "type": "string", + "format": "duration", + "name": "interval", + "in": "query" + }, + { + "enum": [ + "5m", + "15m", + "1h", + "1d", + "1mo" + ], + "type": "string", + "x-enum-varnames": [ + "MetricsPeriod5m", + "MetricsPeriod15m", + "MetricsPeriod1h", + "MetricsPeriod1d", + "MetricsPeriod1mo" + ], + "name": "period", + "in": "query" + } + ], + "responses": { + "200": { + "description": "period specified, aggregated system info by agent name", + "schema": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/SystemInfoAggregate" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-id": "all_system_info" + } + }, "/metrics/system_info": { "get": { "description": "Get system info", @@ -1277,6 +1560,11 @@ const docTemplate = `{ "name": "agentAddr", "in": "query" }, + { + "type": "string", + "name": "agentName", + "in": "query" + }, { "enum": [ "cpu_average", @@ -1345,12 +1633,6 @@ const docTemplate = `{ "$ref": "#/definitions/ErrorResponse" } }, - "404": { - "description": "Not Found", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, "500": { "description": "Internal Server Error", "schema": { @@ -1723,9 +2005,6 @@ const docTemplate = `{ "addr": { "type": "string" }, - "is_nerdctl": { - "type": "boolean" - }, "name": { "type": "string" }, @@ -1864,6 +2143,9 @@ const docTemplate = `{ }, "running": { "type": "boolean" + }, + "state": { + "$ref": "#/definitions/container.ContainerState" } } }, @@ -1903,7 +2185,12 @@ const docTemplate = `{ "type": "string" }, "state": { - "$ref": "#/definitions/ContainerState" + "allOf": [ + { + "$ref": "#/definitions/ContainerState" + } + ], + "x-nullable": true } } }, @@ -2125,12 +2412,125 @@ const docTemplate = `{ "$ref": "#/definitions/routes.HealthInfo" } }, - "HomepageItems": { + "HomepageCategory": { "type": "object", - "additionalProperties": { - "type": "array", + "properties": { "items": { - "$ref": "#/definitions/homepage.Item" + "type": "array", + "items": { + "$ref": "#/definitions/HomepageItem" + } + }, + "name": { + "type": "string" + } + } + }, + "HomepageItem": { + "type": "object", + "properties": { + "alias": { + "type": "string" + }, + "all_sort_order": { + "description": "sort order in all", + "type": "integer" + }, + "category": { + "type": "string" + }, + "description": { + "type": "string" + }, + "fav_sort_order": { + "description": "sort order in favorite", + "type": "integer" + }, + "favorite": { + "type": "boolean" + }, + "icon": { + "type": "string" + }, + "name": { + "description": "display name", + "type": "string" + }, + "origin_url": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "show": { + "type": "boolean" + }, + "sort_order": { + "description": "sort order in category", + "type": "integer" + }, + "url": { + "type": "string" + }, + "widget_config": { + "allOf": [ + { + "$ref": "#/definitions/widgets.Config" + } + ], + "x-nullable": true + }, + "widgets": { + "type": "array", + "items": { + "$ref": "#/definitions/HomepageItemWidget" + } + } + } + }, + "HomepageItemConfig": { + "type": "object", + "properties": { + "category": { + "type": "string" + }, + "description": { + "type": "string" + }, + "favorite": { + "type": "boolean" + }, + "icon": { + "type": "string" + }, + "name": { + "description": "display name", + "type": "string" + }, + "show": { + "type": "boolean" + }, + "url": { + "type": "string" + }, + "widget_config": { + "allOf": [ + { + "$ref": "#/definitions/widgets.Config" + } + ], + "x-nullable": true + } + } + }, + "HomepageItemWidget": { + "type": "object", + "properties": { + "label": { + "type": "string" + }, + "value": { + "type": "string" } } }, @@ -2145,11 +2545,58 @@ const docTemplate = `{ } } }, + "HomepageOverrideItemAllSortOrderParams": { + "type": "object", + "properties": { + "value": { + "type": "integer" + }, + "which": { + "type": "string" + } + } + }, + "HomepageOverrideItemFavSortOrderParams": { + "type": "object", + "properties": { + "value": { + "type": "integer" + }, + "which": { + "type": "string" + } + } + }, + "HomepageOverrideItemFavoriteParams": { + "type": "object", + "properties": { + "value": { + "type": "boolean" + }, + "which": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "HomepageOverrideItemParams": { "type": "object", "properties": { "value": { - "$ref": "#/definitions/homepage.ItemConfig" + "$ref": "#/definitions/HomepageItemConfig" + }, + "which": { + "type": "string" + } + } + }, + "HomepageOverrideItemSortOrderParams": { + "type": "object", + "properties": { + "value": { + "type": "integer" }, "which": { "type": "string" @@ -2176,7 +2623,7 @@ const docTemplate = `{ "value": { "type": "object", "additionalProperties": { - "$ref": "#/definitions/homepage.ItemConfig" + "$ref": "#/definitions/HomepageItemConfig" } } } @@ -2388,18 +2835,6 @@ const docTemplate = `{ "type" ], "properties": { - "container_runtime": { - "enum": [ - "docker", - "podman", - "nerdctl" - ], - "allOf": [ - { - "$ref": "#/definitions/agent.ContainerRuntime" - } - ] - }, "host": { "type": "string" }, @@ -2580,7 +3015,12 @@ const docTemplate = `{ "type": "boolean" }, "excluded": { - "type": "boolean" + "type": "boolean", + "x-nullable": true + }, + "excluded_reason": { + "type": "string", + "x-nullable": true }, "health": { "description": "for swagger", @@ -2594,7 +3034,7 @@ const docTemplate = `{ "$ref": "#/definitions/HealthCheckConfig" }, "homepage": { - "$ref": "#/definitions/homepage.ItemConfig" + "$ref": "#/definitions/HomepageItemConfig" }, "host": { "type": "string" @@ -2744,6 +3184,16 @@ const docTemplate = `{ "avg_latency": { "type": "number" }, + "current_status": { + "type": "string", + "enum": [ + "healthy", + "unhealthy", + "unknown", + "napping", + "starting" + ] + }, "display_name": { "type": "string" }, @@ -2753,6 +3203,9 @@ const docTemplate = `{ "idle": { "type": "number" }, + "is_docker": { + "type": "boolean" + }, "statuses": { "type": "array", "items": { @@ -2925,9 +3378,6 @@ const docTemplate = `{ "client": { "$ref": "#/definitions/PEMPairResponse" }, - "container_runtime": { - "$ref": "#/definitions/agent.ContainerRuntime" - }, "host": { "type": "string" } @@ -3008,19 +3458,6 @@ const docTemplate = `{ } } }, - "agent.ContainerRuntime": { - "type": "string", - "enum": [ - "docker", - "podman", - "nerdctl" - ], - "x-enum-varnames": [ - "ContainerRuntimeDocker", - "ContainerRuntimePodman", - "ContainerRuntimeNerdctl" - ] - }, "auth.UserPassAuthCallbackRequest": { "type": "object", "properties": { @@ -3032,6 +3469,45 @@ const docTemplate = `{ } } }, + "container.ContainerState": { + "type": "string", + "enum": [ + "created", + "running", + "paused", + "restarting", + "removing", + "exited", + "dead" + ], + "x-enum-comments": { + "StateCreated": "StateCreated indicates the container is created, but not (yet) started.", + "StateDead": "StateDead indicates that the container failed to be deleted. Containers in this state are attempted to be cleaned up when the daemon restarts.", + "StateExited": "StateExited indicates that the container exited.", + "StatePaused": "StatePaused indicates that the container's current state is paused.", + "StateRemoving": "StateRemoving indicates that the container is being removed.", + "StateRestarting": "StateRestarting indicates that the container is currently restarting.", + "StateRunning": "StateRunning indicates that the container is running." + }, + "x-enum-descriptions": [ + "StateCreated indicates the container is created, but not (yet) started.", + "StateRunning indicates that the container is running.", + "StatePaused indicates that the container's current state is paused.", + "StateRestarting indicates that the container is currently restarting.", + "StateRemoving indicates that the container is being removed.", + "StateExited indicates that the container exited.", + "StateDead indicates that the container failed to be deleted. Containers in this state are attempted to be cleaned up when the daemon restarts." + ], + "x-enum-varnames": [ + "StateCreated", + "StateRunning", + "StatePaused", + "StateRestarting", + "StateRemoving", + "StateExited", + "StateDead" + ] + }, "container.Port": { "type": "object", "properties": { @@ -3169,77 +3645,6 @@ const docTemplate = `{ "IconSourceSelfhSt" ] }, - "homepage.Item": { - "type": "object", - "properties": { - "alias": { - "type": "string" - }, - "category": { - "type": "string" - }, - "description": { - "type": "string" - }, - "icon": { - "type": "string" - }, - "name": { - "description": "display name", - "type": "string" - }, - "origin_url": { - "type": "string" - }, - "provider": { - "type": "string" - }, - "show": { - "type": "boolean" - }, - "sort_order": { - "type": "integer" - }, - "url": { - "type": "string" - }, - "widget_config": { - "allOf": [ - { - "$ref": "#/definitions/widgets.Config" - } - ], - "x-nullable": true - } - } - }, - "homepage.ItemConfig": { - "type": "object", - "properties": { - "category": { - "type": "string" - }, - "description": { - "type": "string" - }, - "icon": { - "type": "string" - }, - "name": { - "description": "display name", - "type": "string" - }, - "show": { - "type": "boolean" - }, - "sort_order": { - "type": "integer" - }, - "url": { - "type": "string" - } - } - }, "mem.VirtualMemoryStat": { "type": "object", "properties": { @@ -3327,7 +3732,12 @@ const docTemplate = `{ "type": "boolean" }, "excluded": { - "type": "boolean" + "type": "boolean", + "x-nullable": true + }, + "excluded_reason": { + "type": "string", + "x-nullable": true }, "health": { "description": "for swagger", @@ -3341,7 +3751,7 @@ const docTemplate = `{ "$ref": "#/definitions/HealthCheckConfig" }, "homepage": { - "$ref": "#/definitions/homepage.ItemConfig" + "$ref": "#/definitions/HomepageItemConfig" }, "host": { "type": "string" @@ -3466,26 +3876,20 @@ const docTemplate = `{ } } }, - "rules.Command": { - "type": "object" - }, "rules.Rule": { "type": "object", "properties": { "do": { - "$ref": "#/definitions/rules.Command" + "type": "string" }, "name": { "type": "string" }, "on": { - "$ref": "#/definitions/rules.RuleOn" + "type": "string" } } }, - "rules.RuleOn": { - "type": "object" - }, "sensors.TemperatureStat": { "type": "object", "properties": { diff --git a/internal/api/v1/docs/swagger.json b/internal/api/v1/docs/swagger.json index 988319df..d9b8b827 100644 --- a/internal/api/v1/docs/swagger.json +++ b/internal/api/v1/docs/swagger.json @@ -172,55 +172,6 @@ } }, "/auth/callback": { - "get": { - "description": "Handles the callback from the provider after successful authentication", - "produces": [ - "text/plain" - ], - "tags": [ - "auth" - ], - "summary": "Auth Callback", - "parameters": [ - { - "description": "Userpass only", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/auth.UserPassAuthCallbackRequest" - } - } - ], - "responses": { - "200": { - "description": "Userpass: OK", - "schema": { - "type": "string" - } - }, - "302": { - "description": "OIDC: Redirects to home page", - "schema": { - "type": "string" - } - }, - "400": { - "description": "Userpass: invalid request / credentials", - "schema": { - "type": "string" - } - }, - "500": { - "description": "Internal server error", - "schema": { - "type": "string" - } - } - }, - "x-id": "callback", - "operationId": "callback" - }, "post": { "description": "Handles the callback from the provider after successful authentication", "produces": [ @@ -430,6 +381,49 @@ "operationId": "renew" } }, + "/docker/container/{id}": { + "get": { + "description": "Get container by container id", + "produces": [ + "application/json" + ], + "tags": [ + "docker" + ], + "summary": "Get container", + "parameters": [ + { + "type": "string", + "description": "Container ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/ContainerResponse" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-id": "container", + "operationId": "container" + } + }, "/docker/containers": { "get": { "description": "Get containers", @@ -501,9 +495,9 @@ "operationId": "info" } }, - "/docker/logs/{server}/{container}": { + "/docker/logs/{id}": { "get": { - "description": "Get docker container logs", + "description": "Get docker container logs by container id", "consumes": [ "application/json" ], @@ -516,17 +510,10 @@ ], "summary": "Get docker container logs", "parameters": [ - { - "type": "string", - "description": "server name", - "name": "server", - "in": "path", - "required": true - }, { "type": "string", "description": "container id", - "name": "container", + "name": "id", "in": "path", "required": true }, @@ -996,6 +983,12 @@ ], "summary": "Homepage items", "parameters": [ + { + "type": "string", + "description": "Search query", + "name": "search", + "in": "query" + }, { "type": "string", "description": "Category filter", @@ -1013,7 +1006,10 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/HomepageItems" + "type": "array", + "items": { + "$ref": "#/definitions/HomepageCategory" + } } }, "400": { @@ -1129,6 +1125,198 @@ "operationId": "set-item" } }, + "/homepage/set/item_all_sort_order": { + "post": { + "description": "Set homepage item all sort order.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "homepage" + ], + "summary": "Set homepage item all sort order", + "parameters": [ + { + "description": "Set item all sort order", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/HomepageOverrideItemAllSortOrderParams" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/SuccessResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-id": "set-item-all-sort-order", + "operationId": "set-item-all-sort-order" + } + }, + "/homepage/set/item_fav_sort_order": { + "post": { + "description": "Set homepage item fav sort order.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "homepage" + ], + "summary": "Set homepage item fav sort order", + "parameters": [ + { + "description": "Set item fav sort order", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/HomepageOverrideItemFavSortOrderParams" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/SuccessResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-id": "set-item-fav-sort-order", + "operationId": "set-item-fav-sort-order" + } + }, + "/homepage/set/item_favorite": { + "post": { + "description": "Set homepage item favorite.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "homepage" + ], + "summary": "Set homepage item favorite", + "parameters": [ + { + "description": "Set item favorite", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/HomepageOverrideItemFavoriteParams" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/SuccessResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-id": "set-item-favorite", + "operationId": "set-item-favorite" + } + }, + "/homepage/set/item_sort_order": { + "post": { + "description": "Set homepage item sort order.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "homepage" + ], + "summary": "Set homepage item sort order", + "parameters": [ + { + "description": "Set item sort order", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/HomepageOverrideItemSortOrderParams" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/SuccessResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-id": "set-item-sort-order", + "operationId": "set-item-sort-order" + } + }, "/homepage/set/item_visible": { "post": { "description": "POST list of item ids and visibility value.", @@ -1279,6 +1467,106 @@ "operationId": "icons" } }, + "/metrics/all_system_info": { + "get": { + "description": "Get system info", + "produces": [ + "application/json" + ], + "tags": [ + "metrics", + "websocket" + ], + "summary": "Get system info", + "parameters": [ + { + "enum": [ + "cpu_average", + "memory_usage", + "memory_usage_percent", + "disks_read_speed", + "disks_write_speed", + "disks_iops", + "disk_usage", + "network_speed", + "network_transfer", + "sensor_temperature" + ], + "type": "string", + "x-enum-varnames": [ + "SystemInfoAggregateModeCPUAverage", + "SystemInfoAggregateModeMemoryUsage", + "SystemInfoAggregateModeMemoryUsagePercent", + "SystemInfoAggregateModeDisksReadSpeed", + "SystemInfoAggregateModeDisksWriteSpeed", + "SystemInfoAggregateModeDisksIOPS", + "SystemInfoAggregateModeDiskUsage", + "SystemInfoAggregateModeNetworkSpeed", + "SystemInfoAggregateModeNetworkTransfer", + "SystemInfoAggregateModeSensorTemperature" + ], + "name": "aggregate", + "in": "query" + }, + { + "type": "string", + "format": "duration", + "name": "interval", + "in": "query" + }, + { + "enum": [ + "5m", + "15m", + "1h", + "1d", + "1mo" + ], + "type": "string", + "x-enum-varnames": [ + "MetricsPeriod5m", + "MetricsPeriod15m", + "MetricsPeriod1h", + "MetricsPeriod1d", + "MetricsPeriod1mo" + ], + "name": "period", + "in": "query" + } + ], + "responses": { + "200": { + "description": "period specified, aggregated system info by agent name", + "schema": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/SystemInfoAggregate" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-id": "all_system_info", + "operationId": "all_system_info" + } + }, "/metrics/system_info": { "get": { "description": "Get system info", @@ -1296,6 +1584,11 @@ "name": "agentAddr", "in": "query" }, + { + "type": "string", + "name": "agentName", + "in": "query" + }, { "enum": [ "cpu_average", @@ -1364,12 +1657,6 @@ "$ref": "#/definitions/ErrorResponse" } }, - "404": { - "description": "Not Found", - "schema": { - "$ref": "#/definitions/ErrorResponse" - } - }, "500": { "description": "Internal Server Error", "schema": { @@ -1753,11 +2040,6 @@ "x-nullable": false, "x-omitempty": false }, - "is_nerdctl": { - "type": "boolean", - "x-nullable": false, - "x-omitempty": false - }, "name": { "type": "string", "x-nullable": false, @@ -1960,6 +2242,11 @@ "type": "boolean", "x-nullable": false, "x-omitempty": false + }, + "state": { + "$ref": "#/definitions/container.ContainerState", + "x-nullable": false, + "x-omitempty": false } }, "x-nullable": false, @@ -2021,9 +2308,12 @@ "x-omitempty": false }, "state": { - "$ref": "#/definitions/ContainerState", - "x-nullable": false, - "x-omitempty": false + "allOf": [ + { + "$ref": "#/definitions/ContainerState" + } + ], + "x-nullable": true } }, "x-nullable": false, @@ -2331,12 +2621,181 @@ "x-nullable": false, "x-omitempty": false }, - "HomepageItems": { + "HomepageCategory": { "type": "object", - "additionalProperties": { - "type": "array", + "properties": { "items": { - "$ref": "#/definitions/homepage.Item" + "type": "array", + "items": { + "$ref": "#/definitions/HomepageItem" + }, + "x-nullable": false, + "x-omitempty": false + }, + "name": { + "type": "string", + "x-nullable": false, + "x-omitempty": false + } + }, + "x-nullable": false, + "x-omitempty": false + }, + "HomepageItem": { + "type": "object", + "properties": { + "alias": { + "type": "string", + "x-nullable": false, + "x-omitempty": false + }, + "all_sort_order": { + "description": "sort order in all", + "type": "integer", + "x-nullable": false, + "x-omitempty": false + }, + "category": { + "type": "string", + "x-nullable": false, + "x-omitempty": false + }, + "description": { + "type": "string", + "x-nullable": false, + "x-omitempty": false + }, + "fav_sort_order": { + "description": "sort order in favorite", + "type": "integer", + "x-nullable": false, + "x-omitempty": false + }, + "favorite": { + "type": "boolean", + "x-nullable": false, + "x-omitempty": false + }, + "icon": { + "type": "string", + "x-nullable": false, + "x-omitempty": false + }, + "name": { + "description": "display name", + "type": "string", + "x-nullable": false, + "x-omitempty": false + }, + "origin_url": { + "type": "string", + "x-nullable": false, + "x-omitempty": false + }, + "provider": { + "type": "string", + "x-nullable": false, + "x-omitempty": false + }, + "show": { + "type": "boolean", + "x-nullable": false, + "x-omitempty": false + }, + "sort_order": { + "description": "sort order in category", + "type": "integer", + "x-nullable": false, + "x-omitempty": false + }, + "url": { + "type": "string", + "x-nullable": false, + "x-omitempty": false + }, + "widget_config": { + "allOf": [ + { + "$ref": "#/definitions/widgets.Config" + } + ], + "x-nullable": true + }, + "widgets": { + "type": "array", + "items": { + "$ref": "#/definitions/HomepageItemWidget" + }, + "x-nullable": false, + "x-omitempty": false + } + }, + "x-nullable": false, + "x-omitempty": false + }, + "HomepageItemConfig": { + "type": "object", + "properties": { + "category": { + "type": "string", + "x-nullable": false, + "x-omitempty": false + }, + "description": { + "type": "string", + "x-nullable": false, + "x-omitempty": false + }, + "favorite": { + "type": "boolean", + "x-nullable": false, + "x-omitempty": false + }, + "icon": { + "type": "string", + "x-nullable": false, + "x-omitempty": false + }, + "name": { + "description": "display name", + "type": "string", + "x-nullable": false, + "x-omitempty": false + }, + "show": { + "type": "boolean", + "x-nullable": false, + "x-omitempty": false + }, + "url": { + "type": "string", + "x-nullable": false, + "x-omitempty": false + }, + "widget_config": { + "allOf": [ + { + "$ref": "#/definitions/widgets.Config" + } + ], + "x-nullable": true + } + }, + "x-nullable": false, + "x-omitempty": false + }, + "HomepageItemWidget": { + "type": "object", + "properties": { + "label": { + "type": "string", + "x-nullable": false, + "x-omitempty": false + }, + "value": { + "type": "string", + "x-nullable": false, + "x-omitempty": false } }, "x-nullable": false, @@ -2359,11 +2818,82 @@ "x-nullable": false, "x-omitempty": false }, + "HomepageOverrideItemAllSortOrderParams": { + "type": "object", + "properties": { + "value": { + "type": "integer", + "x-nullable": false, + "x-omitempty": false + }, + "which": { + "type": "string", + "x-nullable": false, + "x-omitempty": false + } + }, + "x-nullable": false, + "x-omitempty": false + }, + "HomepageOverrideItemFavSortOrderParams": { + "type": "object", + "properties": { + "value": { + "type": "integer", + "x-nullable": false, + "x-omitempty": false + }, + "which": { + "type": "string", + "x-nullable": false, + "x-omitempty": false + } + }, + "x-nullable": false, + "x-omitempty": false + }, + "HomepageOverrideItemFavoriteParams": { + "type": "object", + "properties": { + "value": { + "type": "boolean", + "x-nullable": false, + "x-omitempty": false + }, + "which": { + "type": "array", + "items": { + "type": "string" + }, + "x-nullable": false, + "x-omitempty": false + } + }, + "x-nullable": false, + "x-omitempty": false + }, "HomepageOverrideItemParams": { "type": "object", "properties": { "value": { - "$ref": "#/definitions/homepage.ItemConfig", + "$ref": "#/definitions/HomepageItemConfig", + "x-nullable": false, + "x-omitempty": false + }, + "which": { + "type": "string", + "x-nullable": false, + "x-omitempty": false + } + }, + "x-nullable": false, + "x-omitempty": false + }, + "HomepageOverrideItemSortOrderParams": { + "type": "object", + "properties": { + "value": { + "type": "integer", "x-nullable": false, "x-omitempty": false }, @@ -2402,7 +2932,7 @@ "value": { "type": "object", "additionalProperties": { - "$ref": "#/definitions/homepage.ItemConfig" + "$ref": "#/definitions/HomepageItemConfig" }, "x-nullable": false, "x-omitempty": false @@ -2698,20 +3228,6 @@ "type" ], "properties": { - "container_runtime": { - "enum": [ - "docker", - "podman", - "nerdctl" - ], - "allOf": [ - { - "$ref": "#/definitions/agent.ContainerRuntime" - } - ], - "x-nullable": false, - "x-omitempty": false - }, "host": { "type": "string", "x-nullable": false, @@ -2971,8 +3487,11 @@ }, "excluded": { "type": "boolean", - "x-nullable": false, - "x-omitempty": false + "x-nullable": true + }, + "excluded_reason": { + "type": "string", + "x-nullable": true }, "health": { "description": "for swagger", @@ -2990,7 +3509,7 @@ "x-omitempty": false }, "homepage": { - "$ref": "#/definitions/homepage.ItemConfig", + "$ref": "#/definitions/HomepageItemConfig", "x-nullable": false, "x-omitempty": false }, @@ -3198,6 +3717,18 @@ "x-nullable": false, "x-omitempty": false }, + "current_status": { + "type": "string", + "enum": [ + "healthy", + "unhealthy", + "unknown", + "napping", + "starting" + ], + "x-nullable": false, + "x-omitempty": false + }, "display_name": { "type": "string", "x-nullable": false, @@ -3213,6 +3744,11 @@ "x-nullable": false, "x-omitempty": false }, + "is_docker": { + "type": "boolean", + "x-nullable": false, + "x-omitempty": false + }, "statuses": { "type": "array", "items": { @@ -3455,11 +3991,6 @@ "x-nullable": false, "x-omitempty": false }, - "container_runtime": { - "$ref": "#/definitions/agent.ContainerRuntime", - "x-nullable": false, - "x-omitempty": false - }, "host": { "type": "string", "x-nullable": false, @@ -3572,21 +4103,6 @@ "x-nullable": false, "x-omitempty": false }, - "agent.ContainerRuntime": { - "type": "string", - "enum": [ - "docker", - "podman", - "nerdctl" - ], - "x-enum-varnames": [ - "ContainerRuntimeDocker", - "ContainerRuntimePodman", - "ContainerRuntimeNerdctl" - ], - "x-nullable": false, - "x-omitempty": false - }, "auth.UserPassAuthCallbackRequest": { "type": "object", "properties": { @@ -3604,6 +4120,47 @@ "x-nullable": false, "x-omitempty": false }, + "container.ContainerState": { + "type": "string", + "enum": [ + "created", + "running", + "paused", + "restarting", + "removing", + "exited", + "dead" + ], + "x-enum-comments": { + "StateCreated": "StateCreated indicates the container is created, but not (yet) started.", + "StateDead": "StateDead indicates that the container failed to be deleted. Containers in this state are attempted to be cleaned up when the daemon restarts.", + "StateExited": "StateExited indicates that the container exited.", + "StatePaused": "StatePaused indicates that the container's current state is paused.", + "StateRemoving": "StateRemoving indicates that the container is being removed.", + "StateRestarting": "StateRestarting indicates that the container is currently restarting.", + "StateRunning": "StateRunning indicates that the container is running." + }, + "x-enum-descriptions": [ + "StateCreated indicates the container is created, but not (yet) started.", + "StateRunning indicates that the container is running.", + "StatePaused indicates that the container's current state is paused.", + "StateRestarting indicates that the container is currently restarting.", + "StateRemoving indicates that the container is being removed.", + "StateExited indicates that the container exited.", + "StateDead indicates that the container failed to be deleted. Containers in this state are attempted to be cleaned up when the daemon restarts." + ], + "x-enum-varnames": [ + "StateCreated", + "StateRunning", + "StatePaused", + "StateRestarting", + "StateRemoving", + "StateExited", + "StateDead" + ], + "x-nullable": false, + "x-omitempty": false + }, "container.Port": { "type": "object", "properties": { @@ -3809,115 +4366,6 @@ "x-nullable": false, "x-omitempty": false }, - "homepage.Item": { - "type": "object", - "properties": { - "alias": { - "type": "string", - "x-nullable": false, - "x-omitempty": false - }, - "category": { - "type": "string", - "x-nullable": false, - "x-omitempty": false - }, - "description": { - "type": "string", - "x-nullable": false, - "x-omitempty": false - }, - "icon": { - "type": "string", - "x-nullable": false, - "x-omitempty": false - }, - "name": { - "description": "display name", - "type": "string", - "x-nullable": false, - "x-omitempty": false - }, - "origin_url": { - "type": "string", - "x-nullable": false, - "x-omitempty": false - }, - "provider": { - "type": "string", - "x-nullable": false, - "x-omitempty": false - }, - "show": { - "type": "boolean", - "x-nullable": false, - "x-omitempty": false - }, - "sort_order": { - "type": "integer", - "x-nullable": false, - "x-omitempty": false - }, - "url": { - "type": "string", - "x-nullable": false, - "x-omitempty": false - }, - "widget_config": { - "allOf": [ - { - "$ref": "#/definitions/widgets.Config" - } - ], - "x-nullable": true - } - }, - "x-nullable": false, - "x-omitempty": false - }, - "homepage.ItemConfig": { - "type": "object", - "properties": { - "category": { - "type": "string", - "x-nullable": false, - "x-omitempty": false - }, - "description": { - "type": "string", - "x-nullable": false, - "x-omitempty": false - }, - "icon": { - "type": "string", - "x-nullable": false, - "x-omitempty": false - }, - "name": { - "description": "display name", - "type": "string", - "x-nullable": false, - "x-omitempty": false - }, - "show": { - "type": "boolean", - "x-nullable": false, - "x-omitempty": false - }, - "sort_order": { - "type": "integer", - "x-nullable": false, - "x-omitempty": false - }, - "url": { - "type": "string", - "x-nullable": false, - "x-omitempty": false - } - }, - "x-nullable": false, - "x-omitempty": false - }, "mem.VirtualMemoryStat": { "type": "object", "properties": { @@ -4040,8 +4488,11 @@ }, "excluded": { "type": "boolean", - "x-nullable": false, - "x-omitempty": false + "x-nullable": true + }, + "excluded_reason": { + "type": "string", + "x-nullable": true }, "health": { "description": "for swagger", @@ -4059,7 +4510,7 @@ "x-omitempty": false }, "homepage": { - "$ref": "#/definitions/homepage.ItemConfig", + "$ref": "#/definitions/HomepageItemConfig", "x-nullable": false, "x-omitempty": false }, @@ -4218,16 +4669,11 @@ "x-nullable": false, "x-omitempty": false }, - "rules.Command": { - "type": "object", - "x-nullable": false, - "x-omitempty": false - }, "rules.Rule": { "type": "object", "properties": { "do": { - "$ref": "#/definitions/rules.Command", + "type": "string", "x-nullable": false, "x-omitempty": false }, @@ -4237,7 +4683,7 @@ "x-omitempty": false }, "on": { - "$ref": "#/definitions/rules.RuleOn", + "type": "string", "x-nullable": false, "x-omitempty": false } @@ -4245,11 +4691,6 @@ "x-nullable": false, "x-omitempty": false }, - "rules.RuleOn": { - "type": "object", - "x-nullable": false, - "x-omitempty": false - }, "sensors.TemperatureStat": { "type": "object", "properties": { diff --git a/internal/api/v1/docs/swagger.yaml b/internal/api/v1/docs/swagger.yaml index 6c640c73..5010cd16 100644 --- a/internal/api/v1/docs/swagger.yaml +++ b/internal/api/v1/docs/swagger.yaml @@ -4,8 +4,6 @@ definitions: properties: addr: type: string - is_nerdctl: - type: boolean name: type: string version: @@ -97,6 +95,8 @@ definitions: description: non-zero publicPort:types.Port running: type: boolean + state: + $ref: '#/definitions/container.ContainerState' type: object ContainerImage: properties: @@ -122,7 +122,9 @@ definitions: server: type: string state: - $ref: '#/definitions/ContainerState' + allOf: + - $ref: '#/definitions/ContainerState' + x-nullable: true type: object ContainerState: enum: @@ -281,11 +283,84 @@ definitions: additionalProperties: $ref: '#/definitions/routes.HealthInfo' type: object - HomepageItems: - additionalProperties: + HomepageCategory: + properties: items: - $ref: '#/definitions/homepage.Item' - type: array + items: + $ref: '#/definitions/HomepageItem' + type: array + name: + type: string + type: object + HomepageItem: + properties: + alias: + type: string + all_sort_order: + description: sort order in all + type: integer + category: + type: string + description: + type: string + fav_sort_order: + description: sort order in favorite + type: integer + favorite: + type: boolean + icon: + type: string + name: + description: display name + type: string + origin_url: + type: string + provider: + type: string + show: + type: boolean + sort_order: + description: sort order in category + type: integer + url: + type: string + widget_config: + allOf: + - $ref: '#/definitions/widgets.Config' + x-nullable: true + widgets: + items: + $ref: '#/definitions/HomepageItemWidget' + type: array + type: object + HomepageItemConfig: + properties: + category: + type: string + description: + type: string + favorite: + type: boolean + icon: + type: string + name: + description: display name + type: string + show: + type: boolean + url: + type: string + widget_config: + allOf: + - $ref: '#/definitions/widgets.Config' + x-nullable: true + type: object + HomepageItemWidget: + properties: + label: + type: string + value: + type: string type: object HomepageOverrideCategoryOrderParams: properties: @@ -294,10 +369,40 @@ definitions: which: type: string type: object + HomepageOverrideItemAllSortOrderParams: + properties: + value: + type: integer + which: + type: string + type: object + HomepageOverrideItemFavSortOrderParams: + properties: + value: + type: integer + which: + type: string + type: object + HomepageOverrideItemFavoriteParams: + properties: + value: + type: boolean + which: + items: + type: string + type: array + type: object HomepageOverrideItemParams: properties: value: - $ref: '#/definitions/homepage.ItemConfig' + $ref: '#/definitions/HomepageItemConfig' + which: + type: string + type: object + HomepageOverrideItemSortOrderParams: + properties: + value: + type: integer which: type: string type: object @@ -314,7 +419,7 @@ definitions: properties: value: additionalProperties: - $ref: '#/definitions/homepage.ItemConfig' + $ref: '#/definitions/HomepageItemConfig' type: object type: object IdlewatcherConfig: @@ -454,13 +559,6 @@ definitions: - MetricsPeriod1mo NewAgentRequest: properties: - container_runtime: - allOf: - - $ref: '#/definitions/agent.ContainerRuntime' - enum: - - docker - - podman - - nerdctl host: type: string name: @@ -587,6 +685,10 @@ definitions: type: boolean excluded: type: boolean + x-nullable: true + excluded_reason: + type: string + x-nullable: true health: allOf: - $ref: '#/definitions/HealthJSON' @@ -594,7 +696,7 @@ definitions: healthcheck: $ref: '#/definitions/HealthCheckConfig' homepage: - $ref: '#/definitions/homepage.ItemConfig' + $ref: '#/definitions/HomepageItemConfig' host: type: string idlewatcher: @@ -693,12 +795,22 @@ definitions: type: string avg_latency: type: number + current_status: + enum: + - healthy + - unhealthy + - unknown + - napping + - starting + type: string display_name: type: string downtime: type: number idle: type: number + is_docker: + type: boolean statuses: items: $ref: '#/definitions/RouteStatus' @@ -819,8 +931,6 @@ definitions: $ref: '#/definitions/PEMPairResponse' client: $ref: '#/definitions/PEMPairResponse' - container_runtime: - $ref: '#/definitions/agent.ContainerRuntime' host: type: string type: object @@ -872,16 +982,6 @@ definitions: status_codes: $ref: '#/definitions/LogFilter-StatusCodeRange' type: object - agent.ContainerRuntime: - enum: - - docker - - podman - - nerdctl - type: string - x-enum-varnames: - - ContainerRuntimeDocker - - ContainerRuntimePodman - - ContainerRuntimeNerdctl auth.UserPassAuthCallbackRequest: properties: password: @@ -889,6 +989,43 @@ definitions: username: type: string type: object + container.ContainerState: + enum: + - created + - running + - paused + - restarting + - removing + - exited + - dead + type: string + x-enum-comments: + StateCreated: StateCreated indicates the container is created, but not (yet) + started. + StateDead: StateDead indicates that the container failed to be deleted. Containers + in this state are attempted to be cleaned up when the daemon restarts. + StateExited: StateExited indicates that the container exited. + StatePaused: StatePaused indicates that the container's current state is paused. + StateRemoving: StateRemoving indicates that the container is being removed. + StateRestarting: StateRestarting indicates that the container is currently restarting. + StateRunning: StateRunning indicates that the container is running. + x-enum-descriptions: + - StateCreated indicates the container is created, but not (yet) started. + - StateRunning indicates that the container is running. + - StatePaused indicates that the container's current state is paused. + - StateRestarting indicates that the container is currently restarting. + - StateRemoving indicates that the container is being removed. + - StateExited indicates that the container exited. + - StateDead indicates that the container failed to be deleted. Containers in this + state are attempted to be cleaned up when the daemon restarts. + x-enum-varnames: + - StateCreated + - StateRunning + - StatePaused + - StateRestarting + - StateRemoving + - StateExited + - StateDead container.Port: properties: IP: @@ -1001,52 +1138,6 @@ definitions: - IconSourceRelative - IconSourceWalkXCode - IconSourceSelfhSt - homepage.Item: - properties: - alias: - type: string - category: - type: string - description: - type: string - icon: - type: string - name: - description: display name - type: string - origin_url: - type: string - provider: - type: string - show: - type: boolean - sort_order: - type: integer - url: - type: string - widget_config: - allOf: - - $ref: '#/definitions/widgets.Config' - x-nullable: true - type: object - homepage.ItemConfig: - properties: - category: - type: string - description: - type: string - icon: - type: string - name: - description: display name - type: string - show: - type: boolean - sort_order: - type: integer - url: - type: string - type: object mem.VirtualMemoryStat: properties: available: @@ -1118,6 +1209,10 @@ definitions: type: boolean excluded: type: boolean + x-nullable: true + excluded_reason: + type: string + x-nullable: true health: allOf: - $ref: '#/definitions/HealthJSON' @@ -1125,7 +1220,7 @@ definitions: healthcheck: $ref: '#/definitions/HealthCheckConfig' homepage: - $ref: '#/definitions/homepage.ItemConfig' + $ref: '#/definitions/HomepageItemConfig' host: type: string idlewatcher: @@ -1212,18 +1307,14 @@ definitions: description: uptime in milliseconds type: number type: object - rules.Command: - type: object rules.Rule: properties: do: - $ref: '#/definitions/rules.Command' + type: string name: type: string "on": - $ref: '#/definitions/rules.RuleOn' - type: object - rules.RuleOn: + type: string type: object sensors.TemperatureStat: properties: @@ -1389,38 +1480,6 @@ paths: - agent x-id: verify /auth/callback: - get: - description: Handles the callback from the provider after successful authentication - parameters: - - description: Userpass only - in: body - name: body - required: true - schema: - $ref: '#/definitions/auth.UserPassAuthCallbackRequest' - produces: - - text/plain - responses: - "200": - description: 'Userpass: OK' - schema: - type: string - "302": - description: 'OIDC: Redirects to home page' - schema: - type: string - "400": - description: 'Userpass: invalid request / credentials' - schema: - type: string - "500": - description: Internal server error - schema: - type: string - summary: Auth Callback - tags: - - auth - x-id: callback post: description: Handles the callback from the provider after successful authentication parameters: @@ -1557,6 +1616,34 @@ paths: - cert - websocket x-id: renew + /docker/container/{id}: + get: + description: Get container by container id + parameters: + - description: Container ID + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/ContainerResponse' + "403": + description: Forbidden + schema: + $ref: '#/definitions/ErrorResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/ErrorResponse' + summary: Get container + tags: + - docker + x-id: container /docker/containers: get: description: Get containers @@ -1603,20 +1690,15 @@ paths: tags: - docker x-id: info - /docker/logs/{server}/{container}: + /docker/logs/{id}: get: consumes: - application/json - description: Get docker container logs + description: Get docker container logs by container id parameters: - - description: server name - in: path - name: server - required: true - type: string - description: container id in: path - name: container + name: id required: true type: string - description: show stdout @@ -1930,6 +2012,10 @@ paths: - application/json description: Homepage items parameters: + - description: Search query + in: query + name: search + type: string - description: Category filter in: query name: category @@ -1944,7 +2030,9 @@ paths: "200": description: OK schema: - $ref: '#/definitions/HomepageItems' + items: + $ref: '#/definitions/HomepageCategory' + type: array "400": description: Bad Request schema: @@ -2019,6 +2107,130 @@ paths: tags: - homepage x-id: set-item + /homepage/set/item_all_sort_order: + post: + consumes: + - application/json + description: Set homepage item all sort order. + parameters: + - description: Set item all sort order + in: body + name: request + required: true + schema: + $ref: '#/definitions/HomepageOverrideItemAllSortOrderParams' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/SuccessResponse' + "400": + description: Bad Request + schema: + $ref: '#/definitions/ErrorResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/ErrorResponse' + summary: Set homepage item all sort order + tags: + - homepage + x-id: set-item-all-sort-order + /homepage/set/item_fav_sort_order: + post: + consumes: + - application/json + description: Set homepage item fav sort order. + parameters: + - description: Set item fav sort order + in: body + name: request + required: true + schema: + $ref: '#/definitions/HomepageOverrideItemFavSortOrderParams' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/SuccessResponse' + "400": + description: Bad Request + schema: + $ref: '#/definitions/ErrorResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/ErrorResponse' + summary: Set homepage item fav sort order + tags: + - homepage + x-id: set-item-fav-sort-order + /homepage/set/item_favorite: + post: + consumes: + - application/json + description: Set homepage item favorite. + parameters: + - description: Set item favorite + in: body + name: request + required: true + schema: + $ref: '#/definitions/HomepageOverrideItemFavoriteParams' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/SuccessResponse' + "400": + description: Bad Request + schema: + $ref: '#/definitions/ErrorResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/ErrorResponse' + summary: Set homepage item favorite + tags: + - homepage + x-id: set-item-favorite + /homepage/set/item_sort_order: + post: + consumes: + - application/json + description: Set homepage item sort order. + parameters: + - description: Set item sort order + in: body + name: request + required: true + schema: + $ref: '#/definitions/HomepageOverrideItemSortOrderParams' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/SuccessResponse' + "400": + description: Bad Request + schema: + $ref: '#/definitions/ErrorResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/ErrorResponse' + summary: Set homepage item sort order + tags: + - homepage + x-id: set-item-sort-order /homepage/set/item_visible: post: consumes: @@ -2116,6 +2328,80 @@ paths: tags: - v1 x-id: icons + /metrics/all_system_info: + get: + description: Get system info + parameters: + - enum: + - cpu_average + - memory_usage + - memory_usage_percent + - disks_read_speed + - disks_write_speed + - disks_iops + - disk_usage + - network_speed + - network_transfer + - sensor_temperature + in: query + name: aggregate + type: string + x-enum-varnames: + - SystemInfoAggregateModeCPUAverage + - SystemInfoAggregateModeMemoryUsage + - SystemInfoAggregateModeMemoryUsagePercent + - SystemInfoAggregateModeDisksReadSpeed + - SystemInfoAggregateModeDisksWriteSpeed + - SystemInfoAggregateModeDisksIOPS + - SystemInfoAggregateModeDiskUsage + - SystemInfoAggregateModeNetworkSpeed + - SystemInfoAggregateModeNetworkTransfer + - SystemInfoAggregateModeSensorTemperature + - format: duration + in: query + name: interval + type: string + - enum: + - 5m + - 15m + - 1h + - 1d + - 1mo + in: query + name: period + type: string + x-enum-varnames: + - MetricsPeriod5m + - MetricsPeriod15m + - MetricsPeriod1h + - MetricsPeriod1d + - MetricsPeriod1mo + produces: + - application/json + responses: + "200": + description: period specified, aggregated system info by agent name + schema: + additionalProperties: + $ref: '#/definitions/SystemInfoAggregate' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/ErrorResponse' + "403": + description: Forbidden + schema: + $ref: '#/definitions/ErrorResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/ErrorResponse' + summary: Get system info + tags: + - metrics + - websocket + x-id: all_system_info /metrics/system_info: get: description: Get system info @@ -2123,6 +2409,9 @@ paths: - in: query name: agentAddr type: string + - in: query + name: agentName + type: string - enum: - cpu_average - memory_usage @@ -2178,10 +2467,6 @@ paths: description: Forbidden schema: $ref: '#/definitions/ErrorResponse' - "404": - description: Not Found - schema: - $ref: '#/definitions/ErrorResponse' "500": description: Internal Server Error schema: