Skip to content

Commit 8f24b73

Browse files
committed
fixed comments and lint errors
1 parent ba2563f commit 8f24b73

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

monitor_alert_definitions.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ type RuleOptions struct {
8686
type DimensionFilterOptions struct {
8787
DimensionLabel string `json:"dimension_label,omitempty"`
8888
Operator string `json:"operator,omitempty"`
89-
Value any `json:"value,omitempty"`
89+
Value string `json:"value,omitempty"`
9090
}
9191

9292
// AlertType represents the type of alert: "user" or "system"
@@ -117,24 +117,24 @@ const (
117117

118118
// AlertDefinitionCreateOptions are the options used to create a new alert definition.
119119
type AlertDefinitionCreateOptions struct {
120-
Label string `json:"label"` // mandatory
121-
Severity int `json:"severity"` // mandatory
122-
ChannelIDs []int `json:"channel_ids"` // mandatory
123-
RuleCriteria RuleCriteriaOptions `json:"rule_criteria,omitempty"` // optional
124-
TriggerConditions TriggerConditions `json:"trigger_conditions,omitempty"` // optional
125-
EntityIDs []string `json:"entity_ids,omitempty"` // optional
126-
Description string `json:"description,omitempty"` // optional
120+
Label string `json:"label"` // mandatory
121+
Severity int `json:"severity"` // mandatory
122+
ChannelIDs []int `json:"channel_ids"` // mandatory
123+
RuleCriteria RuleCriteriaOptions `json:"rule_criteria"` // optional
124+
TriggerConditions TriggerConditions `json:"trigger_conditions"` // optional
125+
EntityIDs []string `json:"entity_ids,omitempty"` // optional
126+
Description string `json:"description,omitempty"` // optional
127127
}
128128

129129
// AlertDefinitionUpdateOptions are the options used to update an alert definition.
130130
type AlertDefinitionUpdateOptions struct {
131-
Label string `json:"label"` // mandatory
132-
Severity int `json:"severity"` // mandatory
133-
ChannelIDs []int `json:"channel_ids"` // mandatory
134-
RuleCriteria RuleCriteriaOptions `json:"rule_criteria,omitempty"` // optional
135-
TriggerConditions TriggerConditions `json:"trigger_conditions,omitempty"` // optional
136-
EntityIDs []string `json:"entity_ids,omitempty"` // optional
137-
Description string `json:"description,omitempty"` // optional
131+
Label string `json:"label"` // mandatory
132+
Severity int `json:"severity"` // mandatory
133+
ChannelIDs []int `json:"channel_ids"` // mandatory
134+
RuleCriteria RuleCriteriaOptions `json:"rule_criteria"` // optional
135+
TriggerConditions TriggerConditions `json:"trigger_conditions"` // optional
136+
EntityIDs []string `json:"entity_ids,omitempty"` // optional
137+
Description string `json:"description,omitempty"` // optional
138138
}
139139

140140
// UnmarshalJSON implements the json.Unmarshaler interface

test/integration/monitor_alert_definitions_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func TestMonitorAlertDefinition_smoke(t *testing.T) {
122122
assert.Equal(t, createOpts.TriggerConditions.PollingIntervalSeconds, createdAlert.TriggerConditions.PollingIntervalSeconds)
123123
assert.Equal(t, createOpts.TriggerConditions.TriggerOccurrences, createdAlert.TriggerConditions.TriggerOccurrences)
124124

125-
if len(createdAlert.RuleCriteria.Rules) > 0 && len(createOpts.RuleCriteria.Rules) > 0 {
125+
if len(createdAlert.RuleCriteria.Rules) > 0 && len(createOpts.RuleCriteria.Rules) > 0 && len(createOpts.RuleCriteria.Rules) > 0 {
126126
assert.Equal(t, len(createOpts.RuleCriteria.Rules), len(createdAlert.RuleCriteria.Rules), "created alert should have same number of rules")
127127
for i, r := range createOpts.RuleCriteria.Rules {
128128
cr := createdAlert.RuleCriteria.Rules[i]

0 commit comments

Comments
 (0)