From afa9eecf3585a46d80b5455cd30f5fcdf880fbad Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Fri, 12 May 2023 22:30:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A1=A5=E5=85=A8=20swagger=20=E6=96=87?= =?UTF-8?q?=E6=A1=A3=20(#1022)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/api/v1/firewall.go | 4 +-- cmd/server/docs/docs.go | 47 ++++++++++++++++++++++++++++++++-- cmd/server/docs/swagger.json | 47 ++++++++++++++++++++++++++++++++-- cmd/server/docs/swagger.yaml | 32 +++++++++++++++++++++-- 4 files changed, 122 insertions(+), 8 deletions(-) diff --git a/backend/app/api/v1/firewall.go b/backend/app/api/v1/firewall.go index 6606df675..1479170f3 100644 --- a/backend/app/api/v1/firewall.go +++ b/backend/app/api/v1/firewall.go @@ -138,7 +138,7 @@ func (b *BaseApi) OperateIPRule(c *gin.Context) { // @Param request body dto.BatchRuleOperate true "request" // @Success 200 // @Security ApiKeyAuth -// @Router /hosts/firewall/ip [post] +// @Router /hosts/firewall/batch [post] func (b *BaseApi) BatchOperateRule(c *gin.Context) { var req dto.BatchRuleOperate if err := c.ShouldBindJSON(&req); err != nil { @@ -188,7 +188,7 @@ func (b *BaseApi) UpdatePortRule(c *gin.Context) { // @Param request body dto.AddrRuleUpdate true "request" // @Success 200 // @Security ApiKeyAuth -// @Router /hosts/firewall/update/ip [post] +// @Router /hosts/firewall/update/addr [post] func (b *BaseApi) UpdateAddrRule(c *gin.Context) { var req dto.AddrRuleUpdate if err := c.ShouldBindJSON(&req); err != nil { diff --git a/cmd/server/docs/docs.go b/cmd/server/docs/docs.go index 72a997a2a..f743c8557 100644 --- a/cmd/server/docs/docs.go +++ b/cmd/server/docs/docs.go @@ -5377,7 +5377,7 @@ var doc = `{ } } }, - "/hosts/firewall/ip": { + "/hosts/firewall/batch": { "post": { "security": [ { @@ -5410,6 +5410,49 @@ var doc = `{ } } }, + "/hosts/firewall/ip": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "创建防火墙 IP 规则", + "consumes": [ + "application/json" + ], + "tags": [ + "Firewall" + ], + "summary": "Create group", + "parameters": [ + { + "description": "request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.AddrRuleOperate" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "x-panel-log": { + "BeforeFuntions": [], + "bodyKeys": [ + "strategy", + "address" + ], + "formatEN": "create address rules [strategy][address]", + "formatZH": "添加 ip 规则 [strategy] [address]", + "paramKeys": [] + } + } + }, "/hosts/firewall/operate": { "post": { "security": [ @@ -5534,7 +5577,7 @@ var doc = `{ } } }, - "/hosts/firewall/update/ip": { + "/hosts/firewall/update/addr": { "post": { "security": [ { diff --git a/cmd/server/docs/swagger.json b/cmd/server/docs/swagger.json index 38b662678..434ac0447 100644 --- a/cmd/server/docs/swagger.json +++ b/cmd/server/docs/swagger.json @@ -5363,7 +5363,7 @@ } } }, - "/hosts/firewall/ip": { + "/hosts/firewall/batch": { "post": { "security": [ { @@ -5396,6 +5396,49 @@ } } }, + "/hosts/firewall/ip": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "创建防火墙 IP 规则", + "consumes": [ + "application/json" + ], + "tags": [ + "Firewall" + ], + "summary": "Create group", + "parameters": [ + { + "description": "request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.AddrRuleOperate" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "x-panel-log": { + "BeforeFuntions": [], + "bodyKeys": [ + "strategy", + "address" + ], + "formatEN": "create address rules [strategy][address]", + "formatZH": "添加 ip 规则 [strategy] [address]", + "paramKeys": [] + } + } + }, "/hosts/firewall/operate": { "post": { "security": [ @@ -5520,7 +5563,7 @@ } } }, - "/hosts/firewall/update/ip": { + "/hosts/firewall/update/addr": { "post": { "security": [ { diff --git a/cmd/server/docs/swagger.yaml b/cmd/server/docs/swagger.yaml index 1d14e2a27..73afc2336 100644 --- a/cmd/server/docs/swagger.yaml +++ b/cmd/server/docs/swagger.yaml @@ -6461,7 +6461,7 @@ paths: summary: Load firewall base info tags: - Firewall - /hosts/firewall/ip: + /hosts/firewall/batch: post: consumes: - application/json @@ -6481,6 +6481,34 @@ paths: summary: Create group tags: - Firewall + /hosts/firewall/ip: + post: + consumes: + - application/json + description: 创建防火墙 IP 规则 + parameters: + - description: request + in: body + name: request + required: true + schema: + $ref: '#/definitions/dto.AddrRuleOperate' + responses: + "200": + description: "" + security: + - ApiKeyAuth: [] + summary: Create group + tags: + - Firewall + x-panel-log: + BeforeFuntions: [] + bodyKeys: + - strategy + - address + formatEN: create address rules [strategy][address] + formatZH: 添加 ip 规则 [strategy] [address] + paramKeys: [] /hosts/firewall/operate: post: consumes: @@ -6560,7 +6588,7 @@ paths: summary: Page firewall rules tags: - Firewall - /hosts/firewall/update/ip: + /hosts/firewall/update/addr: post: consumes: - application/json