waf.go 1.05 KB
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
qiuqunfeng committed
6
	"gitlab.com/tensorsecurity-rd/waf-console/internal/utils"
qiuqunfeng's avatar
qiuqunfeng committed
7 8 9
	"gorm.io/gorm"
)

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

13
	wafController := controller.NewWafController(clusterClientManager, db, gatewayUrl)
14
	v1.GET("/", wafController.Waf)
15
	// v1.POST("/gateway", wafController.GetWafGatewayInfo)
qiuqunfeng's avatar
qiuqunfeng committed
16
	v1.POST("/", wafController.CreateWaf)
qiuqunfeng's avatar
commit  
qiuqunfeng committed
17
	v1.PUT("mode", wafController.UpdateMode)
qiuqunfeng's avatar
qiuqunfeng committed
18 19 20
	v1.PUT("rules", wafController.UpdateRule)
	v1.PUT("listener/enable", wafController.EnableListenerWaf)
	v1.PUT("gateway/enable", wafController.EnableGatewayWaf)
21
	v1.POST("listeners/enable", wafController.EnableListenerWafs)
qiuqunfeng's avatar
qiuqunfeng committed
22 23
	v1.DELETE("listener/:region_code/:namespace/:gateway_name/:port", wafController.DeleteListenerWaf)
	v1.DELETE("gateway/:region_code/:namespace/:gateway_name", wafController.DeleteGatewayWaf)
qiuqunfeng's avatar
commit  
qiuqunfeng committed
24
	v1.POST("debug/savecatagory", wafController.SaveRuleCategoryToDB)
qiuqunfeng's avatar
qiuqunfeng committed
25
}