Skip to content

Commit b210dec

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 (#2752)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 4ad4ee2 commit b210dec

File tree

3 files changed

+120
-1
lines changed

3 files changed

+120
-1
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

features/support/scenarios_model_mapping.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6122,6 +6122,22 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
61226122
"operationResponseType": "IntakePayloadAccepted",
61236123
},
61246124
"v2.GetMonitorNotificationRules": {
6125+
"page": {
6126+
"type": "number",
6127+
"format": "int32",
6128+
},
6129+
"perPage": {
6130+
"type": "number",
6131+
"format": "int32",
6132+
},
6133+
"sort": {
6134+
"type": "string",
6135+
"format": "",
6136+
},
6137+
"filters": {
6138+
"type": "string",
6139+
"format": "",
6140+
},
61256141
"include": {
61266142
"type": "string",
61276143
"format": "",

packages/datadog-api-client-v2/apis/MonitorsApi.ts

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,10 @@ export class MonitorsApiRequestFactory extends BaseAPIRequestFactory {
351351
}
352352

353353
public async getMonitorNotificationRules(
354+
page?: number,
355+
perPage?: number,
356+
sort?: string,
357+
filters?: string,
354358
include?: string,
355359
_options?: Configuration
356360
): Promise<RequestContext> {
@@ -367,6 +371,34 @@ export class MonitorsApiRequestFactory extends BaseAPIRequestFactory {
367371
requestContext.setHttpConfig(_config.httpConfig);
368372

369373
// Query Params
374+
if (page !== undefined) {
375+
requestContext.setQueryParam(
376+
"page",
377+
ObjectSerializer.serialize(page, "number", "int32"),
378+
""
379+
);
380+
}
381+
if (perPage !== undefined) {
382+
requestContext.setQueryParam(
383+
"per_page",
384+
ObjectSerializer.serialize(perPage, "number", "int32"),
385+
""
386+
);
387+
}
388+
if (sort !== undefined) {
389+
requestContext.setQueryParam(
390+
"sort",
391+
ObjectSerializer.serialize(sort, "string", ""),
392+
""
393+
);
394+
}
395+
if (filters !== undefined) {
396+
requestContext.setQueryParam(
397+
"filters",
398+
ObjectSerializer.serialize(filters, "string", ""),
399+
""
400+
);
401+
}
370402
if (include !== undefined) {
371403
requestContext.setQueryParam(
372404
"include",
@@ -1836,6 +1868,29 @@ export interface MonitorsApiGetMonitorNotificationRuleRequest {
18361868
}
18371869

18381870
export interface MonitorsApiGetMonitorNotificationRulesRequest {
1871+
/**
1872+
* The page to start paginating from. If `page` is not specified, the argument defaults to the first page.
1873+
* @type number
1874+
*/
1875+
page?: number;
1876+
/**
1877+
* The number of rules to return per page. If `per_page` is not specified, the argument defaults to 100.
1878+
* @type number
1879+
*/
1880+
perPage?: number;
1881+
/**
1882+
* 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`.
1883+
* @type string
1884+
*/
1885+
sort?: string;
1886+
/**
1887+
* JSON-encoded filter object. Supported keys:
1888+
* * `text`: Free-text query matched against rule name, tags, and recipients.
1889+
* * `tags`: Array of strings. Return rules that have any of these tags.
1890+
* * `recipients`: Array of strings. Return rules that have any of these recipients.
1891+
* @type string
1892+
*/
1893+
filters?: string;
18391894
/**
18401895
* Comma-separated list of resource paths for related resources to include in the response. Supported resource
18411896
* path is `created_by`.
@@ -2120,7 +2175,14 @@ export class MonitorsApi {
21202175
options?: Configuration
21212176
): Promise<MonitorNotificationRuleListResponse> {
21222177
const requestContextPromise =
2123-
this.requestFactory.getMonitorNotificationRules(param.include, options);
2178+
this.requestFactory.getMonitorNotificationRules(
2179+
param.page,
2180+
param.perPage,
2181+
param.sort,
2182+
param.filters,
2183+
param.include,
2184+
options
2185+
);
21242186
return requestContextPromise.then((requestContext) => {
21252187
return this.configuration.httpApi
21262188
.send(requestContext)

0 commit comments

Comments
 (0)