diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 8a63ddc4ce..9ec5c6e3a7 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.py b/examples/v2/monitors/CreateMonitorNotificationRule_292428701.py new file mode 100644 index 0000000000..f5a846d027 --- /dev/null +++ b/examples/v2/monitors/CreateMonitorNotificationRule_292428701.py @@ -0,0 +1,43 @@ +""" +Create a monitor notification rule with rule options returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.monitors_api import MonitorsApi +from datadog_api_client.v2.model.monitor_notification_rule_attributes import MonitorNotificationRuleAttributes +from datadog_api_client.v2.model.monitor_notification_rule_create_request import MonitorNotificationRuleCreateRequest +from datadog_api_client.v2.model.monitor_notification_rule_create_request_data import ( + MonitorNotificationRuleCreateRequestData, +) +from datadog_api_client.v2.model.monitor_notification_rule_filter_tags import MonitorNotificationRuleFilterTags +from datadog_api_client.v2.model.monitor_notification_rule_options import MonitorNotificationRuleOptions +from datadog_api_client.v2.model.monitor_notification_rule_resource_type import MonitorNotificationRuleResourceType + +body = MonitorNotificationRuleCreateRequest( + data=MonitorNotificationRuleCreateRequestData( + attributes=MonitorNotificationRuleAttributes( + filter=MonitorNotificationRuleFilterTags( + tags=[ + "test:example-monitor", + ], + ), + name="test rule", + recipients=[ + "slack-test-channel", + ], + rule_options=MonitorNotificationRuleOptions( + is_threaded=True, + ), + ), + type=MonitorNotificationRuleResourceType.MONITOR_NOTIFICATION_RULE, + ), +) + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +with ApiClient(configuration) as api_client: + api_instance = MonitorsApi(api_client) + response = api_instance.create_monitor_notification_rule(body=body) + + print(response) diff --git a/examples/v2/monitors/UpdateMonitorNotificationRule_365435820.py b/examples/v2/monitors/UpdateMonitorNotificationRule_365435820.py new file mode 100644 index 0000000000..524352d7c3 --- /dev/null +++ b/examples/v2/monitors/UpdateMonitorNotificationRule_365435820.py @@ -0,0 +1,47 @@ +""" +Update a monitor notification rule with rule options returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.monitors_api import MonitorsApi +from datadog_api_client.v2.model.monitor_notification_rule_attributes import MonitorNotificationRuleAttributes +from datadog_api_client.v2.model.monitor_notification_rule_filter_tags import MonitorNotificationRuleFilterTags +from datadog_api_client.v2.model.monitor_notification_rule_options import MonitorNotificationRuleOptions +from datadog_api_client.v2.model.monitor_notification_rule_resource_type import MonitorNotificationRuleResourceType +from datadog_api_client.v2.model.monitor_notification_rule_update_request import MonitorNotificationRuleUpdateRequest +from datadog_api_client.v2.model.monitor_notification_rule_update_request_data import ( + MonitorNotificationRuleUpdateRequestData, +) + +# there is a valid "monitor_notification_rule" in the system +MONITOR_NOTIFICATION_RULE_DATA_ID = environ["MONITOR_NOTIFICATION_RULE_DATA_ID"] + +body = MonitorNotificationRuleUpdateRequest( + data=MonitorNotificationRuleUpdateRequestData( + attributes=MonitorNotificationRuleAttributes( + filter=MonitorNotificationRuleFilterTags( + tags=[ + "test:example-monitor", + ], + ), + name="updated rule", + recipients=[ + "slack-test-channel", + ], + rule_options=MonitorNotificationRuleOptions( + is_threaded=False, + ), + ), + id=MONITOR_NOTIFICATION_RULE_DATA_ID, + type=MonitorNotificationRuleResourceType.MONITOR_NOTIFICATION_RULE, + ), +) + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +with ApiClient(configuration) as api_client: + api_instance = MonitorsApi(api_client) + response = api_instance.update_monitor_notification_rule(rule_id=MONITOR_NOTIFICATION_RULE_DATA_ID, body=body) + + print(response) diff --git a/src/datadog_api_client/v2/model/monitor_notification_rule_attributes.py b/src/datadog_api_client/v2/model/monitor_notification_rule_attributes.py index bb9cc48cf3..34eefcfc81 100644 --- a/src/datadog_api_client/v2/model/monitor_notification_rule_attributes.py +++ b/src/datadog_api_client/v2/model/monitor_notification_rule_attributes.py @@ -19,6 +19,7 @@ MonitorNotificationRuleConditionalRecipients, ) from datadog_api_client.v2.model.monitor_notification_rule_filter import MonitorNotificationRuleFilter + from datadog_api_client.v2.model.monitor_notification_rule_options import MonitorNotificationRuleOptions from datadog_api_client.v2.model.monitor_notification_rule_filter_tags import MonitorNotificationRuleFilterTags from datadog_api_client.v2.model.monitor_notification_rule_filter_scope import MonitorNotificationRuleFilterScope @@ -48,6 +49,7 @@ def openapi_types(_): MonitorNotificationRuleConditionalRecipients, ) from datadog_api_client.v2.model.monitor_notification_rule_filter import MonitorNotificationRuleFilter + from datadog_api_client.v2.model.monitor_notification_rule_options import MonitorNotificationRuleOptions return { "bundle_config": (MonitorNotificationRuleBundleConfig,), @@ -55,6 +57,7 @@ def openapi_types(_): "filter": (MonitorNotificationRuleFilter,), "name": (str,), "recipients": ([str],), + "rule_options": (MonitorNotificationRuleOptions,), } attribute_map = { @@ -63,6 +66,7 @@ def openapi_types(_): "filter": "filter", "name": "name", "recipients": "recipients", + "rule_options": "rule_options", } def __init__( @@ -77,6 +81,7 @@ def __init__( UnsetType, ] = unset, recipients: Union[List[str], UnsetType] = unset, + rule_options: Union[MonitorNotificationRuleOptions, UnsetType] = unset, **kwargs, ): """ @@ -97,6 +102,9 @@ def __init__( :param recipients: 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``. :type recipients: [str], optional + + :param rule_options: Additional options for the monitor notification rule. + :type rule_options: MonitorNotificationRuleOptions, optional """ if bundle_config is not unset: kwargs["bundle_config"] = bundle_config @@ -106,6 +114,8 @@ def __init__( kwargs["filter"] = filter if recipients is not unset: kwargs["recipients"] = recipients + if rule_options is not unset: + kwargs["rule_options"] = rule_options super().__init__(kwargs) self_.name = name diff --git a/src/datadog_api_client/v2/model/monitor_notification_rule_options.py b/src/datadog_api_client/v2/model/monitor_notification_rule_options.py new file mode 100644 index 0000000000..ec0475507b --- /dev/null +++ b/src/datadog_api_client/v2/model/monitor_notification_rule_options.py @@ -0,0 +1,34 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class MonitorNotificationRuleOptions(ModelNormal): + @cached_property + def openapi_types(_): + return { + "is_threaded": (bool,), + } + + attribute_map = { + "is_threaded": "is_threaded", + } + + def __init__(self_, is_threaded: bool, **kwargs): + """ + Additional options for the monitor notification rule. + + :param is_threaded: 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. + :type is_threaded: bool + """ + super().__init__(kwargs) + + self_.is_threaded = is_threaded diff --git a/src/datadog_api_client/v2/model/monitor_notification_rule_response_attributes.py b/src/datadog_api_client/v2/model/monitor_notification_rule_response_attributes.py index a2004b1d28..7580f93e3c 100644 --- a/src/datadog_api_client/v2/model/monitor_notification_rule_response_attributes.py +++ b/src/datadog_api_client/v2/model/monitor_notification_rule_response_attributes.py @@ -20,6 +20,7 @@ MonitorNotificationRuleConditionalRecipients, ) from datadog_api_client.v2.model.monitor_notification_rule_filter import MonitorNotificationRuleFilter + from datadog_api_client.v2.model.monitor_notification_rule_options import MonitorNotificationRuleOptions from datadog_api_client.v2.model.monitor_notification_rule_filter_tags import MonitorNotificationRuleFilterTags from datadog_api_client.v2.model.monitor_notification_rule_filter_scope import MonitorNotificationRuleFilterScope @@ -45,6 +46,7 @@ def openapi_types(_): MonitorNotificationRuleConditionalRecipients, ) from datadog_api_client.v2.model.monitor_notification_rule_filter import MonitorNotificationRuleFilter + from datadog_api_client.v2.model.monitor_notification_rule_options import MonitorNotificationRuleOptions return { "bundle_config": (MonitorNotificationRuleBundleConfig,), @@ -54,6 +56,7 @@ def openapi_types(_): "modified": (datetime,), "name": (str,), "recipients": ([str],), + "rule_options": (MonitorNotificationRuleOptions,), } attribute_map = { @@ -64,6 +67,7 @@ def openapi_types(_): "modified": "modified", "name": "name", "recipients": "recipients", + "rule_options": "rule_options", } def __init__( @@ -80,6 +84,7 @@ def __init__( modified: Union[datetime, UnsetType] = unset, name: Union[str, UnsetType] = unset, recipients: Union[List[str], UnsetType] = unset, + rule_options: Union[MonitorNotificationRuleOptions, UnsetType] = unset, **kwargs, ): """ @@ -106,6 +111,9 @@ def __init__( :param recipients: 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``. :type recipients: [str], optional + + :param rule_options: Additional options for the monitor notification rule. + :type rule_options: MonitorNotificationRuleOptions, optional """ if bundle_config is not unset: kwargs["bundle_config"] = bundle_config @@ -121,4 +129,6 @@ def __init__( kwargs["name"] = name if recipients is not unset: kwargs["recipients"] = recipients + if rule_options is not unset: + kwargs["rule_options"] = rule_options super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 0844b67aea..a135ddf39f 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -6720,6 +6720,7 @@ from datadog_api_client.v2.model.monitor_notification_rule_filter_scope import MonitorNotificationRuleFilterScope from datadog_api_client.v2.model.monitor_notification_rule_filter_tags import MonitorNotificationRuleFilterTags from datadog_api_client.v2.model.monitor_notification_rule_list_response import MonitorNotificationRuleListResponse +from datadog_api_client.v2.model.monitor_notification_rule_options import MonitorNotificationRuleOptions from datadog_api_client.v2.model.monitor_notification_rule_relationships import MonitorNotificationRuleRelationships from datadog_api_client.v2.model.monitor_notification_rule_relationships_created_by import ( MonitorNotificationRuleRelationshipsCreatedBy, @@ -17949,6 +17950,7 @@ "MonitorNotificationRuleFilterScope", "MonitorNotificationRuleFilterTags", "MonitorNotificationRuleListResponse", + "MonitorNotificationRuleOptions", "MonitorNotificationRuleRelationships", "MonitorNotificationRuleRelationshipsCreatedBy", "MonitorNotificationRuleRelationshipsCreatedByData", diff --git a/tests/generated-test/test-runner-data/manifest.json b/tests/generated-test/test-runner-data/manifest.json index 5b9ff71df7..a00eb635d7 100644 --- a/tests/generated-test/test-runner-data/manifest.json +++ b/tests/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": "../../v2/features/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": "../../v2/features/monitors.feature", @@ -8589,6 +8596,13 @@ "scenario": "Update a monitor notification rule with conditional_recipients returns \"OK\" response", "version": "v2" }, + { + "feature": "Monitors", + "feature_file": "../../v2/features/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": "../../v2/features/monitors.feature", diff --git a/tests/generated-test/test-runner-data/v2/monitors/create-a-monitor-notification-rule-with-rule-options-returns-ok-response.json b/tests/generated-test/test-runner-data/v2/monitors/create-a-monitor-notification-rule-with-rule-options-returns-ok-response.json new file mode 100644 index 0000000000..00dcd8c847 --- /dev/null +++ b/tests/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/tests/generated-test/test-runner-data/v2/monitors/update-a-monitor-notification-rule-with-rule-options-returns-ok-response.json b/tests/generated-test/test-runner-data/v2/monitors/update-a-monitor-notification-rule-with-rule-options-returns-ok-response.json new file mode 100644 index 0000000000..7a98cd0b53 --- /dev/null +++ b/tests/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/tests/generated-test/test-server-data/v2/monitors.json b/tests/generated-test/test-server-data/v2/monitors.json index bec7dd9efd..1f45934183 100644 --- a/tests/generated-test/test-server-data/v2/monitors.json +++ b/tests/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/tests/v2/features/monitors.feature b/tests/v2/features/monitors.feature index adda06d2e6..6ecbfc44e2 100644 --- a/tests/v2/features/monitors.feature +++ b/tests/v2/features/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