forked from zorkian/go-datadog-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhosts.go
33 lines (29 loc) · 947 Bytes
/
hosts.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
package datadog
type HostActionResp struct {
Action string `json:"action"`
Hostname string `json:"hostname"`
Message string `json:"message,omitempty"`
}
type HostActionMute struct {
Message *string `json:"message,omitempty"`
EndTime *string `json:"end,omitempty"`
Override *bool `json:"override,omitempty"`
}
// MuteHost mutes all monitors for the given host
func (client *Client) MuteHost(host string, action *HostActionMute) (*HostActionResp, error) {
var out HostActionResp
uri := "/v1/host/" + host + "/mute"
if err := client.doJsonRequest("POST", uri, action, &out); err != nil {
return nil, err
}
return &out, nil
}
// UnmuteHost unmutes all monitors for the given host
func (client *Client) UnmuteHost(host string) (*HostActionResp, error) {
var out HostActionResp
uri := "/v1/host/" + host + "/unmute"
if err := client.doJsonRequest("POST", uri, nil, &out); err != nil {
return nil, err
}
return &out, nil
}