Skip to content

Commit 367403f

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 73b7a53 of spec repo
1 parent f2c3598 commit 367403f

5 files changed

Lines changed: 56 additions & 3 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188770,7 +188770,7 @@ paths:
188770188770
- status_pages_settings_write
188771188771
/api/v2/statuspages/degradations:
188772188772
get:
188773-
description: Lists all degradations for the organization. Optionally filter by status and page.
188773+
description: Lists all degradations for the organization. Optionally filter by status, page, and source ID.
188774188774
operationId: ListDegradations
188775188775
parameters:
188776188776
- description: Optional page id filter.
@@ -188802,6 +188802,11 @@ paths:
188802188802
name: filter[status]
188803188803
schema:
188804188804
type: string
188805+
- description: "Optional source ID filter. Returns only degradations whose source matches this ID (e.g. an incident ID)."
188806+
in: query
188807+
name: filter[source_id]
188808+
schema:
188809+
type: string
188805188810
- description: "Sort order. Prefix with '-' for descending. Supported values: created_at, -created_at, modified_at, -modified_at."
188806188811
in: query
188807188812
name: sort
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// List degradations with source ID filter returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_status_pages::ListDegradationsOptionalParams;
4+
use datadog_api_client::datadogV2::api_status_pages::StatusPagesAPI;
5+
6+
#[tokio::main]
7+
async fn main() {
8+
// there is a valid "degradation" in the system
9+
let degradation_data_id = uuid::Uuid::parse_str(&std::env::var("DEGRADATION_DATA_ID").unwrap())
10+
.expect("Invalid UUID");
11+
let configuration = datadog::Configuration::new();
12+
let api = StatusPagesAPI::with_config(configuration);
13+
let resp = api
14+
.list_degradations(
15+
ListDegradationsOptionalParams::default().filter_source_id(degradation_data_id.clone()),
16+
)
17+
.await;
18+
if let Ok(value) = resp {
19+
println!("{:#?}", value);
20+
} else {
21+
println!("{:#?}", resp.unwrap_err());
22+
}
23+
}

src/datadogV2/api/api_status_pages.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ pub struct ListDegradationsOptionalParams {
230230
pub include: Option<String>,
231231
/// Optional degradation status filter. Supported values: investigating, identified, monitoring, resolved.
232232
pub filter_status: Option<String>,
233+
/// Optional source ID filter. Returns only degradations whose source matches this ID (e.g. an incident ID).
234+
pub filter_source_id: Option<String>,
233235
/// Sort order. Prefix with '-' for descending. Supported values: created_at, -created_at, modified_at, -modified_at.
234236
pub sort: Option<String>,
235237
}
@@ -260,6 +262,11 @@ impl ListDegradationsOptionalParams {
260262
self.filter_status = Some(value);
261263
self
262264
}
265+
/// Optional source ID filter. Returns only degradations whose source matches this ID (e.g. an incident ID).
266+
pub fn filter_source_id(mut self, value: String) -> Self {
267+
self.filter_source_id = Some(value);
268+
self
269+
}
263270
/// Sort order. Prefix with '-' for descending. Supported values: created_at, -created_at, modified_at, -modified_at.
264271
pub fn sort(mut self, value: String) -> Self {
265272
self.sort = Some(value);
@@ -2776,7 +2783,7 @@ impl StatusPagesAPI {
27762783
}
27772784
}
27782785

2779-
/// Lists all degradations for the organization. Optionally filter by status and page.
2786+
/// Lists all degradations for the organization. Optionally filter by status, page, and source ID.
27802787
pub async fn list_degradations(
27812788
&self,
27822789
params: ListDegradationsOptionalParams,
@@ -2796,7 +2803,7 @@ impl StatusPagesAPI {
27962803
}
27972804
}
27982805

2799-
/// Lists all degradations for the organization. Optionally filter by status and page.
2806+
/// Lists all degradations for the organization. Optionally filter by status, page, and source ID.
28002807
pub async fn list_degradations_with_http_info(
28012808
&self,
28022809
params: ListDegradationsOptionalParams,
@@ -2813,6 +2820,7 @@ impl StatusPagesAPI {
28132820
let page_limit = params.page_limit;
28142821
let include = params.include;
28152822
let filter_status = params.filter_status;
2823+
let filter_source_id = params.filter_source_id;
28162824
let sort = params.sort;
28172825

28182826
let local_client = &self.client;
@@ -2844,6 +2852,10 @@ impl StatusPagesAPI {
28442852
local_req_builder =
28452853
local_req_builder.query(&[("filter[status]", &local_query_param.to_string())]);
28462854
};
2855+
if let Some(ref local_query_param) = filter_source_id {
2856+
local_req_builder =
2857+
local_req_builder.query(&[("filter[source_id]", &local_query_param.to_string())]);
2858+
};
28472859
if let Some(ref local_query_param) = sort {
28482860
local_req_builder =
28492861
local_req_builder.query(&[("sort", &local_query_param.to_string())]);

tests/scenarios/features/v2/status_pages.feature

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,15 @@ Feature: Status Pages
157157
When the request is sent
158158
Then the response status is 200 OK
159159

160+
@team:DataDog/incident-app
161+
Scenario: List degradations with source ID filter returns "OK" response
162+
Given new "ListDegradations" request
163+
And there is a valid "status_page" in the system
164+
And there is a valid "degradation" in the system
165+
And request contains "filter[source_id]" parameter from "degradation.data.id"
166+
When the request is sent
167+
Then the response status is 200 OK
168+
160169
@team:DataDog/incident-app
161170
Scenario: List maintenances returns "OK" response
162171
Given there is a valid "status_page" in the system

tests/scenarios/function_mappings.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57322,6 +57322,9 @@ fn test_v2_list_degradations(world: &mut DatadogWorld, _parameters: &HashMap<Str
5732257322
let filter_status = _parameters
5732357323
.get("filter[status]")
5732457324
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
57325+
let filter_source_id = _parameters
57326+
.get("filter[source_id]")
57327+
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
5732557328
let sort = _parameters
5732657329
.get("sort")
5732757330
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
@@ -57331,6 +57334,7 @@ fn test_v2_list_degradations(world: &mut DatadogWorld, _parameters: &HashMap<Str
5733157334
params.page_limit = page_limit;
5733257335
params.include = include;
5733357336
params.filter_status = filter_status;
57337+
params.filter_source_id = filter_source_id;
5733457338
params.sort = sort;
5733557339
let response = match block_on(api.list_degradations_with_http_info(params)) {
5733657340
Ok(response) => response,

0 commit comments

Comments
 (0)