From 77b95b3018d3d53027bb5e4263ab95ad1113d5bd Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 13 Jul 2026 17:04:04 +0000 Subject: [PATCH] Regenerate client from commit 306edfe of spec repo --- .generator/schemas/v1/openapi.yaml | 43 +++++ src/datadogV1/model/mod.rs | 4 + .../model_widget_calendar_aligned_span.rs | 149 ++++++++++++++++++ ...model_widget_calendar_aligned_span_type.rs | 57 +++++++ src/datadogV1/model/model_widget_live_span.rs | 9 ++ src/datadogV1/model/model_widget_time.rs | 9 ++ 6 files changed, 271 insertions(+) create mode 100644 src/datadogV1/model/model_widget_calendar_aligned_span.rs create mode 100644 src/datadogV1/model/model_widget_calendar_aligned_span_type.rs diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index b41f414fd3..b96c7babe9 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -27920,6 +27920,42 @@ components: WidgetBackgroundColor: description: "Background color of the widget. Supported values are `white`, `blue`, `purple`, `pink`, `orange`, `yellow`, `green`, `gray`, `vivid_blue`, `vivid_purple`, `vivid_pink`, `vivid_orange`, `vivid_yellow`, `vivid_green`, and `transparent`." type: string + WidgetCalendarAlignedSpan: + description: Used for calendar-aligned time spans, such as the current month or previous year. + properties: + hide_incomplete_cost_data: + description: Whether to hide incomplete cost data in the widget. + type: boolean + offset: + description: Number of completed periods before the current period. 0 represents the current period. + example: 1 + format: int64 + minimum: 0 + type: integer + timezone: + description: Time zone used to align the calendar period. + example: UTC + type: string + type: + $ref: "#/components/schemas/WidgetCalendarAlignedSpanType" + required: + - type + - offset + type: object + WidgetCalendarAlignedSpanType: + description: Calendar-aligned time span type. + enum: + - daily + - weekly + - monthly + - yearly + example: daily + type: string + x-enum-varnames: + - DAILY + - WEEKLY + - MONTHLY + - YEARLY WidgetChangeType: description: Show the absolute or the relative change. enum: @@ -28381,6 +28417,9 @@ components: - month_to_date - 1y - alert + - full_week + - full_month + - year_to_date example: 5m type: string x-enum-varnames: @@ -28401,6 +28440,9 @@ components: - MONTH_TO_DATE - PAST_ONE_YEAR - ALERT + - FULL_WEEK + - FULL_MONTH + - YEAR_TO_DATE WidgetLiveSpanUnit: description: Unit of the time span. enum: @@ -28784,6 +28826,7 @@ components: - $ref: "#/components/schemas/WidgetLegacyLiveSpan" - $ref: "#/components/schemas/WidgetNewLiveSpan" - $ref: "#/components/schemas/WidgetNewFixedSpan" + - $ref: "#/components/schemas/WidgetCalendarAlignedSpan" WidgetTimeWindows: description: Define a time window. enum: diff --git a/src/datadogV1/model/mod.rs b/src/datadogV1/model/mod.rs index f0f4f83c60..f20d613db1 100644 --- a/src/datadogV1/model/mod.rs +++ b/src/datadogV1/model/mod.rs @@ -116,6 +116,10 @@ pub mod model_widget_new_fixed_span; pub use self::model_widget_new_fixed_span::WidgetNewFixedSpan; pub mod model_widget_new_fixed_span_type; pub use self::model_widget_new_fixed_span_type::WidgetNewFixedSpanType; +pub mod model_widget_calendar_aligned_span; +pub use self::model_widget_calendar_aligned_span::WidgetCalendarAlignedSpan; +pub mod model_widget_calendar_aligned_span_type; +pub use self::model_widget_calendar_aligned_span_type::WidgetCalendarAlignedSpanType; pub mod model_widget_time; pub use self::model_widget_time::WidgetTime; pub mod model_widget_text_align; diff --git a/src/datadogV1/model/model_widget_calendar_aligned_span.rs b/src/datadogV1/model/model_widget_calendar_aligned_span.rs new file mode 100644 index 0000000000..e241c0c5d6 --- /dev/null +++ b/src/datadogV1/model/model_widget_calendar_aligned_span.rs @@ -0,0 +1,149 @@ +// 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::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Used for calendar-aligned time spans, such as the current month or previous year. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct WidgetCalendarAlignedSpan { + /// Whether to hide incomplete cost data in the widget. + #[serde(rename = "hide_incomplete_cost_data")] + pub hide_incomplete_cost_data: Option, + /// Number of completed periods before the current period. 0 represents the current period. + #[serde(rename = "offset")] + pub offset: i64, + /// Time zone used to align the calendar period. + #[serde(rename = "timezone")] + pub timezone: Option, + /// Calendar-aligned time span type. + #[serde(rename = "type")] + pub type_: crate::datadogV1::model::WidgetCalendarAlignedSpanType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl WidgetCalendarAlignedSpan { + pub fn new( + offset: i64, + type_: crate::datadogV1::model::WidgetCalendarAlignedSpanType, + ) -> WidgetCalendarAlignedSpan { + WidgetCalendarAlignedSpan { + hide_incomplete_cost_data: None, + offset, + timezone: None, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn hide_incomplete_cost_data(mut self, value: bool) -> Self { + self.hide_incomplete_cost_data = Some(value); + self + } + + pub fn timezone(mut self, value: String) -> Self { + self.timezone = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for WidgetCalendarAlignedSpan { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct WidgetCalendarAlignedSpanVisitor; + impl<'a> Visitor<'a> for WidgetCalendarAlignedSpanVisitor { + type Value = WidgetCalendarAlignedSpan; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut hide_incomplete_cost_data: Option = None; + let mut offset: Option = None; + let mut timezone: Option = None; + let mut type_: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "hide_incomplete_cost_data" => { + if v.is_null() { + continue; + } + hide_incomplete_cost_data = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "offset" => { + offset = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "timezone" => { + if v.is_null() { + continue; + } + timezone = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV1::model::WidgetCalendarAlignedSpanType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let offset = offset.ok_or_else(|| M::Error::missing_field("offset"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = WidgetCalendarAlignedSpan { + hide_incomplete_cost_data, + offset, + timezone, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(WidgetCalendarAlignedSpanVisitor) + } +} diff --git a/src/datadogV1/model/model_widget_calendar_aligned_span_type.rs b/src/datadogV1/model/model_widget_calendar_aligned_span_type.rs new file mode 100644 index 0000000000..3dbd3ff22d --- /dev/null +++ b/src/datadogV1/model/model_widget_calendar_aligned_span_type.rs @@ -0,0 +1,57 @@ +// 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 WidgetCalendarAlignedSpanType { + DAILY, + WEEKLY, + MONTHLY, + YEARLY, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for WidgetCalendarAlignedSpanType { + fn to_string(&self) -> String { + match self { + Self::DAILY => String::from("daily"), + Self::WEEKLY => String::from("weekly"), + Self::MONTHLY => String::from("monthly"), + Self::YEARLY => String::from("yearly"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for WidgetCalendarAlignedSpanType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for WidgetCalendarAlignedSpanType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "daily" => Self::DAILY, + "weekly" => Self::WEEKLY, + "monthly" => Self::MONTHLY, + "yearly" => Self::YEARLY, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV1/model/model_widget_live_span.rs b/src/datadogV1/model/model_widget_live_span.rs index 81dd49ba4d..5e28a81b12 100644 --- a/src/datadogV1/model/model_widget_live_span.rs +++ b/src/datadogV1/model/model_widget_live_span.rs @@ -24,6 +24,9 @@ pub enum WidgetLiveSpan { MONTH_TO_DATE, PAST_ONE_YEAR, ALERT, + FULL_WEEK, + FULL_MONTH, + YEAR_TO_DATE, UnparsedObject(crate::datadog::UnparsedObject), } @@ -47,6 +50,9 @@ impl ToString for WidgetLiveSpan { Self::MONTH_TO_DATE => String::from("month_to_date"), Self::PAST_ONE_YEAR => String::from("1y"), Self::ALERT => String::from("alert"), + Self::FULL_WEEK => String::from("full_week"), + Self::FULL_MONTH => String::from("full_month"), + Self::YEAR_TO_DATE => String::from("year_to_date"), Self::UnparsedObject(v) => v.value.to_string(), } } @@ -88,6 +94,9 @@ impl<'de> Deserialize<'de> for WidgetLiveSpan { "month_to_date" => Self::MONTH_TO_DATE, "1y" => Self::PAST_ONE_YEAR, "alert" => Self::ALERT, + "full_week" => Self::FULL_WEEK, + "full_month" => Self::FULL_MONTH, + "year_to_date" => Self::YEAR_TO_DATE, _ => Self::UnparsedObject(crate::datadog::UnparsedObject { value: serde_json::Value::String(s.into()), }), diff --git a/src/datadogV1/model/model_widget_time.rs b/src/datadogV1/model/model_widget_time.rs index eafa3dced6..3b34578925 100644 --- a/src/datadogV1/model/model_widget_time.rs +++ b/src/datadogV1/model/model_widget_time.rs @@ -11,6 +11,7 @@ pub enum WidgetTime { WidgetLegacyLiveSpan(Box), WidgetNewLiveSpan(Box), WidgetNewFixedSpan(Box), + WidgetCalendarAlignedSpan(Box), UnparsedObject(crate::datadog::UnparsedObject), } @@ -41,6 +42,14 @@ impl<'de> Deserialize<'de> for WidgetTime { return Ok(WidgetTime::WidgetNewFixedSpan(_v)); } } + if let Ok(_v) = serde_json::from_value::< + Box, + >(value.clone()) + { + if !_v._unparsed { + return Ok(WidgetTime::WidgetCalendarAlignedSpan(_v)); + } + } return Ok(WidgetTime::UnparsedObject(crate::datadog::UnparsedObject { value,