forked from thousandeyes/thousandeyes-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bgp_monitor.go
29 lines (25 loc) · 821 Bytes
/
bgp_monitor.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
package thousandeyes
import "fmt"
// BGPMonitors - list of bgp montors
type BGPMonitors []BGPMonitor
// BGPMonitor - BGPMonitor struct
type BGPMonitor struct {
MonitorID *int64 `json:"monitorId,omitempty"`
IPAddress *string `json:"ipAddress,omitempty"`
Network *string `json:"network,omitempty"`
MonitorType *string `json:"monitorType,omitempty"`
MonitorName *string `json:"monitorName,omitempty"`
}
// GetBPGMonitors - Get bgp monitors
func (c *Client) GetBPGMonitors() (*BGPMonitors, error) {
resp, err := c.get("/bgp-monitors")
if err != nil {
return &BGPMonitors{}, err
}
var target map[string]BGPMonitors
if dErr := c.decodeJSON(resp, &target); dErr != nil {
return nil, fmt.Errorf("Could not decode JSON response: %v", dErr)
}
monitors := target["bgpMonitors"]
return &monitors, nil
}