Skip to content

Commit 8eb7535

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 (#2751)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 8d6a485 commit 8eb7535

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

private/bdd_runner/src/support/scenarios_model_mapping.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6132,6 +6132,22 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
61326132
operationResponseType: "IntakePayloadAccepted",
61336133
},
61346134
"MonitorsApi.V2.GetMonitorNotificationRules": {
6135+
page: {
6136+
type: "number",
6137+
format: "int32",
6138+
},
6139+
perPage: {
6140+
type: "number",
6141+
format: "int32",
6142+
},
6143+
sort: {
6144+
type: "string",
6145+
format: "",
6146+
},
6147+
filters: {
6148+
type: "string",
6149+
format: "",
6150+
},
61356151
include: {
61366152
type: "string",
61376153
format: "",

services/monitors/src/v2/MonitorsApi.ts

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

448448
public async getMonitorNotificationRules(
449+
page?: number,
450+
perPage?: number,
451+
sort?: string,
452+
filters?: string,
449453
include?: string,
450454
_options?: Configuration,
451455
): Promise<RequestContext> {
@@ -473,6 +477,34 @@ export class MonitorsApiRequestFactory extends BaseAPIRequestFactory {
473477
}
474478

475479
// Query Params
480+
if (page !== undefined) {
481+
requestContext.setQueryParam(
482+
"page",
483+
serialize(page, TypingInfo, "number", "int32"),
484+
"",
485+
);
486+
}
487+
if (perPage !== undefined) {
488+
requestContext.setQueryParam(
489+
"per_page",
490+
serialize(perPage, TypingInfo, "number", "int32"),
491+
"",
492+
);
493+
}
494+
if (sort !== undefined) {
495+
requestContext.setQueryParam(
496+
"sort",
497+
serialize(sort, TypingInfo, "string", ""),
498+
"",
499+
);
500+
}
501+
if (filters !== undefined) {
502+
requestContext.setQueryParam(
503+
"filters",
504+
serialize(filters, TypingInfo, "string", ""),
505+
"",
506+
);
507+
}
476508
if (include !== undefined) {
477509
requestContext.setQueryParam(
478510
"include",
@@ -1961,6 +1993,29 @@ export interface MonitorsApiGetMonitorNotificationRuleRequest {
19611993
}
19621994

19631995
export interface MonitorsApiGetMonitorNotificationRulesRequest {
1996+
/**
1997+
* The page to start paginating from. If `page` is not specified, the argument defaults to the first page.
1998+
* @type number
1999+
*/
2000+
page?: number;
2001+
/**
2002+
* The number of rules to return per page. If `per_page` is not specified, the argument defaults to 100.
2003+
* @type number
2004+
*/
2005+
perPage?: number;
2006+
/**
2007+
* 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`.
2008+
* @type string
2009+
*/
2010+
sort?: string;
2011+
/**
2012+
* JSON-encoded filter object. Supported keys:
2013+
* * `text`: Free-text query matched against rule name, tags, and recipients.
2014+
* * `tags`: Array of strings. Return rules that have any of these tags.
2015+
* * `recipients`: Array of strings. Return rules that have any of these recipients.
2016+
* @type string
2017+
*/
2018+
filters?: string;
19642019
/**
19652020
* Comma-separated list of resource paths for related resources to include in the response. Supported resource
19662021
* path is `created_by`.
@@ -2247,7 +2302,14 @@ export class MonitorsApi {
22472302
options?: Configuration,
22482303
): Promise<MonitorNotificationRuleListResponse> {
22492304
const requestContextPromise =
2250-
this.requestFactory.getMonitorNotificationRules(param.include, options);
2305+
this.requestFactory.getMonitorNotificationRules(
2306+
param.page,
2307+
param.perPage,
2308+
param.sort,
2309+
param.filters,
2310+
param.include,
2311+
options,
2312+
);
22512313
return requestContextPromise.then((requestContext) => {
22522314
return this.configuration.httpApi
22532315
.send(requestContext)

0 commit comments

Comments
 (0)