Skip to content

Commit bf02bdc

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 88fa4c2 of spec repo
1 parent 9db491e commit bf02bdc

13 files changed

+594
-10
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29063,6 +29063,8 @@ components:
2906329063
additionalProperties: false
2906429064
description: Attributes of the monitor notification rule.
2906529065
properties:
29066+
conditional_recipients:
29067+
$ref: '#/components/schemas/MonitorNotificationRuleConditionalRecipients'
2906629068
filter:
2906729069
$ref: '#/components/schemas/MonitorNotificationRuleFilter'
2906829070
name:
@@ -29071,8 +29073,36 @@ components:
2907129073
$ref: '#/components/schemas/MonitorNotificationRuleRecipients'
2907229074
required:
2907329075
- name
29076+
type: object
29077+
MonitorNotificationRuleCondition:
29078+
description: Conditions for `conditional_recipients`.
29079+
properties:
29080+
recipients:
29081+
$ref: '#/components/schemas/MonitorNotificationRuleRecipients'
29082+
scope:
29083+
$ref: '#/components/schemas/MonitorNotificationRuleScope'
29084+
required:
29085+
- scope
2907429086
- recipients
2907529087
type: object
29088+
MonitorNotificationRuleConditionalRecipients:
29089+
description: Use conditional recipients to define different recipients for different
29090+
situations.
29091+
properties:
29092+
conditions:
29093+
description: Conditions of the notification rule.
29094+
items:
29095+
$ref: '#/components/schemas/MonitorNotificationRuleCondition'
29096+
maxItems: 10
29097+
minItems: 1
29098+
type: array
29099+
fallback_recipients:
29100+
$ref: '#/components/schemas/MonitorNotificationRuleRecipients'
29101+
description: If none of the `conditions` applied, `fallback_recipients`
29102+
will get notified.
29103+
required:
29104+
- conditions
29105+
type: object
2907629106
MonitorNotificationRuleCreateRequest:
2907729107
description: Request for creating a monitor notification rule.
2907829108
properties:
@@ -29212,6 +29242,8 @@ components:
2921229242
additionalProperties: {}
2921329243
description: Attributes of the monitor notification rule.
2921429244
properties:
29245+
conditional_recipients:
29246+
$ref: '#/components/schemas/MonitorNotificationRuleConditionalRecipients'
2921529247
created:
2921629248
description: Creation time of the monitor notification rule.
2921729249
example: 2020-01-02 03:04:00+00:00
@@ -29233,6 +29265,12 @@ components:
2923329265
description: An object related to a monitor notification rule.
2923429266
oneOf:
2923529267
- $ref: '#/components/schemas/User'
29268+
MonitorNotificationRuleScope:
29269+
description: The scope to which the monitor applied.
29270+
example: transition_type:alert
29271+
maxLength: 3000
29272+
minLength: 1
29273+
type: string
2923629274
MonitorNotificationRuleUpdateRequest:
2923729275
description: Request for updating a monitor notification rule.
2923829276
properties:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-09-26T01:50:59.027Z

cassettes/features/v2/monitors/Create-a-monitor-notification-rule-with-conditional-recipients-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.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-09-26T01:51:00.504Z

cassettes/features/v2/monitors/Update-a-monitor-notification-rule-with-conditional-recipients-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: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Create a monitor notification rule with conditional recipients 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::MonitorNotificationRuleFilterTags.new({
10+
tags: [
11+
"test:example-monitor",
12+
],
13+
}),
14+
name: "test rule",
15+
conditional_recipients: DatadogAPIClient::V2::MonitorNotificationRuleConditionalRecipients.new({
16+
conditions: [
17+
DatadogAPIClient::V2::MonitorNotificationRuleCondition.new({
18+
scope: "transition_type:is_alert",
19+
recipients: [
20+
"slack-test-channel",
21+
"jira-test",
22+
],
23+
}),
24+
],
25+
}),
26+
}),
27+
type: DatadogAPIClient::V2::MonitorNotificationRuleResourceType::MONITOR_NOTIFICATION_RULE,
28+
}),
29+
})
30+
p api_instance.create_monitor_notification_rule(body)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Update a monitor notification rule with conditional_recipients 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::MonitorNotificationRuleFilterTags.new({
13+
tags: [
14+
"test:example-monitor",
15+
"host:abc",
16+
],
17+
}),
18+
name: "updated rule",
19+
conditional_recipients: DatadogAPIClient::V2::MonitorNotificationRuleConditionalRecipients.new({
20+
conditions: [
21+
DatadogAPIClient::V2::MonitorNotificationRuleCondition.new({
22+
scope: "transition_type:is_alert",
23+
recipients: [
24+
"slack-test-channel",
25+
"jira-test",
26+
],
27+
}),
28+
],
29+
}),
30+
}),
31+
id: MONITOR_NOTIFICATION_RULE_DATA_ID,
32+
type: DatadogAPIClient::V2::MonitorNotificationRuleResourceType::MONITOR_NOTIFICATION_RULE,
33+
}),
34+
})
35+
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
@@ -44,6 +44,14 @@ Feature: Monitors
4444
Then the response status is 200 OK
4545
And the response "data.attributes.name" is equal to "test rule"
4646

47+
@team:DataDog/monitor-app
48+
Scenario: Create a monitor notification rule with conditional recipients returns "OK" response
49+
Given new "CreateMonitorNotificationRule" request
50+
And body with value {"data": {"attributes": {"filter": {"tags": ["test:{{ unique_lower }}"]}, "name": "test rule", "conditional_recipients": {"conditions": [{"scope": "transition_type:is_alert", "recipients": ["slack-test-channel", "jira-test"]}]}}, "type": "monitor-notification-rule"}}
51+
When the request is sent
52+
Then the response status is 200 OK
53+
And the response "data.attributes.name" is equal to "test rule"
54+
4755
@skip-validation @team:DataDog/monitor-app
4856
Scenario: Create a monitor user template returns "Bad Request" response
4957
Given new "CreateMonitorUserTemplate" request
@@ -255,6 +263,16 @@ Feature: Monitors
255263
Then the response status is 200 OK
256264
And the response "data.attributes.name" is equal to "updated rule"
257265

266+
@team:DataDog/monitor-app
267+
Scenario: Update a monitor notification rule with conditional_recipients returns "OK" response
268+
Given there is a valid "monitor_notification_rule" in the system
269+
And new "UpdateMonitorNotificationRule" request
270+
And request contains "rule_id" parameter from "monitor_notification_rule.data.id"
271+
And body with value {"data": {"attributes": {"filter": {"tags": ["test:{{ unique_lower }}", "host:abc"]}, "name": "updated rule", "conditional_recipients": {"conditions": [{"scope": "transition_type:is_alert", "recipients": ["slack-test-channel", "jira-test"]}]}}, "id": "{{ monitor_notification_rule.data.id }}", "type": "monitor-notification-rule"}}
272+
When the request is sent
273+
Then the response status is 200 OK
274+
And the response "data.attributes.name" is equal to "updated rule"
275+
258276
@skip-validation @team:DataDog/monitor-app
259277
Scenario: Update a monitor user template to a new version returns "Bad Request" response
260278
Given there is a valid "monitor_user_template" in the system

lib/datadog_api_client/inflector.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2728,6 +2728,8 @@ def overrides
27282728
"v2.monitor_downtime_match_response_attributes" => "MonitorDowntimeMatchResponseAttributes",
27292729
"v2.monitor_downtime_match_response_data" => "MonitorDowntimeMatchResponseData",
27302730
"v2.monitor_notification_rule_attributes" => "MonitorNotificationRuleAttributes",
2731+
"v2.monitor_notification_rule_condition" => "MonitorNotificationRuleCondition",
2732+
"v2.monitor_notification_rule_conditional_recipients" => "MonitorNotificationRuleConditionalRecipients",
27312733
"v2.monitor_notification_rule_create_request" => "MonitorNotificationRuleCreateRequest",
27322734
"v2.monitor_notification_rule_create_request_data" => "MonitorNotificationRuleCreateRequestData",
27332735
"v2.monitor_notification_rule_data" => "MonitorNotificationRuleData",

lib/datadog_api_client/v2/models/monitor_notification_rule_attributes.rb

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

24+
# Use conditional recipients to define different recipients for different situations.
25+
attr_accessor :conditional_recipients
26+
2427
# Filter used to associate the notification rule with monitors.
2528
attr_accessor :filter
2629

@@ -34,6 +37,7 @@ class MonitorNotificationRuleAttributes
3437
# @!visibility private
3538
def self.attribute_map
3639
{
40+
:'conditional_recipients' => :'conditional_recipients',
3741
:'filter' => :'filter',
3842
:'name' => :'name',
3943
:'recipients' => :'recipients'
@@ -44,6 +48,7 @@ def self.attribute_map
4448
# @!visibility private
4549
def self.openapi_types
4650
{
51+
:'conditional_recipients' => :'MonitorNotificationRuleConditionalRecipients',
4752
:'filter' => :'MonitorNotificationRuleFilter',
4853
:'name' => :'String',
4954
:'recipients' => :'Array<String>'
@@ -66,6 +71,10 @@ def initialize(attributes = {})
6671
h[k.to_sym] = v
6772
}
6873

74+
if attributes.key?(:'conditional_recipients')
75+
self.conditional_recipients = attributes[:'conditional_recipients']
76+
end
77+
6978
if attributes.key?(:'filter')
7079
self.filter = attributes[:'filter']
7180
end
@@ -88,9 +97,8 @@ def valid?
8897
return false if @name.nil?
8998
return false if @name.to_s.length > 1000
9099
return false if @name.to_s.length < 1
91-
return false if @recipients.nil?
92-
return false if @recipients.length > 20
93-
return false if @recipients.length < 1
100+
return false if !@recipients.nil? && @recipients.length > 20
101+
return false if !@recipients.nil? && @recipients.length < 1
94102
true
95103
end
96104

@@ -114,13 +122,10 @@ def name=(name)
114122
# @param recipients [Object] Object to be assigned
115123
# @!visibility private
116124
def recipients=(recipients)
117-
if recipients.nil?
118-
fail ArgumentError, 'invalid value for "recipients", recipients cannot be nil.'
119-
end
120-
if recipients.length > 20
125+
if !recipients.nil? && recipients.length > 20
121126
fail ArgumentError, 'invalid value for "recipients", number of items must be less than or equal to 20.'
122127
end
123-
if recipients.length < 1
128+
if !recipients.nil? && recipients.length < 1
124129
fail ArgumentError, 'invalid value for "recipients", number of items must be greater than or equal to 1.'
125130
end
126131
@recipients = recipients
@@ -132,6 +137,7 @@ def recipients=(recipients)
132137
def ==(o)
133138
return true if self.equal?(o)
134139
self.class == o.class &&
140+
conditional_recipients == o.conditional_recipients &&
135141
filter == o.filter &&
136142
name == o.name &&
137143
recipients == o.recipients
@@ -141,7 +147,7 @@ def ==(o)
141147
# @return [Integer] Hash code
142148
# @!visibility private
143149
def hash
144-
[filter, name, recipients].hash
150+
[conditional_recipients, filter, name, recipients].hash
145151
end
146152
end
147153
end

0 commit comments

Comments
 (0)