From 5dfb7d91adb75dc99c1b18309492351d55d24358 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 30 Oct 2026 23:20:13 +0000 Subject: [PATCH] Regenerate client from commit b537ec2 of spec repo --- .generator/schemas/v2/openapi.yaml | 15 ++ ...CreateMonitorNotificationRule_292428701.rb | 28 +++ ...UpdateMonitorNotificationRule_365435820.rb | 32 +++ features/v2/monitors.feature | 20 ++ generated-test/test-runner-data/manifest.json | 14 ++ ...with-rule-options-returns-ok-response.json | 44 +++++ ...with-rule-options-returns-ok-response.json | 62 ++++++ .../test-server-data/v2/monitors.json | 183 ++++++++++++++++++ lib/datadog_api_client/inflector.rb | 1 + .../monitor_notification_rule_attributes.rb | 18 +- .../monitor_notification_rule_options.rb | 124 ++++++++++++ ...r_notification_rule_response_attributes.rb | 16 +- 12 files changed, 550 insertions(+), 7 deletions(-) create mode 100644 examples/v2/monitors/CreateMonitorNotificationRule_292428701.rb create mode 100644 examples/v2/monitors/UpdateMonitorNotificationRule_365435820.rb create mode 100644 generated-test/test-runner-data/v2/monitors/create-a-monitor-notification-rule-with-rule-options-returns-ok-response.json create mode 100644 generated-test/test-runner-data/v2/monitors/update-a-monitor-notification-rule-with-rule-options-returns-ok-response.json create mode 100644 lib/datadog_api_client/v2/models/monitor_notification_rule_options.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 8a63ddc4ce88..9ec5c6e3a75e 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -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: @@ -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`. @@ -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. diff --git a/examples/v2/monitors/CreateMonitorNotificationRule_292428701.rb b/examples/v2/monitors/CreateMonitorNotificationRule_292428701.rb new file mode 100644 index 000000000000..91722d3d7f69 --- /dev/null +++ b/examples/v2/monitors/CreateMonitorNotificationRule_292428701.rb @@ -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) diff --git a/examples/v2/monitors/UpdateMonitorNotificationRule_365435820.rb b/examples/v2/monitors/UpdateMonitorNotificationRule_365435820.rb new file mode 100644 index 000000000000..d4e9d3283ddd --- /dev/null +++ b/examples/v2/monitors/UpdateMonitorNotificationRule_365435820.rb @@ -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) diff --git a/features/v2/monitors.feature b/features/v2/monitors.feature index adda06d2e6cd..6ecbfc44e280 100644 --- a/features/v2/monitors.feature +++ b/features/v2/monitors.feature @@ -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 @@ -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 diff --git a/generated-test/test-runner-data/manifest.json b/generated-test/test-runner-data/manifest.json index 6bc9e44461d2..4991746116bb 100644 --- a/generated-test/test-runner-data/manifest.json +++ b/generated-test/test-runner-data/manifest.json @@ -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", @@ -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", diff --git a/generated-test/test-runner-data/v2/monitors/create-a-monitor-notification-rule-with-rule-options-returns-ok-response.json b/generated-test/test-runner-data/v2/monitors/create-a-monitor-notification-rule-with-rule-options-returns-ok-response.json new file mode 100644 index 000000000000..00dcd8c847ea --- /dev/null +++ b/generated-test/test-runner-data/v2/monitors/create-a-monitor-notification-rule-with-rule-options-returns-ok-response.json @@ -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" +} diff --git a/generated-test/test-runner-data/v2/monitors/update-a-monitor-notification-rule-with-rule-options-returns-ok-response.json b/generated-test/test-runner-data/v2/monitors/update-a-monitor-notification-rule-with-rule-options-returns-ok-response.json new file mode 100644 index 000000000000..7a98cd0b530c --- /dev/null +++ b/generated-test/test-runner-data/v2/monitors/update-a-monitor-notification-rule-with-rule-options-returns-ok-response.json @@ -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" +} diff --git a/generated-test/test-server-data/v2/monitors.json b/generated-test/test-server-data/v2/monitors.json index bec7dd9efd21..1f4593418304 100644 --- a/generated-test/test-server-data/v2/monitors.json +++ b/generated-test/test-server-data/v2/monitors.json @@ -447,6 +447,78 @@ "scenario": "Create a monitor notification rule with conditional recipients returns \"OK\" response", "version": "v2" }, + { + "feature": "Monitors", + "frozen_at": "2026-10-30T20:36:08.126Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "filter": { + "tags": [ + "test:test-create_a_monitor_notification_rule_with_rule_options_returns_ok_response-1793392568" + ] + }, + "name": "test rule", + "recipients": [ + "slack-test-channel" + ], + "rule_options": { + "is_threaded": true + } + }, + "type": "monitor-notification-rule" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/monitor/notification_rule", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"type\":\"monitor-notification-rule\",\"id\":\"740e35fe-ba09-4bd7-981b-df1197331db5\",\"attributes\":{\"name\":\"test rule\",\"created_at\":\"2026-10-30T20:36:08.241525+00:00\",\"modified_at\":\"2026-10-30T20:36:08.260322+00:00\",\"filter\":{\"tags\":[\"test:test-create_a_monitor_notification_rule_with_rule_options_returns_ok_response-1793392568\"]},\"recipients\":[\"slack-test-channel\"],\"rule_options\":{\"is_threaded\":true}},\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"8c875225-6d15-408c-9dcc-dd539cd02fa5\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"8c875225-6d15-408c-9dcc-dd539cd02fa5\",\"attributes\":{\"uuid\":\"8c875225-6d15-408c-9dcc-dd539cd02fa5\",\"name\":\"Shane Yuan\",\"handle\":\"shane.yuan@datadoghq.com\",\"created_at\":\"2026-10-30T20:27:13.026594+00:00\",\"modified_at\":\"2026-10-30T20:27:25.236531+00:00\",\"email\":\"shane.yuan@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/188fa6df65bb6c77c82677908094fbdb?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\",\"last_login_time\":null}}]}\n" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v2/monitor/notification_rule/740e35fe-ba09-4bd7-981b-df1197331db5", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "" + }, + "headers": { + "content-type": "text/html; charset=utf-8" + }, + "reason": "No Content", + "status": 204 + } + } + ], + "scenario": "Create a monitor notification rule with rule options returns \"OK\" response", + "version": "v2" + }, { "feature": "Monitors", "frozen_at": "2025-11-11T21:28:39.129Z", @@ -2388,6 +2460,117 @@ "scenario": "Update a monitor notification rule with conditional_recipients returns \"OK\" response", "version": "v2" }, + { + "feature": "Monitors", + "frozen_at": "2026-10-30T20:36:32.533Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "filter": { + "tags": [ + "app:test-update_a_monitor_notification_rule_with_rule_options_returns_ok_response-1793392592" + ] + }, + "name": "test rule", + "recipients": [ + "slack-monitor-app" + ] + }, + "type": "monitor-notification-rule" + } + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v2/monitor/notification_rule", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"type\":\"monitor-notification-rule\",\"id\":\"586901e2-3384-4a4e-89c3-b7ba7906bcc0\",\"attributes\":{\"name\":\"test rule\",\"created_at\":\"2026-10-30T20:36:32.665098+00:00\",\"modified_at\":\"2026-10-30T20:36:32.679819+00:00\",\"filter\":{\"tags\":[\"app:test-update_a_monitor_notification_rule_with_rule_options_returns_ok_response-1793392592\"]},\"recipients\":[\"slack-monitor-app\"]},\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"8c875225-6d15-408c-9dcc-dd539cd02fa5\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"8c875225-6d15-408c-9dcc-dd539cd02fa5\",\"attributes\":{\"uuid\":\"8c875225-6d15-408c-9dcc-dd539cd02fa5\",\"name\":\"Shane Yuan\",\"handle\":\"shane.yuan@datadoghq.com\",\"created_at\":\"2026-10-30T20:27:13.026594+00:00\",\"modified_at\":\"2026-10-30T20:27:25.236531+00:00\",\"email\":\"shane.yuan@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/188fa6df65bb6c77c82677908094fbdb?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\",\"last_login_time\":null}}]}\n" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "json", + "value": { + "data": { + "attributes": { + "filter": { + "tags": [ + "test:test-update_a_monitor_notification_rule_with_rule_options_returns_ok_response-1793392592" + ] + }, + "name": "updated rule", + "recipients": [ + "slack-test-channel" + ], + "rule_options": { + "is_threaded": false + } + }, + "id": "586901e2-3384-4a4e-89c3-b7ba7906bcc0", + "type": "monitor-notification-rule" + } + } + }, + "content_type": "application/json", + "method": "PATCH", + "path": "/api/v2/monitor/notification_rule/586901e2-3384-4a4e-89c3-b7ba7906bcc0", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"data\":{\"type\":\"monitor-notification-rule\",\"id\":\"586901e2-3384-4a4e-89c3-b7ba7906bcc0\",\"attributes\":{\"name\":\"updated rule\",\"created_at\":\"2026-10-30T20:36:32.665098+00:00\",\"modified_at\":\"2026-10-30T20:36:32.849285+00:00\",\"filter\":{\"tags\":[\"test:test-update_a_monitor_notification_rule_with_rule_options_returns_ok_response-1793392592\"]},\"recipients\":[\"slack-test-channel\"],\"rule_options\":{\"is_threaded\":false}},\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"8c875225-6d15-408c-9dcc-dd539cd02fa5\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"8c875225-6d15-408c-9dcc-dd539cd02fa5\",\"attributes\":{\"uuid\":\"8c875225-6d15-408c-9dcc-dd539cd02fa5\",\"name\":\"Shane Yuan\",\"handle\":\"shane.yuan@datadoghq.com\",\"created_at\":\"2026-10-30T20:27:13.026594+00:00\",\"modified_at\":\"2026-10-30T20:27:25.236531+00:00\",\"email\":\"shane.yuan@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/188fa6df65bb6c77c82677908094fbdb?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\",\"last_login_time\":null}}]}\n" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v2/monitor/notification_rule/586901e2-3384-4a4e-89c3-b7ba7906bcc0", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "" + }, + "headers": { + "content-type": "text/html; charset=utf-8" + }, + "reason": "No Content", + "status": 204 + } + } + ], + "scenario": "Update a monitor notification rule with rule options returns \"OK\" response", + "version": "v2" + }, { "feature": "Monitors", "frozen_at": "2025-11-11T21:28:40.357Z", diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 85318307bbca..9f699ed48379 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -5925,6 +5925,7 @@ def overrides "v2.monitor_notification_rule_filter_scope" => "MonitorNotificationRuleFilterScope", "v2.monitor_notification_rule_filter_tags" => "MonitorNotificationRuleFilterTags", "v2.monitor_notification_rule_list_response" => "MonitorNotificationRuleListResponse", + "v2.monitor_notification_rule_options" => "MonitorNotificationRuleOptions", "v2.monitor_notification_rule_relationships" => "MonitorNotificationRuleRelationships", "v2.monitor_notification_rule_relationships_created_by" => "MonitorNotificationRuleRelationshipsCreatedBy", "v2.monitor_notification_rule_relationships_created_by_data" => "MonitorNotificationRuleRelationshipsCreatedByData", diff --git a/lib/datadog_api_client/v2/models/monitor_notification_rule_attributes.rb b/lib/datadog_api_client/v2/models/monitor_notification_rule_attributes.rb index 9a61570f2830..403410165b54 100644 --- a/lib/datadog_api_client/v2/models/monitor_notification_rule_attributes.rb +++ b/lib/datadog_api_client/v2/models/monitor_notification_rule_attributes.rb @@ -37,6 +37,9 @@ class MonitorNotificationRuleAttributes # 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`. attr_reader :recipients + # Additional options for the monitor notification rule. + attr_accessor :rule_options + # Attribute mapping from ruby-style variable name to JSON key. # @!visibility private def self.attribute_map @@ -45,7 +48,8 @@ def self.attribute_map :'conditional_recipients' => :'conditional_recipients', :'filter' => :'filter', :'name' => :'name', - :'recipients' => :'recipients' + :'recipients' => :'recipients', + :'rule_options' => :'rule_options' } end @@ -57,7 +61,8 @@ def self.openapi_types :'conditional_recipients' => :'MonitorNotificationRuleConditionalRecipients', :'filter' => :'MonitorNotificationRuleFilter', :'name' => :'String', - :'recipients' => :'Array' + :'recipients' => :'Array', + :'rule_options' => :'MonitorNotificationRuleOptions' } end @@ -98,6 +103,10 @@ def initialize(attributes = {}) self.recipients = value end end + + if attributes.key?(:'rule_options') + self.rule_options = attributes[:'rule_options'] + end end # Check to see if the all the properties in the model are valid @@ -151,14 +160,15 @@ def ==(o) conditional_recipients == o.conditional_recipients && filter == o.filter && name == o.name && - recipients == o.recipients + recipients == o.recipients && + rule_options == o.rule_options end # Calculates hash code according to all attributes. # @return [Integer] Hash code # @!visibility private def hash - [bundle_config, conditional_recipients, filter, name, recipients].hash + [bundle_config, conditional_recipients, filter, name, recipients, rule_options].hash end end end diff --git a/lib/datadog_api_client/v2/models/monitor_notification_rule_options.rb b/lib/datadog_api_client/v2/models/monitor_notification_rule_options.rb new file mode 100644 index 000000000000..ca8b32120a69 --- /dev/null +++ b/lib/datadog_api_client/v2/models/monitor_notification_rule_options.rb @@ -0,0 +1,124 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Additional options for the monitor notification rule. + class MonitorNotificationRuleOptions + include BaseGenericModel + + # 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. + attr_reader :is_threaded + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'is_threaded' => :'is_threaded' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'is_threaded' => :'Boolean' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MonitorNotificationRuleOptions` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'is_threaded') + self.is_threaded = attributes[:'is_threaded'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @is_threaded.nil? + true + end + + # Custom attribute writer method with validation + # @param is_threaded [Object] Object to be assigned + # @!visibility private + def is_threaded=(is_threaded) + if is_threaded.nil? + fail ArgumentError, 'invalid value for "is_threaded", is_threaded cannot be nil.' + end + @is_threaded = is_threaded + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + is_threaded == o.is_threaded && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [is_threaded, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/monitor_notification_rule_response_attributes.rb b/lib/datadog_api_client/v2/models/monitor_notification_rule_response_attributes.rb index fc9851df5fb1..80b853637535 100644 --- a/lib/datadog_api_client/v2/models/monitor_notification_rule_response_attributes.rb +++ b/lib/datadog_api_client/v2/models/monitor_notification_rule_response_attributes.rb @@ -43,6 +43,9 @@ class MonitorNotificationRuleResponseAttributes # 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`. attr_reader :recipients + # Additional options for the monitor notification rule. + attr_accessor :rule_options + attr_accessor :additional_properties # Attribute mapping from ruby-style variable name to JSON key. @@ -55,7 +58,8 @@ def self.attribute_map :'filter' => :'filter', :'modified' => :'modified', :'name' => :'name', - :'recipients' => :'recipients' + :'recipients' => :'recipients', + :'rule_options' => :'rule_options' } end @@ -69,7 +73,8 @@ def self.openapi_types :'filter' => :'MonitorNotificationRuleFilter', :'modified' => :'Time', :'name' => :'String', - :'recipients' => :'Array' + :'recipients' => :'Array', + :'rule_options' => :'MonitorNotificationRuleOptions' } end @@ -120,6 +125,10 @@ def initialize(attributes = {}) self.recipients = value end end + + if attributes.key?(:'rule_options') + self.rule_options = attributes[:'rule_options'] + end end # Check to see if the all the properties in the model are valid @@ -192,6 +201,7 @@ def ==(o) modified == o.modified && name == o.name && recipients == o.recipients && + rule_options == o.rule_options && additional_properties == o.additional_properties end @@ -199,7 +209,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [bundle_config, conditional_recipients, created, filter, modified, name, recipients, additional_properties].hash + [bundle_config, conditional_recipients, created, filter, modified, name, recipients, rule_options, additional_properties].hash end end end