Skip to content

Commit 78a5b44

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit e48f054 of spec repo
1 parent 64db983 commit 78a5b44

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
@@ -190482,7 +190482,7 @@ paths:
190482190482
- status_pages_settings_write
190483190483
/api/v2/statuspages/degradations:
190484190484
get:
190485-
description: Lists all degradations for the organization. Optionally filter by status and page.
190485+
description: Lists all degradations for the organization. Optionally filter by status, page, and source ID.
190486190486
operationId: ListDegradations
190487190487
parameters:
190488190488
- description: Optional page id filter.
@@ -190514,6 +190514,11 @@ paths:
190514190514
name: filter[status]
190515190515
schema:
190516190516
type: string
190517+
- description: "Optional source ID filter. Returns only degradations whose source matches this ID (e.g. an incident ID)."
190518+
in: query
190519+
name: filter[source_id]
190520+
schema:
190521+
type: string
190517190522
- description: "Sort order. Prefix with '-' for descending. Supported values: created_at, -created_at, modified_at, -modified_at."
190518190523
in: query
190519190524
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
@@ -57720,6 +57720,9 @@ fn test_v2_list_degradations(world: &mut DatadogWorld, _parameters: &HashMap<Str
5772057720
let filter_status = _parameters
5772157721
.get("filter[status]")
5772257722
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
57723+
let filter_source_id = _parameters
57724+
.get("filter[source_id]")
57725+
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
5772357726
let sort = _parameters
5772457727
.get("sort")
5772557728
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
@@ -57729,6 +57732,7 @@ fn test_v2_list_degradations(world: &mut DatadogWorld, _parameters: &HashMap<Str
5772957732
params.page_limit = page_limit;
5773057733
params.include = include;
5773157734
params.filter_status = filter_status;
57735+
params.filter_source_id = filter_source_id;
5773257736
params.sort = sort;
5773357737
let response = match block_on(api.list_degradations_with_http_info(params)) {
5773457738
Ok(response) => response,

0 commit comments

Comments
 (0)