diff --git a/.apigentools-info b/.apigentools-info index 6d40b26ab5..a9d4322f75 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-04 12:51:42.024933", - "spec_repo_commit": "35a63137" + "regenerated": "2025-06-04 17:40:37.993718", + "spec_repo_commit": "38b3c05a" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-04 12:51:42.039930", - "spec_repo_commit": "35a63137" + "regenerated": "2025-06-04 17:40:38.008535", + "spec_repo_commit": "38b3c05a" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 0b645d2008..3fe10ea7b6 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -6742,6 +6742,8 @@ components: nullable: true readOnly: true type: string + draft_status: + $ref: '#/components/schemas/MonitorDraftStatus' id: description: ID of this monitor. format: int64 @@ -6834,6 +6836,28 @@ components: - FIREFOX_LAPTOP_LARGE - FIREFOX_TABLET - FIREFOX_MOBILE_SMALL + MonitorDraftStatus: + default: published + description: 'Indicates whether the monitor is in a draft or published state. + + + `draft`: The monitor appears as Draft and does not send notifications. + + `published`: The monitor is active and evaluates conditions and notify as + configured. + + + This field is in preview. The draft value is only available to customers with + the feature enabled. + + ' + enum: + - draft + - published + type: string + x-enum-varnames: + - DRAFT + - PUBLISHED MonitorFormulaAndFunctionCostAggregator: description: Aggregation methods for metric queries. enum: @@ -7917,6 +7941,8 @@ components: nullable: true readOnly: true type: string + draft_status: + $ref: '#/components/schemas/MonitorDraftStatus' id: description: ID of this monitor. format: int64 diff --git a/docs/datadog_api_client.v1.model.rst b/docs/datadog_api_client.v1.model.rst index 5db4805c68..db5da66b6f 100644 --- a/docs/datadog_api_client.v1.model.rst +++ b/docs/datadog_api_client.v1.model.rst @@ -2041,6 +2041,13 @@ datadog\_api\_client.v1.model.monitor\_device\_id module :members: :show-inheritance: +datadog\_api\_client.v1.model.monitor\_draft\_status module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.monitor_draft_status + :members: + :show-inheritance: + datadog\_api\_client.v1.model.monitor\_formula\_and\_function\_cost\_aggregator module -------------------------------------------------------------------------------------- diff --git a/examples/v1/monitors/CreateMonitor_1539578087.py b/examples/v1/monitors/CreateMonitor_1539578087.py index 9b453aa823..fabf1fe1f9 100644 --- a/examples/v1/monitors/CreateMonitor_1539578087.py +++ b/examples/v1/monitors/CreateMonitor_1539578087.py @@ -5,6 +5,7 @@ from datadog_api_client import ApiClient, Configuration from datadog_api_client.v1.api.monitors_api import MonitorsApi from datadog_api_client.v1.model.monitor import Monitor +from datadog_api_client.v1.model.monitor_draft_status import MonitorDraftStatus from datadog_api_client.v1.model.monitor_options import MonitorOptions from datadog_api_client.v1.model.monitor_options_custom_schedule import MonitorOptionsCustomSchedule from datadog_api_client.v1.model.monitor_options_custom_schedule_recurrence import ( @@ -45,6 +46,7 @@ ), ), type=MonitorType.QUERY_ALERT, + draft_status=MonitorDraftStatus.PUBLISHED, ) configuration = Configuration() diff --git a/examples/v1/monitors/CreateMonitor_440013737.py b/examples/v1/monitors/CreateMonitor_440013737.py index 5b4144a309..2627686ab0 100644 --- a/examples/v1/monitors/CreateMonitor_440013737.py +++ b/examples/v1/monitors/CreateMonitor_440013737.py @@ -5,6 +5,7 @@ from datadog_api_client import ApiClient, Configuration from datadog_api_client.v1.api.monitors_api import MonitorsApi from datadog_api_client.v1.model.monitor import Monitor +from datadog_api_client.v1.model.monitor_draft_status import MonitorDraftStatus from datadog_api_client.v1.model.monitor_options import MonitorOptions from datadog_api_client.v1.model.monitor_thresholds import MonitorThresholds from datadog_api_client.v1.model.monitor_type import MonitorType @@ -24,6 +25,7 @@ critical=1.0, ), ), + draft_status=MonitorDraftStatus.DRAFT, ) configuration = Configuration() diff --git a/src/datadog_api_client/v1/model/monitor.py b/src/datadog_api_client/v1/model/monitor.py index 07bc45f932..ca835aaf03 100644 --- a/src/datadog_api_client/v1/model/monitor.py +++ b/src/datadog_api_client/v1/model/monitor.py @@ -17,6 +17,7 @@ if TYPE_CHECKING: from datadog_api_client.v1.model.creator import Creator + from datadog_api_client.v1.model.monitor_draft_status import MonitorDraftStatus from datadog_api_client.v1.model.matching_downtime import MatchingDowntime from datadog_api_client.v1.model.monitor_options import MonitorOptions from datadog_api_client.v1.model.monitor_overall_states import MonitorOverallStates @@ -28,6 +29,7 @@ class Monitor(ModelNormal): @cached_property def openapi_types(_): from datadog_api_client.v1.model.creator import Creator + from datadog_api_client.v1.model.monitor_draft_status import MonitorDraftStatus from datadog_api_client.v1.model.matching_downtime import MatchingDowntime from datadog_api_client.v1.model.monitor_options import MonitorOptions from datadog_api_client.v1.model.monitor_overall_states import MonitorOverallStates @@ -38,6 +40,7 @@ def openapi_types(_): "created": (datetime,), "creator": (Creator,), "deleted": (datetime, none_type), + "draft_status": (MonitorDraftStatus,), "id": (int,), "matching_downtimes": ([MatchingDowntime],), "message": (str,), @@ -58,6 +61,7 @@ def openapi_types(_): "created": "created", "creator": "creator", "deleted": "deleted", + "draft_status": "draft_status", "id": "id", "matching_downtimes": "matching_downtimes", "message": "message", @@ -91,6 +95,7 @@ def __init__( created: Union[datetime, UnsetType] = unset, creator: Union[Creator, UnsetType] = unset, deleted: Union[datetime, none_type, UnsetType] = unset, + draft_status: Union[MonitorDraftStatus, UnsetType] = unset, id: Union[int, UnsetType] = unset, matching_downtimes: Union[List[MatchingDowntime], UnsetType] = unset, message: Union[str, UnsetType] = unset, @@ -117,6 +122,14 @@ def __init__( :param deleted: Whether or not the monitor is deleted. (Always ``null`` ) :type deleted: datetime, none_type, optional + :param draft_status: Indicates whether the monitor is in a draft or published state. + + ``draft`` : The monitor appears as Draft and does not send notifications. + ``published`` : The monitor is active and evaluates conditions and notify as configured. + + This field is in preview. The draft value is only available to customers with the feature enabled. + :type draft_status: MonitorDraftStatus, optional + :param id: ID of this monitor. :type id: int, optional @@ -165,6 +178,8 @@ def __init__( kwargs["creator"] = creator if deleted is not unset: kwargs["deleted"] = deleted + if draft_status is not unset: + kwargs["draft_status"] = draft_status if id is not unset: kwargs["id"] = id if matching_downtimes is not unset: diff --git a/src/datadog_api_client/v1/model/monitor_draft_status.py b/src/datadog_api_client/v1/model/monitor_draft_status.py new file mode 100644 index 0000000000..81adf89e9d --- /dev/null +++ b/src/datadog_api_client/v1/model/monitor_draft_status.py @@ -0,0 +1,44 @@ +# 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 ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class MonitorDraftStatus(ModelSimple): + """ + Indicates whether the monitor is in a draft or published state. + + `draft`: The monitor appears as Draft and does not send notifications. + `published`: The monitor is active and evaluates conditions and notify as configured. + + This field is in preview. The draft value is only available to customers with the feature enabled. + + + :param value: If omitted defaults to "published". Must be one of ["draft", "published"]. + :type value: str + """ + + allowed_values = { + "draft", + "published", + } + DRAFT: ClassVar["MonitorDraftStatus"] + PUBLISHED: ClassVar["MonitorDraftStatus"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +MonitorDraftStatus.DRAFT = MonitorDraftStatus("draft") +MonitorDraftStatus.PUBLISHED = MonitorDraftStatus("published") diff --git a/src/datadog_api_client/v1/model/monitor_update_request.py b/src/datadog_api_client/v1/model/monitor_update_request.py index f343623eb3..59a99f7cd5 100644 --- a/src/datadog_api_client/v1/model/monitor_update_request.py +++ b/src/datadog_api_client/v1/model/monitor_update_request.py @@ -17,6 +17,7 @@ if TYPE_CHECKING: from datadog_api_client.v1.model.creator import Creator + from datadog_api_client.v1.model.monitor_draft_status import MonitorDraftStatus from datadog_api_client.v1.model.monitor_options import MonitorOptions from datadog_api_client.v1.model.monitor_overall_states import MonitorOverallStates from datadog_api_client.v1.model.monitor_state import MonitorState @@ -27,6 +28,7 @@ class MonitorUpdateRequest(ModelNormal): @cached_property def openapi_types(_): from datadog_api_client.v1.model.creator import Creator + from datadog_api_client.v1.model.monitor_draft_status import MonitorDraftStatus from datadog_api_client.v1.model.monitor_options import MonitorOptions from datadog_api_client.v1.model.monitor_overall_states import MonitorOverallStates from datadog_api_client.v1.model.monitor_state import MonitorState @@ -36,6 +38,7 @@ def openapi_types(_): "created": (datetime,), "creator": (Creator,), "deleted": (datetime, none_type), + "draft_status": (MonitorDraftStatus,), "id": (int,), "message": (str,), "modified": (datetime,), @@ -55,6 +58,7 @@ def openapi_types(_): "created": "created", "creator": "creator", "deleted": "deleted", + "draft_status": "draft_status", "id": "id", "message": "message", "modified": "modified", @@ -85,6 +89,7 @@ def __init__( created: Union[datetime, UnsetType] = unset, creator: Union[Creator, UnsetType] = unset, deleted: Union[datetime, none_type, UnsetType] = unset, + draft_status: Union[MonitorDraftStatus, UnsetType] = unset, id: Union[int, UnsetType] = unset, message: Union[str, UnsetType] = unset, modified: Union[datetime, UnsetType] = unset, @@ -112,6 +117,14 @@ def __init__( :param deleted: Whether or not the monitor is deleted. (Always ``null`` ) :type deleted: datetime, none_type, optional + :param draft_status: Indicates whether the monitor is in a draft or published state. + + ``draft`` : The monitor appears as Draft and does not send notifications. + ``published`` : The monitor is active and evaluates conditions and notify as configured. + + This field is in preview. The draft value is only available to customers with the feature enabled. + :type draft_status: MonitorDraftStatus, optional + :param id: ID of this monitor. :type id: int, optional @@ -157,6 +170,8 @@ def __init__( kwargs["creator"] = creator if deleted is not unset: kwargs["deleted"] = deleted + if draft_status is not unset: + kwargs["draft_status"] = draft_status if id is not unset: kwargs["id"] = id if message is not unset: diff --git a/src/datadog_api_client/v1/models/__init__.py b/src/datadog_api_client/v1/models/__init__.py index 406420f9bc..fd2e7bf6f1 100644 --- a/src/datadog_api_client/v1/models/__init__.py +++ b/src/datadog_api_client/v1/models/__init__.py @@ -323,6 +323,7 @@ from datadog_api_client.v1.model.metrics_query_unit import MetricsQueryUnit from datadog_api_client.v1.model.monitor import Monitor from datadog_api_client.v1.model.monitor_device_id import MonitorDeviceID +from datadog_api_client.v1.model.monitor_draft_status import MonitorDraftStatus from datadog_api_client.v1.model.monitor_formula_and_function_cost_aggregator import ( MonitorFormulaAndFunctionCostAggregator, ) @@ -1376,6 +1377,7 @@ "MetricsQueryUnit", "Monitor", "MonitorDeviceID", + "MonitorDraftStatus", "MonitorFormulaAndFunctionCostAggregator", "MonitorFormulaAndFunctionCostDataSource", "MonitorFormulaAndFunctionCostQueryDefinition", diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_metric_monitor_with_a_custom_schedule_returns_ok_response.frozen b/tests/v1/cassettes/test_scenarios/test_create_a_metric_monitor_with_a_custom_schedule_returns_ok_response.frozen index e1193224e9..21dcdb2e61 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_metric_monitor_with_a_custom_schedule_returns_ok_response.frozen +++ b/tests/v1/cassettes/test_scenarios/test_create_a_metric_monitor_with_a_custom_schedule_returns_ok_response.frozen @@ -1 +1 @@ -2023-11-09T17:58:50.774Z \ No newline at end of file +2025-05-14T22:28:29.992Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_metric_monitor_with_a_custom_schedule_returns_ok_response.yaml b/tests/v1/cassettes/test_scenarios/test_create_a_metric_monitor_with_a_custom_schedule_returns_ok_response.yaml index e3544681e3..e4058bfe49 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_metric_monitor_with_a_custom_schedule_returns_ok_response.yaml +++ b/tests/v1/cassettes/test_scenarios/test_create_a_metric_monitor_with_a_custom_schedule_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"message":"some message Notify: @hipchat-channel","name":"Test-Create_a_metric_monitor_with_a_custom_schedule_returns_OK_response-1699552730","options":{"include_tags":false,"notify_audit":false,"scheduling_options":{"custom_schedule":{"recurrences":[{"rrule":"FREQ=DAILY;INTERVAL=1","start":"2024-10-26T09:13:00","timezone":"America/Los_Angeles"}]},"evaluation_window":{"day_starts":"04:00","month_starts":1}},"thresholds":{"critical":0.5}},"query":"avg(current_1mo):avg:system.load.5{*} + body: '{"draft_status":"published","message":"some message Notify: @hipchat-channel","name":"Test-Create_a_metric_monitor_with_a_custom_schedule_returns_OK_response-1747261709","options":{"include_tags":false,"notify_audit":false,"scheduling_options":{"custom_schedule":{"recurrences":[{"rrule":"FREQ=DAILY;INTERVAL=1","start":"2024-10-26T09:13:00","timezone":"America/Los_Angeles"}]},"evaluation_window":{"day_starts":"04:00","month_starts":1}},"thresholds":{"critical":0.5}},"query":"avg(current_1mo):avg:system.load.5{*} > 0.5","tags":[],"type":"query alert"}' headers: accept: @@ -11,10 +11,10 @@ interactions: uri: https://api.datadoghq.com/api/v1/monitor response: body: - string: '{"id":134549556,"org_id":321813,"type":"query alert","name":"Test-Create_a_metric_monitor_with_a_custom_schedule_returns_OK_response-1699552730","message":"some + string: '{"id":172140210,"org_id":2,"type":"query alert","name":"Test-Create_a_metric_monitor_with_a_custom_schedule_returns_OK_response-1747261709","message":"some message Notify: @hipchat-channel","tags":[],"query":"avg(current_1mo):avg:system.load.5{*} - > 0.5","options":{"include_tags":false,"notify_audit":false,"scheduling_options":{"custom_schedule":{"recurrences":[{"rrule":"FREQ=DAILY;INTERVAL=1","start":"2024-10-26T09:13:00","timezone":"America/Los_Angeles"}]},"evaluation_window":{"day_starts":"04:00","month_starts":1}},"thresholds":{"critical":0.5},"new_host_delay":300,"silenced":{}},"multi":false,"created_at":1699552731000,"created":"2023-11-09T17:58:51.118858+00:00","modified":"2023-11-09T17:58:51.118858+00:00","deleted":null,"restricted_roles":null,"priority":null,"overall_state_modified":null,"overall_state":"No - Data","creator":{"name":"CI Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com","id":2320499}} + > 0.5","options":{"include_tags":false,"notify_audit":false,"scheduling_options":{"custom_schedule":{"recurrences":[{"rrule":"FREQ=DAILY;INTERVAL=1","start":"2024-10-26T09:13:00","timezone":"America/Los_Angeles"}]},"evaluation_window":{"day_starts":"04:00","month_starts":1}},"thresholds":{"critical":0.5},"new_host_delay":300,"silenced":{},"avalanche_window":20},"multi":false,"created_at":1747261710000,"created":"2025-05-14T22:28:30.512529+00:00","modified":"2025-05-14T22:28:30.512529+00:00","deleted":null,"priority":null,"draft_status":"published","restricted_roles":null,"restriction_policy":null,"overall_state_modified":null,"overall_state":"No + Data","creator":{"name":"Carl Martensen","handle":"carl.martensen@datadoghq.com","email":"carl.martensen@datadoghq.com","id":638339},"run_as":null,"restricted":true} ' headers: @@ -29,10 +29,10 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/monitor/134549556 + uri: https://api.datadoghq.com/api/v1/monitor/172140210 response: body: - string: '{"deleted_monitor_id":134549556} + string: '{"deleted_monitor_id":172140210} ' headers: diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_rum_formula_and_functions_monitor_returns_ok_response.frozen b/tests/v1/cassettes/test_scenarios/test_create_a_rum_formula_and_functions_monitor_returns_ok_response.frozen index 4c68f2b4bd..7cc11a34ab 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_rum_formula_and_functions_monitor_returns_ok_response.frozen +++ b/tests/v1/cassettes/test_scenarios/test_create_a_rum_formula_and_functions_monitor_returns_ok_response.frozen @@ -1 +1 @@ -2022-02-02T21:04:10.597Z \ No newline at end of file +2025-05-14T22:27:13.829Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_rum_formula_and_functions_monitor_returns_ok_response.yaml b/tests/v1/cassettes/test_scenarios/test_create_a_rum_formula_and_functions_monitor_returns_ok_response.yaml index be6a2dd3fd..bc142792e7 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_rum_formula_and_functions_monitor_returns_ok_response.yaml +++ b/tests/v1/cassettes/test_scenarios/test_create_a_rum_formula_and_functions_monitor_returns_ok_response.yaml @@ -1,7 +1,7 @@ interactions: - request: - body: '{"message":"some message Notify: @hipchat-channel","name":"Test-Create_a_RUM_formula_and_functions_monitor_returns_OK_response-1643835850","options":{"thresholds":{"critical":0.8},"variables":[{"compute":{"aggregation":"count"},"data_source":"rum","group_by":[],"indexes":["*"],"name":"query2","search":{"query":""}},{"compute":{"aggregation":"count"},"data_source":"rum","group_by":[],"indexes":["*"],"name":"query1","search":{"query":"status:error"}}]},"priority":3,"query":"formula(\"query2 - / query1 * 100\").last(\"15m\") >= 0.8","tags":["test:testcreatearumformulaandfunctionsmonitorreturnsokresponse1643835850","env:ci"],"type":"rum + body: '{"message":"some message Notify: @hipchat-channel","name":"Test-Create_a_RUM_formula_and_functions_monitor_returns_OK_response-1747261633","options":{"thresholds":{"critical":0.8},"variables":[{"compute":{"aggregation":"count"},"data_source":"rum","group_by":[],"indexes":["*"],"name":"query2","search":{"query":""}},{"compute":{"aggregation":"count"},"data_source":"rum","group_by":[],"indexes":["*"],"name":"query1","search":{"query":"status:error"}}]},"priority":3,"query":"formula(\"query2 + / query1 * 100\").last(\"15m\") >= 0.8","tags":["test:testcreatearumformulaandfunctionsmonitorreturnsokresponse1747261633","env:ci"],"type":"rum alert"}' headers: accept: @@ -12,9 +12,12 @@ interactions: uri: https://api.datadoghq.com/api/v1/monitor response: body: - string: '{"restricted_roles":null,"tags":["test:testcreatearumformulaandfunctionsmonitorreturnsokresponse1643835850","env:ci"],"deleted":null,"query":"formula(\"query2 - / query1 * 100\").last(\"15m\") >= 0.8","message":"some message Notify: @hipchat-channel","id":62683819,"multi":false,"name":"Test-Create_a_RUM_formula_and_functions_monitor_returns_OK_response-1643835850","created":"2022-02-02T21:04:10.947341+00:00","created_at":1643835850000,"creator":{"id":1445416,"handle":"frog@datadoghq.com","name":null,"email":"frog@datadoghq.com"},"org_id":321813,"modified":"2022-02-02T21:04:10.947341+00:00","priority":3,"overall_state_modified":null,"overall_state":"No - Data","type":"rum alert","options":{"notify_audit":false,"locked":false,"silenced":{},"include_tags":true,"thresholds":{"critical":0.8},"new_host_delay":300,"notify_no_data":false,"groupby_simple_monitor":false,"variables":[{"search":{"query":""},"data_source":"rum","compute":{"aggregation":"count"},"name":"query2","indexes":["*"],"group_by":[]},{"search":{"query":"status:error"},"data_source":"rum","compute":{"aggregation":"count"},"name":"query1","indexes":["*"],"group_by":[]}]}}' + string: '{"id":172140181,"org_id":2,"type":"rum alert","name":"Test-Create_a_RUM_formula_and_functions_monitor_returns_OK_response-1747261633","message":"some + message Notify: @hipchat-channel","tags":["test:testcreatearumformulaandfunctionsmonitorreturnsokresponse1747261633","env:ci"],"query":"formula(\"query2 + / query1 * 100\").last(\"15m\") >= 0.8","options":{"thresholds":{"critical":0.8},"variables":[{"compute":{"aggregation":"count"},"data_source":"rum","group_by":[],"indexes":["*"],"name":"query2","search":{"query":""}},{"compute":{"aggregation":"count"},"data_source":"rum","group_by":[],"indexes":["*"],"name":"query1","search":{"query":"status:error"}}],"notify_no_data":false,"notify_audit":false,"new_host_delay":300,"include_tags":true,"groupby_simple_monitor":false,"silenced":{},"avalanche_window":20},"multi":false,"created_at":1747261634000,"created":"2025-05-14T22:27:14.329045+00:00","modified":"2025-05-14T22:27:14.329045+00:00","deleted":null,"priority":3,"draft_status":"published","restricted_roles":null,"restriction_policy":null,"overall_state_modified":null,"overall_state":"No + Data","creator":{"name":"Carl Martensen","handle":"carl.martensen@datadoghq.com","email":"carl.martensen@datadoghq.com","id":638339},"run_as":null,"restricted":true} + + ' headers: content-type: - application/json @@ -27,10 +30,12 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/monitor/62683819 + uri: https://api.datadoghq.com/api/v1/monitor/172140181 response: body: - string: '{"deleted_monitor_id":62683819}' + string: '{"deleted_monitor_id":172140181} + + ' headers: content-type: - application/json diff --git a/tests/v1/cassettes/test_scenarios/test_create_an_error_tracking_monitor_returns_ok_response.frozen b/tests/v1/cassettes/test_scenarios/test_create_an_error_tracking_monitor_returns_ok_response.frozen index 898f3e81d8..b669011559 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_an_error_tracking_monitor_returns_ok_response.frozen +++ b/tests/v1/cassettes/test_scenarios/test_create_an_error_tracking_monitor_returns_ok_response.frozen @@ -1 +1 @@ -2022-03-17T20:05:01.132Z \ No newline at end of file +2025-05-14T22:17:22.560Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_an_error_tracking_monitor_returns_ok_response.yaml b/tests/v1/cassettes/test_scenarios/test_create_an_error_tracking_monitor_returns_ok_response.yaml index 63d0275a1a..9acaf8466e 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_an_error_tracking_monitor_returns_ok_response.yaml +++ b/tests/v1/cassettes/test_scenarios/test_create_an_error_tracking_monitor_returns_ok_response.yaml @@ -1,8 +1,8 @@ interactions: - request: - body: '{"message":"some message","name":"Test-Create_an_Error_Tracking_monitor_returns_OK_response-1647547501","options":{"thresholds":{"critical":1}},"priority":3,"query":"error-tracking-rum(\"service:foo + body: '{"draft_status":"draft","message":"some message","name":"Test-Create_an_Error_Tracking_monitor_returns_OK_response-1747261042","options":{"thresholds":{"critical":1}},"priority":3,"query":"error-tracking-rum(\"service:foo AND @error.source:source\").rollup(\"count\").by(\"@issue.id\").last(\"1h\") - >= 1","tags":["test:testcreateanerrortrackingmonitorreturnsokresponse1647547501","env:ci"],"type":"error-tracking + >= 1","tags":["test:testcreateanerrortrackingmonitorreturnsokresponse1747261042","env:ci"],"type":"error-tracking alert"}' headers: accept: @@ -13,10 +13,13 @@ interactions: uri: https://api.datadoghq.com/api/v1/monitor response: body: - string: '{"restricted_roles":null,"tags":["test:testcreateanerrortrackingmonitorreturnsokresponse1647547501","env:ci"],"deleted":null,"query":"error-tracking-rum(\"service:foo + string: '{"id":172139812,"org_id":2,"type":"error-tracking alert","name":"Test-Create_an_Error_Tracking_monitor_returns_OK_response-1747261042","message":"some + message","tags":["test:testcreateanerrortrackingmonitorreturnsokresponse1747261042","env:ci"],"query":"error-tracking-rum(\"service:foo AND @error.source:source\").rollup(\"count\").by(\"@issue.id\").last(\"1h\") - >= 1","message":"some message","id":66239295,"multi":true,"name":"Test-Create_an_Error_Tracking_monitor_returns_OK_response-1647547501","created":"2022-03-17T20:05:01.603951+00:00","created_at":1647547501000,"creator":{"id":1445416,"handle":"frog@datadoghq.com","name":null,"email":"frog@datadoghq.com"},"org_id":321813,"modified":"2022-03-17T20:05:01.603951+00:00","priority":3,"overall_state_modified":null,"overall_state":"No - Data","type":"error-tracking alert","options":{"notify_audit":false,"silenced":{},"include_tags":true,"thresholds":{"critical":1.0},"new_host_delay":300,"notify_no_data":false,"groupby_simple_monitor":false}}' + >= 1","options":{"thresholds":{"critical":1.0},"notify_no_data":false,"notify_audit":false,"new_host_delay":300,"include_tags":true,"groupby_simple_monitor":false,"silenced":{},"avalanche_window":20},"multi":true,"created_at":1747261042000,"created":"2025-05-14T22:17:22.989000+00:00","modified":"2025-05-14T22:17:22.989000+00:00","deleted":null,"priority":3,"draft_status":"draft","restricted_roles":null,"restriction_policy":null,"overall_state_modified":null,"overall_state":"No + Data","creator":{"name":"Carl Martensen","handle":"carl.martensen@datadoghq.com","email":"carl.martensen@datadoghq.com","id":638339},"run_as":null,"restricted":true} + + ' headers: content-type: - application/json @@ -29,10 +32,12 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/monitor/66239295 + uri: https://api.datadoghq.com/api/v1/monitor/172139812 response: body: - string: '{"deleted_monitor_id":66239295}' + string: '{"deleted_monitor_id":172139812} + + ' headers: content-type: - application/json diff --git a/tests/v1/features/monitor_error_tracking_alert_payload.json b/tests/v1/features/monitor_error_tracking_alert_payload.json index e4ddca19e1..b7922abcd8 100644 --- a/tests/v1/features/monitor_error_tracking_alert_payload.json +++ b/tests/v1/features/monitor_error_tracking_alert_payload.json @@ -5,5 +5,6 @@ "message": "some message", "tags": ["test:{{ unique_lower_alnum }}", "env:ci"], "priority": 3, - "options": { "thresholds": { "critical": 1 } } + "options": { "thresholds": { "critical": 1 } }, + "draft_status": "draft" } diff --git a/tests/v1/features/monitors.feature b/tests/v1/features/monitors.feature index 9bbc6531fa..64e72f698b 100644 --- a/tests/v1/features/monitors.feature +++ b/tests/v1/features/monitors.feature @@ -50,6 +50,7 @@ Feature: Monitors Then the response status is 200 OK And the response "name" is equal to "{{ unique }}" And the response "type" is equal to "rum alert" + And the response "draft_status" is equal to "published" @team:DataDog/monitor-app Scenario: Create a ci-pipelines formula and functions monitor returns "OK" response @@ -103,10 +104,11 @@ Feature: Monitors @team:DataDog/monitor-app Scenario: Create a metric monitor with a custom schedule returns "OK" response Given new "CreateMonitor" request - And body with value {"message":"some message Notify: @hipchat-channel","name":"{{ unique }}","query":"avg(current_1mo):avg:system.load.5{*} > 0.5","tags":[],"options":{"thresholds":{"critical":0.5},"notify_audit":false,"include_tags":false,"scheduling_options":{"evaluation_window":{"day_starts":"04:00", "month_starts":1},"custom_schedule":{"recurrences":[{"rrule":"FREQ=DAILY;INTERVAL=1","timezone":"America/Los_Angeles","start":"2024-10-26T09:13:00"}]}}},"type":"query alert"} + And body with value {"message":"some message Notify: @hipchat-channel","name":"{{ unique }}","query":"avg(current_1mo):avg:system.load.5{*} > 0.5","tags":[],"options":{"thresholds":{"critical":0.5},"notify_audit":false,"include_tags":false,"scheduling_options":{"evaluation_window":{"day_starts":"04:00", "month_starts":1},"custom_schedule":{"recurrences":[{"rrule":"FREQ=DAILY;INTERVAL=1","timezone":"America/Los_Angeles","start":"2024-10-26T09:13:00"}]}}},"type":"query alert", "draft_status": "published"} When the request is sent Then the response status is 200 OK And the response "name" is equal to "{{ unique }}" + And the response "draft_status" is equal to "published" And the response "options.scheduling_options.custom_schedule.recurrences[0].rrule" is equal to "FREQ=DAILY;INTERVAL=1" And the response "options.scheduling_options.custom_schedule.recurrences[0].start" is equal to "2024-10-26T09:13:00" And the response "options.scheduling_options.custom_schedule.recurrences[0].timezone" is equal to "America/Los_Angeles" @@ -138,6 +140,7 @@ Feature: Monitors And the response "name" is equal to "{{ unique }}" And the response "type" is equal to "error-tracking alert" And the response "query" is equal to "error-tracking-rum(\"service:foo AND @error.source:source\").rollup(\"count\").by(\"@issue.id\").last(\"1h\") >= 1" + And the response "draft_status" is equal to "draft" @generated @skip @team:DataDog/monitor-app Scenario: Delete a monitor returns "Bad Request" response @@ -166,7 +169,7 @@ Feature: Monitors Scenario: Edit a monitor returns "Bad Request" response Given new "UpdateMonitor" request And request contains "monitor_id" parameter from "REPLACE.ME" - And body with value {"options": {"evaluation_delay": null, "include_tags": true, "min_failure_duration": 0, "min_location_failed": 1, "new_group_delay": null, "new_host_delay": 300, "no_data_timeframe": null, "notification_preset_name": "show_all", "notify_audit": false, "notify_by": [], "on_missing_data": "default", "renotify_interval": null, "renotify_occurrences": null, "renotify_statuses": ["alert"], "scheduling_options": {"custom_schedule": {"recurrences": [{"rrule": "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR", "start": "2023-08-31T16:30:00", "timezone": "Europe/Paris"}]}, "evaluation_window": {"day_starts": "04:00", "hour_starts": 0, "month_starts": 1, "timezone": "Europe/Paris"}}, "synthetics_check_id": null, "threshold_windows": {"recovery_window": null, "trigger_window": null}, "thresholds": {"critical_recovery": null, "ok": null, "unknown": null, "warning": null, "warning_recovery": null}, "timeout_h": null, "variables": [{"compute": {"aggregation": "avg", "interval": 60000, "metric": "@duration"}, "data_source": "rum", "group_by": [{"facet": "status", "limit": 10, "sort": {"aggregation": "avg", "order": "desc"}}], "indexes": ["days-3", "days-7"], "name": "query_errors", "search": {"query": "service:query"}}]}, "priority": null, "restricted_roles": [], "tags": [], "type": "query alert"} + And body with value {"draft_status": "published", "options": {"evaluation_delay": null, "include_tags": true, "min_failure_duration": 0, "min_location_failed": 1, "new_group_delay": null, "new_host_delay": 300, "no_data_timeframe": null, "notification_preset_name": "show_all", "notify_audit": false, "notify_by": [], "on_missing_data": "default", "renotify_interval": null, "renotify_occurrences": null, "renotify_statuses": ["alert"], "scheduling_options": {"custom_schedule": {"recurrences": [{"rrule": "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR", "start": "2023-08-31T16:30:00", "timezone": "Europe/Paris"}]}, "evaluation_window": {"day_starts": "04:00", "hour_starts": 0, "month_starts": 1, "timezone": "Europe/Paris"}}, "synthetics_check_id": null, "threshold_windows": {"recovery_window": null, "trigger_window": null}, "thresholds": {"critical_recovery": null, "ok": null, "unknown": null, "warning": null, "warning_recovery": null}, "timeout_h": null, "variables": [{"compute": {"aggregation": "avg", "interval": 60000, "metric": "@duration"}, "data_source": "rum", "group_by": [{"facet": "status", "limit": 10, "sort": {"aggregation": "avg", "order": "desc"}}], "indexes": ["days-3", "days-7"], "name": "query_errors", "search": {"query": "service:query"}}]}, "priority": null, "restricted_roles": [], "tags": [], "type": "query alert"} When the request is sent Then the response status is 400 Bad Request