Skip to content

Commit c886f5d

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit fe8637d0 of spec repo
1 parent e844a9b commit c886f5d

File tree

5 files changed

+128
-4
lines changed

5 files changed

+128
-4
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-09-24 18:16:27.931184",
8-
"spec_repo_commit": "2eb52c63"
7+
"regenerated": "2024-09-24 20:07:31.063270",
8+
"spec_repo_commit": "fe8637d0"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-09-24 18:16:27.945962",
13-
"spec_repo_commit": "2eb52c63"
12+
"regenerated": "2024-09-24 20:07:31.079357",
13+
"spec_repo_commit": "fe8637d0"
1414
}
1515
}
1616
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Clients deserialize a dashboard with a empty time object
2+
3+
package main
4+
5+
import (
6+
"context"
7+
"encoding/json"
8+
"fmt"
9+
"os"
10+
11+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
12+
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
13+
)
14+
15+
func main() {
16+
body := datadogV1.Dashboard{
17+
Title: "Example-Dashboard",
18+
Widgets: []datadogV1.Widget{
19+
{
20+
Definition: datadogV1.WidgetDefinition{
21+
TimeseriesWidgetDefinition: &datadogV1.TimeseriesWidgetDefinition{
22+
Title: datadog.PtrString("Example Cloud Cost Query"),
23+
TitleSize: datadog.PtrString("16"),
24+
TitleAlign: datadogV1.WIDGETTEXTALIGN_LEFT.Ptr(),
25+
Type: datadogV1.TIMESERIESWIDGETDEFINITIONTYPE_TIMESERIES,
26+
Requests: []datadogV1.TimeseriesWidgetRequest{
27+
{
28+
Formulas: []datadogV1.WidgetFormula{
29+
{
30+
Formula: "query1",
31+
},
32+
},
33+
Queries: []datadogV1.FormulaAndFunctionQueryDefinition{
34+
datadogV1.FormulaAndFunctionQueryDefinition{
35+
FormulaAndFunctionCloudCostQueryDefinition: &datadogV1.FormulaAndFunctionCloudCostQueryDefinition{
36+
DataSource: datadogV1.FORMULAANDFUNCTIONCLOUDCOSTDATASOURCE_CLOUD_COST,
37+
Name: "query1",
38+
Query: "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)",
39+
}},
40+
},
41+
ResponseFormat: datadogV1.FORMULAANDFUNCTIONRESPONSEFORMAT_TIMESERIES.Ptr(),
42+
Style: &datadogV1.WidgetRequestStyle{
43+
Palette: datadog.PtrString("dog_classic"),
44+
LineType: datadogV1.WIDGETLINETYPE_SOLID.Ptr(),
45+
LineWidth: datadogV1.WIDGETLINEWIDTH_NORMAL.Ptr(),
46+
},
47+
DisplayType: datadogV1.WIDGETDISPLAYTYPE_BARS.Ptr(),
48+
},
49+
},
50+
Time: &datadogV1.WidgetTime{
51+
WidgetLegacyLiveSpan: &datadogV1.WidgetLegacyLiveSpan{}},
52+
}},
53+
},
54+
},
55+
LayoutType: datadogV1.DASHBOARDLAYOUTTYPE_ORDERED,
56+
}
57+
ctx := datadog.NewDefaultContext(context.Background())
58+
configuration := datadog.NewConfiguration()
59+
apiClient := datadog.NewAPIClient(configuration)
60+
api := datadogV1.NewDashboardsApi(apiClient)
61+
resp, r, err := api.CreateDashboard(ctx, body)
62+
63+
if err != nil {
64+
fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.CreateDashboard`: %v\n", err)
65+
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
66+
}
67+
68+
responseContent, _ := json.MarshalIndent(resp, "", " ")
69+
fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.CreateDashboard`:\n%s\n", responseContent)
70+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2024-09-24T19:19:31.807Z
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
interactions:
2+
- request:
3+
body: |
4+
{"layout_type":"ordered","title":"Test-Clients_deserialize_a_dashboard_with_a_empty_time_object-1727205571","widgets":[{"definition":{"requests":[{"display_type":"bars","formulas":[{"formula":"query1"}],"queries":[{"data_source":"cloud_cost","name":"query1","query":"sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)"}],"response_format":"timeseries","style":{"line_type":"solid","line_width":"normal","palette":"dog_classic"}}],"time":{},"title":"Example Cloud Cost Query","title_align":"left","title_size":"16","type":"timeseries"}}]}
5+
form: {}
6+
headers:
7+
Accept:
8+
- application/json
9+
Content-Type:
10+
- application/json
11+
id: 0
12+
method: POST
13+
url: https://api.datadoghq.com/api/v1/dashboard
14+
response:
15+
body: '{"id":"han-5zg-c32","title":"Test-Clients_deserialize_a_dashboard_with_a_empty_time_object-1727205571","description":null,"author_handle":"[email protected]","author_name":null,"layout_type":"ordered","url":"/dashboard/han-5zg-c32/test-clientsdeserializeadashboardwithaemptytimeobject-1727205571","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"requests":[{"display_type":"bars","formulas":[{"formula":"query1"}],"queries":[{"data_source":"cloud_cost","name":"query1","query":"sum:aws.cost.amortized{*}
16+
by {aws_product}.rollup(sum, monthly)"}],"response_format":"timeseries","style":{"line_type":"solid","line_width":"normal","palette":"dog_classic"}}],"time":{},"title":"Example
17+
Cloud Cost Query","title_align":"left","title_size":"16","type":"timeseries"},"id":4274057372149908}],"notify_list":null,"created_at":"2024-09-24T19:19:32.071328+00:00","modified_at":"2024-09-24T19:19:32.071328+00:00","experience_type":"default","restricted_roles":[]}
18+
19+
'
20+
code: 200
21+
duration: 0ms
22+
headers:
23+
Content-Type:
24+
- application/json
25+
status: 200 OK
26+
- request:
27+
body: ''
28+
form: {}
29+
headers:
30+
Accept:
31+
- application/json
32+
id: 1
33+
method: DELETE
34+
url: https://api.datadoghq.com/api/v1/dashboard/han-5zg-c32
35+
response:
36+
body: '{"deleted_dashboard_id":"han-5zg-c32"}
37+
38+
'
39+
code: 200
40+
duration: 0ms
41+
headers:
42+
Content-Type:
43+
- application/json
44+
status: 200 OK
45+
version: 2

tests/scenarios/features/v1/dashboards.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ Feature: Dashboards
99
And a valid "appKeyAuth" key in the system
1010
And an instance of "Dashboards" API
1111

12+
@replay-only @team:DataDog/dashboards-backend
13+
Scenario: Clients deserialize a dashboard with a empty time object
14+
Given new "CreateDashboard" request
15+
And body with value { "title": "{{ unique }}", "widgets": [ { "definition": { "title": "Example Cloud Cost Query", "title_size": "16", "title_align": "left", "type": "timeseries", "requests": [ { "formulas": [ { "formula": "query1" } ], "queries": [ { "data_source": "cloud_cost", "name": "query1", "query": "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)" } ], "response_format": "timeseries", "style": { "palette": "dog_classic", "line_type": "solid", "line_width": "normal" }, "display_type": "bars" } ], "time": {} } } ], "layout_type": "ordered" }
16+
When the request is sent
17+
Then the response status is 200 OK
18+
And the response "widgets[0].definition.time" is equal to {}
19+
1220
@team:DataDog/dashboards-backend
1321
Scenario: Create a distribution widget using a histogram request containing a formulas and functions APM Stats query
1422
Given new "CreateDashboard" request

0 commit comments

Comments
 (0)