Skip to content

Commit c23691f

Browse files
authored
fix: alert rule read convert GenericTest to TestId (#122)
1 parent 3b4f115 commit c23691f

1 file changed

Lines changed: 20 additions & 19 deletions

File tree

alerts.go

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,24 @@ type Notification struct {
6565

6666
// AlertRule - An alert rule
6767
type AlertRule struct {
68-
AlertRuleID *int64 `json:"alertRuleId,omitempty"`
69-
AlertType *string `json:"alertType,omitempty"`
70-
Default *bool `json:"default,omitempty" te:"int-bool"`
71-
Direction *string `json:"direction,omitempty"`
72-
Expression *string `json:"expression,omitempty"`
73-
IncludeCoveredPrefixes *int `json:"includeCoveredPrefixes,omitempty"`
74-
MinimumSources *int `json:"minimumSources,omitempty"`
75-
MinimumSourcesPct *int `json:"minimumSourcesPct,omitempty"`
76-
NotifyOnClear *bool `json:"notifyOnClear,omitempty" te:"int-bool"`
77-
RoundsViolatingMode *string `json:"roundsViolatingMode,omitempty"`
78-
RoundsViolatingOutOf *int `json:"roundsViolatingOutOf,omitempty"`
79-
RoundsViolatingRequired *int `json:"roundsViolatingRequired,omitempty"`
80-
RuleID *int64 `json:"ruleId,omitempty"`
81-
RuleName *string `json:"ruleName,omitempty"`
82-
TestIds *[]int `json:"testIds,omitempty"`
83-
Notifications *Notification `json:"notifications,omitempty"`
84-
Severity *string `json:"severity,omitempty"`
68+
AlertRuleID *int64 `json:"alertRuleId,omitempty"`
69+
AlertType *string `json:"alertType,omitempty"`
70+
Default *bool `json:"default,omitempty" te:"int-bool"`
71+
Direction *string `json:"direction,omitempty"`
72+
Expression *string `json:"expression,omitempty"`
73+
IncludeCoveredPrefixes *int `json:"includeCoveredPrefixes,omitempty"`
74+
MinimumSources *int `json:"minimumSources,omitempty"`
75+
MinimumSourcesPct *int `json:"minimumSourcesPct,omitempty"`
76+
NotifyOnClear *bool `json:"notifyOnClear,omitempty" te:"int-bool"`
77+
RoundsViolatingMode *string `json:"roundsViolatingMode,omitempty"`
78+
RoundsViolatingOutOf *int `json:"roundsViolatingOutOf,omitempty"`
79+
RoundsViolatingRequired *int `json:"roundsViolatingRequired,omitempty"`
80+
RuleID *int64 `json:"ruleId,omitempty"`
81+
RuleName *string `json:"ruleName,omitempty"`
82+
Tests *[]GenericTest `json:"tests,omitempty"`
83+
TestIds *[]int64 `json:"testIds,omitempty"`
84+
Notifications *Notification `json:"notifications,omitempty"`
85+
Severity *string `json:"severity,omitempty"`
8586
}
8687

8788
// MarshalJSON implements the json.Marshaler interface. It ensures
@@ -165,10 +166,10 @@ func (c *Client) GetAlertRule(id int64) (*AlertRule, error) {
165166
}
166167
var target map[string][]AlertRule
167168
if dErr := c.decodeJSON(resp, &target); dErr != nil {
168-
return nil, fmt.Errorf("Could not decode JSON response: %v", dErr)
169+
return nil, fmt.Errorf("could not decode JSON response: %v", dErr)
169170
}
170171
if len(target["alertRules"]) < 1 {
171-
return nil, fmt.Errorf("Could not get alert rule %v", id)
172+
return nil, fmt.Errorf("could not get alert rule %v", id)
172173
}
173174
return &target["alertRules"][0], nil
174175
}

0 commit comments

Comments
 (0)