monitor_services.go raw
1 package linodego
2
3 import (
4 "context"
5 )
6
7 // MonitorService represents a MonitorService object
8 type MonitorService struct {
9 Label string `json:"label"`
10 ServiceType string `json:"service_type"`
11 Alert *MonitorServiceAlert `json:"alert"`
12 }
13
14 // MonitorServiceAlert represents the alert configuration for a monitor service
15 type MonitorServiceAlert struct {
16 PollingIntervalSeconds []int `json:"polling_interval_seconds"`
17 EvaluationPeriodSeconds []int `json:"evaluation_period_seconds"`
18 Scope []string `json:"scope"`
19 }
20
21 // ListMonitorServices lists all the registered ACLP MonitorServices
22 func (c *Client) ListMonitorServices(ctx context.Context, opts *ListOptions) ([]MonitorService, error) {
23 return getPaginatedResults[MonitorService](ctx, c, "monitor/services", opts)
24 }
25
26 // GetMonitorServiceByType gets a monitor service by a given service_type
27 func (c *Client) GetMonitorServiceByType(ctx context.Context, serviceType string) (*MonitorService, error) {
28 e := formatAPIPath("monitor/services/%s", serviceType)
29
30 return doGETRequest[MonitorService](ctx, c, e)
31 }
32