From 0e83da4d98cf6af5474daffcd466bfc2da63aec0 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 25 Sep 2024 14:21:29 +0000 Subject: [PATCH] Regenerate client from commit fe8637d0 of spec repo --- .apigentools-info | 8 +-- .../dashboards/CreateDashboard_1433408735.py | 72 +++++++++++++++++++ ..._dashboard_with_a_empty_time_object.frozen | 1 + ..._a_dashboard_with_a_empty_time_object.yaml | 44 ++++++++++++ tests/v1/features/dashboards.feature | 8 +++ 5 files changed, 129 insertions(+), 4 deletions(-) create mode 100644 examples/v1/dashboards/CreateDashboard_1433408735.py create mode 100644 tests/v1/cassettes/test_scenarios/test_clients_deserialize_a_dashboard_with_a_empty_time_object.frozen create mode 100644 tests/v1/cassettes/test_scenarios/test_clients_deserialize_a_dashboard_with_a_empty_time_object.yaml diff --git a/.apigentools-info b/.apigentools-info index cd81d3f13c..9f3970b8a6 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-09-24 18:16:22.924081", - "spec_repo_commit": "2eb52c63" + "regenerated": "2024-09-25 14:20:58.529527", + "spec_repo_commit": "fe8637d0" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-09-24 18:16:22.938930", - "spec_repo_commit": "2eb52c63" + "regenerated": "2024-09-25 14:20:58.542891", + "spec_repo_commit": "fe8637d0" } } } \ No newline at end of file diff --git a/examples/v1/dashboards/CreateDashboard_1433408735.py b/examples/v1/dashboards/CreateDashboard_1433408735.py new file mode 100644 index 0000000000..f33752ff1d --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_1433408735.py @@ -0,0 +1,72 @@ +""" +Clients deserialize a dashboard with a empty time object +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v1.api.dashboards_api import DashboardsApi +from datadog_api_client.v1.model.dashboard import Dashboard +from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType +from datadog_api_client.v1.model.formula_and_function_cloud_cost_data_source import ( + FormulaAndFunctionCloudCostDataSource, +) +from datadog_api_client.v1.model.formula_and_function_cloud_cost_query_definition import ( + FormulaAndFunctionCloudCostQueryDefinition, +) +from datadog_api_client.v1.model.formula_and_function_response_format import FormulaAndFunctionResponseFormat +from datadog_api_client.v1.model.timeseries_widget_definition import TimeseriesWidgetDefinition +from datadog_api_client.v1.model.timeseries_widget_definition_type import TimeseriesWidgetDefinitionType +from datadog_api_client.v1.model.timeseries_widget_request import TimeseriesWidgetRequest +from datadog_api_client.v1.model.widget import Widget +from datadog_api_client.v1.model.widget_display_type import WidgetDisplayType +from datadog_api_client.v1.model.widget_formula import WidgetFormula +from datadog_api_client.v1.model.widget_legacy_live_span import WidgetLegacyLiveSpan +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_request_style import WidgetRequestStyle +from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign + +body = Dashboard( + title="Example-Dashboard", + widgets=[ + Widget( + definition=TimeseriesWidgetDefinition( + title="Example Cloud Cost Query", + title_size="16", + title_align=WidgetTextAlign.LEFT, + type=TimeseriesWidgetDefinitionType.TIMESERIES, + requests=[ + TimeseriesWidgetRequest( + formulas=[ + WidgetFormula( + formula="query1", + ), + ], + queries=[ + FormulaAndFunctionCloudCostQueryDefinition( + data_source=FormulaAndFunctionCloudCostDataSource.CLOUD_COST, + name="query1", + query="sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)", + ), + ], + response_format=FormulaAndFunctionResponseFormat.TIMESERIES, + style=WidgetRequestStyle( + palette="dog_classic", + line_type=WidgetLineType.SOLID, + line_width=WidgetLineWidth.NORMAL, + ), + display_type=WidgetDisplayType.BARS, + ), + ], + time=WidgetLegacyLiveSpan(), + ), + ), + ], + layout_type=DashboardLayoutType.ORDERED, +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = DashboardsApi(api_client) + response = api_instance.create_dashboard(body=body) + + print(response) diff --git a/tests/v1/cassettes/test_scenarios/test_clients_deserialize_a_dashboard_with_a_empty_time_object.frozen b/tests/v1/cassettes/test_scenarios/test_clients_deserialize_a_dashboard_with_a_empty_time_object.frozen new file mode 100644 index 0000000000..85e15158c6 --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_clients_deserialize_a_dashboard_with_a_empty_time_object.frozen @@ -0,0 +1 @@ +2024-09-24T19:19:31.807Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_clients_deserialize_a_dashboard_with_a_empty_time_object.yaml b/tests/v1/cassettes/test_scenarios/test_clients_deserialize_a_dashboard_with_a_empty_time_object.yaml new file mode 100644 index 0000000000..3efd136d31 --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_clients_deserialize_a_dashboard_with_a_empty_time_object.yaml @@ -0,0 +1,44 @@ +interactions: +- request: + body: '{"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"}}]}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/dashboard + response: + body: + 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":[]} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/han-5zg-c32 + response: + body: + string: '{"deleted_dashboard_id":"han-5zg-c32"} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v1/features/dashboards.feature b/tests/v1/features/dashboards.feature index 33eaed7f4c..de855fec2d 100644 --- a/tests/v1/features/dashboards.feature +++ b/tests/v1/features/dashboards.feature @@ -9,6 +9,14 @@ Feature: Dashboards And a valid "appKeyAuth" key in the system And an instance of "Dashboards" API + @replay-only @team:DataDog/dashboards-backend + Scenario: Clients deserialize a dashboard with a empty time object + 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" } ], "time": {} } } ], "layout_type": "ordered" } + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.time" is equal to {} + @team:DataDog/dashboards-backend Scenario: Create a distribution widget using a histogram request containing a formulas and functions APM Stats query Given new "CreateDashboard" request