Skip to content

Commit

Permalink
server: api: Fix kubernetes API
Browse files Browse the repository at this point in the history
  • Loading branch information
ish-hcc committed Sep 9, 2024
1 parent 1198f7d commit feb87b1
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 5 deletions.
2 changes: 1 addition & 1 deletion server/pkg/api/rest/controller/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ func GetKubernetesInfo(c echo.Context) error {
// @Success 200 {object} model.KubernetesInfoList "Successfully get information of the kubernetes."
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to get information of the kubernetes."
// @Router /source_group/{sgId}/software [get]
// @Router /source_group/{sgId}/kubernetes [get]
func GetKubernetesInfoSourceGroup(c echo.Context) error {
sgID := c.Param("sgId")
if sgID == "" {
Expand Down
46 changes: 45 additions & 1 deletion server/pkg/api/rest/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,7 @@ const docTemplate = `{
}
}
},
"/source_group/{sgId}/software": {
"/source_group/{sgId}/kubernetes": {
"get": {
"description": "Get the kubernetes information for all connections in the source group.",
"consumes": [
Expand Down Expand Up @@ -1395,6 +1395,50 @@ const docTemplate = `{
}
}
}
},
"/source_group/{sgId}/software": {
"get": {
"description": "Get the software information for all connections in the source group.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"[Get] Get source info"
],
"summary": "Get Software Information Source Group",
"parameters": [
{
"type": "string",
"description": "ID of the source group.",
"name": "sgId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Successfully get information of the software.",
"schema": {
"$ref": "#/definitions/github_com_cloud-barista_cm-honeybee_server_pkg_api_rest_model.SoftwareInfoList"
}
},
"400": {
"description": "Sent bad request.",
"schema": {
"$ref": "#/definitions/github_com_cloud-barista_cm-honeybee_server_pkg_api_rest_common.ErrorResponse"
}
},
"500": {
"description": "Failed to get information of the software.",
"schema": {
"$ref": "#/definitions/github_com_cloud-barista_cm-honeybee_server_pkg_api_rest_common.ErrorResponse"
}
}
}
}
}
},
"definitions": {
Expand Down
46 changes: 45 additions & 1 deletion server/pkg/api/rest/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@
}
}
},
"/source_group/{sgId}/software": {
"/source_group/{sgId}/kubernetes": {
"get": {
"description": "Get the kubernetes information for all connections in the source group.",
"consumes": [
Expand Down Expand Up @@ -1388,6 +1388,50 @@
}
}
}
},
"/source_group/{sgId}/software": {
"get": {
"description": "Get the software information for all connections in the source group.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"[Get] Get source info"
],
"summary": "Get Software Information Source Group",
"parameters": [
{
"type": "string",
"description": "ID of the source group.",
"name": "sgId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Successfully get information of the software.",
"schema": {
"$ref": "#/definitions/github_com_cloud-barista_cm-honeybee_server_pkg_api_rest_model.SoftwareInfoList"
}
},
"400": {
"description": "Sent bad request.",
"schema": {
"$ref": "#/definitions/github_com_cloud-barista_cm-honeybee_server_pkg_api_rest_common.ErrorResponse"
}
},
"500": {
"description": "Failed to get information of the software.",
"schema": {
"$ref": "#/definitions/github_com_cloud-barista_cm-honeybee_server_pkg_api_rest_common.ErrorResponse"
}
}
}
}
}
},
"definitions": {
Expand Down
32 changes: 31 additions & 1 deletion server/pkg/api/rest/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1822,7 +1822,7 @@ paths:
summary: Get Infra Information Source Group
tags:
- '[Get] Get source info'
/source_group/{sgId}/software:
/source_group/{sgId}/kubernetes:
get:
consumes:
- application/json
Expand Down Expand Up @@ -1852,4 +1852,34 @@ paths:
summary: Get Kubernetes Information Source Group
tags:
- '[Get] Get source info'
/source_group/{sgId}/software:
get:
consumes:
- application/json
description: Get the software information for all connections in the source
group.
parameters:
- description: ID of the source group.
in: path
name: sgId
required: true
type: string
produces:
- application/json
responses:
"200":
description: Successfully get information of the software.
schema:
$ref: '#/definitions/github_com_cloud-barista_cm-honeybee_server_pkg_api_rest_model.SoftwareInfoList'
"400":
description: Sent bad request.
schema:
$ref: '#/definitions/github_com_cloud-barista_cm-honeybee_server_pkg_api_rest_common.ErrorResponse'
"500":
description: Failed to get information of the software.
schema:
$ref: '#/definitions/github_com_cloud-barista_cm-honeybee_server_pkg_api_rest_common.ErrorResponse'
summary: Get Software Information Source Group
tags:
- '[Get] Get source info'
swagger: "2.0"
2 changes: 1 addition & 1 deletion server/pkg/api/rest/route/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ func RegisterGet(e *echo.Echo) {
e.GET("/"+strings.ToLower(common.ShortModuleName)+"/source_group/:sgId/connection_info/:connId/software", controller.GetSoftwareInfo)
e.GET("/"+strings.ToLower(common.ShortModuleName)+"/source_group/:sgId/software", controller.GetSoftwareInfoSourceGroup)
e.GET("/"+strings.ToLower(common.ShortModuleName)+"/source_group/:sgId/connection_info/:connId/kubernetes", controller.GetKubernetesInfo)
e.GET("/"+strings.ToLower(common.ShortModuleName)+"/source_group/:sgId/software", controller.GetKubernetesInfoSourceGroup)
e.GET("/"+strings.ToLower(common.ShortModuleName)+"/source_group/:sgId/kubernetes", controller.GetKubernetesInfoSourceGroup)
}

0 comments on commit feb87b1

Please sign in to comment.