Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83298,6 +83298,8 @@ components:
$ref: "#/components/schemas/MonitorNotificationRuleName"
recipients:
$ref: "#/components/schemas/MonitorNotificationRuleRecipients"
rule_options:
$ref: "#/components/schemas/MonitorNotificationRuleOptions"
required: [name]
type: object
MonitorNotificationRuleBundleConfig:
Expand Down Expand Up @@ -83438,6 +83440,17 @@ components:
maxLength: 1000
minLength: 1
type: string
MonitorNotificationRuleOptions:
description: Additional options for the monitor notification rule.
properties:
is_threaded:
description: |-
Whether notifications from this rule are threaded. When `true`, follow-up notifications for the same monitor alert are posted in Slack as replies to the first notification.
Cannot be `true` when `bundle_config` is set.
example: true
type: boolean
required: [is_threaded]
type: object
MonitorNotificationRuleRecipients:
description: |-
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`.
Expand Down Expand Up @@ -83515,6 +83528,8 @@ components:
$ref: "#/components/schemas/MonitorNotificationRuleName"
recipients:
$ref: "#/components/schemas/MonitorNotificationRuleRecipients"
rule_options:
$ref: "#/components/schemas/MonitorNotificationRuleOptions"
type: object
MonitorNotificationRuleResponseIncludedItem:
description: An object related to a monitor notification rule.
Expand Down
28 changes: 28 additions & 0 deletions examples/v2/monitors/CreateMonitorNotificationRule_292428701.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Create a monitor notification rule with rule options returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::MonitorsAPI.new

body = DatadogAPIClient::V2::MonitorNotificationRuleCreateRequest.new({
data: DatadogAPIClient::V2::MonitorNotificationRuleCreateRequestData.new({
attributes: DatadogAPIClient::V2::MonitorNotificationRuleAttributes.new({
filter: DatadogAPIClient::V2::MonitorNotificationRuleFilterTags.new({
tags: [
"test:example-monitor",
],
}),
name: "test rule",
recipients: [
"slack-test-channel",
],
rule_options: DatadogAPIClient::V2::MonitorNotificationRuleOptions.new({
is_threaded: true,
}),
}),
type: DatadogAPIClient::V2::MonitorNotificationRuleResourceType::MONITOR_NOTIFICATION_RULE,
}),
})
p api_instance.create_monitor_notification_rule(body)
32 changes: 32 additions & 0 deletions examples/v2/monitors/UpdateMonitorNotificationRule_365435820.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Update a monitor notification rule with rule options returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::MonitorsAPI.new

# there is a valid "monitor_notification_rule" in the system
MONITOR_NOTIFICATION_RULE_DATA_ID = ENV["MONITOR_NOTIFICATION_RULE_DATA_ID"]

body = DatadogAPIClient::V2::MonitorNotificationRuleUpdateRequest.new({
data: DatadogAPIClient::V2::MonitorNotificationRuleUpdateRequestData.new({
attributes: DatadogAPIClient::V2::MonitorNotificationRuleAttributes.new({
filter: DatadogAPIClient::V2::MonitorNotificationRuleFilterTags.new({
tags: [
"test:example-monitor",
],
}),
name: "updated rule",
recipients: [
"slack-test-channel",
],
rule_options: DatadogAPIClient::V2::MonitorNotificationRuleOptions.new({
is_threaded: false,
}),
}),
id: MONITOR_NOTIFICATION_RULE_DATA_ID,
type: DatadogAPIClient::V2::MonitorNotificationRuleResourceType::MONITOR_NOTIFICATION_RULE,
}),
})
p api_instance.update_monitor_notification_rule(MONITOR_NOTIFICATION_RULE_DATA_ID, body)
20 changes: 20 additions & 0 deletions features/v2/monitors.feature
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ Feature: Monitors
Then the response status is 200 OK
And the response "data.attributes.name" is equal to "test rule"

@team:ddoghq/monitor-app
Scenario: Create a monitor notification rule with rule options returns "OK" response
Given new "CreateMonitorNotificationRule" request
And body with value {"data": {"attributes": {"filter": {"tags": ["test:{{ unique_lower }}"]}, "name": "test rule", "recipients": ["slack-test-channel"], "rule_options": {"is_threaded": true}}, "type": "monitor-notification-rule"}}
When the request is sent
Then the response status is 200 OK
And the response "data.attributes.name" is equal to "test rule"
And the response "data.attributes.rule_options.is_threaded" is equal to true

@team:ddoghq/monitor-app
Scenario: Create a monitor notification rule with scope returns "OK" response
Given new "CreateMonitorNotificationRule" request
Expand Down Expand Up @@ -311,6 +320,17 @@ Feature: Monitors
Then the response status is 200 OK
And the response "data.attributes.name" is equal to "updated rule"

@team:ddoghq/monitor-app
Scenario: Update a monitor notification rule with rule options returns "OK" response
Given there is a valid "monitor_notification_rule" in the system
And new "UpdateMonitorNotificationRule" request
And request contains "rule_id" parameter from "monitor_notification_rule.data.id"
And body with value {"data": {"attributes": {"filter": {"tags": ["test:{{ unique_lower }}"]}, "name": "updated rule", "recipients": ["slack-test-channel"], "rule_options": {"is_threaded": false}}, "id": "{{ monitor_notification_rule.data.id }}", "type": "monitor-notification-rule"}}
When the request is sent
Then the response status is 200 OK
And the response "data.attributes.name" is equal to "updated rule"
And the response "data.attributes.rule_options.is_threaded" is equal to false

@team:ddoghq/monitor-app
Scenario: Update a monitor notification rule with scope returns "OK" response
Given there is a valid "monitor_notification_rule" in the system
Expand Down
14 changes: 14 additions & 0 deletions generated-test/test-runner-data/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8407,6 +8407,13 @@
"scenario": "Create a monitor notification rule with conditional recipients returns \"OK\" response",
"version": "v2"
},
{
"feature": "Monitors",
"feature_file": "../../features/v2/monitors.feature",
"file": "v2/monitors/create-a-monitor-notification-rule-with-rule-options-returns-ok-response.json",
"scenario": "Create a monitor notification rule with rule options returns \"OK\" response",
"version": "v2"
},
{
"feature": "Monitors",
"feature_file": "../../features/v2/monitors.feature",
Expand Down Expand Up @@ -8589,6 +8596,13 @@
"scenario": "Update a monitor notification rule with conditional_recipients returns \"OK\" response",
"version": "v2"
},
{
"feature": "Monitors",
"feature_file": "../../features/v2/monitors.feature",
"file": "v2/monitors/update-a-monitor-notification-rule-with-rule-options-returns-ok-response.json",
"scenario": "Update a monitor notification rule with rule options returns \"OK\" response",
"version": "v2"
},
{
"feature": "Monitors",
"feature_file": "../../features/v2/monitors.feature",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"api": "Monitors",
"expected_status": 200,
"feature": "Monitors",
"id": "v2/Monitors/Create a monitor notification rule with rule options returns \"OK\" response",
"operation_id": "CreateMonitorNotificationRule",
"request": {
"body": {
"schema": {
"format": null,
"ref": "MonitorNotificationRuleCreateRequest",
"type": "object"
},
"source": "inline",
"value": {
"data": {
"attributes": {
"filter": {
"tags": [
"test:{{ unique_lower }}"
]
},
"name": "test rule",
"recipients": [
"slack-test-channel"
],
"rule_options": {
"is_threaded": true
}
},
"type": "monitor-notification-rule"
}
}
},
"content_type": "application/json",
"method": "POST",
"pagination": false,
"parameters": [],
"path": "/api/v2/monitor/notification_rule"
},
"scenario": "Create a monitor notification rule with rule options returns \"OK\" response",
"schema_version": 1,
"version": "v2"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"api": "Monitors",
"expected_status": 200,
"feature": "Monitors",
"id": "v2/Monitors/Update a monitor notification rule with rule options returns \"OK\" response",
"operation_id": "UpdateMonitorNotificationRule",
"request": {
"body": {
"schema": {
"format": null,
"ref": "MonitorNotificationRuleUpdateRequest",
"type": "object"
},
"source": "inline",
"value": {
"data": {
"attributes": {
"filter": {
"tags": [
"test:{{ unique_lower }}"
]
},
"name": "updated rule",
"recipients": [
"slack-test-channel"
],
"rule_options": {
"is_threaded": false
}
},
"id": "{{ monitor_notification_rule.data.id }}",
"type": "monitor-notification-rule"
}
}
},
"content_type": "application/json",
"method": "PATCH",
"pagination": false,
"parameters": [
{
"explode": null,
"in": "path",
"name": "rule_id",
"required": true,
"schema": {
"format": null,
"ref": null,
"type": "string"
},
"source": {
"path": "monitor_notification_rule.data.id",
"type": "fixture"
},
"style": null
}
],
"path": "/api/v2/monitor/notification_rule/{rule_id}"
},
"scenario": "Update a monitor notification rule with rule options returns \"OK\" response",
"schema_version": 1,
"version": "v2"
}
Loading
Loading