-
Notifications
You must be signed in to change notification settings - Fork 107
Expand file tree
/
Copy pathmonitor_services.go
More file actions
31 lines (25 loc) · 1.1 KB
/
monitor_services.go
File metadata and controls
31 lines (25 loc) · 1.1 KB
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
package linodego
import (
"context"
)
// MonitorService represents a MonitorService object
type MonitorService struct {
Label string `json:"label"`
ServiceType string `json:"service_type"`
Alert *MonitorServiceAlert `json:"alert"`
}
// MonitorServiceAlert represents the alert configuration for a monitor service
type MonitorServiceAlert struct {
PollingIntervalSeconds []int `json:"polling_interval_seconds"`
EvaluationPeriodSeconds []int `json:"evaluation_period_seconds"`
Scope []string `json:"scope"`
}
// ListMonitorServices lists all the registered ACLP MonitorServices
func (c *Client) ListMonitorServices(ctx context.Context, opts *ListOptions) ([]MonitorService, error) {
return getPaginatedResults[MonitorService](ctx, c, "monitor/services", opts)
}
// GetMonitorServiceByType gets a monitor service by a given service_type
func (c *Client) GetMonitorServiceByType(ctx context.Context, serviceType string) (*MonitorService, error) {
e := formatAPIPath("monitor/services/%s", serviceType)
return doGETRequest[MonitorService](ctx, c, e)
}