Skip to content

Commit f9aa22b

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit d6e52321 of spec repo
1 parent 25106c2 commit f9aa22b

15 files changed

+540
-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.6",
7-
"regenerated": "2025-02-14 15:03:44.521676",
8-
"spec_repo_commit": "a739b49f"
7+
"regenerated": "2025-02-17 08:34:55.318327",
8+
"spec_repo_commit": "d6e52321"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-02-14 15:03:44.537023",
13-
"spec_repo_commit": "a739b49f"
12+
"regenerated": "2025-02-17 08:34:55.337187",
13+
"spec_repo_commit": "d6e52321"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

+66
Original file line numberDiff line numberDiff line change
@@ -9727,6 +9727,62 @@ components:
97279727
items:
97289728
$ref: '#/components/schemas/NotifyEndType'
97299729
type: array
9730+
NumberFormatUnit:
9731+
description: Number format unit.
9732+
oneOf:
9733+
- $ref: '#/components/schemas/NumberFormatUnitCanonical'
9734+
- $ref: '#/components/schemas/NumberFormatUnitCustom'
9735+
NumberFormatUnitCanonical:
9736+
description: Canonical unit.
9737+
properties:
9738+
per_unit_name:
9739+
description: The name of the unit per item.
9740+
example: bytes
9741+
type: string
9742+
type:
9743+
$ref: '#/components/schemas/NumberFormatUnitScaleType'
9744+
unit_name:
9745+
description: The name of the unit.
9746+
example: bytes
9747+
type: string
9748+
type: object
9749+
NumberFormatUnitCustom:
9750+
description: Custom unit.
9751+
properties:
9752+
label:
9753+
description: The label for the custom unit.
9754+
maxLength: 12
9755+
minLength: 1
9756+
type: string
9757+
type:
9758+
$ref: '#/components/schemas/NumberFormatUnitCustomType'
9759+
type: object
9760+
NumberFormatUnitCustomType:
9761+
description: The type of custom unit.
9762+
enum:
9763+
- custom_unit_label
9764+
type: string
9765+
x-enum-varnames:
9766+
- CUSTOM_UNIT_LABEL
9767+
NumberFormatUnitScale:
9768+
description: The definition of `NumberFormatUnitScale` object.
9769+
nullable: true
9770+
properties:
9771+
type:
9772+
$ref: '#/components/schemas/NumberFormatUnitScaleType'
9773+
unit_name:
9774+
description: The name of the unit.
9775+
example: bytes
9776+
type: string
9777+
type: object
9778+
NumberFormatUnitScaleType:
9779+
description: The type of unit scale.
9780+
enum:
9781+
- canonical_unit
9782+
example: canonical_unit
9783+
type: string
9784+
x-enum-varnames:
9785+
- CANONICAL_UNIT
97309786
OnMissingDataOption:
97319787
description: 'Controls how groups or monitors are treated if an evaluation does
97329788
not return any data points.
@@ -23044,6 +23100,8 @@ components:
2304423100
type: string
2304523101
limit:
2304623102
$ref: '#/components/schemas/WidgetFormulaLimit'
23103+
number_format:
23104+
$ref: '#/components/schemas/WidgetNumberFormat'
2304723105
style:
2304823106
$ref: '#/components/schemas/WidgetFormulaStyle'
2304923107
required:
@@ -23463,6 +23521,14 @@ components:
2346323521
x-enum-varnames:
2346423522
- HOST
2346523523
- CONTAINER
23524+
WidgetNumberFormat:
23525+
description: Number format options for the widget.
23526+
properties:
23527+
unit:
23528+
$ref: '#/components/schemas/NumberFormatUnit'
23529+
unit_scale:
23530+
$ref: '#/components/schemas/NumberFormatUnitScale'
23531+
type: object
2346623532
WidgetOrderBy:
2346723533
description: What to order by.
2346823534
enum:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/**
2+
* Create a new dashboard with timeseries widget with custom_unit
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+
description: "",
14+
widgets: [
15+
{
16+
definition: {
17+
title: "",
18+
titleSize: "16",
19+
titleAlign: "left",
20+
showLegend: true,
21+
legendLayout: "auto",
22+
time: {},
23+
type: "timeseries",
24+
requests: [
25+
{
26+
formulas: [
27+
{
28+
formula: "query1",
29+
numberFormat: {
30+
unitScale: {
31+
type: "canonical_unit",
32+
unitName: "apdex",
33+
},
34+
unit: {
35+
type: "canonical_unit",
36+
unitName: "fraction",
37+
},
38+
},
39+
},
40+
],
41+
queries: [
42+
{
43+
dataSource: "metrics",
44+
name: "query1",
45+
query: "avg:system.cpu.user{*}",
46+
},
47+
],
48+
responseFormat: "timeseries",
49+
displayType: "line",
50+
},
51+
],
52+
},
53+
layout: {
54+
x: 0,
55+
y: 0,
56+
width: 12,
57+
height: 5,
58+
},
59+
},
60+
],
61+
templateVariables: [],
62+
layoutType: "ordered",
63+
notifyList: [],
64+
reflowType: "fixed",
65+
},
66+
};
67+
68+
apiInstance
69+
.createDashboard(params)
70+
.then((data: v1.Dashboard) => {
71+
console.log(
72+
"API called successfully. Returned data: " + JSON.stringify(data)
73+
);
74+
})
75+
.catch((error: any) => console.error(error));

features/v1/dashboards.feature

+12
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,18 @@ Feature: Dashboards
817817
And the response "widgets[0].definition.requests[0].display_type" is equal to "bars"
818818
And the response "widgets[0].definition.requests[0].q" is equal to "sum:trace.test.errors{env:prod,service:datadog-api-spec} by {resource_name}.as_count()"
819819

820+
@team:DataDog/dashboards-backend
821+
Scenario: Create a new dashboard with timeseries widget with custom_unit
822+
Given new "CreateDashboard" request
823+
And body from file "dashboards_json_payload/timeseries_widget_with_custom_unit.json"
824+
When the request is sent
825+
Then the response status is 200 OK
826+
And the response "widgets[0].definition.type" is equal to "timeseries"
827+
And the response "widgets[0].definition.requests[0].formulas[0].number_format.unit_scale.type" is equal to "canonical_unit"
828+
And the response "widgets[0].definition.requests[0].formulas[0].number_format.unit_scale.unit_name" is equal to "apdex"
829+
And the response "widgets[0].definition.requests[0].formulas[0].number_format.unit.type" is equal to "canonical_unit"
830+
And the response "widgets[0].definition.requests[0].formulas[0].number_format.unit.unit_name" is equal to "fraction"
831+
820832
@team:DataDog/dashboards-backend
821833
Scenario: Create a new dashboard with toplist widget
822834
Given new "CreateDashboard" request
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"title": "{{ unique }}",
3+
"description": "",
4+
"widgets": [
5+
{
6+
"definition": {
7+
"title": "",
8+
"title_size": "16",
9+
"title_align": "left",
10+
"show_legend": true,
11+
"legend_layout": "auto",
12+
"time": {},
13+
"type": "timeseries",
14+
"requests": [
15+
{
16+
"formulas": [
17+
{
18+
"formula": "query1",
19+
"number_format": {
20+
"unit_scale": {
21+
"type": "canonical_unit",
22+
"unit_name": "apdex"
23+
},
24+
"unit": {
25+
"type": "canonical_unit",
26+
"unit_name": "fraction"
27+
}
28+
}
29+
}
30+
],
31+
"queries": [
32+
{
33+
"data_source": "metrics",
34+
"name": "query1",
35+
"query": "avg:system.cpu.user{*}"
36+
}
37+
],
38+
"response_format": "timeseries",
39+
"display_type": "line"
40+
}
41+
]
42+
},
43+
"layout": {
44+
"x": 0,
45+
"y": 0,
46+
"width": 12,
47+
"height": 5
48+
}
49+
}
50+
],
51+
"template_variables": [],
52+
"layout_type": "ordered",
53+
"notify_list": [],
54+
"reflow_type": "fixed"
55+
}

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

+7
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,12 @@ export { NoteWidgetDefinition } from "./models/NoteWidgetDefinition";
702702
export { NoteWidgetDefinitionType } from "./models/NoteWidgetDefinitionType";
703703
export { NotifyEndState } from "./models/NotifyEndState";
704704
export { NotifyEndType } from "./models/NotifyEndType";
705+
export { NumberFormatUnit } from "./models/NumberFormatUnit";
706+
export { NumberFormatUnitCanonical } from "./models/NumberFormatUnitCanonical";
707+
export { NumberFormatUnitCustom } from "./models/NumberFormatUnitCustom";
708+
export { NumberFormatUnitCustomType } from "./models/NumberFormatUnitCustomType";
709+
export { NumberFormatUnitScale } from "./models/NumberFormatUnitScale";
710+
export { NumberFormatUnitScaleType } from "./models/NumberFormatUnitScaleType";
705711
export { OnMissingDataOption } from "./models/OnMissingDataOption";
706712
export { Organization } from "./models/Organization";
707713
export { OrganizationBilling } from "./models/OrganizationBilling";
@@ -1213,6 +1219,7 @@ export { WidgetNewFixedSpanType } from "./models/WidgetNewFixedSpanType";
12131219
export { WidgetNewLiveSpan } from "./models/WidgetNewLiveSpan";
12141220
export { WidgetNewLiveSpanType } from "./models/WidgetNewLiveSpanType";
12151221
export { WidgetNodeType } from "./models/WidgetNodeType";
1222+
export { WidgetNumberFormat } from "./models/WidgetNumberFormat";
12161223
export { WidgetOrderBy } from "./models/WidgetOrderBy";
12171224
export { WidgetPalette } from "./models/WidgetPalette";
12181225
export { WidgetRequestStyle } from "./models/WidgetRequestStyle";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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 { NumberFormatUnitCanonical } from "./NumberFormatUnitCanonical";
7+
import { NumberFormatUnitCustom } from "./NumberFormatUnitCustom";
8+
9+
import { UnparsedObject } from "../../datadog-api-client-common/util";
10+
11+
/**
12+
* Number format unit.
13+
*/
14+
15+
export type NumberFormatUnit =
16+
| NumberFormatUnitCanonical
17+
| NumberFormatUnitCustom
18+
| UnparsedObject;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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 { NumberFormatUnitScaleType } from "./NumberFormatUnitScaleType";
7+
8+
import { AttributeTypeMap } from "../../datadog-api-client-common/util";
9+
10+
/**
11+
* Canonical unit.
12+
*/
13+
export class NumberFormatUnitCanonical {
14+
/**
15+
* The name of the unit per item.
16+
*/
17+
"perUnitName"?: string;
18+
/**
19+
* The type of unit scale.
20+
*/
21+
"type"?: NumberFormatUnitScaleType;
22+
/**
23+
* The name of the unit.
24+
*/
25+
"unitName"?: string;
26+
27+
/**
28+
* A container for additional, undeclared properties.
29+
* This is a holder for any undeclared properties as specified with
30+
* the 'additionalProperties' keyword in the OAS document.
31+
*/
32+
"additionalProperties"?: { [key: string]: any };
33+
34+
/**
35+
* @ignore
36+
*/
37+
"_unparsed"?: boolean;
38+
39+
/**
40+
* @ignore
41+
*/
42+
static readonly attributeTypeMap: AttributeTypeMap = {
43+
perUnitName: {
44+
baseName: "per_unit_name",
45+
type: "string",
46+
},
47+
type: {
48+
baseName: "type",
49+
type: "NumberFormatUnitScaleType",
50+
},
51+
unitName: {
52+
baseName: "unit_name",
53+
type: "string",
54+
},
55+
additionalProperties: {
56+
baseName: "additionalProperties",
57+
type: "any",
58+
},
59+
};
60+
61+
/**
62+
* @ignore
63+
*/
64+
static getAttributeTypeMap(): AttributeTypeMap {
65+
return NumberFormatUnitCanonical.attributeTypeMap;
66+
}
67+
68+
public constructor() {}
69+
}

0 commit comments

Comments
 (0)