From 7d86712ac5c0159266dfd818920e188422a96f67 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 28 May 2026 19:38:44 +0000 Subject: [PATCH] Regenerate client from commit 719a584 of spec repo --- .generator/schemas/v1/openapi.yaml | 280 +++++++++++++++++- docs/datadog_api_client.v1.model.rst | 70 +++++ .../dashboards/CreateDashboard_2882802132.py | 94 ++++++ .../v1/model/host_map_widget_definition.py | 2 +- .../host_map_widget_definition_requests.py | 112 ++++++- .../v1/model/host_map_widget_dimension.py | 41 +++ .../v1/model/host_map_widget_formula.py | 72 +++++ .../v1/model/host_map_widget_group_by.py | 43 +++ .../host_map_widget_infrastructure_request.py | 139 +++++++++ ..._map_widget_infrastructure_request_leaf.py | 123 ++++++++ ...get_infrastructure_request_request_type.py | 37 +++ .../host_map_widget_infrastructure_style.py | 64 ++++ .../v1/model/host_map_widget_node_type.py | 44 +++ .../model/host_map_widget_scalar_request.py | 115 +++++++ ...p_widget_scalar_request_response_format.py | 35 +++ src/datadog_api_client/v1/models/__init__.py | 26 ++ ...dashboard_with_hostmap_infra_widget.frozen | 1 + ...w_dashboard_with_hostmap_infra_widget.yaml | 39 +++ tests/v1/features/dashboards.feature | 9 + .../hostmap_infra_widget.json | 60 ++++ 20 files changed, 1401 insertions(+), 5 deletions(-) create mode 100644 examples/v1/dashboards/CreateDashboard_2882802132.py create mode 100644 src/datadog_api_client/v1/model/host_map_widget_dimension.py create mode 100644 src/datadog_api_client/v1/model/host_map_widget_formula.py create mode 100644 src/datadog_api_client/v1/model/host_map_widget_group_by.py create mode 100644 src/datadog_api_client/v1/model/host_map_widget_infrastructure_request.py create mode 100644 src/datadog_api_client/v1/model/host_map_widget_infrastructure_request_leaf.py create mode 100644 src/datadog_api_client/v1/model/host_map_widget_infrastructure_request_request_type.py create mode 100644 src/datadog_api_client/v1/model/host_map_widget_infrastructure_style.py create mode 100644 src/datadog_api_client/v1/model/host_map_widget_node_type.py create mode 100644 src/datadog_api_client/v1/model/host_map_widget_scalar_request.py create mode 100644 src/datadog_api_client/v1/model/host_map_widget_scalar_request_response_format.py create mode 100644 tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_hostmap_infra_widget.frozen create mode 100644 tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_hostmap_infra_widget.yaml create mode 100644 tests/v1/features/dashboards_json_payload/hostmap_infra_widget.json diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 8a0eaeb9d0..2b22002269 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -4581,13 +4581,58 @@ components: - requests type: object HostMapWidgetDefinitionRequests: - description: List of definitions. + description: >- + Query definition for the host map widget. Supports two mutually exclusive formats distinguished by the presence of `request_type`: the legacy metric-based format (`fill`/`size`) and the infrastructure-backed format (`request_type`, `node_type`, `enrichments`). example: {} properties: + child: + $ref: "#/components/schemas/HostMapWidgetInfrastructureRequest" + conditional_formats: + description: List of conditional formatting rules applied to fill values. + items: + $ref: "#/components/schemas/WidgetConditionalFormat" + type: array + enrichments: + description: Metric or event queries joined to the entity set. Each formula specifies a visual dimension. + example: + - formulas: + - dimension: fill + formula: "query1" + queries: + - data_source: metrics + name: "query1" + query: "avg:system.cpu.user{*} by {host}" + response_format: scalar + items: + $ref: "#/components/schemas/HostMapWidgetScalarRequest" + type: array fill: $ref: "#/components/schemas/HostMapRequest" + filter: + description: Filter string for the entity set in tag format (for example, `env:prod`). + example: "env:prod" + type: string + group_by: + description: |- + Defines how entities are grouped into tiles. The ordering of entries implies + the grouping hierarchy. + items: + $ref: "#/components/schemas/HostMapWidgetGroupBy" + type: array + no_group_hosts: + description: Whether to hide entities that have no group assignment. + type: boolean + no_metric_hosts: + description: Whether to hide entities that have no enrichment data. + type: boolean + node_type: + $ref: "#/components/schemas/HostMapWidgetNodeType" + request_type: + $ref: "#/components/schemas/HostMapWidgetInfrastructureRequestRequestType" size: $ref: "#/components/schemas/HostMapRequest" + style: + $ref: "#/components/schemas/HostMapWidgetInfrastructureStyle" type: object HostMapWidgetDefinitionStyle: description: The style to apply to the widget. @@ -4614,6 +4659,239 @@ components: type: string x-enum-varnames: - HOSTMAP + HostMapWidgetDimension: + description: Visual dimension driven by a formula in the infrastructure host map widget. + enum: + - node + - fill + - size + example: node + type: string + x-enum-varnames: + - NODE + - FILL + - SIZE + HostMapWidgetFormula: + description: |- + Formula for the infrastructure host map widget that specifies both the expression + and the visual dimension it populates. + properties: + alias: + description: Expression alias. + example: "my-metric" + type: string + dimension: + $ref: "#/components/schemas/HostMapWidgetDimension" + formula: + description: String expression built from queries, formulas, and functions. + example: "query1" + type: string + number_format: + $ref: "#/components/schemas/WidgetNumberFormat" + required: + - formula + - dimension + type: object + HostMapWidgetGroupBy: + description: Defines a grouping dimension for the infrastructure host map. + properties: + column: + description: Column name from the entity table (for example, `cloud_provider`, `tags`, `labels`). + example: tags + type: string + key: + description: Key within the column for nested attribute types (for example, `service` within `tags`). + example: service + type: string + required: + - column + type: object + HostMapWidgetInfrastructureRequest: + description: |- + Infrastructure-backed request for the host map widget. Supports entity-based + visualization with metric query enrichments, tag-based filtering, flexible grouping, + and hierarchical views. + properties: + child: + $ref: "#/components/schemas/HostMapWidgetInfrastructureRequestLeaf" + description: |- + Optional child request for hierarchical visualization (for example, hosts containing + containers). Maximum one level of nesting. + conditional_formats: + description: List of conditional formatting rules applied to fill values. + items: + $ref: "#/components/schemas/WidgetConditionalFormat" + type: array + enrichments: + description: Metric or event queries joined to the entity set. Each formula specifies a visual dimension. + example: + - formulas: + - dimension: fill + formula: "query1" + queries: + - data_source: metrics + name: "query1" + query: "avg:system.cpu.user{*} by {host}" + response_format: scalar + items: + $ref: "#/components/schemas/HostMapWidgetScalarRequest" + type: array + filter: + description: Filter string for the entity set in tag format (for example, `env:prod`). + example: "env:prod" + type: string + group_by: + description: |- + Defines how entities are grouped into tiles. The ordering of entries implies + the grouping hierarchy. + items: + $ref: "#/components/schemas/HostMapWidgetGroupBy" + type: array + no_group_hosts: + description: Whether to hide entities that have no group assignment. + type: boolean + no_metric_hosts: + description: Whether to hide entities that have no enrichment data. + type: boolean + node_type: + $ref: "#/components/schemas/HostMapWidgetNodeType" + request_type: + $ref: "#/components/schemas/HostMapWidgetInfrastructureRequestRequestType" + style: + $ref: "#/components/schemas/HostMapWidgetInfrastructureStyle" + required: + - request_type + - node_type + - enrichments + type: object + HostMapWidgetInfrastructureRequestLeaf: + description: Infrastructure-backed host map child request (leaf node, no further nesting supported). + properties: + conditional_formats: + description: List of conditional formatting rules applied to fill values. + items: + $ref: "#/components/schemas/WidgetConditionalFormat" + type: array + enrichments: + description: Metric or event queries joined to the entity set. Each formula specifies a visual dimension. + example: + - formulas: + - dimension: fill + formula: "query1" + queries: + - data_source: metrics + name: "query1" + query: "avg:system.cpu.user{*} by {host}" + response_format: scalar + items: + $ref: "#/components/schemas/HostMapWidgetScalarRequest" + type: array + filter: + description: Filter string for the entity set in tag format (for example, `env:prod`). + example: "env:prod" + type: string + group_by: + description: |- + Defines how entities are grouped into tiles. The ordering of entries implies + the grouping hierarchy. + items: + $ref: "#/components/schemas/HostMapWidgetGroupBy" + type: array + no_group_hosts: + description: Whether to hide entities that have no group assignment. + type: boolean + no_metric_hosts: + description: Whether to hide entities that have no enrichment data. + type: boolean + node_type: + $ref: "#/components/schemas/HostMapWidgetNodeType" + request_type: + $ref: "#/components/schemas/HostMapWidgetInfrastructureRequestRequestType" + style: + $ref: "#/components/schemas/HostMapWidgetInfrastructureStyle" + required: + - request_type + - node_type + - enrichments + type: object + HostMapWidgetInfrastructureRequestRequestType: + description: Identifies this as an infrastructure-backed host map request. + enum: + - infrastructure_hostmap + example: infrastructure_hostmap + type: string + x-enum-varnames: + - INFRASTRUCTURE_HOSTMAP + HostMapWidgetInfrastructureStyle: + description: Style configuration for the infrastructure host map. + properties: + fill_max: + description: Maximum value for the fill color scale. Omit to use automatic scaling. + format: double + type: number + fill_min: + description: Minimum value for the fill color scale. Omit to use automatic scaling. + format: double + type: number + palette: + description: Color palette name or alias. + example: hostmap_blues + type: string + palette_flip: + description: Whether to invert the color palette. + type: boolean + type: object + HostMapWidgetNodeType: + description: Which type of infrastructure entity to visualize in the host map. + enum: + - host + - container + - pod + - cluster + example: host + type: string + x-enum-varnames: + - HOST + - CONTAINER + - POD + - CLUSTER + HostMapWidgetScalarRequest: + description: |- + Scalar formula request for the infrastructure host map widget. Each formula specifies + which visual dimension it drives. + properties: + formulas: + description: List of formulas that operate on queries, each assigned to a visual dimension. + example: + - dimension: fill + formula: "query1" + items: + $ref: "#/components/schemas/HostMapWidgetFormula" + type: array + queries: + description: List of queries that can be returned directly or used in formulas. + example: + - data_source: "metrics" + name: "my_query" + query: "avg:system.cpu.user{*}" + items: + $ref: "#/components/schemas/FormulaAndFunctionQueryDefinition" + type: array + response_format: + $ref: "#/components/schemas/HostMapWidgetScalarRequestResponseFormat" + required: + - response_format + - queries + - formulas + type: object + HostMapWidgetScalarRequestResponseFormat: + description: Response format for the scalar formula request. Only `scalar` is supported. + enum: + - scalar + example: scalar + type: string + x-enum-varnames: + - SCALAR HostMeta: description: Metadata associated with your host. properties: diff --git a/docs/datadog_api_client.v1.model.rst b/docs/datadog_api_client.v1.model.rst index 2a5028de22..2f64270889 100644 --- a/docs/datadog_api_client.v1.model.rst +++ b/docs/datadog_api_client.v1.model.rst @@ -1467,6 +1467,76 @@ datadog\_api\_client.v1.model.host\_map\_widget\_definition\_type module :members: :show-inheritance: +datadog\_api\_client.v1.model.host\_map\_widget\_dimension module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.host_map_widget_dimension + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.host\_map\_widget\_formula module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.host_map_widget_formula + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.host\_map\_widget\_group\_by module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.host_map_widget_group_by + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.host\_map\_widget\_infrastructure\_request module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.host_map_widget_infrastructure_request + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.host\_map\_widget\_infrastructure\_request\_leaf module +------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.host_map_widget_infrastructure_request_leaf + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.host\_map\_widget\_infrastructure\_request\_request\_type module +---------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.host_map_widget_infrastructure_request_request_type + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.host\_map\_widget\_infrastructure\_style module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.host_map_widget_infrastructure_style + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.host\_map\_widget\_node\_type module +------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v1.model.host_map_widget_node_type + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.host\_map\_widget\_scalar\_request module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.host_map_widget_scalar_request + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.host\_map\_widget\_scalar\_request\_response\_format module +----------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.host_map_widget_scalar_request_response_format + :members: + :show-inheritance: + datadog\_api\_client.v1.model.host\_meta module ----------------------------------------------- diff --git a/examples/v1/dashboards/CreateDashboard_2882802132.py b/examples/v1/dashboards/CreateDashboard_2882802132.py new file mode 100644 index 0000000000..eb5b418efd --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_2882802132.py @@ -0,0 +1,94 @@ +""" +Create a new dashboard with hostmap infra widget +""" + +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.host_map_widget_definition import HostMapWidgetDefinition +from datadog_api_client.v1.model.host_map_widget_definition_requests import HostMapWidgetDefinitionRequests +from datadog_api_client.v1.model.host_map_widget_definition_type import HostMapWidgetDefinitionType +from datadog_api_client.v1.model.host_map_widget_dimension import HostMapWidgetDimension +from datadog_api_client.v1.model.host_map_widget_formula import HostMapWidgetFormula +from datadog_api_client.v1.model.host_map_widget_group_by import HostMapWidgetGroupBy +from datadog_api_client.v1.model.host_map_widget_infrastructure_request_request_type import ( + HostMapWidgetInfrastructureRequestRequestType, +) +from datadog_api_client.v1.model.host_map_widget_infrastructure_style import HostMapWidgetInfrastructureStyle +from datadog_api_client.v1.model.host_map_widget_node_type import HostMapWidgetNodeType +from datadog_api_client.v1.model.host_map_widget_scalar_request import HostMapWidgetScalarRequest +from datadog_api_client.v1.model.host_map_widget_scalar_request_response_format import ( + HostMapWidgetScalarRequestResponseFormat, +) +from datadog_api_client.v1.model.widget import Widget +from datadog_api_client.v1.model.widget_layout import WidgetLayout +from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign + +body = Dashboard( + title="Example-Dashboard", + description=None, + widgets=[ + Widget( + layout=WidgetLayout( + x=0, + y=0, + width=47, + height=22, + ), + definition=HostMapWidgetDefinition( + title="", + title_size="16", + title_align=WidgetTextAlign.LEFT, + type=HostMapWidgetDefinitionType.HOSTMAP, + requests=HostMapWidgetDefinitionRequests( + request_type=HostMapWidgetInfrastructureRequestRequestType.INFRASTRUCTURE_HOSTMAP, + node_type=HostMapWidgetNodeType.HOST, + filter="env:prod", + group_by=[ + HostMapWidgetGroupBy( + column="tags", + key="service", + ), + ], + enrichments=[ + HostMapWidgetScalarRequest( + response_format=HostMapWidgetScalarRequestResponseFormat.SCALAR, + queries=[ + FormulaAndFunctionMetricQueryDefinition( + data_source=FormulaAndFunctionMetricDataSource.METRICS, + name="query1", + query="avg:system.cpu.user{*} by {host}", + ), + ], + formulas=[ + HostMapWidgetFormula( + formula="query1", + dimension=HostMapWidgetDimension.FILL, + ), + ], + ), + ], + style=HostMapWidgetInfrastructureStyle( + palette="green_to_orange", + palette_flip=False, + ), + ), + ), + ), + ], + template_variables=[], + layout_type=DashboardLayoutType.FREE, + notify_list=[], +) + +configuration = Configuration() +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/host_map_widget_definition.py b/src/datadog_api_client/v1/model/host_map_widget_definition.py index 3ff84fe3f8..43b8f9a205 100644 --- a/src/datadog_api_client/v1/model/host_map_widget_definition.py +++ b/src/datadog_api_client/v1/model/host_map_widget_definition.py @@ -108,7 +108,7 @@ def __init__( :param notes: Notes on the title. :type notes: str, optional - :param requests: List of definitions. + :param requests: Query definition for the host map widget. Supports two mutually exclusive formats distinguished by the presence of ``request_type`` : the legacy metric-based format ( ``fill`` / ``size`` ) and the infrastructure-backed format ( ``request_type`` , ``node_type`` , ``enrichments`` ). :type requests: HostMapWidgetDefinitionRequests :param scope: List of tags used to filter the map. diff --git a/src/datadog_api_client/v1/model/host_map_widget_definition_requests.py b/src/datadog_api_client/v1/model/host_map_widget_definition_requests.py index f0522c878b..a0b7df51a5 100644 --- a/src/datadog_api_client/v1/model/host_map_widget_definition_requests.py +++ b/src/datadog_api_client/v1/model/host_map_widget_definition_requests.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union, TYPE_CHECKING +from typing import List, Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, @@ -14,38 +14,144 @@ if TYPE_CHECKING: + from datadog_api_client.v1.model.host_map_widget_infrastructure_request import HostMapWidgetInfrastructureRequest + from datadog_api_client.v1.model.widget_conditional_format import WidgetConditionalFormat + from datadog_api_client.v1.model.host_map_widget_scalar_request import HostMapWidgetScalarRequest from datadog_api_client.v1.model.host_map_request import HostMapRequest + from datadog_api_client.v1.model.host_map_widget_group_by import HostMapWidgetGroupBy + from datadog_api_client.v1.model.host_map_widget_node_type import HostMapWidgetNodeType + from datadog_api_client.v1.model.host_map_widget_infrastructure_request_request_type import ( + HostMapWidgetInfrastructureRequestRequestType, + ) + from datadog_api_client.v1.model.host_map_widget_infrastructure_style import HostMapWidgetInfrastructureStyle class HostMapWidgetDefinitionRequests(ModelNormal): @cached_property def openapi_types(_): + from datadog_api_client.v1.model.host_map_widget_infrastructure_request import ( + HostMapWidgetInfrastructureRequest, + ) + from datadog_api_client.v1.model.widget_conditional_format import WidgetConditionalFormat + from datadog_api_client.v1.model.host_map_widget_scalar_request import HostMapWidgetScalarRequest from datadog_api_client.v1.model.host_map_request import HostMapRequest + from datadog_api_client.v1.model.host_map_widget_group_by import HostMapWidgetGroupBy + from datadog_api_client.v1.model.host_map_widget_node_type import HostMapWidgetNodeType + from datadog_api_client.v1.model.host_map_widget_infrastructure_request_request_type import ( + HostMapWidgetInfrastructureRequestRequestType, + ) + from datadog_api_client.v1.model.host_map_widget_infrastructure_style import HostMapWidgetInfrastructureStyle return { + "child": (HostMapWidgetInfrastructureRequest,), + "conditional_formats": ([WidgetConditionalFormat],), + "enrichments": ([HostMapWidgetScalarRequest],), "fill": (HostMapRequest,), + "filter": (str,), + "group_by": ([HostMapWidgetGroupBy],), + "no_group_hosts": (bool,), + "no_metric_hosts": (bool,), + "node_type": (HostMapWidgetNodeType,), + "request_type": (HostMapWidgetInfrastructureRequestRequestType,), "size": (HostMapRequest,), + "style": (HostMapWidgetInfrastructureStyle,), } attribute_map = { + "child": "child", + "conditional_formats": "conditional_formats", + "enrichments": "enrichments", "fill": "fill", + "filter": "filter", + "group_by": "group_by", + "no_group_hosts": "no_group_hosts", + "no_metric_hosts": "no_metric_hosts", + "node_type": "node_type", + "request_type": "request_type", "size": "size", + "style": "style", } def __init__( - self_, fill: Union[HostMapRequest, UnsetType] = unset, size: Union[HostMapRequest, UnsetType] = unset, **kwargs + self_, + child: Union[HostMapWidgetInfrastructureRequest, UnsetType] = unset, + conditional_formats: Union[List[WidgetConditionalFormat], UnsetType] = unset, + enrichments: Union[List[HostMapWidgetScalarRequest], UnsetType] = unset, + fill: Union[HostMapRequest, UnsetType] = unset, + filter: Union[str, UnsetType] = unset, + group_by: Union[List[HostMapWidgetGroupBy], UnsetType] = unset, + no_group_hosts: Union[bool, UnsetType] = unset, + no_metric_hosts: Union[bool, UnsetType] = unset, + node_type: Union[HostMapWidgetNodeType, UnsetType] = unset, + request_type: Union[HostMapWidgetInfrastructureRequestRequestType, UnsetType] = unset, + size: Union[HostMapRequest, UnsetType] = unset, + style: Union[HostMapWidgetInfrastructureStyle, UnsetType] = unset, + **kwargs, ): """ - List of definitions. + Query definition for the host map widget. Supports two mutually exclusive formats distinguished by the presence of ``request_type`` : the legacy metric-based format ( ``fill`` / ``size`` ) and the infrastructure-backed format ( ``request_type`` , ``node_type`` , ``enrichments`` ). + + :param child: Infrastructure-backed request for the host map widget. Supports entity-based + visualization with metric query enrichments, tag-based filtering, flexible grouping, + and hierarchical views. + :type child: HostMapWidgetInfrastructureRequest, optional + + :param conditional_formats: List of conditional formatting rules applied to fill values. + :type conditional_formats: [WidgetConditionalFormat], optional + + :param enrichments: Metric or event queries joined to the entity set. Each formula specifies a visual dimension. + :type enrichments: [HostMapWidgetScalarRequest], optional :param fill: Updated host map. :type fill: HostMapRequest, optional + :param filter: Filter string for the entity set in tag format (for example, ``env:prod`` ). + :type filter: str, optional + + :param group_by: Defines how entities are grouped into tiles. The ordering of entries implies + the grouping hierarchy. + :type group_by: [HostMapWidgetGroupBy], optional + + :param no_group_hosts: Whether to hide entities that have no group assignment. + :type no_group_hosts: bool, optional + + :param no_metric_hosts: Whether to hide entities that have no enrichment data. + :type no_metric_hosts: bool, optional + + :param node_type: Which type of infrastructure entity to visualize in the host map. + :type node_type: HostMapWidgetNodeType, optional + + :param request_type: Identifies this as an infrastructure-backed host map request. + :type request_type: HostMapWidgetInfrastructureRequestRequestType, optional + :param size: Updated host map. :type size: HostMapRequest, optional + + :param style: Style configuration for the infrastructure host map. + :type style: HostMapWidgetInfrastructureStyle, optional """ + if child is not unset: + kwargs["child"] = child + if conditional_formats is not unset: + kwargs["conditional_formats"] = conditional_formats + if enrichments is not unset: + kwargs["enrichments"] = enrichments if fill is not unset: kwargs["fill"] = fill + if filter is not unset: + kwargs["filter"] = filter + if group_by is not unset: + kwargs["group_by"] = group_by + if no_group_hosts is not unset: + kwargs["no_group_hosts"] = no_group_hosts + if no_metric_hosts is not unset: + kwargs["no_metric_hosts"] = no_metric_hosts + if node_type is not unset: + kwargs["node_type"] = node_type + if request_type is not unset: + kwargs["request_type"] = request_type if size is not unset: kwargs["size"] = size + if style is not unset: + kwargs["style"] = style super().__init__(kwargs) diff --git a/src/datadog_api_client/v1/model/host_map_widget_dimension.py b/src/datadog_api_client/v1/model/host_map_widget_dimension.py new file mode 100644 index 0000000000..6a84462b67 --- /dev/null +++ b/src/datadog_api_client/v1/model/host_map_widget_dimension.py @@ -0,0 +1,41 @@ +# 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 HostMapWidgetDimension(ModelSimple): + """ + Visual dimension driven by a formula in the infrastructure host map widget. + + :param value: Must be one of ["node", "fill", "size"]. + :type value: str + """ + + allowed_values = { + "node", + "fill", + "size", + } + NODE: ClassVar["HostMapWidgetDimension"] + FILL: ClassVar["HostMapWidgetDimension"] + SIZE: ClassVar["HostMapWidgetDimension"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +HostMapWidgetDimension.NODE = HostMapWidgetDimension("node") +HostMapWidgetDimension.FILL = HostMapWidgetDimension("fill") +HostMapWidgetDimension.SIZE = HostMapWidgetDimension("size") diff --git a/src/datadog_api_client/v1/model/host_map_widget_formula.py b/src/datadog_api_client/v1/model/host_map_widget_formula.py new file mode 100644 index 0000000000..51dcc094a6 --- /dev/null +++ b/src/datadog_api_client/v1/model/host_map_widget_formula.py @@ -0,0 +1,72 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 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.host_map_widget_dimension import HostMapWidgetDimension + from datadog_api_client.v1.model.widget_number_format import WidgetNumberFormat + + +class HostMapWidgetFormula(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.host_map_widget_dimension import HostMapWidgetDimension + from datadog_api_client.v1.model.widget_number_format import WidgetNumberFormat + + return { + "alias": (str,), + "dimension": (HostMapWidgetDimension,), + "formula": (str,), + "number_format": (WidgetNumberFormat,), + } + + attribute_map = { + "alias": "alias", + "dimension": "dimension", + "formula": "formula", + "number_format": "number_format", + } + + def __init__( + self_, + dimension: HostMapWidgetDimension, + formula: str, + alias: Union[str, UnsetType] = unset, + number_format: Union[WidgetNumberFormat, UnsetType] = unset, + **kwargs, + ): + """ + Formula for the infrastructure host map widget that specifies both the expression + and the visual dimension it populates. + + :param alias: Expression alias. + :type alias: str, optional + + :param dimension: Visual dimension driven by a formula in the infrastructure host map widget. + :type dimension: HostMapWidgetDimension + + :param formula: String expression built from queries, formulas, and functions. + :type formula: str + + :param number_format: Number format options for the widget. + :type number_format: WidgetNumberFormat, optional + """ + if alias is not unset: + kwargs["alias"] = alias + if number_format is not unset: + kwargs["number_format"] = number_format + super().__init__(kwargs) + + self_.dimension = dimension + self_.formula = formula diff --git a/src/datadog_api_client/v1/model/host_map_widget_group_by.py b/src/datadog_api_client/v1/model/host_map_widget_group_by.py new file mode 100644 index 0000000000..24dd7409bf --- /dev/null +++ b/src/datadog_api_client/v1/model/host_map_widget_group_by.py @@ -0,0 +1,43 @@ +# 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 HostMapWidgetGroupBy(ModelNormal): + @cached_property + def openapi_types(_): + return { + "column": (str,), + "key": (str,), + } + + attribute_map = { + "column": "column", + "key": "key", + } + + def __init__(self_, column: str, key: Union[str, UnsetType] = unset, **kwargs): + """ + Defines a grouping dimension for the infrastructure host map. + + :param column: Column name from the entity table (for example, ``cloud_provider`` , ``tags`` , ``labels`` ). + :type column: str + + :param key: Key within the column for nested attribute types (for example, ``service`` within ``tags`` ). + :type key: str, optional + """ + if key is not unset: + kwargs["key"] = key + super().__init__(kwargs) + + self_.column = column diff --git a/src/datadog_api_client/v1/model/host_map_widget_infrastructure_request.py b/src/datadog_api_client/v1/model/host_map_widget_infrastructure_request.py new file mode 100644 index 0000000000..8e46794c14 --- /dev/null +++ b/src/datadog_api_client/v1/model/host_map_widget_infrastructure_request.py @@ -0,0 +1,139 @@ +# 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.host_map_widget_infrastructure_request_leaf import ( + HostMapWidgetInfrastructureRequestLeaf, + ) + from datadog_api_client.v1.model.widget_conditional_format import WidgetConditionalFormat + from datadog_api_client.v1.model.host_map_widget_scalar_request import HostMapWidgetScalarRequest + from datadog_api_client.v1.model.host_map_widget_group_by import HostMapWidgetGroupBy + from datadog_api_client.v1.model.host_map_widget_node_type import HostMapWidgetNodeType + from datadog_api_client.v1.model.host_map_widget_infrastructure_request_request_type import ( + HostMapWidgetInfrastructureRequestRequestType, + ) + from datadog_api_client.v1.model.host_map_widget_infrastructure_style import HostMapWidgetInfrastructureStyle + + +class HostMapWidgetInfrastructureRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.host_map_widget_infrastructure_request_leaf import ( + HostMapWidgetInfrastructureRequestLeaf, + ) + from datadog_api_client.v1.model.widget_conditional_format import WidgetConditionalFormat + from datadog_api_client.v1.model.host_map_widget_scalar_request import HostMapWidgetScalarRequest + from datadog_api_client.v1.model.host_map_widget_group_by import HostMapWidgetGroupBy + from datadog_api_client.v1.model.host_map_widget_node_type import HostMapWidgetNodeType + from datadog_api_client.v1.model.host_map_widget_infrastructure_request_request_type import ( + HostMapWidgetInfrastructureRequestRequestType, + ) + from datadog_api_client.v1.model.host_map_widget_infrastructure_style import HostMapWidgetInfrastructureStyle + + return { + "child": (HostMapWidgetInfrastructureRequestLeaf,), + "conditional_formats": ([WidgetConditionalFormat],), + "enrichments": ([HostMapWidgetScalarRequest],), + "filter": (str,), + "group_by": ([HostMapWidgetGroupBy],), + "no_group_hosts": (bool,), + "no_metric_hosts": (bool,), + "node_type": (HostMapWidgetNodeType,), + "request_type": (HostMapWidgetInfrastructureRequestRequestType,), + "style": (HostMapWidgetInfrastructureStyle,), + } + + attribute_map = { + "child": "child", + "conditional_formats": "conditional_formats", + "enrichments": "enrichments", + "filter": "filter", + "group_by": "group_by", + "no_group_hosts": "no_group_hosts", + "no_metric_hosts": "no_metric_hosts", + "node_type": "node_type", + "request_type": "request_type", + "style": "style", + } + + def __init__( + self_, + enrichments: List[HostMapWidgetScalarRequest], + node_type: HostMapWidgetNodeType, + request_type: HostMapWidgetInfrastructureRequestRequestType, + child: Union[HostMapWidgetInfrastructureRequestLeaf, UnsetType] = unset, + conditional_formats: Union[List[WidgetConditionalFormat], UnsetType] = unset, + filter: Union[str, UnsetType] = unset, + group_by: Union[List[HostMapWidgetGroupBy], UnsetType] = unset, + no_group_hosts: Union[bool, UnsetType] = unset, + no_metric_hosts: Union[bool, UnsetType] = unset, + style: Union[HostMapWidgetInfrastructureStyle, UnsetType] = unset, + **kwargs, + ): + """ + Infrastructure-backed request for the host map widget. Supports entity-based + visualization with metric query enrichments, tag-based filtering, flexible grouping, + and hierarchical views. + + :param child: Infrastructure-backed host map child request (leaf node, no further nesting supported). + :type child: HostMapWidgetInfrastructureRequestLeaf, optional + + :param conditional_formats: List of conditional formatting rules applied to fill values. + :type conditional_formats: [WidgetConditionalFormat], optional + + :param enrichments: Metric or event queries joined to the entity set. Each formula specifies a visual dimension. + :type enrichments: [HostMapWidgetScalarRequest] + + :param filter: Filter string for the entity set in tag format (for example, ``env:prod`` ). + :type filter: str, optional + + :param group_by: Defines how entities are grouped into tiles. The ordering of entries implies + the grouping hierarchy. + :type group_by: [HostMapWidgetGroupBy], optional + + :param no_group_hosts: Whether to hide entities that have no group assignment. + :type no_group_hosts: bool, optional + + :param no_metric_hosts: Whether to hide entities that have no enrichment data. + :type no_metric_hosts: bool, optional + + :param node_type: Which type of infrastructure entity to visualize in the host map. + :type node_type: HostMapWidgetNodeType + + :param request_type: Identifies this as an infrastructure-backed host map request. + :type request_type: HostMapWidgetInfrastructureRequestRequestType + + :param style: Style configuration for the infrastructure host map. + :type style: HostMapWidgetInfrastructureStyle, optional + """ + if child is not unset: + kwargs["child"] = child + if conditional_formats is not unset: + kwargs["conditional_formats"] = conditional_formats + if filter is not unset: + kwargs["filter"] = filter + if group_by is not unset: + kwargs["group_by"] = group_by + if no_group_hosts is not unset: + kwargs["no_group_hosts"] = no_group_hosts + if no_metric_hosts is not unset: + kwargs["no_metric_hosts"] = no_metric_hosts + if style is not unset: + kwargs["style"] = style + super().__init__(kwargs) + + self_.enrichments = enrichments + self_.node_type = node_type + self_.request_type = request_type diff --git a/src/datadog_api_client/v1/model/host_map_widget_infrastructure_request_leaf.py b/src/datadog_api_client/v1/model/host_map_widget_infrastructure_request_leaf.py new file mode 100644 index 0000000000..62855b79d0 --- /dev/null +++ b/src/datadog_api_client/v1/model/host_map_widget_infrastructure_request_leaf.py @@ -0,0 +1,123 @@ +# 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.host_map_widget_scalar_request import HostMapWidgetScalarRequest + from datadog_api_client.v1.model.host_map_widget_group_by import HostMapWidgetGroupBy + from datadog_api_client.v1.model.host_map_widget_node_type import HostMapWidgetNodeType + from datadog_api_client.v1.model.host_map_widget_infrastructure_request_request_type import ( + HostMapWidgetInfrastructureRequestRequestType, + ) + from datadog_api_client.v1.model.host_map_widget_infrastructure_style import HostMapWidgetInfrastructureStyle + + +class HostMapWidgetInfrastructureRequestLeaf(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.widget_conditional_format import WidgetConditionalFormat + from datadog_api_client.v1.model.host_map_widget_scalar_request import HostMapWidgetScalarRequest + from datadog_api_client.v1.model.host_map_widget_group_by import HostMapWidgetGroupBy + from datadog_api_client.v1.model.host_map_widget_node_type import HostMapWidgetNodeType + from datadog_api_client.v1.model.host_map_widget_infrastructure_request_request_type import ( + HostMapWidgetInfrastructureRequestRequestType, + ) + from datadog_api_client.v1.model.host_map_widget_infrastructure_style import HostMapWidgetInfrastructureStyle + + return { + "conditional_formats": ([WidgetConditionalFormat],), + "enrichments": ([HostMapWidgetScalarRequest],), + "filter": (str,), + "group_by": ([HostMapWidgetGroupBy],), + "no_group_hosts": (bool,), + "no_metric_hosts": (bool,), + "node_type": (HostMapWidgetNodeType,), + "request_type": (HostMapWidgetInfrastructureRequestRequestType,), + "style": (HostMapWidgetInfrastructureStyle,), + } + + attribute_map = { + "conditional_formats": "conditional_formats", + "enrichments": "enrichments", + "filter": "filter", + "group_by": "group_by", + "no_group_hosts": "no_group_hosts", + "no_metric_hosts": "no_metric_hosts", + "node_type": "node_type", + "request_type": "request_type", + "style": "style", + } + + def __init__( + self_, + enrichments: List[HostMapWidgetScalarRequest], + node_type: HostMapWidgetNodeType, + request_type: HostMapWidgetInfrastructureRequestRequestType, + conditional_formats: Union[List[WidgetConditionalFormat], UnsetType] = unset, + filter: Union[str, UnsetType] = unset, + group_by: Union[List[HostMapWidgetGroupBy], UnsetType] = unset, + no_group_hosts: Union[bool, UnsetType] = unset, + no_metric_hosts: Union[bool, UnsetType] = unset, + style: Union[HostMapWidgetInfrastructureStyle, UnsetType] = unset, + **kwargs, + ): + """ + Infrastructure-backed host map child request (leaf node, no further nesting supported). + + :param conditional_formats: List of conditional formatting rules applied to fill values. + :type conditional_formats: [WidgetConditionalFormat], optional + + :param enrichments: Metric or event queries joined to the entity set. Each formula specifies a visual dimension. + :type enrichments: [HostMapWidgetScalarRequest] + + :param filter: Filter string for the entity set in tag format (for example, ``env:prod`` ). + :type filter: str, optional + + :param group_by: Defines how entities are grouped into tiles. The ordering of entries implies + the grouping hierarchy. + :type group_by: [HostMapWidgetGroupBy], optional + + :param no_group_hosts: Whether to hide entities that have no group assignment. + :type no_group_hosts: bool, optional + + :param no_metric_hosts: Whether to hide entities that have no enrichment data. + :type no_metric_hosts: bool, optional + + :param node_type: Which type of infrastructure entity to visualize in the host map. + :type node_type: HostMapWidgetNodeType + + :param request_type: Identifies this as an infrastructure-backed host map request. + :type request_type: HostMapWidgetInfrastructureRequestRequestType + + :param style: Style configuration for the infrastructure host map. + :type style: HostMapWidgetInfrastructureStyle, optional + """ + if conditional_formats is not unset: + kwargs["conditional_formats"] = conditional_formats + if filter is not unset: + kwargs["filter"] = filter + if group_by is not unset: + kwargs["group_by"] = group_by + if no_group_hosts is not unset: + kwargs["no_group_hosts"] = no_group_hosts + if no_metric_hosts is not unset: + kwargs["no_metric_hosts"] = no_metric_hosts + if style is not unset: + kwargs["style"] = style + super().__init__(kwargs) + + self_.enrichments = enrichments + self_.node_type = node_type + self_.request_type = request_type diff --git a/src/datadog_api_client/v1/model/host_map_widget_infrastructure_request_request_type.py b/src/datadog_api_client/v1/model/host_map_widget_infrastructure_request_request_type.py new file mode 100644 index 0000000000..28eb726cad --- /dev/null +++ b/src/datadog_api_client/v1/model/host_map_widget_infrastructure_request_request_type.py @@ -0,0 +1,37 @@ +# 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 HostMapWidgetInfrastructureRequestRequestType(ModelSimple): + """ + Identifies this as an infrastructure-backed host map request. + + :param value: If omitted defaults to "infrastructure_hostmap". Must be one of ["infrastructure_hostmap"]. + :type value: str + """ + + allowed_values = { + "infrastructure_hostmap", + } + INFRASTRUCTURE_HOSTMAP: ClassVar["HostMapWidgetInfrastructureRequestRequestType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +HostMapWidgetInfrastructureRequestRequestType.INFRASTRUCTURE_HOSTMAP = HostMapWidgetInfrastructureRequestRequestType( + "infrastructure_hostmap" +) diff --git a/src/datadog_api_client/v1/model/host_map_widget_infrastructure_style.py b/src/datadog_api_client/v1/model/host_map_widget_infrastructure_style.py new file mode 100644 index 0000000000..d774baa15c --- /dev/null +++ b/src/datadog_api_client/v1/model/host_map_widget_infrastructure_style.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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class HostMapWidgetInfrastructureStyle(ModelNormal): + @cached_property + def openapi_types(_): + return { + "fill_max": (float,), + "fill_min": (float,), + "palette": (str,), + "palette_flip": (bool,), + } + + attribute_map = { + "fill_max": "fill_max", + "fill_min": "fill_min", + "palette": "palette", + "palette_flip": "palette_flip", + } + + def __init__( + self_, + fill_max: Union[float, UnsetType] = unset, + fill_min: Union[float, UnsetType] = unset, + palette: Union[str, UnsetType] = unset, + palette_flip: Union[bool, UnsetType] = unset, + **kwargs, + ): + """ + Style configuration for the infrastructure host map. + + :param fill_max: Maximum value for the fill color scale. Omit to use automatic scaling. + :type fill_max: float, optional + + :param fill_min: Minimum value for the fill color scale. Omit to use automatic scaling. + :type fill_min: float, optional + + :param palette: Color palette name or alias. + :type palette: str, optional + + :param palette_flip: Whether to invert the color palette. + :type palette_flip: bool, optional + """ + if fill_max is not unset: + kwargs["fill_max"] = fill_max + if fill_min is not unset: + kwargs["fill_min"] = fill_min + if palette is not unset: + kwargs["palette"] = palette + if palette_flip is not unset: + kwargs["palette_flip"] = palette_flip + super().__init__(kwargs) diff --git a/src/datadog_api_client/v1/model/host_map_widget_node_type.py b/src/datadog_api_client/v1/model/host_map_widget_node_type.py new file mode 100644 index 0000000000..cc7abfab12 --- /dev/null +++ b/src/datadog_api_client/v1/model/host_map_widget_node_type.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 HostMapWidgetNodeType(ModelSimple): + """ + Which type of infrastructure entity to visualize in the host map. + + :param value: Must be one of ["host", "container", "pod", "cluster"]. + :type value: str + """ + + allowed_values = { + "host", + "container", + "pod", + "cluster", + } + HOST: ClassVar["HostMapWidgetNodeType"] + CONTAINER: ClassVar["HostMapWidgetNodeType"] + POD: ClassVar["HostMapWidgetNodeType"] + CLUSTER: ClassVar["HostMapWidgetNodeType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +HostMapWidgetNodeType.HOST = HostMapWidgetNodeType("host") +HostMapWidgetNodeType.CONTAINER = HostMapWidgetNodeType("container") +HostMapWidgetNodeType.POD = HostMapWidgetNodeType("pod") +HostMapWidgetNodeType.CLUSTER = HostMapWidgetNodeType("cluster") diff --git a/src/datadog_api_client/v1/model/host_map_widget_scalar_request.py b/src/datadog_api_client/v1/model/host_map_widget_scalar_request.py new file mode 100644 index 0000000000..2c9129874e --- /dev/null +++ b/src/datadog_api_client/v1/model/host_map_widget_scalar_request.py @@ -0,0 +1,115 @@ +# 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.host_map_widget_formula import HostMapWidgetFormula + from datadog_api_client.v1.model.formula_and_function_query_definition import FormulaAndFunctionQueryDefinition + from datadog_api_client.v1.model.host_map_widget_scalar_request_response_format import ( + HostMapWidgetScalarRequestResponseFormat, + ) + 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 HostMapWidgetScalarRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.host_map_widget_formula import HostMapWidgetFormula + from datadog_api_client.v1.model.formula_and_function_query_definition import FormulaAndFunctionQueryDefinition + from datadog_api_client.v1.model.host_map_widget_scalar_request_response_format import ( + HostMapWidgetScalarRequestResponseFormat, + ) + + return { + "formulas": ([HostMapWidgetFormula],), + "queries": ([FormulaAndFunctionQueryDefinition],), + "response_format": (HostMapWidgetScalarRequestResponseFormat,), + } + + attribute_map = { + "formulas": "formulas", + "queries": "queries", + "response_format": "response_format", + } + + def __init__( + self_, + formulas: List[HostMapWidgetFormula], + queries: List[ + Union[ + FormulaAndFunctionQueryDefinition, + FormulaAndFunctionMetricQueryDefinition, + FormulaAndFunctionEventQueryDefinition, + FormulaAndFunctionProcessQueryDefinition, + FormulaAndFunctionApmDependencyStatsQueryDefinition, + FormulaAndFunctionApmResourceStatsQueryDefinition, + FormulaAndFunctionApmMetricsQueryDefinition, + FormulaAndFunctionSLOQueryDefinition, + FormulaAndFunctionCloudCostQueryDefinition, + FormulaAndFunctionProductAnalyticsExtendedQueryDefinition, + FormulaAndFunctionUserJourneyQueryDefinition, + FormulaAndFunctionRetentionQueryDefinition, + ] + ], + response_format: HostMapWidgetScalarRequestResponseFormat, + **kwargs, + ): + """ + Scalar formula request for the infrastructure host map widget. Each formula specifies + which visual dimension it drives. + + :param formulas: List of formulas that operate on queries, each assigned to a visual dimension. + :type formulas: [HostMapWidgetFormula] + + :param queries: List of queries that can be returned directly or used in formulas. + :type queries: [FormulaAndFunctionQueryDefinition] + + :param response_format: Response format for the scalar formula request. Only ``scalar`` is supported. + :type response_format: HostMapWidgetScalarRequestResponseFormat + """ + super().__init__(kwargs) + + self_.formulas = formulas + self_.queries = queries + self_.response_format = response_format diff --git a/src/datadog_api_client/v1/model/host_map_widget_scalar_request_response_format.py b/src/datadog_api_client/v1/model/host_map_widget_scalar_request_response_format.py new file mode 100644 index 0000000000..7eefb9f88b --- /dev/null +++ b/src/datadog_api_client/v1/model/host_map_widget_scalar_request_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 HostMapWidgetScalarRequestResponseFormat(ModelSimple): + """ + Response format for the scalar formula request. Only `scalar` is supported. + + :param value: If omitted defaults to "scalar". Must be one of ["scalar"]. + :type value: str + """ + + allowed_values = { + "scalar", + } + SCALAR: ClassVar["HostMapWidgetScalarRequestResponseFormat"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +HostMapWidgetScalarRequestResponseFormat.SCALAR = HostMapWidgetScalarRequestResponseFormat("scalar") diff --git a/src/datadog_api_client/v1/models/__init__.py b/src/datadog_api_client/v1/models/__init__.py index 2ac857c57c..bd2b2da548 100644 --- a/src/datadog_api_client/v1/models/__init__.py +++ b/src/datadog_api_client/v1/models/__init__.py @@ -260,6 +260,22 @@ from datadog_api_client.v1.model.host_map_widget_definition_requests import HostMapWidgetDefinitionRequests from datadog_api_client.v1.model.host_map_widget_definition_style import HostMapWidgetDefinitionStyle from datadog_api_client.v1.model.host_map_widget_definition_type import HostMapWidgetDefinitionType +from datadog_api_client.v1.model.host_map_widget_dimension import HostMapWidgetDimension +from datadog_api_client.v1.model.host_map_widget_formula import HostMapWidgetFormula +from datadog_api_client.v1.model.host_map_widget_group_by import HostMapWidgetGroupBy +from datadog_api_client.v1.model.host_map_widget_infrastructure_request import HostMapWidgetInfrastructureRequest +from datadog_api_client.v1.model.host_map_widget_infrastructure_request_leaf import ( + HostMapWidgetInfrastructureRequestLeaf, +) +from datadog_api_client.v1.model.host_map_widget_infrastructure_request_request_type import ( + HostMapWidgetInfrastructureRequestRequestType, +) +from datadog_api_client.v1.model.host_map_widget_infrastructure_style import HostMapWidgetInfrastructureStyle +from datadog_api_client.v1.model.host_map_widget_node_type import HostMapWidgetNodeType +from datadog_api_client.v1.model.host_map_widget_scalar_request import HostMapWidgetScalarRequest +from datadog_api_client.v1.model.host_map_widget_scalar_request_response_format import ( + HostMapWidgetScalarRequestResponseFormat, +) from datadog_api_client.v1.model.host_meta import HostMeta from datadog_api_client.v1.model.host_meta_install_method import HostMetaInstallMethod from datadog_api_client.v1.model.host_metrics import HostMetrics @@ -1585,6 +1601,16 @@ "HostMapWidgetDefinitionRequests", "HostMapWidgetDefinitionStyle", "HostMapWidgetDefinitionType", + "HostMapWidgetDimension", + "HostMapWidgetFormula", + "HostMapWidgetGroupBy", + "HostMapWidgetInfrastructureRequest", + "HostMapWidgetInfrastructureRequestLeaf", + "HostMapWidgetInfrastructureRequestRequestType", + "HostMapWidgetInfrastructureStyle", + "HostMapWidgetNodeType", + "HostMapWidgetScalarRequest", + "HostMapWidgetScalarRequestResponseFormat", "HostMeta", "HostMetaInstallMethod", "HostMetrics", diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_hostmap_infra_widget.frozen b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_hostmap_infra_widget.frozen new file mode 100644 index 0000000000..ca27f8a5ef --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_hostmap_infra_widget.frozen @@ -0,0 +1 @@ +2026-05-28T19:18:07.925Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_hostmap_infra_widget.yaml b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_hostmap_infra_widget.yaml new file mode 100644 index 0000000000..9ed84e7385 --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_hostmap_infra_widget.yaml @@ -0,0 +1,39 @@ +interactions: +- request: + body: '{"description":null,"layout_type":"free","notify_list":[],"template_variables":[],"title":"Test-Create_a_new_dashboard_with_hostmap_infra_widget-1779995887","widgets":[{"definition":{"requests":{"enrichments":[{"formulas":[{"dimension":"fill","formula":"query1"}],"queries":[{"data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} + by {host}"}],"response_format":"scalar"}],"filter":"env:prod","group_by":[{"column":"tags","key":"service"}],"node_type":"host","request_type":"infrastructure_hostmap","style":{"palette":"green_to_orange","palette_flip":false}},"title":"","title_align":"left","title_size":"16","type":"hostmap"},"layout":{"height":22,"width":47,"x":0,"y":0}}]}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/dashboard + response: + body: + string: '{"id":"ca3-5na-ti2","title":"Test-Create_a_new_dashboard_with_hostmap_infra_widget-1779995887","description":null,"author_handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","author_name":"CI + Account","layout_type":"free","url":"/dashboard/ca3-5na-ti2/test-createanewdashboardwithhostmapinfrawidget-1779995887","template_variables":[],"widgets":[{"definition":{"requests":{"enrichments":[{"formulas":[{"dimension":"fill","formula":"query1"}],"queries":[{"data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} + by {host}"}],"response_format":"scalar"}],"filter":"env:prod","group_by":[{"column":"tags","key":"service"}],"node_type":"host","request_type":"infrastructure_hostmap","style":{"palette":"green_to_orange","palette_flip":false}},"title":"","title_align":"left","title_size":"16","type":"hostmap"},"layout":{"height":22,"width":47,"x":0,"y":0},"id":7949207519561974}],"notify_list":[],"created_at":"2026-05-28T19:18:08.023029+00:00","modified_at":"2026-05-28T19:18:08.023029+00:00","restricted_roles":[]}' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/ca3-5na-ti2 + response: + body: + string: '{"deleted_dashboard_id":"ca3-5na-ti2"}' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v1/features/dashboards.feature b/tests/v1/features/dashboards.feature index 655b599b89..65c4c044ab 100644 --- a/tests/v1/features/dashboards.feature +++ b/tests/v1/features/dashboards.feature @@ -581,6 +581,15 @@ Feature: Dashboards And the response "widgets[0].definition.xaxis.num_buckets" is equal to 75 And the response "widgets[0].definition.markers" is equal to [{"display_type": "percentile", "value": "50"}, {"display_type": "percentile", "value": "99"}] + @team:DataDog/dashboards-backend + Scenario: Create a new dashboard with hostmap infra widget + Given new "CreateDashboard" request + And body from file "dashboards_json_payload/hostmap_infra_widget.json" + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.type" is equal to "hostmap" + And the response "widgets[0].definition.requests" is equal to {"request_type": "infrastructure_hostmap", "node_type": "host", "filter": "env:prod", "group_by": [{"column": "tags", "key": "service"}], "enrichments": [{"response_format": "scalar", "queries": [{"data_source": "metrics", "name": "query1", "query": "avg:system.cpu.user{*} by {host}"}], "formulas": [{"formula": "query1", "dimension": "fill"}]}], "style": {"palette": "green_to_orange", "palette_flip": false}} + @team:DataDog/dashboards-backend Scenario: Create a new dashboard with hostmap widget Given new "CreateDashboard" request diff --git a/tests/v1/features/dashboards_json_payload/hostmap_infra_widget.json b/tests/v1/features/dashboards_json_payload/hostmap_infra_widget.json new file mode 100644 index 0000000000..5890905638 --- /dev/null +++ b/tests/v1/features/dashboards_json_payload/hostmap_infra_widget.json @@ -0,0 +1,60 @@ +{ + "title":"{{ unique }}", + "description":null, + "widgets":[ + { + "layout":{ + "x":0, + "y":0, + "width":47, + "height":22 + }, + "definition":{ + "title":"", + "title_size":"16", + "title_align":"left", + "type":"hostmap", + "requests":{ + "request_type":"infrastructure_hostmap", + "node_type":"host", + "filter":"env:prod", + "group_by":[ + { + "column":"tags", + "key":"service" + } + ], + "enrichments":[ + { + "response_format":"scalar", + "queries":[ + { + "data_source":"metrics", + "name":"query1", + "query":"avg:system.cpu.user{*} by {host}" + } + ], + "formulas":[ + { + "formula":"query1", + "dimension":"fill" + } + ] + } + ], + "style":{ + "palette":"green_to_orange", + "palette_flip":false + } + } + } + } + ], + "template_variables":[ + + ], + "layout_type":"free", + "notify_list":[ + + ] +}