Skip to content

Commit be20633

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Extend Widget time schema with support for hide_incomplete_cost_data (#874)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 5efce7d commit be20633

14 files changed

+95
-27
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24164,6 +24164,9 @@ components:
2416424164
additionalProperties: false
2416524165
description: Wrapper for live span
2416624166
properties:
24167+
hide_incomplete_cost_data:
24168+
description: Whether to hide incomplete cost data in the widget.
24169+
type: boolean
2416724170
live_span:
2416824171
$ref: '#/components/schemas/WidgetLiveSpan'
2416924172
type: object
@@ -24364,6 +24367,9 @@ components:
2436424367
format: int64
2436524368
minimum: 0
2436624369
type: integer
24370+
hide_incomplete_cost_data:
24371+
description: Whether to hide incomplete cost data in the widget.
24372+
type: boolean
2436724373
to:
2436824374
description: End time in seconds since epoch.
2436924375
example: 1712083128
@@ -24388,6 +24394,9 @@ components:
2438824394
WidgetNewLiveSpan:
2438924395
description: Used for arbitrary live span times, such as 17 minutes or 6 hours.
2439024396
properties:
24397+
hide_incomplete_cost_data:
24398+
description: Whether to hide incomplete cost data in the widget.
24399+
type: boolean
2439124400
type:
2439224401
$ref: '#/components/schemas/WidgetNewLiveSpanType'
2439324402
unit:

examples/v1_dashboards_CreateDashboard_3066042014.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ async fn main() {
9494
WidgetNewLiveSpanType::LIVE,
9595
WidgetLiveSpanUnit::MINUTE,
9696
8,
97-
),
97+
).hide_incomplete_cost_data(true),
9898
),
9999
),
100100
)

examples/v1_dashboards_CreateDashboard_3451918078.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ async fn main() {
9393
1712080128,
9494
1712083128,
9595
WidgetNewFixedSpanType::FIXED,
96-
),
96+
).hide_incomplete_cost_data(true),
9797
),
9898
),
9999
)

examples/v1_dashboards_CreateDashboard_4262729673.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ async fn main() {
8989
.time(
9090
WidgetTime::WidgetLegacyLiveSpan(
9191
Box::new(
92-
WidgetLegacyLiveSpan::new().live_span(WidgetLiveSpan::PAST_FIVE_MINUTES),
92+
WidgetLegacyLiveSpan::new()
93+
.hide_incomplete_cost_data(true)
94+
.live_span(WidgetLiveSpan::PAST_FIVE_MINUTES),
9395
),
9496
),
9597
)

src/datadogV1/model/model_widget_legacy_live_span.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ use std::fmt::{self, Formatter};
1111
#[skip_serializing_none]
1212
#[derive(Clone, Debug, PartialEq, Serialize)]
1313
pub struct WidgetLegacyLiveSpan {
14+
/// Whether to hide incomplete cost data in the widget.
15+
#[serde(rename = "hide_incomplete_cost_data")]
16+
pub hide_incomplete_cost_data: Option<bool>,
1417
/// The available timeframes depend on the widget you are using.
1518
#[serde(rename = "live_span")]
1619
pub live_span: Option<crate::datadogV1::model::WidgetLiveSpan>,
@@ -22,11 +25,17 @@ pub struct WidgetLegacyLiveSpan {
2225
impl WidgetLegacyLiveSpan {
2326
pub fn new() -> WidgetLegacyLiveSpan {
2427
WidgetLegacyLiveSpan {
28+
hide_incomplete_cost_data: None,
2529
live_span: None,
2630
_unparsed: false,
2731
}
2832
}
2933

34+
pub fn hide_incomplete_cost_data(mut self, value: bool) -> Self {
35+
self.hide_incomplete_cost_data = Some(value);
36+
self
37+
}
38+
3039
pub fn live_span(mut self, value: crate::datadogV1::model::WidgetLiveSpan) -> Self {
3140
self.live_span = Some(value);
3241
self
@@ -56,11 +65,19 @@ impl<'de> Deserialize<'de> for WidgetLegacyLiveSpan {
5665
where
5766
M: MapAccess<'a>,
5867
{
68+
let mut hide_incomplete_cost_data: Option<bool> = None;
5969
let mut live_span: Option<crate::datadogV1::model::WidgetLiveSpan> = None;
6070
let mut _unparsed = false;
6171

6272
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
6373
match k.as_str() {
74+
"hide_incomplete_cost_data" => {
75+
if v.is_null() {
76+
continue;
77+
}
78+
hide_incomplete_cost_data =
79+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
80+
}
6481
"live_span" => {
6582
if v.is_null() {
6683
continue;
@@ -86,6 +103,7 @@ impl<'de> Deserialize<'de> for WidgetLegacyLiveSpan {
86103
}
87104

88105
let content = WidgetLegacyLiveSpan {
106+
hide_incomplete_cost_data,
89107
live_span,
90108
_unparsed,
91109
};

src/datadogV1/model/model_widget_new_fixed_span.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ pub struct WidgetNewFixedSpan {
1414
/// Start time in seconds since epoch.
1515
#[serde(rename = "from")]
1616
pub from: i64,
17+
/// Whether to hide incomplete cost data in the widget.
18+
#[serde(rename = "hide_incomplete_cost_data")]
19+
pub hide_incomplete_cost_data: Option<bool>,
1720
/// End time in seconds since epoch.
1821
#[serde(rename = "to")]
1922
pub to: i64,
@@ -35,13 +38,19 @@ impl WidgetNewFixedSpan {
3538
) -> WidgetNewFixedSpan {
3639
WidgetNewFixedSpan {
3740
from,
41+
hide_incomplete_cost_data: None,
3842
to,
3943
type_,
4044
additional_properties: std::collections::BTreeMap::new(),
4145
_unparsed: false,
4246
}
4347
}
4448

49+
pub fn hide_incomplete_cost_data(mut self, value: bool) -> Self {
50+
self.hide_incomplete_cost_data = Some(value);
51+
self
52+
}
53+
4554
pub fn additional_properties(
4655
mut self,
4756
value: std::collections::BTreeMap<String, serde_json::Value>,
@@ -69,6 +78,7 @@ impl<'de> Deserialize<'de> for WidgetNewFixedSpan {
6978
M: MapAccess<'a>,
7079
{
7180
let mut from: Option<i64> = None;
81+
let mut hide_incomplete_cost_data: Option<bool> = None;
7282
let mut to: Option<i64> = None;
7383
let mut type_: Option<crate::datadogV1::model::WidgetNewFixedSpanType> = None;
7484
let mut additional_properties: std::collections::BTreeMap<
@@ -82,6 +92,13 @@ impl<'de> Deserialize<'de> for WidgetNewFixedSpan {
8292
"from" => {
8393
from = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
8494
}
95+
"hide_incomplete_cost_data" => {
96+
if v.is_null() {
97+
continue;
98+
}
99+
hide_incomplete_cost_data =
100+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
101+
}
85102
"to" => {
86103
to = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
87104
}
@@ -109,6 +126,7 @@ impl<'de> Deserialize<'de> for WidgetNewFixedSpan {
109126

110127
let content = WidgetNewFixedSpan {
111128
from,
129+
hide_incomplete_cost_data,
112130
to,
113131
type_,
114132
additional_properties,

src/datadogV1/model/model_widget_new_live_span.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ use std::fmt::{self, Formatter};
1111
#[skip_serializing_none]
1212
#[derive(Clone, Debug, PartialEq, Serialize)]
1313
pub struct WidgetNewLiveSpan {
14+
/// Whether to hide incomplete cost data in the widget.
15+
#[serde(rename = "hide_incomplete_cost_data")]
16+
pub hide_incomplete_cost_data: Option<bool>,
1417
/// Type "live" denotes a live span in the new format.
1518
#[serde(rename = "type")]
1619
pub type_: crate::datadogV1::model::WidgetNewLiveSpanType,
@@ -34,6 +37,7 @@ impl WidgetNewLiveSpan {
3437
value: i64,
3538
) -> WidgetNewLiveSpan {
3639
WidgetNewLiveSpan {
40+
hide_incomplete_cost_data: None,
3741
type_,
3842
unit,
3943
value,
@@ -42,6 +46,11 @@ impl WidgetNewLiveSpan {
4246
}
4347
}
4448

49+
pub fn hide_incomplete_cost_data(mut self, value: bool) -> Self {
50+
self.hide_incomplete_cost_data = Some(value);
51+
self
52+
}
53+
4554
pub fn additional_properties(
4655
mut self,
4756
value: std::collections::BTreeMap<String, serde_json::Value>,
@@ -68,6 +77,7 @@ impl<'de> Deserialize<'de> for WidgetNewLiveSpan {
6877
where
6978
M: MapAccess<'a>,
7079
{
80+
let mut hide_incomplete_cost_data: Option<bool> = None;
7181
let mut type_: Option<crate::datadogV1::model::WidgetNewLiveSpanType> = None;
7282
let mut unit: Option<crate::datadogV1::model::WidgetLiveSpanUnit> = None;
7383
let mut value: Option<i64> = None;
@@ -79,6 +89,13 @@ impl<'de> Deserialize<'de> for WidgetNewLiveSpan {
7989

8090
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
8191
match k.as_str() {
92+
"hide_incomplete_cost_data" => {
93+
if v.is_null() {
94+
continue;
95+
}
96+
hide_incomplete_cost_data =
97+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
98+
}
8299
"type" => {
83100
type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
84101
if let Some(ref _type_) = type_ {
@@ -118,6 +135,7 @@ impl<'de> Deserialize<'de> for WidgetNewLiveSpan {
118135
let value = value.ok_or_else(|| M::Error::missing_field("value"))?;
119136

120137
let content = WidgetNewLiveSpan {
138+
hide_incomplete_cost_data,
121139
type_,
122140
unit,
123141
value,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-11-15T19:33:02.539Z
1+
2025-08-26T19:47:58.449Z

tests/scenarios/cassettes/v1/dashboards/Create-a-new-timeseries-widget-with-legacy-live-span-time-format.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": "{\"layout_type\":\"ordered\",\"reflow_type\":\"auto\",\"title\":\"Test-Create_a_new_timeseries_widget_with_legacy_live_span_time_format-1731699182 with legacy live span time\",\"widgets\":[{\"definition\":{\"legend_columns\":[\"avg\",\"min\",\"max\",\"value\",\"sum\"],\"legend_layout\":\"auto\",\"requests\":[{\"display_type\":\"line\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"compute\":{\"aggregation\":\"count\",\"metric\":\"@ci.queue_time\"},\"data_source\":\"ci_pipelines\",\"group_by\":[],\"indexes\":[\"*\"],\"name\":\"query1\",\"search\":{\"query\":\"ci_level:job\"}}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"show_legend\":true,\"time\":{\"live_span\":\"5m\"},\"title\":\"\",\"type\":\"timeseries\"}}]}",
6+
"string": "{\"layout_type\":\"ordered\",\"reflow_type\":\"auto\",\"title\":\"Test-Create_a_new_timeseries_widget_with_legacy_live_span_time_format-1756237678 with legacy live span time\",\"widgets\":[{\"definition\":{\"legend_columns\":[\"avg\",\"min\",\"max\",\"value\",\"sum\"],\"legend_layout\":\"auto\",\"requests\":[{\"display_type\":\"line\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"compute\":{\"aggregation\":\"count\",\"metric\":\"@ci.queue_time\"},\"data_source\":\"ci_pipelines\",\"group_by\":[],\"indexes\":[\"*\"],\"name\":\"query1\",\"search\":{\"query\":\"ci_level:job\"}}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"show_legend\":true,\"time\":{\"hide_incomplete_cost_data\":true,\"live_span\":\"5m\"},\"title\":\"\",\"type\":\"timeseries\"}}]}",
77
"encoding": null
88
},
99
"headers": {
@@ -19,7 +19,7 @@
1919
},
2020
"response": {
2121
"body": {
22-
"string": "{\"id\":\"3zr-n9a-dfd\",\"title\":\"Test-Create_a_new_timeseries_widget_with_legacy_live_span_time_format-1731699182 with legacy live span time\",\"description\":null,\"author_handle\":\"[email protected]\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/3zr-n9a-dfd/test-createanewtimeserieswidgetwithlegacylivespantimeformat-1731699182-with-lega\",\"is_read_only\":false,\"template_variables\":null,\"widgets\":[{\"definition\":{\"legend_columns\":[\"avg\",\"min\",\"max\",\"value\",\"sum\"],\"legend_layout\":\"auto\",\"requests\":[{\"display_type\":\"line\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"compute\":{\"aggregation\":\"count\",\"metric\":\"@ci.queue_time\"},\"data_source\":\"ci_pipelines\",\"group_by\":[],\"indexes\":[\"*\"],\"name\":\"query1\",\"search\":{\"query\":\"ci_level:job\"}}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"show_legend\":true,\"time\":{\"live_span\":\"5m\"},\"title\":\"\",\"type\":\"timeseries\"},\"id\":5376392318113781}],\"notify_list\":null,\"created_at\":\"2024-11-15T19:33:02.697929+00:00\",\"modified_at\":\"2024-11-15T19:33:02.697929+00:00\",\"reflow_type\":\"auto\",\"restricted_roles\":[]}\n",
22+
"string": "{\"id\":\"wek-eci-qnn\",\"title\":\"Test-Create_a_new_timeseries_widget_with_legacy_live_span_time_format-1756237678 with legacy live span time\",\"description\":null,\"author_handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"author_name\":\"CI Account\",\"layout_type\":\"ordered\",\"url\":\"/dashboard/wek-eci-qnn/test-createanewtimeserieswidgetwithlegacylivespantimeformat-1756237678-with-lega\",\"template_variables\":null,\"widgets\":[{\"definition\":{\"legend_columns\":[\"avg\",\"min\",\"max\",\"value\",\"sum\"],\"legend_layout\":\"auto\",\"requests\":[{\"display_type\":\"line\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"compute\":{\"aggregation\":\"count\",\"metric\":\"@ci.queue_time\"},\"data_source\":\"ci_pipelines\",\"group_by\":[],\"indexes\":[\"*\"],\"name\":\"query1\",\"search\":{\"query\":\"ci_level:job\"}}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"show_legend\":true,\"time\":{\"hide_incomplete_cost_data\":true,\"live_span\":\"5m\"},\"title\":\"\",\"type\":\"timeseries\"},\"id\":3088384387119347}],\"notify_list\":null,\"created_at\":\"2025-08-26T19:47:58.616519+00:00\",\"modified_at\":\"2025-08-26T19:47:58.616519+00:00\",\"reflow_type\":\"auto\",\"restricted_roles\":[]}",
2323
"encoding": null
2424
},
2525
"headers": {
@@ -32,7 +32,7 @@
3232
"message": "OK"
3333
}
3434
},
35-
"recorded_at": "Fri, 15 Nov 2024 19:33:02 GMT"
35+
"recorded_at": "Tue, 26 Aug 2025 19:47:58 GMT"
3636
},
3737
{
3838
"request": {
@@ -43,11 +43,11 @@
4343
]
4444
},
4545
"method": "delete",
46-
"uri": "https://api.datadoghq.com/api/v1/dashboard/3zr-n9a-dfd"
46+
"uri": "https://api.datadoghq.com/api/v1/dashboard/wek-eci-qnn"
4747
},
4848
"response": {
4949
"body": {
50-
"string": "{\"deleted_dashboard_id\":\"3zr-n9a-dfd\"}\n",
50+
"string": "{\"deleted_dashboard_id\":\"wek-eci-qnn\"}\n",
5151
"encoding": null
5252
},
5353
"headers": {
@@ -60,7 +60,7 @@
6060
"message": "OK"
6161
}
6262
},
63-
"recorded_at": "Fri, 15 Nov 2024 19:33:02 GMT"
63+
"recorded_at": "Tue, 26 Aug 2025 19:47:58 GMT"
6464
}
6565
],
6666
"recorded_with": "VCR 6.0.0"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-11-15T19:33:02.942Z
1+
2025-08-26T19:47:58.908Z

0 commit comments

Comments
 (0)