waf.go 612 Bytes
Newer Older
qiuqunfeng's avatar
qiuqunfeng committed
1 2 3 4 5
package api

import (
	"github.com/gin-gonic/gin"
	"gitlab.com/tensorsecurity-rd/waf-console/internal/controller"
qiuqunfeng's avatar
commit  
qiuqunfeng committed
6
	"gitlab.com/tensorsecurity-rd/waf-console/internal/utils"
qiuqunfeng's avatar
qiuqunfeng committed
7 8 9
	"gorm.io/gorm"
)

qiuqunfeng's avatar
commit  
qiuqunfeng committed
10
func SetWafRouter(e *gin.Engine, clusterClientManager *utils.ClusterClientManager, db *gorm.DB) {
qiuqunfeng's avatar
qiuqunfeng committed
11 12
	v1 := e.Group("v1/api")

qiuqunfeng's avatar
commit  
qiuqunfeng committed
13
	wafController := controller.NewWafController(clusterClientManager, db)
qiuqunfeng's avatar
commit  
qiuqunfeng committed
14
	v1.GET("waf/:region_code/:namespace/:gateway_name", wafController.Waf)
qiuqunfeng's avatar
qiuqunfeng committed
15
	v1.POST("waf", wafController.CreateWaf)
qiuqunfeng's avatar
commit  
qiuqunfeng committed
16
	v1.PUT("mode", wafController.UpdateMode)
qiuqunfeng's avatar
commit  
qiuqunfeng committed
17
	v1.POST("debug/savecatagory", wafController.SaveRuleCategoryToDB)
qiuqunfeng's avatar
qiuqunfeng committed
18
}