Skip to content

Commit

Permalink
server: api: rest: Update swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
taking committed Oct 16, 2024
1 parent 06190cd commit 64fdb8a
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 14 deletions.
1 change: 1 addition & 0 deletions server/pkg/api/rest/controller/benchmarkInfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func GetBenchmarkInfo(c echo.Context) error {
// @Accept json
// @Produce json
// @Param connId path string true "ID of the connection info"
// @Param types query string false "Comma-separated types for benchmarking (e.g., cpus, cpum, memR, memW, fioR, fioW, dbR, dbW)" default(cpus,cpum)
// @Success 200 {object} model.Benchmark "Successfully get information of the benchmark."
// @Failure 400 {object} common.ErrorResponse "Sent bad request."
// @Failure 500 {object} common.ErrorResponse "Failed to get information of the benchmark."
Expand Down
7 changes: 7 additions & 0 deletions server/pkg/api/rest/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ const docTemplate = `{
"name": "connId",
"in": "path",
"required": true
},
{
"type": "string",
"default": "cpus,cpum",
"description": "Comma-separated types for benchmarking (e.g., cpus, cpum, memR, memW, fioR, fioW, dbR, dbW)",
"name": "types",
"in": "query"
}
],
"responses": {
Expand Down
7 changes: 7 additions & 0 deletions server/pkg/api/rest/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@
"name": "connId",
"in": "path",
"required": true
},
{
"type": "string",
"default": "cpus,cpum",
"description": "Comma-separated types for benchmarking (e.g., cpus, cpum, memR, memW, fioR, fioW, dbR, dbW)",
"name": "types",
"in": "query"
}
],
"responses": {
Expand Down
6 changes: 6 additions & 0 deletions server/pkg/api/rest/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,12 @@ paths:
name: connId
required: true
type: string
- default: cpus,cpum
description: Comma-separated types for benchmarking (e.g., cpus, cpum, memR,
memW, fioR, fioW, dbR, dbW)
in: query
name: types
type: string
produces:
- application/json
responses:
Expand Down
7 changes: 7 additions & 0 deletions server/pkg/api/rest/model/agentInfo.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package model

type AgentInfo struct {
Connection string `json:"connection_name"`
Result string `json:"result"`
ErrorMsg error `json:"error_msg,omitempty"`
}
26 changes: 12 additions & 14 deletions server/pkg/api/rest/model/benchmarkInfo.go
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
package model

import (
"time"
"time"
)

type SavedBenchmarkInfo struct {
ConnectionID string `gorm:"primaryKey" json:"connection_id"`
Benchmark string `gorm:"column:benchmark;type:longtext" json:"benchmark,omitempty"`
Status string `json:"status"`
SavedTime time.Time `json:"saved_time"`
ConnectionID string `gorm:"primaryKey" json:"connection_id"`
Benchmark string `gorm:"column:benchmark;type:longtext" json:"benchmark,omitempty"`
Status string `json:"status"`
SavedTime time.Time `json:"saved_time"`
}

type Benchmark struct {
Type string `json:"type"`
Data BenchmarkData `json:"data" gorm:"embedded"`
Type string `json:"type"`
Data BenchmarkData `json:"data" gorm:"embedded"`
}

type BenchmarkArray []Benchmark

type BenchmarkData struct {
Desc string `json:"desc"`
Elapsed string `json:"elapsed"`
Result string `json:"result"`
SpecID string `json:"specid"`
Unit string `json:"unit"`
Desc string `json:"desc"`
Elapsed string `json:"elapsed"`
Result string `json:"result"`
SpecID string `json:"specid"`
Unit string `json:"unit"`
}

0 comments on commit 64fdb8a

Please sign in to comment.