-
Notifications
You must be signed in to change notification settings - Fork 10
/
typedef.go
83 lines (71 loc) · 1.6 KB
/
typedef.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package notify
//EndPoint is exported
type EndPoint struct {
Name string `yaml:"name"`
URL string `yaml:"url"`
Enabled bool `yaml:"enabled"`
Sender string `yaml:"sender"`
Host string `yaml:"host"`
Port int `yaml:"port"`
User string `yaml:"user"`
Password string `yaml:"password"`
}
//Notifications is exported
type Notifications struct {
EndPoints []EndPoint `yaml:"endpoints,omitempty"`
}
//Server is exported
type Server struct {
IP string
Name string
State string
}
//WatchLocation is exported
type WatchLocation struct {
Name string
ContactInfo []string
Servers []*Server
}
//WatchLocations is exported
type WatchLocations map[string]*WatchLocation
//AddServer is exported
func (location *WatchLocation) AddServer(ip string, name string, state string) {
for _, server := range location.Servers {
if server.IP == ip || server.Name == name {
return
}
}
location.Servers = append(location.Servers, &Server{
IP: ip,
Name: name,
State: state,
})
}
//AddContactInfo is exported
func (location *WatchLocation) AddContactInfo(value string) {
for _, contactname := range location.ContactInfo {
if contactname == value {
return
}
}
location.ContactInfo = append(location.ContactInfo, value)
}
//JobResult is exported
type JobResult struct {
JobName string
Directory string
Location string
Server string
Execat string
IsSuccessd bool
Content string
Stdout string
Errout string
Execerr string
}
//WatchJobNotify is exported
type WatchJobNotify struct {
Name string
ContactInfo []string
JobResult
}