Skip to content

Commit fcfd5c4

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 442428b of spec repo
1 parent 2804e33 commit fcfd5c4

File tree

6 files changed

+185
-0
lines changed

6 files changed

+185
-0
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2875,6 +2875,7 @@ components:
28752875
- ci_tests
28762876
- ci_pipelines
28772877
- incident_analytics
2878+
- product_analytics
28782879
example: logs
28792880
type: string
28802881
x-enum-varnames:
@@ -2889,6 +2890,7 @@ components:
28892890
- CI_TESTS
28902891
- CI_PIPELINES
28912892
- INCIDENT_ANALYTICS
2893+
- PRODUCT_ANALYTICS
28922894
FormulaAndFunctionMetricAggregation:
28932895
description: The aggregation methods available for metrics queries.
28942896
enum:
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
// Create a new timeseries widget with product_analytics data source
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
4+
use datadog_api_client::datadogV1::model::Dashboard;
5+
use datadog_api_client::datadogV1::model::DashboardLayoutType;
6+
use datadog_api_client::datadogV1::model::DashboardReflowType;
7+
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventAggregation;
8+
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinition;
9+
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinitionCompute;
10+
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinitionSearch;
11+
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventsDataSource;
12+
use datadog_api_client::datadogV1::model::FormulaAndFunctionQueryDefinition;
13+
use datadog_api_client::datadogV1::model::FormulaAndFunctionResponseFormat;
14+
use datadog_api_client::datadogV1::model::TimeseriesWidgetDefinition;
15+
use datadog_api_client::datadogV1::model::TimeseriesWidgetDefinitionType;
16+
use datadog_api_client::datadogV1::model::TimeseriesWidgetLegendColumn;
17+
use datadog_api_client::datadogV1::model::TimeseriesWidgetLegendLayout;
18+
use datadog_api_client::datadogV1::model::TimeseriesWidgetRequest;
19+
use datadog_api_client::datadogV1::model::Widget;
20+
use datadog_api_client::datadogV1::model::WidgetDefinition;
21+
use datadog_api_client::datadogV1::model::WidgetDisplayType;
22+
use datadog_api_client::datadogV1::model::WidgetFormula;
23+
use datadog_api_client::datadogV1::model::WidgetLegacyLiveSpan;
24+
use datadog_api_client::datadogV1::model::WidgetLineType;
25+
use datadog_api_client::datadogV1::model::WidgetLineWidth;
26+
use datadog_api_client::datadogV1::model::WidgetRequestStyle;
27+
use datadog_api_client::datadogV1::model::WidgetTime;
28+
29+
#[tokio::main]
30+
async fn main() {
31+
let body =
32+
Dashboard::new(
33+
DashboardLayoutType::ORDERED,
34+
"Example-Dashboard with product_analytics datasource".to_string(),
35+
vec![
36+
Widget::new(
37+
WidgetDefinition::TimeseriesWidgetDefinition(
38+
Box::new(
39+
TimeseriesWidgetDefinition::new(
40+
vec![
41+
TimeseriesWidgetRequest::new()
42+
.display_type(WidgetDisplayType::LINE)
43+
.formulas(vec![WidgetFormula::new("query1".to_string())])
44+
.queries(
45+
vec![
46+
FormulaAndFunctionQueryDefinition
47+
::FormulaAndFunctionEventQueryDefinition(
48+
Box::new(
49+
FormulaAndFunctionEventQueryDefinition::new(
50+
FormulaAndFunctionEventQueryDefinitionCompute::new(
51+
FormulaAndFunctionEventAggregation::COUNT,
52+
),
53+
FormulaAndFunctionEventsDataSource::PRODUCT_ANALYTICS,
54+
"query1".to_string(),
55+
)
56+
.group_by(vec![])
57+
.indexes(vec!["*".to_string()])
58+
.search(
59+
FormulaAndFunctionEventQueryDefinitionSearch::new(
60+
"test_level:test".to_string(),
61+
),
62+
),
63+
),
64+
)
65+
],
66+
)
67+
.response_format(FormulaAndFunctionResponseFormat::TIMESERIES)
68+
.style(
69+
WidgetRequestStyle::new()
70+
.line_type(WidgetLineType::SOLID)
71+
.line_width(WidgetLineWidth::NORMAL)
72+
.palette("dog_classic".to_string()),
73+
)
74+
],
75+
TimeseriesWidgetDefinitionType::TIMESERIES,
76+
)
77+
.legend_columns(
78+
vec![
79+
TimeseriesWidgetLegendColumn::AVG,
80+
TimeseriesWidgetLegendColumn::MIN,
81+
TimeseriesWidgetLegendColumn::MAX,
82+
TimeseriesWidgetLegendColumn::VALUE,
83+
TimeseriesWidgetLegendColumn::SUM
84+
],
85+
)
86+
.legend_layout(TimeseriesWidgetLegendLayout::AUTO)
87+
.show_legend(true)
88+
.time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
89+
.title("".to_string()),
90+
),
91+
),
92+
)
93+
],
94+
).reflow_type(DashboardReflowType::AUTO);
95+
let configuration = datadog::Configuration::new();
96+
let api = DashboardsAPI::with_config(configuration);
97+
let resp = api.create_dashboard(body).await;
98+
if let Ok(value) = resp {
99+
println!("{:#?}", value);
100+
} else {
101+
println!("{:#?}", resp.unwrap_err());
102+
}
103+
}

src/datadogV1/model/model_formula_and_function_events_data_source.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub enum FormulaAndFunctionEventsDataSource {
1818
CI_TESTS,
1919
CI_PIPELINES,
2020
INCIDENT_ANALYTICS,
21+
PRODUCT_ANALYTICS,
2122
UnparsedObject(crate::datadog::UnparsedObject),
2223
}
2324

@@ -35,6 +36,7 @@ impl ToString for FormulaAndFunctionEventsDataSource {
3536
Self::CI_TESTS => String::from("ci_tests"),
3637
Self::CI_PIPELINES => String::from("ci_pipelines"),
3738
Self::INCIDENT_ANALYTICS => String::from("incident_analytics"),
39+
Self::PRODUCT_ANALYTICS => String::from("product_analytics"),
3840
Self::UnparsedObject(v) => v.value.to_string(),
3941
}
4042
}
@@ -70,6 +72,7 @@ impl<'de> Deserialize<'de> for FormulaAndFunctionEventsDataSource {
7072
"ci_tests" => Self::CI_TESTS,
7173
"ci_pipelines" => Self::CI_PIPELINES,
7274
"incident_analytics" => Self::INCIDENT_ANALYTICS,
75+
"product_analytics" => Self::PRODUCT_ANALYTICS,
7376
_ => Self::UnparsedObject(crate::datadog::UnparsedObject {
7477
value: serde_json::Value::String(s.into()),
7578
}),
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-09-18T18:51:17.951Z
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"http_interactions": [
3+
{
4+
"request": {
5+
"body": {
6+
"string": "{\"layout_type\":\"ordered\",\"reflow_type\":\"auto\",\"title\":\"Test-Create_a_new_timeseries_widget_with_product_analytics_data_source-1758221477 with product_analytics datasource\",\"widgets\":[{\"definition\":{\"legend_columns\":[\"avg\",\"min\",\"max\",\"value\",\"sum\"],\"legend_layout\":\"auto\",\"requests\":[{\"display_type\":\"line\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"compute\":{\"aggregation\":\"count\"},\"data_source\":\"product_analytics\",\"group_by\":[],\"indexes\":[\"*\"],\"name\":\"query1\",\"search\":{\"query\":\"test_level:test\"}}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"show_legend\":true,\"time\":{},\"title\":\"\",\"type\":\"timeseries\"}}]}",
7+
"encoding": null
8+
},
9+
"headers": {
10+
"Accept": [
11+
"application/json"
12+
],
13+
"Content-Type": [
14+
"application/json"
15+
]
16+
},
17+
"method": "post",
18+
"uri": "https://api.datadoghq.com/api/v1/dashboard"
19+
},
20+
"response": {
21+
"body": {
22+
"string": "{\"id\":\"zvr-td5-ppm\",\"title\":\"Test-Create_a_new_timeseries_widget_with_product_analytics_data_source-1758221477 with product_analytics datasource\",\"description\":null,\"author_handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"author_name\":\"CI Account\",\"layout_type\":\"ordered\",\"url\":\"/dashboard/zvr-td5-ppm/test-createanewtimeserieswidgetwithproductanalyticsdatasource-1758221477-with-pr\",\"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\"},\"data_source\":\"product_analytics\",\"group_by\":[],\"indexes\":[\"*\"],\"name\":\"query1\",\"search\":{\"query\":\"test_level:test\"}}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"show_legend\":true,\"time\":{},\"title\":\"\",\"type\":\"timeseries\"},\"id\":6058978575853641}],\"notify_list\":null,\"created_at\":\"2025-09-18T18:51:18.107135+00:00\",\"modified_at\":\"2025-09-18T18:51:18.107135+00:00\",\"reflow_type\":\"auto\",\"restricted_roles\":[]}",
23+
"encoding": null
24+
},
25+
"headers": {
26+
"Content-Type": [
27+
"application/json"
28+
]
29+
},
30+
"status": {
31+
"code": 200,
32+
"message": "OK"
33+
}
34+
},
35+
"recorded_at": "Thu, 18 Sep 2025 18:51:17 GMT"
36+
},
37+
{
38+
"request": {
39+
"body": "",
40+
"headers": {
41+
"Accept": [
42+
"application/json"
43+
]
44+
},
45+
"method": "delete",
46+
"uri": "https://api.datadoghq.com/api/v1/dashboard/zvr-td5-ppm"
47+
},
48+
"response": {
49+
"body": {
50+
"string": "{\"deleted_dashboard_id\":\"zvr-td5-ppm\"}\n",
51+
"encoding": null
52+
},
53+
"headers": {
54+
"Content-Type": [
55+
"application/json"
56+
]
57+
},
58+
"status": {
59+
"code": 200,
60+
"message": "OK"
61+
}
62+
},
63+
"recorded_at": "Thu, 18 Sep 2025 18:51:17 GMT"
64+
}
65+
],
66+
"recorded_with": "VCR 6.0.0"
67+
}

tests/scenarios/features/v1/dashboards.feature

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,15 @@ Feature: Dashboards
950950
And the response "widgets[0].definition.time.value" is equal to 8
951951
And the response "widgets[0].definition.time.hide_incomplete_cost_data" is equal to true
952952

953+
@team:DataDog/dashboards-backend
954+
Scenario: Create a new timeseries widget with product_analytics data source
955+
Given new "CreateDashboard" request
956+
And body with value {"title":"{{ unique }} with product_analytics datasource","widgets":[{"definition":{"title":"","show_legend":true,"legend_layout":"auto","legend_columns":["avg","min","max","value","sum"],"time":{},"type":"timeseries","requests":[{"formulas":[{"formula":"query1"}],"queries":[{"data_source":"product_analytics","name":"query1","search":{"query":"test_level:test"},"indexes":["*"],"compute":{"aggregation":"count"},"group_by":[]}],"response_format":"timeseries","style":{"palette":"dog_classic","line_type":"solid","line_width":"normal"},"display_type":"line"}]}}],"layout_type":"ordered","reflow_type":"auto"}
957+
When the request is sent
958+
Then the response status is 200 OK
959+
And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "product_analytics"
960+
And the response "widgets[0].definition.requests[0].queries[0].search.query" is equal to "test_level:test"
961+
953962
@generated @skip @team:DataDog/reporting-and-sharing
954963
Scenario: Create a shared dashboard returns "Bad Request" response
955964
Given new "CreatePublicDashboard" request

0 commit comments

Comments
 (0)