2022-10-20 10:45:47 +00: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{}
|
|
|
|
|
2023-12-20 14:44:09 +00:00
|
|
|
func (s *DatabaseRouter) InitRouter(Router *gin.RouterGroup) {
|
2022-10-20 10:45:47 +00:00
|
|
|
cmdRouter := Router.Group("databases").
|
|
|
|
Use(middleware.JwtAuth()).
|
|
|
|
Use(middleware.SessionAuth()).
|
|
|
|
Use(middleware.PasswordExpired())
|
|
|
|
baseApi := v1.ApiGroupApp.BaseApi
|
|
|
|
{
|
2024-01-08 09:40:42 +00:00
|
|
|
cmdRouter.POST("/common/info", baseApi.LoadDBBaseInfo)
|
|
|
|
cmdRouter.POST("/common/load/file", baseApi.LoadDBFile)
|
|
|
|
cmdRouter.POST("/common/update/conf", baseApi.UpdateDBConfByFile)
|
|
|
|
|
2022-12-13 10:54:28 +00:00
|
|
|
cmdRouter.POST("", baseApi.CreateMysql)
|
2023-12-25 09:08:09 +00:00
|
|
|
cmdRouter.POST("/bind", baseApi.BindUser)
|
2023-08-29 02:50:15 +00:00
|
|
|
cmdRouter.POST("load", baseApi.LoadDBFromRemote)
|
2022-12-13 10:54:28 +00:00
|
|
|
cmdRouter.POST("/change/access", baseApi.ChangeMysqlAccess)
|
|
|
|
cmdRouter.POST("/change/password", baseApi.ChangeMysqlPassword)
|
|
|
|
cmdRouter.POST("/del/check", baseApi.DeleteCheckMysql)
|
|
|
|
cmdRouter.POST("/del", baseApi.DeleteMysql)
|
2022-12-24 05:31:30 +00:00
|
|
|
cmdRouter.POST("/description/update", baseApi.UpdateMysqlDescription)
|
2022-12-13 10:54:28 +00:00
|
|
|
cmdRouter.POST("/variables/update", baseApi.UpdateMysqlVariables)
|
2022-10-20 10:45:47 +00:00
|
|
|
cmdRouter.POST("/search", baseApi.SearchMysql)
|
2023-08-29 02:50:15 +00:00
|
|
|
cmdRouter.POST("/variables", baseApi.LoadVariables)
|
|
|
|
cmdRouter.POST("/status", baseApi.LoadStatus)
|
|
|
|
cmdRouter.POST("/remote", baseApi.LoadRemoteAccess)
|
2022-11-30 07:47:11 +00:00
|
|
|
cmdRouter.GET("/options", baseApi.ListDBName)
|
2022-10-31 09:26:15 +00:00
|
|
|
|
2022-11-02 08:28:54 +00:00
|
|
|
cmdRouter.GET("/redis/persistence/conf", baseApi.LoadPersistenceConf)
|
|
|
|
cmdRouter.GET("/redis/status", baseApi.LoadRedisStatus)
|
|
|
|
cmdRouter.GET("/redis/conf", baseApi.LoadRedisConf)
|
2022-12-29 09:06:04 +00:00
|
|
|
cmdRouter.GET("/redis/exec", baseApi.RedisWsSsh)
|
2022-12-12 06:06:39 +00:00
|
|
|
cmdRouter.POST("/redis/password", baseApi.ChangeRedisPassword)
|
2022-12-20 10:59:26 +00:00
|
|
|
cmdRouter.POST("/redis/backup/search", baseApi.RedisBackupList)
|
2022-11-02 10:30:22 +00:00
|
|
|
cmdRouter.POST("/redis/conf/update", baseApi.UpdateRedisConf)
|
2022-12-13 10:54:28 +00:00
|
|
|
cmdRouter.POST("/redis/persistence/update", baseApi.UpdateRedisPersistenceConf)
|
2023-07-20 09:51:57 +00:00
|
|
|
|
2023-08-29 02:50:15 +00:00
|
|
|
cmdRouter.POST("/db/check", baseApi.CheckDatabase)
|
|
|
|
cmdRouter.POST("/db", baseApi.CreateDatabase)
|
|
|
|
cmdRouter.GET("/db/:name", baseApi.GetDatabase)
|
|
|
|
cmdRouter.GET("/db/list/:type", baseApi.ListDatabase)
|
2024-01-07 14:52:41 +00:00
|
|
|
cmdRouter.GET("/db/item/:type", baseApi.LoadDatabaseItems)
|
2023-08-29 02:50:15 +00:00
|
|
|
cmdRouter.POST("/db/update", baseApi.UpdateDatabase)
|
|
|
|
cmdRouter.POST("/db/search", baseApi.SearchDatabase)
|
2023-10-08 06:52:14 +00:00
|
|
|
cmdRouter.POST("/db/del/check", baseApi.DeleteCheckDatabase)
|
2023-08-29 02:50:15 +00:00
|
|
|
cmdRouter.POST("/db/del", baseApi.DeleteDatabase)
|
2023-12-28 08:29:18 +00:00
|
|
|
|
|
|
|
cmdRouter.POST("/pg", baseApi.CreatePostgresql)
|
|
|
|
cmdRouter.POST("/pg/search", baseApi.SearchPostgresql)
|
2024-01-08 09:40:42 +00:00
|
|
|
cmdRouter.POST("/pg/:database/load", baseApi.LoadPostgresqlDBFromRemote)
|
|
|
|
cmdRouter.POST("/pg/bind", baseApi.BindPostgresqlUser)
|
2023-12-28 08:29:18 +00:00
|
|
|
cmdRouter.POST("/pg/del/check", baseApi.DeleteCheckPostgresql)
|
2024-01-08 09:40:42 +00:00
|
|
|
cmdRouter.POST("/pg/del", baseApi.DeletePostgresql)
|
2024-01-09 04:43:33 +00:00
|
|
|
cmdRouter.POST("/pg/privileges", baseApi.ChangePostgresqlPrivileges)
|
2023-12-28 08:29:18 +00:00
|
|
|
cmdRouter.POST("/pg/password", baseApi.ChangePostgresqlPassword)
|
|
|
|
cmdRouter.POST("/pg/description", baseApi.UpdatePostgresqlDescription)
|
2022-10-20 10:45:47 +00:00
|
|
|
}
|
|
|
|
}
|