Skip to content

Commit 110582d

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Update Get All Notification Rules API docs to include pagination, sorting, and filtering params (#2808)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 2fedd1d commit 110582d

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58413,6 +58413,47 @@ paths:
5841358413
description: Returns a list of all monitor notification rules.
5841458414
operationId: GetMonitorNotificationRules
5841558415
parameters:
58416+
- description: The page to start paginating from. If `page` is not specified,
58417+
the argument defaults to the first page.
58418+
in: query
58419+
name: page
58420+
required: false
58421+
schema:
58422+
format: int32
58423+
maximum: 1000000
58424+
minimum: 0
58425+
type: integer
58426+
- description: The number of rules to return per page. If `per_page` is not
58427+
specified, the argument defaults to 100.
58428+
in: query
58429+
name: per_page
58430+
required: false
58431+
schema:
58432+
format: int32
58433+
maximum: 1000
58434+
minimum: 1
58435+
type: integer
58436+
- description: 'String for sort order, composed of field and sort order separated
58437+
by a colon, for example `name:asc`. Supported sort directions: `asc`, `desc`.
58438+
Supported fields: `name`, `created_at`.'
58439+
in: query
58440+
name: sort
58441+
required: false
58442+
schema:
58443+
type: string
58444+
- description: 'JSON-encoded filter object. Supported keys:
58445+
58446+
* `text`: Free-text query matched against rule name, tags, and recipients.
58447+
58448+
* `tags`: Array of strings. Return rules that have any of these tags.
58449+
58450+
* `recipients`: Array of strings. Return rules that have any of these recipients.'
58451+
example: '{"text":"error","tags":["env:prod","team:my-team"],"recipients":["slack-monitor-app","[email protected]"]}'
58452+
in: query
58453+
name: filters
58454+
required: false
58455+
schema:
58456+
type: string
5841658457
- description: 'Comma-separated list of resource paths for related resources
5841758458
to include in the response. Supported resource
5841858459

src/datadog_api_client/v2/api/monitors_api.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,34 @@ def __init__(self, api_client=None):
230230
"version": "v2",
231231
},
232232
params_map={
233+
"page": {
234+
"validation": {
235+
"inclusive_maximum": 1000000,
236+
"inclusive_minimum": 0,
237+
},
238+
"openapi_types": (int,),
239+
"attribute": "page",
240+
"location": "query",
241+
},
242+
"per_page": {
243+
"validation": {
244+
"inclusive_maximum": 1000,
245+
"inclusive_minimum": 1,
246+
},
247+
"openapi_types": (int,),
248+
"attribute": "per_page",
249+
"location": "query",
250+
},
251+
"sort": {
252+
"openapi_types": (str,),
253+
"attribute": "sort",
254+
"location": "query",
255+
},
256+
"filters": {
257+
"openapi_types": (str,),
258+
"attribute": "filters",
259+
"location": "query",
260+
},
233261
"include": {
234262
"openapi_types": (str,),
235263
"attribute": "include",
@@ -572,18 +600,46 @@ def get_monitor_notification_rule(
572600
def get_monitor_notification_rules(
573601
self,
574602
*,
603+
page: Union[int, UnsetType] = unset,
604+
per_page: Union[int, UnsetType] = unset,
605+
sort: Union[str, UnsetType] = unset,
606+
filters: Union[str, UnsetType] = unset,
575607
include: Union[str, UnsetType] = unset,
576608
) -> MonitorNotificationRuleListResponse:
577609
"""Get all monitor notification rules.
578610
579611
Returns a list of all monitor notification rules.
580612
613+
:param page: The page to start paginating from. If ``page`` is not specified, the argument defaults to the first page.
614+
:type page: int, optional
615+
:param per_page: The number of rules to return per page. If ``per_page`` is not specified, the argument defaults to 100.
616+
:type per_page: int, optional
617+
:param sort: String for sort order, composed of field and sort order separated by a colon, for example ``name:asc``. Supported sort directions: ``asc`` , ``desc``. Supported fields: ``name`` , ``created_at``.
618+
:type sort: str, optional
619+
:param filters: JSON-encoded filter object. Supported keys:
620+
621+
* ``text`` : Free-text query matched against rule name, tags, and recipients.
622+
* ``tags`` : Array of strings. Return rules that have any of these tags.
623+
* ``recipients`` : Array of strings. Return rules that have any of these recipients.
624+
:type filters: str, optional
581625
:param include: Comma-separated list of resource paths for related resources to include in the response. Supported resource
582626
path is ``created_by``.
583627
:type include: str, optional
584628
:rtype: MonitorNotificationRuleListResponse
585629
"""
586630
kwargs: Dict[str, Any] = {}
631+
if page is not unset:
632+
kwargs["page"] = page
633+
634+
if per_page is not unset:
635+
kwargs["per_page"] = per_page
636+
637+
if sort is not unset:
638+
kwargs["sort"] = sort
639+
640+
if filters is not unset:
641+
kwargs["filters"] = filters
642+
587643
if include is not unset:
588644
kwargs["include"] = include
589645

0 commit comments

Comments
 (0)