mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 01:08:31 +02:00
fix(api): renew endpoint uses get instead of post, correct @Accept docs
This commit is contained in:
@@ -87,7 +87,7 @@ func NewHandler() *gin.Engine {
|
|||||||
cert := v1.Group("/cert")
|
cert := v1.Group("/cert")
|
||||||
{
|
{
|
||||||
cert.GET("/info", certApi.Info)
|
cert.GET("/info", certApi.Info)
|
||||||
cert.POST("/renew", certApi.Renew)
|
cert.GET("/renew", certApi.Renew)
|
||||||
}
|
}
|
||||||
|
|
||||||
agent := v1.Group("/agent")
|
agent := v1.Group("/agent")
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ type CertInfo struct {
|
|||||||
// @Summary Get cert info
|
// @Summary Get cert info
|
||||||
// @Description Get cert info
|
// @Description Get cert info
|
||||||
// @Tags cert
|
// @Tags cert
|
||||||
// @Accept json
|
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {object} CertInfo
|
// @Success 200 {object} CertInfo
|
||||||
// @Failure 403 {object} apitypes.ErrorResponse
|
// @Failure 403 {object} apitypes.ErrorResponse
|
||||||
|
|||||||
@@ -17,13 +17,12 @@ import (
|
|||||||
// @BasePath /api/v1
|
// @BasePath /api/v1
|
||||||
// @Summary Renew cert
|
// @Summary Renew cert
|
||||||
// @Description Renew cert
|
// @Description Renew cert
|
||||||
// @Tags cert
|
// @Tags cert,websocket
|
||||||
// @Accept json
|
// @Produce plain
|
||||||
// @Produce json
|
|
||||||
// @Success 200 {object} apitypes.SuccessResponse
|
// @Success 200 {object} apitypes.SuccessResponse
|
||||||
// @Failure 403 {object} apitypes.ErrorResponse
|
// @Failure 403 {object} apitypes.ErrorResponse
|
||||||
// @Failure 500 {object} apitypes.ErrorResponse
|
// @Failure 500 {object} apitypes.ErrorResponse
|
||||||
// @Router /cert/renew [post]
|
// @Router /cert/renew [get]
|
||||||
func Renew(c *gin.Context) {
|
func Renew(c *gin.Context) {
|
||||||
autocert := config.GetInstance().AutoCertProvider()
|
autocert := config.GetInstance().AutoCertProvider()
|
||||||
if autocert == nil {
|
if autocert == nil {
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ type Container struct {
|
|||||||
// @Summary Get containers
|
// @Summary Get containers
|
||||||
// @Description Get containers
|
// @Description Get containers
|
||||||
// @Tags docker
|
// @Tags docker
|
||||||
// @Accept json
|
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {array} Container
|
// @Success 200 {array} Container
|
||||||
// @Failure 403 {object} apitypes.ErrorResponse
|
// @Failure 403 {object} apitypes.ErrorResponse
|
||||||
|
|||||||
@@ -47,9 +47,8 @@ func toDockerInfo(info dockerSystem.Info) dockerInfo {
|
|||||||
// @Summary Get docker info
|
// @Summary Get docker info
|
||||||
// @Description Get docker info
|
// @Description Get docker info
|
||||||
// @Tags docker
|
// @Tags docker
|
||||||
// @Accept json
|
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {array} dockerInfo
|
// @Success 200 {object} dockerInfo
|
||||||
// @Failure 403 {object} apitypes.ErrorResponse
|
// @Failure 403 {object} apitypes.ErrorResponse
|
||||||
// @Failure 500 {object} apitypes.ErrorResponse
|
// @Failure 500 {object} apitypes.ErrorResponse
|
||||||
// @Router /docker/info [get]
|
// @Router /docker/info [get]
|
||||||
|
|||||||
@@ -301,9 +301,6 @@ const docTemplate = `{
|
|||||||
"/cert/info": {
|
"/cert/info": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "Get cert info",
|
"description": "Get cert info",
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -341,16 +338,14 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/cert/renew": {
|
"/cert/renew": {
|
||||||
"post": {
|
"get": {
|
||||||
"description": "Renew cert",
|
"description": "Renew cert",
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"text/plain"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"cert"
|
"cert",
|
||||||
|
"websocket"
|
||||||
],
|
],
|
||||||
"summary": "Renew cert",
|
"summary": "Renew cert",
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -379,9 +374,6 @@ const docTemplate = `{
|
|||||||
"/docker/containers": {
|
"/docker/containers": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "Get containers",
|
"description": "Get containers",
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -418,9 +410,6 @@ const docTemplate = `{
|
|||||||
"/docker/info": {
|
"/docker/info": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "Get docker info",
|
"description": "Get docker info",
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -432,10 +421,7 @@ const docTemplate = `{
|
|||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "array",
|
"$ref": "#/definitions/ServerInfo"
|
||||||
"items": {
|
|
||||||
"$ref": "#/definitions/ServerInfo"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"403": {
|
"403": {
|
||||||
|
|||||||
@@ -297,9 +297,6 @@
|
|||||||
"/cert/info": {
|
"/cert/info": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "Get cert info",
|
"description": "Get cert info",
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -338,16 +335,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/cert/renew": {
|
"/cert/renew": {
|
||||||
"post": {
|
"get": {
|
||||||
"description": "Renew cert",
|
"description": "Renew cert",
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"text/plain"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"cert"
|
"cert",
|
||||||
|
"websocket"
|
||||||
],
|
],
|
||||||
"summary": "Renew cert",
|
"summary": "Renew cert",
|
||||||
"responses": {
|
"responses": {
|
||||||
@@ -377,9 +372,6 @@
|
|||||||
"/docker/containers": {
|
"/docker/containers": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "Get containers",
|
"description": "Get containers",
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -417,9 +409,6 @@
|
|||||||
"/docker/info": {
|
"/docker/info": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "Get docker info",
|
"description": "Get docker info",
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"produces": [
|
"produces": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -431,10 +420,7 @@
|
|||||||
"200": {
|
"200": {
|
||||||
"description": "OK",
|
"description": "OK",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "array",
|
"$ref": "#/definitions/ServerInfo"
|
||||||
"items": {
|
|
||||||
"$ref": "#/definitions/ServerInfo"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"403": {
|
"403": {
|
||||||
|
|||||||
@@ -437,11 +437,11 @@ definitions:
|
|||||||
- 1mo
|
- 1mo
|
||||||
type: string
|
type: string
|
||||||
x-enum-comments:
|
x-enum-comments:
|
||||||
MetricsPeriod1mo: '@name MetricsPeriod1mo'
|
|
||||||
MetricsPeriod5m: '@name MetricsPeriod5m'
|
|
||||||
MetricsPeriod15m: '@name MetricsPeriod15m'
|
MetricsPeriod15m: '@name MetricsPeriod15m'
|
||||||
MetricsPeriod1d: '@name MetricsPeriod1d'
|
MetricsPeriod1d: '@name MetricsPeriod1d'
|
||||||
MetricsPeriod1h: '@name MetricsPeriod1h'
|
MetricsPeriod1h: '@name MetricsPeriod1h'
|
||||||
|
MetricsPeriod1mo: '@name MetricsPeriod1mo'
|
||||||
|
MetricsPeriod5m: '@name MetricsPeriod5m'
|
||||||
x-enum-varnames:
|
x-enum-varnames:
|
||||||
- MetricsPeriod5m
|
- MetricsPeriod5m
|
||||||
- MetricsPeriod15m
|
- MetricsPeriod15m
|
||||||
@@ -1452,8 +1452,6 @@ paths:
|
|||||||
x-id: logout
|
x-id: logout
|
||||||
/cert/info:
|
/cert/info:
|
||||||
get:
|
get:
|
||||||
consumes:
|
|
||||||
- application/json
|
|
||||||
description: Get cert info
|
description: Get cert info
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
@@ -1479,12 +1477,10 @@ paths:
|
|||||||
- cert
|
- cert
|
||||||
x-id: info
|
x-id: info
|
||||||
/cert/renew:
|
/cert/renew:
|
||||||
post:
|
get:
|
||||||
consumes:
|
|
||||||
- application/json
|
|
||||||
description: Renew cert
|
description: Renew cert
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- text/plain
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
@@ -1501,11 +1497,10 @@ paths:
|
|||||||
summary: Renew cert
|
summary: Renew cert
|
||||||
tags:
|
tags:
|
||||||
- cert
|
- cert
|
||||||
|
- websocket
|
||||||
x-id: renew
|
x-id: renew
|
||||||
/docker/containers:
|
/docker/containers:
|
||||||
get:
|
get:
|
||||||
consumes:
|
|
||||||
- application/json
|
|
||||||
description: Get containers
|
description: Get containers
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
@@ -1530,8 +1525,6 @@ paths:
|
|||||||
x-id: containers
|
x-id: containers
|
||||||
/docker/info:
|
/docker/info:
|
||||||
get:
|
get:
|
||||||
consumes:
|
|
||||||
- application/json
|
|
||||||
description: Get docker info
|
description: Get docker info
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
@@ -1539,9 +1532,7 @@ paths:
|
|||||||
"200":
|
"200":
|
||||||
description: OK
|
description: OK
|
||||||
schema:
|
schema:
|
||||||
items:
|
$ref: '#/definitions/ServerInfo'
|
||||||
$ref: '#/definitions/ServerInfo'
|
|
||||||
type: array
|
|
||||||
"403":
|
"403":
|
||||||
description: Forbidden
|
description: Forbidden
|
||||||
schema:
|
schema:
|
||||||
@@ -2124,11 +2115,11 @@ paths:
|
|||||||
name: period
|
name: period
|
||||||
type: string
|
type: string
|
||||||
x-enum-comments:
|
x-enum-comments:
|
||||||
MetricsPeriod1mo: '@name MetricsPeriod1mo'
|
|
||||||
MetricsPeriod5m: '@name MetricsPeriod5m'
|
|
||||||
MetricsPeriod15m: '@name MetricsPeriod15m'
|
MetricsPeriod15m: '@name MetricsPeriod15m'
|
||||||
MetricsPeriod1d: '@name MetricsPeriod1d'
|
MetricsPeriod1d: '@name MetricsPeriod1d'
|
||||||
MetricsPeriod1h: '@name MetricsPeriod1h'
|
MetricsPeriod1h: '@name MetricsPeriod1h'
|
||||||
|
MetricsPeriod1mo: '@name MetricsPeriod1mo'
|
||||||
|
MetricsPeriod5m: '@name MetricsPeriod5m'
|
||||||
x-enum-varnames:
|
x-enum-varnames:
|
||||||
- MetricsPeriod5m
|
- MetricsPeriod5m
|
||||||
- MetricsPeriod15m
|
- MetricsPeriod15m
|
||||||
|
|||||||
Reference in New Issue
Block a user