Skip to content

Commit 08bae7f

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
and
ci.datadog-api-spec
authored
Add monitor draft status field (#2566)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 082dc9f commit 08bae7f

17 files changed

+157
-30
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-06-04 12:51:42.024933",
8-
"spec_repo_commit": "35a63137"
7+
"regenerated": "2025-06-04 17:40:37.993718",
8+
"spec_repo_commit": "38b3c05a"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-06-04 12:51:42.039930",
13-
"spec_repo_commit": "35a63137"
12+
"regenerated": "2025-06-04 17:40:38.008535",
13+
"spec_repo_commit": "38b3c05a"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6742,6 +6742,8 @@ components:
67426742
nullable: true
67436743
readOnly: true
67446744
type: string
6745+
draft_status:
6746+
$ref: '#/components/schemas/MonitorDraftStatus'
67456747
id:
67466748
description: ID of this monitor.
67476749
format: int64
@@ -6834,6 +6836,28 @@ components:
68346836
- FIREFOX_LAPTOP_LARGE
68356837
- FIREFOX_TABLET
68366838
- FIREFOX_MOBILE_SMALL
6839+
MonitorDraftStatus:
6840+
default: published
6841+
description: 'Indicates whether the monitor is in a draft or published state.
6842+
6843+
6844+
`draft`: The monitor appears as Draft and does not send notifications.
6845+
6846+
`published`: The monitor is active and evaluates conditions and notify as
6847+
configured.
6848+
6849+
6850+
This field is in preview. The draft value is only available to customers with
6851+
the feature enabled.
6852+
6853+
'
6854+
enum:
6855+
- draft
6856+
- published
6857+
type: string
6858+
x-enum-varnames:
6859+
- DRAFT
6860+
- PUBLISHED
68376861
MonitorFormulaAndFunctionCostAggregator:
68386862
description: Aggregation methods for metric queries.
68396863
enum:
@@ -7917,6 +7941,8 @@ components:
79177941
nullable: true
79187942
readOnly: true
79197943
type: string
7944+
draft_status:
7945+
$ref: '#/components/schemas/MonitorDraftStatus'
79207946
id:
79217947
description: ID of this monitor.
79227948
format: int64

docs/datadog_api_client.v1.model.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,6 +2041,13 @@ datadog\_api\_client.v1.model.monitor\_device\_id module
20412041
:members:
20422042
:show-inheritance:
20432043

2044+
datadog\_api\_client.v1.model.monitor\_draft\_status module
2045+
-----------------------------------------------------------
2046+
2047+
.. automodule:: datadog_api_client.v1.model.monitor_draft_status
2048+
:members:
2049+
:show-inheritance:
2050+
20442051
datadog\_api\_client.v1.model.monitor\_formula\_and\_function\_cost\_aggregator module
20452052
--------------------------------------------------------------------------------------
20462053

examples/v1/monitors/CreateMonitor_1539578087.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from datadog_api_client import ApiClient, Configuration
66
from datadog_api_client.v1.api.monitors_api import MonitorsApi
77
from datadog_api_client.v1.model.monitor import Monitor
8+
from datadog_api_client.v1.model.monitor_draft_status import MonitorDraftStatus
89
from datadog_api_client.v1.model.monitor_options import MonitorOptions
910
from datadog_api_client.v1.model.monitor_options_custom_schedule import MonitorOptionsCustomSchedule
1011
from datadog_api_client.v1.model.monitor_options_custom_schedule_recurrence import (
@@ -45,6 +46,7 @@
4546
),
4647
),
4748
type=MonitorType.QUERY_ALERT,
49+
draft_status=MonitorDraftStatus.PUBLISHED,
4850
)
4951

5052
configuration = Configuration()

examples/v1/monitors/CreateMonitor_440013737.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from datadog_api_client import ApiClient, Configuration
66
from datadog_api_client.v1.api.monitors_api import MonitorsApi
77
from datadog_api_client.v1.model.monitor import Monitor
8+
from datadog_api_client.v1.model.monitor_draft_status import MonitorDraftStatus
89
from datadog_api_client.v1.model.monitor_options import MonitorOptions
910
from datadog_api_client.v1.model.monitor_thresholds import MonitorThresholds
1011
from datadog_api_client.v1.model.monitor_type import MonitorType
@@ -24,6 +25,7 @@
2425
critical=1.0,
2526
),
2627
),
28+
draft_status=MonitorDraftStatus.DRAFT,
2729
)
2830

2931
configuration = Configuration()

src/datadog_api_client/v1/model/monitor.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
if TYPE_CHECKING:
1919
from datadog_api_client.v1.model.creator import Creator
20+
from datadog_api_client.v1.model.monitor_draft_status import MonitorDraftStatus
2021
from datadog_api_client.v1.model.matching_downtime import MatchingDowntime
2122
from datadog_api_client.v1.model.monitor_options import MonitorOptions
2223
from datadog_api_client.v1.model.monitor_overall_states import MonitorOverallStates
@@ -28,6 +29,7 @@ class Monitor(ModelNormal):
2829
@cached_property
2930
def openapi_types(_):
3031
from datadog_api_client.v1.model.creator import Creator
32+
from datadog_api_client.v1.model.monitor_draft_status import MonitorDraftStatus
3133
from datadog_api_client.v1.model.matching_downtime import MatchingDowntime
3234
from datadog_api_client.v1.model.monitor_options import MonitorOptions
3335
from datadog_api_client.v1.model.monitor_overall_states import MonitorOverallStates
@@ -38,6 +40,7 @@ def openapi_types(_):
3840
"created": (datetime,),
3941
"creator": (Creator,),
4042
"deleted": (datetime, none_type),
43+
"draft_status": (MonitorDraftStatus,),
4144
"id": (int,),
4245
"matching_downtimes": ([MatchingDowntime],),
4346
"message": (str,),
@@ -58,6 +61,7 @@ def openapi_types(_):
5861
"created": "created",
5962
"creator": "creator",
6063
"deleted": "deleted",
64+
"draft_status": "draft_status",
6165
"id": "id",
6266
"matching_downtimes": "matching_downtimes",
6367
"message": "message",
@@ -91,6 +95,7 @@ def __init__(
9195
created: Union[datetime, UnsetType] = unset,
9296
creator: Union[Creator, UnsetType] = unset,
9397
deleted: Union[datetime, none_type, UnsetType] = unset,
98+
draft_status: Union[MonitorDraftStatus, UnsetType] = unset,
9499
id: Union[int, UnsetType] = unset,
95100
matching_downtimes: Union[List[MatchingDowntime], UnsetType] = unset,
96101
message: Union[str, UnsetType] = unset,
@@ -117,6 +122,14 @@ def __init__(
117122
:param deleted: Whether or not the monitor is deleted. (Always ``null`` )
118123
:type deleted: datetime, none_type, optional
119124
125+
:param draft_status: Indicates whether the monitor is in a draft or published state.
126+
127+
``draft`` : The monitor appears as Draft and does not send notifications.
128+
``published`` : The monitor is active and evaluates conditions and notify as configured.
129+
130+
This field is in preview. The draft value is only available to customers with the feature enabled.
131+
:type draft_status: MonitorDraftStatus, optional
132+
120133
:param id: ID of this monitor.
121134
:type id: int, optional
122135
@@ -165,6 +178,8 @@ def __init__(
165178
kwargs["creator"] = creator
166179
if deleted is not unset:
167180
kwargs["deleted"] = deleted
181+
if draft_status is not unset:
182+
kwargs["draft_status"] = draft_status
168183
if id is not unset:
169184
kwargs["id"] = id
170185
if matching_downtimes is not unset:
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
7+
from datadog_api_client.model_utils import (
8+
ModelSimple,
9+
cached_property,
10+
)
11+
12+
from typing import ClassVar
13+
14+
15+
class MonitorDraftStatus(ModelSimple):
16+
"""
17+
Indicates whether the monitor is in a draft or published state.
18+
19+
`draft`: The monitor appears as Draft and does not send notifications.
20+
`published`: The monitor is active and evaluates conditions and notify as configured.
21+
22+
This field is in preview. The draft value is only available to customers with the feature enabled.
23+
24+
25+
:param value: If omitted defaults to "published". Must be one of ["draft", "published"].
26+
:type value: str
27+
"""
28+
29+
allowed_values = {
30+
"draft",
31+
"published",
32+
}
33+
DRAFT: ClassVar["MonitorDraftStatus"]
34+
PUBLISHED: ClassVar["MonitorDraftStatus"]
35+
36+
@cached_property
37+
def openapi_types(_):
38+
return {
39+
"value": (str,),
40+
}
41+
42+
43+
MonitorDraftStatus.DRAFT = MonitorDraftStatus("draft")
44+
MonitorDraftStatus.PUBLISHED = MonitorDraftStatus("published")

src/datadog_api_client/v1/model/monitor_update_request.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
if TYPE_CHECKING:
1919
from datadog_api_client.v1.model.creator import Creator
20+
from datadog_api_client.v1.model.monitor_draft_status import MonitorDraftStatus
2021
from datadog_api_client.v1.model.monitor_options import MonitorOptions
2122
from datadog_api_client.v1.model.monitor_overall_states import MonitorOverallStates
2223
from datadog_api_client.v1.model.monitor_state import MonitorState
@@ -27,6 +28,7 @@ class MonitorUpdateRequest(ModelNormal):
2728
@cached_property
2829
def openapi_types(_):
2930
from datadog_api_client.v1.model.creator import Creator
31+
from datadog_api_client.v1.model.monitor_draft_status import MonitorDraftStatus
3032
from datadog_api_client.v1.model.monitor_options import MonitorOptions
3133
from datadog_api_client.v1.model.monitor_overall_states import MonitorOverallStates
3234
from datadog_api_client.v1.model.monitor_state import MonitorState
@@ -36,6 +38,7 @@ def openapi_types(_):
3638
"created": (datetime,),
3739
"creator": (Creator,),
3840
"deleted": (datetime, none_type),
41+
"draft_status": (MonitorDraftStatus,),
3942
"id": (int,),
4043
"message": (str,),
4144
"modified": (datetime,),
@@ -55,6 +58,7 @@ def openapi_types(_):
5558
"created": "created",
5659
"creator": "creator",
5760
"deleted": "deleted",
61+
"draft_status": "draft_status",
5862
"id": "id",
5963
"message": "message",
6064
"modified": "modified",
@@ -85,6 +89,7 @@ def __init__(
8589
created: Union[datetime, UnsetType] = unset,
8690
creator: Union[Creator, UnsetType] = unset,
8791
deleted: Union[datetime, none_type, UnsetType] = unset,
92+
draft_status: Union[MonitorDraftStatus, UnsetType] = unset,
8893
id: Union[int, UnsetType] = unset,
8994
message: Union[str, UnsetType] = unset,
9095
modified: Union[datetime, UnsetType] = unset,
@@ -112,6 +117,14 @@ def __init__(
112117
:param deleted: Whether or not the monitor is deleted. (Always ``null`` )
113118
:type deleted: datetime, none_type, optional
114119
120+
:param draft_status: Indicates whether the monitor is in a draft or published state.
121+
122+
``draft`` : The monitor appears as Draft and does not send notifications.
123+
``published`` : The monitor is active and evaluates conditions and notify as configured.
124+
125+
This field is in preview. The draft value is only available to customers with the feature enabled.
126+
:type draft_status: MonitorDraftStatus, optional
127+
115128
:param id: ID of this monitor.
116129
:type id: int, optional
117130
@@ -157,6 +170,8 @@ def __init__(
157170
kwargs["creator"] = creator
158171
if deleted is not unset:
159172
kwargs["deleted"] = deleted
173+
if draft_status is not unset:
174+
kwargs["draft_status"] = draft_status
160175
if id is not unset:
161176
kwargs["id"] = id
162177
if message is not unset:

src/datadog_api_client/v1/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@
323323
from datadog_api_client.v1.model.metrics_query_unit import MetricsQueryUnit
324324
from datadog_api_client.v1.model.monitor import Monitor
325325
from datadog_api_client.v1.model.monitor_device_id import MonitorDeviceID
326+
from datadog_api_client.v1.model.monitor_draft_status import MonitorDraftStatus
326327
from datadog_api_client.v1.model.monitor_formula_and_function_cost_aggregator import (
327328
MonitorFormulaAndFunctionCostAggregator,
328329
)
@@ -1376,6 +1377,7 @@
13761377
"MetricsQueryUnit",
13771378
"Monitor",
13781379
"MonitorDeviceID",
1380+
"MonitorDraftStatus",
13791381
"MonitorFormulaAndFunctionCostAggregator",
13801382
"MonitorFormulaAndFunctionCostDataSource",
13811383
"MonitorFormulaAndFunctionCostQueryDefinition",
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2023-11-09T17:58:50.774Z
1+
2025-05-14T22:28:29.992Z

tests/v1/cassettes/test_scenarios/test_create_a_metric_monitor_with_a_custom_schedule_returns_ok_response.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
interactions:
22
- request:
3-
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{*}
3+
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{*}
44
> 0.5","tags":[],"type":"query alert"}'
55
headers:
66
accept:
@@ -11,10 +11,10 @@ interactions:
1111
uri: https://api.datadoghq.com/api/v1/monitor
1212
response:
1313
body:
14-
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
14+
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
1515
message Notify: @hipchat-channel","tags":[],"query":"avg(current_1mo):avg:system.load.5{*}
16-
> 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
17-
Data","creator":{"name":"CI Account","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"team-intg-tools-libs-spam@datadoghq.com","id":2320499}}
16+
> 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
17+
Data","creator":{"name":"Carl Martensen","handle":"[email protected]","email":"carl.martensen@datadoghq.com","id":638339},"run_as":null,"restricted":true}
1818
1919
'
2020
headers:
@@ -29,10 +29,10 @@ interactions:
2929
accept:
3030
- application/json
3131
method: DELETE
32-
uri: https://api.datadoghq.com/api/v1/monitor/134549556
32+
uri: https://api.datadoghq.com/api/v1/monitor/172140210
3333
response:
3434
body:
35-
string: '{"deleted_monitor_id":134549556}
35+
string: '{"deleted_monitor_id":172140210}
3636
3737
'
3838
headers:
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-02-02T21:04:10.597Z
1+
2025-05-14T22:27:13.829Z

tests/v1/cassettes/test_scenarios/test_create_a_rum_formula_and_functions_monitor_returns_ok_response.yaml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
interactions:
22
- request:
3-
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
4-
/ query1 * 100\").last(\"15m\") >= 0.8","tags":["test:testcreatearumformulaandfunctionsmonitorreturnsokresponse1643835850","env:ci"],"type":"rum
3+
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
4+
/ query1 * 100\").last(\"15m\") >= 0.8","tags":["test:testcreatearumformulaandfunctionsmonitorreturnsokresponse1747261633","env:ci"],"type":"rum
55
alert"}'
66
headers:
77
accept:
@@ -12,9 +12,12 @@ interactions:
1212
uri: https://api.datadoghq.com/api/v1/monitor
1313
response:
1414
body:
15-
string: '{"restricted_roles":null,"tags":["test:testcreatearumformulaandfunctionsmonitorreturnsokresponse1643835850","env:ci"],"deleted":null,"query":"formula(\"query2
16-
/ 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":"[email protected]","name":null,"email":"[email protected]"},"org_id":321813,"modified":"2022-02-02T21:04:10.947341+00:00","priority":3,"overall_state_modified":null,"overall_state":"No
17-
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":[]}]}}'
15+
string: '{"id":172140181,"org_id":2,"type":"rum alert","name":"Test-Create_a_RUM_formula_and_functions_monitor_returns_OK_response-1747261633","message":"some
16+
message Notify: @hipchat-channel","tags":["test:testcreatearumformulaandfunctionsmonitorreturnsokresponse1747261633","env:ci"],"query":"formula(\"query2
17+
/ 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
18+
Data","creator":{"name":"Carl Martensen","handle":"[email protected]","email":"[email protected]","id":638339},"run_as":null,"restricted":true}
19+
20+
'
1821
headers:
1922
content-type:
2023
- application/json
@@ -27,10 +30,12 @@ interactions:
2730
accept:
2831
- application/json
2932
method: DELETE
30-
uri: https://api.datadoghq.com/api/v1/monitor/62683819
33+
uri: https://api.datadoghq.com/api/v1/monitor/172140181
3134
response:
3235
body:
33-
string: '{"deleted_monitor_id":62683819}'
36+
string: '{"deleted_monitor_id":172140181}
37+
38+
'
3439
headers:
3540
content-type:
3641
- application/json
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-03-17T20:05:01.132Z
1+
2025-05-14T22:17:22.560Z

0 commit comments

Comments
 (0)