Skip to content

Commit 172b38e

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
dashboards - Add DashboardTab schema and tabs property to Dashboard spec (#3491)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent f66006b commit 172b38e

File tree

6 files changed

+124
-3
lines changed

6 files changed

+124
-3
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,13 @@ components:
13141314
description: A role UUID.
13151315
type: string
13161316
type: array
1317+
tabs:
1318+
description: List of tabs for organizing dashboard widgets into groups.
1319+
items:
1320+
$ref: '#/components/schemas/DashboardTab'
1321+
maxItems: 100
1322+
nullable: true
1323+
type: array
13171324
tags:
13181325
description: List of team names representing ownership of a dashboard.
13191326
items:
@@ -1584,6 +1591,36 @@ components:
15841591
description: URL of the dashboard.
15851592
type: string
15861593
type: object
1594+
DashboardTab:
1595+
description: Dashboard tab for organizing widgets.
1596+
properties:
1597+
id:
1598+
description: UUID of the tab.
1599+
example: ''
1600+
format: uuid
1601+
type: string
1602+
name:
1603+
description: Name of the tab.
1604+
example: L
1605+
maxLength: 100
1606+
minLength: 1
1607+
type: string
1608+
widget_ids:
1609+
description: List of widget IDs belonging to this tab. The backend also
1610+
accepts positional references in @N format (1-indexed) as a convenience
1611+
for Terraform and other declarative tools.
1612+
example:
1613+
- 0
1614+
items:
1615+
description: Widget ID.
1616+
format: int64
1617+
type: integer
1618+
type: array
1619+
required:
1620+
- id
1621+
- name
1622+
- widget_ids
1623+
type: object
15871624
DashboardTemplateVariable:
15881625
description: Template variable.
15891626
properties:

features/v1/dashboards.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Feature: Dashboards
9090
@generated @skip @team:DataDog/dashboards-backend
9191
Scenario: Create a new dashboard returns "Bad Request" response
9292
Given new "CreateDashboard" request
93-
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
93+
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
9494
When the request is sent
9595
Then the response status is 400 Bad Request
9696

@@ -1373,15 +1373,15 @@ Feature: Dashboards
13731373
Scenario: Update a dashboard returns "Bad Request" response
13741374
Given new "UpdateDashboard" request
13751375
And request contains "dashboard_id" parameter from "REPLACE.ME"
1376-
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
1376+
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
13771377
When the request is sent
13781378
Then the response status is 400 Bad Request
13791379

13801380
@generated @skip @team:DataDog/dashboards-backend
13811381
Scenario: Update a dashboard returns "Item Not Found" response
13821382
Given new "UpdateDashboard" request
13831383
And request contains "dashboard_id" parameter from "REPLACE.ME"
1384-
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
1384+
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
13851385
When the request is sent
13861386
Then the response status is 404 Item Not Found
13871387

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ export { DashboardRestoreRequest } from "./models/DashboardRestoreRequest";
417417
export { DashboardShareType } from "./models/DashboardShareType";
418418
export { DashboardSummary } from "./models/DashboardSummary";
419419
export { DashboardSummaryDefinition } from "./models/DashboardSummaryDefinition";
420+
export { DashboardTab } from "./models/DashboardTab";
420421
export { DashboardTemplateVariable } from "./models/DashboardTemplateVariable";
421422
export { DashboardTemplateVariablePreset } from "./models/DashboardTemplateVariablePreset";
422423
export { DashboardTemplateVariablePresetValue } from "./models/DashboardTemplateVariablePresetValue";

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
import { DashboardLayoutType } from "./DashboardLayoutType";
77
import { DashboardReflowType } from "./DashboardReflowType";
8+
import { DashboardTab } from "./DashboardTab";
89
import { DashboardTemplateVariable } from "./DashboardTemplateVariable";
910
import { DashboardTemplateVariablePreset } from "./DashboardTemplateVariablePreset";
1011
import { Widget } from "./Widget";
@@ -64,6 +65,10 @@ export class Dashboard {
6465
* A list of role identifiers. Only the author and users associated with at least one of these roles can edit this dashboard.
6566
*/
6667
"restrictedRoles"?: Array<string>;
68+
/**
69+
* List of tabs for organizing dashboard widgets into groups.
70+
*/
71+
"tabs"?: Array<DashboardTab>;
6772
/**
6873
* List of team names representing ownership of a dashboard.
6974
*/
@@ -152,6 +157,10 @@ export class Dashboard {
152157
baseName: "restricted_roles",
153158
type: "Array<string>",
154159
},
160+
tabs: {
161+
baseName: "tabs",
162+
type: "Array<DashboardTab>",
163+
},
155164
tags: {
156165
baseName: "tags",
157166
type: "Array<string>",
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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 { AttributeTypeMap } from "../../datadog-api-client-common/util";
8+
9+
/**
10+
* Dashboard tab for organizing widgets.
11+
*/
12+
export class DashboardTab {
13+
/**
14+
* UUID of the tab.
15+
*/
16+
"id": string;
17+
/**
18+
* Name of the tab.
19+
*/
20+
"name": string;
21+
/**
22+
* List of widget IDs belonging to this tab. The backend also accepts positional references in @N format (1-indexed) as a convenience for Terraform and other declarative tools.
23+
*/
24+
"widgetIds": Array<number>;
25+
26+
/**
27+
* A container for additional, undeclared properties.
28+
* This is a holder for any undeclared properties as specified with
29+
* the 'additionalProperties' keyword in the OAS document.
30+
*/
31+
"additionalProperties"?: { [key: string]: any };
32+
33+
/**
34+
* @ignore
35+
*/
36+
"_unparsed"?: boolean;
37+
38+
/**
39+
* @ignore
40+
*/
41+
static readonly attributeTypeMap: AttributeTypeMap = {
42+
id: {
43+
baseName: "id",
44+
type: "string",
45+
required: true,
46+
format: "uuid",
47+
},
48+
name: {
49+
baseName: "name",
50+
type: "string",
51+
required: true,
52+
},
53+
widgetIds: {
54+
baseName: "widget_ids",
55+
type: "Array<number>",
56+
required: true,
57+
},
58+
additionalProperties: {
59+
baseName: "additionalProperties",
60+
type: "{ [key: string]: any; }",
61+
},
62+
};
63+
64+
/**
65+
* @ignore
66+
*/
67+
static getAttributeTypeMap(): AttributeTypeMap {
68+
return DashboardTab.attributeTypeMap;
69+
}
70+
71+
public constructor() {}
72+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ import { DashboardListListResponse } from "./DashboardListListResponse";
6060
import { DashboardRestoreRequest } from "./DashboardRestoreRequest";
6161
import { DashboardSummary } from "./DashboardSummary";
6262
import { DashboardSummaryDefinition } from "./DashboardSummaryDefinition";
63+
import { DashboardTab } from "./DashboardTab";
6364
import { DashboardTemplateVariable } from "./DashboardTemplateVariable";
6465
import { DashboardTemplateVariablePreset } from "./DashboardTemplateVariablePreset";
6566
import { DashboardTemplateVariablePresetValue } from "./DashboardTemplateVariablePresetValue";
@@ -1872,6 +1873,7 @@ const typeMap: { [index: string]: any } = {
18721873
DashboardRestoreRequest: DashboardRestoreRequest,
18731874
DashboardSummary: DashboardSummary,
18741875
DashboardSummaryDefinition: DashboardSummaryDefinition,
1876+
DashboardTab: DashboardTab,
18751877
DashboardTemplateVariable: DashboardTemplateVariable,
18761878
DashboardTemplateVariablePreset: DashboardTemplateVariablePreset,
18771879
DashboardTemplateVariablePresetValue: DashboardTemplateVariablePresetValue,

0 commit comments

Comments
 (0)