Skip to content

Commit 2de9374

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 60bc9127 of spec repo
1 parent c1e5b54 commit 2de9374

5 files changed

+160
-4
lines changed

.apigentools-info

+4-4
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": "2024-09-30 13:56:49.501323",
8-
"spec_repo_commit": "eb66b1cf"
7+
"regenerated": "2024-09-30 14:37:40.714287",
8+
"spec_repo_commit": "60bc9127"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-09-30 13:56:49.516562",
13-
"spec_repo_commit": "eb66b1cf"
12+
"regenerated": "2024-09-30 14:37:40.728525",
13+
"spec_repo_commit": "60bc9127"
1414
}
1515
}
1616
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// Clients deserialize a dashboard with a empty time object
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::FormulaAndFunctionCloudCostDataSource;
7+
use datadog_api_client::datadogV1::model::FormulaAndFunctionCloudCostQueryDefinition;
8+
use datadog_api_client::datadogV1::model::FormulaAndFunctionQueryDefinition;
9+
use datadog_api_client::datadogV1::model::FormulaAndFunctionResponseFormat;
10+
use datadog_api_client::datadogV1::model::TimeseriesWidgetDefinition;
11+
use datadog_api_client::datadogV1::model::TimeseriesWidgetDefinitionType;
12+
use datadog_api_client::datadogV1::model::TimeseriesWidgetRequest;
13+
use datadog_api_client::datadogV1::model::Widget;
14+
use datadog_api_client::datadogV1::model::WidgetDefinition;
15+
use datadog_api_client::datadogV1::model::WidgetDisplayType;
16+
use datadog_api_client::datadogV1::model::WidgetFormula;
17+
use datadog_api_client::datadogV1::model::WidgetLegacyLiveSpan;
18+
use datadog_api_client::datadogV1::model::WidgetLineType;
19+
use datadog_api_client::datadogV1::model::WidgetLineWidth;
20+
use datadog_api_client::datadogV1::model::WidgetRequestStyle;
21+
use datadog_api_client::datadogV1::model::WidgetTextAlign;
22+
use datadog_api_client::datadogV1::model::WidgetTime;
23+
24+
#[tokio::main]
25+
async fn main() {
26+
let body =
27+
Dashboard::new(
28+
DashboardLayoutType::ORDERED,
29+
"Example-Dashboard".to_string(),
30+
vec![
31+
Widget::new(
32+
WidgetDefinition::TimeseriesWidgetDefinition(
33+
Box::new(
34+
TimeseriesWidgetDefinition::new(
35+
vec![
36+
TimeseriesWidgetRequest::new()
37+
.display_type(WidgetDisplayType::BARS)
38+
.formulas(vec![WidgetFormula::new("query1".to_string())])
39+
.queries(
40+
vec![
41+
FormulaAndFunctionQueryDefinition
42+
::FormulaAndFunctionCloudCostQueryDefinition(
43+
Box::new(
44+
FormulaAndFunctionCloudCostQueryDefinition::new(
45+
FormulaAndFunctionCloudCostDataSource::CLOUD_COST,
46+
"query1".to_string(),
47+
"sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)".to_string(),
48+
),
49+
),
50+
)
51+
],
52+
)
53+
.response_format(FormulaAndFunctionResponseFormat::TIMESERIES)
54+
.style(
55+
WidgetRequestStyle::new()
56+
.line_type(WidgetLineType::SOLID)
57+
.line_width(WidgetLineWidth::NORMAL)
58+
.palette("dog_classic".to_string()),
59+
)
60+
],
61+
TimeseriesWidgetDefinitionType::TIMESERIES,
62+
)
63+
.time(WidgetTime::WidgetLegacyLiveSpan(Box::new(WidgetLegacyLiveSpan::new())))
64+
.title("Example Cloud Cost Query".to_string())
65+
.title_align(WidgetTextAlign::LEFT)
66+
.title_size("16".to_string()),
67+
),
68+
),
69+
)
70+
],
71+
);
72+
let configuration = datadog::Configuration::new();
73+
let api = DashboardsAPI::with_config(configuration);
74+
let resp = api.create_dashboard(body).await;
75+
if let Ok(value) = resp {
76+
println!("{:#?}", value);
77+
} else {
78+
println!("{:#?}", resp.unwrap_err());
79+
}
80+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2024-09-24T19:19:31.807Z
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\",\"title\":\"Test-Clients_deserialize_a_dashboard_with_a_empty_time_object-1727205571\",\"widgets\":[{\"definition\":{\"requests\":[{\"display_type\":\"bars\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"data_source\":\"cloud_cost\",\"name\":\"query1\",\"query\":\"sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)\"}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"time\":{},\"title\":\"Example Cloud Cost Query\",\"title_align\":\"left\",\"title_size\":\"16\",\"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\":\"han-5zg-c32\",\"title\":\"Test-Clients_deserialize_a_dashboard_with_a_empty_time_object-1727205571\",\"description\":null,\"author_handle\":\"frog@datadoghq.com\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/han-5zg-c32/test-clientsdeserializeadashboardwithaemptytimeobject-1727205571\",\"is_read_only\":false,\"template_variables\":null,\"widgets\":[{\"definition\":{\"requests\":[{\"display_type\":\"bars\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"data_source\":\"cloud_cost\",\"name\":\"query1\",\"query\":\"sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)\"}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"time\":{},\"title\":\"Example Cloud Cost Query\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"timeseries\"},\"id\":4274057372149908}],\"notify_list\":null,\"created_at\":\"2024-09-24T19:19:32.071328+00:00\",\"modified_at\":\"2024-09-24T19:19:32.071328+00:00\",\"experience_type\":\"default\",\"restricted_roles\":[]}\n",
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": "Tue, 24 Sep 2024 19:19:31 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/han-5zg-c32"
47+
},
48+
"response": {
49+
"body": {
50+
"string": "{\"deleted_dashboard_id\":\"han-5zg-c32\"}\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": "Tue, 24 Sep 2024 19:19:31 GMT"
64+
}
65+
],
66+
"recorded_with": "VCR 6.0.0"
67+
}

tests/scenarios/features/v1/dashboards.feature

+8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ Feature: Dashboards
99
And a valid "appKeyAuth" key in the system
1010
And an instance of "Dashboards" API
1111

12+
@replay-only @team:DataDog/dashboards-backend
13+
Scenario: Clients deserialize a dashboard with a empty time object
14+
Given new "CreateDashboard" request
15+
And body with value { "title": "{{ unique }}", "widgets": [ { "definition": { "title": "Example Cloud Cost Query", "title_size": "16", "title_align": "left", "type": "timeseries", "requests": [ { "formulas": [ { "formula": "query1" } ], "queries": [ { "data_source": "cloud_cost", "name": "query1", "query": "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)" } ], "response_format": "timeseries", "style": { "palette": "dog_classic", "line_type": "solid", "line_width": "normal" }, "display_type": "bars" } ], "time": {} } } ], "layout_type": "ordered" }
16+
When the request is sent
17+
Then the response status is 200 OK
18+
And the response "widgets[0].definition.time" is equal to {}
19+
1220
@team:DataDog/dashboards-backend
1321
Scenario: Create a distribution widget using a histogram request containing a formulas and functions APM Stats query
1422
Given new "CreateDashboard" request

0 commit comments

Comments
 (0)