Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions monitor_dashboards.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const (
ServiceTypeObjectStorage ServiceType = "objectstorage"
ServiceTypeVPC ServiceType = "vpc"
ServiceTypeFirewallService ServiceType = "firewall"
ServiceTypeNetLoadBalancer ServiceType = "netloadbalancer"
)

// DashboardType is an enum object for DashboardType
Expand All @@ -51,6 +52,15 @@ type DashboardWidget struct {
ChartType ChartType `json:"chart_type"`
YLabel string `json:"y_label"`
AggregateFunction AggregateFunction `json:"aggregate_function"`
GroupBy []string `json:"group_by"`
Filters []DashboardFilter `json:"filters"`
}

// DashboardFilter represents a filter for dashboard widgets
type DashboardFilter struct {
DimensionLabel string `json:"dimension_label"`
Operator string `json:"operator"`
Value string `json:"value"`
}

// AggregateFunction is an enum object for AggregateFunction
Expand Down
34 changes: 19 additions & 15 deletions monitor_metrics_definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,25 @@ const (
type MetricUnit string

const (
MetricUnitCount MetricUnit = "count"
MetricUnitPercent MetricUnit = "percent"
MetricUnitByte MetricUnit = "byte"
MetricUnitSecond MetricUnit = "second"
MetricUnitBitsPerSecond MetricUnit = "bits_per_second"
MetricUnitMillisecond MetricUnit = "millisecond"
MetricUnitKB MetricUnit = "KB"
MetricUnitMB MetricUnit = "MB"
MetricUnitGB MetricUnit = "GB"
MetricUnitRate MetricUnit = "rate"
MetricUnitBytesPerSecond MetricUnit = "bytes_per_second"
MetricUnitPercentile MetricUnit = "percentile"
MetricUnitRatio MetricUnit = "ratio"
MetricUnitOpsPerSecond MetricUnit = "ops_per_second"
MetricUnitIops MetricUnit = "iops"
MetricUnitCount MetricUnit = "count"
MetricUnitPercent MetricUnit = "percent"
MetricUnitByte MetricUnit = "byte"
MetricUnitSecond MetricUnit = "second"
MetricUnitBitsPerSecond MetricUnit = "bits_per_second"
MetricUnitMillisecond MetricUnit = "millisecond"
MetricUnitKB MetricUnit = "KB"
MetricUnitMB MetricUnit = "MB"
MetricUnitGB MetricUnit = "GB"
MetricUnitRate MetricUnit = "rate"
MetricUnitBytesPerSecond MetricUnit = "bytes_per_second"
MetricUnitPercentile MetricUnit = "percentile"
MetricUnitRatio MetricUnit = "ratio"
MetricUnitOpsPerSecond MetricUnit = "ops_per_second"
MetricUnitIops MetricUnit = "iops"
MetricUnitKiloBytesPerSecond MetricUnit = "kilo_bytes_per_second"
MetricUnitSessionsPerSecond MetricUnit = "sessions_per_second"
MetricUnitPacketsPerSecond MetricUnit = "packets_per_second"
MetricUnitKiloBitsPerSecond MetricUnit = "kilo_bits_per_second"
)

// MonitorDimension represents an ACLP MonitorDimension object
Expand Down
19 changes: 14 additions & 5 deletions monitor_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,26 @@ import (

// MonitorService represents a MonitorService object
type MonitorService struct {
Label string `json:"label"`
ServiceType string `json:"service_type"`
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)
}

// ListMonitorServiceByType lists monitor services by a given service_type
func (c *Client) ListMonitorServiceByType(ctx context.Context, serviceType string, opts *ListOptions) ([]MonitorService, error) {
// 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 getPaginatedResults[MonitorService](ctx, c, e, opts)

return doGETRequest[MonitorService](ctx, c, e)
}
8 changes: 8 additions & 0 deletions regions.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ type Region struct {
// A List of enums from the above constants
Capabilities []string `json:"capabilities"`

Monitors RegionMonitors `json:"monitors"`

Status string `json:"status"`
Label string `json:"label"`
SiteType string `json:"site_type"`
Expand All @@ -74,6 +76,12 @@ type RegionResolvers struct {
IPv6 string `json:"ipv6"`
}

// RegionMonitors contains the monitoring configuration for a region
type RegionMonitors struct {
Alerts []string `json:"alerts"`
Metrics []string `json:"metrics"`
}

// RegionPlacementGroupLimits contains information about the
// placement group limits for the current user in the current region.
type RegionPlacementGroupLimits struct {
Expand Down
Loading