Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190482,7 +190482,7 @@ paths:
- status_pages_settings_write
/api/v2/statuspages/degradations:
get:
description: Lists all degradations for the organization. Optionally filter by status and page.
description: Lists all degradations for the organization. Optionally filter by status, page, and source ID.
operationId: ListDegradations
parameters:
- description: Optional page id filter.
Expand Down Expand Up @@ -190514,6 +190514,11 @@ paths:
name: filter[status]
schema:
type: string
- description: "Optional source ID filter. Returns only degradations whose source matches this ID (e.g. an incident ID)."
in: query
name: filter[source_id]
schema:
type: string
- description: "Sort order. Prefix with '-' for descending. Supported values: created_at, -created_at, modified_at, -modified_at."
in: query
name: sort
Expand Down
23 changes: 23 additions & 0 deletions examples/v2_status-pages_ListDegradations_3179419218.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// List degradations with source ID filter returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_status_pages::ListDegradationsOptionalParams;
use datadog_api_client::datadogV2::api_status_pages::StatusPagesAPI;

#[tokio::main]
async fn main() {
// there is a valid "degradation" in the system
let degradation_data_id = uuid::Uuid::parse_str(&std::env::var("DEGRADATION_DATA_ID").unwrap())
.expect("Invalid UUID");
let configuration = datadog::Configuration::new();
let api = StatusPagesAPI::with_config(configuration);
let resp = api
.list_degradations(
ListDegradationsOptionalParams::default().filter_source_id(degradation_data_id.clone()),
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
16 changes: 14 additions & 2 deletions src/datadogV2/api/api_status_pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ pub struct ListDegradationsOptionalParams {
pub include: Option<String>,
/// Optional degradation status filter. Supported values: investigating, identified, monitoring, resolved.
pub filter_status: Option<String>,
/// Optional source ID filter. Returns only degradations whose source matches this ID (e.g. an incident ID).
pub filter_source_id: Option<String>,
/// Sort order. Prefix with '-' for descending. Supported values: created_at, -created_at, modified_at, -modified_at.
pub sort: Option<String>,
}
Expand Down Expand Up @@ -260,6 +262,11 @@ impl ListDegradationsOptionalParams {
self.filter_status = Some(value);
self
}
/// Optional source ID filter. Returns only degradations whose source matches this ID (e.g. an incident ID).
pub fn filter_source_id(mut self, value: String) -> Self {
self.filter_source_id = Some(value);
self
}
/// Sort order. Prefix with '-' for descending. Supported values: created_at, -created_at, modified_at, -modified_at.
pub fn sort(mut self, value: String) -> Self {
self.sort = Some(value);
Expand Down Expand Up @@ -2776,7 +2783,7 @@ impl StatusPagesAPI {
}
}

/// Lists all degradations for the organization. Optionally filter by status and page.
/// Lists all degradations for the organization. Optionally filter by status, page, and source ID.
pub async fn list_degradations(
&self,
params: ListDegradationsOptionalParams,
Expand All @@ -2796,7 +2803,7 @@ impl StatusPagesAPI {
}
}

/// Lists all degradations for the organization. Optionally filter by status and page.
/// Lists all degradations for the organization. Optionally filter by status, page, and source ID.
pub async fn list_degradations_with_http_info(
&self,
params: ListDegradationsOptionalParams,
Expand All @@ -2813,6 +2820,7 @@ impl StatusPagesAPI {
let page_limit = params.page_limit;
let include = params.include;
let filter_status = params.filter_status;
let filter_source_id = params.filter_source_id;
let sort = params.sort;

let local_client = &self.client;
Expand Down Expand Up @@ -2844,6 +2852,10 @@ impl StatusPagesAPI {
local_req_builder =
local_req_builder.query(&[("filter[status]", &local_query_param.to_string())]);
};
if let Some(ref local_query_param) = filter_source_id {
local_req_builder =
local_req_builder.query(&[("filter[source_id]", &local_query_param.to_string())]);
};
if let Some(ref local_query_param) = sort {
local_req_builder =
local_req_builder.query(&[("sort", &local_query_param.to_string())]);
Expand Down
9 changes: 9 additions & 0 deletions tests/scenarios/features/v2/status_pages.feature
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,15 @@ Feature: Status Pages
When the request is sent
Then the response status is 200 OK

@team:DataDog/incident-app
Scenario: List degradations with source ID filter returns "OK" response
Given new "ListDegradations" request
And there is a valid "status_page" in the system
And there is a valid "degradation" in the system
And request contains "filter[source_id]" parameter from "degradation.data.id"
When the request is sent
Then the response status is 200 OK

@team:DataDog/incident-app
Scenario: List maintenances returns "OK" response
Given there is a valid "status_page" in the system
Expand Down
4 changes: 4 additions & 0 deletions tests/scenarios/function_mappings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57720,6 +57720,9 @@ fn test_v2_list_degradations(world: &mut DatadogWorld, _parameters: &HashMap<Str
let filter_status = _parameters
.get("filter[status]")
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
let filter_source_id = _parameters
.get("filter[source_id]")
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
let sort = _parameters
.get("sort")
.and_then(|param| Some(serde_json::from_value(param.clone()).unwrap()));
Expand All @@ -57729,6 +57732,7 @@ fn test_v2_list_degradations(world: &mut DatadogWorld, _parameters: &HashMap<Str
params.page_limit = page_limit;
params.include = include;
params.filter_status = filter_status;
params.filter_source_id = filter_source_id;
params.sort = sort;
let response = match block_on(api.list_degradations_with_http_info(params)) {
Ok(response) => response,
Expand Down
Loading