2021-04-16 15:10:07 +08:00
|
|
|
package routers
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"mayfly-go/base/ctx"
|
2021-06-07 17:22:07 +08:00
|
|
|
"mayfly-go/server/devops/apis"
|
|
|
|
|
"mayfly-go/server/devops/application"
|
2021-04-16 15:10:07 +08:00
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func InitMachineRouter(router *gin.RouterGroup) {
|
2021-05-08 18:00:33 +08:00
|
|
|
m := &apis.Machine{MachineApp: application.Machine}
|
2021-04-16 15:10:07 +08:00
|
|
|
db := router.Group("machines")
|
|
|
|
|
{
|
|
|
|
|
db.GET("", func(c *gin.Context) {
|
2021-05-08 18:00:33 +08:00
|
|
|
ctx.NewReqCtxWithGin(c).Handle(m.Machines)
|
2021-04-16 15:10:07 +08:00
|
|
|
})
|
|
|
|
|
|
2021-05-08 18:00:33 +08:00
|
|
|
db.POST("", func(c *gin.Context) {
|
|
|
|
|
ctx.NewReqCtxWithGin(c).Handle(m.SaveMachine)
|
2021-04-16 15:10:07 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
db.GET(":machineId/top", func(c *gin.Context) {
|
2021-05-08 18:00:33 +08:00
|
|
|
ctx.NewReqCtxWithGin(c).Handle(m.Top)
|
2021-04-16 15:10:07 +08:00
|
|
|
})
|
|
|
|
|
|
2021-05-08 18:00:33 +08:00
|
|
|
db.GET(":machineId/terminal", m.WsSSH)
|
2021-04-16 15:10:07 +08:00
|
|
|
}
|
|
|
|
|
}
|