-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regenerate client from commit 015355f6 of spec repo
- Loading branch information
ci.datadog-api-spec
committed
Jul 23, 2024
1 parent
fd73c26
commit cf364fb
Showing
7 changed files
with
158 additions
and
14 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,86 @@ | ||
// Create a new timeseries widget with incident_analytics data source | ||
|
||
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{ | ||
Title: "Example-Dashboard with incident_analytics datasource", | ||
Widgets: []datadogV1.Widget{ | ||
{ | ||
Definition: datadogV1.WidgetDefinition{ | ||
TimeseriesWidgetDefinition: &datadogV1.TimeseriesWidgetDefinition{ | ||
Title: datadog.PtrString(""), | ||
ShowLegend: datadog.PtrBool(true), | ||
LegendLayout: datadogV1.TIMESERIESWIDGETLEGENDLAYOUT_AUTO.Ptr(), | ||
LegendColumns: []datadogV1.TimeseriesWidgetLegendColumn{ | ||
datadogV1.TIMESERIESWIDGETLEGENDCOLUMN_AVG, | ||
datadogV1.TIMESERIESWIDGETLEGENDCOLUMN_MIN, | ||
datadogV1.TIMESERIESWIDGETLEGENDCOLUMN_MAX, | ||
datadogV1.TIMESERIESWIDGETLEGENDCOLUMN_VALUE, | ||
datadogV1.TIMESERIESWIDGETLEGENDCOLUMN_SUM, | ||
}, | ||
Time: &datadogV1.WidgetTime{}, | ||
Type: datadogV1.TIMESERIESWIDGETDEFINITIONTYPE_TIMESERIES, | ||
Requests: []datadogV1.TimeseriesWidgetRequest{ | ||
{ | ||
Formulas: []datadogV1.WidgetFormula{ | ||
{ | ||
Formula: "query1", | ||
}, | ||
}, | ||
Queries: []datadogV1.FormulaAndFunctionQueryDefinition{ | ||
datadogV1.FormulaAndFunctionQueryDefinition{ | ||
FormulaAndFunctionEventQueryDefinition: &datadogV1.FormulaAndFunctionEventQueryDefinition{ | ||
DataSource: datadogV1.FORMULAANDFUNCTIONEVENTSDATASOURCE_INCIDENT_ANALYTICS, | ||
Name: "query1", | ||
Search: &datadogV1.FormulaAndFunctionEventQueryDefinitionSearch{ | ||
Query: "test_level:test", | ||
}, | ||
Indexes: []string{ | ||
"*", | ||
}, | ||
Compute: datadogV1.FormulaAndFunctionEventQueryDefinitionCompute{ | ||
Aggregation: datadogV1.FORMULAANDFUNCTIONEVENTAGGREGATION_COUNT, | ||
}, | ||
GroupBy: []datadogV1.FormulaAndFunctionEventQueryGroupBy{}, | ||
}}, | ||
}, | ||
ResponseFormat: datadogV1.FORMULAANDFUNCTIONRESPONSEFORMAT_TIMESERIES.Ptr(), | ||
Style: &datadogV1.WidgetRequestStyle{ | ||
Palette: datadog.PtrString("dog_classic"), | ||
LineType: datadogV1.WIDGETLINETYPE_SOLID.Ptr(), | ||
LineWidth: datadogV1.WIDGETLINEWIDTH_NORMAL.Ptr(), | ||
}, | ||
DisplayType: datadogV1.WIDGETDISPLAYTYPE_LINE.Ptr(), | ||
}, | ||
}, | ||
}}, | ||
}, | ||
}, | ||
LayoutType: datadogV1.DASHBOARDLAYOUTTYPE_ORDERED, | ||
ReflowType: datadogV1.DASHBOARDREFLOWTYPE_AUTO.Ptr(), | ||
} | ||
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
...boards/Scenario_Create_a_new_timeseries_widget_with_incident_analytics_data_source.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 @@ | ||
2024-07-23T14:59:59.215Z |
44 changes: 44 additions & 0 deletions
44
...shboards/Scenario_Create_a_new_timeseries_widget_with_incident_analytics_data_source.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,44 @@ | ||
interactions: | ||
- request: | ||
body: | | ||
{"layout_type":"ordered","reflow_type":"auto","title":"Test-Create_a_new_timeseries_widget_with_incident_analytics_data_source-1721746799 with incident_analytics datasource","widgets":[{"definition":{"legend_columns":["avg","min","max","value","sum"],"legend_layout":"auto","requests":[{"display_type":"line","formulas":[{"formula":"query1"}],"queries":[{"compute":{"aggregation":"count"},"data_source":"incident_analytics","group_by":[],"indexes":["*"],"name":"query1","search":{"query":"test_level:test"}}],"response_format":"timeseries","style":{"line_type":"solid","line_width":"normal","palette":"dog_classic"}}],"show_legend":true,"time":{},"title":"","type":"timeseries"}}]} | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
Content-Type: | ||
- application/json | ||
id: 0 | ||
method: POST | ||
url: https://api.datadoghq.com/api/v1/dashboard | ||
response: | ||
body: '{"id":"r29-a2b-nhh","title":"Test-Create_a_new_timeseries_widget_with_incident_analytics_data_source-1721746799 | ||
with incident_analytics datasource","description":null,"author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/r29-a2b-nhh/test-createanewtimeserieswidgetwithincidentanalyticsdatasource-1721746799-with-i","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"legend_columns":["avg","min","max","value","sum"],"legend_layout":"auto","requests":[{"display_type":"line","formulas":[{"formula":"query1"}],"queries":[{"compute":{"aggregation":"count"},"data_source":"incident_analytics","group_by":[],"indexes":["*"],"name":"query1","search":{"query":"test_level:test"}}],"response_format":"timeseries","style":{"line_type":"solid","line_width":"normal","palette":"dog_classic"}}],"show_legend":true,"time":{},"title":"","type":"timeseries"},"id":4216078110414841}],"notify_list":null,"created_at":"2024-07-23T14:59:59.491800+00:00","modified_at":"2024-07-23T14:59:59.491800+00:00","reflow_type":"auto","restricted_roles":[]} | ||
' | ||
code: 200 | ||
duration: 0ms | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
- request: | ||
body: '' | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
id: 1 | ||
method: DELETE | ||
url: https://api.datadoghq.com/api/v1/dashboard/r29-a2b-nhh | ||
response: | ||
body: '{"deleted_dashboard_id":"r29-a2b-nhh"} | ||
' | ||
code: 200 | ||
duration: 0ms | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
version: 2 |
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