-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapiVersions.go
50 lines (44 loc) · 974 Bytes
/
apiVersions.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
package polyanalyst6api
var apiVersions = map[string][]string{
"1.0": {
"/project/nodes",
"/project/execution-statistics",
"/project/execute",
"/project/global-abort",
"/project/save",
"/project/unload",
"/project/repair",
"/project/delete",
"/dataset/preview",
"/scheduler/run-task",
"/project/tasks",
"/server/info",
"/parameters/configure",
"/parameters/nodes",
"/folder/create",
"/folder/delete",
"/logout",
"/project/is-running",
},
}
func checkPathSupported(v string, url string) bool {
for _, existingURL := range apiVersions[v] {
if existingURL == url {
return true
}
}
return false
}
func pathSupportedIn(url string) []string {
var res []string
allVersions := []string{}
for key := range apiVersions {
allVersions = append(allVersions, key)
}
for _, v := range allVersions {
if checkPathSupported(v, url) {
res = append(res, v)
}
}
return res
}