2022-10-08 18:32:02 +08:00
|
|
|
package router
|
|
|
|
|
|
|
|
import (
|
|
|
|
v1 "github.com/1Panel-dev/1Panel/app/api/v1"
|
|
|
|
"github.com/1Panel-dev/1Panel/middleware"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ContainerRouter struct{}
|
|
|
|
|
|
|
|
func (s *ContainerRouter) InitContainerRouter(Router *gin.RouterGroup) {
|
|
|
|
baRouter := Router.Group("containers").
|
|
|
|
Use(middleware.JwtAuth()).
|
|
|
|
Use(middleware.SessionAuth()).
|
|
|
|
Use(middleware.PasswordExpired())
|
|
|
|
withRecordRouter := Router.Group("containers").
|
|
|
|
Use(middleware.JwtAuth()).
|
|
|
|
Use(middleware.SessionAuth()).
|
|
|
|
Use(middleware.PasswordExpired()).
|
|
|
|
Use(middleware.OperationRecord())
|
|
|
|
baseApi := v1.ApiGroupApp.BaseApi
|
|
|
|
{
|
|
|
|
baRouter.POST("/search", baseApi.SearchContainer)
|
2022-10-11 19:47:16 +08:00
|
|
|
baRouter.POST("/inspect", baseApi.Inspect)
|
2022-10-12 18:55:47 +08:00
|
|
|
baRouter.POST("", baseApi.ContainerCreate)
|
2022-10-08 18:32:02 +08:00
|
|
|
withRecordRouter.POST("operate", baseApi.ContainerOperation)
|
|
|
|
withRecordRouter.POST("/log", baseApi.ContainerLogs)
|
2022-10-13 18:24:24 +08:00
|
|
|
withRecordRouter.GET("/stats/:id", baseApi.ContainerStats)
|
2022-10-09 16:17:15 +08:00
|
|
|
|
2022-10-10 15:14:49 +08:00
|
|
|
baRouter.POST("/repo/search", baseApi.SearchRepo)
|
2022-10-09 16:17:15 +08:00
|
|
|
baRouter.PUT("/repo/:id", baseApi.UpdateRepo)
|
2022-10-10 15:14:49 +08:00
|
|
|
baRouter.GET("/repo", baseApi.ListRepo)
|
2022-10-09 16:17:15 +08:00
|
|
|
withRecordRouter.POST("/repo", baseApi.CreateRepo)
|
|
|
|
withRecordRouter.POST("/repo/del", baseApi.DeleteRepo)
|
2022-10-10 15:14:49 +08:00
|
|
|
|
2022-10-17 16:04:39 +08:00
|
|
|
baRouter.POST("/compose/search", baseApi.SearchCompose)
|
|
|
|
baRouter.POST("/compose/up", baseApi.CreateCompose)
|
|
|
|
baRouter.POST("/compose/operate", baseApi.OperatorCompose)
|
|
|
|
|
|
|
|
baRouter.POST("/template/search", baseApi.SearchComposeTemplate)
|
|
|
|
baRouter.PUT("/template/:id", baseApi.UpdateComposeTemplate)
|
|
|
|
baRouter.GET("/template", baseApi.ListComposeTemplate)
|
|
|
|
withRecordRouter.POST("/template", baseApi.CreateComposeTemplate)
|
|
|
|
withRecordRouter.POST("/template/del", baseApi.DeleteComposeTemplate)
|
2022-10-17 09:10:06 +08:00
|
|
|
|
2022-10-10 15:14:49 +08:00
|
|
|
baRouter.POST("/image/search", baseApi.SearchImage)
|
2022-10-12 18:55:47 +08:00
|
|
|
baRouter.GET("/image", baseApi.ListImage)
|
2022-10-10 15:14:49 +08:00
|
|
|
baRouter.POST("/image/pull", baseApi.ImagePull)
|
|
|
|
baRouter.POST("/image/push", baseApi.ImagePush)
|
|
|
|
baRouter.POST("/image/save", baseApi.ImageSave)
|
|
|
|
baRouter.POST("/image/load", baseApi.ImageLoad)
|
|
|
|
baRouter.POST("/image/remove", baseApi.ImageRemove)
|
2022-10-11 17:46:52 +08:00
|
|
|
baRouter.POST("/image/tag", baseApi.ImageTag)
|
2022-10-12 13:42:58 +08:00
|
|
|
baRouter.POST("/image/build", baseApi.ImageBuild)
|
2022-10-11 14:20:51 +08:00
|
|
|
|
|
|
|
baRouter.POST("/network/del", baseApi.DeleteNetwork)
|
|
|
|
baRouter.POST("/network/search", baseApi.SearchNetwork)
|
|
|
|
baRouter.POST("/network", baseApi.CreateNetwork)
|
|
|
|
baRouter.POST("/volume/del", baseApi.DeleteVolume)
|
|
|
|
baRouter.POST("/volume/search", baseApi.SearchVolume)
|
2022-10-12 18:55:47 +08:00
|
|
|
baRouter.GET("/volume", baseApi.ListVolume)
|
2022-10-11 14:20:51 +08:00
|
|
|
baRouter.POST("/volume", baseApi.CreateVolume)
|
2022-10-08 18:32:02 +08:00
|
|
|
}
|
|
|
|
}
|