Skip to content

Commit 86b8fbb

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 07378d9e of spec repo
1 parent 624a776 commit 86b8fbb

16 files changed

+169
-28
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-05-14 15:44:18.586011",
8-
"spec_repo_commit": "64f5e7ee"
7+
"regenerated": "2025-05-14 22:55:15.268511",
8+
"spec_repo_commit": "07378d9e"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-05-14 15:44:18.601730",
13-
"spec_repo_commit": "64f5e7ee"
12+
"regenerated": "2025-05-14 22:55:15.285392",
13+
"spec_repo_commit": "07378d9e"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 20 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,22 @@ components:
68346836
- FIREFOX_LAPTOP_LARGE
68356837
- FIREFOX_TABLET
68366838
- FIREFOX_MOBILE_SMALL
6839+
MonitorDraftStatus:
6840+
default: published
6841+
description: 'Whether a monitor is in draft or published state. Draft monitors
6842+
do not notify recipients. Draft monitors are currently in
6843+
6844+
preview and the field is only processed for enabled customers. This accepts
6845+
the values `draft`
6846+
6847+
and `published`. Defaults to published.'
6848+
enum:
6849+
- draft
6850+
- published
6851+
type: string
6852+
x-enum-varnames:
6853+
- DRAFT
6854+
- PUBLISHED
68376855
MonitorFormulaAndFunctionCostAggregator:
68386856
description: Aggregation methods for metric queries.
68396857
enum:
@@ -7917,6 +7935,8 @@ components:
79177935
nullable: true
79187936
readOnly: true
79197937
type: string
7938+
draft_status:
7939+
$ref: '#/components/schemas/MonitorDraftStatus'
79207940
id:
79217941
description: ID of this monitor.
79227942
format: int64

examples/v1_monitors_CreateMonitor_1539578087.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
use datadog_api_client::datadog;
33
use datadog_api_client::datadogV1::api_monitors::MonitorsAPI;
44
use datadog_api_client::datadogV1::model::Monitor;
5+
use datadog_api_client::datadogV1::model::MonitorDraftStatus;
56
use datadog_api_client::datadogV1::model::MonitorOptions;
67
use datadog_api_client::datadogV1::model::MonitorOptionsCustomSchedule;
78
use datadog_api_client::datadogV1::model::MonitorOptionsCustomScheduleRecurrence;
@@ -16,6 +17,7 @@ async fn main() {
1617
"avg(current_1mo):avg:system.load.5{*} > 0.5".to_string(),
1718
MonitorType::QUERY_ALERT,
1819
)
20+
.draft_status(MonitorDraftStatus::PUBLISHED)
1921
.message("some message Notify: @hipchat-channel".to_string())
2022
.name("Example-Monitor".to_string())
2123
.options(

examples/v1_monitors_CreateMonitor_440013737.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
use datadog_api_client::datadog;
33
use datadog_api_client::datadogV1::api_monitors::MonitorsAPI;
44
use datadog_api_client::datadogV1::model::Monitor;
5+
use datadog_api_client::datadogV1::model::MonitorDraftStatus;
56
use datadog_api_client::datadogV1::model::MonitorOptions;
67
use datadog_api_client::datadogV1::model::MonitorThresholds;
78
use datadog_api_client::datadogV1::model::MonitorType;
@@ -13,6 +14,7 @@ async fn main() {
1314
r#"error-tracking-rum("service:foo AND @error.source:source").rollup("count").by("@issue.id").last("1h") >= 1"#.to_string(),
1415
MonitorType::ERROR_TRACKING_ALERT,
1516
)
17+
.draft_status(MonitorDraftStatus::DRAFT)
1618
.message("some message".to_string())
1719
.name("Example-Monitor".to_string())
1820
.options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))

src/datadogV1/model/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,8 @@ pub mod model_metric_metadata;
922922
pub use self::model_metric_metadata::MetricMetadata;
923923
pub mod model_monitor;
924924
pub use self::model_monitor::Monitor;
925+
pub mod model_monitor_draft_status;
926+
pub use self::model_monitor_draft_status::MonitorDraftStatus;
925927
pub mod model_matching_downtime;
926928
pub use self::model_matching_downtime::MatchingDowntime;
927929
pub mod model_monitor_options;

src/datadogV1/model/model_monitor.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ pub struct Monitor {
2424
with = "::serde_with::rust::double_option"
2525
)]
2626
pub deleted: Option<Option<chrono::DateTime<chrono::Utc>>>,
27+
/// Whether a monitor is in draft or published state. Draft monitors do not notify recipients. Draft monitors are currently in
28+
/// preview and the field is only processed for enabled customers. This accepts the values `draft`
29+
/// and `published`. Defaults to published.
30+
#[serde(rename = "draft_status")]
31+
pub draft_status: Option<crate::datadogV1::model::MonitorDraftStatus>,
2732
/// ID of this monitor.
2833
#[serde(rename = "id")]
2934
pub id: Option<i64>,
@@ -87,6 +92,7 @@ impl Monitor {
8792
created: None,
8893
creator: None,
8994
deleted: None,
95+
draft_status: None,
9096
id: None,
9197
matching_downtimes: None,
9298
message: None,
@@ -121,6 +127,11 @@ impl Monitor {
121127
self
122128
}
123129

130+
pub fn draft_status(mut self, value: crate::datadogV1::model::MonitorDraftStatus) -> Self {
131+
self.draft_status = Some(value);
132+
self
133+
}
134+
124135
pub fn id(mut self, value: i64) -> Self {
125136
self.id = Some(value);
126137
self
@@ -213,6 +224,7 @@ impl<'de> Deserialize<'de> for Monitor {
213224
let mut created: Option<chrono::DateTime<chrono::Utc>> = None;
214225
let mut creator: Option<crate::datadogV1::model::Creator> = None;
215226
let mut deleted: Option<Option<chrono::DateTime<chrono::Utc>>> = None;
227+
let mut draft_status: Option<crate::datadogV1::model::MonitorDraftStatus> = None;
216228
let mut id: Option<i64> = None;
217229
let mut matching_downtimes: Option<Vec<crate::datadogV1::model::MatchingDowntime>> =
218230
None;
@@ -251,6 +263,23 @@ impl<'de> Deserialize<'de> for Monitor {
251263
"deleted" => {
252264
deleted = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
253265
}
266+
"draft_status" => {
267+
if v.is_null() {
268+
continue;
269+
}
270+
draft_status =
271+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
272+
if let Some(ref _draft_status) = draft_status {
273+
match _draft_status {
274+
crate::datadogV1::model::MonitorDraftStatus::UnparsedObject(
275+
_draft_status,
276+
) => {
277+
_unparsed = true;
278+
}
279+
_ => {}
280+
}
281+
}
282+
}
254283
"id" => {
255284
if v.is_null() {
256285
continue;
@@ -358,6 +387,7 @@ impl<'de> Deserialize<'de> for Monitor {
358387
created,
359388
creator,
360389
deleted,
390+
draft_status,
361391
id,
362392
matching_downtimes,
363393
message,
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
5+
use serde::{Deserialize, Deserializer, Serialize, Serializer};
6+
7+
#[non_exhaustive]
8+
#[derive(Clone, Debug, Eq, PartialEq)]
9+
pub enum MonitorDraftStatus {
10+
DRAFT,
11+
PUBLISHED,
12+
UnparsedObject(crate::datadog::UnparsedObject),
13+
}
14+
15+
impl ToString for MonitorDraftStatus {
16+
fn to_string(&self) -> String {
17+
match self {
18+
Self::DRAFT => String::from("draft"),
19+
Self::PUBLISHED => String::from("published"),
20+
Self::UnparsedObject(v) => v.value.to_string(),
21+
}
22+
}
23+
}
24+
25+
impl Serialize for MonitorDraftStatus {
26+
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
27+
where
28+
S: Serializer,
29+
{
30+
match self {
31+
Self::UnparsedObject(v) => v.serialize(serializer),
32+
_ => serializer.serialize_str(self.to_string().as_str()),
33+
}
34+
}
35+
}
36+
37+
impl<'de> Deserialize<'de> for MonitorDraftStatus {
38+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
39+
where
40+
D: Deserializer<'de>,
41+
{
42+
let s: String = String::deserialize(deserializer)?;
43+
Ok(match s.as_str() {
44+
"draft" => Self::DRAFT,
45+
"published" => Self::PUBLISHED,
46+
_ => Self::UnparsedObject(crate::datadog::UnparsedObject {
47+
value: serde_json::Value::String(s.into()),
48+
}),
49+
})
50+
}
51+
}

src/datadogV1/model/model_monitor_update_request.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ pub struct MonitorUpdateRequest {
2424
with = "::serde_with::rust::double_option"
2525
)]
2626
pub deleted: Option<Option<chrono::DateTime<chrono::Utc>>>,
27+
/// Whether a monitor is in draft or published state. Draft monitors do not notify recipients. Draft monitors are currently in
28+
/// preview and the field is only processed for enabled customers. This accepts the values `draft`
29+
/// and `published`. Defaults to published.
30+
#[serde(rename = "draft_status")]
31+
pub draft_status: Option<crate::datadogV1::model::MonitorDraftStatus>,
2732
/// ID of this monitor.
2833
#[serde(rename = "id")]
2934
pub id: Option<i64>,
@@ -84,6 +89,7 @@ impl MonitorUpdateRequest {
8489
created: None,
8590
creator: None,
8691
deleted: None,
92+
draft_status: None,
8793
id: None,
8894
message: None,
8995
modified: None,
@@ -117,6 +123,11 @@ impl MonitorUpdateRequest {
117123
self
118124
}
119125

126+
pub fn draft_status(mut self, value: crate::datadogV1::model::MonitorDraftStatus) -> Self {
127+
self.draft_status = Some(value);
128+
self
129+
}
130+
120131
pub fn id(mut self, value: i64) -> Self {
121132
self.id = Some(value);
122133
self
@@ -217,6 +228,7 @@ impl<'de> Deserialize<'de> for MonitorUpdateRequest {
217228
let mut created: Option<chrono::DateTime<chrono::Utc>> = None;
218229
let mut creator: Option<crate::datadogV1::model::Creator> = None;
219230
let mut deleted: Option<Option<chrono::DateTime<chrono::Utc>>> = None;
231+
let mut draft_status: Option<crate::datadogV1::model::MonitorDraftStatus> = None;
220232
let mut id: Option<i64> = None;
221233
let mut message: Option<String> = None;
222234
let mut modified: Option<chrono::DateTime<chrono::Utc>> = None;
@@ -253,6 +265,23 @@ impl<'de> Deserialize<'de> for MonitorUpdateRequest {
253265
"deleted" => {
254266
deleted = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
255267
}
268+
"draft_status" => {
269+
if v.is_null() {
270+
continue;
271+
}
272+
draft_status =
273+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
274+
if let Some(ref _draft_status) = draft_status {
275+
match _draft_status {
276+
crate::datadogV1::model::MonitorDraftStatus::UnparsedObject(
277+
_draft_status,
278+
) => {
279+
_unparsed = true;
280+
}
281+
_ => {}
282+
}
283+
}
284+
}
256285
"id" => {
257286
if v.is_null() {
258287
continue;
@@ -357,6 +386,7 @@ impl<'de> Deserialize<'de> for MonitorUpdateRequest {
357386
created,
358387
creator,
359388
deleted,
389+
draft_status,
360390
id,
361391
message,
362392
modified,
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/scenarios/cassettes/v1/monitors/Create-a-RUM-formula-and-functions-monitor-returns-OK-response.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"request": {
55
"body": {
6-
"string": "{\"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 alert\"}",
6+
"string": "{\"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\"}",
77
"encoding": null
88
},
99
"headers": {
@@ -19,7 +19,7 @@
1919
},
2020
"response": {
2121
"body": {
22-
"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\":\"[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 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\":[]}]}}",
22+
"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\":\"[email protected]\",\"email\":\"[email protected]\",\"id\":638339},\"run_as\":null,\"restricted\":true}\n",
2323
"encoding": null
2424
},
2525
"headers": {
@@ -32,7 +32,7 @@
3232
"message": "OK"
3333
}
3434
},
35-
"recorded_at": "Wed, 02 Feb 2022 21:04:10 GMT"
35+
"recorded_at": "Wed, 14 May 2025 22:27:13 GMT"
3636
},
3737
{
3838
"request": {
@@ -43,11 +43,11 @@
4343
]
4444
},
4545
"method": "delete",
46-
"uri": "https://api.datadoghq.com/api/v1/monitor/62683819"
46+
"uri": "https://api.datadoghq.com/api/v1/monitor/172140181"
4747
},
4848
"response": {
4949
"body": {
50-
"string": "{\"deleted_monitor_id\":62683819}",
50+
"string": "{\"deleted_monitor_id\":172140181}\n",
5151
"encoding": null
5252
},
5353
"headers": {
@@ -60,7 +60,7 @@
6060
"message": "OK"
6161
}
6262
},
63-
"recorded_at": "Wed, 02 Feb 2022 21:04:10 GMT"
63+
"recorded_at": "Wed, 14 May 2025 22:27:13 GMT"
6464
}
6565
],
6666
"recorded_with": "VCR 6.0.0"
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2023-11-09T17:58:50.774Z
1+
2025-05-14T22:28:29.992Z

0 commit comments

Comments
 (0)