diff --git a/.apigentools-info b/.apigentools-info index 6f4b00f219..49cbbb7ea8 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-09-04 17:12:33.836340", - "spec_repo_commit": "8e0507d2" + "regenerated": "2024-09-06 21:00:01.018907", + "spec_repo_commit": "3dff532a" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-09-04 17:12:33.853825", - "spec_repo_commit": "8e0507d2" + "regenerated": "2024-09-06 21:00:01.036744", + "spec_repo_commit": "3dff532a" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 507a26a653..7e7134461f 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -17115,6 +17115,9 @@ components: properties: display: $ref: '#/components/schemas/ToplistWidgetDisplay' + palette: + description: Color palette to apply to the widget. + type: string scaling: $ref: '#/components/schemas/ToplistWidgetScaling' type: object diff --git a/examples/v1/dashboards/CreateDashboard_1213075383.py b/examples/v1/dashboards/CreateDashboard_1213075383.py index ca3f7822de..a57a0621aa 100644 --- a/examples/v1/dashboards/CreateDashboard_1213075383.py +++ b/examples/v1/dashboards/CreateDashboard_1213075383.py @@ -52,6 +52,7 @@ legend=ToplistWidgetLegend.INLINE, ), scaling=ToplistWidgetScaling.RELATIVE, + palette="dog_classic", ), type=ToplistWidgetDefinitionType.TOPLIST, requests=[ diff --git a/examples/v1/dashboards/CreateDashboard_2563642929.py b/examples/v1/dashboards/CreateDashboard_2563642929.py index f4aada3a18..17e6057495 100644 --- a/examples/v1/dashboards/CreateDashboard_2563642929.py +++ b/examples/v1/dashboards/CreateDashboard_2563642929.py @@ -52,6 +52,7 @@ legend=ToplistWidgetLegend.INLINE, ), scaling=ToplistWidgetScaling.RELATIVE, + palette="dog_classic", ), type=ToplistWidgetDefinitionType.TOPLIST, requests=[ diff --git a/src/datadog_api_client/v1/model/toplist_widget_style.py b/src/datadog_api_client/v1/model/toplist_widget_style.py index 5e20f8b63e..8780d48d73 100644 --- a/src/datadog_api_client/v1/model/toplist_widget_style.py +++ b/src/datadog_api_client/v1/model/toplist_widget_style.py @@ -28,17 +28,20 @@ def openapi_types(_): return { "display": (ToplistWidgetDisplay,), + "palette": (str,), "scaling": (ToplistWidgetScaling,), } attribute_map = { "display": "display", + "palette": "palette", "scaling": "scaling", } def __init__( self_, display: Union[ToplistWidgetDisplay, ToplistWidgetStacked, ToplistWidgetFlat, UnsetType] = unset, + palette: Union[str, UnsetType] = unset, scaling: Union[ToplistWidgetScaling, UnsetType] = unset, **kwargs, ): @@ -48,11 +51,16 @@ def __init__( :param display: Top list widget display options. :type display: ToplistWidgetDisplay, optional + :param palette: Color palette to apply to the widget. + :type palette: str, optional + :param scaling: Top list widget scaling definition. :type scaling: ToplistWidgetScaling, optional """ if display is not unset: kwargs["display"] = display + if palette is not unset: + kwargs["palette"] = palette if scaling is not unset: kwargs["scaling"] = scaling super().__init__(kwargs) diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_toplist_widget_sorted_by_group.frozen b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_toplist_widget_sorted_by_group.frozen index a5750081be..53ed77b4f6 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_toplist_widget_sorted_by_group.frozen +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_toplist_widget_sorted_by_group.frozen @@ -1 +1 @@ -2024-05-21T14:43:42.680Z \ No newline at end of file +2024-09-06T12:10:50.473Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_toplist_widget_sorted_by_group.yaml b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_toplist_widget_sorted_by_group.yaml index 7e4f9756c2..e4e5f452b7 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_toplist_widget_sorted_by_group.yaml +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_toplist_widget_sorted_by_group.yaml @@ -1,7 +1,7 @@ interactions: - request: - body: '{"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}}]}' + body: '{"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-1725624650","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"},"palette":"dog_classic","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 @@ -11,9 +11,9 @@ interactions: uri: https://api.datadoghq.com/api/v1/dashboard response: body: - 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":[]} + string: '{"id":"pr4-bz7-nn3","title":"Test-Create_a_new_dashboard_with_a_toplist_widget_sorted_by_group-1725624650","description":"","author_handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","author_name":"CI + Account","layout_type":"free","url":"/dashboard/pr4-bz7-nn3/test-createanewdashboardwithatoplistwidgetsortedbygroup-1725624650","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"},"palette":"dog_classic","scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"toplist"},"layout":{"height":15,"width":47,"x":0,"y":0},"id":8644525358047960}],"notify_list":[],"created_at":"2024-09-06T12:10:50.735923+00:00","modified_at":"2024-09-06T12:10:50.735923+00:00","restricted_roles":[]} ' headers: @@ -28,10 +28,10 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/dashboard/wbt-nas-fux + uri: https://api.datadoghq.com/api/v1/dashboard/pr4-bz7-nn3 response: body: - string: '{"deleted_dashboard_id":"wbt-nas-fux"} + string: '{"deleted_dashboard_id":"pr4-bz7-nn3"} ' headers: diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_toplist_widget.frozen b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_toplist_widget.frozen index 858c73b255..342b24a3fe 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_toplist_widget.frozen +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_toplist_widget.frozen @@ -1 +1 @@ -2024-05-15T20:07:42.432Z \ No newline at end of file +2024-09-06T12:10:51.099Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_toplist_widget.yaml b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_toplist_widget.yaml index dbc7332a4e..0d3a4e7f6d 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_toplist_widget.yaml +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_toplist_widget.yaml @@ -1,7 +1,7 @@ interactions: - request: - body: '{"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}}]}' + body: '{"description":"","is_read_only":false,"layout_type":"free","notify_list":[],"template_variables":[],"title":"Test-Create_a_new_dashboard_with_toplist_widget-1725624651","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"},"palette":"dog_classic","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 @@ -11,9 +11,9 @@ interactions: uri: https://api.datadoghq.com/api/v1/dashboard response: body: - 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":[]} + string: '{"id":"q25-ie2-8p9","title":"Test-Create_a_new_dashboard_with_toplist_widget-1725624651","description":"","author_handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","author_name":"CI + Account","layout_type":"free","url":"/dashboard/q25-ie2-8p9/test-createanewdashboardwithtoplistwidget-1725624651","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"},"palette":"dog_classic","scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"toplist"},"layout":{"height":15,"width":47,"x":0,"y":0},"id":6898333964604098}],"notify_list":[],"created_at":"2024-09-06T12:10:51.371974+00:00","modified_at":"2024-09-06T12:10:51.371974+00:00","restricted_roles":[]} ' headers: @@ -28,10 +28,10 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/dashboard/y3a-6s5-ycw + uri: https://api.datadoghq.com/api/v1/dashboard/q25-ie2-8p9 response: body: - string: '{"deleted_dashboard_id":"y3a-6s5-ycw"} + string: '{"deleted_dashboard_id":"q25-ie2-8p9"} ' headers: diff --git a/tests/v1/features/dashboards.feature b/tests/v1/features/dashboards.feature index 0b080ef44c..27f714940d 100644 --- a/tests/v1/features/dashboards.feature +++ b/tests/v1/features/dashboards.feature @@ -190,7 +190,7 @@ Feature: Dashboards @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":[]} + 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","palette": "dog_classic"},"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" diff --git a/tests/v1/features/dashboards_json_payload/toplist_widget.json b/tests/v1/features/dashboards_json_payload/toplist_widget.json index fd16e0a612..bb07133d5f 100644 --- a/tests/v1/features/dashboards_json_payload/toplist_widget.json +++ b/tests/v1/features/dashboards_json_payload/toplist_widget.json @@ -21,7 +21,8 @@ "type": "stacked", "legend": "inline" }, - "scaling": "relative" + "scaling": "relative", + "palette": "dog_classic" }, "type":"toplist", "requests":[