-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
68 lines (59 loc) · 1.37 KB
/
main.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package main
import (
"configserver_test/flags/agent"
"configserver_test/flags/user"
"flag"
"fmt"
)
var Request = flag.String("request", "", "")
type Value interface {
String() string
Set(string) error
}
type sliceFlag []string
func (f *sliceFlag) String() string {
return fmt.Sprintf("%v", []string(*f))
}
func (f *sliceFlag) Set(value string) error {
*f = append(*f, value)
return nil
}
var configs sliceFlag
func main() {
flag.Var(&configs, "configs", "Pipline configs, for example: -configs=a.yaml -host=b.yaml")
flag.Parse()
switch *Request {
case "CreateAgentGroup":
user.CreateAgentGroup()
case "UpdateAgentGroup":
user.UpdateAgentGroup()
case "DeleteAgentGroup":
user.DeleteAgentGroup()
case "GetAgentGroup":
user.GetAgentGroup()
case "ListAgentGroups":
user.ListAgentGroups()
case "CreateConfig":
user.CreateConfig()
case "UpdateConfig":
user.UpdateConfig()
case "DeleteConfig":
user.DeleteConfig()
case "GetConfig":
user.GetConfig()
case "ListConfigs":
user.ListConfigs()
case "ApplyConfigToAgentGroup":
user.ApplyConfigToAgentGroup()
case "RemoveConfigFromAgentGroup":
user.RemoveConfigFromAgentGroup()
case "GetAppliedConfigsForAgentGroup":
user.GetAppliedConfigsForAgentGroup()
case "GetAppliedAgentGroups":
user.GetAppliedAgentGroups()
case "ListAgents":
user.ListAgents()
case "HeartBeat":
agent.HeartBeat(configs)
}
}