waf-api-server.go 707 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
package api

import (
	"github.com/gin-gonic/gin"
	"github.com/olivere/elastic/v7"
	"gitlab.com/tensorsecurity-rd/waf-console/internal/controller"
	"gitlab.com/tensorsecurity-rd/waf-console/internal/utils"
	"gorm.io/gorm"
)

func SetWafApiServerRouter(e *gin.Engine, clusterClientManager *utils.ClusterClientManager, db *gorm.DB, gatewayUrl string, elasticClient *elastic.Client) {
	wafController := controller.NewWafController(clusterClientManager, db, gatewayUrl, elasticClient)
	v2 := e.Group("api/v2/containerSec/waf")
	v2.GET("attack/log/list", wafController.ListAttackLogs)
	v2.GET("attack/log/details", wafController.GetAttackLogDetails)
	v2.GET("attack/log/rspPkg", wafController.GetAttackLogRsp)
}