Skip to content

Commit 085689f

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add week_to_date and month_to_date to widget livespan (#2071)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent fe8c80c commit 085689f

File tree

7 files changed

+41
-15
lines changed

7 files changed

+41
-15
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": "2023-11-17 20:28:34.664609",
8-
"spec_repo_commit": "7fb616ae"
7+
"regenerated": "2023-11-20 19:20:11.573745",
8+
"spec_repo_commit": "55cf29a4"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2023-11-17 20:28:34.680209",
13-
"spec_repo_commit": "7fb616ae"
12+
"regenerated": "2023-11-20 19:20:11.589405",
13+
"spec_repo_commit": "55cf29a4"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20955,6 +20955,8 @@ components:
2095520955
- 1mo
2095620956
- 3mo
2095720957
- 6mo
20958+
- week_to_date
20959+
- month_to_date
2095820960
- 1y
2095920961
- alert
2096020962
example: 5m
@@ -20973,6 +20975,8 @@ components:
2097320975
- PAST_ONE_MONTH
2097420976
- PAST_THREE_MONTHS
2097520977
- PAST_SIX_MONTHS
20978+
- WEEK_TO_DATE
20979+
- MONTH_TO_DATE
2097620980
- PAST_ONE_YEAR
2097720981
- ALERT
2097820982
WidgetMargin:

examples/v1/dashboards/CreateDashboard_1284514532.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
import com.datadog.api.client.v1.model.WidgetFormula;
1919
import com.datadog.api.client.v1.model.WidgetLineType;
2020
import com.datadog.api.client.v1.model.WidgetLineWidth;
21+
import com.datadog.api.client.v1.model.WidgetLiveSpan;
2122
import com.datadog.api.client.v1.model.WidgetRequestStyle;
2223
import com.datadog.api.client.v1.model.WidgetTextAlign;
24+
import com.datadog.api.client.v1.model.WidgetTime;
2325
import java.util.Collections;
2426

2527
public class Example {
@@ -65,7 +67,9 @@ public static void main(String[] args) {
6567
.palette("dog_classic")
6668
.lineType(WidgetLineType.SOLID)
6769
.lineWidth(WidgetLineWidth.NORMAL))
68-
.displayType(WidgetDisplayType.BARS)))))))
70+
.displayType(WidgetDisplayType.BARS)))
71+
.time(
72+
new WidgetTime().liveSpan(WidgetLiveSpan.WEEK_TO_DATE))))))
6973
.layoutType(DashboardLayoutType.ORDERED);
7074

7175
try {

src/main/java/com/datadog/api/client/v1/model/WidgetLiveSpan.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,23 @@ public class WidgetLiveSpan extends ModelEnum<String> {
2525
private static final Set<String> allowedValues =
2626
new HashSet<String>(
2727
Arrays.asList(
28-
"1m", "5m", "10m", "15m", "30m", "1h", "4h", "1d", "2d", "1w", "1mo", "3mo", "6mo",
29-
"1y", "alert"));
28+
"1m",
29+
"5m",
30+
"10m",
31+
"15m",
32+
"30m",
33+
"1h",
34+
"4h",
35+
"1d",
36+
"2d",
37+
"1w",
38+
"1mo",
39+
"3mo",
40+
"6mo",
41+
"week_to_date",
42+
"month_to_date",
43+
"1y",
44+
"alert"));
3045

3146
public static final WidgetLiveSpan PAST_ONE_MINUTE = new WidgetLiveSpan("1m");
3247
public static final WidgetLiveSpan PAST_FIVE_MINUTES = new WidgetLiveSpan("5m");
@@ -41,6 +56,8 @@ public class WidgetLiveSpan extends ModelEnum<String> {
4156
public static final WidgetLiveSpan PAST_ONE_MONTH = new WidgetLiveSpan("1mo");
4257
public static final WidgetLiveSpan PAST_THREE_MONTHS = new WidgetLiveSpan("3mo");
4358
public static final WidgetLiveSpan PAST_SIX_MONTHS = new WidgetLiveSpan("6mo");
59+
public static final WidgetLiveSpan WEEK_TO_DATE = new WidgetLiveSpan("week_to_date");
60+
public static final WidgetLiveSpan MONTH_TO_DATE = new WidgetLiveSpan("month_to_date");
4461
public static final WidgetLiveSpan PAST_ONE_YEAR = new WidgetLiveSpan("1y");
4562
public static final WidgetLiveSpan ALERT = new WidgetLiveSpan("alert");
4663

Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2023-07-11T14:32:45.409Z
1+
2023-11-14T21:39:19.397Z

src/test/resources/cassettes/features/v1/Create_a_new_dashboard_with_a_timeseries_widget_using_formulas_and_functions_cloud_cost_query.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"httpRequest": {
44
"body": {
55
"type": "JSON",
6-
"json": "{\"layout_type\":\"ordered\",\"title\":\"Test-Create_a_new_dashboard_with_a_timeseries_widget_using_formulas_and_functions_cloud_cost_query-1689085965\",\"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\"}}],\"title\":\"Example Cloud Cost Query\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"timeseries\"}}]}"
6+
"json": "{\"layout_type\":\"ordered\",\"title\":\"Test-Create_a_new_dashboard_with_a_timeseries_widget_using_formulas_and_functions_cloud_cost_query-1699997959\",\"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\":{\"live_span\":\"week_to_date\"},\"title\":\"Example Cloud Cost Query\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"timeseries\"}}]}"
77
},
88
"headers": {},
99
"method": "POST",
@@ -12,7 +12,7 @@
1212
"secure": true
1313
},
1414
"httpResponse": {
15-
"body": "{\"id\":\"kka-2iz-3jf\",\"title\":\"Test-Create_a_new_dashboard_with_a_timeseries_widget_using_formulas_and_functions_cloud_cost_query-1689085965\",\"description\":null,\"author_handle\":\"frog@datadoghq.com\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/kka-2iz-3jf/test-createanewdashboardwithatimeserieswidgetusingformulasandfunctionscloudcostq\",\"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\"}}],\"title\":\"Example Cloud Cost Query\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"timeseries\"},\"id\":1004255439340}],\"notify_list\":null,\"created_at\":\"2023-07-11T14:32:45.564617+00:00\",\"modified_at\":\"2023-07-11T14:32:45.564617+00:00\",\"restricted_roles\":[]}\n",
15+
"body": "{\"id\":\"nh3-n9c-wuz\",\"title\":\"Test-Create_a_new_dashboard_with_a_timeseries_widget_using_formulas_and_functions_cloud_cost_query-1699997959\",\"description\":null,\"author_handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"author_name\":\"CI Account\",\"layout_type\":\"ordered\",\"url\":\"/dashboard/nh3-n9c-wuz/test-createanewdashboardwithatimeserieswidgetusingformulasandfunctionscloudcostq\",\"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\":{\"live_span\":\"week_to_date\"},\"title\":\"Example Cloud Cost Query\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"timeseries\"},\"id\":380165468656457}],\"notify_list\":null,\"created_at\":\"2023-11-14T21:39:19.798591+00:00\",\"modified_at\":\"2023-11-14T21:39:19.798591+00:00\",\"restricted_roles\":[]}\n",
1616
"headers": {
1717
"Content-Type": [
1818
"application/json"
@@ -27,18 +27,18 @@
2727
"timeToLive": {
2828
"unlimited": true
2929
},
30-
"id": "21554e3c-bbf5-1a3f-13fd-398b7622a007"
30+
"id": "31bde127-a70c-ba12-22f8-23380e18b8b2"
3131
},
3232
{
3333
"httpRequest": {
3434
"headers": {},
3535
"method": "DELETE",
36-
"path": "/api/v1/dashboard/kka-2iz-3jf",
36+
"path": "/api/v1/dashboard/nh3-n9c-wuz",
3737
"keepAlive": false,
3838
"secure": true
3939
},
4040
"httpResponse": {
41-
"body": "{\"deleted_dashboard_id\":\"kka-2iz-3jf\"}\n",
41+
"body": "{\"deleted_dashboard_id\":\"nh3-n9c-wuz\"}\n",
4242
"headers": {
4343
"Content-Type": [
4444
"application/json"
@@ -53,6 +53,6 @@
5353
"timeToLive": {
5454
"unlimited": true
5555
},
56-
"id": "7c80e62c-3821-49b2-a53a-fcb41ec2fea8"
56+
"id": "f68f8218-29cb-1e5d-4440-43758daa2f6b"
5757
}
5858
]

src/test/resources/com/datadog/api/client/v1/api/dashboards.feature

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,15 @@ Feature: Dashboards
177177
@team:DataDog/dashboards-backend
178178
Scenario: Create a new dashboard with a timeseries widget using formulas and functions cloud cost query
179179
Given new "CreateDashboard" request
180-
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" } ] } } ], "layout_type": "ordered" }
180+
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": { "live_span": "week_to_date" } } } ], "layout_type": "ordered" }
181181
When the request is sent
182182
Then the response status is 200 OK
183183
And the response "widgets[0].definition.requests[0].response_format" is equal to "timeseries"
184184
And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "cloud_cost"
185185
And the response "widgets[0].definition.requests[0].queries[0].name" is equal to "query1"
186186
And the response "widgets[0].definition.requests[0].queries[0].query" is equal to "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)"
187187
And the response "widgets[0].definition.requests[0].formulas[0].formula" is equal to "query1"
188+
And the response "widgets[0].definition.time.live_span" is equal to "week_to_date"
188189

189190
@team:DataDog/dashboards-backend
190191
Scenario: Create a new dashboard with alert_graph widget

0 commit comments

Comments
 (0)