Skip to content

Commit c54d98d

Browse files
authored
fix(api): fix alert rules source field (#1370)
1 parent 5f499c3 commit c54d98d

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

api/_examples/alert-rules/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func main() {
4040
ResourceGroups: []string{"TECHALLY_000000000000AAAAAAAAAAAAAAAAAAAA"},
4141
EventCategories: []string{"Compliance"},
4242
AlertCategories: []string{"Policy"},
43-
Sources: []string{"Aws"},
43+
AlertSources: []string{"Aws"},
4444
}
4545

4646
myAlertRule := api.NewAlertRule("MyTestAlertRule",

api/alert_rules.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func NewAlertRule(name string, rule AlertRuleConfig) AlertRule {
186186
ResourceGroups: rule.ResourceGroups,
187187
EventCategories: rule.EventCategories,
188188
AlertCategories: rule.AlertCategories,
189-
Sources: rule.Sources,
189+
AlertSources: rule.AlertSources,
190190
},
191191
}
192192
}
@@ -256,8 +256,8 @@ type AlertRuleConfig struct {
256256
Severities AlertRuleSeverities
257257
ResourceGroups []string
258258
EventCategories []string
259-
Sources []string
260259
AlertCategories []string
260+
AlertSources []string
261261
}
262262

263263
type AlertRule struct {
@@ -274,8 +274,8 @@ type AlertRuleFilter struct {
274274
Severity []int `json:"severity"`
275275
ResourceGroups []string `json:"resourceGroups"`
276276
EventCategories []string `json:"eventCategory"`
277-
Sources []string `json:"sources,omitempty"`
278277
AlertCategories []string `json:"category"`
278+
AlertSources []string `json:"source,omitempty"`
279279
CreatedOrUpdatedTime string `json:"createdOrUpdatedTime,omitempty"`
280280
CreatedOrUpdatedBy string `json:"createdOrUpdatedBy,omitempty"`
281281
}

api/alert_rules_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ func TestAlertRuleUpdate(t *testing.T) {
227227
Severities: api.AlertRuleSeverities{api.AlertRuleSeverityHigh},
228228
ResourceGroups: []string{"TECHALLY_100000000000AAAAAAAAAAAAAAAAAAAB"},
229229
EventCategories: []string{"Compliance", "SystemCall"},
230-
Sources: []string{"Aws", "Agent", "K8s"},
230+
AlertSources: []string{"Aws", "Agent", "K8s"},
231231
AlertCategories: []string{"Policy", "Anomaly"},
232232
},
233233
)
@@ -241,8 +241,8 @@ func TestAlertRuleUpdate(t *testing.T) {
241241
assert.NotNil(t, response)
242242
assert.Equal(t, intgGUID, response.Data.Guid)
243243
assert.Contains(t, response.Data.Filter.EventCategories, "Compliance", "SystemCall")
244-
assert.Contains(t, response.Data.Filter.Sources, "Aws", "Agent", "K8s")
245244
assert.Contains(t, response.Data.Filter.AlertCategories, "Policy", "Anomaly")
245+
assert.Contains(t, response.Data.Filter.AlertSources, "Aws", "Agent", "K8s")
246246
assert.Contains(t, response.Data.Filter.ResourceGroups, "TECHALLY_100000000000AAAAAAAAAAAAAAAAAAAB")
247247
assert.Contains(t, response.Data.Channels, "TECHALLY_000000000000AAAAAAAAAAAAAAAAAAAA")
248248
}
@@ -315,7 +315,7 @@ func singleMockAlertRule(id string) string {
315315
"Policy",
316316
"Anomaly"
317317
],
318-
"sources": [
318+
"source": [
319319
"Aws",
320320
"Agent",
321321
"K8s"

0 commit comments

Comments
 (0)