Skip to content

Commit 1da7c96

Browse files
pmajalizliang-akamaiCopilot
authored
aclp region and group_by changes (#807)
* aclp region and group_by changes * lint and review updates * Update test/unit/fixtures/monitor_dashboards.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * removing extra spaces Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update test/unit/fixtures/monitor_services.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * lint and review updates * updating getByserviceType func * fixing lint errors * fixing fixtures * returning MonitorService as pointer * fixing test errors due to GetServiceByType API --------- Co-authored-by: Zhiwei Liang <121905282+zliang-akamai@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 081d3a8 commit 1da7c96

26 files changed

+805
-141
lines changed

monitor_dashboards.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const (
3131
ServiceTypeObjectStorage ServiceType = "objectstorage"
3232
ServiceTypeVPC ServiceType = "vpc"
3333
ServiceTypeFirewallService ServiceType = "firewall"
34+
ServiceTypeNetLoadBalancer ServiceType = "netloadbalancer"
3435
)
3536

3637
// DashboardType is an enum object for DashboardType
@@ -51,6 +52,15 @@ type DashboardWidget struct {
5152
ChartType ChartType `json:"chart_type"`
5253
YLabel string `json:"y_label"`
5354
AggregateFunction AggregateFunction `json:"aggregate_function"`
55+
GroupBy []string `json:"group_by"`
56+
Filters []DashboardFilter `json:"filters"`
57+
}
58+
59+
// DashboardFilter represents a filter for dashboard widgets
60+
type DashboardFilter struct {
61+
DimensionLabel string `json:"dimension_label"`
62+
Operator string `json:"operator"`
63+
Value string `json:"value"`
5464
}
5565

5666
// AggregateFunction is an enum object for AggregateFunction

monitor_metrics_definitions.go

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,25 @@ const (
3030
type MetricUnit string
3131

3232
const (
33-
MetricUnitCount MetricUnit = "count"
34-
MetricUnitPercent MetricUnit = "percent"
35-
MetricUnitByte MetricUnit = "byte"
36-
MetricUnitSecond MetricUnit = "second"
37-
MetricUnitBitsPerSecond MetricUnit = "bits_per_second"
38-
MetricUnitMillisecond MetricUnit = "millisecond"
39-
MetricUnitKB MetricUnit = "KB"
40-
MetricUnitMB MetricUnit = "MB"
41-
MetricUnitGB MetricUnit = "GB"
42-
MetricUnitRate MetricUnit = "rate"
43-
MetricUnitBytesPerSecond MetricUnit = "bytes_per_second"
44-
MetricUnitPercentile MetricUnit = "percentile"
45-
MetricUnitRatio MetricUnit = "ratio"
46-
MetricUnitOpsPerSecond MetricUnit = "ops_per_second"
47-
MetricUnitIops MetricUnit = "iops"
33+
MetricUnitCount MetricUnit = "count"
34+
MetricUnitPercent MetricUnit = "percent"
35+
MetricUnitByte MetricUnit = "byte"
36+
MetricUnitSecond MetricUnit = "second"
37+
MetricUnitBitsPerSecond MetricUnit = "bits_per_second"
38+
MetricUnitMillisecond MetricUnit = "millisecond"
39+
MetricUnitKB MetricUnit = "KB"
40+
MetricUnitMB MetricUnit = "MB"
41+
MetricUnitGB MetricUnit = "GB"
42+
MetricUnitRate MetricUnit = "rate"
43+
MetricUnitBytesPerSecond MetricUnit = "bytes_per_second"
44+
MetricUnitPercentile MetricUnit = "percentile"
45+
MetricUnitRatio MetricUnit = "ratio"
46+
MetricUnitOpsPerSecond MetricUnit = "ops_per_second"
47+
MetricUnitIops MetricUnit = "iops"
48+
MetricUnitKiloBytesPerSecond MetricUnit = "kilo_bytes_per_second"
49+
MetricUnitSessionsPerSecond MetricUnit = "sessions_per_second"
50+
MetricUnitPacketsPerSecond MetricUnit = "packets_per_second"
51+
MetricUnitKiloBitsPerSecond MetricUnit = "kilo_bits_per_second"
4852
)
4953

5054
// MonitorDimension represents an ACLP MonitorDimension object

monitor_services.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,26 @@ import (
66

77
// MonitorService represents a MonitorService object
88
type MonitorService struct {
9-
Label string `json:"label"`
10-
ServiceType string `json:"service_type"`
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"`
1119
}
1220

1321
// ListMonitorServices lists all the registered ACLP MonitorServices
1422
func (c *Client) ListMonitorServices(ctx context.Context, opts *ListOptions) ([]MonitorService, error) {
1523
return getPaginatedResults[MonitorService](ctx, c, "monitor/services", opts)
1624
}
1725

18-
// ListMonitorServiceByType lists monitor services by a given service_type
19-
func (c *Client) ListMonitorServiceByType(ctx context.Context, serviceType string, opts *ListOptions) ([]MonitorService, error) {
26+
// GetMonitorServiceByType gets a monitor service by a given service_type
27+
func (c *Client) GetMonitorServiceByType(ctx context.Context, serviceType string) (*MonitorService, error) {
2028
e := formatAPIPath("monitor/services/%s", serviceType)
21-
return getPaginatedResults[MonitorService](ctx, c, e, opts)
29+
30+
return doGETRequest[MonitorService](ctx, c, e)
2231
}

regions.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ type Region struct {
6060
// A List of enums from the above constants
6161
Capabilities []string `json:"capabilities"`
6262

63+
Monitors RegionMonitors `json:"monitors"`
64+
6365
Status string `json:"status"`
6466
Label string `json:"label"`
6567
SiteType string `json:"site_type"`
@@ -74,6 +76,12 @@ type RegionResolvers struct {
7476
IPv6 string `json:"ipv6"`
7577
}
7678

79+
// RegionMonitors contains the monitoring configuration for a region
80+
type RegionMonitors struct {
81+
Alerts []string `json:"alerts"`
82+
Metrics []string `json:"metrics"`
83+
}
84+
7785
// RegionPlacementGroupLimits contains information about the
7886
// placement group limits for the current user in the current region.
7987
type RegionPlacementGroupLimits struct {

0 commit comments

Comments
 (0)