-
Notifications
You must be signed in to change notification settings - Fork 0
/
silenced.go
49 lines (41 loc) · 1.18 KB
/
silenced.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
package uchiwa
import "github.com/sensu/uchiwa/uchiwa/logger"
type silence struct {
ID string `json:"id"`
Dc string `json:"dc"`
Subscription string `json:"subscription,omitempty"`
Check string `json:"check,omitempty"`
Reason string `json:"reason,omitempty"`
Creator string `json:"creator,omitempty"`
Begin int32 `json:"begin,omitempty"`
Expire int32 `json:"expire,omitempty"`
ExpireOnResolve bool `json:"expire_on_resolve,omitempty"`
}
// ClearSilenced send a POST request to the /stashes endpoint in order to create a stash
func (u *Uchiwa) ClearSilenced(data silence) error {
api, err := getAPI(u.Datacenters, data.Dc)
if err != nil {
logger.Warning(err)
return err
}
_, err = api.ClearSilenced(data)
if err != nil {
logger.Warning(err)
return err
}
return nil
}
// PostSilence send a POST request to the /stashes endpoint in order to create a stash
func (u *Uchiwa) PostSilence(data silence) error {
api, err := getAPI(u.Datacenters, data.Dc)
if err != nil {
logger.Warning(err)
return err
}
_, err = api.Silence(data)
if err != nil {
logger.Warning(err)
return err
}
return nil
}