Skip to content

Commit 688019c

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 (#3105)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 5e54520 commit 688019c

File tree

2 files changed

+112
-0
lines changed

2 files changed

+112
-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/main/java/com/datadog/api/client/v2/api/MonitorsApi.java

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,8 +1252,63 @@ public ApiResponse<MonitorNotificationRuleResponse> getMonitorNotificationRuleWi
12521252

12531253
/** Manage optional parameters to getMonitorNotificationRules. */
12541254
public static class GetMonitorNotificationRulesOptionalParameters {
1255+
private Integer page;
1256+
private Integer perPage;
1257+
private String sort;
1258+
private String filters;
12551259
private String include;
12561260

1261+
/**
1262+
* Set page.
1263+
*
1264+
* @param page The page to start paginating from. If <code>page</code> is not specified, the
1265+
* argument defaults to the first page. (optional)
1266+
* @return GetMonitorNotificationRulesOptionalParameters
1267+
*/
1268+
public GetMonitorNotificationRulesOptionalParameters page(Integer page) {
1269+
this.page = page;
1270+
return this;
1271+
}
1272+
1273+
/**
1274+
* Set perPage.
1275+
*
1276+
* @param perPage The number of rules to return per page. If <code>per_page</code> is not
1277+
* specified, the argument defaults to 100. (optional)
1278+
* @return GetMonitorNotificationRulesOptionalParameters
1279+
*/
1280+
public GetMonitorNotificationRulesOptionalParameters perPage(Integer perPage) {
1281+
this.perPage = perPage;
1282+
return this;
1283+
}
1284+
1285+
/**
1286+
* Set sort.
1287+
*
1288+
* @param sort String for sort order, composed of field and sort order separated by a colon, for
1289+
* example <code>name:asc</code>. Supported sort directions: <code>asc</code>, <code>desc
1290+
* </code>. Supported fields: <code>name</code>, <code>created_at</code>. (optional)
1291+
* @return GetMonitorNotificationRulesOptionalParameters
1292+
*/
1293+
public GetMonitorNotificationRulesOptionalParameters sort(String sort) {
1294+
this.sort = sort;
1295+
return this;
1296+
}
1297+
1298+
/**
1299+
* Set filters.
1300+
*
1301+
* @param filters JSON-encoded filter object. Supported keys: * <code>text</code>: Free-text
1302+
* query matched against rule name, tags, and recipients. * <code>tags</code>: Array of
1303+
* strings. Return rules that have any of these tags. * <code>recipients</code>: Array of
1304+
* strings. Return rules that have any of these recipients. (optional)
1305+
* @return GetMonitorNotificationRulesOptionalParameters
1306+
*/
1307+
public GetMonitorNotificationRulesOptionalParameters filters(String filters) {
1308+
this.filters = filters;
1309+
return this;
1310+
}
1311+
12571312
/**
12581313
* Set include.
12591314
*
@@ -1346,13 +1401,21 @@ public CompletableFuture<MonitorNotificationRuleListResponse> getMonitorNotifica
13461401
public ApiResponse<MonitorNotificationRuleListResponse> getMonitorNotificationRulesWithHttpInfo(
13471402
GetMonitorNotificationRulesOptionalParameters parameters) throws ApiException {
13481403
Object localVarPostBody = null;
1404+
Integer page = parameters.page;
1405+
Integer perPage = parameters.perPage;
1406+
String sort = parameters.sort;
1407+
String filters = parameters.filters;
13491408
String include = parameters.include;
13501409
// create path and map variables
13511410
String localVarPath = "/api/v2/monitor/notification_rule";
13521411

13531412
List<Pair> localVarQueryParams = new ArrayList<Pair>();
13541413
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
13551414

1415+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page));
1416+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "per_page", perPage));
1417+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort));
1418+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "filters", filters));
13561419
localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include));
13571420

13581421
Invocation.Builder builder =
@@ -1387,13 +1450,21 @@ public ApiResponse<MonitorNotificationRuleListResponse> getMonitorNotificationRu
13871450
getMonitorNotificationRulesWithHttpInfoAsync(
13881451
GetMonitorNotificationRulesOptionalParameters parameters) {
13891452
Object localVarPostBody = null;
1453+
Integer page = parameters.page;
1454+
Integer perPage = parameters.perPage;
1455+
String sort = parameters.sort;
1456+
String filters = parameters.filters;
13901457
String include = parameters.include;
13911458
// create path and map variables
13921459
String localVarPath = "/api/v2/monitor/notification_rule";
13931460

13941461
List<Pair> localVarQueryParams = new ArrayList<Pair>();
13951462
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
13961463

1464+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page));
1465+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "per_page", perPage));
1466+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort));
1467+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "filters", filters));
13971468
localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include));
13981469

13991470
Invocation.Builder builder;

0 commit comments

Comments
 (0)