diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 9ee2d06488..49976b69bb 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -4612,10 +4612,14 @@ components: - $ref: "#/components/schemas/HeatgridThemeColors" HeatgridColorBin: additionalProperties: false - description: A color and optional lower threshold for a discrete bin. + description: A color, optional lower threshold, and optional label for a discrete bin. properties: color: $ref: "#/components/schemas/HeatgridColor" + label: + description: Name of the bin. + maxLength: 255 + type: string lower_bound: description: Inclusive lower bound. Omit for the first bin. format: double @@ -4749,12 +4753,15 @@ components: type: object HeatgridLabelColumn: additionalProperties: false - description: Configuration of the group label column. + description: Configuration of the group label column. Its width is sized automatically when omitted. properties: + text_formats: + description: Ordered string replacement rules for the group labels. + items: + $ref: "#/components/schemas/HeatgridTextFormatRule" + type: array width: $ref: "#/components/schemas/HeatgridLabelColumnWidth" - required: - - width type: object HeatgridLabelColumnWidth: description: Width of the label column. @@ -4880,6 +4887,107 @@ components: x-enum-varnames: - ASC - DESC + HeatgridTextFormatMatch: + additionalProperties: false + description: Match a group label against a string. + properties: + type: + $ref: "#/components/schemas/HeatgridTextFormatMatchType" + value: + description: String to compare with the group label. + example: "" + maxLength: 255 + type: string + required: + - type + - value + type: object + HeatgridTextFormatMatchType: + description: Comparison used to match a group label. + enum: + - is + - is_not + - contains + - does_not_contain + - starts_with + - ends_with + example: is + type: string + x-enum-varnames: + - IS + - IS_NOT + - CONTAINS + - DOES_NOT_CONTAIN + - STARTS_WITH + - ENDS_WITH + HeatgridTextFormatReplace: + description: Replace all or part of a matching group label. + oneOf: + - $ref: "#/components/schemas/HeatgridTextFormatReplaceAll" + - $ref: "#/components/schemas/HeatgridTextFormatReplaceSubstring" + HeatgridTextFormatReplaceAll: + additionalProperties: false + description: Replace the entire matching group label. + properties: + type: + $ref: "#/components/schemas/HeatgridTextFormatReplaceAllType" + with: + description: Replacement string. + example: "" + maxLength: 255 + type: string + required: + - type + - with + type: object + HeatgridTextFormatReplaceAllType: + description: Replace the entire matching group label. + enum: + - all + example: all + type: string + x-enum-varnames: + - ALL + HeatgridTextFormatReplaceSubstring: + additionalProperties: false + description: Replace a substring of the matching group label. + properties: + substring: + description: Substring to replace. + example: "" + maxLength: 255 + type: string + type: + $ref: "#/components/schemas/HeatgridTextFormatReplaceSubstringType" + with: + description: Replacement string. + example: "" + maxLength: 255 + type: string + required: + - type + - substring + - with + type: object + HeatgridTextFormatReplaceSubstringType: + description: Replace a substring of a matching group label. + enum: + - substring + example: substring + type: string + x-enum-varnames: + - SUBSTRING + HeatgridTextFormatRule: + additionalProperties: false + description: A rule for matching and optionally replacing a group label. + properties: + match: + $ref: "#/components/schemas/HeatgridTextFormatMatch" + replace: + $ref: "#/components/schemas/HeatgridTextFormatReplace" + required: + - match + type: object HeatgridThemeColors: description: Two color strings for the light and dark themes, in that order. example: ["#FFFFFF", "#000000"] diff --git a/examples/v1/dashboards/CreateDashboard_209524718.py b/examples/v1/dashboards/CreateDashboard_209524718.py new file mode 100644 index 0000000000..8cc98bff07 --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_209524718.py @@ -0,0 +1,122 @@ +""" +Create a heatgrid widget with bin labels and formatted row labels +""" + +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_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_text_format_match import HeatgridTextFormatMatch +from datadog_api_client.v1.model.heatgrid_text_format_match_type import HeatgridTextFormatMatchType +from datadog_api_client.v1.model.heatgrid_text_format_replace_all import HeatgridTextFormatReplaceAll +from datadog_api_client.v1.model.heatgrid_text_format_replace_all_type import HeatgridTextFormatReplaceAllType +from datadog_api_client.v1.model.heatgrid_text_format_replace_substring import HeatgridTextFormatReplaceSubstring +from datadog_api_client.v1.model.heatgrid_text_format_replace_substring_type import ( + HeatgridTextFormatReplaceSubstringType, +) +from datadog_api_client.v1.model.heatgrid_text_format_rule import HeatgridTextFormatRule +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", + label="Normal", + ), + HeatgridColorBin( + color="#FF0000", + lower_bound=80.0, + label="High", + ), + ], + ), + label_column=HeatgridLabelColumn( + text_formats=[ + HeatgridTextFormatRule( + match=HeatgridTextFormatMatch( + type=HeatgridTextFormatMatchType.STARTS_WITH, + value="api-", + ), + replace=HeatgridTextFormatReplaceSubstring( + type=HeatgridTextFormatReplaceSubstringType.SUBSTRING, + substring="api-", + _with="", + ), + ), + HeatgridTextFormatRule( + match=HeatgridTextFormatMatch( + type=HeatgridTextFormatMatchType.IS, + value="unknown", + ), + replace=HeatgridTextFormatReplaceAll( + type=HeatgridTextFormatReplaceAllType.ALL, + _with="Other", + ), + ), + ], + ), + ), + ), + ], +) + +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_bin.py b/src/datadog_api_client/v1/model/heatgrid_color_bin.py index c5a5cbe8a1..d7dda927b4 100644 --- a/src/datadog_api_client/v1/model/heatgrid_color_bin.py +++ b/src/datadog_api_client/v1/model/heatgrid_color_bin.py @@ -18,6 +18,12 @@ class HeatgridColorBin(ModelNormal): + validations = { + "label": { + "max_length": 255, + }, + } + @cached_property def additional_properties_type(_): return None @@ -28,26 +34,37 @@ def openapi_types(_): return { "color": (HeatgridColor,), + "label": (str,), "lower_bound": (float,), } attribute_map = { "color": "color", + "label": "label", "lower_bound": "lower_bound", } def __init__( - self_, color: Union[HeatgridColor, str, List[str]], lower_bound: Union[float, UnsetType] = unset, **kwargs + self_, + color: Union[HeatgridColor, str, List[str]], + label: Union[str, UnsetType] = unset, + lower_bound: Union[float, UnsetType] = unset, + **kwargs, ): """ - A color and optional lower threshold for a discrete bin. + A color, optional lower threshold, and optional label 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 label: Name of the bin. + :type label: str, optional + :param lower_bound: Inclusive lower bound. Omit for the first bin. :type lower_bound: float, optional """ + if label is not unset: + kwargs["label"] = label if lower_bound is not unset: kwargs["lower_bound"] = lower_bound super().__init__(kwargs) diff --git a/src/datadog_api_client/v1/model/heatgrid_label_column.py b/src/datadog_api_client/v1/model/heatgrid_label_column.py index ff472a3f65..67e25527ac 100644 --- a/src/datadog_api_client/v1/model/heatgrid_label_column.py +++ b/src/datadog_api_client/v1/model/heatgrid_label_column.py @@ -3,15 +3,18 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import TYPE_CHECKING +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_text_format_rule import HeatgridTextFormatRule from datadog_api_client.v1.model.heatgrid_label_column_width import HeatgridLabelColumnWidth @@ -22,23 +25,36 @@ def additional_properties_type(_): @cached_property def openapi_types(_): + from datadog_api_client.v1.model.heatgrid_text_format_rule import HeatgridTextFormatRule from datadog_api_client.v1.model.heatgrid_label_column_width import HeatgridLabelColumnWidth return { + "text_formats": ([HeatgridTextFormatRule],), "width": (HeatgridLabelColumnWidth,), } attribute_map = { + "text_formats": "text_formats", "width": "width", } - def __init__(self_, width: HeatgridLabelColumnWidth, **kwargs): + def __init__( + self_, + text_formats: Union[List[HeatgridTextFormatRule], UnsetType] = unset, + width: Union[HeatgridLabelColumnWidth, UnsetType] = unset, + **kwargs, + ): """ - Configuration of the group label column. + Configuration of the group label column. Its width is sized automatically when omitted. + + :param text_formats: Ordered string replacement rules for the group labels. + :type text_formats: [HeatgridTextFormatRule], optional :param width: Width of the label column. - :type width: HeatgridLabelColumnWidth + :type width: HeatgridLabelColumnWidth, optional """ + if text_formats is not unset: + kwargs["text_formats"] = text_formats + if width is not unset: + kwargs["width"] = width super().__init__(kwargs) - - self_.width = width diff --git a/src/datadog_api_client/v1/model/heatgrid_text_format_match.py b/src/datadog_api_client/v1/model/heatgrid_text_format_match.py new file mode 100644 index 0000000000..15b63e92a3 --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_text_format_match.py @@ -0,0 +1,56 @@ +# 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_text_format_match_type import HeatgridTextFormatMatchType + + +class HeatgridTextFormatMatch(ModelNormal): + validations = { + "value": { + "max_length": 255, + }, + } + + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.heatgrid_text_format_match_type import HeatgridTextFormatMatchType + + return { + "type": (HeatgridTextFormatMatchType,), + "value": (str,), + } + + attribute_map = { + "type": "type", + "value": "value", + } + + def __init__(self_, type: HeatgridTextFormatMatchType, value: str, **kwargs): + """ + Match a group label against a string. + + :param type: Comparison used to match a group label. + :type type: HeatgridTextFormatMatchType + + :param value: String to compare with the group label. + :type value: str + """ + super().__init__(kwargs) + + self_.type = type + self_.value = value diff --git a/src/datadog_api_client/v1/model/heatgrid_text_format_match_type.py b/src/datadog_api_client/v1/model/heatgrid_text_format_match_type.py new file mode 100644 index 0000000000..bae1e8423d --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_text_format_match_type.py @@ -0,0 +1,50 @@ +# 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 HeatgridTextFormatMatchType(ModelSimple): + """ + Comparison used to match a group label. + + :param value: Must be one of ["is", "is_not", "contains", "does_not_contain", "starts_with", "ends_with"]. + :type value: str + """ + + allowed_values = { + "is", + "is_not", + "contains", + "does_not_contain", + "starts_with", + "ends_with", + } + IS: ClassVar["HeatgridTextFormatMatchType"] + IS_NOT: ClassVar["HeatgridTextFormatMatchType"] + CONTAINS: ClassVar["HeatgridTextFormatMatchType"] + DOES_NOT_CONTAIN: ClassVar["HeatgridTextFormatMatchType"] + STARTS_WITH: ClassVar["HeatgridTextFormatMatchType"] + ENDS_WITH: ClassVar["HeatgridTextFormatMatchType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +HeatgridTextFormatMatchType.IS = HeatgridTextFormatMatchType("is") +HeatgridTextFormatMatchType.IS_NOT = HeatgridTextFormatMatchType("is_not") +HeatgridTextFormatMatchType.CONTAINS = HeatgridTextFormatMatchType("contains") +HeatgridTextFormatMatchType.DOES_NOT_CONTAIN = HeatgridTextFormatMatchType("does_not_contain") +HeatgridTextFormatMatchType.STARTS_WITH = HeatgridTextFormatMatchType("starts_with") +HeatgridTextFormatMatchType.ENDS_WITH = HeatgridTextFormatMatchType("ends_with") diff --git a/src/datadog_api_client/v1/model/heatgrid_text_format_replace.py b/src/datadog_api_client/v1/model/heatgrid_text_format_replace.py new file mode 100644 index 0000000000..72f70cbec5 --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_text_format_replace.py @@ -0,0 +1,48 @@ +# 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 HeatgridTextFormatReplace(ModelComposed): + def __init__(self, **kwargs): + """ + Replace all or part of a matching group label. + + :param type: Replace the entire matching group label. + :type type: HeatgridTextFormatReplaceAllType + + :param _with: Replacement string. + :type _with: str + + :param substring: Substring to replace. + :type substring: str + """ + 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_text_format_replace_all import HeatgridTextFormatReplaceAll + from datadog_api_client.v1.model.heatgrid_text_format_replace_substring import ( + HeatgridTextFormatReplaceSubstring, + ) + + return { + "oneOf": [ + HeatgridTextFormatReplaceAll, + HeatgridTextFormatReplaceSubstring, + ], + } diff --git a/src/datadog_api_client/v1/model/heatgrid_text_format_replace_all.py b/src/datadog_api_client/v1/model/heatgrid_text_format_replace_all.py new file mode 100644 index 0000000000..9ffb2dd1ee --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_text_format_replace_all.py @@ -0,0 +1,56 @@ +# 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_text_format_replace_all_type import HeatgridTextFormatReplaceAllType + + +class HeatgridTextFormatReplaceAll(ModelNormal): + validations = { + "_with": { + "max_length": 255, + }, + } + + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.heatgrid_text_format_replace_all_type import HeatgridTextFormatReplaceAllType + + return { + "type": (HeatgridTextFormatReplaceAllType,), + "_with": (str,), + } + + attribute_map = { + "type": "type", + "_with": "with", + } + + def __init__(self_, type: HeatgridTextFormatReplaceAllType, _with: str, **kwargs): + """ + Replace the entire matching group label. + + :param type: Replace the entire matching group label. + :type type: HeatgridTextFormatReplaceAllType + + :param _with: Replacement string. + :type _with: str + """ + super().__init__(kwargs) + + self_.type = type + self_._with = _with diff --git a/src/datadog_api_client/v1/model/heatgrid_text_format_replace_all_type.py b/src/datadog_api_client/v1/model/heatgrid_text_format_replace_all_type.py new file mode 100644 index 0000000000..be7576c8b6 --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_text_format_replace_all_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 HeatgridTextFormatReplaceAllType(ModelSimple): + """ + Replace the entire matching group label. + + :param value: If omitted defaults to "all". Must be one of ["all"]. + :type value: str + """ + + allowed_values = { + "all", + } + ALL: ClassVar["HeatgridTextFormatReplaceAllType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +HeatgridTextFormatReplaceAllType.ALL = HeatgridTextFormatReplaceAllType("all") diff --git a/src/datadog_api_client/v1/model/heatgrid_text_format_replace_substring.py b/src/datadog_api_client/v1/model/heatgrid_text_format_replace_substring.py new file mode 100644 index 0000000000..3958ecfc2f --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_text_format_replace_substring.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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.heatgrid_text_format_replace_substring_type import ( + HeatgridTextFormatReplaceSubstringType, + ) + + +class HeatgridTextFormatReplaceSubstring(ModelNormal): + validations = { + "substring": { + "max_length": 255, + }, + "_with": { + "max_length": 255, + }, + } + + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.heatgrid_text_format_replace_substring_type import ( + HeatgridTextFormatReplaceSubstringType, + ) + + return { + "substring": (str,), + "type": (HeatgridTextFormatReplaceSubstringType,), + "_with": (str,), + } + + attribute_map = { + "substring": "substring", + "type": "type", + "_with": "with", + } + + def __init__(self_, substring: str, type: HeatgridTextFormatReplaceSubstringType, _with: str, **kwargs): + """ + Replace a substring of the matching group label. + + :param substring: Substring to replace. + :type substring: str + + :param type: Replace a substring of a matching group label. + :type type: HeatgridTextFormatReplaceSubstringType + + :param _with: Replacement string. + :type _with: str + """ + super().__init__(kwargs) + + self_.substring = substring + self_.type = type + self_._with = _with diff --git a/src/datadog_api_client/v1/model/heatgrid_text_format_replace_substring_type.py b/src/datadog_api_client/v1/model/heatgrid_text_format_replace_substring_type.py new file mode 100644 index 0000000000..ccde62240b --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_text_format_replace_substring_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 HeatgridTextFormatReplaceSubstringType(ModelSimple): + """ + Replace a substring of a matching group label. + + :param value: If omitted defaults to "substring". Must be one of ["substring"]. + :type value: str + """ + + allowed_values = { + "substring", + } + SUBSTRING: ClassVar["HeatgridTextFormatReplaceSubstringType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +HeatgridTextFormatReplaceSubstringType.SUBSTRING = HeatgridTextFormatReplaceSubstringType("substring") diff --git a/src/datadog_api_client/v1/model/heatgrid_text_format_rule.py b/src/datadog_api_client/v1/model/heatgrid_text_format_rule.py new file mode 100644 index 0000000000..7c29f3cc45 --- /dev/null +++ b/src/datadog_api_client/v1/model/heatgrid_text_format_rule.py @@ -0,0 +1,64 @@ +# 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, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.heatgrid_text_format_match import HeatgridTextFormatMatch + from datadog_api_client.v1.model.heatgrid_text_format_replace import HeatgridTextFormatReplace + from datadog_api_client.v1.model.heatgrid_text_format_replace_all import HeatgridTextFormatReplaceAll + from datadog_api_client.v1.model.heatgrid_text_format_replace_substring import HeatgridTextFormatReplaceSubstring + + +class HeatgridTextFormatRule(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.heatgrid_text_format_match import HeatgridTextFormatMatch + from datadog_api_client.v1.model.heatgrid_text_format_replace import HeatgridTextFormatReplace + + return { + "match": (HeatgridTextFormatMatch,), + "replace": (HeatgridTextFormatReplace,), + } + + attribute_map = { + "match": "match", + "replace": "replace", + } + + def __init__( + self_, + match: HeatgridTextFormatMatch, + replace: Union[ + HeatgridTextFormatReplace, HeatgridTextFormatReplaceAll, HeatgridTextFormatReplaceSubstring, UnsetType + ] = unset, + **kwargs, + ): + """ + A rule for matching and optionally replacing a group label. + + :param match: Match a group label against a string. + :type match: HeatgridTextFormatMatch + + :param replace: Replace all or part of a matching group label. + :type replace: HeatgridTextFormatReplace, optional + """ + if replace is not unset: + kwargs["replace"] = replace + super().__init__(kwargs) + + self_.match = match diff --git a/src/datadog_api_client/v1/model/heatgrid_widget_definition.py b/src/datadog_api_client/v1/model/heatgrid_widget_definition.py index 4786bdbef2..dfb7ed6f82 100644 --- a/src/datadog_api_client/v1/model/heatgrid_widget_definition.py +++ b/src/datadog_api_client/v1/model/heatgrid_widget_definition.py @@ -120,7 +120,7 @@ def __init__( :param description: Description of the widget. :type description: str, optional - :param label_column: Configuration of the group label column. + :param label_column: Configuration of the group label column. Its width is sized automatically when omitted. :type label_column: HeatgridLabelColumn, optional :param legend: Legend configuration for the heatgrid widget. diff --git a/src/datadog_api_client/v1/model/widget_definition.py b/src/datadog_api_client/v1/model/widget_definition.py index ed44323ac3..b1c3d7d07a 100644 --- a/src/datadog_api_client/v1/model/widget_definition.py +++ b/src/datadog_api_client/v1/model/widget_definition.py @@ -135,7 +135,7 @@ def __init__(self, **kwargs): :param widgets: List of widget groups. :type widgets: [Widget] - :param label_column: Configuration of the group label column. + :param label_column: Configuration of the group label column. Its width is sized automatically when omitted. :type label_column: HeatgridLabelColumn, optional :param legend: Legend configuration for the heatgrid widget. diff --git a/src/datadog_api_client/v1/models/__init__.py b/src/datadog_api_client/v1/models/__init__.py index a5576c273b..135ebf6b1f 100644 --- a/src/datadog_api_client/v1/models/__init__.py +++ b/src/datadog_api_client/v1/models/__init__.py @@ -290,6 +290,16 @@ 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_text_format_match import HeatgridTextFormatMatch +from datadog_api_client.v1.model.heatgrid_text_format_match_type import HeatgridTextFormatMatchType +from datadog_api_client.v1.model.heatgrid_text_format_replace import HeatgridTextFormatReplace +from datadog_api_client.v1.model.heatgrid_text_format_replace_all import HeatgridTextFormatReplaceAll +from datadog_api_client.v1.model.heatgrid_text_format_replace_all_type import HeatgridTextFormatReplaceAllType +from datadog_api_client.v1.model.heatgrid_text_format_replace_substring import HeatgridTextFormatReplaceSubstring +from datadog_api_client.v1.model.heatgrid_text_format_replace_substring_type import ( + HeatgridTextFormatReplaceSubstringType, +) +from datadog_api_client.v1.model.heatgrid_text_format_rule import HeatgridTextFormatRule 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 @@ -1785,6 +1795,14 @@ "HeatgridSortByValue", "HeatgridSortByValueProperty", "HeatgridSortOrder", + "HeatgridTextFormatMatch", + "HeatgridTextFormatMatchType", + "HeatgridTextFormatReplace", + "HeatgridTextFormatReplaceAll", + "HeatgridTextFormatReplaceAllType", + "HeatgridTextFormatReplaceSubstring", + "HeatgridTextFormatReplaceSubstringType", + "HeatgridTextFormatRule", "HeatgridWidgetDefinition", "HeatgridWidgetDefinitionType", "HeatgridWidgetFormula", diff --git a/tests/generated-test/test-runner-data/manifest.json b/tests/generated-test/test-runner-data/manifest.json index 76efa3cef5..ec62496d58 100644 --- a/tests/generated-test/test-runner-data/manifest.json +++ b/tests/generated-test/test-runner-data/manifest.json @@ -168,6 +168,13 @@ "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-bin-labels-and-formatted-row-labels.json", + "scenario": "Create a heatgrid widget with bin labels and formatted row labels", + "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-bin-labels-and-formatted-row-labels.json b/tests/generated-test/test-runner-data/v1/dashboards/create-a-heatgrid-widget-with-bin-labels-and-formatted-row-labels.json new file mode 100644 index 0000000000..57b69d1b2e --- /dev/null +++ b/tests/generated-test/test-runner-data/v1/dashboards/create-a-heatgrid-widget-with-bin-labels-and-formatted-row-labels.json @@ -0,0 +1,100 @@ +{ + "api": "Dashboards", + "expected_status": 200, + "feature": "Dashboards", + "id": "v1/Dashboards/Create a heatgrid widget with bin labels and formatted row labels", + "operation_id": "CreateDashboard", + "request": { + "body": { + "schema": { + "format": null, + "ref": "Dashboard", + "type": "object" + }, + "source": "dashboards_json_payload/heatgrid_text_formats_widget.json", + "value": { + "layout_type": "ordered", + "title": "{{ unique }}", + "widgets": [ + { + "definition": { + "color": { + "bins": [ + { + "color": "#00FF00", + "label": "Normal" + }, + { + "color": "#FF0000", + "label": "High", + "lower_bound": 80 + } + ], + "mode": "discrete", + "source": "custom" + }, + "label_column": { + "text_formats": [ + { + "match": { + "type": "starts_with", + "value": "api-" + }, + "replace": { + "substring": "api-", + "type": "substring", + "with": "" + } + }, + { + "match": { + "type": "is", + "value": "unknown" + }, + "replace": { + "type": "all", + "with": "Other" + } + } + ] + }, + "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 bin labels and formatted row labels", + "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 c11782ed7a..49729f2b37 100644 --- a/tests/generated-test/test-server-data/v1/dashboards.json +++ b/tests/generated-test/test-server-data/v1/dashboards.json @@ -849,7 +849,7 @@ "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\":[]}" + "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\":\"Example Name\",\"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" @@ -885,6 +885,134 @@ "scenario": "Create a heatgrid widget with a preset gradient", "version": "v1" }, + { + "feature": "Dashboards", + "frozen_at": "2026-11-02T20:37:43.231Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "layout_type": "ordered", + "title": "Test-Create_a_heatgrid_widget_with_bin_labels_and_formatted_row_labels-1793651863", + "widgets": [ + { + "definition": { + "color": { + "bins": [ + { + "color": "#00FF00", + "label": "Normal" + }, + { + "color": "#FF0000", + "label": "High", + "lower_bound": 80 + } + ], + "mode": "discrete", + "source": "custom" + }, + "label_column": { + "text_formats": [ + { + "match": { + "type": "starts_with", + "value": "api-" + }, + "replace": { + "substring": "api-", + "type": "substring", + "with": "" + } + }, + { + "match": { + "type": "is", + "value": "unknown" + }, + "replace": { + "type": "all", + "with": "Other" + } + } + ] + }, + "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\":\"6tq-fme-ndk\",\"title\":\"Test-Create_a_heatgrid_widget_with_bin_labels_and_formatted_row_labels-1793651863\",\"description\":null,\"author_handle\":\"test@example.com\",\"author_name\":\"Example Name\",\"layout_type\":\"ordered\",\"url\":\"/dashboard/6tq-fme-ndk/test-createaheatgridwidgetwithbinlabelsandformattedrowlabels-1793651863\",\"template_variables\":null,\"widgets\":[{\"definition\":{\"color\":{\"bins\":[{\"color\":\"#00FF00\",\"label\":\"Normal\"},{\"color\":\"#FF0000\",\"label\":\"High\",\"lower_bound\":80}],\"mode\":\"discrete\",\"source\":\"custom\"},\"label_column\":{\"text_formats\":[{\"match\":{\"type\":\"starts_with\",\"value\":\"api-\"},\"replace\":{\"substring\":\"api-\",\"type\":\"substring\",\"with\":\"\"}},{\"match\":{\"type\":\"is\",\"value\":\"unknown\"},\"replace\":{\"type\":\"all\",\"with\":\"Other\"}}]},\"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\":1095468656102212}],\"notify_list\":null,\"created_at\":\"2026-11-02T20:37:43.411584+00:00\",\"modified_at\":\"2026-11-02T20:37:43.411584+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/6tq-fme-ndk", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"deleted_dashboard_id\":\"6tq-fme-ndk\"}" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "Create a heatgrid widget with bin labels and formatted row labels", + "version": "v1" + }, { "feature": "Dashboards", "frozen_at": "2026-10-08T20:45:29.961Z", @@ -956,7 +1084,7 @@ "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\":[]}" + "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\":\"Example Name\",\"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" @@ -1068,7 +1196,7 @@ "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\":[]}" + "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\":\"Example Name\",\"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" diff --git a/tests/v1/features/dashboards.feature b/tests/v1/features/dashboards.feature index 311dff9a97..22ebf82dcf 100644 --- a/tests/v1/features/dashboards.feature +++ b/tests/v1/features/dashboards.feature @@ -113,6 +113,21 @@ Feature: Dashboards 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 bin labels and formatted row labels + Given new "CreateDashboard" request + And body from file "dashboards_json_payload/heatgrid_text_formats_widget.json" + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.color.bins[0].label" is equal to "Normal" + And the response "widgets[0].definition.color.bins[1].label" is equal to "High" + And the response "widgets[0].definition.label_column" does not have field "width" + And the response "widgets[0].definition.label_column.text_formats[0].match.type" is equal to "starts_with" + And the response "widgets[0].definition.label_column.text_formats[0].replace.type" is equal to "substring" + And the response "widgets[0].definition.label_column.text_formats[0].replace.substring" is equal to "api-" + And the response "widgets[0].definition.label_column.text_formats[1].replace.type" is equal to "all" + And the response "widgets[0].definition.label_column.text_formats[1].replace.with" is equal to "Other" + @team:ddoghq/dashboards-backend Scenario: Create a heatgrid widget with custom discrete thresholds Given new "CreateDashboard" request diff --git a/tests/v1/features/dashboards_json_payload/heatgrid_text_formats_widget.json b/tests/v1/features/dashboards_json_payload/heatgrid_text_formats_widget.json new file mode 100644 index 0000000000..7b8acd2a2d --- /dev/null +++ b/tests/v1/features/dashboards_json_payload/heatgrid_text_formats_widget.json @@ -0,0 +1,48 @@ +{ + "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", "label": "Normal" }, + { "color": "#FF0000", "lower_bound": 80, "label": "High" } + ] + }, + "label_column": { + "text_formats": [ + { + "match": { "type": "starts_with", "value": "api-" }, + "replace": { "type": "substring", "substring": "api-", "with": "" } + }, + { + "match": { "type": "is", "value": "unknown" }, + "replace": { "type": "all", "with": "Other" } + } + ] + } + } + } + ] +}