@title dtle API Docs @version 2.0 @description This is a sample server for dev. @securityDefinitions.apikey ApiKeyAuth @in header @name Authorization @BasePath /
(logger g.LoggerType, driverConfig *dtle.DriverConfig)
| 37 | // @BasePath / |
| 38 | |
| 39 | func SetupApiServer(logger g.LoggerType, driverConfig *dtle.DriverConfig) (err error) { |
| 40 | logger.Debug("Begin Setup api server", "addr", driverConfig.ApiAddr) |
| 41 | e := echo.New() |
| 42 | |
| 43 | // adapt to stdout |
| 44 | e.StdLogger = handler.NewLogger().StandardLogger(&hclog.StandardLoggerOptions{ |
| 45 | InferLevels: false, |
| 46 | ForceLevel: hclog.Debug, |
| 47 | }) |
| 48 | |
| 49 | handler.NomadHost = driverConfig.NomadAddr |
| 50 | handler.ApiAddr = driverConfig.ApiAddr |
| 51 | handler.ConsulAddr = driverConfig.Consul |
| 52 | |
| 53 | e.GET("/swagger/*", echoSwagger.WrapHandler) |
| 54 | |
| 55 | // api v1 |
| 56 | v1Router := e.Group("/v1") |
| 57 | v1Router.Use(JWTTokenAdapter(), middleware.JWT([]byte(common.JWTSecret)), AuthFilter()) |
| 58 | v1Router.GET("/job/:jobId", v1.JobDetailRequest) |
| 59 | v1Router.DELETE("/job/:jobId", v1.JobDeleteRequest) |
| 60 | v1Router.GET("/job/:jobId/:path", v1.JobRequest) |
| 61 | v1Router.POST("/jobs", v1.UpdupJob) |
| 62 | v1Router.GET("/jobs", v1.JobListRequest) |
| 63 | v1Router.GET("/allocations", v1.AllocsRequest) |
| 64 | v1Router.GET("/allocation/:allocID", v1.AllocSpecificRequest) |
| 65 | v1Router.GET("/evaluations", v1.EvalsRequest) |
| 66 | v1Router.GET("/evaluation/:evalID/:type", v1.EvalRequest) |
| 67 | v1Router.GET("/agent/allocation/:tokens", v1.ClientAllocRequest) |
| 68 | v1Router.GET("/self", v1.AgentSelfRequest) |
| 69 | v1Router.POST("/join", v1.AgentJoinRequest) |
| 70 | v1Router.POST("/agent/force-leave", v1.AgentForceLeaveRequest) |
| 71 | v1Router.GET("/members", v1.AgentMembersRequest) |
| 72 | v1Router.POST("/managers", v1.UpdateServers) |
| 73 | v1Router.GET("/managers", v1.ListServers) |
| 74 | v1Router.GET("/regions", v1.RegionListRequest) |
| 75 | v1Router.GET("/leader", v1.StatusLeaderRequest) |
| 76 | v1Router.GET("/peers", v1.StatusPeersRequest) |
| 77 | v1Router.POST("/validate/job", v1.ValidateJobRequest) |
| 78 | v1Router.GET("/nodes", v1.NodesRequest) |
| 79 | v1Router.GET("/node/:nodeName/:type", v1.NodeRequest) |
| 80 | |
| 81 | // api v2 |
| 82 | v2Router := e.Group("/v2") |
| 83 | v2Router.Use(JWTTokenAdapter(), middleware.JWT([]byte(common.JWTSecret)), AuthFilter()) |
| 84 | e.POST("/v2/login", v2.LoginV2) |
| 85 | e.POST("/v2/loginWithoutVerifyCode", v2.LoginWithoutVerifyCodeV2) |
| 86 | e.POST("/v2/login/captcha", v2.CaptchaV2) |
| 87 | e.GET("/v2/monitor/task", v2.GetTaskProgressV2) |
| 88 | e.POST("/v2/log/level", v2.UpdateLogLevelV2) |
| 89 | e.GET("/v2/job/diagnosis", v2.DiagnosisJobV2) |
| 90 | v2Router.GET("/jobs/migration", v2.MigrationJobListV2) |
| 91 | v2Router.GET("/job/migration/detail", v2.GetMigrationJobDetailV2) |
| 92 | v2Router.POST("/job/migration/create", v2.CreateMigrationJobV2) |
| 93 | v2Router.POST("/job/migration/update", v2.UpdateMigrationJobV2) |
| 94 | v2Router.POST("/job/migration/reverse", v2.ReverseMigrationJobV2) |
| 95 | v2Router.POST("/job/migration/pause", v2.PauseMigrationJobV2) |
| 96 | v2Router.POST("/job/migration/resume", v2.ResumeMigrationJobV2) |
nothing calls this directly
no test coverage detected