From 2e3cbda92435f541abb46a8ddb386766b3bc13aa Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 9 Oct 2026 17:46:25 +0000 Subject: [PATCH] Regenerate client from commit 2478f8a of spec repo --- .generator/schemas/v1/openapi.yaml | 397 ++++++++++++++++++ .../dashboards/CreateDashboard_1322784076.py | 94 +++++ .../dashboards/CreateDashboard_1681529203.py | 97 +++++ .../dashboards/CreateDashboard_2574782816.py | 87 ++++ .../v1/model/heatgrid_color.py | 34 ++ .../v1/model/heatgrid_color_bin.py | 55 +++ .../v1/model/heatgrid_color_config.py | 57 +++ .../v1/model/heatgrid_color_stop.py | 57 +++ .../v1/model/heatgrid_custom_color_source.py | 35 ++ .../model/heatgrid_discrete_custom_color.py | 70 +++ .../v1/model/heatgrid_discrete_mode.py | 35 ++ .../model/heatgrid_discrete_preset_color.py | 58 +++ .../model/heatgrid_gradient_custom_color.py | 69 +++ .../v1/model/heatgrid_gradient_mode.py | 35 ++ .../model/heatgrid_gradient_preset_color.py | 58 +++ .../v1/model/heatgrid_label_column.py | 44 ++ .../v1/model/heatgrid_label_column_width.py | 47 +++ .../v1/model/heatgrid_legend.py | 40 ++ .../v1/model/heatgrid_nesting_display.py | 35 ++ .../v1/model/heatgrid_preset_color_source.py | 35 ++ .../v1/model/heatgrid_sort.py | 59 +++ .../v1/model/heatgrid_sort_aggregation.py | 44 ++ .../v1/model/heatgrid_sort_by.py | 46 ++ .../v1/model/heatgrid_sort_by_label.py | 52 +++ .../model/heatgrid_sort_by_label_property.py | 35 ++ .../v1/model/heatgrid_sort_by_value.py | 66 +++ .../model/heatgrid_sort_by_value_property.py | 35 ++ .../v1/model/heatgrid_sort_order.py | 38 ++ .../v1/model/heatgrid_widget_definition.py | 172 ++++++++ .../model/heatgrid_widget_definition_type.py | 35 ++ .../v1/model/heatgrid_widget_formula.py | 97 +++++ .../v1/model/heatgrid_widget_request.py | 117 ++++++ .../model/heatgrid_widget_response_format.py | 35 ++ src/datadog_api_client/v1/model/widget.py | 2 + .../v1/model/widget_definition.py | 17 +- src/datadog_api_client/v1/models/__init__.py | 58 +++ .../test-runner-data/manifest.json | 21 + ...eatgrid-widget-with-a-preset-gradient.json | 72 ++++ ...idget-with-custom-discrete-thresholds.json | 79 ++++ ...ustom-gradient-colors-for-both-themes.json | 84 ++++ .../test-server-data/v1/dashboards.json | 319 ++++++++++++++ tests/v1/features/dashboards.feature | 60 +++ 42 files changed, 2976 insertions(+), 6 deletions(-) create mode 100644 examples/v1/dashboards/CreateDashboard_1322784076.py create mode 100644 examples/v1/dashboards/CreateDashboard_1681529203.py create mode 100644 examples/v1/dashboards/CreateDashboard_2574782816.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_color.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_color_bin.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_color_config.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_color_stop.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_custom_color_source.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_discrete_custom_color.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_discrete_mode.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_discrete_preset_color.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_gradient_custom_color.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_gradient_mode.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_gradient_preset_color.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_label_column.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_label_column_width.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_legend.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_nesting_display.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_preset_color_source.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_sort.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_sort_aggregation.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_sort_by.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_sort_by_label.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_sort_by_label_property.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_sort_by_value.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_sort_by_value_property.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_sort_order.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_widget_definition.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_widget_definition_type.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_widget_formula.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_widget_request.py create mode 100644 src/datadog_api_client/v1/model/heatgrid_widget_response_format.py create mode 100644 tests/generated-test/test-runner-data/v1/dashboards/create-a-heatgrid-widget-with-a-preset-gradient.json create mode 100644 tests/generated-test/test-runner-data/v1/dashboards/create-a-heatgrid-widget-with-custom-discrete-thresholds.json create mode 100644 tests/generated-test/test-runner-data/v1/dashboards/create-a-heatgrid-widget-with-custom-gradient-colors-for-both-themes.json diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index fade3e9420..3ec349c633 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -4602,6 +4602,402 @@ components: format: int64 type: integer type: object + HeatgridColor: + description: A color string, or two color strings for the light and dark themes, in that order. + example: "#FF0000" + oneOf: + - type: string + - $ref: "#/components/schemas/HeatgridThemeColors" + HeatgridColorBin: + additionalProperties: false + description: A color and optional lower threshold for a discrete bin. + properties: + color: + $ref: "#/components/schemas/HeatgridColor" + lower_bound: + description: Inclusive lower bound. Omit for the first bin. + format: double + type: number + required: + - color + type: object + HeatgridColorConfig: + description: Color configuration for continuous gradients or discrete thresholds. + oneOf: + - $ref: "#/components/schemas/HeatgridGradientCustomColor" + - $ref: "#/components/schemas/HeatgridGradientPresetColor" + - $ref: "#/components/schemas/HeatgridDiscreteCustomColor" + - $ref: "#/components/schemas/HeatgridDiscretePresetColor" + HeatgridColorStop: + additionalProperties: false + description: A position and color in a continuous gradient. + properties: + color: + $ref: "#/components/schemas/HeatgridColor" + position: + description: Position in the gradient, from 0 to 100. + example: 100 + format: int64 + maximum: 100 + minimum: 0 + type: integer + required: + - position + - color + type: object + HeatgridCustomColorSource: + description: Use custom colors. + enum: + - custom + example: custom + type: string + x-enum-varnames: + - CUSTOM + HeatgridDiscreteCustomColor: + additionalProperties: false + description: Discrete thresholds with custom colors. + properties: + bins: + description: |- + Two to six bins. Omit `lower_bound` on the first bin. Subsequent lower bounds must be in + ascending order. + items: + $ref: "#/components/schemas/HeatgridColorBin" + maxItems: 6 + minItems: 2 + type: array + mode: + $ref: "#/components/schemas/HeatgridDiscreteMode" + source: + $ref: "#/components/schemas/HeatgridCustomColorSource" + required: + - mode + - source + - bins + type: object + HeatgridDiscreteMode: + description: Use discrete color thresholds. + enum: + - discrete + example: discrete + type: string + x-enum-varnames: + - DISCRETE + HeatgridDiscretePresetColor: + additionalProperties: false + description: A preset discrete color palette. + properties: + mode: + $ref: "#/components/schemas/HeatgridDiscreteMode" + preset_name: + description: Name of the preset color palette. + example: "classic" + type: string + source: + $ref: "#/components/schemas/HeatgridPresetColorSource" + required: + - mode + - source + - preset_name + type: object + HeatgridGradientCustomColor: + additionalProperties: false + description: A continuous gradient with custom color stops. + properties: + mode: + $ref: "#/components/schemas/HeatgridGradientMode" + source: + $ref: "#/components/schemas/HeatgridCustomColorSource" + stops: + description: Two to six stops with positions in ascending order. + items: + $ref: "#/components/schemas/HeatgridColorStop" + maxItems: 6 + minItems: 2 + type: array + required: + - mode + - source + - stops + type: object + HeatgridGradientMode: + description: Use a continuous color gradient. + enum: + - gradient + example: gradient + type: string + x-enum-varnames: + - GRADIENT + HeatgridGradientPresetColor: + additionalProperties: false + description: A preset gradient color palette. + properties: + mode: + $ref: "#/components/schemas/HeatgridGradientMode" + preset_name: + description: Name of the preset color palette. + example: "classic" + type: string + source: + $ref: "#/components/schemas/HeatgridPresetColorSource" + required: + - mode + - source + - preset_name + type: object + HeatgridLabelColumn: + additionalProperties: false + description: Configuration of the group label column. + properties: + width: + $ref: "#/components/schemas/HeatgridLabelColumnWidth" + required: + - width + type: object + HeatgridLabelColumnWidth: + description: Width of the label column. + enum: + - xs + - s + - m + - l + - xl + example: xs + type: string + x-enum-varnames: + - XS + - S + - M + - L + - XL + HeatgridLegend: + additionalProperties: false + description: Legend configuration for the heatgrid widget. + properties: + show_caption: + description: Whether to display the legend caption. + type: boolean + type: object + HeatgridNestingDisplay: + description: Display groups as flat rows. + enum: + - flat + example: flat + type: string + x-enum-varnames: + - FLAT + HeatgridPresetColorSource: + description: Use a preset color palette. + enum: + - preset + example: preset + type: string + x-enum-varnames: + - PRESET + HeatgridSort: + additionalProperties: false + description: Ordering of the heatgrid rows. + properties: + nesting_display: + $ref: "#/components/schemas/HeatgridNestingDisplay" + sort_by: + $ref: "#/components/schemas/HeatgridSortBy" + required: + - nesting_display + - sort_by + type: object + HeatgridSortAggregation: + description: Aggregation used to order rows over the displayed time range. + enum: + - avg + - min + - max + - sum + example: avg + type: string + x-enum-varnames: + - AVG + - MIN + - MAX + - SUM + HeatgridSortBy: + description: Sort rows by aggregated value or group label. + oneOf: + - $ref: "#/components/schemas/HeatgridSortByValue" + - $ref: "#/components/schemas/HeatgridSortByLabel" + HeatgridSortByLabel: + additionalProperties: false + description: Sort rows by their group labels. + properties: + order: + $ref: "#/components/schemas/HeatgridSortOrder" + property: + $ref: "#/components/schemas/HeatgridSortByLabelProperty" + required: + - property + - order + type: object + HeatgridSortByLabelProperty: + description: Sort by label. + enum: + - label + example: label + type: string + x-enum-varnames: + - LABEL + HeatgridSortByValue: + additionalProperties: false + description: Sort rows by their aggregated values. + properties: + aggregation: + $ref: "#/components/schemas/HeatgridSortAggregation" + order: + $ref: "#/components/schemas/HeatgridSortOrder" + property: + $ref: "#/components/schemas/HeatgridSortByValueProperty" + required: + - property + - order + - aggregation + type: object + HeatgridSortByValueProperty: + description: Sort by value. + enum: + - value + example: value + type: string + x-enum-varnames: + - VALUE + HeatgridSortOrder: + description: Sort direction. + enum: + - asc + - desc + example: asc + type: string + x-enum-varnames: + - ASC + - DESC + HeatgridThemeColors: + description: Two color strings for the light and dark themes, in that order. + example: ["#FFFFFF", "#000000"] + items: + description: Color for the light or dark theme. + type: string + maxItems: 2 + minItems: 2 + type: array + HeatgridWidgetDefinition: + additionalProperties: false + description: The heatgrid visualization displays values for each group over time using color. + properties: + color: + $ref: "#/components/schemas/HeatgridColorConfig" + custom_links: + description: List of custom links. + items: + $ref: "#/components/schemas/WidgetCustomLink" + type: array + description: + description: Description of the widget. + type: string + label_column: + $ref: "#/components/schemas/HeatgridLabelColumn" + legend: + $ref: "#/components/schemas/HeatgridLegend" + requests: + description: Widget requests. The widget displays one formula, which can combine multiple queries. + items: + $ref: "#/components/schemas/HeatgridWidgetRequest" + minItems: 1 + type: array + sort: + $ref: "#/components/schemas/HeatgridSort" + time: + $ref: "#/components/schemas/WidgetTime" + title: + description: Title of the widget. + type: string + title_align: + $ref: "#/components/schemas/WidgetTextAlign" + title_size: + description: Size of the title. + type: string + type: + $ref: "#/components/schemas/HeatgridWidgetDefinitionType" + required: + - type + - requests + - sort + type: object + HeatgridWidgetDefinitionType: + default: heatgrid + description: Type of the heatgrid widget. + enum: + - heatgrid + example: heatgrid + type: string + x-enum-varnames: + - HEATGRID + HeatgridWidgetFormula: + additionalProperties: false + description: A formula for a heatgrid widget request. + properties: + alias: + description: Expression alias. + type: string + conditional_formats: + description: |- + Conditional formatting rules. These rules do not affect heatgrid rendering. + Use the widget-level `color` configuration to control cell colors. + items: + $ref: "#/components/schemas/WidgetConditionalFormat" + type: array + formula: + description: String expression built from queries, formulas, and functions. + example: "query1" + type: string + limit: + $ref: "#/components/schemas/WidgetFormulaLimit" + number_format: + $ref: "#/components/schemas/WidgetNumberFormat" + style: + $ref: "#/components/schemas/WidgetFormulaStyle" + required: + - formula + type: object + HeatgridWidgetRequest: + additionalProperties: false + description: A request for a heatgrid widget that uses formulas and functions. + properties: + formulas: + description: The single displayed formula can combine multiple queries. + items: + $ref: "#/components/schemas/HeatgridWidgetFormula" + type: array + queries: + description: Queries returned directly or combined in a formula. + example: + - data_source: "metrics" + name: "my_query" + query: "avg:system.cpu.user{*}" + items: + $ref: "#/components/schemas/FormulaAndFunctionQueryDefinition" + type: array + response_format: + $ref: "#/components/schemas/HeatgridWidgetResponseFormat" + required: + - response_format + - queries + type: object + HeatgridWidgetResponseFormat: + description: Response format for heatgrid queries. + enum: + - timeseries + example: timeseries + type: string + x-enum-varnames: + - TIMESERIES Host: description: Object representing a host. properties: @@ -28261,6 +28657,7 @@ components: - $ref: "#/components/schemas/ProductAnalyticsFunnelWidgetDefinition" - $ref: "#/components/schemas/GeomapWidgetDefinition" - $ref: "#/components/schemas/GroupWidgetDefinition" + - $ref: "#/components/schemas/HeatgridWidgetDefinition" - $ref: "#/components/schemas/HeatMapWidgetDefinition" - $ref: "#/components/schemas/HostMapWidgetDefinition" - $ref: "#/components/schemas/IFrameWidgetDefinition" diff --git a/examples/v1/dashboards/CreateDashboard_1322784076.py b/examples/v1/dashboards/CreateDashboard_1322784076.py new file mode 100644 index 0000000000..faaad23536 --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_1322784076.py @@ -0,0 +1,94 @@ +""" +Create a heatgrid widget with custom discrete thresholds +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v1.api.dashboards_api import DashboardsApi +from datadog_api_client.v1.model.dashboard import Dashboard +from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType +from datadog_api_client.v1.model.formula_and_function_metric_data_source import FormulaAndFunctionMetricDataSource +from datadog_api_client.v1.model.formula_and_function_metric_query_definition import ( + FormulaAndFunctionMetricQueryDefinition, +) +from datadog_api_client.v1.model.heatgrid_color_bin import HeatgridColorBin +from datadog_api_client.v1.model.heatgrid_custom_color_source import HeatgridCustomColorSource +from datadog_api_client.v1.model.heatgrid_discrete_custom_color import HeatgridDiscreteCustomColor +from datadog_api_client.v1.model.heatgrid_discrete_mode import HeatgridDiscreteMode +from datadog_api_client.v1.model.heatgrid_label_column import HeatgridLabelColumn +from datadog_api_client.v1.model.heatgrid_label_column_width import HeatgridLabelColumnWidth +from datadog_api_client.v1.model.heatgrid_legend import HeatgridLegend +from datadog_api_client.v1.model.heatgrid_nesting_display import HeatgridNestingDisplay +from datadog_api_client.v1.model.heatgrid_sort import HeatgridSort +from datadog_api_client.v1.model.heatgrid_sort_by_label import HeatgridSortByLabel +from datadog_api_client.v1.model.heatgrid_sort_by_label_property import HeatgridSortByLabelProperty +from datadog_api_client.v1.model.heatgrid_sort_order import HeatgridSortOrder +from datadog_api_client.v1.model.heatgrid_widget_definition import HeatgridWidgetDefinition +from datadog_api_client.v1.model.heatgrid_widget_definition_type import HeatgridWidgetDefinitionType +from datadog_api_client.v1.model.heatgrid_widget_formula import HeatgridWidgetFormula +from datadog_api_client.v1.model.heatgrid_widget_request import HeatgridWidgetRequest +from datadog_api_client.v1.model.heatgrid_widget_response_format import HeatgridWidgetResponseFormat +from datadog_api_client.v1.model.widget import Widget + +body = Dashboard( + title="Example-Dashboard", + layout_type=DashboardLayoutType.ORDERED, + widgets=[ + Widget( + definition=HeatgridWidgetDefinition( + type=HeatgridWidgetDefinitionType.HEATGRID, + requests=[ + HeatgridWidgetRequest( + response_format=HeatgridWidgetResponseFormat.TIMESERIES, + queries=[ + FormulaAndFunctionMetricQueryDefinition( + data_source=FormulaAndFunctionMetricDataSource.METRICS, + name="query1", + query="avg:system.cpu.user{*} by {host}", + ), + ], + formulas=[ + HeatgridWidgetFormula( + formula="query1", + ), + ], + ), + ], + sort=HeatgridSort( + nesting_display=HeatgridNestingDisplay.FLAT, + sort_by=HeatgridSortByLabel( + _property=HeatgridSortByLabelProperty.LABEL, + order=HeatgridSortOrder.ASC, + ), + ), + color=HeatgridDiscreteCustomColor( + mode=HeatgridDiscreteMode.DISCRETE, + source=HeatgridCustomColorSource.CUSTOM, + bins=[ + HeatgridColorBin( + color="#00FF00", + ), + HeatgridColorBin( + color="#FF0000", + lower_bound=80.0, + ), + ], + ), + legend=HeatgridLegend( + show_caption=True, + ), + label_column=HeatgridLabelColumn( + width=HeatgridLabelColumnWidth.M, + ), + ), + ), + ], +) + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +with ApiClient(configuration) as api_client: + api_instance = DashboardsApi(api_client) + response = api_instance.create_dashboard(body=body) + + print(response) diff --git a/examples/v1/dashboards/CreateDashboard_1681529203.py b/examples/v1/dashboards/CreateDashboard_1681529203.py new file mode 100644 index 0000000000..6d4d4b68ae --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_1681529203.py @@ -0,0 +1,97 @@ +""" +Create a heatgrid widget with custom gradient colors for both themes +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v1.api.dashboards_api import DashboardsApi +from datadog_api_client.v1.model.dashboard import Dashboard +from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType +from datadog_api_client.v1.model.formula_and_function_metric_data_source import FormulaAndFunctionMetricDataSource +from datadog_api_client.v1.model.formula_and_function_metric_query_definition import ( + FormulaAndFunctionMetricQueryDefinition, +) +from datadog_api_client.v1.model.heatgrid_color_stop import HeatgridColorStop +from datadog_api_client.v1.model.heatgrid_custom_color_source import HeatgridCustomColorSource +from datadog_api_client.v1.model.heatgrid_gradient_custom_color import HeatgridGradientCustomColor +from datadog_api_client.v1.model.heatgrid_gradient_mode import HeatgridGradientMode +from datadog_api_client.v1.model.heatgrid_label_column import HeatgridLabelColumn +from datadog_api_client.v1.model.heatgrid_label_column_width import HeatgridLabelColumnWidth +from datadog_api_client.v1.model.heatgrid_legend import HeatgridLegend +from datadog_api_client.v1.model.heatgrid_nesting_display import HeatgridNestingDisplay +from datadog_api_client.v1.model.heatgrid_sort import HeatgridSort +from datadog_api_client.v1.model.heatgrid_sort_aggregation import HeatgridSortAggregation +from datadog_api_client.v1.model.heatgrid_sort_by_value import HeatgridSortByValue +from datadog_api_client.v1.model.heatgrid_sort_by_value_property import HeatgridSortByValueProperty +from datadog_api_client.v1.model.heatgrid_sort_order import HeatgridSortOrder +from datadog_api_client.v1.model.heatgrid_widget_definition import HeatgridWidgetDefinition +from datadog_api_client.v1.model.heatgrid_widget_definition_type import HeatgridWidgetDefinitionType +from datadog_api_client.v1.model.heatgrid_widget_formula import HeatgridWidgetFormula +from datadog_api_client.v1.model.heatgrid_widget_request import HeatgridWidgetRequest +from datadog_api_client.v1.model.heatgrid_widget_response_format import HeatgridWidgetResponseFormat +from datadog_api_client.v1.model.widget import Widget + +body = Dashboard( + title="Example-Dashboard", + layout_type=DashboardLayoutType.ORDERED, + widgets=[ + Widget( + definition=HeatgridWidgetDefinition( + type=HeatgridWidgetDefinitionType.HEATGRID, + requests=[ + HeatgridWidgetRequest( + response_format=HeatgridWidgetResponseFormat.TIMESERIES, + queries=[ + FormulaAndFunctionMetricQueryDefinition( + data_source=FormulaAndFunctionMetricDataSource.METRICS, + name="query1", + query="avg:system.cpu.user{*} by {host}", + ), + ], + formulas=[ + HeatgridWidgetFormula( + formula="query1", + ), + ], + ), + ], + sort=HeatgridSort( + nesting_display=HeatgridNestingDisplay.FLAT, + sort_by=HeatgridSortByValue( + _property=HeatgridSortByValueProperty.VALUE, + order=HeatgridSortOrder.DESC, + aggregation=HeatgridSortAggregation.AVG, + ), + ), + color=HeatgridGradientCustomColor( + mode=HeatgridGradientMode.GRADIENT, + source=HeatgridCustomColorSource.CUSTOM, + stops=[ + HeatgridColorStop( + position=0, + color=["#FFFFFF", "#000000"], + ), + HeatgridColorStop( + position=100, + color="#FF0000", + ), + ], + ), + legend=HeatgridLegend( + show_caption=True, + ), + label_column=HeatgridLabelColumn( + width=HeatgridLabelColumnWidth.M, + ), + ), + ), + ], +) + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +with ApiClient(configuration) as api_client: + api_instance = DashboardsApi(api_client) + response = api_instance.create_dashboard(body=body) + + print(response) diff --git a/examples/v1/dashboards/CreateDashboard_2574782816.py b/examples/v1/dashboards/CreateDashboard_2574782816.py new file mode 100644 index 0000000000..313ab737bc --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_2574782816.py @@ -0,0 +1,87 @@ +""" +Create a heatgrid widget with a preset gradient +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v1.api.dashboards_api import DashboardsApi +from datadog_api_client.v1.model.dashboard import Dashboard +from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType +from datadog_api_client.v1.model.formula_and_function_metric_data_source import FormulaAndFunctionMetricDataSource +from datadog_api_client.v1.model.formula_and_function_metric_query_definition import ( + FormulaAndFunctionMetricQueryDefinition, +) +from datadog_api_client.v1.model.heatgrid_gradient_mode import HeatgridGradientMode +from datadog_api_client.v1.model.heatgrid_gradient_preset_color import HeatgridGradientPresetColor +from datadog_api_client.v1.model.heatgrid_label_column import HeatgridLabelColumn +from datadog_api_client.v1.model.heatgrid_label_column_width import HeatgridLabelColumnWidth +from datadog_api_client.v1.model.heatgrid_legend import HeatgridLegend +from datadog_api_client.v1.model.heatgrid_nesting_display import HeatgridNestingDisplay +from datadog_api_client.v1.model.heatgrid_preset_color_source import HeatgridPresetColorSource +from datadog_api_client.v1.model.heatgrid_sort import HeatgridSort +from datadog_api_client.v1.model.heatgrid_sort_aggregation import HeatgridSortAggregation +from datadog_api_client.v1.model.heatgrid_sort_by_value import HeatgridSortByValue +from datadog_api_client.v1.model.heatgrid_sort_by_value_property import HeatgridSortByValueProperty +from datadog_api_client.v1.model.heatgrid_sort_order import HeatgridSortOrder +from datadog_api_client.v1.model.heatgrid_widget_definition import HeatgridWidgetDefinition +from datadog_api_client.v1.model.heatgrid_widget_definition_type import HeatgridWidgetDefinitionType +from datadog_api_client.v1.model.heatgrid_widget_formula import HeatgridWidgetFormula +from datadog_api_client.v1.model.heatgrid_widget_request import HeatgridWidgetRequest +from datadog_api_client.v1.model.heatgrid_widget_response_format import HeatgridWidgetResponseFormat +from datadog_api_client.v1.model.widget import Widget + +body = Dashboard( + title="Example-Dashboard", + layout_type=DashboardLayoutType.ORDERED, + widgets=[ + Widget( + definition=HeatgridWidgetDefinition( + type=HeatgridWidgetDefinitionType.HEATGRID, + requests=[ + HeatgridWidgetRequest( + response_format=HeatgridWidgetResponseFormat.TIMESERIES, + queries=[ + FormulaAndFunctionMetricQueryDefinition( + data_source=FormulaAndFunctionMetricDataSource.METRICS, + name="query1", + query="avg:system.cpu.user{*} by {host}", + ), + ], + formulas=[ + HeatgridWidgetFormula( + formula="query1", + ), + ], + ), + ], + sort=HeatgridSort( + nesting_display=HeatgridNestingDisplay.FLAT, + sort_by=HeatgridSortByValue( + _property=HeatgridSortByValueProperty.VALUE, + order=HeatgridSortOrder.DESC, + aggregation=HeatgridSortAggregation.AVG, + ), + ), + color=HeatgridGradientPresetColor( + mode=HeatgridGradientMode.GRADIENT, + source=HeatgridPresetColorSource.PRESET, + preset_name="classic", + ), + legend=HeatgridLegend( + show_caption=True, + ), + label_column=HeatgridLabelColumn( + width=HeatgridLabelColumnWidth.M, + ), + ), + ), + ], +) + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +with ApiClient(configuration) as api_client: + api_instance = DashboardsApi(api_client) + response = api_instance.create_dashboard(body=body) + + print(response) diff --git a/src/datadog_api_client/v1/model/heatgrid_color.py b/src/datadog_api_client/v1/model/heatgrid_color.py new file mode 100644 index 0000000000..352c646663 --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_color.py @@ -0,0 +1,34 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelComposed, + cached_property, +) + + +class HeatgridColor(ModelComposed): + def __init__(self, **kwargs): + """ + A color string, or two color strings for the light and dark themes, in that order. + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + return { + "oneOf": [ + str, + [str], + ], + } diff --git a/src/datadog_api_client/v1/model/heatgrid_color_bin.py b/src/datadog_api_client/v1/model/heatgrid_color_bin.py new file mode 100644 index 0000000000..c5a5cbe8a1 --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_color_bin.py @@ -0,0 +1,55 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.heatgrid_color import HeatgridColor + + +class HeatgridColorBin(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.heatgrid_color import HeatgridColor + + return { + "color": (HeatgridColor,), + "lower_bound": (float,), + } + + attribute_map = { + "color": "color", + "lower_bound": "lower_bound", + } + + def __init__( + self_, color: Union[HeatgridColor, str, List[str]], lower_bound: Union[float, UnsetType] = unset, **kwargs + ): + """ + A color and optional lower threshold for a discrete bin. + + :param color: A color string, or two color strings for the light and dark themes, in that order. + :type color: HeatgridColor + + :param lower_bound: Inclusive lower bound. Omit for the first bin. + :type lower_bound: float, optional + """ + if lower_bound is not unset: + kwargs["lower_bound"] = lower_bound + super().__init__(kwargs) + + self_.color = color diff --git a/src/datadog_api_client/v1/model/heatgrid_color_config.py b/src/datadog_api_client/v1/model/heatgrid_color_config.py new file mode 100644 index 0000000000..88d0d43d0e --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_color_config.py @@ -0,0 +1,57 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelComposed, + cached_property, +) + + +class HeatgridColorConfig(ModelComposed): + def __init__(self, **kwargs): + """ + Color configuration for continuous gradients or discrete thresholds. + + :param mode: Use a continuous color gradient. + :type mode: HeatgridGradientMode + + :param source: Use custom colors. + :type source: HeatgridCustomColorSource + + :param stops: Two to six stops with positions in ascending order. + :type stops: [HeatgridColorStop] + + :param preset_name: Name of the preset color palette. + :type preset_name: str + + :param bins: Two to six bins. Omit `lower_bound` on the first bin. Subsequent lower bounds must be in + ascending order. + :type bins: [HeatgridColorBin] + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v1.model.heatgrid_gradient_custom_color import HeatgridGradientCustomColor + from datadog_api_client.v1.model.heatgrid_gradient_preset_color import HeatgridGradientPresetColor + from datadog_api_client.v1.model.heatgrid_discrete_custom_color import HeatgridDiscreteCustomColor + from datadog_api_client.v1.model.heatgrid_discrete_preset_color import HeatgridDiscretePresetColor + + return { + "oneOf": [ + HeatgridGradientCustomColor, + HeatgridGradientPresetColor, + HeatgridDiscreteCustomColor, + HeatgridDiscretePresetColor, + ], + } diff --git a/src/datadog_api_client/v1/model/heatgrid_color_stop.py b/src/datadog_api_client/v1/model/heatgrid_color_stop.py new file mode 100644 index 0000000000..30e9c565ee --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_color_stop.py @@ -0,0 +1,57 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.heatgrid_color import HeatgridColor + + +class HeatgridColorStop(ModelNormal): + validations = { + "position": { + "inclusive_maximum": 100, + "inclusive_minimum": 0, + }, + } + + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.heatgrid_color import HeatgridColor + + return { + "color": (HeatgridColor,), + "position": (int,), + } + + attribute_map = { + "color": "color", + "position": "position", + } + + def __init__(self_, color: Union[HeatgridColor, str, List[str]], position: int, **kwargs): + """ + A position and color in a continuous gradient. + + :param color: A color string, or two color strings for the light and dark themes, in that order. + :type color: HeatgridColor + + :param position: Position in the gradient, from 0 to 100. + :type position: int + """ + super().__init__(kwargs) + + self_.color = color + self_.position = position diff --git a/src/datadog_api_client/v1/model/heatgrid_custom_color_source.py b/src/datadog_api_client/v1/model/heatgrid_custom_color_source.py new file mode 100644 index 0000000000..c870b3462d --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_custom_color_source.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class HeatgridCustomColorSource(ModelSimple): + """ + Use custom colors. + + :param value: If omitted defaults to "custom". Must be one of ["custom"]. + :type value: str + """ + + allowed_values = { + "custom", + } + CUSTOM: ClassVar["HeatgridCustomColorSource"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +HeatgridCustomColorSource.CUSTOM = HeatgridCustomColorSource("custom") diff --git a/src/datadog_api_client/v1/model/heatgrid_discrete_custom_color.py b/src/datadog_api_client/v1/model/heatgrid_discrete_custom_color.py new file mode 100644 index 0000000000..abd3cc23c0 --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_discrete_custom_color.py @@ -0,0 +1,70 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.heatgrid_color_bin import HeatgridColorBin + from datadog_api_client.v1.model.heatgrid_discrete_mode import HeatgridDiscreteMode + from datadog_api_client.v1.model.heatgrid_custom_color_source import HeatgridCustomColorSource + + +class HeatgridDiscreteCustomColor(ModelNormal): + validations = { + "bins": { + "max_items": 6, + "min_items": 2, + }, + } + + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.heatgrid_color_bin import HeatgridColorBin + from datadog_api_client.v1.model.heatgrid_discrete_mode import HeatgridDiscreteMode + from datadog_api_client.v1.model.heatgrid_custom_color_source import HeatgridCustomColorSource + + return { + "bins": ([HeatgridColorBin],), + "mode": (HeatgridDiscreteMode,), + "source": (HeatgridCustomColorSource,), + } + + attribute_map = { + "bins": "bins", + "mode": "mode", + "source": "source", + } + + def __init__( + self_, bins: List[HeatgridColorBin], mode: HeatgridDiscreteMode, source: HeatgridCustomColorSource, **kwargs + ): + """ + Discrete thresholds with custom colors. + + :param bins: Two to six bins. Omit ``lower_bound`` on the first bin. Subsequent lower bounds must be in + ascending order. + :type bins: [HeatgridColorBin] + + :param mode: Use discrete color thresholds. + :type mode: HeatgridDiscreteMode + + :param source: Use custom colors. + :type source: HeatgridCustomColorSource + """ + super().__init__(kwargs) + + self_.bins = bins + self_.mode = mode + self_.source = source diff --git a/src/datadog_api_client/v1/model/heatgrid_discrete_mode.py b/src/datadog_api_client/v1/model/heatgrid_discrete_mode.py new file mode 100644 index 0000000000..6f49d46827 --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_discrete_mode.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class HeatgridDiscreteMode(ModelSimple): + """ + Use discrete color thresholds. + + :param value: If omitted defaults to "discrete". Must be one of ["discrete"]. + :type value: str + """ + + allowed_values = { + "discrete", + } + DISCRETE: ClassVar["HeatgridDiscreteMode"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +HeatgridDiscreteMode.DISCRETE = HeatgridDiscreteMode("discrete") diff --git a/src/datadog_api_client/v1/model/heatgrid_discrete_preset_color.py b/src/datadog_api_client/v1/model/heatgrid_discrete_preset_color.py new file mode 100644 index 0000000000..ca943cd2d3 --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_discrete_preset_color.py @@ -0,0 +1,58 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.heatgrid_discrete_mode import HeatgridDiscreteMode + from datadog_api_client.v1.model.heatgrid_preset_color_source import HeatgridPresetColorSource + + +class HeatgridDiscretePresetColor(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.heatgrid_discrete_mode import HeatgridDiscreteMode + from datadog_api_client.v1.model.heatgrid_preset_color_source import HeatgridPresetColorSource + + return { + "mode": (HeatgridDiscreteMode,), + "preset_name": (str,), + "source": (HeatgridPresetColorSource,), + } + + attribute_map = { + "mode": "mode", + "preset_name": "preset_name", + "source": "source", + } + + def __init__(self_, mode: HeatgridDiscreteMode, preset_name: str, source: HeatgridPresetColorSource, **kwargs): + """ + A preset discrete color palette. + + :param mode: Use discrete color thresholds. + :type mode: HeatgridDiscreteMode + + :param preset_name: Name of the preset color palette. + :type preset_name: str + + :param source: Use a preset color palette. + :type source: HeatgridPresetColorSource + """ + super().__init__(kwargs) + + self_.mode = mode + self_.preset_name = preset_name + self_.source = source diff --git a/src/datadog_api_client/v1/model/heatgrid_gradient_custom_color.py b/src/datadog_api_client/v1/model/heatgrid_gradient_custom_color.py new file mode 100644 index 0000000000..cb459833ae --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_gradient_custom_color.py @@ -0,0 +1,69 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.heatgrid_gradient_mode import HeatgridGradientMode + from datadog_api_client.v1.model.heatgrid_custom_color_source import HeatgridCustomColorSource + from datadog_api_client.v1.model.heatgrid_color_stop import HeatgridColorStop + + +class HeatgridGradientCustomColor(ModelNormal): + validations = { + "stops": { + "max_items": 6, + "min_items": 2, + }, + } + + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.heatgrid_gradient_mode import HeatgridGradientMode + from datadog_api_client.v1.model.heatgrid_custom_color_source import HeatgridCustomColorSource + from datadog_api_client.v1.model.heatgrid_color_stop import HeatgridColorStop + + return { + "mode": (HeatgridGradientMode,), + "source": (HeatgridCustomColorSource,), + "stops": ([HeatgridColorStop],), + } + + attribute_map = { + "mode": "mode", + "source": "source", + "stops": "stops", + } + + def __init__( + self_, mode: HeatgridGradientMode, source: HeatgridCustomColorSource, stops: List[HeatgridColorStop], **kwargs + ): + """ + A continuous gradient with custom color stops. + + :param mode: Use a continuous color gradient. + :type mode: HeatgridGradientMode + + :param source: Use custom colors. + :type source: HeatgridCustomColorSource + + :param stops: Two to six stops with positions in ascending order. + :type stops: [HeatgridColorStop] + """ + super().__init__(kwargs) + + self_.mode = mode + self_.source = source + self_.stops = stops diff --git a/src/datadog_api_client/v1/model/heatgrid_gradient_mode.py b/src/datadog_api_client/v1/model/heatgrid_gradient_mode.py new file mode 100644 index 0000000000..58fe2d4f2a --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_gradient_mode.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class HeatgridGradientMode(ModelSimple): + """ + Use a continuous color gradient. + + :param value: If omitted defaults to "gradient". Must be one of ["gradient"]. + :type value: str + """ + + allowed_values = { + "gradient", + } + GRADIENT: ClassVar["HeatgridGradientMode"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +HeatgridGradientMode.GRADIENT = HeatgridGradientMode("gradient") diff --git a/src/datadog_api_client/v1/model/heatgrid_gradient_preset_color.py b/src/datadog_api_client/v1/model/heatgrid_gradient_preset_color.py new file mode 100644 index 0000000000..69fe6be109 --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_gradient_preset_color.py @@ -0,0 +1,58 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.heatgrid_gradient_mode import HeatgridGradientMode + from datadog_api_client.v1.model.heatgrid_preset_color_source import HeatgridPresetColorSource + + +class HeatgridGradientPresetColor(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.heatgrid_gradient_mode import HeatgridGradientMode + from datadog_api_client.v1.model.heatgrid_preset_color_source import HeatgridPresetColorSource + + return { + "mode": (HeatgridGradientMode,), + "preset_name": (str,), + "source": (HeatgridPresetColorSource,), + } + + attribute_map = { + "mode": "mode", + "preset_name": "preset_name", + "source": "source", + } + + def __init__(self_, mode: HeatgridGradientMode, preset_name: str, source: HeatgridPresetColorSource, **kwargs): + """ + A preset gradient color palette. + + :param mode: Use a continuous color gradient. + :type mode: HeatgridGradientMode + + :param preset_name: Name of the preset color palette. + :type preset_name: str + + :param source: Use a preset color palette. + :type source: HeatgridPresetColorSource + """ + super().__init__(kwargs) + + self_.mode = mode + self_.preset_name = preset_name + self_.source = source diff --git a/src/datadog_api_client/v1/model/heatgrid_label_column.py b/src/datadog_api_client/v1/model/heatgrid_label_column.py new file mode 100644 index 0000000000..ff472a3f65 --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_label_column.py @@ -0,0 +1,44 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.heatgrid_label_column_width import HeatgridLabelColumnWidth + + +class HeatgridLabelColumn(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.heatgrid_label_column_width import HeatgridLabelColumnWidth + + return { + "width": (HeatgridLabelColumnWidth,), + } + + attribute_map = { + "width": "width", + } + + def __init__(self_, width: HeatgridLabelColumnWidth, **kwargs): + """ + Configuration of the group label column. + + :param width: Width of the label column. + :type width: HeatgridLabelColumnWidth + """ + super().__init__(kwargs) + + self_.width = width diff --git a/src/datadog_api_client/v1/model/heatgrid_label_column_width.py b/src/datadog_api_client/v1/model/heatgrid_label_column_width.py new file mode 100644 index 0000000000..17013a9d05 --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_label_column_width.py @@ -0,0 +1,47 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class HeatgridLabelColumnWidth(ModelSimple): + """ + Width of the label column. + + :param value: Must be one of ["xs", "s", "m", "l", "xl"]. + :type value: str + """ + + allowed_values = { + "xs", + "s", + "m", + "l", + "xl", + } + XS: ClassVar["HeatgridLabelColumnWidth"] + S: ClassVar["HeatgridLabelColumnWidth"] + M: ClassVar["HeatgridLabelColumnWidth"] + L: ClassVar["HeatgridLabelColumnWidth"] + XL: ClassVar["HeatgridLabelColumnWidth"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +HeatgridLabelColumnWidth.XS = HeatgridLabelColumnWidth("xs") +HeatgridLabelColumnWidth.S = HeatgridLabelColumnWidth("s") +HeatgridLabelColumnWidth.M = HeatgridLabelColumnWidth("m") +HeatgridLabelColumnWidth.L = HeatgridLabelColumnWidth("l") +HeatgridLabelColumnWidth.XL = HeatgridLabelColumnWidth("xl") diff --git a/src/datadog_api_client/v1/model/heatgrid_legend.py b/src/datadog_api_client/v1/model/heatgrid_legend.py new file mode 100644 index 0000000000..810cf8b13a --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_legend.py @@ -0,0 +1,40 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class HeatgridLegend(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + return { + "show_caption": (bool,), + } + + attribute_map = { + "show_caption": "show_caption", + } + + def __init__(self_, show_caption: Union[bool, UnsetType] = unset, **kwargs): + """ + Legend configuration for the heatgrid widget. + + :param show_caption: Whether to display the legend caption. + :type show_caption: bool, optional + """ + if show_caption is not unset: + kwargs["show_caption"] = show_caption + super().__init__(kwargs) diff --git a/src/datadog_api_client/v1/model/heatgrid_nesting_display.py b/src/datadog_api_client/v1/model/heatgrid_nesting_display.py new file mode 100644 index 0000000000..da4289d1fb --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_nesting_display.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class HeatgridNestingDisplay(ModelSimple): + """ + Display groups as flat rows. + + :param value: If omitted defaults to "flat". Must be one of ["flat"]. + :type value: str + """ + + allowed_values = { + "flat", + } + FLAT: ClassVar["HeatgridNestingDisplay"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +HeatgridNestingDisplay.FLAT = HeatgridNestingDisplay("flat") diff --git a/src/datadog_api_client/v1/model/heatgrid_preset_color_source.py b/src/datadog_api_client/v1/model/heatgrid_preset_color_source.py new file mode 100644 index 0000000000..fea82318b9 --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_preset_color_source.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class HeatgridPresetColorSource(ModelSimple): + """ + Use a preset color palette. + + :param value: If omitted defaults to "preset". Must be one of ["preset"]. + :type value: str + """ + + allowed_values = { + "preset", + } + PRESET: ClassVar["HeatgridPresetColorSource"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +HeatgridPresetColorSource.PRESET = HeatgridPresetColorSource("preset") diff --git a/src/datadog_api_client/v1/model/heatgrid_sort.py b/src/datadog_api_client/v1/model/heatgrid_sort.py new file mode 100644 index 0000000000..d54c05ad0a --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_sort.py @@ -0,0 +1,59 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.heatgrid_nesting_display import HeatgridNestingDisplay + from datadog_api_client.v1.model.heatgrid_sort_by import HeatgridSortBy + from datadog_api_client.v1.model.heatgrid_sort_by_value import HeatgridSortByValue + from datadog_api_client.v1.model.heatgrid_sort_by_label import HeatgridSortByLabel + + +class HeatgridSort(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.heatgrid_nesting_display import HeatgridNestingDisplay + from datadog_api_client.v1.model.heatgrid_sort_by import HeatgridSortBy + + return { + "nesting_display": (HeatgridNestingDisplay,), + "sort_by": (HeatgridSortBy,), + } + + attribute_map = { + "nesting_display": "nesting_display", + "sort_by": "sort_by", + } + + def __init__( + self_, + nesting_display: HeatgridNestingDisplay, + sort_by: Union[HeatgridSortBy, HeatgridSortByValue, HeatgridSortByLabel], + **kwargs, + ): + """ + Ordering of the heatgrid rows. + + :param nesting_display: Display groups as flat rows. + :type nesting_display: HeatgridNestingDisplay + + :param sort_by: Sort rows by aggregated value or group label. + :type sort_by: HeatgridSortBy + """ + super().__init__(kwargs) + + self_.nesting_display = nesting_display + self_.sort_by = sort_by diff --git a/src/datadog_api_client/v1/model/heatgrid_sort_aggregation.py b/src/datadog_api_client/v1/model/heatgrid_sort_aggregation.py new file mode 100644 index 0000000000..8c2d064490 --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_sort_aggregation.py @@ -0,0 +1,44 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class HeatgridSortAggregation(ModelSimple): + """ + Aggregation used to order rows over the displayed time range. + + :param value: Must be one of ["avg", "min", "max", "sum"]. + :type value: str + """ + + allowed_values = { + "avg", + "min", + "max", + "sum", + } + AVG: ClassVar["HeatgridSortAggregation"] + MIN: ClassVar["HeatgridSortAggregation"] + MAX: ClassVar["HeatgridSortAggregation"] + SUM: ClassVar["HeatgridSortAggregation"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +HeatgridSortAggregation.AVG = HeatgridSortAggregation("avg") +HeatgridSortAggregation.MIN = HeatgridSortAggregation("min") +HeatgridSortAggregation.MAX = HeatgridSortAggregation("max") +HeatgridSortAggregation.SUM = HeatgridSortAggregation("sum") diff --git a/src/datadog_api_client/v1/model/heatgrid_sort_by.py b/src/datadog_api_client/v1/model/heatgrid_sort_by.py new file mode 100644 index 0000000000..0e9458d7c5 --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_sort_by.py @@ -0,0 +1,46 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelComposed, + cached_property, +) + + +class HeatgridSortBy(ModelComposed): + def __init__(self, **kwargs): + """ + Sort rows by aggregated value or group label. + + :param aggregation: Aggregation used to order rows over the displayed time range. + :type aggregation: HeatgridSortAggregation + + :param order: Sort direction. + :type order: HeatgridSortOrder + + :param _property: Sort by value. + :type _property: HeatgridSortByValueProperty + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v1.model.heatgrid_sort_by_value import HeatgridSortByValue + from datadog_api_client.v1.model.heatgrid_sort_by_label import HeatgridSortByLabel + + return { + "oneOf": [ + HeatgridSortByValue, + HeatgridSortByLabel, + ], + } diff --git a/src/datadog_api_client/v1/model/heatgrid_sort_by_label.py b/src/datadog_api_client/v1/model/heatgrid_sort_by_label.py new file mode 100644 index 0000000000..c14544e10b --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_sort_by_label.py @@ -0,0 +1,52 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.heatgrid_sort_order import HeatgridSortOrder + from datadog_api_client.v1.model.heatgrid_sort_by_label_property import HeatgridSortByLabelProperty + + +class HeatgridSortByLabel(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.heatgrid_sort_order import HeatgridSortOrder + from datadog_api_client.v1.model.heatgrid_sort_by_label_property import HeatgridSortByLabelProperty + + return { + "order": (HeatgridSortOrder,), + "_property": (HeatgridSortByLabelProperty,), + } + + attribute_map = { + "order": "order", + "_property": "property", + } + + def __init__(self_, order: HeatgridSortOrder, _property: HeatgridSortByLabelProperty, **kwargs): + """ + Sort rows by their group labels. + + :param order: Sort direction. + :type order: HeatgridSortOrder + + :param _property: Sort by label. + :type _property: HeatgridSortByLabelProperty + """ + super().__init__(kwargs) + + self_.order = order + self_._property = _property diff --git a/src/datadog_api_client/v1/model/heatgrid_sort_by_label_property.py b/src/datadog_api_client/v1/model/heatgrid_sort_by_label_property.py new file mode 100644 index 0000000000..b09aaa95be --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_sort_by_label_property.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class HeatgridSortByLabelProperty(ModelSimple): + """ + Sort by label. + + :param value: If omitted defaults to "label". Must be one of ["label"]. + :type value: str + """ + + allowed_values = { + "label", + } + LABEL: ClassVar["HeatgridSortByLabelProperty"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +HeatgridSortByLabelProperty.LABEL = HeatgridSortByLabelProperty("label") diff --git a/src/datadog_api_client/v1/model/heatgrid_sort_by_value.py b/src/datadog_api_client/v1/model/heatgrid_sort_by_value.py new file mode 100644 index 0000000000..2d1d317d8c --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_sort_by_value.py @@ -0,0 +1,66 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.heatgrid_sort_aggregation import HeatgridSortAggregation + from datadog_api_client.v1.model.heatgrid_sort_order import HeatgridSortOrder + from datadog_api_client.v1.model.heatgrid_sort_by_value_property import HeatgridSortByValueProperty + + +class HeatgridSortByValue(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.heatgrid_sort_aggregation import HeatgridSortAggregation + from datadog_api_client.v1.model.heatgrid_sort_order import HeatgridSortOrder + from datadog_api_client.v1.model.heatgrid_sort_by_value_property import HeatgridSortByValueProperty + + return { + "aggregation": (HeatgridSortAggregation,), + "order": (HeatgridSortOrder,), + "_property": (HeatgridSortByValueProperty,), + } + + attribute_map = { + "aggregation": "aggregation", + "order": "order", + "_property": "property", + } + + def __init__( + self_, + aggregation: HeatgridSortAggregation, + order: HeatgridSortOrder, + _property: HeatgridSortByValueProperty, + **kwargs, + ): + """ + Sort rows by their aggregated values. + + :param aggregation: Aggregation used to order rows over the displayed time range. + :type aggregation: HeatgridSortAggregation + + :param order: Sort direction. + :type order: HeatgridSortOrder + + :param _property: Sort by value. + :type _property: HeatgridSortByValueProperty + """ + super().__init__(kwargs) + + self_.aggregation = aggregation + self_.order = order + self_._property = _property diff --git a/src/datadog_api_client/v1/model/heatgrid_sort_by_value_property.py b/src/datadog_api_client/v1/model/heatgrid_sort_by_value_property.py new file mode 100644 index 0000000000..570f083874 --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_sort_by_value_property.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class HeatgridSortByValueProperty(ModelSimple): + """ + Sort by value. + + :param value: If omitted defaults to "value". Must be one of ["value"]. + :type value: str + """ + + allowed_values = { + "value", + } + VALUE: ClassVar["HeatgridSortByValueProperty"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +HeatgridSortByValueProperty.VALUE = HeatgridSortByValueProperty("value") diff --git a/src/datadog_api_client/v1/model/heatgrid_sort_order.py b/src/datadog_api_client/v1/model/heatgrid_sort_order.py new file mode 100644 index 0000000000..9f274d7b52 --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_sort_order.py @@ -0,0 +1,38 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class HeatgridSortOrder(ModelSimple): + """ + Sort direction. + + :param value: Must be one of ["asc", "desc"]. + :type value: str + """ + + allowed_values = { + "asc", + "desc", + } + ASC: ClassVar["HeatgridSortOrder"] + DESC: ClassVar["HeatgridSortOrder"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +HeatgridSortOrder.ASC = HeatgridSortOrder("asc") +HeatgridSortOrder.DESC = HeatgridSortOrder("desc") diff --git a/src/datadog_api_client/v1/model/heatgrid_widget_definition.py b/src/datadog_api_client/v1/model/heatgrid_widget_definition.py new file mode 100644 index 0000000000..4786bdbef2 --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_widget_definition.py @@ -0,0 +1,172 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.heatgrid_color_config import HeatgridColorConfig + from datadog_api_client.v1.model.widget_custom_link import WidgetCustomLink + from datadog_api_client.v1.model.heatgrid_label_column import HeatgridLabelColumn + from datadog_api_client.v1.model.heatgrid_legend import HeatgridLegend + from datadog_api_client.v1.model.heatgrid_widget_request import HeatgridWidgetRequest + from datadog_api_client.v1.model.heatgrid_sort import HeatgridSort + from datadog_api_client.v1.model.widget_time import WidgetTime + from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign + from datadog_api_client.v1.model.heatgrid_widget_definition_type import HeatgridWidgetDefinitionType + from datadog_api_client.v1.model.heatgrid_gradient_custom_color import HeatgridGradientCustomColor + from datadog_api_client.v1.model.heatgrid_gradient_preset_color import HeatgridGradientPresetColor + from datadog_api_client.v1.model.heatgrid_discrete_custom_color import HeatgridDiscreteCustomColor + from datadog_api_client.v1.model.heatgrid_discrete_preset_color import HeatgridDiscretePresetColor + from datadog_api_client.v1.model.widget_legacy_live_span import WidgetLegacyLiveSpan + from datadog_api_client.v1.model.widget_new_live_span import WidgetNewLiveSpan + from datadog_api_client.v1.model.widget_new_fixed_span import WidgetNewFixedSpan + + +class HeatgridWidgetDefinition(ModelNormal): + validations = { + "requests": { + "min_items": 1, + }, + } + + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.heatgrid_color_config import HeatgridColorConfig + from datadog_api_client.v1.model.widget_custom_link import WidgetCustomLink + from datadog_api_client.v1.model.heatgrid_label_column import HeatgridLabelColumn + from datadog_api_client.v1.model.heatgrid_legend import HeatgridLegend + from datadog_api_client.v1.model.heatgrid_widget_request import HeatgridWidgetRequest + from datadog_api_client.v1.model.heatgrid_sort import HeatgridSort + from datadog_api_client.v1.model.widget_time import WidgetTime + from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign + from datadog_api_client.v1.model.heatgrid_widget_definition_type import HeatgridWidgetDefinitionType + + return { + "color": (HeatgridColorConfig,), + "custom_links": ([WidgetCustomLink],), + "description": (str,), + "label_column": (HeatgridLabelColumn,), + "legend": (HeatgridLegend,), + "requests": ([HeatgridWidgetRequest],), + "sort": (HeatgridSort,), + "time": (WidgetTime,), + "title": (str,), + "title_align": (WidgetTextAlign,), + "title_size": (str,), + "type": (HeatgridWidgetDefinitionType,), + } + + attribute_map = { + "color": "color", + "custom_links": "custom_links", + "description": "description", + "label_column": "label_column", + "legend": "legend", + "requests": "requests", + "sort": "sort", + "time": "time", + "title": "title", + "title_align": "title_align", + "title_size": "title_size", + "type": "type", + } + + def __init__( + self_, + requests: List[HeatgridWidgetRequest], + sort: HeatgridSort, + type: HeatgridWidgetDefinitionType, + color: Union[ + HeatgridColorConfig, + HeatgridGradientCustomColor, + HeatgridGradientPresetColor, + HeatgridDiscreteCustomColor, + HeatgridDiscretePresetColor, + UnsetType, + ] = unset, + custom_links: Union[List[WidgetCustomLink], UnsetType] = unset, + description: Union[str, UnsetType] = unset, + label_column: Union[HeatgridLabelColumn, UnsetType] = unset, + legend: Union[HeatgridLegend, UnsetType] = unset, + time: Union[WidgetTime, WidgetLegacyLiveSpan, WidgetNewLiveSpan, WidgetNewFixedSpan, UnsetType] = unset, + title: Union[str, UnsetType] = unset, + title_align: Union[WidgetTextAlign, UnsetType] = unset, + title_size: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + The heatgrid visualization displays values for each group over time using color. + + :param color: Color configuration for continuous gradients or discrete thresholds. + :type color: HeatgridColorConfig, optional + + :param custom_links: List of custom links. + :type custom_links: [WidgetCustomLink], optional + + :param description: Description of the widget. + :type description: str, optional + + :param label_column: Configuration of the group label column. + :type label_column: HeatgridLabelColumn, optional + + :param legend: Legend configuration for the heatgrid widget. + :type legend: HeatgridLegend, optional + + :param requests: Widget requests. The widget displays one formula, which can combine multiple queries. + :type requests: [HeatgridWidgetRequest] + + :param sort: Ordering of the heatgrid rows. + :type sort: HeatgridSort + + :param time: Time setting for the widget. + :type time: WidgetTime, optional + + :param title: Title of the widget. + :type title: str, optional + + :param title_align: How to align the text on the widget. + :type title_align: WidgetTextAlign, optional + + :param title_size: Size of the title. + :type title_size: str, optional + + :param type: Type of the heatgrid widget. + :type type: HeatgridWidgetDefinitionType + """ + if color is not unset: + kwargs["color"] = color + if custom_links is not unset: + kwargs["custom_links"] = custom_links + if description is not unset: + kwargs["description"] = description + if label_column is not unset: + kwargs["label_column"] = label_column + if legend is not unset: + kwargs["legend"] = legend + if time is not unset: + kwargs["time"] = time + if title is not unset: + kwargs["title"] = title + if title_align is not unset: + kwargs["title_align"] = title_align + if title_size is not unset: + kwargs["title_size"] = title_size + super().__init__(kwargs) + + self_.requests = requests + self_.sort = sort + self_.type = type diff --git a/src/datadog_api_client/v1/model/heatgrid_widget_definition_type.py b/src/datadog_api_client/v1/model/heatgrid_widget_definition_type.py new file mode 100644 index 0000000000..43cb0c0daa --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_widget_definition_type.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class HeatgridWidgetDefinitionType(ModelSimple): + """ + Type of the heatgrid widget. + + :param value: If omitted defaults to "heatgrid". Must be one of ["heatgrid"]. + :type value: str + """ + + allowed_values = { + "heatgrid", + } + HEATGRID: ClassVar["HeatgridWidgetDefinitionType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +HeatgridWidgetDefinitionType.HEATGRID = HeatgridWidgetDefinitionType("heatgrid") diff --git a/src/datadog_api_client/v1/model/heatgrid_widget_formula.py b/src/datadog_api_client/v1/model/heatgrid_widget_formula.py new file mode 100644 index 0000000000..bbc2c09505 --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_widget_formula.py @@ -0,0 +1,97 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.widget_conditional_format import WidgetConditionalFormat + from datadog_api_client.v1.model.widget_formula_limit import WidgetFormulaLimit + from datadog_api_client.v1.model.widget_number_format import WidgetNumberFormat + from datadog_api_client.v1.model.widget_formula_style import WidgetFormulaStyle + + +class HeatgridWidgetFormula(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.widget_conditional_format import WidgetConditionalFormat + from datadog_api_client.v1.model.widget_formula_limit import WidgetFormulaLimit + from datadog_api_client.v1.model.widget_number_format import WidgetNumberFormat + from datadog_api_client.v1.model.widget_formula_style import WidgetFormulaStyle + + return { + "alias": (str,), + "conditional_formats": ([WidgetConditionalFormat],), + "formula": (str,), + "limit": (WidgetFormulaLimit,), + "number_format": (WidgetNumberFormat,), + "style": (WidgetFormulaStyle,), + } + + attribute_map = { + "alias": "alias", + "conditional_formats": "conditional_formats", + "formula": "formula", + "limit": "limit", + "number_format": "number_format", + "style": "style", + } + + def __init__( + self_, + formula: str, + alias: Union[str, UnsetType] = unset, + conditional_formats: Union[List[WidgetConditionalFormat], UnsetType] = unset, + limit: Union[WidgetFormulaLimit, UnsetType] = unset, + number_format: Union[WidgetNumberFormat, UnsetType] = unset, + style: Union[WidgetFormulaStyle, UnsetType] = unset, + **kwargs, + ): + """ + A formula for a heatgrid widget request. + + :param alias: Expression alias. + :type alias: str, optional + + :param conditional_formats: Conditional formatting rules. These rules do not affect heatgrid rendering. + Use the widget-level ``color`` configuration to control cell colors. + :type conditional_formats: [WidgetConditionalFormat], optional + + :param formula: String expression built from queries, formulas, and functions. + :type formula: str + + :param limit: Options for limiting results returned. + :type limit: WidgetFormulaLimit, optional + + :param number_format: Number format options for the widget. + :type number_format: WidgetNumberFormat, optional + + :param style: Styling options for widget formulas. + :type style: WidgetFormulaStyle, optional + """ + if alias is not unset: + kwargs["alias"] = alias + if conditional_formats is not unset: + kwargs["conditional_formats"] = conditional_formats + if limit is not unset: + kwargs["limit"] = limit + if number_format is not unset: + kwargs["number_format"] = number_format + if style is not unset: + kwargs["style"] = style + super().__init__(kwargs) + + self_.formula = formula diff --git a/src/datadog_api_client/v1/model/heatgrid_widget_request.py b/src/datadog_api_client/v1/model/heatgrid_widget_request.py new file mode 100644 index 0000000000..658dd5eabd --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_widget_request.py @@ -0,0 +1,117 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.heatgrid_widget_formula import HeatgridWidgetFormula + from datadog_api_client.v1.model.formula_and_function_query_definition import FormulaAndFunctionQueryDefinition + from datadog_api_client.v1.model.heatgrid_widget_response_format import HeatgridWidgetResponseFormat + from datadog_api_client.v1.model.formula_and_function_metric_query_definition import ( + FormulaAndFunctionMetricQueryDefinition, + ) + from datadog_api_client.v1.model.formula_and_function_event_query_definition import ( + FormulaAndFunctionEventQueryDefinition, + ) + from datadog_api_client.v1.model.formula_and_function_process_query_definition import ( + FormulaAndFunctionProcessQueryDefinition, + ) + from datadog_api_client.v1.model.formula_and_function_apm_dependency_stats_query_definition import ( + FormulaAndFunctionApmDependencyStatsQueryDefinition, + ) + from datadog_api_client.v1.model.formula_and_function_apm_resource_stats_query_definition import ( + FormulaAndFunctionApmResourceStatsQueryDefinition, + ) + from datadog_api_client.v1.model.formula_and_function_apm_metrics_query_definition import ( + FormulaAndFunctionApmMetricsQueryDefinition, + ) + from datadog_api_client.v1.model.formula_and_function_slo_query_definition import ( + FormulaAndFunctionSLOQueryDefinition, + ) + from datadog_api_client.v1.model.formula_and_function_cloud_cost_query_definition import ( + FormulaAndFunctionCloudCostQueryDefinition, + ) + from datadog_api_client.v1.model.formula_and_function_product_analytics_extended_query_definition import ( + FormulaAndFunctionProductAnalyticsExtendedQueryDefinition, + ) + from datadog_api_client.v1.model.formula_and_function_user_journey_query_definition import ( + FormulaAndFunctionUserJourneyQueryDefinition, + ) + from datadog_api_client.v1.model.formula_and_function_retention_query_definition import ( + FormulaAndFunctionRetentionQueryDefinition, + ) + + +class HeatgridWidgetRequest(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.heatgrid_widget_formula import HeatgridWidgetFormula + from datadog_api_client.v1.model.formula_and_function_query_definition import FormulaAndFunctionQueryDefinition + from datadog_api_client.v1.model.heatgrid_widget_response_format import HeatgridWidgetResponseFormat + + return { + "formulas": ([HeatgridWidgetFormula],), + "queries": ([FormulaAndFunctionQueryDefinition],), + "response_format": (HeatgridWidgetResponseFormat,), + } + + attribute_map = { + "formulas": "formulas", + "queries": "queries", + "response_format": "response_format", + } + + def __init__( + self_, + queries: List[ + Union[ + FormulaAndFunctionQueryDefinition, + FormulaAndFunctionMetricQueryDefinition, + FormulaAndFunctionEventQueryDefinition, + FormulaAndFunctionProcessQueryDefinition, + FormulaAndFunctionApmDependencyStatsQueryDefinition, + FormulaAndFunctionApmResourceStatsQueryDefinition, + FormulaAndFunctionApmMetricsQueryDefinition, + FormulaAndFunctionSLOQueryDefinition, + FormulaAndFunctionCloudCostQueryDefinition, + FormulaAndFunctionProductAnalyticsExtendedQueryDefinition, + FormulaAndFunctionUserJourneyQueryDefinition, + FormulaAndFunctionRetentionQueryDefinition, + ] + ], + response_format: HeatgridWidgetResponseFormat, + formulas: Union[List[HeatgridWidgetFormula], UnsetType] = unset, + **kwargs, + ): + """ + A request for a heatgrid widget that uses formulas and functions. + + :param formulas: The single displayed formula can combine multiple queries. + :type formulas: [HeatgridWidgetFormula], optional + + :param queries: Queries returned directly or combined in a formula. + :type queries: [FormulaAndFunctionQueryDefinition] + + :param response_format: Response format for heatgrid queries. + :type response_format: HeatgridWidgetResponseFormat + """ + if formulas is not unset: + kwargs["formulas"] = formulas + super().__init__(kwargs) + + self_.queries = queries + self_.response_format = response_format diff --git a/src/datadog_api_client/v1/model/heatgrid_widget_response_format.py b/src/datadog_api_client/v1/model/heatgrid_widget_response_format.py new file mode 100644 index 0000000000..023e6dd2ad --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_widget_response_format.py @@ -0,0 +1,35 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class HeatgridWidgetResponseFormat(ModelSimple): + """ + Response format for heatgrid queries. + + :param value: If omitted defaults to "timeseries". Must be one of ["timeseries"]. + :type value: str + """ + + allowed_values = { + "timeseries", + } + TIMESERIES: ClassVar["HeatgridWidgetResponseFormat"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +HeatgridWidgetResponseFormat.TIMESERIES = HeatgridWidgetResponseFormat("timeseries") diff --git a/src/datadog_api_client/v1/model/widget.py b/src/datadog_api_client/v1/model/widget.py index e41922ba47..80a3982604 100644 --- a/src/datadog_api_client/v1/model/widget.py +++ b/src/datadog_api_client/v1/model/widget.py @@ -33,6 +33,7 @@ ) from datadog_api_client.v1.model.geomap_widget_definition import GeomapWidgetDefinition from datadog_api_client.v1.model.group_widget_definition import GroupWidgetDefinition + from datadog_api_client.v1.model.heatgrid_widget_definition import HeatgridWidgetDefinition from datadog_api_client.v1.model.heat_map_widget_definition import HeatMapWidgetDefinition from datadog_api_client.v1.model.host_map_widget_definition import HostMapWidgetDefinition from datadog_api_client.v1.model.i_frame_widget_definition import IFrameWidgetDefinition @@ -99,6 +100,7 @@ def __init__( ProductAnalyticsFunnelWidgetDefinition, GeomapWidgetDefinition, GroupWidgetDefinition, + HeatgridWidgetDefinition, HeatMapWidgetDefinition, HostMapWidgetDefinition, IFrameWidgetDefinition, diff --git a/src/datadog_api_client/v1/model/widget_definition.py b/src/datadog_api_client/v1/model/widget_definition.py index f1f23cf3b5..c38831ef7e 100644 --- a/src/datadog_api_client/v1/model/widget_definition.py +++ b/src/datadog_api_client/v1/model/widget_definition.py @@ -135,6 +135,15 @@ def __init__(self, **kwargs): :param widgets: List of widget groups. :type widgets: [Widget] + :param label_column: Configuration of the group label column. + :type label_column: HeatgridLabelColumn, optional + + :param legend: Legend configuration for the heatgrid widget. + :type legend: HeatgridLegend, optional + + :param sort: Ordering of the heatgrid rows. + :type sort: HeatgridSort + :param events: List of widget events. Deprecated - Use `overlay` request type instead. :type events: [WidgetEvent], optional @@ -197,9 +206,6 @@ def __init__(self, **kwargs): :param show_message_column: Whether to show the message column or not :type show_message_column: bool, optional - :param sort: Which column and order to sort by - :type sort: WidgetFieldSort, optional - :param color_preference: Which color to use on the widget. :type color_preference: WidgetColorPreference, optional @@ -245,9 +251,6 @@ def __init__(self, **kwargs): :param template_variables: Powerpack template variables. :type template_variables: PowerpackTemplateVariables, optional - :param legend: Legend configuration for the point plot widget. - :type legend: PointPlotWidgetLegend, optional - :param autoscale: Whether to use auto-scaling or not. :type autoscale: bool, optional @@ -387,6 +390,7 @@ def _composed_schemas(_): ) from datadog_api_client.v1.model.geomap_widget_definition import GeomapWidgetDefinition from datadog_api_client.v1.model.group_widget_definition import GroupWidgetDefinition + from datadog_api_client.v1.model.heatgrid_widget_definition import HeatgridWidgetDefinition from datadog_api_client.v1.model.heat_map_widget_definition import HeatMapWidgetDefinition from datadog_api_client.v1.model.host_map_widget_definition import HostMapWidgetDefinition from datadog_api_client.v1.model.i_frame_widget_definition import IFrameWidgetDefinition @@ -432,6 +436,7 @@ def _composed_schemas(_): ProductAnalyticsFunnelWidgetDefinition, GeomapWidgetDefinition, GroupWidgetDefinition, + HeatgridWidgetDefinition, HeatMapWidgetDefinition, HostMapWidgetDefinition, IFrameWidgetDefinition, diff --git a/src/datadog_api_client/v1/models/__init__.py b/src/datadog_api_client/v1/models/__init__.py index 99afdc7a7a..4521858305 100644 --- a/src/datadog_api_client/v1/models/__init__.py +++ b/src/datadog_api_client/v1/models/__init__.py @@ -266,6 +266,35 @@ from datadog_api_client.v1.model.heat_map_widget_definition_type import HeatMapWidgetDefinitionType from datadog_api_client.v1.model.heat_map_widget_request import HeatMapWidgetRequest from datadog_api_client.v1.model.heat_map_widget_x_axis import HeatMapWidgetXAxis +from datadog_api_client.v1.model.heatgrid_color import HeatgridColor +from datadog_api_client.v1.model.heatgrid_color_bin import HeatgridColorBin +from datadog_api_client.v1.model.heatgrid_color_config import HeatgridColorConfig +from datadog_api_client.v1.model.heatgrid_color_stop import HeatgridColorStop +from datadog_api_client.v1.model.heatgrid_custom_color_source import HeatgridCustomColorSource +from datadog_api_client.v1.model.heatgrid_discrete_custom_color import HeatgridDiscreteCustomColor +from datadog_api_client.v1.model.heatgrid_discrete_mode import HeatgridDiscreteMode +from datadog_api_client.v1.model.heatgrid_discrete_preset_color import HeatgridDiscretePresetColor +from datadog_api_client.v1.model.heatgrid_gradient_custom_color import HeatgridGradientCustomColor +from datadog_api_client.v1.model.heatgrid_gradient_mode import HeatgridGradientMode +from datadog_api_client.v1.model.heatgrid_gradient_preset_color import HeatgridGradientPresetColor +from datadog_api_client.v1.model.heatgrid_label_column import HeatgridLabelColumn +from datadog_api_client.v1.model.heatgrid_label_column_width import HeatgridLabelColumnWidth +from datadog_api_client.v1.model.heatgrid_legend import HeatgridLegend +from datadog_api_client.v1.model.heatgrid_nesting_display import HeatgridNestingDisplay +from datadog_api_client.v1.model.heatgrid_preset_color_source import HeatgridPresetColorSource +from datadog_api_client.v1.model.heatgrid_sort import HeatgridSort +from datadog_api_client.v1.model.heatgrid_sort_aggregation import HeatgridSortAggregation +from datadog_api_client.v1.model.heatgrid_sort_by import HeatgridSortBy +from datadog_api_client.v1.model.heatgrid_sort_by_label import HeatgridSortByLabel +from datadog_api_client.v1.model.heatgrid_sort_by_label_property import HeatgridSortByLabelProperty +from datadog_api_client.v1.model.heatgrid_sort_by_value import HeatgridSortByValue +from datadog_api_client.v1.model.heatgrid_sort_by_value_property import HeatgridSortByValueProperty +from datadog_api_client.v1.model.heatgrid_sort_order import HeatgridSortOrder +from datadog_api_client.v1.model.heatgrid_widget_definition import HeatgridWidgetDefinition +from datadog_api_client.v1.model.heatgrid_widget_definition_type import HeatgridWidgetDefinitionType +from datadog_api_client.v1.model.heatgrid_widget_formula import HeatgridWidgetFormula +from datadog_api_client.v1.model.heatgrid_widget_request import HeatgridWidgetRequest +from datadog_api_client.v1.model.heatgrid_widget_response_format import HeatgridWidgetResponseFormat from datadog_api_client.v1.model.host import Host from datadog_api_client.v1.model.host_list_response import HostListResponse from datadog_api_client.v1.model.host_map_request import HostMapRequest @@ -1690,6 +1719,35 @@ "HeatMapWidgetDefinitionType", "HeatMapWidgetRequest", "HeatMapWidgetXAxis", + "HeatgridColor", + "HeatgridColorBin", + "HeatgridColorConfig", + "HeatgridColorStop", + "HeatgridCustomColorSource", + "HeatgridDiscreteCustomColor", + "HeatgridDiscreteMode", + "HeatgridDiscretePresetColor", + "HeatgridGradientCustomColor", + "HeatgridGradientMode", + "HeatgridGradientPresetColor", + "HeatgridLabelColumn", + "HeatgridLabelColumnWidth", + "HeatgridLegend", + "HeatgridNestingDisplay", + "HeatgridPresetColorSource", + "HeatgridSort", + "HeatgridSortAggregation", + "HeatgridSortBy", + "HeatgridSortByLabel", + "HeatgridSortByLabelProperty", + "HeatgridSortByValue", + "HeatgridSortByValueProperty", + "HeatgridSortOrder", + "HeatgridWidgetDefinition", + "HeatgridWidgetDefinitionType", + "HeatgridWidgetFormula", + "HeatgridWidgetRequest", + "HeatgridWidgetResponseFormat", "Host", "HostListResponse", "HostMapRequest", diff --git a/tests/generated-test/test-runner-data/manifest.json b/tests/generated-test/test-runner-data/manifest.json index 08eb2c46ea..1502e31199 100644 --- a/tests/generated-test/test-runner-data/manifest.json +++ b/tests/generated-test/test-runner-data/manifest.json @@ -154,6 +154,27 @@ "scenario": "Create a geomap widget with conditional formats and text formats", "version": "v1" }, + { + "feature": "Dashboards", + "feature_file": "../../v1/features/dashboards.feature", + "file": "v1/dashboards/create-a-heatgrid-widget-with-a-preset-gradient.json", + "scenario": "Create a heatgrid widget with a preset gradient", + "version": "v1" + }, + { + "feature": "Dashboards", + "feature_file": "../../v1/features/dashboards.feature", + "file": "v1/dashboards/create-a-heatgrid-widget-with-custom-discrete-thresholds.json", + "scenario": "Create a heatgrid widget with custom discrete thresholds", + "version": "v1" + }, + { + "feature": "Dashboards", + "feature_file": "../../v1/features/dashboards.feature", + "file": "v1/dashboards/create-a-heatgrid-widget-with-custom-gradient-colors-for-both-themes.json", + "scenario": "Create a heatgrid widget with custom gradient colors for both themes", + "version": "v1" + }, { "feature": "Dashboards", "feature_file": "../../v1/features/dashboards.feature", diff --git a/tests/generated-test/test-runner-data/v1/dashboards/create-a-heatgrid-widget-with-a-preset-gradient.json b/tests/generated-test/test-runner-data/v1/dashboards/create-a-heatgrid-widget-with-a-preset-gradient.json new file mode 100644 index 0000000000..730998783f --- /dev/null +++ b/tests/generated-test/test-runner-data/v1/dashboards/create-a-heatgrid-widget-with-a-preset-gradient.json @@ -0,0 +1,72 @@ +{ + "api": "Dashboards", + "expected_status": 200, + "feature": "Dashboards", + "id": "v1/Dashboards/Create a heatgrid widget with a preset gradient", + "operation_id": "CreateDashboard", + "request": { + "body": { + "schema": { + "format": null, + "ref": "Dashboard", + "type": "object" + }, + "source": "inline", + "value": { + "layout_type": "ordered", + "title": "{{ unique }}", + "widgets": [ + { + "definition": { + "color": { + "mode": "gradient", + "preset_name": "classic", + "source": "preset" + }, + "label_column": { + "width": "m" + }, + "legend": { + "show_caption": true + }, + "requests": [ + { + "formulas": [ + { + "formula": "query1" + } + ], + "queries": [ + { + "data_source": "metrics", + "name": "query1", + "query": "avg:system.cpu.user{*} by {host}" + } + ], + "response_format": "timeseries" + } + ], + "sort": { + "nesting_display": "flat", + "sort_by": { + "aggregation": "avg", + "order": "desc", + "property": "value" + } + }, + "type": "heatgrid" + } + } + ] + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v1/dashboard" + }, + "scenario": "Create a heatgrid widget with a preset gradient", + "schema_version": 1, + "version": "v1" +} diff --git a/tests/generated-test/test-runner-data/v1/dashboards/create-a-heatgrid-widget-with-custom-discrete-thresholds.json b/tests/generated-test/test-runner-data/v1/dashboards/create-a-heatgrid-widget-with-custom-discrete-thresholds.json new file mode 100644 index 0000000000..a21fef5d5d --- /dev/null +++ b/tests/generated-test/test-runner-data/v1/dashboards/create-a-heatgrid-widget-with-custom-discrete-thresholds.json @@ -0,0 +1,79 @@ +{ + "api": "Dashboards", + "expected_status": 200, + "feature": "Dashboards", + "id": "v1/Dashboards/Create a heatgrid widget with custom discrete thresholds", + "operation_id": "CreateDashboard", + "request": { + "body": { + "schema": { + "format": null, + "ref": "Dashboard", + "type": "object" + }, + "source": "inline", + "value": { + "layout_type": "ordered", + "title": "{{ unique }}", + "widgets": [ + { + "definition": { + "color": { + "bins": [ + { + "color": "#00FF00" + }, + { + "color": "#FF0000", + "lower_bound": 80 + } + ], + "mode": "discrete", + "source": "custom" + }, + "label_column": { + "width": "m" + }, + "legend": { + "show_caption": true + }, + "requests": [ + { + "formulas": [ + { + "formula": "query1" + } + ], + "queries": [ + { + "data_source": "metrics", + "name": "query1", + "query": "avg:system.cpu.user{*} by {host}" + } + ], + "response_format": "timeseries" + } + ], + "sort": { + "nesting_display": "flat", + "sort_by": { + "order": "asc", + "property": "label" + } + }, + "type": "heatgrid" + } + } + ] + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v1/dashboard" + }, + "scenario": "Create a heatgrid widget with custom discrete thresholds", + "schema_version": 1, + "version": "v1" +} diff --git a/tests/generated-test/test-runner-data/v1/dashboards/create-a-heatgrid-widget-with-custom-gradient-colors-for-both-themes.json b/tests/generated-test/test-runner-data/v1/dashboards/create-a-heatgrid-widget-with-custom-gradient-colors-for-both-themes.json new file mode 100644 index 0000000000..86d24a6e15 --- /dev/null +++ b/tests/generated-test/test-runner-data/v1/dashboards/create-a-heatgrid-widget-with-custom-gradient-colors-for-both-themes.json @@ -0,0 +1,84 @@ +{ + "api": "Dashboards", + "expected_status": 200, + "feature": "Dashboards", + "id": "v1/Dashboards/Create a heatgrid widget with custom gradient colors for both themes", + "operation_id": "CreateDashboard", + "request": { + "body": { + "schema": { + "format": null, + "ref": "Dashboard", + "type": "object" + }, + "source": "inline", + "value": { + "layout_type": "ordered", + "title": "{{ unique }}", + "widgets": [ + { + "definition": { + "color": { + "mode": "gradient", + "source": "custom", + "stops": [ + { + "color": [ + "#FFFFFF", + "#000000" + ], + "position": 0 + }, + { + "color": "#FF0000", + "position": 100 + } + ] + }, + "label_column": { + "width": "m" + }, + "legend": { + "show_caption": true + }, + "requests": [ + { + "formulas": [ + { + "formula": "query1" + } + ], + "queries": [ + { + "data_source": "metrics", + "name": "query1", + "query": "avg:system.cpu.user{*} by {host}" + } + ], + "response_format": "timeseries" + } + ], + "sort": { + "nesting_display": "flat", + "sort_by": { + "aggregation": "avg", + "order": "desc", + "property": "value" + } + }, + "type": "heatgrid" + } + } + ] + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v1/dashboard" + }, + "scenario": "Create a heatgrid widget with custom gradient colors for both themes", + "schema_version": 1, + "version": "v1" +} diff --git a/tests/generated-test/test-server-data/v1/dashboards.json b/tests/generated-test/test-server-data/v1/dashboards.json index 7c47fc4541..30239698c4 100644 --- a/tests/generated-test/test-server-data/v1/dashboards.json +++ b/tests/generated-test/test-server-data/v1/dashboards.json @@ -696,6 +696,325 @@ "scenario": "Create a geomap widget with conditional formats and text formats", "version": "v1" }, + { + "feature": "Dashboards", + "frozen_at": "2026-10-08T20:45:28.713Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "layout_type": "ordered", + "title": "Test-Create_a_heatgrid_widget_with_a_preset_gradient-1791492328", + "widgets": [ + { + "definition": { + "color": { + "mode": "gradient", + "preset_name": "classic", + "source": "preset" + }, + "label_column": { + "width": "m" + }, + "legend": { + "show_caption": true + }, + "requests": [ + { + "formulas": [ + { + "formula": "query1" + } + ], + "queries": [ + { + "data_source": "metrics", + "name": "query1", + "query": "avg:system.cpu.user{*} by {host}" + } + ], + "response_format": "timeseries" + } + ], + "sort": { + "nesting_display": "flat", + "sort_by": { + "aggregation": "avg", + "order": "desc", + "property": "value" + } + }, + "type": "heatgrid" + } + } + ] + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v1/dashboard", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"id\":\"rws-u2c-xjn\",\"title\":\"Test-Create_a_heatgrid_widget_with_a_preset_gradient-1791492328\",\"description\":null,\"author_handle\":\"test@example.com\",\"author_name\":\"Test User\",\"layout_type\":\"ordered\",\"url\":\"/dashboard/rws-u2c-xjn/test-createaheatgridwidgetwithapresetgradient-1791492328\",\"template_variables\":null,\"widgets\":[{\"definition\":{\"color\":{\"mode\":\"gradient\",\"preset_name\":\"classic\",\"source\":\"preset\"},\"label_column\":{\"width\":\"m\"},\"legend\":{\"show_caption\":true},\"requests\":[{\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"data_source\":\"metrics\",\"name\":\"query1\",\"query\":\"avg:system.cpu.user{*} by {host}\"}],\"response_format\":\"timeseries\"}],\"sort\":{\"nesting_display\":\"flat\",\"sort_by\":{\"aggregation\":\"avg\",\"order\":\"desc\",\"property\":\"value\"}},\"type\":\"heatgrid\"},\"id\":703699353428571}],\"notify_list\":null,\"created_at\":\"2026-10-08T20:45:28.947012+00:00\",\"modified_at\":\"2026-10-08T20:45:28.947012+00:00\",\"experience_type\":\"default\",\"restricted_roles\":[]}" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v1/dashboard/rws-u2c-xjn", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"deleted_dashboard_id\":\"rws-u2c-xjn\"}" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "Create a heatgrid widget with a preset gradient", + "version": "v1" + }, + { + "feature": "Dashboards", + "frozen_at": "2026-10-08T20:45:29.961Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "layout_type": "ordered", + "title": "Test-Create_a_heatgrid_widget_with_custom_discrete_thresholds-1791492329", + "widgets": [ + { + "definition": { + "color": { + "bins": [ + { + "color": "#00FF00" + }, + { + "color": "#FF0000", + "lower_bound": 80 + } + ], + "mode": "discrete", + "source": "custom" + }, + "label_column": { + "width": "m" + }, + "legend": { + "show_caption": true + }, + "requests": [ + { + "formulas": [ + { + "formula": "query1" + } + ], + "queries": [ + { + "data_source": "metrics", + "name": "query1", + "query": "avg:system.cpu.user{*} by {host}" + } + ], + "response_format": "timeseries" + } + ], + "sort": { + "nesting_display": "flat", + "sort_by": { + "order": "asc", + "property": "label" + } + }, + "type": "heatgrid" + } + } + ] + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v1/dashboard", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"id\":\"6sq-avw-idr\",\"title\":\"Test-Create_a_heatgrid_widget_with_custom_discrete_thresholds-1791492329\",\"description\":null,\"author_handle\":\"test@example.com\",\"author_name\":\"Test User\",\"layout_type\":\"ordered\",\"url\":\"/dashboard/6sq-avw-idr/test-createaheatgridwidgetwithcustomdiscretethresholds-1791492329\",\"template_variables\":null,\"widgets\":[{\"definition\":{\"color\":{\"bins\":[{\"color\":\"#00FF00\"},{\"color\":\"#FF0000\",\"lower_bound\":80}],\"mode\":\"discrete\",\"source\":\"custom\"},\"label_column\":{\"width\":\"m\"},\"legend\":{\"show_caption\":true},\"requests\":[{\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"data_source\":\"metrics\",\"name\":\"query1\",\"query\":\"avg:system.cpu.user{*} by {host}\"}],\"response_format\":\"timeseries\"}],\"sort\":{\"nesting_display\":\"flat\",\"sort_by\":{\"order\":\"asc\",\"property\":\"label\"}},\"type\":\"heatgrid\"},\"id\":4032652334995696}],\"notify_list\":null,\"created_at\":\"2026-10-08T20:45:30.208364+00:00\",\"modified_at\":\"2026-10-08T20:45:30.208364+00:00\",\"experience_type\":\"default\",\"restricted_roles\":[]}" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v1/dashboard/6sq-avw-idr", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"deleted_dashboard_id\":\"6sq-avw-idr\"}" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "Create a heatgrid widget with custom discrete thresholds", + "version": "v1" + }, + { + "feature": "Dashboards", + "frozen_at": "2026-10-08T20:45:31.220Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "layout_type": "ordered", + "title": "Test-Create_a_heatgrid_widget_with_custom_gradient_colors_for_both_themes-1791492331", + "widgets": [ + { + "definition": { + "color": { + "mode": "gradient", + "source": "custom", + "stops": [ + { + "color": [ + "#FFFFFF", + "#000000" + ], + "position": 0 + }, + { + "color": "#FF0000", + "position": 100 + } + ] + }, + "label_column": { + "width": "m" + }, + "legend": { + "show_caption": true + }, + "requests": [ + { + "formulas": [ + { + "formula": "query1" + } + ], + "queries": [ + { + "data_source": "metrics", + "name": "query1", + "query": "avg:system.cpu.user{*} by {host}" + } + ], + "response_format": "timeseries" + } + ], + "sort": { + "nesting_display": "flat", + "sort_by": { + "aggregation": "avg", + "order": "desc", + "property": "value" + } + }, + "type": "heatgrid" + } + } + ] + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v1/dashboard", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"id\":\"p5v-36u-h29\",\"title\":\"Test-Create_a_heatgrid_widget_with_custom_gradient_colors_for_both_themes-1791492331\",\"description\":null,\"author_handle\":\"test@example.com\",\"author_name\":\"Test User\",\"layout_type\":\"ordered\",\"url\":\"/dashboard/p5v-36u-h29/test-createaheatgridwidgetwithcustomgradientcolorsforboththemes-1791492331\",\"template_variables\":null,\"widgets\":[{\"definition\":{\"color\":{\"mode\":\"gradient\",\"source\":\"custom\",\"stops\":[{\"color\":[\"#FFFFFF\",\"#000000\"],\"position\":0},{\"color\":\"#FF0000\",\"position\":100}]},\"label_column\":{\"width\":\"m\"},\"legend\":{\"show_caption\":true},\"requests\":[{\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"data_source\":\"metrics\",\"name\":\"query1\",\"query\":\"avg:system.cpu.user{*} by {host}\"}],\"response_format\":\"timeseries\"}],\"sort\":{\"nesting_display\":\"flat\",\"sort_by\":{\"aggregation\":\"avg\",\"order\":\"desc\",\"property\":\"value\"}},\"type\":\"heatgrid\"},\"id\":4644010913884827}],\"notify_list\":null,\"created_at\":\"2026-10-08T20:45:31.439485+00:00\",\"modified_at\":\"2026-10-08T20:45:31.439485+00:00\",\"experience_type\":\"default\",\"restricted_roles\":[]}" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + }, + { + "request": { + "body": { + "type": "empty", + "value": null + }, + "content_type": "", + "method": "DELETE", + "path": "/api/v1/dashboard/p5v-36u-h29", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"deleted_dashboard_id\":\"p5v-36u-h29\"}" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "Create a heatgrid widget with custom gradient colors for both themes", + "version": "v1" + }, { "feature": "Dashboards", "frozen_at": "2024-11-15T19:32:29.001Z", diff --git a/tests/v1/features/dashboards.feature b/tests/v1/features/dashboards.feature index 0025051913..be69220359 100644 --- a/tests/v1/features/dashboards.feature +++ b/tests/v1/features/dashboards.feature @@ -87,6 +87,66 @@ Feature: Dashboards And the response "widgets[0].definition.requests[1].text_formats[0].palette" is equal to "white_on_red" And the response "widgets[0].definition.view.focus" is equal to "NORTH_AMERICA" + @team:ddoghq/dashboards-backend + Scenario: Create a heatgrid widget with a preset gradient + Given new "CreateDashboard" request + And body with value {"title": "{{ unique }}", "layout_type": "ordered", "widgets": [{"definition": {"type": "heatgrid", "requests": [{"response_format": "timeseries", "queries": [{"data_source": "metrics", "name": "query1", "query": "avg:system.cpu.user{*} by {host}"}], "formulas": [{"formula": "query1"}]}], "sort": {"nesting_display": "flat", "sort_by": {"property": "value", "order": "desc", "aggregation": "avg"}}, "color": {"mode": "gradient", "source": "preset", "preset_name": "classic"}, "legend": {"show_caption": true}, "label_column": {"width": "m"}}}]} + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.type" is equal to "heatgrid" + And the response "widgets[0].definition.color.mode" is equal to "gradient" + And the response "widgets[0].definition.color.source" is equal to "preset" + And the response "widgets[0].definition.color.preset_name" is equal to "classic" + And the response "widgets[0].definition.sort.nesting_display" is equal to "flat" + And the response "widgets[0].definition.sort.sort_by.property" is equal to "value" + And the response "widgets[0].definition.sort.sort_by.order" is equal to "desc" + And the response "widgets[0].definition.sort.sort_by.aggregation" is equal to "avg" + And the response "widgets[0].definition.legend.show_caption" is equal to true + And the response "widgets[0].definition.label_column.width" is equal to "m" + + @team:ddoghq/dashboards-backend + Scenario: Create a heatgrid widget with custom discrete thresholds + Given new "CreateDashboard" request + And body with value {"title": "{{ unique }}", "layout_type": "ordered", "widgets": [{"definition": {"type": "heatgrid", "requests": [{"response_format": "timeseries", "queries": [{"data_source": "metrics", "name": "query1", "query": "avg:system.cpu.user{*} by {host}"}], "formulas": [{"formula": "query1"}]}], "sort": {"nesting_display": "flat", "sort_by": {"property": "label", "order": "asc"}}, "color": {"mode": "discrete", "source": "custom", "bins": [{"color": "#00FF00"}, {"color": "#FF0000", "lower_bound": 80}]}, "legend": {"show_caption": true}, "label_column": {"width": "m"}}}]} + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.type" is equal to "heatgrid" + And the response "widgets[0].definition.color.mode" is equal to "discrete" + And the response "widgets[0].definition.color.source" is equal to "custom" + And the response "widgets[0].definition.color.bins" has length 2 + And the response "widgets[0].definition.color.bins[0].color" is equal to "#00FF00" + And the response "widgets[0].definition.color.bins[1].color" is equal to "#FF0000" + And the response "widgets[0].definition.color.bins[1].lower_bound" is equal to 80 + And the response "widgets[0].definition.color.bins[0]" does not have field "lower_bound" + And the response "widgets[0].definition.sort.nesting_display" is equal to "flat" + And the response "widgets[0].definition.sort.sort_by.property" is equal to "label" + And the response "widgets[0].definition.sort.sort_by.order" is equal to "asc" + And the response "widgets[0].definition.legend.show_caption" is equal to true + And the response "widgets[0].definition.label_column.width" is equal to "m" + + @team:ddoghq/dashboards-backend + Scenario: Create a heatgrid widget with custom gradient colors for both themes + Given new "CreateDashboard" request + And body with value {"title": "{{ unique }}", "layout_type": "ordered", "widgets": [{"definition": {"type": "heatgrid", "requests": [{"response_format": "timeseries", "queries": [{"data_source": "metrics", "name": "query1", "query": "avg:system.cpu.user{*} by {host}"}], "formulas": [{"formula": "query1"}]}], "sort": {"nesting_display": "flat", "sort_by": {"property": "value", "order": "desc", "aggregation": "avg"}}, "color": {"mode": "gradient", "source": "custom", "stops": [{"position": 0, "color": ["#FFFFFF", "#000000"]}, {"position": 100, "color": "#FF0000"}]}, "legend": {"show_caption": true}, "label_column": {"width": "m"}}}]} + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.type" is equal to "heatgrid" + And the response "widgets[0].definition.color.mode" is equal to "gradient" + And the response "widgets[0].definition.color.source" is equal to "custom" + And the response "widgets[0].definition.color.stops" has length 2 + And the response "widgets[0].definition.color.stops[0].position" is equal to 0 + And the response "widgets[0].definition.color.stops[0].color" has length 2 + And the response "widgets[0].definition.color.stops[0].color[0]" is equal to "#FFFFFF" + And the response "widgets[0].definition.color.stops[0].color[1]" is equal to "#000000" + And the response "widgets[0].definition.color.stops[1].position" is equal to 100 + And the response "widgets[0].definition.color.stops[1].color" is equal to "#FF0000" + And the response "widgets[0].definition.sort.nesting_display" is equal to "flat" + And the response "widgets[0].definition.sort.sort_by.property" is equal to "value" + And the response "widgets[0].definition.sort.sort_by.order" is equal to "desc" + And the response "widgets[0].definition.sort.sort_by.aggregation" is equal to "avg" + And the response "widgets[0].definition.legend.show_caption" is equal to true + And the response "widgets[0].definition.label_column.width" is equal to "m" + @generated @skip @team:ddoghq/dashboards-backend Scenario: Create a new dashboard returns "Bad Request" response Given new "CreateDashboard" request