From 6513c08c4112f56f5cba910b3e9a73eb3525acda Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 30 Aug 2022 09:41:31 +0000 Subject: [PATCH] Regenerate client from commit 267e916e of spec repo --- .apigentools-info | 8 +-- .generator/schemas/v1/openapi.yaml | 2 + ...es-widget-with-ci-tests-data-source.frozen | 1 + ...eries-widget-with-ci-tests-data-source.yml | 48 +++++++++++++++ .../dashboards/CreateDashboard_1307120899.rb | 61 +++++++++++++++++++ features/v1/dashboards.feature | 9 +++ ...formula_and_function_events_data_source.rb | 1 + 7 files changed, 126 insertions(+), 4 deletions(-) create mode 100644 cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-ci-tests-data-source.frozen create mode 100644 cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-ci-tests-data-source.yml create mode 100644 examples/v1/dashboards/CreateDashboard_1307120899.rb diff --git a/.apigentools-info b/.apigentools-info index 2f849c46c718..c8390c959148 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.4", - "regenerated": "2022-08-29 18:11:39.706250", - "spec_repo_commit": "95e8a34f" + "regenerated": "2022-08-30 09:41:10.267849", + "spec_repo_commit": "267e916e" }, "v2": { "apigentools_version": "1.6.4", - "regenerated": "2022-08-29 18:11:39.722226", - "spec_repo_commit": "95e8a34f" + "regenerated": "2022-08-30 09:41:10.281160", + "spec_repo_commit": "267e916e" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index cf5b19723d77..4bb9bb9798f2 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -2485,6 +2485,7 @@ components: - profiles - audit - events + - ci_tests example: logs type: string x-enum-varnames: @@ -2496,6 +2497,7 @@ components: - PROFILES - AUDIT - EVENTS + - CI_TESTS FormulaAndFunctionMetricAggregation: description: The aggregation methods available for metrics queries. enum: diff --git a/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-ci-tests-data-source.frozen b/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-ci-tests-data-source.frozen new file mode 100644 index 000000000000..5b964cc4a85b --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-ci-tests-data-source.frozen @@ -0,0 +1 @@ +2022-08-22T19:31:16.232Z \ No newline at end of file diff --git a/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-ci-tests-data-source.yml b/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-ci-tests-data-source.yml new file mode 100644 index 000000000000..24620c9a06b0 --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-ci-tests-data-source.yml @@ -0,0 +1,48 @@ +http_interactions: +- recorded_at: Mon, 22 Aug 2022 19:31:16 GMT + request: + body: + encoding: UTF-8 + string: '{"layout_type":"ordered","reflow_type":"auto","title":"Test-Create_a_new_timeseries_widget_with_ci_tests_data_source-1661196676 + with ci_tests 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":"ci_tests","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"}}]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/dashboard + response: + body: + encoding: UTF-8 + string: '{"notify_list":null,"description":null,"restricted_roles":[],"author_name":null,"template_variables":null,"is_read_only":false,"id":"ykp-mnk-euu","title":"Test-Create_a_new_timeseries_widget_with_ci_tests_data_source-1661196676 + with ci_tests datasource","url":"/dashboard/ykp-mnk-euu/test-createanewtimeserieswidgetwithcitestsdatasource-1661196676-with-citests-dat","created_at":"2022-08-22T19:31:16.421905+00:00","modified_at":"2022-08-22T19:31:16.421905+00:00","reflow_type":"auto","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"legend_columns":["avg","min","max","value","sum"],"title":"","legend_layout":"auto","show_legend":true,"time":{},"requests":[{"formulas":[{"formula":"query1"}],"style":{"line_width":"normal","palette":"dog_classic","line_type":"solid"},"display_type":"line","response_format":"timeseries","queries":[{"search":{"query":"test_level:test"},"data_source":"ci_tests","compute":{"aggregation":"count"},"name":"query1","indexes":["*"],"group_by":[]}]}],"type":"timeseries"},"id":5710436152334347}],"layout_type":"ordered"} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Mon, 22 Aug 2022 19:31:16 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/ykp-mnk-euu + response: + body: + encoding: UTF-8 + string: '{"deleted_dashboard_id":"ykp-mnk-euu"} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v1/dashboards/CreateDashboard_1307120899.rb b/examples/v1/dashboards/CreateDashboard_1307120899.rb new file mode 100644 index 000000000000..3df69e2391af --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_1307120899.rb @@ -0,0 +1,61 @@ +# Create a new timeseries widget with ci_tests data source + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::DashboardsAPI.new + +body = DatadogAPIClient::V1::Dashboard.new({ + title: "Example-Create_a_new_timeseries_widget_with_ci_tests_data_source with ci_tests datasource", + widgets: [ + DatadogAPIClient::V1::Widget.new({ + definition: DatadogAPIClient::V1::TimeseriesWidgetDefinition.new({ + title: "", + show_legend: true, + legend_layout: DatadogAPIClient::V1::TimeseriesWidgetLegendLayout::AUTO, + legend_columns: [ + DatadogAPIClient::V1::TimeseriesWidgetLegendColumn::AVG, + DatadogAPIClient::V1::TimeseriesWidgetLegendColumn::MIN, + DatadogAPIClient::V1::TimeseriesWidgetLegendColumn::MAX, + DatadogAPIClient::V1::TimeseriesWidgetLegendColumn::VALUE, + DatadogAPIClient::V1::TimeseriesWidgetLegendColumn::SUM, + ], + time: DatadogAPIClient::V1::WidgetTime.new({}), + type: DatadogAPIClient::V1::TimeseriesWidgetDefinitionType::TIMESERIES, + requests: [ + DatadogAPIClient::V1::TimeseriesWidgetRequest.new({ + formulas: [ + DatadogAPIClient::V1::WidgetFormula.new({ + formula: "query1", + }), + ], + queries: [ + DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinition.new({ + data_source: DatadogAPIClient::V1::FormulaAndFunctionEventsDataSource::CI_TESTS, + name: "query1", + search: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinitionSearch.new({ + query: "test_level:test", + }), + indexes: [ + "*", + ], + compute: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinitionCompute.new({ + aggregation: DatadogAPIClient::V1::FormulaAndFunctionEventAggregation::COUNT, + }), + group_by: [], + }), + ], + response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::TIMESERIES, + style: DatadogAPIClient::V1::WidgetRequestStyle.new({ + palette: "dog_classic", + line_type: DatadogAPIClient::V1::WidgetLineType::SOLID, + line_width: DatadogAPIClient::V1::WidgetLineWidth::NORMAL, + }), + display_type: DatadogAPIClient::V1::WidgetDisplayType::LINE, + }), + ], + }), + }), + ], + layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED, + reflow_type: DatadogAPIClient::V1::DashboardReflowType::AUTO, +}) +p api_instance.create_dashboard(body) diff --git a/features/v1/dashboards.feature b/features/v1/dashboards.feature index 6752fba9e09d..f9a90ee42c2b 100644 --- a/features/v1/dashboards.feature +++ b/features/v1/dashboards.feature @@ -441,6 +441,15 @@ Feature: Dashboards And the response "widgets[0].definition.type" is equal to "trace_service" And the response "widgets[0].definition.env" is equal to "none" + @team:DataDog/dashboards + Scenario: Create a new timeseries widget with ci_tests data source + Given new "CreateDashboard" request + And body with value {"title":"{{ unique }} with ci_tests 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":"ci_tests","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"} + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "ci_tests" + And the response "widgets[0].definition.requests[0].queries[0].search.query" is equal to "test_level:test" + @generated @skip @team:DataDog/dashboards Scenario: Delete a dashboard returns "Dashboards Not Found" response Given new "DeleteDashboard" request diff --git a/lib/datadog_api_client/v1/models/formula_and_function_events_data_source.rb b/lib/datadog_api_client/v1/models/formula_and_function_events_data_source.rb index 1b905f3a8d98..4a4240371d65 100644 --- a/lib/datadog_api_client/v1/models/formula_and_function_events_data_source.rb +++ b/lib/datadog_api_client/v1/models/formula_and_function_events_data_source.rb @@ -29,5 +29,6 @@ class FormulaAndFunctionEventsDataSource PROFILES = "profiles".freeze AUDIT = "audit".freeze EVENTS = "events".freeze + CI_TESTS = "ci_tests".freeze end end