From 237cd1b2757cf38a681770e456f4d6ea2135cba2 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 19:52:13 +0000 Subject: [PATCH] Add week_to_date and month_to_date to widget livespan (#1768) Co-authored-by: ci.datadog-api-spec --- .apigentools-info | 8 ++++---- .generator/schemas/v1/openapi.yaml | 4 ++++ .../v1/dashboards/CreateDashboard_1284514532.py | 5 +++++ .../v1/model/widget_live_span.py | 8 +++++++- ...formulas_and_functions_cloud_cost_query.frozen | 2 +- ...g_formulas_and_functions_cloud_cost_query.yaml | 15 ++++++++------- tests/v1/features/dashboards.feature | 3 ++- 7 files changed, 31 insertions(+), 14 deletions(-) diff --git a/.apigentools-info b/.apigentools-info index 829ed3a08e..351bf6bb77 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2023-11-17 20:28:38.988410", - "spec_repo_commit": "7fb616ae" + "regenerated": "2023-11-20 19:20:13.651946", + "spec_repo_commit": "55cf29a4" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2023-11-17 20:28:39.002128", - "spec_repo_commit": "7fb616ae" + "regenerated": "2023-11-20 19:20:13.666926", + "spec_repo_commit": "55cf29a4" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index fc38d34761..e6a063ca39 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -20955,6 +20955,8 @@ components: - 1mo - 3mo - 6mo + - week_to_date + - month_to_date - 1y - alert example: 5m @@ -20973,6 +20975,8 @@ components: - PAST_ONE_MONTH - PAST_THREE_MONTHS - PAST_SIX_MONTHS + - WEEK_TO_DATE + - MONTH_TO_DATE - PAST_ONE_YEAR - ALERT WidgetMargin: diff --git a/examples/v1/dashboards/CreateDashboard_1284514532.py b/examples/v1/dashboards/CreateDashboard_1284514532.py index 01864cc924..64e7cb0e46 100644 --- a/examples/v1/dashboards/CreateDashboard_1284514532.py +++ b/examples/v1/dashboards/CreateDashboard_1284514532.py @@ -21,8 +21,10 @@ from datadog_api_client.v1.model.widget_formula import WidgetFormula from datadog_api_client.v1.model.widget_line_type import WidgetLineType from datadog_api_client.v1.model.widget_line_width import WidgetLineWidth +from datadog_api_client.v1.model.widget_live_span import WidgetLiveSpan from datadog_api_client.v1.model.widget_request_style import WidgetRequestStyle from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign +from datadog_api_client.v1.model.widget_time import WidgetTime body = Dashboard( title="Example-Dashboard", @@ -56,6 +58,9 @@ display_type=WidgetDisplayType.BARS, ), ], + time=WidgetTime( + live_span=WidgetLiveSpan.WEEK_TO_DATE, + ), ), ), ], diff --git a/src/datadog_api_client/v1/model/widget_live_span.py b/src/datadog_api_client/v1/model/widget_live_span.py index c5a156f57d..310aa920b6 100644 --- a/src/datadog_api_client/v1/model/widget_live_span.py +++ b/src/datadog_api_client/v1/model/widget_live_span.py @@ -16,7 +16,7 @@ class WidgetLiveSpan(ModelSimple): """ The available timeframes depend on the widget you are using. - :param value: Must be one of ["1m", "5m", "10m", "15m", "30m", "1h", "4h", "1d", "2d", "1w", "1mo", "3mo", "6mo", "1y", "alert"]. + :param value: Must be one of ["1m", "5m", "10m", "15m", "30m", "1h", "4h", "1d", "2d", "1w", "1mo", "3mo", "6mo", "week_to_date", "month_to_date", "1y", "alert"]. :type value: str """ @@ -34,6 +34,8 @@ class WidgetLiveSpan(ModelSimple): "1mo", "3mo", "6mo", + "week_to_date", + "month_to_date", "1y", "alert", } @@ -50,6 +52,8 @@ class WidgetLiveSpan(ModelSimple): PAST_ONE_MONTH: ClassVar["WidgetLiveSpan"] PAST_THREE_MONTHS: ClassVar["WidgetLiveSpan"] PAST_SIX_MONTHS: ClassVar["WidgetLiveSpan"] + WEEK_TO_DATE: ClassVar["WidgetLiveSpan"] + MONTH_TO_DATE: ClassVar["WidgetLiveSpan"] PAST_ONE_YEAR: ClassVar["WidgetLiveSpan"] ALERT: ClassVar["WidgetLiveSpan"] @@ -73,5 +77,7 @@ def openapi_types(_): WidgetLiveSpan.PAST_ONE_MONTH = WidgetLiveSpan("1mo") WidgetLiveSpan.PAST_THREE_MONTHS = WidgetLiveSpan("3mo") WidgetLiveSpan.PAST_SIX_MONTHS = WidgetLiveSpan("6mo") +WidgetLiveSpan.WEEK_TO_DATE = WidgetLiveSpan("week_to_date") +WidgetLiveSpan.MONTH_TO_DATE = WidgetLiveSpan("month_to_date") WidgetLiveSpan.PAST_ONE_YEAR = WidgetLiveSpan("1y") WidgetLiveSpan.ALERT = WidgetLiveSpan("alert") diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_timeseries_widget_using_formulas_and_functions_cloud_cost_query.frozen b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_timeseries_widget_using_formulas_and_functions_cloud_cost_query.frozen index c799f9c5fa..111062c807 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_timeseries_widget_using_formulas_and_functions_cloud_cost_query.frozen +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_timeseries_widget_using_formulas_and_functions_cloud_cost_query.frozen @@ -1 +1 @@ -2023-07-11T14:32:45.409Z \ No newline at end of file +2023-11-14T21:39:19.397Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_timeseries_widget_using_formulas_and_functions_cloud_cost_query.yaml b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_timeseries_widget_using_formulas_and_functions_cloud_cost_query.yaml index ad1d175679..44be4a56ab 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_timeseries_widget_using_formulas_and_functions_cloud_cost_query.yaml +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_timeseries_widget_using_formulas_and_functions_cloud_cost_query.yaml @@ -1,7 +1,7 @@ interactions: - request: - body: '{"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 + body: '{"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"}}]}' headers: accept: @@ -12,9 +12,10 @@ interactions: uri: https://api.datadoghq.com/api/v1/dashboard response: body: - string: '{"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":[]} + string: '{"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":[]} ' headers: @@ -29,10 +30,10 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/dashboard/kka-2iz-3jf + uri: https://api.datadoghq.com/api/v1/dashboard/nh3-n9c-wuz response: body: - string: '{"deleted_dashboard_id":"kka-2iz-3jf"} + string: '{"deleted_dashboard_id":"nh3-n9c-wuz"} ' headers: diff --git a/tests/v1/features/dashboards.feature b/tests/v1/features/dashboards.feature index 4d2a81f53d..0177acd4f4 100644 --- a/tests/v1/features/dashboards.feature +++ b/tests/v1/features/dashboards.feature @@ -177,7 +177,7 @@ Feature: Dashboards @team:DataDog/dashboards-backend Scenario: Create a new dashboard with a timeseries widget using formulas and functions cloud cost query Given new "CreateDashboard" request - 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" } + 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" } When the request is sent Then the response status is 200 OK And the response "widgets[0].definition.requests[0].response_format" is equal to "timeseries" @@ -185,6 +185,7 @@ Feature: Dashboards And the response "widgets[0].definition.requests[0].queries[0].name" is equal to "query1" And the response "widgets[0].definition.requests[0].queries[0].query" is equal to "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)" And the response "widgets[0].definition.requests[0].formulas[0].formula" is equal to "query1" + And the response "widgets[0].definition.time.live_span" is equal to "week_to_date" @team:DataDog/dashboards-backend Scenario: Create a new dashboard with alert_graph widget