diff --git a/.apigentools-info b/.apigentools-info index dd85dccc18ab..c96959831928 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-09-03 15:34:19.182802", - "spec_repo_commit": "e8b83f9d" + "regenerated": "2024-09-03 18:07:13.266236", + "spec_repo_commit": "2d21d782" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-09-03 15:34:19.200837", - "spec_repo_commit": "e8b83f9d" + "regenerated": "2024-09-03 18:07:13.283808", + "spec_repo_commit": "2d21d782" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 92975e5d0926..c4d126880cd9 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -21867,6 +21867,13 @@ components: type: string x-enum-varnames: - ORDERED + WidgetLegacyLiveSpan: + additionalProperties: false + description: Wrapper for live span + properties: + live_span: + $ref: '#/components/schemas/WidgetLiveSpan' + type: object WidgetLegendSize: description: Available legend sizes for a widget. Should be one of "0", "2", "4", "8", "16", or "auto". @@ -21933,6 +21940,24 @@ components: - MONTH_TO_DATE - PAST_ONE_YEAR - ALERT + WidgetLiveSpanUnit: + description: Unit of the time span. + enum: + - minute + - hour + - day + - week + - month + - year + example: minute + type: string + x-enum-varnames: + - MINUTE + - HOUR + - DAY + - WEEK + - MONTH + - YEAR WidgetMargin: description: 'Size of the margins around the image. @@ -22037,6 +22062,62 @@ components: - TRIGGERED_DESCENDING - PRIORITY_ASCENDING - PRIORITY_DESCENDING + WidgetNewFixedSpan: + description: Used for fixed span times, such as 'March 1 to March 7'. + properties: + from: + description: Start time in seconds since epoch. + example: 1712080128 + format: int64 + minimum: 0 + type: integer + to: + description: End time in seconds since epoch. + example: 1712083128 + format: int64 + minimum: 0 + type: integer + type: + $ref: '#/components/schemas/WidgetNewFixedSpanType' + required: + - type + - from + - to + type: object + WidgetNewFixedSpanType: + description: Type "fixed" denotes a fixed span. + enum: + - fixed + example: fixed + type: string + x-enum-varnames: + - FIXED + WidgetNewLiveSpan: + description: Used for arbitrary live span times, such as 17 minutes or 6 hours. + properties: + type: + $ref: '#/components/schemas/WidgetNewLiveSpanType' + unit: + $ref: '#/components/schemas/WidgetLiveSpanUnit' + value: + description: Value of the time span. + example: 4 + format: int64 + minimum: 1 + type: integer + required: + - type + - value + - unit + type: object + WidgetNewLiveSpanType: + description: Type "live" denotes a live span in the new format. + enum: + - live + example: live + type: string + x-enum-varnames: + - LIVE WidgetNodeType: description: Which type of node to use in the map. enum: @@ -22209,10 +22290,10 @@ components: - TOP WidgetTime: description: Time setting for the widget. - properties: - live_span: - $ref: '#/components/schemas/WidgetLiveSpan' - type: object + oneOf: + - $ref: '#/components/schemas/WidgetLegacyLiveSpan' + - $ref: '#/components/schemas/WidgetNewLiveSpan' + - $ref: '#/components/schemas/WidgetNewFixedSpan' WidgetTimeWindows: description: Define a time window. enum: diff --git a/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-legacy-live-span-time-format.frozen b/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-legacy-live-span-time-format.frozen new file mode 100644 index 000000000000..85c52092329a --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-legacy-live-span-time-format.frozen @@ -0,0 +1 @@ +2024-08-08T16:08:49.284Z \ No newline at end of file diff --git a/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-legacy-live-span-time-format.yml b/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-legacy-live-span-time-format.yml new file mode 100644 index 000000000000..bb26c80263bb --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-legacy-live-span-time-format.yml @@ -0,0 +1,49 @@ +http_interactions: +- recorded_at: Thu, 08 Aug 2024 16:08:49 GMT + request: + body: + encoding: UTF-8 + string: '{"layout_type":"ordered","reflow_type":"auto","title":"Test-Create_a_new_timeseries_widget_with_legacy_live_span_time_format-1723133329 + with legacy live span time","widgets":[{"definition":{"legend_columns":["avg","min","max","value","sum"],"legend_layout":"auto","requests":[{"display_type":"line","formulas":[{"formula":"query1"}],"queries":[{"compute":{"aggregation":"count","metric":"@ci.queue_time"},"data_source":"ci_pipelines","group_by":[],"indexes":["*"],"name":"query1","search":{"query":"ci_level:job"}}],"response_format":"timeseries","style":{"line_type":"solid","line_width":"normal","palette":"dog_classic"}}],"show_legend":true,"time":{"live_span":"5m"},"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: '{"id":"dfy-yby-e2c","title":"Test-Create_a_new_timeseries_widget_with_legacy_live_span_time_format-1723133329 + with legacy live span time","description":null,"author_handle":"d5459c54-9e9d-11ee-a5c9-ce6dc639753f","author_name":"CI + Service Account","layout_type":"ordered","url":"/dashboard/dfy-yby-e2c/test-createanewtimeserieswidgetwithlegacylivespantimeformat-1723133329-with-lega","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"legend_columns":["avg","min","max","value","sum"],"legend_layout":"auto","requests":[{"display_type":"line","formulas":[{"formula":"query1"}],"queries":[{"compute":{"aggregation":"count","metric":"@ci.queue_time"},"data_source":"ci_pipelines","group_by":[],"indexes":["*"],"name":"query1","search":{"query":"ci_level:job"}}],"response_format":"timeseries","style":{"line_type":"solid","line_width":"normal","palette":"dog_classic"}}],"show_legend":true,"time":{"live_span":"5m"},"title":"","type":"timeseries"},"id":6745766981061097}],"notify_list":null,"created_at":"2024-08-08T16:08:49.543129+00:00","modified_at":"2024-08-08T16:08:49.543129+00:00","reflow_type":"auto","restricted_roles":[]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 08 Aug 2024 16:08:49 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/dfy-yby-e2c + response: + body: + encoding: UTF-8 + string: '{"deleted_dashboard_id":"dfy-yby-e2c"} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-new-fixed-span-time-format.frozen b/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-new-fixed-span-time-format.frozen new file mode 100644 index 000000000000..038444cbe0f8 --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-new-fixed-span-time-format.frozen @@ -0,0 +1 @@ +2024-08-08T16:09:04.492Z \ No newline at end of file diff --git a/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-new-fixed-span-time-format.yml b/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-new-fixed-span-time-format.yml new file mode 100644 index 000000000000..33a654ae0c02 --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-new-fixed-span-time-format.yml @@ -0,0 +1,49 @@ +http_interactions: +- recorded_at: Thu, 08 Aug 2024 16:09:04 GMT + request: + body: + encoding: UTF-8 + string: '{"layout_type":"ordered","reflow_type":"auto","title":"Test-Create_a_new_timeseries_widget_with_new_fixed_span_time_format-1723133344 + with new fixed span time","widgets":[{"definition":{"legend_columns":["avg","min","max","value","sum"],"legend_layout":"auto","requests":[{"display_type":"line","formulas":[{"formula":"query1"}],"queries":[{"compute":{"aggregation":"count","metric":"@ci.queue_time"},"data_source":"ci_pipelines","group_by":[],"indexes":["*"],"name":"query1","search":{"query":"ci_level:job"}}],"response_format":"timeseries","style":{"line_type":"solid","line_width":"normal","palette":"dog_classic"}}],"show_legend":true,"time":{"from":1712080128,"to":1712083128,"type":"fixed"},"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: '{"id":"kvv-wiy-nsu","title":"Test-Create_a_new_timeseries_widget_with_new_fixed_span_time_format-1723133344 + with new fixed span time","description":null,"author_handle":"d5459c54-9e9d-11ee-a5c9-ce6dc639753f","author_name":"CI + Service Account","layout_type":"ordered","url":"/dashboard/kvv-wiy-nsu/test-createanewtimeserieswidgetwithnewfixedspantimeformat-1723133344-with-new-fi","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"legend_columns":["avg","min","max","value","sum"],"legend_layout":"auto","requests":[{"display_type":"line","formulas":[{"formula":"query1"}],"queries":[{"compute":{"aggregation":"count","metric":"@ci.queue_time"},"data_source":"ci_pipelines","group_by":[],"indexes":["*"],"name":"query1","search":{"query":"ci_level:job"}}],"response_format":"timeseries","style":{"line_type":"solid","line_width":"normal","palette":"dog_classic"}}],"show_legend":true,"time":{"from":1712080128,"to":1712083128,"type":"fixed"},"title":"","type":"timeseries"},"id":1421131468062823}],"notify_list":null,"created_at":"2024-08-08T16:09:04.750457+00:00","modified_at":"2024-08-08T16:09:04.750457+00:00","reflow_type":"auto","restricted_roles":[]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 08 Aug 2024 16:09:04 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/kvv-wiy-nsu + response: + body: + encoding: UTF-8 + string: '{"deleted_dashboard_id":"kvv-wiy-nsu"} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-new-live-span-time-format.frozen b/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-new-live-span-time-format.frozen new file mode 100644 index 000000000000..80af97252dff --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-new-live-span-time-format.frozen @@ -0,0 +1 @@ +2024-08-08T16:09:15.828Z \ No newline at end of file diff --git a/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-new-live-span-time-format.yml b/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-new-live-span-time-format.yml new file mode 100644 index 000000000000..40a264cc4ec4 --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-timeseries-widget-with-new-live-span-time-format.yml @@ -0,0 +1,49 @@ +http_interactions: +- recorded_at: Thu, 08 Aug 2024 16:09:15 GMT + request: + body: + encoding: UTF-8 + string: '{"layout_type":"ordered","reflow_type":"auto","title":"Test-Create_a_new_timeseries_widget_with_new_live_span_time_format-1723133355 + with new live span time","widgets":[{"definition":{"legend_columns":["avg","min","max","value","sum"],"legend_layout":"auto","requests":[{"display_type":"line","formulas":[{"formula":"query1"}],"queries":[{"compute":{"aggregation":"count","metric":"@ci.queue_time"},"data_source":"ci_pipelines","group_by":[],"indexes":["*"],"name":"query1","search":{"query":"ci_level:job"}}],"response_format":"timeseries","style":{"line_type":"solid","line_width":"normal","palette":"dog_classic"}}],"show_legend":true,"time":{"type":"live","unit":"minute","value":8},"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: '{"id":"mew-pjn-ndm","title":"Test-Create_a_new_timeseries_widget_with_new_live_span_time_format-1723133355 + with new live span time","description":null,"author_handle":"d5459c54-9e9d-11ee-a5c9-ce6dc639753f","author_name":"CI + Service Account","layout_type":"ordered","url":"/dashboard/mew-pjn-ndm/test-createanewtimeserieswidgetwithnewlivespantimeformat-1723133355-with-new-liv","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"legend_columns":["avg","min","max","value","sum"],"legend_layout":"auto","requests":[{"display_type":"line","formulas":[{"formula":"query1"}],"queries":[{"compute":{"aggregation":"count","metric":"@ci.queue_time"},"data_source":"ci_pipelines","group_by":[],"indexes":["*"],"name":"query1","search":{"query":"ci_level:job"}}],"response_format":"timeseries","style":{"line_type":"solid","line_width":"normal","palette":"dog_classic"}}],"show_legend":true,"time":{"type":"live","unit":"minute","value":8},"title":"","type":"timeseries"},"id":6031010449478602}],"notify_list":null,"created_at":"2024-08-08T16:09:16.036773+00:00","modified_at":"2024-08-08T16:09:16.036773+00:00","reflow_type":"auto","restricted_roles":[]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 08 Aug 2024 16:09:15 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/mew-pjn-ndm + response: + body: + encoding: UTF-8 + string: '{"deleted_dashboard_id":"mew-pjn-ndm"} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v1/dashboards/CreateDashboard_1177423752.rb b/examples/v1/dashboards/CreateDashboard_1177423752.rb index 4d8391f053ea..5e3b76b98c43 100644 --- a/examples/v1/dashboards/CreateDashboard_1177423752.rb +++ b/examples/v1/dashboards/CreateDashboard_1177423752.rb @@ -18,7 +18,7 @@ title: "", title_size: "16", title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, - time: DatadogAPIClient::V1::WidgetTime.new({}), + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), type: DatadogAPIClient::V1::HeatMapWidgetDefinitionType::HEATMAP, requests: [ DatadogAPIClient::V1::HeatMapWidgetRequest.new({ diff --git a/examples/v1/dashboards/CreateDashboard_1213075383.rb b/examples/v1/dashboards/CreateDashboard_1213075383.rb index a034cfe838ea..94c32b35b61b 100644 --- a/examples/v1/dashboards/CreateDashboard_1213075383.rb +++ b/examples/v1/dashboards/CreateDashboard_1213075383.rb @@ -18,7 +18,7 @@ title: "", title_size: "16", title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, - time: DatadogAPIClient::V1::WidgetTime.new({}), + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), style: DatadogAPIClient::V1::ToplistWidgetStyle.new({ display: DatadogAPIClient::V1::ToplistWidgetStacked.new({ type: DatadogAPIClient::V1::ToplistWidgetStackedType::STACKED, diff --git a/examples/v1/dashboards/CreateDashboard_1284514532.rb b/examples/v1/dashboards/CreateDashboard_1284514532.rb index 98e41066329a..5033e32c26ac 100644 --- a/examples/v1/dashboards/CreateDashboard_1284514532.rb +++ b/examples/v1/dashboards/CreateDashboard_1284514532.rb @@ -35,7 +35,7 @@ display_type: DatadogAPIClient::V1::WidgetDisplayType::BARS, }), ], - time: DatadogAPIClient::V1::WidgetTime.new({ + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({ live_span: DatadogAPIClient::V1::WidgetLiveSpan::WEEK_TO_DATE, }), }), diff --git a/examples/v1/dashboards/CreateDashboard_1307120899.rb b/examples/v1/dashboards/CreateDashboard_1307120899.rb index 10a3f5221a09..f0bc78061f86 100644 --- a/examples/v1/dashboards/CreateDashboard_1307120899.rb +++ b/examples/v1/dashboards/CreateDashboard_1307120899.rb @@ -18,7 +18,7 @@ DatadogAPIClient::V1::TimeseriesWidgetLegendColumn::VALUE, DatadogAPIClient::V1::TimeseriesWidgetLegendColumn::SUM, ], - time: DatadogAPIClient::V1::WidgetTime.new({}), + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), type: DatadogAPIClient::V1::TimeseriesWidgetDefinitionType::TIMESERIES, requests: [ DatadogAPIClient::V1::TimeseriesWidgetRequest.new({ diff --git a/examples/v1/dashboards/CreateDashboard_2064651578.rb b/examples/v1/dashboards/CreateDashboard_2064651578.rb index ac67556b6804..cb4c045fa183 100644 --- a/examples/v1/dashboards/CreateDashboard_2064651578.rb +++ b/examples/v1/dashboards/CreateDashboard_2064651578.rb @@ -11,7 +11,7 @@ title: "", title_size: "16", title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, - time: DatadogAPIClient::V1::WidgetTime.new({}), + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), type: DatadogAPIClient::V1::ChangeWidgetDefinitionType::CHANGE, requests: [ DatadogAPIClient::V1::ChangeWidgetRequest.new({ diff --git a/examples/v1/dashboards/CreateDashboard_2308247857.rb b/examples/v1/dashboards/CreateDashboard_2308247857.rb index 4851fca1bd5d..5e4c821f3281 100644 --- a/examples/v1/dashboards/CreateDashboard_2308247857.rb +++ b/examples/v1/dashboards/CreateDashboard_2308247857.rb @@ -21,7 +21,7 @@ title: "", title_size: "16", title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, - time: DatadogAPIClient::V1::WidgetTime.new({}), + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), type: DatadogAPIClient::V1::AlertGraphWidgetDefinitionType::ALERT_GRAPH, alert_id: "7", viz_type: DatadogAPIClient::V1::WidgetVizType::TIMESERIES, diff --git a/examples/v1/dashboards/CreateDashboard_2336428357.rb b/examples/v1/dashboards/CreateDashboard_2336428357.rb index 944b46a2259f..5e490959190c 100644 --- a/examples/v1/dashboards/CreateDashboard_2336428357.rb +++ b/examples/v1/dashboards/CreateDashboard_2336428357.rb @@ -18,7 +18,7 @@ title: "", title_size: "16", title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, - time: DatadogAPIClient::V1::WidgetTime.new({}), + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), type: DatadogAPIClient::V1::TableWidgetDefinitionType::QUERY_TABLE, requests: [ DatadogAPIClient::V1::TableWidgetRequest.new({ diff --git a/examples/v1/dashboards/CreateDashboard_2342457693.rb b/examples/v1/dashboards/CreateDashboard_2342457693.rb index 7a646cb6fabf..e29a60b57558 100644 --- a/examples/v1/dashboards/CreateDashboard_2342457693.rb +++ b/examples/v1/dashboards/CreateDashboard_2342457693.rb @@ -18,7 +18,7 @@ title: "", title_size: "16", title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, - time: DatadogAPIClient::V1::WidgetTime.new({}), + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), type: DatadogAPIClient::V1::ScatterPlotWidgetDefinitionType::SCATTERPLOT, requests: DatadogAPIClient::V1::ScatterPlotWidgetDefinitionRequests.new({ table: DatadogAPIClient::V1::ScatterplotTableRequest.new({ diff --git a/examples/v1/dashboards/CreateDashboard_2349863258.rb b/examples/v1/dashboards/CreateDashboard_2349863258.rb index ed3a657a9143..921d8a2fd81f 100644 --- a/examples/v1/dashboards/CreateDashboard_2349863258.rb +++ b/examples/v1/dashboards/CreateDashboard_2349863258.rb @@ -18,7 +18,7 @@ title: "", title_size: "16", title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, - time: DatadogAPIClient::V1::WidgetTime.new({}), + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), type: DatadogAPIClient::V1::QueryValueWidgetDefinitionType::QUERY_VALUE, requests: [ DatadogAPIClient::V1::QueryValueWidgetRequest.new({ diff --git a/examples/v1/dashboards/CreateDashboard_2563642929.rb b/examples/v1/dashboards/CreateDashboard_2563642929.rb index 9c13568e06d6..c26fcfc61ed6 100644 --- a/examples/v1/dashboards/CreateDashboard_2563642929.rb +++ b/examples/v1/dashboards/CreateDashboard_2563642929.rb @@ -18,7 +18,7 @@ title: "", title_size: "16", title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, - time: DatadogAPIClient::V1::WidgetTime.new({}), + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), style: DatadogAPIClient::V1::ToplistWidgetStyle.new({ display: DatadogAPIClient::V1::ToplistWidgetStacked.new({ type: DatadogAPIClient::V1::ToplistWidgetStackedType::STACKED, diff --git a/examples/v1/dashboards/CreateDashboard_2610827685.rb b/examples/v1/dashboards/CreateDashboard_2610827685.rb index 18f831007018..3bf7598722f3 100644 --- a/examples/v1/dashboards/CreateDashboard_2610827685.rb +++ b/examples/v1/dashboards/CreateDashboard_2610827685.rb @@ -18,7 +18,7 @@ title: "Run workflow title", title_size: "16", title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, - time: DatadogAPIClient::V1::WidgetTime.new({}), + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), type: DatadogAPIClient::V1::RunWorkflowWidgetDefinitionType::RUN_WORKFLOW, workflow_id: "2e055f16-8b6a-4cdd-b452-17a34c44b160", inputs: [ diff --git a/examples/v1/dashboards/CreateDashboard_2644712913.rb b/examples/v1/dashboards/CreateDashboard_2644712913.rb index 914f79bed785..0351b224f472 100644 --- a/examples/v1/dashboards/CreateDashboard_2644712913.rb +++ b/examples/v1/dashboards/CreateDashboard_2644712913.rb @@ -13,7 +13,7 @@ title: "", title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, precision: 2, - time: DatadogAPIClient::V1::WidgetTime.new({}), + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), autoscale: true, requests: [ DatadogAPIClient::V1::QueryValueWidgetRequest.new({ diff --git a/examples/v1/dashboards/CreateDashboard_2800096921.rb b/examples/v1/dashboards/CreateDashboard_2800096921.rb index d9869f9f4846..053c0c406952 100644 --- a/examples/v1/dashboards/CreateDashboard_2800096921.rb +++ b/examples/v1/dashboards/CreateDashboard_2800096921.rb @@ -18,7 +18,7 @@ DatadogAPIClient::V1::TimeseriesWidgetLegendColumn::VALUE, DatadogAPIClient::V1::TimeseriesWidgetLegendColumn::SUM, ], - time: DatadogAPIClient::V1::WidgetTime.new({}), + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), type: DatadogAPIClient::V1::TimeseriesWidgetDefinitionType::TIMESERIES, requests: [ DatadogAPIClient::V1::TimeseriesWidgetRequest.new({ diff --git a/examples/v1/dashboards/CreateDashboard_2921337351.rb b/examples/v1/dashboards/CreateDashboard_2921337351.rb index 6c76e808b6af..17b3862d9f64 100644 --- a/examples/v1/dashboards/CreateDashboard_2921337351.rb +++ b/examples/v1/dashboards/CreateDashboard_2921337351.rb @@ -16,7 +16,7 @@ }), definition: DatadogAPIClient::V1::ServiceSummaryWidgetDefinition.new({ title: "Service Summary", - time: DatadogAPIClient::V1::WidgetTime.new({}), + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), type: DatadogAPIClient::V1::ServiceSummaryWidgetDefinitionType::TRACE_SERVICE, env: "none", service: "", diff --git a/examples/v1/dashboards/CreateDashboard_3066042014.rb b/examples/v1/dashboards/CreateDashboard_3066042014.rb new file mode 100644 index 000000000000..652c816257bd --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_3066042014.rb @@ -0,0 +1,66 @@ +# Create a new timeseries widget with new live span time format + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::DashboardsAPI.new + +body = DatadogAPIClient::V1::Dashboard.new({ + title: "Example-Dashboard with new live span time", + 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::WidgetNewLiveSpan.new({ + type: DatadogAPIClient::V1::WidgetNewLiveSpanType::LIVE, + unit: DatadogAPIClient::V1::WidgetLiveSpanUnit::MINUTE, + value: 8, + }), + 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_PIPELINES, + name: "query1", + search: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinitionSearch.new({ + query: "ci_level:job", + }), + indexes: [ + "*", + ], + compute: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinitionCompute.new({ + aggregation: DatadogAPIClient::V1::FormulaAndFunctionEventAggregation::COUNT, + metric: "@ci.queue_time", + }), + 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/examples/v1/dashboards/CreateDashboard_3451918078.rb b/examples/v1/dashboards/CreateDashboard_3451918078.rb new file mode 100644 index 000000000000..650ec2485547 --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_3451918078.rb @@ -0,0 +1,66 @@ +# Create a new timeseries widget with new fixed span time format + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::DashboardsAPI.new + +body = DatadogAPIClient::V1::Dashboard.new({ + title: "Example-Dashboard with new fixed span time", + 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::WidgetNewFixedSpan.new({ + type: DatadogAPIClient::V1::WidgetNewFixedSpanType::FIXED, + from: 1712080128, + to: 1712083128, + }), + 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_PIPELINES, + name: "query1", + search: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinitionSearch.new({ + query: "ci_level:job", + }), + indexes: [ + "*", + ], + compute: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinitionCompute.new({ + aggregation: DatadogAPIClient::V1::FormulaAndFunctionEventAggregation::COUNT, + metric: "@ci.queue_time", + }), + 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/examples/v1/dashboards/CreateDashboard_3562282606.rb b/examples/v1/dashboards/CreateDashboard_3562282606.rb index 356fa3215f65..ddff7a4c4e6f 100644 --- a/examples/v1/dashboards/CreateDashboard_3562282606.rb +++ b/examples/v1/dashboards/CreateDashboard_3562282606.rb @@ -14,7 +14,7 @@ title: "", title_size: "16", title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, - time: DatadogAPIClient::V1::WidgetTime.new({}), + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), type: DatadogAPIClient::V1::ChangeWidgetDefinitionType::CHANGE, requests: [ DatadogAPIClient::V1::ChangeWidgetRequest.new({ diff --git a/examples/v1/dashboards/CreateDashboard_3777304439.rb b/examples/v1/dashboards/CreateDashboard_3777304439.rb index 98a4ac64bf2d..349d9210e8d7 100644 --- a/examples/v1/dashboards/CreateDashboard_3777304439.rb +++ b/examples/v1/dashboards/CreateDashboard_3777304439.rb @@ -17,7 +17,7 @@ title: "", title_size: "16", title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, - time: DatadogAPIClient::V1::WidgetTime.new({}), + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), type: DatadogAPIClient::V1::HeatMapWidgetDefinitionType::HEATMAP, requests: [ DatadogAPIClient::V1::HeatMapWidgetRequest.new({ diff --git a/examples/v1/dashboards/CreateDashboard_41622531.rb b/examples/v1/dashboards/CreateDashboard_41622531.rb index 78ea6cce9517..7f776edcd3f1 100644 --- a/examples/v1/dashboards/CreateDashboard_41622531.rb +++ b/examples/v1/dashboards/CreateDashboard_41622531.rb @@ -18,7 +18,7 @@ DatadogAPIClient::V1::TimeseriesWidgetLegendColumn::VALUE, DatadogAPIClient::V1::TimeseriesWidgetLegendColumn::SUM, ], - time: DatadogAPIClient::V1::WidgetTime.new({}), + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), type: DatadogAPIClient::V1::TimeseriesWidgetDefinitionType::TIMESERIES, requests: [ DatadogAPIClient::V1::TimeseriesWidgetRequest.new({ diff --git a/examples/v1/dashboards/CreateDashboard_4262729673.rb b/examples/v1/dashboards/CreateDashboard_4262729673.rb new file mode 100644 index 000000000000..7ffb04fa6a7e --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_4262729673.rb @@ -0,0 +1,64 @@ +# Create a new timeseries widget with legacy live span time format + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::DashboardsAPI.new + +body = DatadogAPIClient::V1::Dashboard.new({ + title: "Example-Dashboard with legacy live span time", + 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::WidgetLegacyLiveSpan.new({ + live_span: DatadogAPIClient::V1::WidgetLiveSpan::PAST_FIVE_MINUTES, + }), + 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_PIPELINES, + name: "query1", + search: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinitionSearch.new({ + query: "ci_level:job", + }), + indexes: [ + "*", + ], + compute: DatadogAPIClient::V1::FormulaAndFunctionEventQueryDefinitionCompute.new({ + aggregation: DatadogAPIClient::V1::FormulaAndFunctionEventAggregation::COUNT, + metric: "@ci.queue_time", + }), + 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/examples/v1/dashboards/CreateDashboard_578885732.rb b/examples/v1/dashboards/CreateDashboard_578885732.rb index e419574a8fd2..aa0bd01916d1 100644 --- a/examples/v1/dashboards/CreateDashboard_578885732.rb +++ b/examples/v1/dashboards/CreateDashboard_578885732.rb @@ -11,7 +11,7 @@ title: "", title_size: "16", title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, - time: DatadogAPIClient::V1::WidgetTime.new({}), + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), type: DatadogAPIClient::V1::ChangeWidgetDefinitionType::CHANGE, requests: [ DatadogAPIClient::V1::ChangeWidgetRequest.new({ diff --git a/examples/v1/dashboards/CreateDashboard_765140092.rb b/examples/v1/dashboards/CreateDashboard_765140092.rb index 0233f4a563e4..fe580ba678f3 100644 --- a/examples/v1/dashboards/CreateDashboard_765140092.rb +++ b/examples/v1/dashboards/CreateDashboard_765140092.rb @@ -13,7 +13,7 @@ title: "", title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, precision: 2, - time: DatadogAPIClient::V1::WidgetTime.new({}), + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), autoscale: true, requests: [ DatadogAPIClient::V1::QueryValueWidgetRequest.new({ diff --git a/examples/v1/dashboards/CreateDashboard_915214113.rb b/examples/v1/dashboards/CreateDashboard_915214113.rb index 92732b60b544..f3a85fe72469 100644 --- a/examples/v1/dashboards/CreateDashboard_915214113.rb +++ b/examples/v1/dashboards/CreateDashboard_915214113.rb @@ -18,7 +18,7 @@ title: "", title_size: "16", title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, - time: DatadogAPIClient::V1::WidgetTime.new({}), + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), type: DatadogAPIClient::V1::GeomapWidgetDefinitionType::GEOMAP, requests: [ DatadogAPIClient::V1::GeomapWidgetRequest.new({ diff --git a/examples/v1/dashboards/CreateDashboard_985012506.rb b/examples/v1/dashboards/CreateDashboard_985012506.rb index 833aad847c91..b14b575ee811 100644 --- a/examples/v1/dashboards/CreateDashboard_985012506.rb +++ b/examples/v1/dashboards/CreateDashboard_985012506.rb @@ -18,7 +18,7 @@ DatadogAPIClient::V1::TimeseriesWidgetLegendColumn::VALUE, DatadogAPIClient::V1::TimeseriesWidgetLegendColumn::SUM, ], - time: DatadogAPIClient::V1::WidgetTime.new({}), + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), type: DatadogAPIClient::V1::TimeseriesWidgetDefinitionType::TIMESERIES, requests: [ DatadogAPIClient::V1::TimeseriesWidgetRequest.new({ diff --git a/features/v1/dashboards.feature b/features/v1/dashboards.feature index b892e9da84df..0b080ef44c72 100644 --- a/features/v1/dashboards.feature +++ b/features/v1/dashboards.feature @@ -839,6 +839,34 @@ Feature: Dashboards And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "incident_analytics" And the response "widgets[0].definition.requests[0].queries[0].search.query" is equal to "test_level:test" + @team:DataDog/dashboards-backend + Scenario: Create a new timeseries widget with legacy live span time format + Given new "CreateDashboard" request + And body with value {"title":"{{ unique }} with legacy live span time","widgets":[{"definition":{"title":"","show_legend":true,"legend_layout":"auto","legend_columns":["avg","min","max","value","sum"],"time":{"live_span": "5m"},"type":"timeseries","requests":[{"formulas":[{"formula":"query1"}],"queries":[{"data_source":"ci_pipelines","name":"query1","search":{"query":"ci_level:job"},"indexes":["*"],"compute":{"aggregation":"count", "metric": "@ci.queue_time"},"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.time.live_span" is equal to "5m" + + @team:DataDog/dashboards-backend + Scenario: Create a new timeseries widget with new fixed span time format + Given new "CreateDashboard" request + And body with value {"title":"{{ unique }} with new fixed span time","widgets":[{"definition":{"title":"","show_legend":true,"legend_layout":"auto","legend_columns":["avg","min","max","value","sum"],"time":{"type": "fixed", "from": 1712080128, "to": 1712083128},"type":"timeseries","requests":[{"formulas":[{"formula":"query1"}],"queries":[{"data_source":"ci_pipelines","name":"query1","search":{"query":"ci_level:job"},"indexes":["*"],"compute":{"aggregation":"count", "metric": "@ci.queue_time"},"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.time.type" is equal to "fixed" + And the response "widgets[0].definition.time.from" is equal to 1712080128 + And the response "widgets[0].definition.time.to" is equal to 1712083128 + + @team:DataDog/dashboards-backend + Scenario: Create a new timeseries widget with new live span time format + Given new "CreateDashboard" request + And body with value {"title":"{{ unique }} with new live span time","widgets":[{"definition":{"title":"","show_legend":true,"legend_layout":"auto","legend_columns":["avg","min","max","value","sum"],"time":{"type": "live", "unit": "minute", "value": 8},"type":"timeseries","requests":[{"formulas":[{"formula":"query1"}],"queries":[{"data_source":"ci_pipelines","name":"query1","search":{"query":"ci_level:job"},"indexes":["*"],"compute":{"aggregation":"count", "metric": "@ci.queue_time"},"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.time.type" is equal to "live" + And the response "widgets[0].definition.time.unit" is equal to "minute" + And the response "widgets[0].definition.time.value" is equal to 8 + @generated @skip @team:DataDog/dashboards-backend Scenario: Create a shared dashboard returns "Bad Request" response Given new "CreatePublicDashboard" request diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 058eafdf89c2..f2828d842563 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -838,14 +838,20 @@ def overrides "v1.widget_image_sizing" => "WidgetImageSizing", "v1.widget_layout" => "WidgetLayout", "v1.widget_layout_type" => "WidgetLayoutType", + "v1.widget_legacy_live_span" => "WidgetLegacyLiveSpan", "v1.widget_line_type" => "WidgetLineType", "v1.widget_line_width" => "WidgetLineWidth", "v1.widget_live_span" => "WidgetLiveSpan", + "v1.widget_live_span_unit" => "WidgetLiveSpanUnit", "v1.widget_margin" => "WidgetMargin", "v1.widget_marker" => "WidgetMarker", "v1.widget_message_display" => "WidgetMessageDisplay", "v1.widget_monitor_summary_display_format" => "WidgetMonitorSummaryDisplayFormat", "v1.widget_monitor_summary_sort" => "WidgetMonitorSummarySort", + "v1.widget_new_fixed_span" => "WidgetNewFixedSpan", + "v1.widget_new_fixed_span_type" => "WidgetNewFixedSpanType", + "v1.widget_new_live_span" => "WidgetNewLiveSpan", + "v1.widget_new_live_span_type" => "WidgetNewLiveSpanType", "v1.widget_node_type" => "WidgetNodeType", "v1.widget_order_by" => "WidgetOrderBy", "v1.widget_palette" => "WidgetPalette", diff --git a/lib/datadog_api_client/v1/models/widget_legacy_live_span.rb b/lib/datadog_api_client/v1/models/widget_legacy_live_span.rb new file mode 100644 index 000000000000..9d03b7a473f9 --- /dev/null +++ b/lib/datadog_api_client/v1/models/widget_legacy_live_span.rb @@ -0,0 +1,80 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V1 + # Wrapper for live span + class WidgetLegacyLiveSpan + include BaseGenericModel + + # The available timeframes depend on the widget you are using. + attr_accessor :live_span + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'live_span' => :'live_span' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'live_span' => :'WidgetLiveSpan' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::WidgetLegacyLiveSpan` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V1::WidgetLegacyLiveSpan`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'live_span') + self.live_span = attributes[:'live_span'] + end + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + live_span == o.live_span + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [live_span].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/widget_live_span_unit.rb b/lib/datadog_api_client/v1/models/widget_live_span_unit.rb new file mode 100644 index 000000000000..52308255f5d3 --- /dev/null +++ b/lib/datadog_api_client/v1/models/widget_live_span_unit.rb @@ -0,0 +1,31 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V1 + # Unit of the time span. + class WidgetLiveSpanUnit + include BaseEnumModel + + MINUTE = "minute".freeze + HOUR = "hour".freeze + DAY = "day".freeze + WEEK = "week".freeze + MONTH = "month".freeze + YEAR = "year".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/widget_new_fixed_span.rb b/lib/datadog_api_client/v1/models/widget_new_fixed_span.rb new file mode 100644 index 000000000000..d2f610f70c5c --- /dev/null +++ b/lib/datadog_api_client/v1/models/widget_new_fixed_span.rb @@ -0,0 +1,173 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V1 + # Used for fixed span times, such as 'March 1 to March 7'. + class WidgetNewFixedSpan + include BaseGenericModel + + # Start time in seconds since epoch. + attr_reader :from + + # End time in seconds since epoch. + attr_reader :to + + # Type "fixed" denotes a fixed span. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'from' => :'from', + :'to' => :'to', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'from' => :'Integer', + :'to' => :'Integer', + :'type' => :'WidgetNewFixedSpanType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::WidgetNewFixedSpan` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'from') + self.from = attributes[:'from'] + end + + if attributes.key?(:'to') + self.to = attributes[:'to'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @from.nil? + return false if @from < 0 + return false if @to.nil? + return false if @to < 0 + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param from [Object] Object to be assigned + # @!visibility private + def from=(from) + if from.nil? + fail ArgumentError, 'invalid value for "from", from cannot be nil.' + end + if from < 0 + fail ArgumentError, 'invalid value for "from", must be greater than or equal to 0.' + end + @from = from + end + + # Custom attribute writer method with validation + # @param to [Object] Object to be assigned + # @!visibility private + def to=(to) + if to.nil? + fail ArgumentError, 'invalid value for "to", to cannot be nil.' + end + if to < 0 + fail ArgumentError, 'invalid value for "to", must be greater than or equal to 0.' + end + @to = to + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + from == o.from && + to == o.to && + type == o.type + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [from, to, type].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/widget_new_fixed_span_type.rb b/lib/datadog_api_client/v1/models/widget_new_fixed_span_type.rb new file mode 100644 index 000000000000..a261f8056451 --- /dev/null +++ b/lib/datadog_api_client/v1/models/widget_new_fixed_span_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V1 + # Type "fixed" denotes a fixed span. + class WidgetNewFixedSpanType + include BaseEnumModel + + FIXED = "fixed".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/widget_new_live_span.rb b/lib/datadog_api_client/v1/models/widget_new_live_span.rb new file mode 100644 index 000000000000..951f1b557ab3 --- /dev/null +++ b/lib/datadog_api_client/v1/models/widget_new_live_span.rb @@ -0,0 +1,169 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V1 + # Used for arbitrary live span times, such as 17 minutes or 6 hours. + class WidgetNewLiveSpan + include BaseGenericModel + + # Type "live" denotes a live span in the new format. + attr_reader :type + + # Unit of the time span. + attr_reader :unit + + # Value of the time span. + attr_reader :value + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'type' => :'type', + :'unit' => :'unit', + :'value' => :'value' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'type' => :'WidgetNewLiveSpanType', + :'unit' => :'WidgetLiveSpanUnit', + :'value' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::WidgetNewLiveSpan` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'unit') + self.unit = attributes[:'unit'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + return false if @unit.nil? + return false if @value.nil? + return false if @value < 1 + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Custom attribute writer method with validation + # @param unit [Object] Object to be assigned + # @!visibility private + def unit=(unit) + if unit.nil? + fail ArgumentError, 'invalid value for "unit", unit cannot be nil.' + end + @unit = unit + end + + # Custom attribute writer method with validation + # @param value [Object] Object to be assigned + # @!visibility private + def value=(value) + if value.nil? + fail ArgumentError, 'invalid value for "value", value cannot be nil.' + end + if value < 1 + fail ArgumentError, 'invalid value for "value", must be greater than or equal to 1.' + end + @value = value + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + unit == o.unit && + value == o.value + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [type, unit, value].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/widget_new_live_span_type.rb b/lib/datadog_api_client/v1/models/widget_new_live_span_type.rb new file mode 100644 index 000000000000..2e377514289c --- /dev/null +++ b/lib/datadog_api_client/v1/models/widget_new_live_span_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V1 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V1 + # Type "live" denotes a live span in the new format. + class WidgetNewLiveSpanType + include BaseEnumModel + + LIVE = "live".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/widget_time.rb b/lib/datadog_api_client/v1/models/widget_time.rb index c8a0524315c5..47d268b3d81e 100644 --- a/lib/datadog_api_client/v1/models/widget_time.rb +++ b/lib/datadog_api_client/v1/models/widget_time.rb @@ -18,88 +18,47 @@ module DatadogAPIClient::V1 # Time setting for the widget. - class WidgetTime - include BaseGenericModel - - # The available timeframes depend on the widget you are using. - attr_accessor :live_span - - attr_accessor :additional_properties - - # Attribute mapping from ruby-style variable name to JSON key. - # @!visibility private - def self.attribute_map - { - :'live_span' => :'live_span' - } - end - - # Attribute type mapping. - # @!visibility private - def self.openapi_types - { - :'live_span' => :'WidgetLiveSpan' - } - end - - # Initializes the object - # @param attributes [Hash] Model attributes in the form of hash - # @!visibility private - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::WidgetTime` initialize method" + module WidgetTime + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'WidgetLegacyLiveSpan', + :'WidgetNewLiveSpan', + :'WidgetNewFixedSpan' + ] end - - self.additional_properties = {} - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - self.additional_properties[k.to_sym] = v - else - h[k.to_sym] = v + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end end - } - if attributes.key?(:'live_span') - self.live_span = attributes[:'live_span'] - end - end - - # Returns the object in the form of hash, with additionalProperties support. - # @return [Hash] Returns the object in the form of hash - # @!visibility private - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) end - - hash[param] = _to_hash(value) - end - self.additional_properties.each_pair do |attr, value| - hash[attr] = value end - hash - end - - # Checks equality by comparing each attribute. - # @param o [Object] Object to be compared - # @!visibility private - def ==(o) - return true if self.equal?(o) - self.class == o.class && - live_span == o.live_span - additional_properties == o.additional_properties - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - # @!visibility private - def hash - [live_span].hash end end end