2022-08-18 18:54:21 +08:00
|
|
|
package router
|
|
|
|
|
|
|
|
import (
|
2022-10-17 16:32:31 +08:00
|
|
|
v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1"
|
|
|
|
"github.com/1Panel-dev/1Panel/backend/middleware"
|
2022-08-18 18:54:21 +08:00
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
|
|
|
type HostRouter struct{}
|
|
|
|
|
|
|
|
func (s *HostRouter) InitHostRouter(Router *gin.RouterGroup) {
|
2022-09-29 16:15:59 +08:00
|
|
|
hostRouter := Router.Group("hosts").
|
|
|
|
Use(middleware.JwtAuth()).
|
|
|
|
Use(middleware.SessionAuth()).
|
|
|
|
Use(middleware.PasswordExpired())
|
2022-08-18 18:54:21 +08:00
|
|
|
baseApi := v1.ApiGroupApp.BaseApi
|
|
|
|
{
|
2022-12-13 18:54:28 +08:00
|
|
|
hostRouter.POST("", baseApi.CreateHost)
|
|
|
|
hostRouter.POST("/del", baseApi.DeleteHost)
|
|
|
|
hostRouter.POST("/update", baseApi.UpdateHost)
|
2023-03-01 17:43:28 +08:00
|
|
|
hostRouter.POST("/update/group", baseApi.UpdateHostGroup)
|
|
|
|
hostRouter.POST("/search", baseApi.SearchHost)
|
|
|
|
hostRouter.POST("/tree", baseApi.HostTree)
|
2023-01-03 14:37:17 +08:00
|
|
|
hostRouter.POST("/test/byinfo", baseApi.TestByInfo)
|
|
|
|
hostRouter.POST("/test/byid/:id", baseApi.TestByID)
|
2022-08-31 23:16:10 +08:00
|
|
|
hostRouter.GET(":id", baseApi.GetHostInfo)
|
2023-02-13 17:13:55 +08:00
|
|
|
|
2023-03-27 19:02:36 +08:00
|
|
|
hostRouter.POST("/firewall/search", baseApi.SearchFirewallRule)
|
|
|
|
hostRouter.POST("/firewall/port", baseApi.OperatePortRule)
|
|
|
|
hostRouter.POST("/firewall/ip", baseApi.OperateIPRule)
|
|
|
|
|
2023-02-13 17:13:55 +08:00
|
|
|
hostRouter.GET("/command", baseApi.ListCommand)
|
|
|
|
hostRouter.POST("/command", baseApi.CreateCommand)
|
|
|
|
hostRouter.POST("/command/del", baseApi.DeleteCommand)
|
|
|
|
hostRouter.POST("/command/search", baseApi.SearchCommand)
|
|
|
|
hostRouter.POST("/command/update", baseApi.UpdateCommand)
|
2022-08-18 18:54:21 +08:00
|
|
|
}
|
|
|
|
}
|