-
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.
Regenerate client from commit e71b6cea of spec repo
- Loading branch information
ci.datadog-api-spec
committed
Mar 2, 2023
1 parent
62efe99
commit cb8e12f
Showing
7 changed files
with
147 additions
and
4 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,87 @@ | ||
// Create a new timeseries widget with ci_pipelines 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-Create_a_new_timeseries_widget_with_ci_pipelines_data_source with ci_pipelines 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_CI_PIPELINES, | ||
Name: "query1", | ||
Search: &datadogV1.FormulaAndFunctionEventQueryDefinitionSearch{ | ||
Query: "ci_level:job", | ||
}, | ||
Indexes: []string{ | ||
"*", | ||
}, | ||
Compute: datadogV1.FormulaAndFunctionEventQueryDefinitionCompute{ | ||
Aggregation: datadogV1.FORMULAANDFUNCTIONEVENTAGGREGATION_COUNT, | ||
Metric: datadog.PtrString("@ci.queue_time"), | ||
}, | ||
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
...e_Dashboards/Scenario_Create_a_new_timeseries_widget_with_ci_pipelines_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 @@ | ||
2023-03-02T15:41:16.500Z |
42 changes: 42 additions & 0 deletions
42
...ure_Dashboards/Scenario_Create_a_new_timeseries_widget_with_ci_pipelines_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,42 @@ | ||
interactions: | ||
- request: | ||
body: | | ||
{"layout_type":"ordered","reflow_type":"auto","title":"Test-Create_a_new_timeseries_widget_with_ci_pipelines_data_source-1677771676 with ci_pipelines datasource","widgets":[{"definition":{"legend_columns":["avg","min","max","value","sum"],"legend_layout":"auto","requests":[{"display_type":"line","formulas":[{"formula":"query1"}],"queries":[{"compute":{"aggregation":"count","metric":"@ci.queue_time"},"data_source":"ci_pipelines","group_by":[],"indexes":["*"],"name":"query1","search":{"query":"ci_level:job"}}],"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 | ||
method: POST | ||
url: https://api.datadoghq.com/api/v1/dashboard | ||
response: | ||
body: '{"id":"iu9-viw-buz","title":"Test-Create_a_new_timeseries_widget_with_ci_pipelines_data_source-1677771676 | ||
with ci_pipelines datasource","description":null,"author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/iu9-viw-buz/test-createanewtimeserieswidgetwithcipipelinesdatasource-1677771676-with-cipipel","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","metric":"@ci.queue_time"},"data_source":"ci_pipelines","group_by":[],"indexes":["*"],"name":"query1","search":{"query":"ci_level:job"}}],"response_format":"timeseries","style":{"line_type":"solid","line_width":"normal","palette":"dog_classic"}}],"show_legend":true,"time":{},"title":"","type":"timeseries"},"id":2105687409669278}],"notify_list":null,"created_at":"2023-03-02T15:41:16.697612+00:00","modified_at":"2023-03-02T15:41:16.697612+00:00","reflow_type":"auto","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/iu9-viw-buz | ||
response: | ||
body: '{"deleted_dashboard_id":"iu9-viw-buz"} | ||
' | ||
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