From cea2c795813814b251400f6be1d436be10023766 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 4 Nov 2026 09:11:07 +0000 Subject: [PATCH] Regenerate client from commit 11196e9 of spec repo --- .generator/schemas/v2/openapi.yaml | 71 ++++++- ...CreateMonitorNotificationRule_292428701.py | 43 ++++ ...UpdateMonitorNotificationRule_365435820.py | 47 +++++ .../v2/model/incident_created_trigger.py | 12 +- .../model/incident_impact_created_trigger.py | 12 +- .../model/incident_impact_updated_trigger.py | 12 +- .../incident_postmortem_updated_trigger.py | 12 +- .../incident_responder_created_trigger.py | 12 +- .../v2/model/incident_saved_trigger.py | 12 +- .../v2/model/incident_schedule_trigger.py | 12 +- .../monitor_notification_rule_attributes.py | 10 + .../monitor_notification_rule_options.py | 34 ++++ ...r_notification_rule_response_attributes.py | 10 + src/datadog_api_client/v2/models/__init__.py | 2 + .../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 ++++++++++++++++++ tests/v2/features/monitors.feature | 20 ++ 19 files changed, 603 insertions(+), 21 deletions(-) create mode 100644 examples/v2/monitors/CreateMonitorNotificationRule_292428701.py create mode 100644 examples/v2/monitors/UpdateMonitorNotificationRule_365435820.py create mode 100644 src/datadog_api_client/v2/model/monitor_notification_rule_options.py create mode 100644 tests/generated-test/test-runner-data/v2/monitors/create-a-monitor-notification-rule-with-rule-options-returns-ok-response.json create mode 100644 tests/generated-test/test-runner-data/v2/monitors/update-a-monitor-notification-rule-with-rule-options-returns-ok-response.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 1798ff51a8..05b36d6266 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -61454,8 +61454,14 @@ components: description: "Trigger a workflow when an incident is declared." properties: incidentType: - description: "The type of incident that triggers the workflow." + deprecated: true + description: "The type of incident that triggers the workflow. Deprecated. Use `incidentTypes` instead." type: string + incidentTypes: + description: "The types of incidents that trigger the workflow." + items: + type: string + type: array tagCondition: $ref: "#/components/schemas/IncidentCondition" type: object @@ -62154,8 +62160,14 @@ components: executionLimit: $ref: "#/components/schemas/ExecutionLimit" incidentType: - description: "The type of incident that triggers the workflow." + deprecated: true + description: "The type of incident that triggers the workflow. Deprecated. Use `incidentTypes` instead." type: string + incidentTypes: + description: "The types of incidents that trigger the workflow." + items: + type: string + type: array tagCondition: $ref: "#/components/schemas/IncidentCondition" type: object @@ -62473,8 +62485,14 @@ components: executionLimit: $ref: "#/components/schemas/ExecutionLimit" incidentType: - description: "The type of incident that triggers the workflow." + deprecated: true + description: "The type of incident that triggers the workflow. Deprecated. Use `incidentTypes` instead." type: string + incidentTypes: + description: "The types of incidents that trigger the workflow." + items: + type: string + type: array tagCondition: $ref: "#/components/schemas/IncidentCondition" type: object @@ -63715,8 +63733,14 @@ components: executionLimit: $ref: "#/components/schemas/ExecutionLimit" incidentType: - description: "The type of incident that triggers the workflow." + deprecated: true + description: "The type of incident that triggers the workflow. Deprecated. Use `incidentTypes` instead." type: string + incidentTypes: + description: "The types of incidents that trigger the workflow." + items: + type: string + type: array tagCondition: $ref: "#/components/schemas/IncidentCondition" type: object @@ -63766,8 +63790,14 @@ components: executionLimit: $ref: "#/components/schemas/ExecutionLimit" incidentType: - description: "The type of incident that triggers the workflow." + deprecated: true + description: "The type of incident that triggers the workflow. Deprecated. Use `incidentTypes` instead." type: string + incidentTypes: + description: "The types of incidents that trigger the workflow." + items: + type: string + type: array tagCondition: $ref: "#/components/schemas/IncidentCondition" type: object @@ -64751,8 +64781,14 @@ components: executionLimit: $ref: "#/components/schemas/ExecutionLimit" incidentType: - description: "The type of incident that triggers the workflow." + deprecated: true + description: "The type of incident that triggers the workflow. Deprecated. Use `incidentTypes` instead." type: string + incidentTypes: + description: "The types of incidents that trigger the workflow." + items: + type: string + type: array serialExecution: $ref: "#/components/schemas/SerialExecution" tagCondition: @@ -64772,8 +64808,14 @@ components: description: "Trigger a workflow on a schedule for an incident." properties: incidentType: - description: "The type of incident that triggers the workflow." + deprecated: true + description: "The type of incident that triggers the workflow. Deprecated. Use `incidentTypes` instead." type: string + incidentTypes: + description: "The types of incidents that trigger the workflow." + items: + type: string + type: array rrule: description: "The recurrence rule for the schedule, expressed as an iCalendar `RRULE` string." example: "DTSTART:20241220T151700Z\nRRULE:FREQ=MONTHLY" @@ -83346,6 +83388,8 @@ components: $ref: "#/components/schemas/MonitorNotificationRuleName" recipients: $ref: "#/components/schemas/MonitorNotificationRuleRecipients" + rule_options: + $ref: "#/components/schemas/MonitorNotificationRuleOptions" required: [name] type: object MonitorNotificationRuleBundleConfig: @@ -83486,6 +83530,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`. @@ -83563,6 +83618,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/incident_created_trigger.py b/src/datadog_api_client/v2/model/incident_created_trigger.py index 08af39828d..9d6fbd05e9 100644 --- a/src/datadog_api_client/v2/model/incident_created_trigger.py +++ b/src/datadog_api_client/v2/model/incident_created_trigger.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union, TYPE_CHECKING +from typing import List, Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, @@ -24,31 +24,39 @@ def openapi_types(_): return { "incident_type": (str,), + "incident_types": ([str],), "tag_condition": (IncidentCondition,), } attribute_map = { "incident_type": "incidentType", + "incident_types": "incidentTypes", "tag_condition": "tagCondition", } def __init__( self_, incident_type: Union[str, UnsetType] = unset, + incident_types: Union[List[str], UnsetType] = unset, tag_condition: Union[IncidentCondition, UnsetType] = unset, **kwargs, ): """ Trigger a workflow when an incident is declared. - :param incident_type: The type of incident that triggers the workflow. + :param incident_type: The type of incident that triggers the workflow. Deprecated. Use ``incidentTypes`` instead. **Deprecated**. :type incident_type: str, optional + :param incident_types: The types of incidents that trigger the workflow. + :type incident_types: [str], optional + :param tag_condition: Conditions that determine which incidents trigger the workflow. :type tag_condition: IncidentCondition, optional """ if incident_type is not unset: kwargs["incident_type"] = incident_type + if incident_types is not unset: + kwargs["incident_types"] = incident_types if tag_condition is not unset: kwargs["tag_condition"] = tag_condition super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/incident_impact_created_trigger.py b/src/datadog_api_client/v2/model/incident_impact_created_trigger.py index 1f8a8cce31..956f2ad2f2 100644 --- a/src/datadog_api_client/v2/model/incident_impact_created_trigger.py +++ b/src/datadog_api_client/v2/model/incident_impact_created_trigger.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union, TYPE_CHECKING +from typing import List, Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, @@ -27,12 +27,14 @@ def openapi_types(_): return { "execution_limit": (ExecutionLimit,), "incident_type": (str,), + "incident_types": ([str],), "tag_condition": (IncidentCondition,), } attribute_map = { "execution_limit": "executionLimit", "incident_type": "incidentType", + "incident_types": "incidentTypes", "tag_condition": "tagCondition", } @@ -40,6 +42,7 @@ def __init__( self_, execution_limit: Union[ExecutionLimit, UnsetType] = unset, incident_type: Union[str, UnsetType] = unset, + incident_types: Union[List[str], UnsetType] = unset, tag_condition: Union[IncidentCondition, UnsetType] = unset, **kwargs, ): @@ -49,9 +52,12 @@ def __init__( :param execution_limit: The maximum number of times to execute a workflow for an incident. :type execution_limit: ExecutionLimit, optional - :param incident_type: The type of incident that triggers the workflow. + :param incident_type: The type of incident that triggers the workflow. Deprecated. Use ``incidentTypes`` instead. **Deprecated**. :type incident_type: str, optional + :param incident_types: The types of incidents that trigger the workflow. + :type incident_types: [str], optional + :param tag_condition: Conditions that determine which incidents trigger the workflow. :type tag_condition: IncidentCondition, optional """ @@ -59,6 +65,8 @@ def __init__( kwargs["execution_limit"] = execution_limit if incident_type is not unset: kwargs["incident_type"] = incident_type + if incident_types is not unset: + kwargs["incident_types"] = incident_types if tag_condition is not unset: kwargs["tag_condition"] = tag_condition super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/incident_impact_updated_trigger.py b/src/datadog_api_client/v2/model/incident_impact_updated_trigger.py index 230a92129a..b470406515 100644 --- a/src/datadog_api_client/v2/model/incident_impact_updated_trigger.py +++ b/src/datadog_api_client/v2/model/incident_impact_updated_trigger.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union, TYPE_CHECKING +from typing import List, Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, @@ -27,12 +27,14 @@ def openapi_types(_): return { "execution_limit": (ExecutionLimit,), "incident_type": (str,), + "incident_types": ([str],), "tag_condition": (IncidentCondition,), } attribute_map = { "execution_limit": "executionLimit", "incident_type": "incidentType", + "incident_types": "incidentTypes", "tag_condition": "tagCondition", } @@ -40,6 +42,7 @@ def __init__( self_, execution_limit: Union[ExecutionLimit, UnsetType] = unset, incident_type: Union[str, UnsetType] = unset, + incident_types: Union[List[str], UnsetType] = unset, tag_condition: Union[IncidentCondition, UnsetType] = unset, **kwargs, ): @@ -49,9 +52,12 @@ def __init__( :param execution_limit: The maximum number of times to execute a workflow for an incident. :type execution_limit: ExecutionLimit, optional - :param incident_type: The type of incident that triggers the workflow. + :param incident_type: The type of incident that triggers the workflow. Deprecated. Use ``incidentTypes`` instead. **Deprecated**. :type incident_type: str, optional + :param incident_types: The types of incidents that trigger the workflow. + :type incident_types: [str], optional + :param tag_condition: Conditions that determine which incidents trigger the workflow. :type tag_condition: IncidentCondition, optional """ @@ -59,6 +65,8 @@ def __init__( kwargs["execution_limit"] = execution_limit if incident_type is not unset: kwargs["incident_type"] = incident_type + if incident_types is not unset: + kwargs["incident_types"] = incident_types if tag_condition is not unset: kwargs["tag_condition"] = tag_condition super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/incident_postmortem_updated_trigger.py b/src/datadog_api_client/v2/model/incident_postmortem_updated_trigger.py index 3de35b8a46..15a136fb8f 100644 --- a/src/datadog_api_client/v2/model/incident_postmortem_updated_trigger.py +++ b/src/datadog_api_client/v2/model/incident_postmortem_updated_trigger.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union, TYPE_CHECKING +from typing import List, Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, @@ -27,12 +27,14 @@ def openapi_types(_): return { "execution_limit": (ExecutionLimit,), "incident_type": (str,), + "incident_types": ([str],), "tag_condition": (IncidentCondition,), } attribute_map = { "execution_limit": "executionLimit", "incident_type": "incidentType", + "incident_types": "incidentTypes", "tag_condition": "tagCondition", } @@ -40,6 +42,7 @@ def __init__( self_, execution_limit: Union[ExecutionLimit, UnsetType] = unset, incident_type: Union[str, UnsetType] = unset, + incident_types: Union[List[str], UnsetType] = unset, tag_condition: Union[IncidentCondition, UnsetType] = unset, **kwargs, ): @@ -49,9 +52,12 @@ def __init__( :param execution_limit: The maximum number of times to execute a workflow for an incident. :type execution_limit: ExecutionLimit, optional - :param incident_type: The type of incident that triggers the workflow. + :param incident_type: The type of incident that triggers the workflow. Deprecated. Use ``incidentTypes`` instead. **Deprecated**. :type incident_type: str, optional + :param incident_types: The types of incidents that trigger the workflow. + :type incident_types: [str], optional + :param tag_condition: Conditions that determine which incidents trigger the workflow. :type tag_condition: IncidentCondition, optional """ @@ -59,6 +65,8 @@ def __init__( kwargs["execution_limit"] = execution_limit if incident_type is not unset: kwargs["incident_type"] = incident_type + if incident_types is not unset: + kwargs["incident_types"] = incident_types if tag_condition is not unset: kwargs["tag_condition"] = tag_condition super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/incident_responder_created_trigger.py b/src/datadog_api_client/v2/model/incident_responder_created_trigger.py index 3e9e7c8875..38fb7d4b06 100644 --- a/src/datadog_api_client/v2/model/incident_responder_created_trigger.py +++ b/src/datadog_api_client/v2/model/incident_responder_created_trigger.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union, TYPE_CHECKING +from typing import List, Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, @@ -27,12 +27,14 @@ def openapi_types(_): return { "execution_limit": (ExecutionLimit,), "incident_type": (str,), + "incident_types": ([str],), "tag_condition": (IncidentCondition,), } attribute_map = { "execution_limit": "executionLimit", "incident_type": "incidentType", + "incident_types": "incidentTypes", "tag_condition": "tagCondition", } @@ -40,6 +42,7 @@ def __init__( self_, execution_limit: Union[ExecutionLimit, UnsetType] = unset, incident_type: Union[str, UnsetType] = unset, + incident_types: Union[List[str], UnsetType] = unset, tag_condition: Union[IncidentCondition, UnsetType] = unset, **kwargs, ): @@ -49,9 +52,12 @@ def __init__( :param execution_limit: The maximum number of times to execute a workflow for an incident. :type execution_limit: ExecutionLimit, optional - :param incident_type: The type of incident that triggers the workflow. + :param incident_type: The type of incident that triggers the workflow. Deprecated. Use ``incidentTypes`` instead. **Deprecated**. :type incident_type: str, optional + :param incident_types: The types of incidents that trigger the workflow. + :type incident_types: [str], optional + :param tag_condition: Conditions that determine which incidents trigger the workflow. :type tag_condition: IncidentCondition, optional """ @@ -59,6 +65,8 @@ def __init__( kwargs["execution_limit"] = execution_limit if incident_type is not unset: kwargs["incident_type"] = incident_type + if incident_types is not unset: + kwargs["incident_types"] = incident_types if tag_condition is not unset: kwargs["tag_condition"] = tag_condition super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/incident_saved_trigger.py b/src/datadog_api_client/v2/model/incident_saved_trigger.py index c84d53b74a..709ce0b87b 100644 --- a/src/datadog_api_client/v2/model/incident_saved_trigger.py +++ b/src/datadog_api_client/v2/model/incident_saved_trigger.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union, TYPE_CHECKING +from typing import List, Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, @@ -29,6 +29,7 @@ def openapi_types(_): return { "execution_limit": (ExecutionLimit,), "incident_type": (str,), + "incident_types": ([str],), "serial_execution": (SerialExecution,), "tag_condition": (IncidentCondition,), } @@ -36,6 +37,7 @@ def openapi_types(_): attribute_map = { "execution_limit": "executionLimit", "incident_type": "incidentType", + "incident_types": "incidentTypes", "serial_execution": "serialExecution", "tag_condition": "tagCondition", } @@ -44,6 +46,7 @@ def __init__( self_, execution_limit: Union[ExecutionLimit, UnsetType] = unset, incident_type: Union[str, UnsetType] = unset, + incident_types: Union[List[str], UnsetType] = unset, serial_execution: Union[SerialExecution, UnsetType] = unset, tag_condition: Union[IncidentCondition, UnsetType] = unset, **kwargs, @@ -54,9 +57,12 @@ def __init__( :param execution_limit: The maximum number of times to execute a workflow for an incident. :type execution_limit: ExecutionLimit, optional - :param incident_type: The type of incident that triggers the workflow. + :param incident_type: The type of incident that triggers the workflow. Deprecated. Use ``incidentTypes`` instead. **Deprecated**. :type incident_type: str, optional + :param incident_types: The types of incidents that trigger the workflow. + :type incident_types: [str], optional + :param serial_execution: Whether to execute the workflow serially for an incident. :type serial_execution: SerialExecution, optional @@ -67,6 +73,8 @@ def __init__( kwargs["execution_limit"] = execution_limit if incident_type is not unset: kwargs["incident_type"] = incident_type + if incident_types is not unset: + kwargs["incident_types"] = incident_types if serial_execution is not unset: kwargs["serial_execution"] = serial_execution if tag_condition is not unset: diff --git a/src/datadog_api_client/v2/model/incident_schedule_trigger.py b/src/datadog_api_client/v2/model/incident_schedule_trigger.py index d50820ce1c..0afdf585f0 100644 --- a/src/datadog_api_client/v2/model/incident_schedule_trigger.py +++ b/src/datadog_api_client/v2/model/incident_schedule_trigger.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union, TYPE_CHECKING +from typing import List, Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, @@ -30,12 +30,14 @@ def openapi_types(_): return { "incident_type": (str,), + "incident_types": ([str],), "rrule": (str,), "tag_condition": (IncidentCondition,), } attribute_map = { "incident_type": "incidentType", + "incident_types": "incidentTypes", "rrule": "rrule", "tag_condition": "tagCondition", } @@ -44,15 +46,19 @@ def __init__( self_, rrule: str, incident_type: Union[str, UnsetType] = unset, + incident_types: Union[List[str], UnsetType] = unset, tag_condition: Union[IncidentCondition, UnsetType] = unset, **kwargs, ): """ Trigger a workflow on a schedule for an incident. - :param incident_type: The type of incident that triggers the workflow. + :param incident_type: The type of incident that triggers the workflow. Deprecated. Use ``incidentTypes`` instead. **Deprecated**. :type incident_type: str, optional + :param incident_types: The types of incidents that trigger the workflow. + :type incident_types: [str], optional + :param rrule: The recurrence rule for the schedule, expressed as an iCalendar ``RRULE`` string. :type rrule: str @@ -61,6 +67,8 @@ def __init__( """ if incident_type is not unset: kwargs["incident_type"] = incident_type + if incident_types is not unset: + kwargs["incident_types"] = incident_types if tag_condition is not unset: kwargs["tag_condition"] = tag_condition super().__init__(kwargs) 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 3f5d5a1ed7..8df9eafce9 100644 --- a/tests/generated-test/test-runner-data/manifest.json +++ b/tests/generated-test/test-runner-data/manifest.json @@ -8414,6 +8414,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", @@ -8596,6 +8603,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