imbytecat 8b7e7a3f85
All checks were successful
Template Cleanup / Template Cleanup (push) Has been skipped
convert to template
2024-09-04 11:36:03 +08:00

44 lines
1.3 KiB
Go

package router
import (
"github.com/gin-gonic/gin"
"zabbixagent2plugintemplate/integration/zabbixagent"
"zabbixagent2plugintemplate/router/handler"
"zabbixagent2plugintemplate/router/handler/onvif"
)
func SetupRoutes(r *gin.Engine) {
r.GET("/", handler.Hello)
onvifGroup := r.Group("/onvif")
{
connectionGroup := onvifGroup.Group("/sessions")
{
connectionGroup.POST("/", onvif.CreateSession)
connectionGroup.GET("/", onvif.GetSessions)
connectionGroup.GET("/:xaddr", onvif.GetSessionByXaddr)
connectionGroup.DELETE("/:xaddr", onvif.DeleteSessionByXaddr)
}
subscriptionGroup := onvifGroup.Group("/subscriptions")
{
subscriptionGroup.POST("/:xaddr", onvif.CreateSubscription)
subscriptionGroup.POST("/:xaddr/callback", onvif.NotifyCallback)
}
notificationGroup := onvifGroup.Group("/notifications")
{
notificationGroup.GET("/", onvif.GetNotifications)
notificationGroup.GET("/:xaddr", onvif.GetNotificationByXaddr)
notificationGroup.DELETE("/:xaddr", onvif.DeleteNotificationByXaddr)
}
}
zabbixGroup := r.Group("/zabbix")
{
zabbixGroup.POST("/DiscoverONVIFDevices", zabbixagent.DiscoverONVIFDevices)
zabbixGroup.POST("/RegisterONVIFDevices", zabbixagent.RegisterONVIFDevices)
zabbixGroup.POST("/ConsumeONVIFNotifications", zabbixagent.ConsumeONVIFNotifications)
}
}