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