Skip to content

Commit 55b27ad

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

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-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

features/scenarios_model_mapping.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,6 +2153,10 @@
21532153
"body" => "MetricPayload",
21542154
},
21552155
"v2.GetMonitorNotificationRules" => {
2156+
"page" => "Integer",
2157+
"per_page" => "Integer",
2158+
"sort" => "String",
2159+
"filters" => "String",
21562160
"include" => "String",
21572161
},
21582162
"v2.CreateMonitorNotificationRule" => {

lib/datadog_api_client/v2/api/monitors_api.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,18 +576,38 @@ def get_monitor_notification_rules(opts = {})
576576
# Returns a list of all monitor notification rules.
577577
#
578578
# @param opts [Hash] the optional parameters
579+
# @option opts [Integer] :page The page to start paginating from. If `page` is not specified, the argument defaults to the first page.
580+
# @option opts [Integer] :per_page The number of rules to return per page. If `per_page` is not specified, the argument defaults to 100.
581+
# @option opts [String] :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`.
582+
# @option opts [String] :filters JSON-encoded filter object. Supported keys: * `text`: Free-text query matched against rule name, tags, and recipients. * `tags`: Array of strings. Return rules that have any of these tags. * `recipients`: Array of strings. Return rules that have any of these recipients.
579583
# @option opts [String] :include Comma-separated list of resource paths for related resources to include in the response. Supported resource path is `created_by`.
580584
# @return [Array<(MonitorNotificationRuleListResponse, Integer, Hash)>] MonitorNotificationRuleListResponse data, response status code and response headers
581585
def get_monitor_notification_rules_with_http_info(opts = {})
582586

583587
if @api_client.config.debugging
584588
@api_client.config.logger.debug 'Calling API: MonitorsAPI.get_monitor_notification_rules ...'
585589
end
590+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 1000000
591+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling MonitorsAPI.get_monitor_notification_rules, must be smaller than or equal to 1000000.'
592+
end
593+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 0
594+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling MonitorsAPI.get_monitor_notification_rules, must be greater than or equal to 0.'
595+
end
596+
if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 1000
597+
fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling MonitorsAPI.get_monitor_notification_rules, must be smaller than or equal to 1000.'
598+
end
599+
if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1
600+
fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling MonitorsAPI.get_monitor_notification_rules, must be greater than or equal to 1.'
601+
end
586602
# resource path
587603
local_var_path = '/api/v2/monitor/notification_rule'
588604

589605
# query parameters
590606
query_params = opts[:query_params] || {}
607+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
608+
query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
609+
query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
610+
query_params[:'filters'] = opts[:'filters'] if !opts[:'filters'].nil?
591611
query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil?
592612

593613
# header parameters

0 commit comments

Comments
 (0)