Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-06-04 12:51:39.592781",
"spec_repo_commit": "35a63137"
"regenerated": "2025-06-04 17:40:40.467497",
"spec_repo_commit": "38b3c05a"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-06-04 12:51:39.609704",
"spec_repo_commit": "35a63137"
"regenerated": "2025-06-04 17:40:40.483266",
"spec_repo_commit": "38b3c05a"
}
}
}
26 changes: 26 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions examples/v1_monitors_CreateMonitor_1539578087.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_monitors::MonitorsAPI;
use datadog_api_client::datadogV1::model::Monitor;
use datadog_api_client::datadogV1::model::MonitorDraftStatus;
use datadog_api_client::datadogV1::model::MonitorOptions;
use datadog_api_client::datadogV1::model::MonitorOptionsCustomSchedule;
use datadog_api_client::datadogV1::model::MonitorOptionsCustomScheduleRecurrence;
Expand All @@ -16,6 +17,7 @@ async fn main() {
"avg(current_1mo):avg:system.load.5{*} > 0.5".to_string(),
MonitorType::QUERY_ALERT,
)
.draft_status(MonitorDraftStatus::PUBLISHED)
.message("some message Notify: @hipchat-channel".to_string())
.name("Example-Monitor".to_string())
.options(
Expand Down
2 changes: 2 additions & 0 deletions examples/v1_monitors_CreateMonitor_440013737.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_monitors::MonitorsAPI;
use datadog_api_client::datadogV1::model::Monitor;
use datadog_api_client::datadogV1::model::MonitorDraftStatus;
use datadog_api_client::datadogV1::model::MonitorOptions;
use datadog_api_client::datadogV1::model::MonitorThresholds;
use datadog_api_client::datadogV1::model::MonitorType;
Expand All @@ -13,6 +14,7 @@ async fn main() {
r#"error-tracking-rum("service:foo AND @error.source:source").rollup("count").by("@issue.id").last("1h") >= 1"#.to_string(),
MonitorType::ERROR_TRACKING_ALERT,
)
.draft_status(MonitorDraftStatus::DRAFT)
.message("some message".to_string())
.name("Example-Monitor".to_string())
.options(MonitorOptions::new().thresholds(MonitorThresholds::new().critical(1.0 as f64)))
Expand Down
2 changes: 2 additions & 0 deletions src/datadogV1/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,8 @@ pub mod model_metric_metadata;
pub use self::model_metric_metadata::MetricMetadata;
pub mod model_monitor;
pub use self::model_monitor::Monitor;
pub mod model_monitor_draft_status;
pub use self::model_monitor_draft_status::MonitorDraftStatus;
pub mod model_matching_downtime;
pub use self::model_matching_downtime::MatchingDowntime;
pub mod model_monitor_options;
Expand Down
34 changes: 34 additions & 0 deletions src/datadogV1/model/model_monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ pub struct Monitor {
with = "::serde_with::rust::double_option"
)]
pub deleted: Option<Option<chrono::DateTime<chrono::Utc>>>,
/// 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.
///
#[serde(rename = "draft_status")]
pub draft_status: Option<crate::datadogV1::model::MonitorDraftStatus>,
/// ID of this monitor.
#[serde(rename = "id")]
pub id: Option<i64>,
Expand Down Expand Up @@ -87,6 +96,7 @@ impl Monitor {
created: None,
creator: None,
deleted: None,
draft_status: None,
id: None,
matching_downtimes: None,
message: None,
Expand Down Expand Up @@ -121,6 +131,11 @@ impl Monitor {
self
}

pub fn draft_status(mut self, value: crate::datadogV1::model::MonitorDraftStatus) -> Self {
self.draft_status = Some(value);
self
}

pub fn id(mut self, value: i64) -> Self {
self.id = Some(value);
self
Expand Down Expand Up @@ -213,6 +228,7 @@ impl<'de> Deserialize<'de> for Monitor {
let mut created: Option<chrono::DateTime<chrono::Utc>> = None;
let mut creator: Option<crate::datadogV1::model::Creator> = None;
let mut deleted: Option<Option<chrono::DateTime<chrono::Utc>>> = None;
let mut draft_status: Option<crate::datadogV1::model::MonitorDraftStatus> = None;
let mut id: Option<i64> = None;
let mut matching_downtimes: Option<Vec<crate::datadogV1::model::MatchingDowntime>> =
None;
Expand Down Expand Up @@ -251,6 +267,23 @@ impl<'de> Deserialize<'de> for Monitor {
"deleted" => {
deleted = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"draft_status" => {
if v.is_null() {
continue;
}
draft_status =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
if let Some(ref _draft_status) = draft_status {
match _draft_status {
crate::datadogV1::model::MonitorDraftStatus::UnparsedObject(
_draft_status,
) => {
_unparsed = true;
}
_ => {}
}
}
}
"id" => {
if v.is_null() {
continue;
Expand Down Expand Up @@ -358,6 +391,7 @@ impl<'de> Deserialize<'de> for Monitor {
created,
creator,
deleted,
draft_status,
id,
matching_downtimes,
message,
Expand Down
51 changes: 51 additions & 0 deletions src/datadogV1/model/model_monitor_draft_status.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// 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.

use serde::{Deserialize, Deserializer, Serialize, Serializer};

#[non_exhaustive]
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum MonitorDraftStatus {
DRAFT,
PUBLISHED,
UnparsedObject(crate::datadog::UnparsedObject),
}

impl ToString for MonitorDraftStatus {
fn to_string(&self) -> String {
match self {
Self::DRAFT => String::from("draft"),
Self::PUBLISHED => String::from("published"),
Self::UnparsedObject(v) => v.value.to_string(),
}
}
}

impl Serialize for MonitorDraftStatus {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
match self {
Self::UnparsedObject(v) => v.serialize(serializer),
_ => serializer.serialize_str(self.to_string().as_str()),
}
}
}

impl<'de> Deserialize<'de> for MonitorDraftStatus {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
let s: String = String::deserialize(deserializer)?;
Ok(match s.as_str() {
"draft" => Self::DRAFT,
"published" => Self::PUBLISHED,
_ => Self::UnparsedObject(crate::datadog::UnparsedObject {
value: serde_json::Value::String(s.into()),
}),
})
}
}
34 changes: 34 additions & 0 deletions src/datadogV1/model/model_monitor_update_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ pub struct MonitorUpdateRequest {
with = "::serde_with::rust::double_option"
)]
pub deleted: Option<Option<chrono::DateTime<chrono::Utc>>>,
/// 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.
///
#[serde(rename = "draft_status")]
pub draft_status: Option<crate::datadogV1::model::MonitorDraftStatus>,
/// ID of this monitor.
#[serde(rename = "id")]
pub id: Option<i64>,
Expand Down Expand Up @@ -84,6 +93,7 @@ impl MonitorUpdateRequest {
created: None,
creator: None,
deleted: None,
draft_status: None,
id: None,
message: None,
modified: None,
Expand Down Expand Up @@ -117,6 +127,11 @@ impl MonitorUpdateRequest {
self
}

pub fn draft_status(mut self, value: crate::datadogV1::model::MonitorDraftStatus) -> Self {
self.draft_status = Some(value);
self
}

pub fn id(mut self, value: i64) -> Self {
self.id = Some(value);
self
Expand Down Expand Up @@ -217,6 +232,7 @@ impl<'de> Deserialize<'de> for MonitorUpdateRequest {
let mut created: Option<chrono::DateTime<chrono::Utc>> = None;
let mut creator: Option<crate::datadogV1::model::Creator> = None;
let mut deleted: Option<Option<chrono::DateTime<chrono::Utc>>> = None;
let mut draft_status: Option<crate::datadogV1::model::MonitorDraftStatus> = None;
let mut id: Option<i64> = None;
let mut message: Option<String> = None;
let mut modified: Option<chrono::DateTime<chrono::Utc>> = None;
Expand Down Expand Up @@ -253,6 +269,23 @@ impl<'de> Deserialize<'de> for MonitorUpdateRequest {
"deleted" => {
deleted = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"draft_status" => {
if v.is_null() {
continue;
}
draft_status =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
if let Some(ref _draft_status) = draft_status {
match _draft_status {
crate::datadogV1::model::MonitorDraftStatus::UnparsedObject(
_draft_status,
) => {
_unparsed = true;
}
_ => {}
}
}
}
"id" => {
if v.is_null() {
continue;
Expand Down Expand Up @@ -357,6 +390,7 @@ impl<'de> Deserialize<'de> for MonitorUpdateRequest {
created,
creator,
deleted,
draft_status,
id,
message,
modified,
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2022-02-02T21:04:10.597Z
2025-05-14T22:27:13.829Z
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"request": {
"body": {
"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\"}",
"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\"}",
"encoding": null
},
"headers": {
Expand All @@ -19,7 +19,7 @@
},
"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\":\"[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\":[]}]}}",
"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",
"encoding": null
},
"headers": {
Expand All @@ -32,7 +32,7 @@
"message": "OK"
}
},
"recorded_at": "Wed, 02 Feb 2022 21:04:10 GMT"
"recorded_at": "Wed, 14 May 2025 22:27:13 GMT"
},
{
"request": {
Expand All @@ -43,11 +43,11 @@
]
},
"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}\n",
"encoding": null
},
"headers": {
Expand All @@ -60,7 +60,7 @@
"message": "OK"
}
},
"recorded_at": "Wed, 02 Feb 2022 21:04:10 GMT"
"recorded_at": "Wed, 14 May 2025 22:27:13 GMT"
}
],
"recorded_with": "VCR 6.0.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-11-09T17:58:50.774Z
2025-05-14T22:28:29.992Z
Loading
Loading