Skip to content

Commit e5b3c60

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit cd9869f of spec repo
1 parent 9c31ab9 commit e5b3c60

16 files changed

+333
-21
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32306,14 +32306,20 @@ components:
3230632306
recipients:
3230732307
$ref: '#/components/schemas/MonitorNotificationRuleRecipients'
3230832308
scope:
32309-
$ref: '#/components/schemas/MonitorNotificationRuleScope'
32309+
$ref: '#/components/schemas/MonitorNotificationRuleConditionScope'
3231032310
required:
3231132311
- scope
3231232312
- recipients
3231332313
type: object
32314+
MonitorNotificationRuleConditionScope:
32315+
description: The scope to which the monitor applied.
32316+
example: transition_type:alert
32317+
maxLength: 3000
32318+
minLength: 1
32319+
type: string
3231432320
MonitorNotificationRuleConditionalRecipients:
3231532321
description: Use conditional recipients to define different recipients for different
32316-
situations.
32322+
situations. Cannot be used with `recipients`.
3231732323
properties:
3231832324
conditions:
3231932325
description: Conditions of the notification rule.
@@ -32363,12 +32369,30 @@ components:
3236332369
description: Filter used to associate the notification rule with monitors.
3236432370
oneOf:
3236532371
- $ref: '#/components/schemas/MonitorNotificationRuleFilterTags'
32372+
- $ref: '#/components/schemas/MonitorNotificationRuleFilterScope'
32373+
MonitorNotificationRuleFilterScope:
32374+
additionalProperties: false
32375+
description: Filter monitor notifications. A monitor notification must match
32376+
the scope.
32377+
properties:
32378+
scope:
32379+
description: A scope composed of one or several key:value pairs, which can
32380+
be used to filter monitor notifications on monitor and group tags.
32381+
example: service:(foo OR bar) AND team:test NOT environment:staging
32382+
maxLength: 3000
32383+
minLength: 1
32384+
type: string
32385+
required:
32386+
- scope
32387+
type: object
3236632388
MonitorNotificationRuleFilterTags:
3236732389
additionalProperties: false
32368-
description: Filter monitors by tags. Monitors must match all tags.
32390+
description: Filter monitor notifications by tags. A monitor notification must
32391+
match all tags.
3236932392
properties:
3237032393
tags:
32371-
description: A list of monitor tags.
32394+
description: A list of tags (key:value pairs), which can be used to filter
32395+
monitor notifications on monitor and group tags.
3237232396
example:
3237332397
- team:product
3237432398
- host:abc
@@ -32408,7 +32432,7 @@ components:
3240832432
type: string
3240932433
MonitorNotificationRuleRecipients:
3241032434
description: A list of recipients to notify. Uses the same format as the monitor
32411-
`message` field. Must not start with an '@'.
32435+
`message` field. Must not start with an '@'. Cannot be used with `conditional_recipients`.
3241232436
example:
3241332437
- slack-test-channel
3241432438
- jira-test
@@ -32491,12 +32515,6 @@ components:
3249132515
description: An object related to a monitor notification rule.
3249232516
oneOf:
3249332517
- $ref: '#/components/schemas/User'
32494-
MonitorNotificationRuleScope:
32495-
description: The scope to which the monitor applied.
32496-
example: transition_type:alert
32497-
maxLength: 3000
32498-
minLength: 1
32499-
type: string
3250032518
MonitorNotificationRuleUpdateRequest:
3250132519
description: Request for updating a monitor notification rule.
3250232520
properties:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-11-11T21:28:39.129Z

cassettes/features/v2/monitors/Create-a-monitor-notification-rule-with-scope-returns-OK-response.yml

Lines changed: 47 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-11-11T21:28:40.357Z

cassettes/features/v2/monitors/Update-a-monitor-notification-rule-with-scope-returns-OK-response.yml

Lines changed: 74 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Create a monitor notification rule with scope returns "OK" response
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V2::MonitorsAPI.new
5+
6+
body = DatadogAPIClient::V2::MonitorNotificationRuleCreateRequest.new({
7+
data: DatadogAPIClient::V2::MonitorNotificationRuleCreateRequestData.new({
8+
attributes: DatadogAPIClient::V2::MonitorNotificationRuleAttributes.new({
9+
filter: DatadogAPIClient::V2::MonitorNotificationRuleFilterScope.new({
10+
scope: "test:example-monitor",
11+
}),
12+
name: "test rule",
13+
recipients: [
14+
"slack-test-channel",
15+
"jira-test",
16+
],
17+
}),
18+
type: DatadogAPIClient::V2::MonitorNotificationRuleResourceType::MONITOR_NOTIFICATION_RULE,
19+
}),
20+
})
21+
p api_instance.create_monitor_notification_rule(body)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Update a monitor notification rule with scope returns "OK" response
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V2::MonitorsAPI.new
5+
6+
# there is a valid "monitor_notification_rule" in the system
7+
MONITOR_NOTIFICATION_RULE_DATA_ID = ENV["MONITOR_NOTIFICATION_RULE_DATA_ID"]
8+
9+
body = DatadogAPIClient::V2::MonitorNotificationRuleUpdateRequest.new({
10+
data: DatadogAPIClient::V2::MonitorNotificationRuleUpdateRequestData.new({
11+
attributes: DatadogAPIClient::V2::MonitorNotificationRuleAttributes.new({
12+
filter: DatadogAPIClient::V2::MonitorNotificationRuleFilterScope.new({
13+
scope: "test:example-monitor",
14+
}),
15+
name: "updated rule",
16+
recipients: [
17+
"slack-test-channel",
18+
],
19+
}),
20+
id: MONITOR_NOTIFICATION_RULE_DATA_ID,
21+
type: DatadogAPIClient::V2::MonitorNotificationRuleResourceType::MONITOR_NOTIFICATION_RULE,
22+
}),
23+
})
24+
p api_instance.update_monitor_notification_rule(MONITOR_NOTIFICATION_RULE_DATA_ID, body)

features/v2/monitors.feature

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ Feature: Monitors
5252
Then the response status is 200 OK
5353
And the response "data.attributes.name" is equal to "test rule"
5454

55+
@team:DataDog/monitor-app
56+
Scenario: Create a monitor notification rule with scope returns "OK" response
57+
Given new "CreateMonitorNotificationRule" request
58+
And body with value {"data": {"attributes": {"filter": {"scope": "test:{{ unique_lower }}"}, "name": "test rule", "recipients": ["slack-test-channel", "jira-test"]}, "type": "monitor-notification-rule"}}
59+
When the request is sent
60+
Then the response status is 200 OK
61+
And the response "data.attributes.name" is equal to "test rule"
62+
5563
@skip-validation @team:DataDog/monitor-app
5664
Scenario: Create a monitor user template returns "Bad Request" response
5765
Given new "CreateMonitorUserTemplate" request
@@ -272,6 +280,16 @@ Feature: Monitors
272280
Then the response status is 200 OK
273281
And the response "data.attributes.name" is equal to "updated rule"
274282

283+
@team:DataDog/monitor-app
284+
Scenario: Update a monitor notification rule with scope returns "OK" response
285+
Given there is a valid "monitor_notification_rule" in the system
286+
And new "UpdateMonitorNotificationRule" request
287+
And request contains "rule_id" parameter from "monitor_notification_rule.data.id"
288+
And body with value {"data": {"attributes": {"filter": {"scope": "test:{{ unique_lower }}"}, "name": "updated rule", "recipients": ["slack-test-channel"]}, "id": "{{ monitor_notification_rule.data.id }}", "type": "monitor-notification-rule"}}
289+
When the request is sent
290+
Then the response status is 200 OK
291+
And the response "data.attributes.name" is equal to "updated rule"
292+
275293
@skip-validation @team:DataDog/monitor-app
276294
Scenario: Update a monitor user template to a new version returns "Bad Request" response
277295
Given there is a valid "monitor_user_template" in the system

lib/datadog_api_client/inflector.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2956,6 +2956,7 @@ def overrides
29562956
"v2.monitor_notification_rule_create_request_data" => "MonitorNotificationRuleCreateRequestData",
29572957
"v2.monitor_notification_rule_data" => "MonitorNotificationRuleData",
29582958
"v2.monitor_notification_rule_filter" => "MonitorNotificationRuleFilter",
2959+
"v2.monitor_notification_rule_filter_scope" => "MonitorNotificationRuleFilterScope",
29592960
"v2.monitor_notification_rule_filter_tags" => "MonitorNotificationRuleFilterTags",
29602961
"v2.monitor_notification_rule_list_response" => "MonitorNotificationRuleListResponse",
29612962
"v2.monitor_notification_rule_relationships" => "MonitorNotificationRuleRelationships",

lib/datadog_api_client/v2/models/monitor_notification_rule_attributes.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module DatadogAPIClient::V2
2121
class MonitorNotificationRuleAttributes
2222
include BaseGenericModel
2323

24-
# Use conditional recipients to define different recipients for different situations.
24+
# Use conditional recipients to define different recipients for different situations. Cannot be used with `recipients`.
2525
attr_accessor :conditional_recipients
2626

2727
# Filter used to associate the notification rule with monitors.
@@ -30,7 +30,7 @@ class MonitorNotificationRuleAttributes
3030
# The name of the monitor notification rule.
3131
attr_reader :name
3232

33-
# A list of recipients to notify. Uses the same format as the monitor `message` field. Must not start with an '@'.
33+
# A list of recipients to notify. Uses the same format as the monitor `message` field. Must not start with an '@'. Cannot be used with `conditional_recipients`.
3434
attr_reader :recipients
3535

3636
# Attribute mapping from ruby-style variable name to JSON key.

0 commit comments

Comments
 (0)