MCPcopy
hub / github.com/apache/devlake / RegisterRouter

Function RegisterRouter

backend/server/api/router.go:45–98  ·  view source on GitHub ↗
(r *gin.Engine, basicRes context.BasicRes)

Source from the content-addressed store, hash-verified

43)
44
45func RegisterRouter(r *gin.Engine, basicRes context.BasicRes) {
46 r.GET("/pipelines", pipelines.Index)
47 r.POST("/pipelines", pipelines.Post)
48 r.GET("/pipelines/:pipelineId", pipelines.Get)
49 r.DELETE("/pipelines/:pipelineId", pipelines.Delete)
50 r.GET("/pipelines/:pipelineId/tasks", task.GetTaskByPipeline)
51 r.GET("/pipelines/:pipelineId/subtasks", task.GetSubtaskByPipeline)
52 r.POST("/pipelines/:pipelineId/rerun", pipelines.PostRerun)
53 r.GET("/pipelines/:pipelineId/logging.tar.gz", pipelines.DownloadLogs)
54
55 r.GET("/blueprints", blueprints.Index)
56 r.POST("/blueprints", blueprints.Post)
57 r.PATCH("/blueprints/:blueprintId", blueprints.Patch)
58 r.DELETE("/blueprints/:blueprintId", blueprints.Delete)
59 r.GET("/blueprints/:blueprintId", blueprints.Get)
60 r.POST("/blueprints/:blueprintId/trigger", blueprints.Trigger)
61 r.GET("/blueprints/:blueprintId/pipelines", blueprints.GetBlueprintPipelines)
62
63 r.POST("/tasks/:taskId/rerun", task.PostRerun)
64
65 r.POST("/push/:tableName", push.Post)
66 r.GET("/domainlayer/repos", domainlayer.ReposIndex)
67
68 // plugin api
69 r.GET("/plugininfo", plugininfo.Get)
70 r.GET("/plugins", plugininfo.GetPluginMetas)
71
72 // project api
73 r.GET("/projects/:projectName", project.GetProject)
74 r.GET("/projects/:projectName/check", project.GetProjectCheck)
75 r.PATCH("/projects/:projectName", project.PatchProject)
76 r.DELETE("/projects/:projectName", project.DeleteProject)
77 r.POST("/projects", project.PostProject)
78 r.GET("/projects", project.GetProjects)
79 // on board api
80 r.GET("/store/:storeKey", store.GetStore)
81 r.PUT("/store/:storeKey", store.PutStore)
82
83 // api keys api
84 r.GET("/api-keys", apikeys.GetApiKeys)
85 r.POST("/api-keys", apikeys.PostApiKey)
86 r.PUT("/api-keys/:apiKeyId", apikeys.PutApiKey)
87 r.DELETE("/api-keys/:apiKeyId", apikeys.DeleteApiKey)
88
89 // mount all api resources for all plugins
90 resources, err := services.GetPluginsApiResources()
91 if err != nil {
92 panic(err)
93 }
94 // mount all api resources for all plugins
95 for pluginName, apiResources := range resources {
96 registerPluginEndpoints(r, basicRes, pluginName, apiResources)
97 }
98}
99
100func registerPluginEndpoints(r *gin.Engine, basicRes context.BasicRes, pluginName string, apiResources map[string]map[string]plugin.ApiResourceHandler) {
101 for resourcePath, resourceHandlers := range apiResources {

Callers 1

SetupApiServerFunction · 0.85

Calls 1

registerPluginEndpointsFunction · 0.85

Tested by

no test coverage detected