Skip to content

Commit f2c5334

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit df337ad3 of spec repo
1 parent 41cf25e commit f2c5334

8 files changed

+325
-4
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-02-12 18:33:49.810961",
8-
"spec_repo_commit": "6a4cfb82"
7+
"regenerated": "2025-02-13 13:47:41.521129",
8+
"spec_repo_commit": "df337ad3"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-02-12 18:33:49.826925",
13-
"spec_repo_commit": "6a4cfb82"
12+
"regenerated": "2025-02-13 13:47:41.536225",
13+
"spec_repo_commit": "df337ad3"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17340,11 +17340,13 @@ components:
1734017340
enum:
1734117341
- number
1734217342
- bar
17343+
- trend
1734317344
example: number
1734417345
type: string
1734517346
x-enum-varnames:
1734617347
- NUMBER
1734717348
- BAR
17349+
- TREND
1734817350
TableWidgetDefinition:
1734917351
description: The table visualization is available on timeboards and screenboards.
1735017352
It displays columns of metrics grouped by tag key.
@@ -23033,6 +23035,8 @@ components:
2303323035
type: string
2303423036
cell_display_mode:
2303523037
$ref: '#/components/schemas/TableWidgetCellDisplayMode'
23038+
cell_display_mode_options:
23039+
$ref: '#/components/schemas/WidgetFormulaCellDisplayModeOptions'
2303623040
conditional_formats:
2303723041
description: List of conditional formats.
2303823042
items:
@@ -23049,6 +23053,37 @@ components:
2304923053
required:
2305023054
- formula
2305123055
type: object
23056+
WidgetFormulaCellDisplayModeOptions:
23057+
description: Cell display mode options for the widget formula. (only if cell_display_mode
23058+
is set to `trend`)
23059+
properties:
23060+
trend_type:
23061+
$ref: '#/components/schemas/WidgetFormulaCellDisplayModeOptionsTrendType'
23062+
y_scale:
23063+
$ref: '#/components/schemas/WidgetFormulaCellDisplayModeOptionsYScale'
23064+
type: object
23065+
WidgetFormulaCellDisplayModeOptionsTrendType:
23066+
description: Trend type for the cell display mode options.
23067+
enum:
23068+
- area
23069+
- line
23070+
- bars
23071+
example: area
23072+
type: string
23073+
x-enum-varnames:
23074+
- AREA
23075+
- LINE
23076+
- BARS
23077+
WidgetFormulaCellDisplayModeOptionsYScale:
23078+
description: Y scale for the cell display mode options.
23079+
enum:
23080+
- shared
23081+
- independent
23082+
example: shared
23083+
type: string
23084+
x-enum-varnames:
23085+
- SHARED
23086+
- INDEPENDENT
2305223087
WidgetFormulaLimit:
2305323088
description: Options for limiting results returned.
2305423089
properties:

src/datadogV1/model/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ pub mod model_widget_formula;
152152
pub use self::model_widget_formula::WidgetFormula;
153153
pub mod model_table_widget_cell_display_mode;
154154
pub use self::model_table_widget_cell_display_mode::TableWidgetCellDisplayMode;
155+
pub mod model_widget_formula_cell_display_mode_options;
156+
pub use self::model_widget_formula_cell_display_mode_options::WidgetFormulaCellDisplayModeOptions;
157+
pub mod model_widget_formula_cell_display_mode_options_trend_type;
158+
pub use self::model_widget_formula_cell_display_mode_options_trend_type::WidgetFormulaCellDisplayModeOptionsTrendType;
159+
pub mod model_widget_formula_cell_display_mode_options_y_scale;
160+
pub use self::model_widget_formula_cell_display_mode_options_y_scale::WidgetFormulaCellDisplayModeOptionsYScale;
155161
pub mod model_widget_conditional_format;
156162
pub use self::model_widget_conditional_format::WidgetConditionalFormat;
157163
pub mod model_widget_comparator;

src/datadogV1/model/model_table_widget_cell_display_mode.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
99
pub enum TableWidgetCellDisplayMode {
1010
NUMBER,
1111
BAR,
12+
TREND,
1213
UnparsedObject(crate::datadog::UnparsedObject),
1314
}
1415

@@ -17,6 +18,7 @@ impl ToString for TableWidgetCellDisplayMode {
1718
match self {
1819
Self::NUMBER => String::from("number"),
1920
Self::BAR => String::from("bar"),
21+
Self::TREND => String::from("trend"),
2022
Self::UnparsedObject(v) => v.value.to_string(),
2123
}
2224
}
@@ -43,6 +45,7 @@ impl<'de> Deserialize<'de> for TableWidgetCellDisplayMode {
4345
Ok(match s.as_str() {
4446
"number" => Self::NUMBER,
4547
"bar" => Self::BAR,
48+
"trend" => Self::TREND,
4649
_ => Self::UnparsedObject(crate::datadog::UnparsedObject {
4750
value: serde_json::Value::String(s.into()),
4851
}),

src/datadogV1/model/model_widget_formula.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ pub struct WidgetFormula {
1717
/// Define a display mode for the table cell.
1818
#[serde(rename = "cell_display_mode")]
1919
pub cell_display_mode: Option<crate::datadogV1::model::TableWidgetCellDisplayMode>,
20+
/// Cell display mode options for the widget formula. (only if cell_display_mode is set to `trend`)
21+
#[serde(rename = "cell_display_mode_options")]
22+
pub cell_display_mode_options:
23+
Option<crate::datadogV1::model::WidgetFormulaCellDisplayModeOptions>,
2024
/// List of conditional formats.
2125
#[serde(rename = "conditional_formats")]
2226
pub conditional_formats: Option<Vec<crate::datadogV1::model::WidgetConditionalFormat>>,
@@ -41,6 +45,7 @@ impl WidgetFormula {
4145
WidgetFormula {
4246
alias: None,
4347
cell_display_mode: None,
48+
cell_display_mode_options: None,
4449
conditional_formats: None,
4550
formula,
4651
limit: None,
@@ -63,6 +68,14 @@ impl WidgetFormula {
6368
self
6469
}
6570

71+
pub fn cell_display_mode_options(
72+
mut self,
73+
value: crate::datadogV1::model::WidgetFormulaCellDisplayModeOptions,
74+
) -> Self {
75+
self.cell_display_mode_options = Some(value);
76+
self
77+
}
78+
6679
pub fn conditional_formats(
6780
mut self,
6881
value: Vec<crate::datadogV1::model::WidgetConditionalFormat>,
@@ -111,6 +124,9 @@ impl<'de> Deserialize<'de> for WidgetFormula {
111124
let mut cell_display_mode: Option<
112125
crate::datadogV1::model::TableWidgetCellDisplayMode,
113126
> = None;
127+
let mut cell_display_mode_options: Option<
128+
crate::datadogV1::model::WidgetFormulaCellDisplayModeOptions,
129+
> = None;
114130
let mut conditional_formats: Option<
115131
Vec<crate::datadogV1::model::WidgetConditionalFormat>,
116132
> = None;
@@ -146,6 +162,13 @@ impl<'de> Deserialize<'de> for WidgetFormula {
146162
}
147163
}
148164
}
165+
"cell_display_mode_options" => {
166+
if v.is_null() {
167+
continue;
168+
}
169+
cell_display_mode_options =
170+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
171+
}
149172
"conditional_formats" => {
150173
if v.is_null() {
151174
continue;
@@ -180,6 +203,7 @@ impl<'de> Deserialize<'de> for WidgetFormula {
180203
let content = WidgetFormula {
181204
alias,
182205
cell_display_mode,
206+
cell_display_mode_options,
183207
conditional_formats,
184208
formula,
185209
limit,
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
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+
use serde::de::{Error, MapAccess, Visitor};
5+
use serde::{Deserialize, Deserializer, Serialize};
6+
use serde_with::skip_serializing_none;
7+
use std::fmt::{self, Formatter};
8+
9+
/// Cell display mode options for the widget formula. (only if cell_display_mode is set to `trend`)
10+
#[non_exhaustive]
11+
#[skip_serializing_none]
12+
#[derive(Clone, Debug, PartialEq, Serialize)]
13+
pub struct WidgetFormulaCellDisplayModeOptions {
14+
/// Trend type for the cell display mode options.
15+
#[serde(rename = "trend_type")]
16+
pub trend_type: Option<crate::datadogV1::model::WidgetFormulaCellDisplayModeOptionsTrendType>,
17+
/// Y scale for the cell display mode options.
18+
#[serde(rename = "y_scale")]
19+
pub y_scale: Option<crate::datadogV1::model::WidgetFormulaCellDisplayModeOptionsYScale>,
20+
#[serde(flatten)]
21+
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
22+
#[serde(skip)]
23+
#[serde(default)]
24+
pub(crate) _unparsed: bool,
25+
}
26+
27+
impl WidgetFormulaCellDisplayModeOptions {
28+
pub fn new() -> WidgetFormulaCellDisplayModeOptions {
29+
WidgetFormulaCellDisplayModeOptions {
30+
trend_type: None,
31+
y_scale: None,
32+
additional_properties: std::collections::BTreeMap::new(),
33+
_unparsed: false,
34+
}
35+
}
36+
37+
pub fn trend_type(
38+
mut self,
39+
value: crate::datadogV1::model::WidgetFormulaCellDisplayModeOptionsTrendType,
40+
) -> Self {
41+
self.trend_type = Some(value);
42+
self
43+
}
44+
45+
pub fn y_scale(
46+
mut self,
47+
value: crate::datadogV1::model::WidgetFormulaCellDisplayModeOptionsYScale,
48+
) -> Self {
49+
self.y_scale = Some(value);
50+
self
51+
}
52+
53+
pub fn additional_properties(
54+
mut self,
55+
value: std::collections::BTreeMap<String, serde_json::Value>,
56+
) -> Self {
57+
self.additional_properties = value;
58+
self
59+
}
60+
}
61+
62+
impl Default for WidgetFormulaCellDisplayModeOptions {
63+
fn default() -> Self {
64+
Self::new()
65+
}
66+
}
67+
68+
impl<'de> Deserialize<'de> for WidgetFormulaCellDisplayModeOptions {
69+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
70+
where
71+
D: Deserializer<'de>,
72+
{
73+
struct WidgetFormulaCellDisplayModeOptionsVisitor;
74+
impl<'a> Visitor<'a> for WidgetFormulaCellDisplayModeOptionsVisitor {
75+
type Value = WidgetFormulaCellDisplayModeOptions;
76+
77+
fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
78+
f.write_str("a mapping")
79+
}
80+
81+
fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
82+
where
83+
M: MapAccess<'a>,
84+
{
85+
let mut trend_type: Option<
86+
crate::datadogV1::model::WidgetFormulaCellDisplayModeOptionsTrendType,
87+
> = None;
88+
let mut y_scale: Option<
89+
crate::datadogV1::model::WidgetFormulaCellDisplayModeOptionsYScale,
90+
> = None;
91+
let mut additional_properties: std::collections::BTreeMap<
92+
String,
93+
serde_json::Value,
94+
> = std::collections::BTreeMap::new();
95+
let mut _unparsed = false;
96+
97+
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
98+
match k.as_str() {
99+
"trend_type" => {
100+
if v.is_null() {
101+
continue;
102+
}
103+
trend_type = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
104+
if let Some(ref _trend_type) = trend_type {
105+
match _trend_type {
106+
crate::datadogV1::model::WidgetFormulaCellDisplayModeOptionsTrendType::UnparsedObject(_trend_type) => {
107+
_unparsed = true;
108+
},
109+
_ => {}
110+
}
111+
}
112+
}
113+
"y_scale" => {
114+
if v.is_null() {
115+
continue;
116+
}
117+
y_scale = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
118+
if let Some(ref _y_scale) = y_scale {
119+
match _y_scale {
120+
crate::datadogV1::model::WidgetFormulaCellDisplayModeOptionsYScale::UnparsedObject(_y_scale) => {
121+
_unparsed = true;
122+
},
123+
_ => {}
124+
}
125+
}
126+
}
127+
&_ => {
128+
if let Ok(value) = serde_json::from_value(v.clone()) {
129+
additional_properties.insert(k, value);
130+
}
131+
}
132+
}
133+
}
134+
135+
let content = WidgetFormulaCellDisplayModeOptions {
136+
trend_type,
137+
y_scale,
138+
additional_properties,
139+
_unparsed,
140+
};
141+
142+
Ok(content)
143+
}
144+
}
145+
146+
deserializer.deserialize_any(WidgetFormulaCellDisplayModeOptionsVisitor)
147+
}
148+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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 WidgetFormulaCellDisplayModeOptionsTrendType {
10+
AREA,
11+
LINE,
12+
BARS,
13+
UnparsedObject(crate::datadog::UnparsedObject),
14+
}
15+
16+
impl ToString for WidgetFormulaCellDisplayModeOptionsTrendType {
17+
fn to_string(&self) -> String {
18+
match self {
19+
Self::AREA => String::from("area"),
20+
Self::LINE => String::from("line"),
21+
Self::BARS => String::from("bars"),
22+
Self::UnparsedObject(v) => v.value.to_string(),
23+
}
24+
}
25+
}
26+
27+
impl Serialize for WidgetFormulaCellDisplayModeOptionsTrendType {
28+
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
29+
where
30+
S: Serializer,
31+
{
32+
match self {
33+
Self::UnparsedObject(v) => v.serialize(serializer),
34+
_ => serializer.serialize_str(self.to_string().as_str()),
35+
}
36+
}
37+
}
38+
39+
impl<'de> Deserialize<'de> for WidgetFormulaCellDisplayModeOptionsTrendType {
40+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
41+
where
42+
D: Deserializer<'de>,
43+
{
44+
let s: String = String::deserialize(deserializer)?;
45+
Ok(match s.as_str() {
46+
"area" => Self::AREA,
47+
"line" => Self::LINE,
48+
"bars" => Self::BARS,
49+
_ => Self::UnparsedObject(crate::datadog::UnparsedObject {
50+
value: serde_json::Value::String(s.into()),
51+
}),
52+
})
53+
}
54+
}

0 commit comments

Comments
 (0)