-
Notifications
You must be signed in to change notification settings - Fork 18
/
Example.go
43 lines (31 loc) · 1.51 KB
/
Example.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
package main
import (
apiClient "github.com/AliceO2Group/Bookkeeping/go-api-client/src"
sw "github.com/AliceO2Group/Bookkeeping/go-api-client/src/go-client-generated"
)
func main() {
// Set base url and api token
baseUrl := "http://localhost:4000/api"
apiToken := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MCwidXNlcm5hbWUiOiJhbm9ueW1vdXMiLCJuYW1lIjoiQW5vbnltb3VzIiwiYWNjZXNzIjowLCJpYXQiOjE2MzM2ODQ3MDcsImV4cCI6MTY2NTI0MjMwNywiaXNzIjoibzItdWkifQ.bWbXX5tSgElHCx9bEeRRjGbd2ISckPpCYSwJnOh8mV0"
// Create an Unix Timestamp to local time.
testTime := int64(1656936788677)
// Initialize api with manual JWT token + baseurl
// TODO: generate correct JWT token instead of manual insertion
apiClient.InitializeApi(baseUrl, apiToken)
// Create a run
apiClient.CreateRun("go-api-Timestamp", 5, 5, 1, 130, "COSMIC", false, false, true, "normal", "hash",
(sw.CPV_Detectors + "," + sw.ZDC_Detectors + "," + sw.EMC_Detectors))
// Update a run
apiClient.UpdateRun(130, sw.BAD_RunQuality, -1, testTime, -1, testTime, "LTU", "Repository Hash",
"production/production.desc", "processing", "lhc22_b", "production/production-system.desc", "QC,GPU,CTF,EVENT_DISPLAY", "cosmic", "Repository hash")
// Create an flp
apiClient.CreateFlp("flpTestName", "flpTestHost", 80)
// Update an flp
apiClient.UpdateFlp("flpTestName", 80, 100, 200, 300, 400)
// Create a log
apiClient.CreateLog("logTest", "logTest", "80", -1)
// Retrieve all logs from the api
apiClient.GetLogs()
// Retrieve all runs from the api
apiClient.GetRuns()
}