-
Notifications
You must be signed in to change notification settings - Fork 0
/
es_data_collector.go
52 lines (41 loc) · 1.76 KB
/
es_data_collector.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"eslasticsearchdatacollector/controllers"
"eslasticsearchdatacollector/dao"
"eslasticsearchdatacollector/elasticsearch"
"eslasticsearchdatacollector/scheduler"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
_ "github.com/go-sql-driver/mysql"
)
func main() {
webApp := gin.Default()
dao.ConnectDatabase()
elasticsearch.ConnectElasticsearch()
scheduler.InitializeSchedulerAndActivateJobs()
webApp.Use(cors.New(cors.Config{
AllowOrigins: []string{"*"},
AllowMethods: []string{"*"},
AllowHeaders: []string{"*"},
ExposeHeaders: []string{"*"},
AllowCredentials: true,
}))
webApp.GET("/datasources", controllers.FindDatasources)
webApp.GET("/datasources/:id", controllers.GetDatasourceById)
webApp.POST("/datasources", controllers.CreateDataSource)
webApp.PUT("/datasources/:id", controllers.UpdateDatasource)
webApp.DELETE("/datasources/:id", controllers.DeleteDatasourceById)
webApp.GET("/indices", controllers.FindIndices)
webApp.GET("/indices/:id", controllers.GetIndexById)
webApp.POST("/indices", controllers.CreateIndex)
webApp.DELETE("/indices/:id", controllers.DeleteIndexById)
webApp.PUT("/indices/:id", controllers.UpdateIndex)
webApp.PUT("/indices/:id/schedule-data-sync", controllers.IndexScheduleDataSync)
webApp.DELETE("/indices/:id/unschedule-data-sync", controllers.IndexUnscheduleDataSync)
webApp.GET("/indices/sync-daily-status-stats", controllers.GetIndexSyncDailyStatusStats)
webApp.GET("/indices/sync-daily-record-stats", controllers.GetIndexSyncDailyRecordStats)
webApp.POST("/indices/:id/start-sync-immediately", controllers.StartSyncImmetiately)
webApp.POST("/query-meta-data/preview", controllers.PreviewQueryMetaData)
webApp.GET("/sync-logs", controllers.FindSyncLogs)
webApp.Run()
}