Skip to content

Commit f0aadf8

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 38144b37 of spec repo
1 parent c30d515 commit f0aadf8

File tree

11 files changed

+313
-4
lines changed

11 files changed

+313
-4
lines changed

.apigentools-info

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.5",
7-
"regenerated": "2023-07-10 17:45:27.823253",
8-
"spec_repo_commit": "9e0b471a"
7+
"regenerated": "2023-07-11 14:40:42.995166",
8+
"spec_repo_commit": "38144b37"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.5",
12-
"regenerated": "2023-07-10 17:45:27.841604",
13-
"spec_repo_commit": "9e0b471a"
12+
"regenerated": "2023-07-11 14:40:43.008688",
13+
"spec_repo_commit": "38144b37"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -2466,6 +2466,38 @@ components:
24662466
- service
24672467
- stat
24682468
type: object
2469+
FormulaAndFunctionCloudCostDataSource:
2470+
description: Data source for Cloud Cost queries.
2471+
enum:
2472+
- cloud_cost
2473+
example: cloud_cost
2474+
type: string
2475+
x-enum-varnames:
2476+
- CLOUD_COST
2477+
FormulaAndFunctionCloudCostQueryDefinition:
2478+
description: A formula and functions Cloud Cost query.
2479+
example:
2480+
data_source: cloud_cost
2481+
name: query1
2482+
query: sum:aws.cost.amortized{*}
2483+
properties:
2484+
aggregator:
2485+
$ref: '#/components/schemas/WidgetAggregator'
2486+
data_source:
2487+
$ref: '#/components/schemas/FormulaAndFunctionCloudCostDataSource'
2488+
name:
2489+
description: Name of the query for use in formulas.
2490+
example: my_query
2491+
type: string
2492+
query:
2493+
description: Query for Cloud Cost data.
2494+
example: ''
2495+
type: string
2496+
required:
2497+
- data_source
2498+
- query
2499+
- name
2500+
type: object
24692501
FormulaAndFunctionEventAggregation:
24702502
description: Aggregation methods for event platform queries.
24712503
enum:
@@ -2729,6 +2761,7 @@ components:
27292761
- $ref: '#/components/schemas/FormulaAndFunctionApmDependencyStatsQueryDefinition'
27302762
- $ref: '#/components/schemas/FormulaAndFunctionApmResourceStatsQueryDefinition'
27312763
- $ref: '#/components/schemas/FormulaAndFunctionSLOQueryDefinition'
2764+
- $ref: '#/components/schemas/FormulaAndFunctionCloudCostQueryDefinition'
27322765
type: object
27332766
FormulaAndFunctionResponseFormat:
27342767
description: Timeseries, scalar, or event list response. Event list response
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2023-07-11T14:32:45.409Z"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"log": {
3+
"_recordingName": "Dashboards/Create a new dashboard with a timeseries widget using formulas and functions cloud cost query",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "21554e3cbbf51a3f13fd398b7622a007",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 577,
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": 558,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"layout_type\":\"ordered\",\"title\":\"Test-Create_a_new_dashboard_with_a_timeseries_widget_using_formulas_and_functions_cloud_cost_query-1689085965\",\"widgets\":[{\"definition\":{\"requests\":[{\"display_type\":\"bars\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"data_source\":\"cloud_cost\",\"name\":\"query1\",\"query\":\"sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)\"}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"title\":\"Example Cloud Cost Query\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"timeseries\"}}]}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v1/dashboard"
39+
},
40+
"response": {
41+
"bodySize": 988,
42+
"content": {
43+
"mimeType": "application/json",
44+
"size": 988,
45+
"text": "{\"id\":\"kka-2iz-3jf\",\"title\":\"Test-Create_a_new_dashboard_with_a_timeseries_widget_using_formulas_and_functions_cloud_cost_query-1689085965\",\"description\":null,\"author_handle\":\"frog@datadoghq.com\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/kka-2iz-3jf/test-createanewdashboardwithatimeserieswidgetusingformulasandfunctionscloudcostq\",\"is_read_only\":false,\"template_variables\":null,\"widgets\":[{\"definition\":{\"requests\":[{\"display_type\":\"bars\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"data_source\":\"cloud_cost\",\"name\":\"query1\",\"query\":\"sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)\"}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"title\":\"Example Cloud Cost Query\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"timeseries\"},\"id\":1004255439340}],\"notify_list\":null,\"created_at\":\"2023-07-11T14:32:45.564617+00:00\",\"modified_at\":\"2023-07-11T14:32:45.564617+00:00\",\"restricted_roles\":[]}\n"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/json"
52+
}
53+
],
54+
"headersSize": 517,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 200,
58+
"statusText": "OK"
59+
},
60+
"startedDateTime": "2023-07-11T14:32:45.418Z",
61+
"time": 219
62+
},
63+
{
64+
"_id": "7c80e62c382149b2a53afcb41ec2fea8",
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": 519,
78+
"httpVersion": "HTTP/1.1",
79+
"method": "DELETE",
80+
"queryString": [],
81+
"url": "https://api.datadoghq.com/api/v1/dashboard/kka-2iz-3jf"
82+
},
83+
"response": {
84+
"bodySize": 39,
85+
"content": {
86+
"mimeType": "application/json",
87+
"size": 39,
88+
"text": "{\"deleted_dashboard_id\":\"kka-2iz-3jf\"}\n"
89+
},
90+
"cookies": [],
91+
"headers": [
92+
{
93+
"name": "content-type",
94+
"value": "application/json"
95+
}
96+
],
97+
"headersSize": 516,
98+
"httpVersion": "HTTP/1.1",
99+
"redirectURL": "",
100+
"status": 200,
101+
"statusText": "OK"
102+
},
103+
"startedDateTime": "2023-07-11T14:32:45.648Z",
104+
"time": 186
105+
}
106+
],
107+
"pages": [],
108+
"version": "1.2"
109+
}
110+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/**
2+
* Create a new dashboard with a timeseries widget using formulas and functions cloud cost query
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: "Example-Dashboard",
13+
widgets: [
14+
{
15+
definition: {
16+
title: "Example Cloud Cost Query",
17+
titleSize: "16",
18+
titleAlign: "left",
19+
type: "timeseries",
20+
requests: [
21+
{
22+
formulas: [
23+
{
24+
formula: "query1",
25+
},
26+
],
27+
queries: [
28+
{
29+
dataSource: "cloud_cost",
30+
name: "query1",
31+
query:
32+
"sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)",
33+
},
34+
],
35+
responseFormat: "timeseries",
36+
style: {
37+
palette: "dog_classic",
38+
lineType: "solid",
39+
lineWidth: "normal",
40+
},
41+
displayType: "bars",
42+
},
43+
],
44+
},
45+
},
46+
],
47+
layoutType: "ordered",
48+
},
49+
};
50+
51+
apiInstance
52+
.createDashboard(params)
53+
.then((data: v1.Dashboard) => {
54+
console.log(
55+
"API called successfully. Returned data: " + JSON.stringify(data)
56+
);
57+
})
58+
.catch((error: any) => console.error(error));

features/v1/dashboards.feature

+12
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,18 @@ Feature: Dashboards
159159
And the response "widgets[0].definition.requests[0].response_format" is equal to "scalar"
160160
And the response "widgets[0].definition.requests[0].queries[0].query" is equal to "sum:my.cool.count.metric{*}"
161161

162+
@team:DataDog/dashboards-backend
163+
Scenario: Create a new dashboard with a timeseries widget using formulas and functions cloud cost query
164+
Given new "CreateDashboard" request
165+
And body with value { "title": "{{ unique }}", "widgets": [ { "definition": { "title": "Example Cloud Cost Query", "title_size": "16", "title_align": "left", "type": "timeseries", "requests": [ { "formulas": [ { "formula": "query1" } ], "queries": [ { "data_source": "cloud_cost", "name": "query1", "query": "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)" } ], "response_format": "timeseries", "style": { "palette": "dog_classic", "line_type": "solid", "line_width": "normal" }, "display_type": "bars" } ] } } ], "layout_type": "ordered" }
166+
When the request is sent
167+
Then the response status is 200 OK
168+
And the response "widgets[0].definition.requests[0].response_format" is equal to "timeseries"
169+
And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "cloud_cost"
170+
And the response "widgets[0].definition.requests[0].queries[0].name" is equal to "query1"
171+
And the response "widgets[0].definition.requests[0].queries[0].query" is equal to "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)"
172+
And the response "widgets[0].definition.requests[0].formulas[0].formula" is equal to "query1"
173+
162174
@team:DataDog/dashboards-backend
163175
Scenario: Create a new dashboard with alert_graph widget
164176
Given there is a valid "monitor" in the system

packages/datadog-api-client-v1/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,8 @@ export { FormulaAndFunctionApmDependencyStatsQueryDefinition } from "./models/Fo
428428
export { FormulaAndFunctionApmResourceStatName } from "./models/FormulaAndFunctionApmResourceStatName";
429429
export { FormulaAndFunctionApmResourceStatsDataSource } from "./models/FormulaAndFunctionApmResourceStatsDataSource";
430430
export { FormulaAndFunctionApmResourceStatsQueryDefinition } from "./models/FormulaAndFunctionApmResourceStatsQueryDefinition";
431+
export { FormulaAndFunctionCloudCostDataSource } from "./models/FormulaAndFunctionCloudCostDataSource";
432+
export { FormulaAndFunctionCloudCostQueryDefinition } from "./models/FormulaAndFunctionCloudCostQueryDefinition";
431433
export { FormulaAndFunctionEventAggregation } from "./models/FormulaAndFunctionEventAggregation";
432434
export { FormulaAndFunctionEventQueryDefinition } from "./models/FormulaAndFunctionEventQueryDefinition";
433435
export { FormulaAndFunctionEventQueryDefinitionCompute } from "./models/FormulaAndFunctionEventQueryDefinitionCompute";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
3+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
* Copyright 2020-Present Datadog, Inc.
5+
*/
6+
7+
import { UnparsedObject } from "../../datadog-api-client-common/util";
8+
9+
/**
10+
* Data source for Cloud Cost queries.
11+
*/
12+
13+
export type FormulaAndFunctionCloudCostDataSource =
14+
| typeof CLOUD_COST
15+
| UnparsedObject;
16+
export const CLOUD_COST = "cloud_cost";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/**
2+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
3+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
* Copyright 2020-Present Datadog, Inc.
5+
*/
6+
import { FormulaAndFunctionCloudCostDataSource } from "./FormulaAndFunctionCloudCostDataSource";
7+
import { WidgetAggregator } from "./WidgetAggregator";
8+
9+
import { AttributeTypeMap } from "../../datadog-api-client-common/util";
10+
11+
/**
12+
* A formula and functions Cloud Cost query.
13+
*/
14+
export class FormulaAndFunctionCloudCostQueryDefinition {
15+
/**
16+
* Aggregator used for the request.
17+
*/
18+
"aggregator"?: WidgetAggregator;
19+
/**
20+
* Data source for Cloud Cost queries.
21+
*/
22+
"dataSource": FormulaAndFunctionCloudCostDataSource;
23+
/**
24+
* Name of the query for use in formulas.
25+
*/
26+
"name": string;
27+
/**
28+
* Query for Cloud Cost data.
29+
*/
30+
"query": string;
31+
32+
/**
33+
* @ignore
34+
*/
35+
"_unparsed"?: boolean;
36+
37+
/**
38+
* @ignore
39+
*/
40+
static readonly attributeTypeMap: AttributeTypeMap = {
41+
aggregator: {
42+
baseName: "aggregator",
43+
type: "WidgetAggregator",
44+
},
45+
dataSource: {
46+
baseName: "data_source",
47+
type: "FormulaAndFunctionCloudCostDataSource",
48+
required: true,
49+
},
50+
name: {
51+
baseName: "name",
52+
type: "string",
53+
required: true,
54+
},
55+
query: {
56+
baseName: "query",
57+
type: "string",
58+
required: true,
59+
},
60+
};
61+
62+
/**
63+
* @ignore
64+
*/
65+
static getAttributeTypeMap(): AttributeTypeMap {
66+
return FormulaAndFunctionCloudCostQueryDefinition.attributeTypeMap;
67+
}
68+
69+
public constructor() {}
70+
}

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

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
import { FormulaAndFunctionApmDependencyStatsQueryDefinition } from "./FormulaAndFunctionApmDependencyStatsQueryDefinition";
77
import { FormulaAndFunctionApmResourceStatsQueryDefinition } from "./FormulaAndFunctionApmResourceStatsQueryDefinition";
8+
import { FormulaAndFunctionCloudCostQueryDefinition } from "./FormulaAndFunctionCloudCostQueryDefinition";
89
import { FormulaAndFunctionEventQueryDefinition } from "./FormulaAndFunctionEventQueryDefinition";
910
import { FormulaAndFunctionMetricQueryDefinition } from "./FormulaAndFunctionMetricQueryDefinition";
1011
import { FormulaAndFunctionProcessQueryDefinition } from "./FormulaAndFunctionProcessQueryDefinition";
@@ -23,4 +24,5 @@ export type FormulaAndFunctionQueryDefinition =
2324
| FormulaAndFunctionApmDependencyStatsQueryDefinition
2425
| FormulaAndFunctionApmResourceStatsQueryDefinition
2526
| FormulaAndFunctionSLOQueryDefinition
27+
| FormulaAndFunctionCloudCostQueryDefinition
2628
| UnparsedObject;

0 commit comments

Comments
 (0)