-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
sort
field to List Stream Widget's request query (#2020)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
- Loading branch information
1 parent
2edbce5
commit 5cd5960
Showing
10 changed files
with
283 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Create a new dashboard with list_stream widget with a valid sort parameter ASC | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/DataDog/datadog-api-client-go/v2/api/datadog" | ||
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1" | ||
) | ||
|
||
func main() { | ||
body := datadogV1.Dashboard{ | ||
LayoutType: datadogV1.DASHBOARDLAYOUTTYPE_ORDERED, | ||
Title: "Example-Dashboard with list_stream widget", | ||
Widgets: []datadogV1.Widget{ | ||
{ | ||
Definition: datadogV1.WidgetDefinition{ | ||
ListStreamWidgetDefinition: &datadogV1.ListStreamWidgetDefinition{ | ||
Type: datadogV1.LISTSTREAMWIDGETDEFINITIONTYPE_LIST_STREAM, | ||
Requests: []datadogV1.ListStreamWidgetRequest{ | ||
{ | ||
Columns: []datadogV1.ListStreamColumn{ | ||
{ | ||
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_AUTO, | ||
Field: "timestamp", | ||
}, | ||
}, | ||
Query: datadogV1.ListStreamQuery{ | ||
DataSource: datadogV1.LISTSTREAMSOURCE_EVENT_STREAM, | ||
QueryString: "", | ||
EventSize: datadogV1.WIDGETEVENTSIZE_LARGE.Ptr(), | ||
Sort: &datadogV1.WidgetFieldSort{ | ||
Column: "timestamp", | ||
Order: datadogV1.WIDGETSORT_ASCENDING, | ||
}, | ||
}, | ||
ResponseFormat: datadogV1.LISTSTREAMRESPONSEFORMAT_EVENT_LIST, | ||
}, | ||
}, | ||
}}, | ||
}, | ||
}, | ||
} | ||
ctx := datadog.NewDefaultContext(context.Background()) | ||
configuration := datadog.NewConfiguration() | ||
apiClient := datadog.NewAPIClient(configuration) | ||
api := datadogV1.NewDashboardsApi(apiClient) | ||
resp, r, err := api.CreateDashboard(ctx, body) | ||
|
||
if err != nil { | ||
fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.CreateDashboard`: %v\n", err) | ||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) | ||
} | ||
|
||
responseContent, _ := json.MarshalIndent(resp, "", " ") | ||
fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.CreateDashboard`:\n%s\n", responseContent) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Create a new dashboard with list_stream widget with a valid sort parameter DESC | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/DataDog/datadog-api-client-go/v2/api/datadog" | ||
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1" | ||
) | ||
|
||
func main() { | ||
body := datadogV1.Dashboard{ | ||
LayoutType: datadogV1.DASHBOARDLAYOUTTYPE_ORDERED, | ||
Title: "Example-Dashboard with list_stream widget", | ||
Widgets: []datadogV1.Widget{ | ||
{ | ||
Definition: datadogV1.WidgetDefinition{ | ||
ListStreamWidgetDefinition: &datadogV1.ListStreamWidgetDefinition{ | ||
Type: datadogV1.LISTSTREAMWIDGETDEFINITIONTYPE_LIST_STREAM, | ||
Requests: []datadogV1.ListStreamWidgetRequest{ | ||
{ | ||
Columns: []datadogV1.ListStreamColumn{ | ||
{ | ||
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_AUTO, | ||
Field: "timestamp", | ||
}, | ||
}, | ||
Query: datadogV1.ListStreamQuery{ | ||
DataSource: datadogV1.LISTSTREAMSOURCE_EVENT_STREAM, | ||
QueryString: "", | ||
EventSize: datadogV1.WIDGETEVENTSIZE_LARGE.Ptr(), | ||
Sort: &datadogV1.WidgetFieldSort{ | ||
Column: "timestamp", | ||
Order: datadogV1.WIDGETSORT_DESCENDING, | ||
}, | ||
}, | ||
ResponseFormat: datadogV1.LISTSTREAMRESPONSEFORMAT_EVENT_LIST, | ||
}, | ||
}, | ||
}}, | ||
}, | ||
}, | ||
} | ||
ctx := datadog.NewDefaultContext(context.Background()) | ||
configuration := datadog.NewConfiguration() | ||
apiClient := datadog.NewAPIClient(configuration) | ||
api := datadogV1.NewDashboardsApi(apiClient) | ||
resp, r, err := api.CreateDashboard(ctx, body) | ||
|
||
if err != nil { | ||
fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.CreateDashboard`: %v\n", err) | ||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) | ||
} | ||
|
||
responseContent, _ := json.MarshalIndent(resp, "", " ") | ||
fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.CreateDashboard`:\n%s\n", responseContent) | ||
} |
1 change: 1 addition & 0 deletions
1
...rio_Create_a_new_dashboard_with_list_stream_widget_with_a_valid_sort_parameter_ASC.freeze
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2023-05-31T17:12:24.532Z |
42 changes: 42 additions & 0 deletions
42
...nario_Create_a_new_dashboard_with_list_stream_widget_with_a_valid_sort_parameter_ASC.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
interactions: | ||
- request: | ||
body: | | ||
{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_list_stream_widget_with_a_valid_sort_parameter_ASC-1685553144 with list_stream widget","widgets":[{"definition":{"requests":[{"columns":[{"field":"timestamp","width":"auto"}],"query":{"data_source":"event_stream","event_size":"l","query_string":"","sort":{"column":"timestamp","order":"asc"}},"response_format":"event_list"}],"type":"list_stream"}}]} | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
Content-Type: | ||
- application/json | ||
method: POST | ||
url: https://api.datadoghq.com/api/v1/dashboard | ||
response: | ||
body: '{"id":"td2-he3-3vj","title":"Test-Create_a_new_dashboard_with_list_stream_widget_with_a_valid_sort_parameter_ASC-1685553144 | ||
with list_stream widget","description":null,"author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/td2-he3-3vj/test-createanewdashboardwithliststreamwidgetwithavalidsortparameterasc-168555314","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"requests":[{"columns":[{"field":"timestamp","width":"auto"}],"query":{"data_source":"event_stream","event_size":"l","query_string":"","sort":{"column":"timestamp","order":"asc"}},"response_format":"event_list"}],"type":"list_stream"},"id":4579982797049164}],"notify_list":null,"created_at":"2023-05-31T17:12:24.700217+00:00","modified_at":"2023-05-31T17:12:24.700217+00:00","restricted_roles":[]} | ||
' | ||
code: 200 | ||
duration: '' | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
- request: | ||
body: '' | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
method: DELETE | ||
url: https://api.datadoghq.com/api/v1/dashboard/td2-he3-3vj | ||
response: | ||
body: '{"deleted_dashboard_id":"td2-he3-3vj"} | ||
' | ||
code: 200 | ||
duration: '' | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
version: 1 |
1 change: 1 addition & 0 deletions
1
...io_Create_a_new_dashboard_with_list_stream_widget_with_a_valid_sort_parameter_DESC.freeze
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2023-05-31T17:12:24.923Z |
42 changes: 42 additions & 0 deletions
42
...ario_Create_a_new_dashboard_with_list_stream_widget_with_a_valid_sort_parameter_DESC.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
interactions: | ||
- request: | ||
body: | | ||
{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_list_stream_widget_with_a_valid_sort_parameter_DESC-1685553144 with list_stream widget","widgets":[{"definition":{"requests":[{"columns":[{"field":"timestamp","width":"auto"}],"query":{"data_source":"event_stream","event_size":"l","query_string":"","sort":{"column":"timestamp","order":"desc"}},"response_format":"event_list"}],"type":"list_stream"}}]} | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
Content-Type: | ||
- application/json | ||
method: POST | ||
url: https://api.datadoghq.com/api/v1/dashboard | ||
response: | ||
body: '{"id":"mwn-7ph-8z8","title":"Test-Create_a_new_dashboard_with_list_stream_widget_with_a_valid_sort_parameter_DESC-1685553144 | ||
with list_stream widget","description":null,"author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/mwn-7ph-8z8/test-createanewdashboardwithliststreamwidgetwithavalidsortparameterdesc-16855531","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"requests":[{"columns":[{"field":"timestamp","width":"auto"}],"query":{"data_source":"event_stream","event_size":"l","query_string":"","sort":{"column":"timestamp","order":"desc"}},"response_format":"event_list"}],"type":"list_stream"},"id":8830087860290510}],"notify_list":null,"created_at":"2023-05-31T17:12:25.020023+00:00","modified_at":"2023-05-31T17:12:25.020023+00:00","restricted_roles":[]} | ||
' | ||
code: 200 | ||
duration: '' | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
- request: | ||
body: '' | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
method: DELETE | ||
url: https://api.datadoghq.com/api/v1/dashboard/mwn-7ph-8z8 | ||
response: | ||
body: '{"deleted_dashboard_id":"mwn-7ph-8z8"} | ||
' | ||
code: 200 | ||
duration: '' | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
version: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters