Skip to content

Commit

Permalink
Regenerate client from commit e71b6cea of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Mar 2, 2023
1 parent 62efe99 commit cb8e12f
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 4 deletions.
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.4",
"regenerated": "2023-03-02 15:38:23.431053",
"spec_repo_commit": "0ec7fe9d"
"regenerated": "2023-03-02 16:19:57.535341",
"spec_repo_commit": "e71b6cea"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2023-03-02 15:38:23.446256",
"spec_repo_commit": "0ec7fe9d"
"regenerated": "2023-03-02 16:19:57.554926",
"spec_repo_commit": "e71b6cea"
}
}
}
2 changes: 2 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2518,6 +2518,7 @@ components:
- audit
- events
- ci_tests
- ci_pipelines
example: logs
type: string
x-enum-varnames:
Expand All @@ -2530,6 +2531,7 @@ components:
- AUDIT
- EVENTS
- CI_TESTS
- CI_PIPELINES
FormulaAndFunctionMetricAggregation:
description: The aggregation methods available for metrics queries.
enum:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const (
FORMULAANDFUNCTIONEVENTSDATASOURCE_AUDIT FormulaAndFunctionEventsDataSource = "audit"
FORMULAANDFUNCTIONEVENTSDATASOURCE_EVENTS FormulaAndFunctionEventsDataSource = "events"
FORMULAANDFUNCTIONEVENTSDATASOURCE_CI_TESTS FormulaAndFunctionEventsDataSource = "ci_tests"
FORMULAANDFUNCTIONEVENTSDATASOURCE_CI_PIPELINES FormulaAndFunctionEventsDataSource = "ci_pipelines"
)

var allowedFormulaAndFunctionEventsDataSourceEnumValues = []FormulaAndFunctionEventsDataSource{
Expand All @@ -35,6 +36,7 @@ var allowedFormulaAndFunctionEventsDataSourceEnumValues = []FormulaAndFunctionEv
FORMULAANDFUNCTIONEVENTSDATASOURCE_AUDIT,
FORMULAANDFUNCTIONEVENTSDATASOURCE_EVENTS,
FORMULAANDFUNCTIONEVENTSDATASOURCE_CI_TESTS,
FORMULAANDFUNCTIONEVENTSDATASOURCE_CI_PIPELINES,
}

// GetAllowedValues reeturns the list of possible values.
Expand Down
87 changes: 87 additions & 0 deletions examples/v1/dashboards/CreateDashboard_2800096921.go
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)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-03-02T15:41:16.500Z
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
9 changes: 9 additions & 0 deletions tests/scenarios/features/v1/dashboards.feature
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,15 @@ Feature: Dashboards
And the response "widgets[0].definition.type" is equal to "trace_service"
And the response "widgets[0].definition.env" is equal to "none"

@team:DataDog/dashboards
Scenario: Create a new timeseries widget with ci_pipelines data source
Given new "CreateDashboard" request
And body with value {"title":"{{ unique }} with ci_pipelines datasource","widgets":[{"definition":{"title":"","show_legend":true,"legend_layout":"auto","legend_columns":["avg","min","max","value","sum"],"time":{},"type":"timeseries","requests":[{"formulas":[{"formula":"query1"}],"queries":[{"data_source":"ci_pipelines","name":"query1","search":{"query":"ci_level:job"},"indexes":["*"],"compute":{"aggregation":"count", "metric": "@ci.queue_time"},"group_by":[]}],"response_format":"timeseries","style":{"palette":"dog_classic","line_type":"solid","line_width":"normal"},"display_type":"line"}]}}],"layout_type":"ordered","reflow_type":"auto"}
When the request is sent
Then the response status is 200 OK
And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "ci_pipelines"
And the response "widgets[0].definition.requests[0].queries[0].search.query" is equal to "ci_level:job"

@team:DataDog/dashboards
Scenario: Create a new timeseries widget with ci_tests data source
Given new "CreateDashboard" request
Expand Down

0 comments on commit cb8e12f

Please sign in to comment.