59 lines
1.5 KiB
Go
59 lines
1.5 KiB
Go
package server
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func (s *Server) router(e *gin.Engine) {
|
|
base := e.Group("/api")
|
|
apiV1 := base.Group("/v1")
|
|
{
|
|
apiV1.GET("/ping", func(c *gin.Context) {
|
|
c.String(200, "alive")
|
|
})
|
|
}
|
|
|
|
//s.bindGroupRouter(apiV1.Group("/group"))
|
|
//s.bindAgentRouter(apiV1.Group("/instance"))
|
|
}
|
|
|
|
//func (s *Server) bindGroupRouter(r *gin.RouterGroup) {
|
|
// group := s.group
|
|
//
|
|
// r.GET("/list", api(group.List()))
|
|
// r.POST("/new", api(group.New()))
|
|
//
|
|
// byID := r.Group("/:id")
|
|
// // manage relation
|
|
// byID.PUT("/join", api(group.Join()))
|
|
// byID.DELETE("/delete", api(group.Delete()))
|
|
// byID.GET("/list", api(group.ListInstance()))
|
|
// // batch operation
|
|
// byID.POST("/up", api(group.Up()))
|
|
// byID.POST("/down", api(group.Down()))
|
|
// byID.POST("/update", api(group.Update()))
|
|
// // config
|
|
// byID.GET("/config", api(group.GetConfig()))
|
|
// byID.POST("/config", api(group.SaveConfig()))
|
|
// byID.POST("/save", api(group.Save()))
|
|
//}
|
|
//
|
|
//func (s *Server) bindAgentRouter(r *gin.RouterGroup) {
|
|
// agent := s.instance
|
|
//
|
|
// r.POST("/up", api(agent.BatchUp()))
|
|
// r.POST("/down", api(agent.BatchDown()))
|
|
// r.POST("/update", api(agent.Update()))
|
|
// r.DELETE("/delete", api(agent.Delete()))
|
|
//
|
|
// byID := r.Group("/:id")
|
|
// byID.GET("/config", api(agent.GetConfig()))
|
|
// byID.GET("/info", api(agent.Info()))
|
|
// byID.GET("/log", api(agent.Log()))
|
|
// // operation
|
|
// byID.POST("/up", api(agent.Up()))
|
|
// byID.POST("/down", api(agent.Down()))
|
|
// byID.POST("/update", api(agent.Update()))
|
|
// byID.DELETE("/delete", api(agent.Delete()))
|
|
//}
|