From 05b0a0af0275dd9cc24ded3dca1407813a838333 Mon Sep 17 00:00:00 2001 From: yuyi Date: Thu, 14 Mar 2024 11:46:33 +0800 Subject: [PATCH] fix(apigroup): move statistics api to info api group --- internal/dashboard/generated/swagger/docs.go | 118 +++++++++--------- .../dashboard/generated/swagger/swagger.json | 118 +++++++++--------- .../dashboard/generated/swagger/swagger.yaml | 70 +++++------ internal/dashboard/handler/info_handler.go | 2 +- internal/dashboard/router/v1/info_router.go | 1 + internal/dashboard/router/v1/metric_router.go | 1 - 6 files changed, 155 insertions(+), 155 deletions(-) diff --git a/internal/dashboard/generated/swagger/docs.go b/internal/dashboard/generated/swagger/docs.go index 757ef3873..17a36bf47 100644 --- a/internal/dashboard/generated/swagger/docs.go +++ b/internal/dashboard/generated/swagger/docs.go @@ -640,65 +640,6 @@ const docTemplate = `{ } } }, - "/api/v1/metrics/statistic": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "get statistic data", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Info" - ], - "summary": "get statistic data", - "operationId": "GetStatistics", - "responses": { - "200": { - "description": "OK", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/response.APIResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/response.StatisticDataResponse" - } - } - } - ] - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.APIResponse" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.APIResponse" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.APIResponse" - } - } - } - } - }, "/api/v1/obclusters": { "get": { "security": [ @@ -2720,6 +2661,65 @@ const docTemplate = `{ } } } + }, + "/api/v1/statistics": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "get statistic data", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Info" + ], + "summary": "get statistic data", + "operationId": "GetStatistics", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/response.StatisticDataResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } } }, "definitions": { diff --git a/internal/dashboard/generated/swagger/swagger.json b/internal/dashboard/generated/swagger/swagger.json index 1d2a717e0..ad2cc6b9d 100644 --- a/internal/dashboard/generated/swagger/swagger.json +++ b/internal/dashboard/generated/swagger/swagger.json @@ -633,65 +633,6 @@ } } }, - "/api/v1/metrics/statistic": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "get statistic data", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Info" - ], - "summary": "get statistic data", - "operationId": "GetStatistics", - "responses": { - "200": { - "description": "OK", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/response.APIResponse" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/response.StatisticDataResponse" - } - } - } - ] - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.APIResponse" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.APIResponse" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.APIResponse" - } - } - } - } - }, "/api/v1/obclusters": { "get": { "security": [ @@ -2713,6 +2654,65 @@ } } } + }, + "/api/v1/statistics": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "get statistic data", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Info" + ], + "summary": "get statistic data", + "operationId": "GetStatistics", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.APIResponse" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/response.StatisticDataResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.APIResponse" + } + } + } + } } }, "definitions": { diff --git a/internal/dashboard/generated/swagger/swagger.yaml b/internal/dashboard/generated/swagger/swagger.yaml index 0d863c3b6..eea15d2b4 100644 --- a/internal/dashboard/generated/swagger/swagger.yaml +++ b/internal/dashboard/generated/swagger/swagger.yaml @@ -1697,41 +1697,6 @@ paths: summary: query metrics tags: - Metric - /api/v1/metrics/statistic: - get: - consumes: - - application/json - description: get statistic data - operationId: GetStatistics - produces: - - application/json - responses: - "200": - description: OK - schema: - allOf: - - $ref: '#/definitions/response.APIResponse' - - properties: - data: - $ref: '#/definitions/response.StatisticDataResponse' - type: object - "400": - description: Bad Request - schema: - $ref: '#/definitions/response.APIResponse' - "401": - description: Unauthorized - schema: - $ref: '#/definitions/response.APIResponse' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/response.APIResponse' - security: - - ApiKeyAuth: [] - summary: get statistic data - tags: - - Info /api/v1/obclusters: get: consumes: @@ -3000,6 +2965,41 @@ paths: summary: List statistics information of tenants tags: - OBTenant + /api/v1/statistics: + get: + consumes: + - application/json + description: get statistic data + operationId: GetStatistics + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/response.APIResponse' + - properties: + data: + $ref: '#/definitions/response.StatisticDataResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/response.APIResponse' + "401": + description: Unauthorized + schema: + $ref: '#/definitions/response.APIResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/response.APIResponse' + security: + - ApiKeyAuth: [] + summary: get statistic data + tags: + - Info securityDefinitions: ApiKeyAuth: in: header diff --git a/internal/dashboard/handler/info_handler.go b/internal/dashboard/handler/info_handler.go index a15617308..e124a46b4 100644 --- a/internal/dashboard/handler/info_handler.go +++ b/internal/dashboard/handler/info_handler.go @@ -69,7 +69,7 @@ func GetProcessInfo(_ *gin.Context) (*response.DashboardInfo, error) { // @Failure 400 object response.APIResponse // @Failure 401 object response.APIResponse // @Failure 500 object response.APIResponse -// @Router /api/v1/metrics/statistic [GET] +// @Router /api/v1/statistics [GET] // @Security ApiKeyAuth func GetStatistics(c *gin.Context) (*response.StatisticDataResponse, error) { reportData := response.StatisticData{} diff --git a/internal/dashboard/router/v1/info_router.go b/internal/dashboard/router/v1/info_router.go index 6ece93760..c86d22fb6 100644 --- a/internal/dashboard/router/v1/info_router.go +++ b/internal/dashboard/router/v1/info_router.go @@ -20,4 +20,5 @@ import ( func InitInfoRoutes(g *gin.RouterGroup) { g.GET("/info", h.Wrap(h.GetProcessInfo)) + g.GET("/statstics", h.Wrap(h.GetStatistics)) } diff --git a/internal/dashboard/router/v1/metric_router.go b/internal/dashboard/router/v1/metric_router.go index ec7fd973b..3f8fe511a 100644 --- a/internal/dashboard/router/v1/metric_router.go +++ b/internal/dashboard/router/v1/metric_router.go @@ -21,5 +21,4 @@ import ( func InitMetricRoutes(g *gin.RouterGroup) { g.GET("/metrics", h.Wrap(h.ListMetricMetas)) g.POST("/metrics/query", h.Wrap(h.QueryMetrics)) - g.GET("/metrics/statistic", h.Wrap(h.GetStatistics)) }