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 @@ -188770,7 +188770,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 @@ -188802,6 +188802,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
19 changes: 19 additions & 0 deletions examples/v2/status-pages/ListDegradations_3179419218.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
List degradations with source ID filter returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.status_pages_api import StatusPagesApi

# there is a valid "degradation" in the system
DEGRADATION_DATA_ID = environ["DEGRADATION_DATA_ID"]

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = StatusPagesApi(api_client)
response = api_instance.list_degradations(
filter_source_id=DEGRADATION_DATA_ID,
)

print(response)
13 changes: 12 additions & 1 deletion src/datadog_api_client/v2/api/status_pages_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,11 @@ def __init__(self, api_client=None):
"attribute": "filter[status]",
"location": "query",
},
"filter_source_id": {
"openapi_types": (str,),
"attribute": "filter[source_id]",
"location": "query",
},
"sort": {
"openapi_types": (str,),
"attribute": "sort",
Expand Down Expand Up @@ -1302,11 +1307,12 @@ def list_degradations(
page_limit: Union[int, UnsetType] = unset,
include: Union[str, UnsetType] = unset,
filter_status: Union[str, UnsetType] = unset,
filter_source_id: Union[str, UnsetType] = unset,
sort: Union[str, UnsetType] = unset,
) -> DegradationArray:
"""List degradations.

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.

:param filter_page_id: Optional page id filter.
:type filter_page_id: str, optional
Expand All @@ -1318,6 +1324,8 @@ def list_degradations(
:type include: str, optional
:param filter_status: Optional degradation status filter. Supported values: investigating, identified, monitoring, resolved.
:type filter_status: str, optional
:param filter_source_id: Optional source ID filter. Returns only degradations whose source matches this ID (e.g. an incident ID).
:type filter_source_id: str, optional
:param sort: Sort order. Prefix with '-' for descending. Supported values: created_at, -created_at, modified_at, -modified_at.
:type sort: str, optional
:rtype: DegradationArray
Expand All @@ -1338,6 +1346,9 @@ def list_degradations(
if filter_status is not unset:
kwargs["filter_status"] = filter_status

if filter_source_id is not unset:
kwargs["filter_source_id"] = filter_source_id

if sort is not unset:
kwargs["sort"] = sort

Expand Down
9 changes: 9 additions & 0 deletions tests/v2/features/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
Loading