Skip to content

Commit 1d1e29f

Browse files
feat(cockpit): add datasource filter on listAlert endpoint (scaleway#2555)
Co-authored-by: Laure-di <[email protected]>
1 parent f36c46b commit 1d1e29f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

api/cockpit/v1/cockpit_sdk.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,9 @@ type Alert struct {
573573

574574
// PreconfiguredData: contains additional data for preconfigured alerts, such as the rule ID, display name, and description. Only present if the alert is preconfigured.
575575
PreconfiguredData *PreconfiguredAlertData `json:"preconfigured_data"`
576+
577+
// DataSourceID: ID of the data source containing the alert rule.
578+
DataSourceID string `json:"data_source_id"`
576579
}
577580

578581
// ContactPoint: Contact point.
@@ -1304,6 +1307,9 @@ type RegionalAPIListAlertsRequest struct {
13041307
// State: valid values to filter on are `inactive`, `pending` and `firing`. If omitted, no filtering is applied on alert states. Other filters may still apply.
13051308
// Default value: unknown_state
13061309
State *AlertState `json:"-"`
1310+
1311+
// DataSourceID: if omitted, only alerts from the default scaleway data source will be listed.
1312+
DataSourceID *string `json:"-"`
13071313
}
13081314

13091315
// RegionalAPIListContactPointsRequest: List contact points.
@@ -2460,6 +2466,7 @@ func (s *RegionalAPI) ListAlerts(req *RegionalAPIListAlertsRequest, opts ...scw.
24602466
parameter.AddToQuery(query, "is_enabled", req.IsEnabled)
24612467
parameter.AddToQuery(query, "is_preconfigured", req.IsPreconfigured)
24622468
parameter.AddToQuery(query, "state", req.State)
2469+
parameter.AddToQuery(query, "data_source_id", req.DataSourceID)
24632470

24642471
if fmt.Sprint(req.Region) == "" {
24652472
return nil, errors.New("field Region cannot be empty in request")

0 commit comments

Comments
 (0)