1Panel/backend/router/ro_database.go

55 lines
2.3 KiB
Go
Raw Normal View History

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)
withRecordRouter.PUT("/:id", baseApi.UpdateMysql)
withRecordRouter.POST("/backup", baseApi.BackupMysql)
2022-11-08 19:03:38 +08:00
withRecordRouter.POST("/uplist", baseApi.MysqlUpList)
withRecordRouter.POST("/uplist/upload/:mysqlName", baseApi.UploadMysqlFiles)
withRecordRouter.POST("/recover/byupload", baseApi.RecoverMysqlByUpload)
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-11-04 19:02:15 +08:00
withRecordRouter.POST("/variables/update/:mysqlName", baseApi.UpdateMysqlVariables)
withRecordRouter.POST("/conf/update/byfile", baseApi.UpdateMysqlConfByFile)
2022-10-20 18:45:47 +08:00
cmdRouter.POST("/search", baseApi.SearchMysql)
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)
cmdRouter.GET("/dbs/:name", baseApi.ListDBNameByVersion)
2022-10-31 17:26:15 +08:00
cmdRouter.GET("/redis/persistence/conf", baseApi.LoadPersistenceConf)
cmdRouter.GET("/redis/status", baseApi.LoadRedisStatus)
cmdRouter.GET("/redis/conf", baseApi.LoadRedisConf)
cmdRouter.GET("/redis/exec", baseApi.RedisExec)
2022-11-03 23:42:42 +08:00
cmdRouter.POST("/redis/backup", baseApi.RedisBackup)
cmdRouter.POST("/redis/recover", baseApi.RedisRecover)
cmdRouter.POST("/redis/backup/records", baseApi.RedisBackupList)
cmdRouter.POST("/redis/backup/del", baseApi.RedisBackupDelete)
cmdRouter.POST("/redis/conf/update", baseApi.UpdateRedisConf)
cmdRouter.POST("/redis/conf/update/byfile", baseApi.UpdateRedisConfByFile)
2022-11-03 23:42:42 +08:00
cmdRouter.POST("/redis/conf/update/persistence", baseApi.UpdateRedisPersistenceConf)
2022-10-20 18:45:47 +08:00
}
}