2022-10-20 18:45:47 +08:00
|
|
|
package router
|
|
|
|
|
|
|
|
import (
|
|
|
|
v1 "github.com/1Panel-dev/1Panel/backend/app/api/v1"
|
|
|
|
"github.com/1Panel-dev/1Panel/backend/middleware"
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
|
|
|
type DatabaseRouter struct{}
|
|
|
|
|
|
|
|
func (s *DatabaseRouter) InitDatabaseRouter(Router *gin.RouterGroup) {
|
|
|
|
cmdRouter := Router.Group("databases").
|
|
|
|
Use(middleware.JwtAuth()).
|
|
|
|
Use(middleware.SessionAuth()).
|
|
|
|
Use(middleware.PasswordExpired())
|
|
|
|
withRecordRouter := Router.Group("databases").
|
|
|
|
Use(middleware.JwtAuth()).
|
|
|
|
Use(middleware.SessionAuth()).
|
|
|
|
Use(middleware.PasswordExpired()).
|
|
|
|
Use(middleware.OperationRecord())
|
|
|
|
baseApi := v1.ApiGroupApp.BaseApi
|
|
|
|
{
|
|
|
|
withRecordRouter.POST("", baseApi.CreateMysql)
|
2022-10-24 18:46:19 +08:00
|
|
|
withRecordRouter.PUT("/:id", baseApi.UpdateMysql)
|
2022-10-27 23:09:39 +08:00
|
|
|
withRecordRouter.POST("/backup", baseApi.BackupMysql)
|
|
|
|
withRecordRouter.POST("/recover", baseApi.RecoverMysql)
|
|
|
|
withRecordRouter.POST("/backups/search", baseApi.SearchDBBackups)
|
2022-10-20 18:45:47 +08:00
|
|
|
withRecordRouter.POST("/del", baseApi.DeleteMysql)
|
2022-10-25 11:41:19 +08:00
|
|
|
withRecordRouter.POST("/variables/update", baseApi.UpdateMysqlVariables)
|
2022-10-20 18:45:47 +08:00
|
|
|
cmdRouter.POST("/search", baseApi.SearchMysql)
|
2022-10-31 23:52:39 +08:00
|
|
|
cmdRouter.GET("/variables/:name", baseApi.LoadVariables)
|
|
|
|
cmdRouter.GET("/status/:name", baseApi.LoadStatus)
|
|
|
|
cmdRouter.GET("/baseinfo/:name", baseApi.LoadBaseinfo)
|
2022-10-25 18:34:33 +08:00
|
|
|
cmdRouter.GET("/versions", baseApi.LoadVersions)
|
2022-10-31 23:52:39 +08:00
|
|
|
cmdRouter.GET("/dbs/:name", baseApi.ListDBNameByVersion)
|
2022-10-31 17:26:15 +08:00
|
|
|
|
|
|
|
cmdRouter.POST("/redis/search", baseApi.SearchRedis)
|
|
|
|
withRecordRouter.POST("/redis", baseApi.SetRedis)
|
|
|
|
withRecordRouter.POST("/redis/del", baseApi.DeleteRedis)
|
2022-10-31 23:52:39 +08:00
|
|
|
withRecordRouter.POST("/redis/cleanall", baseApi.CleanRedis)
|
|
|
|
withRecordRouter.POST("/redis/status", baseApi.LoadRedisStatus)
|
|
|
|
withRecordRouter.POST("/redis/conf/update", baseApi.UpdateRedisConf)
|
|
|
|
withRecordRouter.POST("/redis/conf", baseApi.LoadRedisConf)
|
|
|
|
cmdRouter.GET("/redis/versions", baseApi.LoadRedisRunningVersion)
|
2022-10-20 18:45:47 +08:00
|
|
|
}
|
|
|
|
}
|