ot_monitor_rules.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package router
  2. import (
  3. "github.com/gin-gonic/gin"
  4. jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
  5. "go-admin/app/admin/apis"
  6. "go-admin/common/actions"
  7. "go-admin/common/middleware"
  8. )
  9. func init() {
  10. routerCheckRole = append(routerCheckRole, registerOtMonitorRulesRouter)
  11. routerNoCheckRole = append(routerNoCheckRole, registerOtMonitorRulesRouterNocheck)
  12. }
  13. // registerOtMonitorRulesRouter
  14. func registerOtMonitorRulesRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
  15. api := apis.OtMonitorRules{}
  16. r := v1.Group("/check/monitor-rules").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
  17. {
  18. r.GET("", actions.PermissionAction(), api.GetPage)
  19. r.GET("/:id", actions.PermissionAction(), api.Get)
  20. r.POST("", api.Insert)
  21. r.PUT("/:id", actions.PermissionAction(), api.Update)
  22. r.DELETE("", api.Delete)
  23. }
  24. }
  25. func registerOtMonitorRulesRouterNocheck(v1 *gin.RouterGroup) {
  26. api := apis.OtMonitorRules{}
  27. r := v1.Group("/monitor-rules")
  28. {
  29. r.GET("", api.GetPage)
  30. r.GET("/:id", api.Get)
  31. r.POST("", api.Insert)
  32. r.PUT("/:id", api.Update)
  33. r.DELETE("", api.Delete)
  34. }
  35. }