Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-09-04 17:12:32.108678",
"spec_repo_commit": "8e0507d2"
"regenerated": "2024-09-06 21:00:03.088699",
"spec_repo_commit": "3dff532a"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-09-04 17:12:32.128009",
"spec_repo_commit": "8e0507d2"
"regenerated": "2024-09-06 21:00:03.109592",
"spec_repo_commit": "3dff532a"
}
}
}
3 changes: 3 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 36 additions & 1 deletion api/datadogV1/model_toplist_widget_style.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
type ToplistWidgetStyle struct {
// Top list widget display options.
Display *ToplistWidgetDisplay `json:"display,omitempty"`
// Color palette to apply to the widget.
Palette *string `json:"palette,omitempty"`
// Top list widget scaling definition.
Scaling *ToplistWidgetScaling `json:"scaling,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
Expand Down Expand Up @@ -64,6 +66,34 @@ func (o *ToplistWidgetStyle) SetDisplay(v ToplistWidgetDisplay) {
o.Display = &v
}

// GetPalette returns the Palette field value if set, zero value otherwise.
func (o *ToplistWidgetStyle) GetPalette() string {
if o == nil || o.Palette == nil {
var ret string
return ret
}
return *o.Palette
}

// GetPaletteOk returns a tuple with the Palette field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ToplistWidgetStyle) GetPaletteOk() (*string, bool) {
if o == nil || o.Palette == nil {
return nil, false
}
return o.Palette, true
}

// HasPalette returns a boolean if a field has been set.
func (o *ToplistWidgetStyle) HasPalette() bool {
return o != nil && o.Palette != nil
}

// SetPalette gets a reference to the given string and assigns it to the Palette field.
func (o *ToplistWidgetStyle) SetPalette(v string) {
o.Palette = &v
}

// GetScaling returns the Scaling field value if set, zero value otherwise.
func (o *ToplistWidgetStyle) GetScaling() ToplistWidgetScaling {
if o == nil || o.Scaling == nil {
Expand Down Expand Up @@ -101,6 +131,9 @@ func (o ToplistWidgetStyle) MarshalJSON() ([]byte, error) {
if o.Display != nil {
toSerialize["display"] = o.Display
}
if o.Palette != nil {
toSerialize["palette"] = o.Palette
}
if o.Scaling != nil {
toSerialize["scaling"] = o.Scaling
}
Expand All @@ -115,20 +148,22 @@ func (o ToplistWidgetStyle) MarshalJSON() ([]byte, error) {
func (o *ToplistWidgetStyle) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Display *ToplistWidgetDisplay `json:"display,omitempty"`
Palette *string `json:"palette,omitempty"`
Scaling *ToplistWidgetScaling `json:"scaling,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"display", "scaling"})
datadog.DeleteKeys(additionalProperties, &[]string{"display", "palette", "scaling"})
} else {
return err
}

hasInvalidField := false
o.Display = all.Display
o.Palette = all.Palette
if all.Scaling != nil && !all.Scaling.IsValid() {
hasInvalidField = true
} else {
Expand Down
1 change: 1 addition & 0 deletions examples/v1/dashboards/CreateDashboard_1213075383.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func main() {
Legend: datadogV1.TOPLISTWIDGETLEGEND_INLINE,
}},
Scaling: datadogV1.TOPLISTWIDGETSCALING_RELATIVE.Ptr(),
Palette: datadog.PtrString("dog_classic"),
},
Type: datadogV1.TOPLISTWIDGETDEFINITIONTYPE_TOPLIST,
Requests: []datadogV1.ToplistWidgetRequest{
Expand Down
1 change: 1 addition & 0 deletions examples/v1/dashboards/CreateDashboard_2563642929.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func main() {
Legend: datadogV1.TOPLISTWIDGETLEGEND_INLINE,
}},
Scaling: datadogV1.TOPLISTWIDGETSCALING_RELATIVE.Ptr(),
Palette: datadog.PtrString("dog_classic"),
},
Type: datadogV1.TOPLISTWIDGETDEFINITIONTYPE_TOPLIST,
Requests: []datadogV1.ToplistWidgetRequest{
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-05-21T14:43:42.680Z
2024-09-06T12:10:50.473Z
Original file line number Diff line number Diff line change
@@ -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}}]}
{"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}}]}
form: {}
headers:
Accept:
Expand All @@ -12,9 +12,9 @@ interactions:
method: POST
url: https://api.datadoghq.com/api/v1/dashboard
response:
body: '{"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":[]}
body: '{"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":[]}

'
code: 200
Expand All @@ -31,9 +31,9 @@ interactions:
- application/json
id: 1
method: DELETE
url: https://api.datadoghq.com/api/v1/dashboard/wbt-nas-fux
url: https://api.datadoghq.com/api/v1/dashboard/pr4-bz7-nn3
response:
body: '{"deleted_dashboard_id":"wbt-nas-fux"}
body: '{"deleted_dashboard_id":"pr4-bz7-nn3"}

'
code: 200
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-05-15T20:07:42.432Z
2024-09-06T12:10:51.099Z
Original file line number Diff line number Diff line change
@@ -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}}]}
{"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}}]}
form: {}
headers:
Accept:
Expand All @@ -12,9 +12,9 @@ interactions:
method: POST
url: https://api.datadoghq.com/api/v1/dashboard
response:
body: '{"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":[]}
body: '{"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":[]}

'
code: 200
Expand All @@ -31,9 +31,9 @@ interactions:
- application/json
id: 1
method: DELETE
url: https://api.datadoghq.com/api/v1/dashboard/y3a-6s5-ycw
url: https://api.datadoghq.com/api/v1/dashboard/q25-ie2-8p9
response:
body: '{"deleted_dashboard_id":"y3a-6s5-ycw"}
body: '{"deleted_dashboard_id":"q25-ie2-8p9"}

'
code: 200
Expand Down
2 changes: 1 addition & 1 deletion tests/scenarios/features/v1/dashboards.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"type": "stacked",
"legend": "inline"
},
"scaling": "relative"
"scaling": "relative",
"palette": "dog_classic"
},
"type":"toplist",
"requests":[
Expand Down