feat: swagger接口文档更新1.0.8

This commit is contained in:
TsMask
2025-01-23 15:07:22 +08:00
parent 788e406c32
commit ed9aa17bc3
47 changed files with 16033 additions and 119 deletions

View File

@@ -4,16 +4,14 @@ import (
"be.ems/src/framework/i18n"
"be.ems/src/framework/utils/ctx"
"be.ems/src/framework/vo/result"
neService "be.ems/src/modules/network_element/service"
traceService "be.ems/src/modules/trace/service"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
)
// 实例化控制层 TCPdumpController 结构体
var NewTCPdump = &TCPdumpController{
tcpdumpService: traceService.NewTCPdump,
neInfoService: neService.NewNeInfo,
}
// 信令抓包
@@ -21,12 +19,21 @@ var NewTCPdump = &TCPdumpController{
// PATH /tcpdump
type TCPdumpController struct {
tcpdumpService *traceService.TCPdump // 信令抓包服务
neInfoService *neService.NeInfo // 网元信息服务
}
// 网元抓包PACP 开始
//
// POST /start
//
// @Tags trace/tcpdump
// @Accept json
// @Produce json
// @Param data body object true "Request Param"
// @Success 200 {object} object "Response Results"
// @Security ApiKeyAuth
// @Summary Network Element Capture Packet PACP Start
// @Description Network Element Capture Packet PACP Start
// @Router /trace/tcpdump/start [post]
func (s *TCPdumpController) DumpStart(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var body struct {
@@ -34,7 +41,7 @@ func (s *TCPdumpController) DumpStart(c *gin.Context) {
NeId string `json:"neId" binding:"required"` // 网元ID
Cmd string `json:"cmd" binding:"required"` // 命令 "-n -s 0 -v"
}
err := c.ShouldBindBodyWith(&body, binding.JSON)
err := c.ShouldBindBodyWithJSON(&body)
if err != nil {
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
return
@@ -51,6 +58,16 @@ func (s *TCPdumpController) DumpStart(c *gin.Context) {
// 网元抓包PACP 结束
//
// POST /stop
//
// @Tags trace/tcpdump
// @Accept json
// @Produce json
// @Param data body object true "Request Param"
// @Success 200 {object} object "Response Results"
// @Security ApiKeyAuth
// @Summary Network Element Capture Packet PACP Stop
// @Description Network Element Capture Packet PACP Stop
// @Router /trace/tcpdump/stop [post]
func (s *TCPdumpController) DumpStop(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var body struct {
@@ -58,7 +75,7 @@ func (s *TCPdumpController) DumpStop(c *gin.Context) {
NeId string `json:"neId" binding:"required"` // 网元ID
TaskCode string `json:"taskCode" binding:"required"` // 任务码,停止任务并查看日志信息
}
err := c.ShouldBindBodyWith(&body, binding.JSON)
err := c.ShouldBindBodyWithJSON(&body)
if err != nil {
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
return
@@ -75,6 +92,16 @@ func (s *TCPdumpController) DumpStop(c *gin.Context) {
// UPF标准版内部抓包
//
// POST /upf
//
// @Tags trace/tcpdump
// @Accept json
// @Produce json
// @Param data body object true "Request Param"
// @Success 200 {object} object "Response Results"
// @Security ApiKeyAuth
// @Summary UPF Standard Edition Internal Grab Bag
// @Description UPF Standard Edition Internal Grab Bag
// @Router /trace/tcpdump/upf [post]
func (s *TCPdumpController) UPFTrace(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var body struct {
@@ -82,7 +109,7 @@ func (s *TCPdumpController) UPFTrace(c *gin.Context) {
NeId string `json:"neId" binding:"required"` // 网元ID
Cmd string `json:"cmd" binding:"required"` // 命令
}
err := c.ShouldBindBodyWith(&body, binding.JSON)
err := c.ShouldBindBodyWithJSON(&body)
if err != nil {
c.JSON(400, result.CodeMsg(400, i18n.TKey(language, "app.common.err400")))
return