Skip to content

Commit 5e5276a

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add ci_pipelines enum to FormulaAndFunctionEventsDataSource (#1051)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent d1bc37d commit 5e5276a

File tree

8 files changed

+198
-4
lines changed

8 files changed

+198
-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.4",
7-
"regenerated": "2023-03-02 15:38:11.895882",
8-
"spec_repo_commit": "0ec7fe9d"
7+
"regenerated": "2023-03-02 16:19:43.754784",
8+
"spec_repo_commit": "e71b6cea"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2023-03-02 15:38:11.912094",
13-
"spec_repo_commit": "0ec7fe9d"
12+
"regenerated": "2023-03-02 16:19:43.767675",
13+
"spec_repo_commit": "e71b6cea"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2518,6 +2518,7 @@ components:
25182518
- audit
25192519
- events
25202520
- ci_tests
2521+
- ci_pipelines
25212522
example: logs
25222523
type: string
25232524
x-enum-varnames:
@@ -2530,6 +2531,7 @@ components:
25302531
- AUDIT
25312532
- EVENTS
25322533
- CI_TESTS
2534+
- CI_PIPELINES
25332535
FormulaAndFunctionMetricAggregation:
25342536
description: The aggregation methods available for metrics queries.
25352537
enum:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2023-03-02T15:41:16.500Z"
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"log": {
3+
"_recordingName": "Dashboards/Create a new timeseries widget with ci_pipelines data source",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "017c148fc89f9d586fa2aed2abe76310",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 686,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json"
22+
},
23+
{
24+
"_fromType": "array",
25+
"name": "content-type",
26+
"value": "application/json"
27+
}
28+
],
29+
"headersSize": 559,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"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\"}}]}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v1/dashboard"
39+
},
40+
"response": {
41+
"bodySize": 1100,
42+
"content": {
43+
"mimeType": "application/json",
44+
"size": 1100,
45+
"text": "{\"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\":\"[email protected]\",\"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\":[]}\n"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/json"
52+
}
53+
],
54+
"headersSize": 491,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 200,
58+
"statusText": "OK"
59+
},
60+
"startedDateTime": "2023-03-02T15:41:16.508Z",
61+
"time": 234
62+
},
63+
{
64+
"_id": "26275201455e990ae4597f4c6359f9f3",
65+
"_order": 0,
66+
"cache": {},
67+
"request": {
68+
"bodySize": 0,
69+
"cookies": [],
70+
"headers": [
71+
{
72+
"_fromType": "array",
73+
"name": "accept",
74+
"value": "application/json"
75+
}
76+
],
77+
"headersSize": 520,
78+
"httpVersion": "HTTP/1.1",
79+
"method": "DELETE",
80+
"queryString": [],
81+
"url": "https://api.datadoghq.com/api/v1/dashboard/iu9-viw-buz"
82+
},
83+
"response": {
84+
"bodySize": 39,
85+
"content": {
86+
"mimeType": "application/json",
87+
"size": 39,
88+
"text": "{\"deleted_dashboard_id\":\"iu9-viw-buz\"}\n"
89+
},
90+
"cookies": [],
91+
"headers": [
92+
{
93+
"name": "content-type",
94+
"value": "application/json"
95+
}
96+
],
97+
"headersSize": 489,
98+
"httpVersion": "HTTP/1.1",
99+
"redirectURL": "",
100+
"status": 200,
101+
"statusText": "OK"
102+
},
103+
"startedDateTime": "2023-03-02T15:41:16.755Z",
104+
"time": 210
105+
}
106+
],
107+
"pages": [],
108+
"version": "1.2"
109+
}
110+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/**
2+
* Create a new timeseries widget with ci_pipelines data source
3+
*/
4+
5+
import { client, v1 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v1.DashboardsApi(configuration);
9+
10+
const params: v1.DashboardsApiCreateDashboardRequest = {
11+
body: {
12+
title:
13+
"Example-Create_a_new_timeseries_widget_with_ci_pipelines_data_source with ci_pipelines datasource",
14+
widgets: [
15+
{
16+
definition: {
17+
title: "",
18+
showLegend: true,
19+
legendLayout: "auto",
20+
legendColumns: ["avg", "min", "max", "value", "sum"],
21+
time: {},
22+
type: "timeseries",
23+
requests: [
24+
{
25+
formulas: [
26+
{
27+
formula: "query1",
28+
},
29+
],
30+
queries: [
31+
{
32+
dataSource: "ci_pipelines",
33+
name: "query1",
34+
search: {
35+
query: "ci_level:job",
36+
},
37+
indexes: ["*"],
38+
compute: {
39+
aggregation: "count",
40+
metric: "@ci.queue_time",
41+
},
42+
groupBy: [],
43+
},
44+
],
45+
responseFormat: "timeseries",
46+
style: {
47+
palette: "dog_classic",
48+
lineType: "solid",
49+
lineWidth: "normal",
50+
},
51+
displayType: "line",
52+
},
53+
],
54+
},
55+
},
56+
],
57+
layoutType: "ordered",
58+
reflowType: "auto",
59+
},
60+
};
61+
62+
apiInstance
63+
.createDashboard(params)
64+
.then((data: v1.Dashboard) => {
65+
console.log(
66+
"API called successfully. Returned data: " + JSON.stringify(data)
67+
);
68+
})
69+
.catch((error: any) => console.error(error));

features/v1/dashboards.feature

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,15 @@ Feature: Dashboards
620620
And the response "widgets[0].definition.type" is equal to "trace_service"
621621
And the response "widgets[0].definition.env" is equal to "none"
622622

623+
@team:DataDog/dashboards
624+
Scenario: Create a new timeseries widget with ci_pipelines data source
625+
Given new "CreateDashboard" request
626+
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"}
627+
When the request is sent
628+
Then the response status is 200 OK
629+
And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "ci_pipelines"
630+
And the response "widgets[0].definition.requests[0].queries[0].search.query" is equal to "ci_level:job"
631+
623632
@team:DataDog/dashboards
624633
Scenario: Create a new timeseries widget with ci_tests data source
625634
Given new "CreateDashboard" request

packages/datadog-api-client-v1/models/FormulaAndFunctionEventsDataSource.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export type FormulaAndFunctionEventsDataSource =
2020
| typeof AUDIT
2121
| typeof EVENTS
2222
| typeof CI_TESTS
23+
| typeof CI_PIPELINES
2324
| UnparsedObject;
2425
export const LOGS = "logs";
2526
export const SPANS = "spans";
@@ -30,3 +31,4 @@ export const PROFILES = "profiles";
3031
export const AUDIT = "audit";
3132
export const EVENTS = "events";
3233
export const CI_TESTS = "ci_tests";
34+
export const CI_PIPELINES = "ci_pipelines";

packages/datadog-api-client-v1/models/ObjectSerializer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@ const enumsMap: { [key: string]: any[] } = {
666666
"audit",
667667
"events",
668668
"ci_tests",
669+
"ci_pipelines",
669670
],
670671
FormulaAndFunctionMetricAggregation: [
671672
"avg",

0 commit comments

Comments
 (0)