diff --git a/.apigentools-info b/.apigentools-info index be0f325d46c9..2f7525f43a53 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-05-23 10:59:59.851281", - "spec_repo_commit": "b829bfa2" + "regenerated": "2024-05-23 18:14:50.405657", + "spec_repo_commit": "95a954a4" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-05-23 10:59:59.869149", - "spec_repo_commit": "b829bfa2" + "regenerated": "2024-05-23 18:14:50.423297", + "spec_repo_commit": "95a954a4" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 5764ef3500fb..8a0174885901 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -3043,6 +3043,14 @@ components: type: string x-enum-varnames: - METRIC + FormulaType: + description: Set the sort type to formula. + enum: + - formula + example: formula + type: string + x-enum-varnames: + - FORMULA FreeTextWidgetDefinition: description: Free text is a widget that allows you to add headings to your screenboard. Commonly used to state the overall purpose of the dashboard. Only available @@ -3411,6 +3419,8 @@ components: $ref: '#/components/schemas/LogQueryDefinition' security_query: $ref: '#/components/schemas/LogQueryDefinition' + sort: + $ref: '#/components/schemas/WidgetSortBy' type: object GraphSnapshot: description: Object representing a graph snapshot. @@ -3431,6 +3441,14 @@ components: example: https://app.datadoghq.com/s/f12345678/aaa-bbb-ccc type: string type: object + GroupType: + description: Set the sort type to group. + enum: + - group + example: group + type: string + x-enum-varnames: + - GROUP GroupWidgetDefinition: description: The groups widget allows you to keep similar graphs together on your timeboard. Each group has a custom header, can hold one to many graphs, @@ -16392,6 +16410,8 @@ components: $ref: '#/components/schemas/LogQueryDefinition' security_query: $ref: '#/components/schemas/LogQueryDefinition' + sort: + $ref: '#/components/schemas/WidgetSortBy' type: object TagToHosts: description: In this object, the key is the tag, the value is a list of host @@ -16728,6 +16748,8 @@ components: $ref: '#/components/schemas/LogQueryDefinition' security_query: $ref: '#/components/schemas/LogQueryDefinition' + sort: + $ref: '#/components/schemas/WidgetSortBy' style: $ref: '#/components/schemas/WidgetRequestStyle' type: object @@ -20939,6 +20961,24 @@ components: order: $ref: '#/components/schemas/QuerySortOrder' type: object + WidgetFormulaSort: + description: The formula to sort the widget by. + properties: + index: + description: The index of the formula to sort by. + example: 0 + format: int64 + minimum: 0 + type: integer + order: + $ref: '#/components/schemas/WidgetSort' + type: + $ref: '#/components/schemas/FormulaType' + required: + - type + - index + - order + type: object WidgetFormulaStyle: description: Styling options for widget formulas. properties: @@ -20953,6 +20993,22 @@ components: format: int64 type: integer type: object + WidgetGroupSort: + description: The group to sort the widget by. + properties: + name: + description: The name of the group. + example: group_name + type: string + order: + $ref: '#/components/schemas/WidgetSort' + type: + $ref: '#/components/schemas/GroupType' + required: + - type + - name + - order + type: object WidgetGrouping: description: The kind of grouping to use. enum: @@ -21328,6 +21384,25 @@ components: x-enum-varnames: - ASCENDING - DESCENDING + WidgetSortBy: + description: The controls for sorting the widget. + properties: + count: + description: The number of items to limit the widget to. + format: int64 + minimum: 0 + type: integer + order_by: + description: The array of items to sort the widget by in order. + items: + $ref: '#/components/schemas/WidgetSortOrderBy' + type: array + type: object + WidgetSortOrderBy: + description: The item to sort the widget by. + oneOf: + - $ref: '#/components/schemas/WidgetFormulaSort' + - $ref: '#/components/schemas/WidgetGroupSort' WidgetStyle: description: Widget style definition. properties: diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-a-toplist-widget-sorted-by-group.frozen b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-a-toplist-widget-sorted-by-group.frozen new file mode 100644 index 000000000000..a5750081be1c --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-a-toplist-widget-sorted-by-group.frozen @@ -0,0 +1 @@ +2024-05-21T14:43:42.680Z \ No newline at end of file diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-a-toplist-widget-sorted-by-group.yml b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-a-toplist-widget-sorted-by-group.yml new file mode 100644 index 000000000000..75088d7a1551 --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-a-toplist-widget-sorted-by-group.yml @@ -0,0 +1,49 @@ +http_interactions: +- recorded_at: Tue, 21 May 2024 14:43:42 GMT + request: + body: + encoding: UTF-8 + string: '{"description":"","is_read_only":false,"layout_type":"free","notify_list":[],"template_variables":[],"title":"Test-Create_a_new_dashboard_with_a_toplist_widget_sorted_by_group-1716302622","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1"}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} + by {service}"}],"response_format":"scalar","sort":{"count":10,"order_by":[{"name":"service","order":"asc","type":"group"}]}}],"style":{"display":{"legend":"inline","type":"stacked"},"scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"toplist"},"layout":{"height":15,"width":47,"x":0,"y":0}}]}' + 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":"wbt-nas-fux","title":"Test-Create_a_new_dashboard_with_a_toplist_widget_sorted_by_group-1716302622","description":"","author_handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","author_name":"CI + Account","layout_type":"free","url":"/dashboard/wbt-nas-fux/test-createanewdashboardwithatoplistwidgetsortedbygroup-1716302622","is_read_only":false,"template_variables":[],"widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1"}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} + by {service}"}],"response_format":"scalar","sort":{"count":10,"order_by":[{"name":"service","order":"asc","type":"group"}]}}],"style":{"display":{"legend":"inline","type":"stacked"},"scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"toplist"},"layout":{"height":15,"width":47,"x":0,"y":0},"id":4714578700620842}],"notify_list":[],"created_at":"2024-05-21T14:43:42.875646+00:00","modified_at":"2024-05-21T14:43:42.875646+00:00","restricted_roles":[]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Tue, 21 May 2024 14:43:42 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/wbt-nas-fux + response: + body: + encoding: UTF-8 + string: '{"deleted_dashboard_id":"wbt-nas-fux"} + + ' + 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-dashboard-with-geomap-widget.frozen b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-geomap-widget.frozen index 4fe889d0acc7..41f51372bbbc 100644 --- a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-geomap-widget.frozen +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-geomap-widget.frozen @@ -1 +1 @@ -2022-01-06T00:50:33.370Z \ No newline at end of file +2024-05-15T20:07:40.997Z \ No newline at end of file diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-geomap-widget.yml b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-geomap-widget.yml index bd4f5441ed59..5a8081ca6ca0 100644 --- a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-geomap-widget.yml +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-geomap-widget.yml @@ -1,9 +1,9 @@ http_interactions: -- recorded_at: Thu, 06 Jan 2022 00:50:33 GMT +- recorded_at: Wed, 15 May 2024 20:07:40 GMT request: body: encoding: UTF-8 - string: '{"description":null,"is_read_only":false,"layout_type":"free","notify_list":[],"template_variables":[],"title":"Test-Create_a_new_dashboard_with_geomap_widget-1641430233","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":250,"order":"desc"}}],"queries":[{"compute":{"aggregation":"count"},"data_source":"rum","group_by":[{"facet":"@geo.country_iso_code","limit":250,"sort":{"aggregation":"count","order":"desc"}}],"indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"scalar"}],"style":{"palette":"hostmap_blues","palette_flip":false},"time":{},"title":"","title_align":"left","title_size":"16","type":"geomap","view":{"focus":"WORLD"}},"layout":{"height":30,"width":47,"x":0,"y":0}}]}' + string: '{"description":null,"is_read_only":false,"layout_type":"free","notify_list":[],"template_variables":[],"title":"Test-Create_a_new_dashboard_with_geomap_widget-1715803660","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1"}],"queries":[{"compute":{"aggregation":"count"},"data_source":"rum","group_by":[{"facet":"@geo.country_iso_code","limit":250,"sort":{"aggregation":"count","order":"desc"}}],"indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"scalar","sort":{"count":250,"order_by":[{"index":0,"order":"desc","type":"formula"}]}}],"style":{"palette":"hostmap_blues","palette_flip":false},"time":{},"title":"","title_align":"left","title_size":"16","type":"geomap","view":{"focus":"WORLD"}},"layout":{"height":30,"width":47,"x":0,"y":0}}]}' headers: Accept: - application/json @@ -14,25 +14,30 @@ http_interactions: response: body: encoding: UTF-8 - string: '{"notify_list":[],"description":null,"restricted_roles":[],"author_name":null,"template_variables":[],"is_read_only":false,"id":"cqc-kbv-se3","title":"Test-Create_a_new_dashboard_with_geomap_widget-1641430233","url":"/dashboard/cqc-kbv-se3/test-createanewdashboardwithgeomapwidget-1641430233","created_at":"2022-01-06T00:50:33.554719+00:00","modified_at":"2022-01-06T00:50:33.554719+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"style":{"palette":"hostmap_blues","palette_flip":false},"title_size":"16","title":"","title_align":"left","time":{},"requests":[{"formulas":[{"formula":"query1","limit":{"count":250,"order":"desc"}}],"response_format":"scalar","queries":[{"search":{"query":""},"data_source":"rum","compute":{"aggregation":"count"},"name":"query1","indexes":["*"],"group_by":[{"facet":"@geo.country_iso_code","sort":{"aggregation":"count","order":"desc"},"limit":250}]}]}],"type":"geomap","view":{"focus":"WORLD"}},"layout":{"y":0,"width":47,"x":0,"height":30},"id":814328647870268}],"layout_type":"free"}' + string: '{"id":"38d-vt6-cf9","title":"Test-Create_a_new_dashboard_with_geomap_widget-1715803660","description":null,"author_handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","author_name":"CI + Account","layout_type":"free","url":"/dashboard/38d-vt6-cf9/test-createanewdashboardwithgeomapwidget-1715803660","is_read_only":false,"template_variables":[],"widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1"}],"queries":[{"compute":{"aggregation":"count"},"data_source":"rum","group_by":[{"facet":"@geo.country_iso_code","limit":250,"sort":{"aggregation":"count","order":"desc"}}],"indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"scalar","sort":{"count":250,"order_by":[{"index":0,"order":"desc","type":"formula"}]}}],"style":{"palette":"hostmap_blues","palette_flip":false},"time":{},"title":"","title_align":"left","title_size":"16","type":"geomap","view":{"focus":"WORLD"}},"layout":{"height":30,"width":47,"x":0,"y":0},"id":2497706086149326}],"notify_list":[],"created_at":"2024-05-15T20:07:41.236839+00:00","modified_at":"2024-05-15T20:07:41.236839+00:00","restricted_roles":[]} + + ' headers: Content-Type: - application/json status: code: 200 message: OK -- recorded_at: Thu, 06 Jan 2022 00:50:33 GMT +- recorded_at: Wed, 15 May 2024 20:07:40 GMT request: body: null headers: Accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/dashboard/cqc-kbv-se3 + uri: https://api.datadoghq.com/api/v1/dashboard/38d-vt6-cf9 response: body: encoding: UTF-8 - string: '{"deleted_dashboard_id":"cqc-kbv-se3"}' + string: '{"deleted_dashboard_id":"38d-vt6-cf9"} + + ' headers: Content-Type: - application/json diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-logs-query-table-widget-and-storage-parameter.frozen b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-logs-query-table-widget-and-storage-parameter.frozen index 8e22e04aabd2..b93cde460762 100644 --- a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-logs-query-table-widget-and-storage-parameter.frozen +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-logs-query-table-widget-and-storage-parameter.frozen @@ -1 +1 @@ -2022-09-22T15:06:29.061Z \ No newline at end of file +2024-05-15T20:07:41.518Z \ No newline at end of file diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-logs-query-table-widget-and-storage-parameter.yml b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-logs-query-table-widget-and-storage-parameter.yml index c4ad66225280..2460bd22ff6b 100644 --- a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-logs-query-table-widget-and-storage-parameter.yml +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-logs-query-table-widget-and-storage-parameter.yml @@ -1,10 +1,10 @@ http_interactions: -- recorded_at: Thu, 22 Sep 2022 15:06:29 GMT +- recorded_at: Wed, 15 May 2024 20:07:41 GMT request: body: encoding: UTF-8 - string: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_logs_query_table_widget_and_storage_parameter-1663859189 - with query table widget and storage parameter","widgets":[{"definition":{"requests":[{"formulas":[{"cell_display_mode":"bar","conditional_formats":[],"formula":"query1","limit":{"count":50,"order":"desc"}}],"queries":[{"compute":{"aggregation":"count"},"data_source":"logs","group_by":[],"indexes":["*"],"name":"query1","search":{"query":""},"storage":"online_archives"}],"response_format":"scalar"}],"type":"query_table"}}]}' + string: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_logs_query_table_widget_and_storage_parameter-1715803661 + with query table widget and storage parameter","widgets":[{"definition":{"requests":[{"formulas":[{"cell_display_mode":"bar","conditional_formats":[],"formula":"query1"}],"queries":[{"compute":{"aggregation":"count"},"data_source":"logs","group_by":[],"indexes":["*"],"name":"query1","search":{"query":""},"storage":"online_archives"}],"response_format":"scalar","sort":{"count":50,"order_by":[{"index":0,"order":"desc","type":"formula"}]}}],"type":"query_table"}}]}' headers: Accept: - application/json @@ -15,8 +15,9 @@ http_interactions: response: body: encoding: UTF-8 - string: '{"notify_list":null,"description":null,"restricted_roles":[],"author_name":null,"template_variables":null,"is_read_only":false,"id":"3my-5nt-jfx","title":"Test-Create_a_new_dashboard_with_logs_query_table_widget_and_storage_parameter-1663859189 - with query table widget and storage parameter","url":"/dashboard/3my-5nt-jfx/test-createanewdashboardwithlogsquerytablewidgetandstorageparameter-1663859189-w","created_at":"2022-09-22T15:06:29.565373+00:00","modified_at":"2022-09-22T15:06:29.565373+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1","cell_display_mode":"bar","limit":{"count":50,"order":"desc"},"conditional_formats":[]}],"response_format":"scalar","queries":[{"search":{"query":""},"data_source":"logs","compute":{"aggregation":"count"},"name":"query1","storage":"online_archives","indexes":["*"],"group_by":[]}]}],"type":"query_table"},"id":7645558730591730}],"layout_type":"ordered"} + string: '{"id":"pps-yna-n2n","title":"Test-Create_a_new_dashboard_with_logs_query_table_widget_and_storage_parameter-1715803661 + with query table widget and storage parameter","description":null,"author_handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","author_name":"CI + Account","layout_type":"ordered","url":"/dashboard/pps-yna-n2n/test-createanewdashboardwithlogsquerytablewidgetandstorageparameter-1715803661-w","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"requests":[{"formulas":[{"cell_display_mode":"bar","conditional_formats":[],"formula":"query1"}],"queries":[{"compute":{"aggregation":"count"},"data_source":"logs","group_by":[],"indexes":["*"],"name":"query1","search":{"query":""},"storage":"online_archives"}],"response_format":"scalar","sort":{"count":50,"order_by":[{"index":0,"order":"desc","type":"formula"}]}}],"type":"query_table"},"id":8781722139143844}],"notify_list":null,"created_at":"2024-05-15T20:07:41.693500+00:00","modified_at":"2024-05-15T20:07:41.693500+00:00","restricted_roles":[]} ' headers: @@ -25,18 +26,18 @@ http_interactions: status: code: 200 message: OK -- recorded_at: Thu, 22 Sep 2022 15:06:29 GMT +- recorded_at: Wed, 15 May 2024 20:07:41 GMT request: body: null headers: Accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/dashboard/3my-5nt-jfx + uri: https://api.datadoghq.com/api/v1/dashboard/pps-yna-n2n response: body: encoding: UTF-8 - string: '{"deleted_dashboard_id":"3my-5nt-jfx"} + string: '{"deleted_dashboard_id":"pps-yna-n2n"} ' headers: diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-query-table-widget.frozen b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-query-table-widget.frozen index e860e5343d73..12f16776248e 100644 --- a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-query-table-widget.frozen +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-query-table-widget.frozen @@ -1 +1 @@ -2022-01-06T00:50:38.157Z \ No newline at end of file +2024-05-15T20:07:41.983Z \ No newline at end of file diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-query-table-widget.yml b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-query-table-widget.yml index 18d565d8339c..19104918134e 100644 --- a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-query-table-widget.yml +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-query-table-widget.yml @@ -1,10 +1,10 @@ http_interactions: -- recorded_at: Thu, 06 Jan 2022 00:50:38 GMT +- recorded_at: Wed, 15 May 2024 20:07:41 GMT request: body: encoding: UTF-8 - string: '{"description":"","is_read_only":false,"layout_type":"free","notify_list":[],"template_variables":[],"title":"Test-Create_a_new_dashboard_with_query_table_widget-1641430238","widgets":[{"definition":{"has_search_bar":"auto","requests":[{"formulas":[{"cell_display_mode":"bar","conditional_formats":[],"formula":"query1","limit":{"count":500,"order":"desc"}}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} - by {host}"}],"response_format":"scalar"}],"time":{},"title":"","title_align":"left","title_size":"16","type":"query_table"},"layout":{"height":32,"width":54,"x":0,"y":0}}]}' + string: '{"description":"","is_read_only":false,"layout_type":"free","notify_list":[],"template_variables":[],"title":"Test-Create_a_new_dashboard_with_query_table_widget-1715803661","widgets":[{"definition":{"has_search_bar":"auto","requests":[{"formulas":[{"cell_display_mode":"bar","conditional_formats":[],"formula":"query1"}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} + by {host}"}],"response_format":"scalar","sort":{"count":500,"order_by":[{"index":0,"order":"desc","type":"formula"}]}}],"time":{},"title":"","title_align":"left","title_size":"16","type":"query_table"},"layout":{"height":32,"width":54,"x":0,"y":0}}]}' headers: Accept: - application/json @@ -15,26 +15,31 @@ http_interactions: response: body: encoding: UTF-8 - string: '{"notify_list":[],"description":"","restricted_roles":[],"author_name":null,"template_variables":[],"is_read_only":false,"id":"sqa-699-xcc","title":"Test-Create_a_new_dashboard_with_query_table_widget-1641430238","url":"/dashboard/sqa-699-xcc/test-createanewdashboardwithquerytablewidget-1641430238","created_at":"2022-01-06T00:50:38.368385+00:00","modified_at":"2022-01-06T00:50:38.368385+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"title_size":"16","title":"","title_align":"left","has_search_bar":"auto","time":{},"requests":[{"formulas":[{"formula":"query1","cell_display_mode":"bar","limit":{"count":500,"order":"desc"},"conditional_formats":[]}],"response_format":"scalar","queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} - by {host}"}]}],"type":"query_table"},"layout":{"y":0,"width":54,"x":0,"height":32},"id":4876182137167827}],"layout_type":"free"}' + string: '{"id":"gau-v5i-xn9","title":"Test-Create_a_new_dashboard_with_query_table_widget-1715803661","description":"","author_handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","author_name":"CI + Account","layout_type":"free","url":"/dashboard/gau-v5i-xn9/test-createanewdashboardwithquerytablewidget-1715803661","is_read_only":false,"template_variables":[],"widgets":[{"definition":{"has_search_bar":"auto","requests":[{"formulas":[{"cell_display_mode":"bar","conditional_formats":[],"formula":"query1"}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} + by {host}"}],"response_format":"scalar","sort":{"count":500,"order_by":[{"index":0,"order":"desc","type":"formula"}]}}],"time":{},"title":"","title_align":"left","title_size":"16","type":"query_table"},"layout":{"height":32,"width":54,"x":0,"y":0},"id":2055060354863184}],"notify_list":[],"created_at":"2024-05-15T20:07:42.157797+00:00","modified_at":"2024-05-15T20:07:42.157797+00:00","restricted_roles":[]} + + ' headers: Content-Type: - application/json status: code: 200 message: OK -- recorded_at: Thu, 06 Jan 2022 00:50:38 GMT +- recorded_at: Wed, 15 May 2024 20:07:41 GMT request: body: null headers: Accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/dashboard/sqa-699-xcc + uri: https://api.datadoghq.com/api/v1/dashboard/gau-v5i-xn9 response: body: encoding: UTF-8 - string: '{"deleted_dashboard_id":"sqa-699-xcc"}' + string: '{"deleted_dashboard_id":"gau-v5i-xn9"} + + ' headers: Content-Type: - application/json diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-toplist-widget.frozen b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-toplist-widget.frozen index 5402413b1cc7..858c73b2553c 100644 --- a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-toplist-widget.frozen +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-toplist-widget.frozen @@ -1 +1 @@ -2023-10-26T08:09:58.883Z \ No newline at end of file +2024-05-15T20:07:42.432Z \ No newline at end of file diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-toplist-widget.yml b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-toplist-widget.yml index 63765e81af36..9f72dfc430dc 100644 --- a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-toplist-widget.yml +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-toplist-widget.yml @@ -1,10 +1,10 @@ http_interactions: -- recorded_at: Thu, 26 Oct 2023 08:09:58 GMT +- recorded_at: Wed, 15 May 2024 20:07:42 GMT request: body: encoding: UTF-8 - string: '{"description":"","is_read_only":false,"layout_type":"free","notify_list":[],"template_variables":[],"title":"Test-Create_a_new_dashboard_with_toplist_widget-1698307798","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":10,"order":"desc"}}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} - by {service}"}],"response_format":"scalar"}],"style":{"display":{"legend":"inline","type":"stacked"},"scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"toplist"},"layout":{"height":15,"width":47,"x":0,"y":0}}]}' + string: '{"description":"","is_read_only":false,"layout_type":"free","notify_list":[],"template_variables":[],"title":"Test-Create_a_new_dashboard_with_toplist_widget-1715803662","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1"}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} + by {service}"}],"response_format":"scalar","sort":{"count":10,"order_by":[{"index":0,"order":"desc","type":"formula"}]}}],"style":{"display":{"legend":"inline","type":"stacked"},"scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"toplist"},"layout":{"height":15,"width":47,"x":0,"y":0}}]}' headers: Accept: - application/json @@ -15,8 +15,9 @@ http_interactions: response: body: encoding: UTF-8 - string: '{"id":"bw8-fjj-cai","title":"Test-Create_a_new_dashboard_with_toplist_widget-1698307798","description":"","author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"free","url":"/dashboard/bw8-fjj-cai/test-createanewdashboardwithtoplistwidget-1698307798","is_read_only":false,"template_variables":[],"widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1","limit":{"count":10,"order":"desc"}}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} - by {service}"}],"response_format":"scalar"}],"style":{"display":{"legend":"inline","type":"stacked"},"scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"toplist"},"layout":{"height":15,"width":47,"x":0,"y":0},"id":7690286767696538}],"notify_list":[],"created_at":"2023-10-26T08:09:59.495981+00:00","modified_at":"2023-10-26T08:09:59.495981+00:00","restricted_roles":[]} + string: '{"id":"y3a-6s5-ycw","title":"Test-Create_a_new_dashboard_with_toplist_widget-1715803662","description":"","author_handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","author_name":"CI + Account","layout_type":"free","url":"/dashboard/y3a-6s5-ycw/test-createanewdashboardwithtoplistwidget-1715803662","is_read_only":false,"template_variables":[],"widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1"}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} + by {service}"}],"response_format":"scalar","sort":{"count":10,"order_by":[{"index":0,"order":"desc","type":"formula"}]}}],"style":{"display":{"legend":"inline","type":"stacked"},"scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"toplist"},"layout":{"height":15,"width":47,"x":0,"y":0},"id":1848529953140569}],"notify_list":[],"created_at":"2024-05-15T20:07:42.589379+00:00","modified_at":"2024-05-15T20:07:42.589379+00:00","restricted_roles":[]} ' headers: @@ -25,18 +26,18 @@ http_interactions: status: code: 200 message: OK -- recorded_at: Thu, 26 Oct 2023 08:09:58 GMT +- recorded_at: Wed, 15 May 2024 20:07:42 GMT request: body: null headers: Accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/dashboard/bw8-fjj-cai + uri: https://api.datadoghq.com/api/v1/dashboard/y3a-6s5-ycw response: body: encoding: UTF-8 - string: '{"deleted_dashboard_id":"bw8-fjj-cai"} + string: '{"deleted_dashboard_id":"y3a-6s5-ycw"} ' headers: diff --git a/examples/v1/dashboards/CreateDashboard_1213075383.rb b/examples/v1/dashboards/CreateDashboard_1213075383.rb index dc29ae570581..a034cfe838ea 100644 --- a/examples/v1/dashboards/CreateDashboard_1213075383.rb +++ b/examples/v1/dashboards/CreateDashboard_1213075383.rb @@ -40,12 +40,18 @@ formulas: [ DatadogAPIClient::V1::WidgetFormula.new({ formula: "query1", - limit: DatadogAPIClient::V1::WidgetFormulaLimit.new({ - count: 10, - order: DatadogAPIClient::V1::QuerySortOrder::DESC, - }), }), ], + sort: DatadogAPIClient::V1::WidgetSortBy.new({ + count: 10, + order_by: [ + DatadogAPIClient::V1::WidgetFormulaSort.new({ + type: DatadogAPIClient::V1::FormulaType::FORMULA, + index: 0, + order: DatadogAPIClient::V1::WidgetSort::DESCENDING, + }), + ], + }), response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::SCALAR, }), ], diff --git a/examples/v1/dashboards/CreateDashboard_2336428357.rb b/examples/v1/dashboards/CreateDashboard_2336428357.rb index 1a68645b9e10..944b46a2259f 100644 --- a/examples/v1/dashboards/CreateDashboard_2336428357.rb +++ b/examples/v1/dashboards/CreateDashboard_2336428357.rb @@ -33,14 +33,20 @@ formulas: [ DatadogAPIClient::V1::WidgetFormula.new({ formula: "query1", - limit: DatadogAPIClient::V1::WidgetFormulaLimit.new({ - count: 500, - order: DatadogAPIClient::V1::QuerySortOrder::DESC, - }), conditional_formats: [], cell_display_mode: DatadogAPIClient::V1::TableWidgetCellDisplayMode::BAR, }), ], + sort: DatadogAPIClient::V1::WidgetSortBy.new({ + count: 500, + order_by: [ + DatadogAPIClient::V1::WidgetFormulaSort.new({ + type: DatadogAPIClient::V1::FormulaType::FORMULA, + index: 0, + order: DatadogAPIClient::V1::WidgetSort::DESCENDING, + }), + ], + }), response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::SCALAR, }), ], diff --git a/examples/v1/dashboards/CreateDashboard_2563642929.rb b/examples/v1/dashboards/CreateDashboard_2563642929.rb new file mode 100644 index 000000000000..9c13568e06d6 --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_2563642929.rb @@ -0,0 +1,66 @@ +# Create a new dashboard with a toplist widget sorted by group + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::DashboardsAPI.new + +body = DatadogAPIClient::V1::Dashboard.new({ + title: "Example-Dashboard", + description: "", + widgets: [ + DatadogAPIClient::V1::Widget.new({ + layout: DatadogAPIClient::V1::WidgetLayout.new({ + x: 0, + y: 0, + width: 47, + height: 15, + }), + definition: DatadogAPIClient::V1::ToplistWidgetDefinition.new({ + title: "", + title_size: "16", + title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, + time: DatadogAPIClient::V1::WidgetTime.new({}), + style: DatadogAPIClient::V1::ToplistWidgetStyle.new({ + display: DatadogAPIClient::V1::ToplistWidgetStacked.new({ + type: DatadogAPIClient::V1::ToplistWidgetStackedType::STACKED, + legend: DatadogAPIClient::V1::ToplistWidgetLegend::INLINE, + }), + scaling: DatadogAPIClient::V1::ToplistWidgetScaling::RELATIVE, + }), + type: DatadogAPIClient::V1::ToplistWidgetDefinitionType::TOPLIST, + requests: [ + DatadogAPIClient::V1::ToplistWidgetRequest.new({ + queries: [ + DatadogAPIClient::V1::FormulaAndFunctionMetricQueryDefinition.new({ + data_source: DatadogAPIClient::V1::FormulaAndFunctionMetricDataSource::METRICS, + name: "query1", + query: "avg:system.cpu.user{*} by {service}", + aggregator: DatadogAPIClient::V1::FormulaAndFunctionMetricAggregation::AVG, + }), + ], + formulas: [ + DatadogAPIClient::V1::WidgetFormula.new({ + formula: "query1", + }), + ], + sort: DatadogAPIClient::V1::WidgetSortBy.new({ + count: 10, + order_by: [ + DatadogAPIClient::V1::WidgetGroupSort.new({ + type: DatadogAPIClient::V1::GroupType::GROUP, + name: "service", + order: DatadogAPIClient::V1::WidgetSort::ASCENDING, + }), + ], + }), + response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::SCALAR, + }), + ], + }), + }), + ], + template_variables: [], + layout_type: DatadogAPIClient::V1::DashboardLayoutType::FREE, + is_read_only: false, + notify_list: [], +}) +p api_instance.create_dashboard(body) diff --git a/examples/v1/dashboards/CreateDashboard_3669695268.rb b/examples/v1/dashboards/CreateDashboard_3669695268.rb index 0a3f3b8e6cd9..20466c61fba0 100644 --- a/examples/v1/dashboards/CreateDashboard_3669695268.rb +++ b/examples/v1/dashboards/CreateDashboard_3669695268.rb @@ -34,12 +34,18 @@ conditional_formats: [], cell_display_mode: DatadogAPIClient::V1::TableWidgetCellDisplayMode::BAR, formula: "query1", - limit: DatadogAPIClient::V1::WidgetFormulaLimit.new({ - count: 50, - order: DatadogAPIClient::V1::QuerySortOrder::DESC, - }), }), ], + sort: DatadogAPIClient::V1::WidgetSortBy.new({ + count: 50, + order_by: [ + DatadogAPIClient::V1::WidgetFormulaSort.new({ + type: DatadogAPIClient::V1::FormulaType::FORMULA, + index: 0, + order: DatadogAPIClient::V1::WidgetSort::DESCENDING, + }), + ], + }), response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::SCALAR, }), ], diff --git a/examples/v1/dashboards/CreateDashboard_915214113.rb b/examples/v1/dashboards/CreateDashboard_915214113.rb index 845a3312c8df..92732b60b544 100644 --- a/examples/v1/dashboards/CreateDashboard_915214113.rb +++ b/examples/v1/dashboards/CreateDashboard_915214113.rb @@ -25,10 +25,6 @@ formulas: [ DatadogAPIClient::V1::WidgetFormula.new({ formula: "query1", - limit: DatadogAPIClient::V1::WidgetFormulaLimit.new({ - count: 250, - order: DatadogAPIClient::V1::QuerySortOrder::DESC, - }), }), ], queries: [ @@ -56,6 +52,16 @@ ], }), ], + sort: DatadogAPIClient::V1::WidgetSortBy.new({ + count: 250, + order_by: [ + DatadogAPIClient::V1::WidgetFormulaSort.new({ + type: DatadogAPIClient::V1::FormulaType::FORMULA, + index: 0, + order: DatadogAPIClient::V1::WidgetSort::DESCENDING, + }), + ], + }), response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::SCALAR, }), ], diff --git a/features/v1/dashboards.feature b/features/v1/dashboards.feature index e631bc34593a..1f42aa8f0723 100644 --- a/features/v1/dashboards.feature +++ b/features/v1/dashboards.feature @@ -187,6 +187,17 @@ Feature: Dashboards 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 a toplist widget sorted by group + Given new "CreateDashboard" request + And body with value {"title":"{{ unique }}","description":"","widgets":[{"layout":{"x":0,"y":0,"width":47,"height":15},"definition":{"title":"","title_size":"16","title_align":"left","time":{},"style":{"display": {"type": "stacked","legend": "inline"},"scaling": "relative"},"type":"toplist","requests":[{"queries":[{"data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} by {service}","aggregator":"avg"}],"formulas":[{"formula":"query1"}],"sort":{"count":10,"order_by":[{"type":"group","name":"service","order":"asc"}]},"response_format":"scalar"}]}}],"template_variables":[],"layout_type":"free","is_read_only":false,"notify_list":[]} + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.type" is equal to "toplist" + And the response "widgets[0].definition.requests[0].sort.order_by[0].order" is equal to "asc" + And the response "widgets[0].definition.requests[0].sort.order_by[0].type" is equal to "group" + And the response "widgets[0].definition.requests[0].sort.order_by[0].name" is equal to "service" + @team:DataDog/dashboards-backend Scenario: Create a new dashboard with alert_graph widget Given there is a valid "monitor" in the system @@ -386,6 +397,9 @@ Feature: Dashboards When the request is sent Then the response status is 200 OK And the response "widgets[0].definition.type" is equal to "geomap" + And the response "widgets[0].definition.requests[0].sort.order_by[0].order" is equal to "desc" + And the response "widgets[0].definition.requests[0].sort.order_by[0].type" is equal to "formula" + And the response "widgets[0].definition.requests[0].sort.order_by[0].index" is equal to 0 @team:DataDog/dashboards-backend Scenario: Create a new dashboard with heatmap widget @@ -478,12 +492,15 @@ Feature: Dashboards @team:DataDog/dashboards-backend Scenario: Create a new dashboard with logs query table widget and storage parameter Given new "CreateDashboard" request - And body with value {"layout_type":"ordered","title":"{{ unique }} with query table widget and storage parameter","widgets":[{"definition":{"type":"query_table","requests":[{"queries":[{"data_source":"logs","name":"query1","search":{"query":""},"indexes":["*"],"compute":{"aggregation":"count"},"group_by":[],"storage":"online_archives"}],"formulas":[{"conditional_formats":[],"cell_display_mode":"bar","formula":"query1","limit":{"count":50,"order":"desc"}}],"response_format":"scalar"}]}}]} + And body with value {"layout_type":"ordered","title":"{{ unique }} with query table widget and storage parameter","widgets":[{"definition":{"type":"query_table","requests":[{"queries":[{"data_source":"logs","name":"query1","search":{"query":""},"indexes":["*"],"compute":{"aggregation":"count"},"group_by":[],"storage":"online_archives"}],"formulas":[{"conditional_formats":[],"cell_display_mode":"bar","formula":"query1"}],"sort":{"count":50, "order_by":[{"type":"formula","index":0,"order":"desc"}]},"response_format":"scalar"}]}}]} When the request is sent Then the response status is 200 OK And the response "widgets[0].definition.type" is equal to "query_table" And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "logs" And the response "widgets[0].definition.requests[0].queries[0].storage" is equal to "online_archives" + And the response "widgets[0].definition.requests[0].sort.order_by[0].order" is equal to "desc" + And the response "widgets[0].definition.requests[0].sort.order_by[0].type" is equal to "formula" + And the response "widgets[0].definition.requests[0].sort.order_by[0].index" is equal to 0 @team:DataDog/dashboards-backend Scenario: Create a new dashboard with logs_pattern_stream list_stream widget @@ -559,6 +576,9 @@ Feature: Dashboards When the request is sent Then the response status is 200 OK And the response "widgets[0].definition.type" is equal to "query_table" + And the response "widgets[0].definition.requests[0].sort.order_by[0].order" is equal to "desc" + And the response "widgets[0].definition.requests[0].sort.order_by[0].type" is equal to "formula" + And the response "widgets[0].definition.requests[0].sort.order_by[0].index" is equal to 0 @team:DataDog/dashboards-backend Scenario: Create a new dashboard with query_value widget @@ -758,6 +778,9 @@ Feature: Dashboards When the request is sent Then the response status is 200 OK And the response "widgets[0].definition.type" is equal to "toplist" + And the response "widgets[0].definition.requests[0].sort.order_by[0].order" is equal to "desc" + And the response "widgets[0].definition.requests[0].sort.order_by[0].type" is equal to "formula" + And the response "widgets[0].definition.requests[0].sort.order_by[0].index" is equal to 0 @team:DataDog/dashboards-backend Scenario: Create a new dashboard with topology_map widget diff --git a/features/v1/dashboards_json_payload/geomap_widget.json b/features/v1/dashboards_json_payload/geomap_widget.json index 7eff35698abc..240094d45320 100644 --- a/features/v1/dashboards_json_payload/geomap_widget.json +++ b/features/v1/dashboards_json_payload/geomap_widget.json @@ -21,11 +21,7 @@ { "formulas":[ { - "formula":"query1", - "limit":{ - "count":250, - "order":"desc" - } + "formula":"query1" } ], "queries":[ @@ -53,6 +49,16 @@ ] } ], + "sort": { + "count":250, + "order_by":[ + { + "type":"formula", + "index":0, + "order":"desc" + } + ] + }, "response_format":"scalar" } ], diff --git a/features/v1/dashboards_json_payload/query_table_widget.json b/features/v1/dashboards_json_payload/query_table_widget.json index d9e516ff054e..d68b21f5c9a0 100644 --- a/features/v1/dashboards_json_payload/query_table_widget.json +++ b/features/v1/dashboards_json_payload/query_table_widget.json @@ -30,16 +30,22 @@ "formulas":[ { "formula":"query1", - "limit":{ - "count":500, - "order":"desc" - }, "conditional_formats":[ ], "cell_display_mode":"bar" } ], + "sort": { + "count":500, + "order_by":[ + { + "type":"formula", + "index":0, + "order":"desc" + } + ] + }, "response_format":"scalar" } ], diff --git a/features/v1/dashboards_json_payload/toplist_widget.json b/features/v1/dashboards_json_payload/toplist_widget.json index 9bee1724c4de..fd16e0a61210 100644 --- a/features/v1/dashboards_json_payload/toplist_widget.json +++ b/features/v1/dashboards_json_payload/toplist_widget.json @@ -36,13 +36,19 @@ ], "formulas":[ { - "formula":"query1", - "limit":{ - "count":10, - "order":"desc" - } + "formula":"query1" } ], + "sort": { + "count":10, + "order_by":[ + { + "type":"formula", + "index":0, + "order":"desc" + } + ] + }, "response_format":"scalar" } ] diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 6428861f2265..a9854db11bd3 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -143,6 +143,7 @@ def overrides "v1.formula_and_function_slo_measure" => "FormulaAndFunctionSLOMeasure", "v1.formula_and_function_slo_query_definition" => "FormulaAndFunctionSLOQueryDefinition", "v1.formula_and_function_slo_query_type" => "FormulaAndFunctionSLOQueryType", + "v1.formula_type" => "FormulaType", "v1.free_text_widget_definition" => "FreeTextWidgetDefinition", "v1.free_text_widget_definition_type" => "FreeTextWidgetDefinitionType", "v1.funnel_query" => "FunnelQuery", @@ -159,6 +160,7 @@ def overrides "v1.geomap_widget_definition_view" => "GeomapWidgetDefinitionView", "v1.geomap_widget_request" => "GeomapWidgetRequest", "v1.graph_snapshot" => "GraphSnapshot", + "v1.group_type" => "GroupType", "v1.group_widget_definition" => "GroupWidgetDefinition", "v1.group_widget_definition_type" => "GroupWidgetDefinitionType", "v1.heat_map_widget_definition" => "HeatMapWidgetDefinition", @@ -819,8 +821,10 @@ def overrides "v1.widget_field_sort" => "WidgetFieldSort", "v1.widget_formula" => "WidgetFormula", "v1.widget_formula_limit" => "WidgetFormulaLimit", + "v1.widget_formula_sort" => "WidgetFormulaSort", "v1.widget_formula_style" => "WidgetFormulaStyle", "v1.widget_grouping" => "WidgetGrouping", + "v1.widget_group_sort" => "WidgetGroupSort", "v1.widget_horizontal_align" => "WidgetHorizontalAlign", "v1.widget_image_sizing" => "WidgetImageSizing", "v1.widget_layout" => "WidgetLayout", @@ -840,6 +844,8 @@ def overrides "v1.widget_service_summary_display_format" => "WidgetServiceSummaryDisplayFormat", "v1.widget_size_format" => "WidgetSizeFormat", "v1.widget_sort" => "WidgetSort", + "v1.widget_sort_by" => "WidgetSortBy", + "v1.widget_sort_order_by" => "WidgetSortOrderBy", "v1.widget_style" => "WidgetStyle", "v1.widget_summary_type" => "WidgetSummaryType", "v1.widget_text_align" => "WidgetTextAlign", diff --git a/lib/datadog_api_client/v1/models/formula_type.rb b/lib/datadog_api_client/v1/models/formula_type.rb new file mode 100644 index 000000000000..056f2bc708ac --- /dev/null +++ b/lib/datadog_api_client/v1/models/formula_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 + # Set the sort type to formula. + class FormulaType + include BaseEnumModel + + FORMULA = "formula".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/geomap_widget_request.rb b/lib/datadog_api_client/v1/models/geomap_widget_request.rb index b078dbb020d3..be83daff2cd1 100644 --- a/lib/datadog_api_client/v1/models/geomap_widget_request.rb +++ b/lib/datadog_api_client/v1/models/geomap_widget_request.rb @@ -48,6 +48,9 @@ class GeomapWidgetRequest # The log query. attr_accessor :security_query + # The controls for sorting the widget. + attr_accessor :sort + # Attribute mapping from ruby-style variable name to JSON key. # @!visibility private def self.attribute_map @@ -60,7 +63,8 @@ def self.attribute_map :'query' => :'query', :'response_format' => :'response_format', :'rum_query' => :'rum_query', - :'security_query' => :'security_query' + :'security_query' => :'security_query', + :'sort' => :'sort' } end @@ -76,7 +80,8 @@ def self.openapi_types :'query' => :'ListStreamQuery', :'response_format' => :'FormulaAndFunctionResponseFormat', :'rum_query' => :'LogQueryDefinition', - :'security_query' => :'LogQueryDefinition' + :'security_query' => :'LogQueryDefinition', + :'sort' => :'WidgetSortBy' } end @@ -137,6 +142,10 @@ def initialize(attributes = {}) if attributes.key?(:'security_query') self.security_query = attributes[:'security_query'] end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end end # Checks equality by comparing each attribute. @@ -153,14 +162,15 @@ def ==(o) query == o.query && response_format == o.response_format && rum_query == o.rum_query && - security_query == o.security_query + security_query == o.security_query && + sort == o.sort end # Calculates hash code according to all attributes. # @return [Integer] Hash code # @!visibility private def hash - [columns, formulas, log_query, q, queries, query, response_format, rum_query, security_query].hash + [columns, formulas, log_query, q, queries, query, response_format, rum_query, security_query, sort].hash end end end diff --git a/lib/datadog_api_client/v1/models/group_type.rb b/lib/datadog_api_client/v1/models/group_type.rb new file mode 100644 index 000000000000..f17af36a58f0 --- /dev/null +++ b/lib/datadog_api_client/v1/models/group_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 + # Set the sort type to group. + class GroupType + include BaseEnumModel + + GROUP = "group".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/table_widget_request.rb b/lib/datadog_api_client/v1/models/table_widget_request.rb index 2aa74ac800ad..7e3d908249dc 100644 --- a/lib/datadog_api_client/v1/models/table_widget_request.rb +++ b/lib/datadog_api_client/v1/models/table_widget_request.rb @@ -78,6 +78,9 @@ class TableWidgetRequest # The log query. attr_accessor :security_query + # The controls for sorting the widget. + attr_accessor :sort + # Attribute mapping from ruby-style variable name to JSON key. # @!visibility private def self.attribute_map @@ -100,7 +103,8 @@ def self.attribute_map :'queries' => :'queries', :'response_format' => :'response_format', :'rum_query' => :'rum_query', - :'security_query' => :'security_query' + :'security_query' => :'security_query', + :'sort' => :'sort' } end @@ -126,7 +130,8 @@ def self.openapi_types :'queries' => :'Array', :'response_format' => :'FormulaAndFunctionResponseFormat', :'rum_query' => :'LogQueryDefinition', - :'security_query' => :'LogQueryDefinition' + :'security_query' => :'LogQueryDefinition', + :'sort' => :'WidgetSortBy' } end @@ -229,6 +234,10 @@ def initialize(attributes = {}) if attributes.key?(:'security_query') self.security_query = attributes[:'security_query'] end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end end # Checks equality by comparing each attribute. @@ -255,14 +264,15 @@ def ==(o) queries == o.queries && response_format == o.response_format && rum_query == o.rum_query && - security_query == o.security_query + security_query == o.security_query && + sort == o.sort end # Calculates hash code according to all attributes. # @return [Integer] Hash code # @!visibility private def hash - [aggregator, _alias, apm_query, apm_stats_query, cell_display_mode, conditional_formats, event_query, formulas, limit, log_query, network_query, order, process_query, profile_metrics_query, q, queries, response_format, rum_query, security_query].hash + [aggregator, _alias, apm_query, apm_stats_query, cell_display_mode, conditional_formats, event_query, formulas, limit, log_query, network_query, order, process_query, profile_metrics_query, q, queries, response_format, rum_query, security_query, sort].hash end end end diff --git a/lib/datadog_api_client/v1/models/toplist_widget_request.rb b/lib/datadog_api_client/v1/models/toplist_widget_request.rb index 81bdeac3e19d..b0881ae023a9 100644 --- a/lib/datadog_api_client/v1/models/toplist_widget_request.rb +++ b/lib/datadog_api_client/v1/models/toplist_widget_request.rb @@ -63,6 +63,9 @@ class ToplistWidgetRequest # The log query. attr_accessor :security_query + # The controls for sorting the widget. + attr_accessor :sort + # Define request widget style. attr_accessor :style @@ -84,6 +87,7 @@ def self.attribute_map :'response_format' => :'response_format', :'rum_query' => :'rum_query', :'security_query' => :'security_query', + :'sort' => :'sort', :'style' => :'style' } end @@ -106,6 +110,7 @@ def self.openapi_types :'response_format' => :'FormulaAndFunctionResponseFormat', :'rum_query' => :'LogQueryDefinition', :'security_query' => :'LogQueryDefinition', + :'sort' => :'WidgetSortBy', :'style' => :'WidgetRequestStyle' } end @@ -188,6 +193,10 @@ def initialize(attributes = {}) self.security_query = attributes[:'security_query'] end + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end + if attributes.key?(:'style') self.style = attributes[:'style'] end @@ -231,6 +240,7 @@ def ==(o) response_format == o.response_format && rum_query == o.rum_query && security_query == o.security_query && + sort == o.sort && style == o.style end @@ -238,7 +248,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [apm_query, audit_query, conditional_formats, event_query, formulas, log_query, network_query, process_query, profile_metrics_query, q, queries, response_format, rum_query, security_query, style].hash + [apm_query, audit_query, conditional_formats, event_query, formulas, log_query, network_query, process_query, profile_metrics_query, q, queries, response_format, rum_query, security_query, sort, style].hash end end end diff --git a/lib/datadog_api_client/v1/models/widget_formula_sort.rb b/lib/datadog_api_client/v1/models/widget_formula_sort.rb new file mode 100644 index 000000000000..b4ca83e3820b --- /dev/null +++ b/lib/datadog_api_client/v1/models/widget_formula_sort.rb @@ -0,0 +1,144 @@ +=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 + # The formula to sort the widget by. + class WidgetFormulaSort + include BaseGenericModel + + # The index of the formula to sort by. + attr_reader :index + + # Widget sorting methods. + attr_reader :order + + # Set the sort type to formula. + attr_reader :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'index' => :'index', + :'order' => :'order', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'index' => :'Integer', + :'order' => :'WidgetSort', + :'type' => :'FormulaType' + } + 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::WidgetFormulaSort` 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::WidgetFormulaSort`. 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?(:'index') + self.index = attributes[:'index'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + 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 @index.nil? + return false if @index < 0 + return false if @order.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param index [Object] Object to be assigned + # @!visibility private + def index=(index) + if index.nil? + fail ArgumentError, 'invalid value for "index", index cannot be nil.' + end + if index < 0 + fail ArgumentError, 'invalid value for "index", must be greater than or equal to 0.' + end + @index = index + end + + # Custom attribute writer method with validation + # @param order [Object] Object to be assigned + # @!visibility private + def order=(order) + if order.nil? + fail ArgumentError, 'invalid value for "order", order cannot be nil.' + end + @order = order + 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 + + # 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 && + index == o.index && + order == o.order && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [index, order, type].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/widget_group_sort.rb b/lib/datadog_api_client/v1/models/widget_group_sort.rb new file mode 100644 index 000000000000..a9f54ac312a0 --- /dev/null +++ b/lib/datadog_api_client/v1/models/widget_group_sort.rb @@ -0,0 +1,140 @@ +=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 + # The group to sort the widget by. + class WidgetGroupSort + include BaseGenericModel + + # The name of the group. + attr_reader :name + + # Widget sorting methods. + attr_reader :order + + # Set the sort type to group. + attr_reader :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'name' => :'name', + :'order' => :'order', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'name' => :'String', + :'order' => :'WidgetSort', + :'type' => :'GroupType' + } + 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::WidgetGroupSort` 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::WidgetGroupSort`. 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?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'order') + self.order = attributes[:'order'] + 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 @name.nil? + return false if @order.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param order [Object] Object to be assigned + # @!visibility private + def order=(order) + if order.nil? + fail ArgumentError, 'invalid value for "order", order cannot be nil.' + end + @order = order + 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 + + # 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 && + name == o.name && + order == o.order && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [name, order, type].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/widget_sort_by.rb b/lib/datadog_api_client/v1/models/widget_sort_by.rb new file mode 100644 index 000000000000..670a54bff2af --- /dev/null +++ b/lib/datadog_api_client/v1/models/widget_sort_by.rb @@ -0,0 +1,110 @@ +=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 + # The controls for sorting the widget. + class WidgetSortBy + include BaseGenericModel + + # The number of items to limit the widget to. + attr_reader :count + + # The array of items to sort the widget by in order. + attr_accessor :order_by + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'count' => :'count', + :'order_by' => :'order_by' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'count' => :'Integer', + :'order_by' => :'Array' + } + 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::WidgetSortBy` 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::WidgetSortBy`. 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?(:'count') + self.count = attributes[:'count'] + end + + if attributes.key?(:'order_by') + if (value = attributes[:'order_by']).is_a?(Array) + self.order_by = value + end + 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 !@count.nil? && @count < 0 + true + end + + # Custom attribute writer method with validation + # @param count [Object] Object to be assigned + # @!visibility private + def count=(count) + if !count.nil? && count < 0 + fail ArgumentError, 'invalid value for "count", must be greater than or equal to 0.' + end + @count = count + 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 && + count == o.count && + order_by == o.order_by + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [count, order_by].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/widget_sort_order_by.rb b/lib/datadog_api_client/v1/models/widget_sort_order_by.rb new file mode 100644 index 000000000000..5691f967a5cf --- /dev/null +++ b/lib/datadog_api_client/v1/models/widget_sort_order_by.rb @@ -0,0 +1,63 @@ +=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 + # The item to sort the widget by. + module WidgetSortOrderBy + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'WidgetFormulaSort', + :'WidgetGroupSort' + ] + end + # 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 openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end