diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 3e86f3a82c2d..87bad04350b9 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -1390,6 +1390,13 @@ components: description: A role UUID. type: string type: array + tabs: + description: List of tabs for organizing dashboard widgets into groups. + items: + $ref: '#/components/schemas/DashboardTab' + maxItems: 100 + nullable: true + type: array tags: description: List of team names representing ownership of a dashboard. items: @@ -1681,6 +1688,36 @@ components: description: URL of the dashboard. type: string type: object + DashboardTab: + description: Dashboard tab for organizing widgets. + properties: + id: + description: UUID of the tab. + example: '' + format: uuid + type: string + name: + description: Name of the tab. + example: L + maxLength: 100 + minLength: 1 + type: string + widget_ids: + description: 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. + example: + - 0 + items: + description: Widget ID. + format: int64 + type: integer + type: array + required: + - id + - name + - widget_ids + type: object DashboardTemplateVariable: description: Template variable. properties: diff --git a/features/v1/dashboards.feature b/features/v1/dashboards.feature index 349f7de6f9d7..180d587a837b 100644 --- a/features/v1/dashboards.feature +++ b/features/v1/dashboards.feature @@ -91,7 +91,7 @@ Feature: Dashboards @generated @skip @team:DataDog/dashboards-backend Scenario: Create a new dashboard returns "Bad Request" response Given new "CreateDashboard" request - 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"}}]} + 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"}}]} When the request is sent Then the response status is 400 Bad Request @@ -1342,7 +1342,7 @@ Feature: Dashboards Scenario: Update a dashboard returns "Bad Request" response Given new "UpdateDashboard" request And request contains "dashboard_id" parameter from "REPLACE.ME" - 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"}}]} + 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"}}]} When the request is sent Then the response status is 400 Bad Request @@ -1350,7 +1350,7 @@ Feature: Dashboards Scenario: Update a dashboard returns "Item Not Found" response Given new "UpdateDashboard" request And request contains "dashboard_id" parameter from "REPLACE.ME" - 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"}}]} + 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"}}]} When the request is sent Then the response status is 404 Item Not Found diff --git a/packages/datadog-api-client-v1/index.ts b/packages/datadog-api-client-v1/index.ts index c4e237e25993..8f640d1ebda5 100644 --- a/packages/datadog-api-client-v1/index.ts +++ b/packages/datadog-api-client-v1/index.ts @@ -417,6 +417,7 @@ export { DashboardRestoreRequest } from "./models/DashboardRestoreRequest"; export { DashboardShareType } from "./models/DashboardShareType"; export { DashboardSummary } from "./models/DashboardSummary"; export { DashboardSummaryDefinition } from "./models/DashboardSummaryDefinition"; +export { DashboardTab } from "./models/DashboardTab"; export { DashboardTemplateVariable } from "./models/DashboardTemplateVariable"; export { DashboardTemplateVariablePreset } from "./models/DashboardTemplateVariablePreset"; export { DashboardTemplateVariablePresetValue } from "./models/DashboardTemplateVariablePresetValue"; diff --git a/packages/datadog-api-client-v1/models/Dashboard.ts b/packages/datadog-api-client-v1/models/Dashboard.ts index 3dd7689f9fda..5f55e462f230 100644 --- a/packages/datadog-api-client-v1/models/Dashboard.ts +++ b/packages/datadog-api-client-v1/models/Dashboard.ts @@ -5,6 +5,7 @@ */ import { DashboardLayoutType } from "./DashboardLayoutType"; import { DashboardReflowType } from "./DashboardReflowType"; +import { DashboardTab } from "./DashboardTab"; import { DashboardTemplateVariable } from "./DashboardTemplateVariable"; import { DashboardTemplateVariablePreset } from "./DashboardTemplateVariablePreset"; import { Widget } from "./Widget"; @@ -64,6 +65,10 @@ export class Dashboard { * A list of role identifiers. Only the author and users associated with at least one of these roles can edit this dashboard. */ "restrictedRoles"?: Array; + /** + * List of tabs for organizing dashboard widgets into groups. + */ + "tabs"?: Array; /** * List of team names representing ownership of a dashboard. */ @@ -152,6 +157,10 @@ export class Dashboard { baseName: "restricted_roles", type: "Array", }, + tabs: { + baseName: "tabs", + type: "Array", + }, tags: { baseName: "tags", type: "Array", diff --git a/packages/datadog-api-client-v1/models/DashboardTab.ts b/packages/datadog-api-client-v1/models/DashboardTab.ts new file mode 100644 index 000000000000..b37a677859c5 --- /dev/null +++ b/packages/datadog-api-client-v1/models/DashboardTab.ts @@ -0,0 +1,72 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Dashboard tab for organizing widgets. + */ +export class DashboardTab { + /** + * UUID of the tab. + */ + "id": string; + /** + * Name of the tab. + */ + "name": string; + /** + * 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. + */ + "widgetIds": Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + id: { + baseName: "id", + type: "string", + required: true, + format: "uuid", + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + widgetIds: { + baseName: "widget_ids", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return DashboardTab.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v1/models/ObjectSerializer.ts b/packages/datadog-api-client-v1/models/ObjectSerializer.ts index 84353a5d6194..63d809567b14 100644 --- a/packages/datadog-api-client-v1/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v1/models/ObjectSerializer.ts @@ -60,6 +60,7 @@ import { DashboardListListResponse } from "./DashboardListListResponse"; import { DashboardRestoreRequest } from "./DashboardRestoreRequest"; import { DashboardSummary } from "./DashboardSummary"; import { DashboardSummaryDefinition } from "./DashboardSummaryDefinition"; +import { DashboardTab } from "./DashboardTab"; import { DashboardTemplateVariable } from "./DashboardTemplateVariable"; import { DashboardTemplateVariablePreset } from "./DashboardTemplateVariablePreset"; import { DashboardTemplateVariablePresetValue } from "./DashboardTemplateVariablePresetValue"; @@ -1837,6 +1838,7 @@ const typeMap: { [index: string]: any } = { DashboardRestoreRequest: DashboardRestoreRequest, DashboardSummary: DashboardSummary, DashboardSummaryDefinition: DashboardSummaryDefinition, + DashboardTab: DashboardTab, DashboardTemplateVariable: DashboardTemplateVariable, DashboardTemplateVariablePreset: DashboardTemplateVariablePreset, DashboardTemplateVariablePresetValue: DashboardTemplateVariablePresetValue,