diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 17fc41e6b2..3f09c0483c 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -22509,11 +22509,274 @@ components: scaling: $ref: "#/components/schemas/ToplistWidgetScaling" type: object + TopologyMapInlineColumnKindScalar: + default: scalar + description: Column of numbers. + enum: + - scalar + example: scalar + type: string + x-enum-varnames: + - SCALAR + TopologyMapInlineColumnKindString: + default: string + description: Column of strings. + enum: + - string + example: string + type: string + x-enum-varnames: + - STRING + TopologyMapInlineData: + additionalProperties: false + description: >- + Static nodes and edges, stored in columns. Within a table, every column must have the same number of values and a unique `id`. + properties: + edges: + $ref: "#/components/schemas/TopologyMapInlineEdgesData" + nodes: + $ref: "#/components/schemas/TopologyMapInlineNodesData" + type: object + TopologyMapInlineEdgeColumn: + additionalProperties: false + description: Column of edge endpoint node IDs. + properties: + id: + $ref: "#/components/schemas/TopologyMapInlineEdgeColumnId" + kind: + $ref: "#/components/schemas/TopologyMapInlineColumnKindString" + values: + description: Node IDs. + example: ["service:web"] + items: + description: Node ID. + type: string + type: array + required: + - kind + - id + - values + type: object + TopologyMapInlineEdgeColumnId: + description: Edge endpoint the column holds. + enum: + - source + - target + example: source + type: string + x-enum-varnames: + - SOURCE + - TARGET + TopologyMapInlineEdgesData: + additionalProperties: false + description: Table of edges, one row per edge. + properties: + columns: + description: Columns of the edges table. Must include one `source` column and one `target` column. + items: + $ref: "#/components/schemas/TopologyMapInlineEdgeColumn" + type: array + required: + - columns + type: object + TopologyMapInlineNodeColumn: + description: Column of the nodes table. + oneOf: + - $ref: "#/components/schemas/TopologyMapInlineNodeIdColumn" + - $ref: "#/components/schemas/TopologyMapInlineNodeStringColumn" + - $ref: "#/components/schemas/TopologyMapInlineNodeValueColumn" + TopologyMapInlineNodeIdColumn: + additionalProperties: false + description: Column of node IDs. + properties: + id: + $ref: "#/components/schemas/TopologyMapInlineNodeIdColumnId" + kind: + $ref: "#/components/schemas/TopologyMapInlineColumnKindString" + values: + description: Node IDs. + example: ["service:web", "service:db"] + items: + description: Node ID. + type: string + type: array + required: + - kind + - id + - values + type: object + TopologyMapInlineNodeIdColumnId: + default: id + description: ID of the node ID column. + enum: + - id + example: id + type: string + x-enum-varnames: + - ID + TopologyMapInlineNodeStringColumn: + additionalProperties: false + description: Column of node text. + properties: + id: + $ref: "#/components/schemas/TopologyMapInlineNodeStringColumnId" + kind: + $ref: "#/components/schemas/TopologyMapInlineColumnKindString" + values: + description: >- + Text for each node. A null `title` shows the node's ID; a null `subtitle` shows no subtitle. + example: ["api-team", null] + items: + description: Text for one node. + nullable: true + type: string + type: array + required: + - kind + - id + - values + type: object + TopologyMapInlineNodeStringColumnId: + description: >- + Node field the column fills. `title` is bold text at the top of the node; `subtitle` is smaller text below it. + enum: + - title + - subtitle + example: title + type: string + x-enum-varnames: + - TITLE + - SUBTITLE + TopologyMapInlineNodeValueColumn: + additionalProperties: false + description: >- + Column of numeric node values. Nodes display non-null values in order of column `id`. + properties: + id: + description: Position of the value in the node, as `values[N]`. The smallest N appears first. + example: "values[0]" + pattern: '^values\[(0|[1-9][0-9]*)\]$' + type: string + kind: + $ref: "#/components/schemas/TopologyMapInlineColumnKindScalar" + meta: + $ref: "#/components/schemas/TopologyMapInlineNodeValueColumnMeta" + values: + description: Value for each node. Null values are not displayed. + example: [1.5, null] + items: + description: Value for one node. + format: double + nullable: true + type: number + type: array + required: + - kind + - id + - values + type: object + TopologyMapInlineNodeValueColumnMeta: + additionalProperties: false + description: Display options for a value column. + properties: + unit: + $ref: "#/components/schemas/NumberFormatUnit" + type: object + TopologyMapInlineNodesData: + additionalProperties: false + description: Table of nodes, one row per node. + properties: + columns: + description: >- + Columns of the nodes table. Must include an `id` column, unless the list is empty (no nodes). + items: + $ref: "#/components/schemas/TopologyMapInlineNodeColumn" + type: array + required: + - columns + type: object + TopologyMapLayout: + additionalProperties: false + description: >- + Algorithm that positions nodes and edges. The `hierarchical` layout places nodes in ranks so edges flow in one direction. + properties: + direction: + $ref: "#/components/schemas/TopologyMapLayoutDirection" + type: + $ref: "#/components/schemas/TopologyMapLayoutType" + required: + - type + - direction + type: object + TopologyMapLayoutDirection: + description: >- + Direction of ranks. For example, `top-to-bottom` places first-rank nodes at the top and last-rank nodes at the bottom. + enum: + - top-to-bottom + - bottom-to-top + - left-to-right + - right-to-left + example: top-to-bottom + type: string + x-enum-varnames: + - TOP_TO_BOTTOM + - BOTTOM_TO_TOP + - LEFT_TO_RIGHT + - RIGHT_TO_LEFT + TopologyMapLayoutType: + default: hierarchical + description: Type of layout algorithm. + enum: + - hierarchical + example: hierarchical + type: string + x-enum-varnames: + - HIERARCHICAL TopologyMapWidgetDefinition: description: This widget displays a topology of nodes and edges for different data sources. It replaces the service map widget. oneOf: - $ref: "#/components/schemas/TopologyMapWidgetDefinitionDataStreams" - $ref: "#/components/schemas/TopologyMapWidgetDefinitionServiceMap" + - $ref: "#/components/schemas/TopologyMapWidgetDefinitionCustom" + TopologyMapWidgetDefinitionCustom: + additionalProperties: false + description: >- + Custom topology map widget. Renders nodes and edges from inline `data` and from scalar `requests`. There is one node for each node ID found in `data.nodes`, `data.edges`, and `requests`. When `data` and several requests set the same field on the same node (such as `title` or `values[0]`), the last non-null value wins. + properties: + custom_links: + description: List of custom links. + items: + $ref: "#/components/schemas/WidgetCustomLink" + type: array + data: + $ref: "#/components/schemas/TopologyMapInlineData" + description: + description: The description of the widget. + type: string + layout: + $ref: "#/components/schemas/TopologyMapLayout" + requests: + description: List of scalar requests that supply node data. Can be empty. + items: + $ref: "#/components/schemas/TopologyRequestCustom" + type: array + time: + $ref: "#/components/schemas/WidgetTime" + title: + description: Title of your widget. + type: string + title_align: + $ref: "#/components/schemas/WidgetTextAlign" + title_size: + description: Size of the title. + type: string + type: + $ref: "#/components/schemas/TopologyMapWidgetDefinitionType" + required: + - type + - requests + - layout + type: object TopologyMapWidgetDefinitionDataStreams: additionalProperties: false description: Topology map widget backed by the data streams data source. @@ -22661,6 +22924,87 @@ components: type: string x-enum-varnames: - SERVICE_MAP + TopologyRequestCustom: + additionalProperties: false + description: Scalar request whose result rows become nodes. + properties: + formulas: + description: List of formulas that operate on queries. + items: + $ref: "#/components/schemas/WidgetFormula" + type: array + projection: + $ref: "#/components/schemas/TopologyRequestCustomProjection" + 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/TopologyRequestCustomResponseFormat" + sort: + $ref: "#/components/schemas/WidgetSortBy" + required: + - response_format + - queries + - projection + type: object + TopologyRequestCustomProjection: + additionalProperties: false + description: >- + Mapping from result columns to node fields. Each result row feeds one node. + properties: + dimensions: + description: List of mappings from a result column to a node field. Each `dimension` must be unique. + items: + $ref: "#/components/schemas/TopologyRequestCustomProjectionDimension" + type: array + type: + $ref: "#/components/schemas/TopologyRequestCustomProjectionType" + required: + - type + - dimensions + type: object + TopologyRequestCustomProjectionDimension: + additionalProperties: false + description: Mapping from one result column to one node field. + properties: + column: + description: Column name from the result. Must be a group-by tag key or a formula. + example: service + type: string + dimension: + description: >- + Node field that receives the column's value: `id`, `title`, `subtitle`, or `values[N]` for the value at position N. When `id` is not set, each node's ID is derived from the group-by tags (for example, `env:prod,service:web`). When `title` is not set, the title is the node's ID. When several rows set the same non-`id` field on a node, the last non-null value wins. + example: "values[0]" + pattern: '^(id|title|subtitle|values\[(0|[1-9][0-9]*)\])$' + type: string + required: + - column + - dimension + type: object + TopologyRequestCustomProjectionType: + default: custom_topology_map_node + description: Projection type. Each result row is a node. + enum: + - custom_topology_map_node + example: custom_topology_map_node + type: string + x-enum-varnames: + - CUSTOM_TOPOLOGY_MAP_NODE + TopologyRequestCustomResponseFormat: + default: scalar + description: Response format of a custom topology map request. + enum: + - scalar + example: scalar + type: string + x-enum-varnames: + - SCALAR TopologyRequestDataStreams: description: Request that returns nodes and edges from the data streams data source. properties: diff --git a/examples/v1/dashboards/CreateDashboard_620827773.py b/examples/v1/dashboards/CreateDashboard_620827773.py new file mode 100644 index 0000000000..38f61448e6 --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_620827773.py @@ -0,0 +1,162 @@ +""" +Create a new dashboard with topology_map custom widget +""" + +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_aggregation import FormulaAndFunctionMetricAggregation +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.number_format_unit_canonical import NumberFormatUnitCanonical +from datadog_api_client.v1.model.number_format_unit_scale_type import NumberFormatUnitScaleType +from datadog_api_client.v1.model.topology_map_inline_column_kind_scalar import TopologyMapInlineColumnKindScalar +from datadog_api_client.v1.model.topology_map_inline_column_kind_string import TopologyMapInlineColumnKindString +from datadog_api_client.v1.model.topology_map_inline_data import TopologyMapInlineData +from datadog_api_client.v1.model.topology_map_inline_edge_column import TopologyMapInlineEdgeColumn +from datadog_api_client.v1.model.topology_map_inline_edge_column_id import TopologyMapInlineEdgeColumnId +from datadog_api_client.v1.model.topology_map_inline_edges_data import TopologyMapInlineEdgesData +from datadog_api_client.v1.model.topology_map_inline_node_id_column import TopologyMapInlineNodeIdColumn +from datadog_api_client.v1.model.topology_map_inline_node_id_column_id import TopologyMapInlineNodeIdColumnId +from datadog_api_client.v1.model.topology_map_inline_node_string_column import TopologyMapInlineNodeStringColumn +from datadog_api_client.v1.model.topology_map_inline_node_string_column_id import TopologyMapInlineNodeStringColumnId +from datadog_api_client.v1.model.topology_map_inline_node_value_column import TopologyMapInlineNodeValueColumn +from datadog_api_client.v1.model.topology_map_inline_node_value_column_meta import TopologyMapInlineNodeValueColumnMeta +from datadog_api_client.v1.model.topology_map_inline_nodes_data import TopologyMapInlineNodesData +from datadog_api_client.v1.model.topology_map_layout import TopologyMapLayout +from datadog_api_client.v1.model.topology_map_layout_direction import TopologyMapLayoutDirection +from datadog_api_client.v1.model.topology_map_layout_type import TopologyMapLayoutType +from datadog_api_client.v1.model.topology_map_widget_definition_custom import TopologyMapWidgetDefinitionCustom +from datadog_api_client.v1.model.topology_map_widget_definition_type import TopologyMapWidgetDefinitionType +from datadog_api_client.v1.model.topology_request_custom import TopologyRequestCustom +from datadog_api_client.v1.model.topology_request_custom_projection import TopologyRequestCustomProjection +from datadog_api_client.v1.model.topology_request_custom_projection_dimension import ( + TopologyRequestCustomProjectionDimension, +) +from datadog_api_client.v1.model.topology_request_custom_projection_type import TopologyRequestCustomProjectionType +from datadog_api_client.v1.model.topology_request_custom_response_format import TopologyRequestCustomResponseFormat +from datadog_api_client.v1.model.widget import Widget +from datadog_api_client.v1.model.widget_formula import WidgetFormula +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="", + widgets=[ + Widget( + layout=WidgetLayout( + x=0, + y=0, + width=47, + height=15, + ), + definition=TopologyMapWidgetDefinitionCustom( + title="", + title_size="16", + title_align=WidgetTextAlign.LEFT, + type=TopologyMapWidgetDefinitionType.TOPOLOGY_MAP, + layout=TopologyMapLayout( + type=TopologyMapLayoutType.HIERARCHICAL, + direction=TopologyMapLayoutDirection.LEFT_TO_RIGHT, + ), + data=TopologyMapInlineData( + nodes=TopologyMapInlineNodesData( + columns=[ + TopologyMapInlineNodeIdColumn( + kind=TopologyMapInlineColumnKindString.STRING, + id=TopologyMapInlineNodeIdColumnId.ID, + values=[ + "service:web", + "service:db", + ], + ), + TopologyMapInlineNodeStringColumn( + kind=TopologyMapInlineColumnKindString.STRING, + id=TopologyMapInlineNodeStringColumnId.SUBTITLE, + values=[ + "api-team", + None, + ], + ), + TopologyMapInlineNodeValueColumn( + kind=TopologyMapInlineColumnKindScalar.SCALAR, + id="values[1]", + values=[ + 1.5, + None, + ], + meta=TopologyMapInlineNodeValueColumnMeta( + unit=NumberFormatUnitCanonical( + type=NumberFormatUnitScaleType.CANONICAL_UNIT, + unit_name="second", + ), + ), + ), + ], + ), + edges=TopologyMapInlineEdgesData( + columns=[ + TopologyMapInlineEdgeColumn( + kind=TopologyMapInlineColumnKindString.STRING, + id=TopologyMapInlineEdgeColumnId.SOURCE, + values=[ + "service:web", + ], + ), + TopologyMapInlineEdgeColumn( + kind=TopologyMapInlineColumnKindString.STRING, + id=TopologyMapInlineEdgeColumnId.TARGET, + values=[ + "service:db", + ], + ), + ], + ), + ), + requests=[ + TopologyRequestCustom( + response_format=TopologyRequestCustomResponseFormat.SCALAR, + queries=[ + FormulaAndFunctionMetricQueryDefinition( + data_source=FormulaAndFunctionMetricDataSource.METRICS, + name="a", + query="avg:system.cpu.user{*} by {service}", + aggregator=FormulaAndFunctionMetricAggregation.AVG, + ), + ], + formulas=[ + WidgetFormula( + formula="a", + ), + ], + projection=TopologyRequestCustomProjection( + type=TopologyRequestCustomProjectionType.CUSTOM_TOPOLOGY_MAP_NODE, + dimensions=[ + TopologyRequestCustomProjectionDimension( + column="a", + dimension="values[0]", + ), + ], + ), + ), + ], + ), + ), + ], + template_variables=[], + layout_type=DashboardLayoutType.FREE, + notify_list=[], +) + +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/topology_map_inline_column_kind_scalar.py b/src/datadog_api_client/v1/model/topology_map_inline_column_kind_scalar.py new file mode 100644 index 0000000000..f74905d966 --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_map_inline_column_kind_scalar.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 TopologyMapInlineColumnKindScalar(ModelSimple): + """ + Column of numbers. + + :param value: If omitted defaults to "scalar". Must be one of ["scalar"]. + :type value: str + """ + + allowed_values = { + "scalar", + } + SCALAR: ClassVar["TopologyMapInlineColumnKindScalar"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +TopologyMapInlineColumnKindScalar.SCALAR = TopologyMapInlineColumnKindScalar("scalar") diff --git a/src/datadog_api_client/v1/model/topology_map_inline_column_kind_string.py b/src/datadog_api_client/v1/model/topology_map_inline_column_kind_string.py new file mode 100644 index 0000000000..2aeec4003a --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_map_inline_column_kind_string.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 TopologyMapInlineColumnKindString(ModelSimple): + """ + Column of strings. + + :param value: If omitted defaults to "string". Must be one of ["string"]. + :type value: str + """ + + allowed_values = { + "string", + } + STRING: ClassVar["TopologyMapInlineColumnKindString"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +TopologyMapInlineColumnKindString.STRING = TopologyMapInlineColumnKindString("string") diff --git a/src/datadog_api_client/v1/model/topology_map_inline_data.py b/src/datadog_api_client/v1/model/topology_map_inline_data.py new file mode 100644 index 0000000000..e72b4adcae --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_map_inline_data.py @@ -0,0 +1,60 @@ +# 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.topology_map_inline_edges_data import TopologyMapInlineEdgesData + from datadog_api_client.v1.model.topology_map_inline_nodes_data import TopologyMapInlineNodesData + + +class TopologyMapInlineData(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.topology_map_inline_edges_data import TopologyMapInlineEdgesData + from datadog_api_client.v1.model.topology_map_inline_nodes_data import TopologyMapInlineNodesData + + return { + "edges": (TopologyMapInlineEdgesData,), + "nodes": (TopologyMapInlineNodesData,), + } + + attribute_map = { + "edges": "edges", + "nodes": "nodes", + } + + def __init__( + self_, + edges: Union[TopologyMapInlineEdgesData, UnsetType] = unset, + nodes: Union[TopologyMapInlineNodesData, UnsetType] = unset, + **kwargs, + ): + """ + Static nodes and edges, stored in columns. Within a table, every column must have the same number of values and a unique ``id``. + + :param edges: Table of edges, one row per edge. + :type edges: TopologyMapInlineEdgesData, optional + + :param nodes: Table of nodes, one row per node. + :type nodes: TopologyMapInlineNodesData, optional + """ + if edges is not unset: + kwargs["edges"] = edges + if nodes is not unset: + kwargs["nodes"] = nodes + super().__init__(kwargs) diff --git a/src/datadog_api_client/v1/model/topology_map_inline_edge_column.py b/src/datadog_api_client/v1/model/topology_map_inline_edge_column.py new file mode 100644 index 0000000000..e761640368 --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_map_inline_edge_column.py @@ -0,0 +1,60 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.topology_map_inline_edge_column_id import TopologyMapInlineEdgeColumnId + from datadog_api_client.v1.model.topology_map_inline_column_kind_string import TopologyMapInlineColumnKindString + + +class TopologyMapInlineEdgeColumn(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.topology_map_inline_edge_column_id import TopologyMapInlineEdgeColumnId + from datadog_api_client.v1.model.topology_map_inline_column_kind_string import TopologyMapInlineColumnKindString + + return { + "id": (TopologyMapInlineEdgeColumnId,), + "kind": (TopologyMapInlineColumnKindString,), + "values": ([str],), + } + + attribute_map = { + "id": "id", + "kind": "kind", + "values": "values", + } + + def __init__( + self_, id: TopologyMapInlineEdgeColumnId, kind: TopologyMapInlineColumnKindString, values: List[str], **kwargs + ): + """ + Column of edge endpoint node IDs. + + :param id: Edge endpoint the column holds. + :type id: TopologyMapInlineEdgeColumnId + + :param kind: Column of strings. + :type kind: TopologyMapInlineColumnKindString + + :param values: Node IDs. + :type values: [str] + """ + super().__init__(kwargs) + + self_.id = id + self_.kind = kind + self_.values = values diff --git a/src/datadog_api_client/v1/model/topology_map_inline_edge_column_id.py b/src/datadog_api_client/v1/model/topology_map_inline_edge_column_id.py new file mode 100644 index 0000000000..8d1d1bd62a --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_map_inline_edge_column_id.py @@ -0,0 +1,38 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class TopologyMapInlineEdgeColumnId(ModelSimple): + """ + Edge endpoint the column holds. + + :param value: Must be one of ["source", "target"]. + :type value: str + """ + + allowed_values = { + "source", + "target", + } + SOURCE: ClassVar["TopologyMapInlineEdgeColumnId"] + TARGET: ClassVar["TopologyMapInlineEdgeColumnId"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +TopologyMapInlineEdgeColumnId.SOURCE = TopologyMapInlineEdgeColumnId("source") +TopologyMapInlineEdgeColumnId.TARGET = TopologyMapInlineEdgeColumnId("target") diff --git a/src/datadog_api_client/v1/model/topology_map_inline_edges_data.py b/src/datadog_api_client/v1/model/topology_map_inline_edges_data.py new file mode 100644 index 0000000000..6ef9b18002 --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_map_inline_edges_data.py @@ -0,0 +1,44 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.topology_map_inline_edge_column import TopologyMapInlineEdgeColumn + + +class TopologyMapInlineEdgesData(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.topology_map_inline_edge_column import TopologyMapInlineEdgeColumn + + return { + "columns": ([TopologyMapInlineEdgeColumn],), + } + + attribute_map = { + "columns": "columns", + } + + def __init__(self_, columns: List[TopologyMapInlineEdgeColumn], **kwargs): + """ + Table of edges, one row per edge. + + :param columns: Columns of the edges table. Must include one ``source`` column and one ``target`` column. + :type columns: [TopologyMapInlineEdgeColumn] + """ + super().__init__(kwargs) + + self_.columns = columns diff --git a/src/datadog_api_client/v1/model/topology_map_inline_node_column.py b/src/datadog_api_client/v1/model/topology_map_inline_node_column.py new file mode 100644 index 0000000000..33201968ab --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_map_inline_node_column.py @@ -0,0 +1,51 @@ +# 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 TopologyMapInlineNodeColumn(ModelComposed): + def __init__(self, **kwargs): + """ + Column of the nodes table. + + :param id: ID of the node ID column. + :type id: TopologyMapInlineNodeIdColumnId + + :param kind: Column of strings. + :type kind: TopologyMapInlineColumnKindString + + :param values: Node IDs. + :type values: [str] + + :param meta: Display options for a value column. + :type meta: TopologyMapInlineNodeValueColumnMeta, optional + """ + 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.topology_map_inline_node_id_column import TopologyMapInlineNodeIdColumn + from datadog_api_client.v1.model.topology_map_inline_node_string_column import TopologyMapInlineNodeStringColumn + from datadog_api_client.v1.model.topology_map_inline_node_value_column import TopologyMapInlineNodeValueColumn + + return { + "oneOf": [ + TopologyMapInlineNodeIdColumn, + TopologyMapInlineNodeStringColumn, + TopologyMapInlineNodeValueColumn, + ], + } diff --git a/src/datadog_api_client/v1/model/topology_map_inline_node_id_column.py b/src/datadog_api_client/v1/model/topology_map_inline_node_id_column.py new file mode 100644 index 0000000000..60315e1915 --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_map_inline_node_id_column.py @@ -0,0 +1,60 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.topology_map_inline_node_id_column_id import TopologyMapInlineNodeIdColumnId + from datadog_api_client.v1.model.topology_map_inline_column_kind_string import TopologyMapInlineColumnKindString + + +class TopologyMapInlineNodeIdColumn(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.topology_map_inline_node_id_column_id import TopologyMapInlineNodeIdColumnId + from datadog_api_client.v1.model.topology_map_inline_column_kind_string import TopologyMapInlineColumnKindString + + return { + "id": (TopologyMapInlineNodeIdColumnId,), + "kind": (TopologyMapInlineColumnKindString,), + "values": ([str],), + } + + attribute_map = { + "id": "id", + "kind": "kind", + "values": "values", + } + + def __init__( + self_, id: TopologyMapInlineNodeIdColumnId, kind: TopologyMapInlineColumnKindString, values: List[str], **kwargs + ): + """ + Column of node IDs. + + :param id: ID of the node ID column. + :type id: TopologyMapInlineNodeIdColumnId + + :param kind: Column of strings. + :type kind: TopologyMapInlineColumnKindString + + :param values: Node IDs. + :type values: [str] + """ + super().__init__(kwargs) + + self_.id = id + self_.kind = kind + self_.values = values diff --git a/src/datadog_api_client/v1/model/topology_map_inline_node_id_column_id.py b/src/datadog_api_client/v1/model/topology_map_inline_node_id_column_id.py new file mode 100644 index 0000000000..b8ccc9cfe8 --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_map_inline_node_id_column_id.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 TopologyMapInlineNodeIdColumnId(ModelSimple): + """ + ID of the node ID column. + + :param value: If omitted defaults to "id". Must be one of ["id"]. + :type value: str + """ + + allowed_values = { + "id", + } + ID: ClassVar["TopologyMapInlineNodeIdColumnId"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +TopologyMapInlineNodeIdColumnId.ID = TopologyMapInlineNodeIdColumnId("id") diff --git a/src/datadog_api_client/v1/model/topology_map_inline_node_string_column.py b/src/datadog_api_client/v1/model/topology_map_inline_node_string_column.py new file mode 100644 index 0000000000..19d1dca1ed --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_map_inline_node_string_column.py @@ -0,0 +1,69 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.topology_map_inline_node_string_column_id import ( + TopologyMapInlineNodeStringColumnId, + ) + from datadog_api_client.v1.model.topology_map_inline_column_kind_string import TopologyMapInlineColumnKindString + + +class TopologyMapInlineNodeStringColumn(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.topology_map_inline_node_string_column_id import ( + TopologyMapInlineNodeStringColumnId, + ) + from datadog_api_client.v1.model.topology_map_inline_column_kind_string import TopologyMapInlineColumnKindString + + return { + "id": (TopologyMapInlineNodeStringColumnId,), + "kind": (TopologyMapInlineColumnKindString,), + "values": ([str, none_type],), + } + + attribute_map = { + "id": "id", + "kind": "kind", + "values": "values", + } + + def __init__( + self_, + id: TopologyMapInlineNodeStringColumnId, + kind: TopologyMapInlineColumnKindString, + values: List[str], + **kwargs, + ): + """ + Column of node text. + + :param id: Node field the column fills. ``title`` is bold text at the top of the node; ``subtitle`` is smaller text below it. + :type id: TopologyMapInlineNodeStringColumnId + + :param kind: Column of strings. + :type kind: TopologyMapInlineColumnKindString + + :param values: Text for each node. A null ``title`` shows the node's ID; a null ``subtitle`` shows no subtitle. + :type values: [str, none_type] + """ + super().__init__(kwargs) + + self_.id = id + self_.kind = kind + self_.values = values diff --git a/src/datadog_api_client/v1/model/topology_map_inline_node_string_column_id.py b/src/datadog_api_client/v1/model/topology_map_inline_node_string_column_id.py new file mode 100644 index 0000000000..0ced7cf9d0 --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_map_inline_node_string_column_id.py @@ -0,0 +1,38 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class TopologyMapInlineNodeStringColumnId(ModelSimple): + """ + Node field the column fills. `title` is bold text at the top of the node; `subtitle` is smaller text below it. + + :param value: Must be one of ["title", "subtitle"]. + :type value: str + """ + + allowed_values = { + "title", + "subtitle", + } + TITLE: ClassVar["TopologyMapInlineNodeStringColumnId"] + SUBTITLE: ClassVar["TopologyMapInlineNodeStringColumnId"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +TopologyMapInlineNodeStringColumnId.TITLE = TopologyMapInlineNodeStringColumnId("title") +TopologyMapInlineNodeStringColumnId.SUBTITLE = TopologyMapInlineNodeStringColumnId("subtitle") diff --git a/src/datadog_api_client/v1/model/topology_map_inline_node_value_column.py b/src/datadog_api_client/v1/model/topology_map_inline_node_value_column.py new file mode 100644 index 0000000000..21d8dd4208 --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_map_inline_node_value_column.py @@ -0,0 +1,83 @@ +# 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, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.topology_map_inline_column_kind_scalar import TopologyMapInlineColumnKindScalar + from datadog_api_client.v1.model.topology_map_inline_node_value_column_meta import ( + TopologyMapInlineNodeValueColumnMeta, + ) + + +class TopologyMapInlineNodeValueColumn(ModelNormal): + validations = { + "id": {}, + } + + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.topology_map_inline_column_kind_scalar import TopologyMapInlineColumnKindScalar + from datadog_api_client.v1.model.topology_map_inline_node_value_column_meta import ( + TopologyMapInlineNodeValueColumnMeta, + ) + + return { + "id": (str,), + "kind": (TopologyMapInlineColumnKindScalar,), + "meta": (TopologyMapInlineNodeValueColumnMeta,), + "values": ([float, none_type],), + } + + attribute_map = { + "id": "id", + "kind": "kind", + "meta": "meta", + "values": "values", + } + + def __init__( + self_, + id: str, + kind: TopologyMapInlineColumnKindScalar, + values: List[float], + meta: Union[TopologyMapInlineNodeValueColumnMeta, UnsetType] = unset, + **kwargs, + ): + """ + Column of numeric node values. Nodes display non-null values in order of column ``id``. + + :param id: Position of the value in the node, as ``values[N]``. The smallest N appears first. + :type id: str + + :param kind: Column of numbers. + :type kind: TopologyMapInlineColumnKindScalar + + :param meta: Display options for a value column. + :type meta: TopologyMapInlineNodeValueColumnMeta, optional + + :param values: Value for each node. Null values are not displayed. + :type values: [float, none_type] + """ + if meta is not unset: + kwargs["meta"] = meta + super().__init__(kwargs) + + self_.id = id + self_.kind = kind + self_.values = values diff --git a/src/datadog_api_client/v1/model/topology_map_inline_node_value_column_meta.py b/src/datadog_api_client/v1/model/topology_map_inline_node_value_column_meta.py new file mode 100644 index 0000000000..198e56217a --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_map_inline_node_value_column_meta.py @@ -0,0 +1,52 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.number_format_unit import NumberFormatUnit + from datadog_api_client.v1.model.number_format_unit_canonical import NumberFormatUnitCanonical + from datadog_api_client.v1.model.number_format_unit_custom import NumberFormatUnitCustom + + +class TopologyMapInlineNodeValueColumnMeta(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.number_format_unit import NumberFormatUnit + + return { + "unit": (NumberFormatUnit,), + } + + attribute_map = { + "unit": "unit", + } + + def __init__( + self_, + unit: Union[NumberFormatUnit, NumberFormatUnitCanonical, NumberFormatUnitCustom, UnsetType] = unset, + **kwargs, + ): + """ + Display options for a value column. + + :param unit: Number format unit. + :type unit: NumberFormatUnit, optional + """ + if unit is not unset: + kwargs["unit"] = unit + super().__init__(kwargs) diff --git a/src/datadog_api_client/v1/model/topology_map_inline_nodes_data.py b/src/datadog_api_client/v1/model/topology_map_inline_nodes_data.py new file mode 100644 index 0000000000..01208d87fa --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_map_inline_nodes_data.py @@ -0,0 +1,58 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.topology_map_inline_node_column import TopologyMapInlineNodeColumn + from datadog_api_client.v1.model.topology_map_inline_node_id_column import TopologyMapInlineNodeIdColumn + from datadog_api_client.v1.model.topology_map_inline_node_string_column import TopologyMapInlineNodeStringColumn + from datadog_api_client.v1.model.topology_map_inline_node_value_column import TopologyMapInlineNodeValueColumn + + +class TopologyMapInlineNodesData(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.topology_map_inline_node_column import TopologyMapInlineNodeColumn + + return { + "columns": ([TopologyMapInlineNodeColumn],), + } + + attribute_map = { + "columns": "columns", + } + + def __init__( + self_, + columns: List[ + Union[ + TopologyMapInlineNodeColumn, + TopologyMapInlineNodeIdColumn, + TopologyMapInlineNodeStringColumn, + TopologyMapInlineNodeValueColumn, + ] + ], + **kwargs, + ): + """ + Table of nodes, one row per node. + + :param columns: Columns of the nodes table. Must include an ``id`` column, unless the list is empty (no nodes). + :type columns: [TopologyMapInlineNodeColumn] + """ + super().__init__(kwargs) + + self_.columns = columns diff --git a/src/datadog_api_client/v1/model/topology_map_layout.py b/src/datadog_api_client/v1/model/topology_map_layout.py new file mode 100644 index 0000000000..482ca8963f --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_map_layout.py @@ -0,0 +1,52 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.topology_map_layout_direction import TopologyMapLayoutDirection + from datadog_api_client.v1.model.topology_map_layout_type import TopologyMapLayoutType + + +class TopologyMapLayout(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.topology_map_layout_direction import TopologyMapLayoutDirection + from datadog_api_client.v1.model.topology_map_layout_type import TopologyMapLayoutType + + return { + "direction": (TopologyMapLayoutDirection,), + "type": (TopologyMapLayoutType,), + } + + attribute_map = { + "direction": "direction", + "type": "type", + } + + def __init__(self_, direction: TopologyMapLayoutDirection, type: TopologyMapLayoutType, **kwargs): + """ + Algorithm that positions nodes and edges. The ``hierarchical`` layout places nodes in ranks so edges flow in one direction. + + :param direction: Direction of ranks. For example, ``top-to-bottom`` places first-rank nodes at the top and last-rank nodes at the bottom. + :type direction: TopologyMapLayoutDirection + + :param type: Type of layout algorithm. + :type type: TopologyMapLayoutType + """ + super().__init__(kwargs) + + self_.direction = direction + self_.type = type diff --git a/src/datadog_api_client/v1/model/topology_map_layout_direction.py b/src/datadog_api_client/v1/model/topology_map_layout_direction.py new file mode 100644 index 0000000000..4f7b82497b --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_map_layout_direction.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 TopologyMapLayoutDirection(ModelSimple): + """ + Direction of ranks. For example, `top-to-bottom` places first-rank nodes at the top and last-rank nodes at the bottom. + + :param value: Must be one of ["top-to-bottom", "bottom-to-top", "left-to-right", "right-to-left"]. + :type value: str + """ + + allowed_values = { + "top-to-bottom", + "bottom-to-top", + "left-to-right", + "right-to-left", + } + TOP_TO_BOTTOM: ClassVar["TopologyMapLayoutDirection"] + BOTTOM_TO_TOP: ClassVar["TopologyMapLayoutDirection"] + LEFT_TO_RIGHT: ClassVar["TopologyMapLayoutDirection"] + RIGHT_TO_LEFT: ClassVar["TopologyMapLayoutDirection"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +TopologyMapLayoutDirection.TOP_TO_BOTTOM = TopologyMapLayoutDirection("top-to-bottom") +TopologyMapLayoutDirection.BOTTOM_TO_TOP = TopologyMapLayoutDirection("bottom-to-top") +TopologyMapLayoutDirection.LEFT_TO_RIGHT = TopologyMapLayoutDirection("left-to-right") +TopologyMapLayoutDirection.RIGHT_TO_LEFT = TopologyMapLayoutDirection("right-to-left") diff --git a/src/datadog_api_client/v1/model/topology_map_layout_type.py b/src/datadog_api_client/v1/model/topology_map_layout_type.py new file mode 100644 index 0000000000..67b02e35c5 --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_map_layout_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 TopologyMapLayoutType(ModelSimple): + """ + Type of layout algorithm. + + :param value: If omitted defaults to "hierarchical". Must be one of ["hierarchical"]. + :type value: str + """ + + allowed_values = { + "hierarchical", + } + HIERARCHICAL: ClassVar["TopologyMapLayoutType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +TopologyMapLayoutType.HIERARCHICAL = TopologyMapLayoutType("hierarchical") diff --git a/src/datadog_api_client/v1/model/topology_map_widget_definition.py b/src/datadog_api_client/v1/model/topology_map_widget_definition.py index e3ea5adc68..112207e8a0 100644 --- a/src/datadog_api_client/v1/model/topology_map_widget_definition.py +++ b/src/datadog_api_client/v1/model/topology_map_widget_definition.py @@ -38,6 +38,12 @@ def __init__(self, **kwargs): :param type: Type of the topology map widget. :type type: TopologyMapWidgetDefinitionType + + :param data: Static nodes and edges, stored in columns. Within a table, every column must have the same number of values and a unique `id`. + :type data: TopologyMapInlineData, optional + + :param layout: Algorithm that positions nodes and edges. The `hierarchical` layout places nodes in ranks so edges flow in one direction. + :type layout: TopologyMapLayout """ super().__init__(kwargs) @@ -56,10 +62,12 @@ def _composed_schemas(_): from datadog_api_client.v1.model.topology_map_widget_definition_service_map import ( TopologyMapWidgetDefinitionServiceMap, ) + from datadog_api_client.v1.model.topology_map_widget_definition_custom import TopologyMapWidgetDefinitionCustom return { "oneOf": [ TopologyMapWidgetDefinitionDataStreams, TopologyMapWidgetDefinitionServiceMap, + TopologyMapWidgetDefinitionCustom, ], } diff --git a/src/datadog_api_client/v1/model/topology_map_widget_definition_custom.py b/src/datadog_api_client/v1/model/topology_map_widget_definition_custom.py new file mode 100644 index 0000000000..2fcb1375fe --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_map_widget_definition_custom.py @@ -0,0 +1,135 @@ +# 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_custom_link import WidgetCustomLink + from datadog_api_client.v1.model.topology_map_inline_data import TopologyMapInlineData + from datadog_api_client.v1.model.topology_map_layout import TopologyMapLayout + from datadog_api_client.v1.model.topology_request_custom import TopologyRequestCustom + from datadog_api_client.v1.model.widget_time import WidgetTime + from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign + from datadog_api_client.v1.model.topology_map_widget_definition_type import TopologyMapWidgetDefinitionType + from datadog_api_client.v1.model.widget_legacy_live_span import WidgetLegacyLiveSpan + from datadog_api_client.v1.model.widget_new_live_span import WidgetNewLiveSpan + from datadog_api_client.v1.model.widget_new_fixed_span import WidgetNewFixedSpan + + +class TopologyMapWidgetDefinitionCustom(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.widget_custom_link import WidgetCustomLink + from datadog_api_client.v1.model.topology_map_inline_data import TopologyMapInlineData + from datadog_api_client.v1.model.topology_map_layout import TopologyMapLayout + from datadog_api_client.v1.model.topology_request_custom import TopologyRequestCustom + from datadog_api_client.v1.model.widget_time import WidgetTime + from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign + from datadog_api_client.v1.model.topology_map_widget_definition_type import TopologyMapWidgetDefinitionType + + return { + "custom_links": ([WidgetCustomLink],), + "data": (TopologyMapInlineData,), + "description": (str,), + "layout": (TopologyMapLayout,), + "requests": ([TopologyRequestCustom],), + "time": (WidgetTime,), + "title": (str,), + "title_align": (WidgetTextAlign,), + "title_size": (str,), + "type": (TopologyMapWidgetDefinitionType,), + } + + attribute_map = { + "custom_links": "custom_links", + "data": "data", + "description": "description", + "layout": "layout", + "requests": "requests", + "time": "time", + "title": "title", + "title_align": "title_align", + "title_size": "title_size", + "type": "type", + } + + def __init__( + self_, + layout: TopologyMapLayout, + requests: List[TopologyRequestCustom], + type: TopologyMapWidgetDefinitionType, + custom_links: Union[List[WidgetCustomLink], UnsetType] = unset, + data: Union[TopologyMapInlineData, UnsetType] = unset, + description: Union[str, UnsetType] = unset, + time: Union[WidgetTime, WidgetLegacyLiveSpan, WidgetNewLiveSpan, WidgetNewFixedSpan, UnsetType] = unset, + title: Union[str, UnsetType] = unset, + title_align: Union[WidgetTextAlign, UnsetType] = unset, + title_size: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Custom topology map widget. Renders nodes and edges from inline ``data`` and from scalar ``requests``. There is one node for each node ID found in ``data.nodes`` , ``data.edges`` , and ``requests``. When ``data`` and several requests set the same field on the same node (such as ``title`` or ``values[0]`` ), the last non-null value wins. + + :param custom_links: List of custom links. + :type custom_links: [WidgetCustomLink], optional + + :param data: Static nodes and edges, stored in columns. Within a table, every column must have the same number of values and a unique ``id``. + :type data: TopologyMapInlineData, optional + + :param description: The description of the widget. + :type description: str, optional + + :param layout: Algorithm that positions nodes and edges. The ``hierarchical`` layout places nodes in ranks so edges flow in one direction. + :type layout: TopologyMapLayout + + :param requests: List of scalar requests that supply node data. Can be empty. + :type requests: [TopologyRequestCustom] + + :param time: Time setting for the widget. + :type time: WidgetTime, optional + + :param title: Title of your widget. + :type title: str, optional + + :param title_align: How to align the text on the widget. + :type title_align: WidgetTextAlign, optional + + :param title_size: Size of the title. + :type title_size: str, optional + + :param type: Type of the topology map widget. + :type type: TopologyMapWidgetDefinitionType + """ + if custom_links is not unset: + kwargs["custom_links"] = custom_links + if data is not unset: + kwargs["data"] = data + if description is not unset: + kwargs["description"] = description + if time is not unset: + kwargs["time"] = time + if title is not unset: + kwargs["title"] = title + if title_align is not unset: + kwargs["title_align"] = title_align + if title_size is not unset: + kwargs["title_size"] = title_size + super().__init__(kwargs) + + self_.layout = layout + self_.requests = requests + self_.type = type diff --git a/src/datadog_api_client/v1/model/topology_request_custom.py b/src/datadog_api_client/v1/model/topology_request_custom.py new file mode 100644 index 0000000000..d19ef7fddb --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_request_custom.py @@ -0,0 +1,138 @@ +# 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_formula import WidgetFormula + from datadog_api_client.v1.model.topology_request_custom_projection import TopologyRequestCustomProjection + from datadog_api_client.v1.model.formula_and_function_query_definition import FormulaAndFunctionQueryDefinition + from datadog_api_client.v1.model.topology_request_custom_response_format import TopologyRequestCustomResponseFormat + from datadog_api_client.v1.model.widget_sort_by import WidgetSortBy + 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 TopologyRequestCustom(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.widget_formula import WidgetFormula + from datadog_api_client.v1.model.topology_request_custom_projection import TopologyRequestCustomProjection + from datadog_api_client.v1.model.formula_and_function_query_definition import FormulaAndFunctionQueryDefinition + from datadog_api_client.v1.model.topology_request_custom_response_format import ( + TopologyRequestCustomResponseFormat, + ) + from datadog_api_client.v1.model.widget_sort_by import WidgetSortBy + + return { + "formulas": ([WidgetFormula],), + "projection": (TopologyRequestCustomProjection,), + "queries": ([FormulaAndFunctionQueryDefinition],), + "response_format": (TopologyRequestCustomResponseFormat,), + "sort": (WidgetSortBy,), + } + + attribute_map = { + "formulas": "formulas", + "projection": "projection", + "queries": "queries", + "response_format": "response_format", + "sort": "sort", + } + + def __init__( + self_, + projection: TopologyRequestCustomProjection, + queries: List[ + Union[ + FormulaAndFunctionQueryDefinition, + FormulaAndFunctionMetricQueryDefinition, + FormulaAndFunctionEventQueryDefinition, + FormulaAndFunctionProcessQueryDefinition, + FormulaAndFunctionApmDependencyStatsQueryDefinition, + FormulaAndFunctionApmResourceStatsQueryDefinition, + FormulaAndFunctionApmMetricsQueryDefinition, + FormulaAndFunctionSLOQueryDefinition, + FormulaAndFunctionCloudCostQueryDefinition, + FormulaAndFunctionProductAnalyticsExtendedQueryDefinition, + FormulaAndFunctionUserJourneyQueryDefinition, + FormulaAndFunctionRetentionQueryDefinition, + ] + ], + response_format: TopologyRequestCustomResponseFormat, + formulas: Union[List[WidgetFormula], UnsetType] = unset, + sort: Union[WidgetSortBy, UnsetType] = unset, + **kwargs, + ): + """ + Scalar request whose result rows become nodes. + + :param formulas: List of formulas that operate on queries. + :type formulas: [WidgetFormula], optional + + :param projection: Mapping from result columns to node fields. Each result row feeds one node. + :type projection: TopologyRequestCustomProjection + + :param queries: List of queries that can be returned directly or used in formulas. + :type queries: [FormulaAndFunctionQueryDefinition] + + :param response_format: Response format of a custom topology map request. + :type response_format: TopologyRequestCustomResponseFormat + + :param sort: The controls for sorting the widget. + :type sort: WidgetSortBy, optional + """ + if formulas is not unset: + kwargs["formulas"] = formulas + if sort is not unset: + kwargs["sort"] = sort + super().__init__(kwargs) + + self_.projection = projection + self_.queries = queries + self_.response_format = response_format diff --git a/src/datadog_api_client/v1/model/topology_request_custom_projection.py b/src/datadog_api_client/v1/model/topology_request_custom_projection.py new file mode 100644 index 0000000000..549f0ed012 --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_request_custom_projection.py @@ -0,0 +1,63 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.topology_request_custom_projection_dimension import ( + TopologyRequestCustomProjectionDimension, + ) + from datadog_api_client.v1.model.topology_request_custom_projection_type import TopologyRequestCustomProjectionType + + +class TopologyRequestCustomProjection(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.topology_request_custom_projection_dimension import ( + TopologyRequestCustomProjectionDimension, + ) + from datadog_api_client.v1.model.topology_request_custom_projection_type import ( + TopologyRequestCustomProjectionType, + ) + + return { + "dimensions": ([TopologyRequestCustomProjectionDimension],), + "type": (TopologyRequestCustomProjectionType,), + } + + attribute_map = { + "dimensions": "dimensions", + "type": "type", + } + + def __init__( + self_, + dimensions: List[TopologyRequestCustomProjectionDimension], + type: TopologyRequestCustomProjectionType, + **kwargs, + ): + """ + Mapping from result columns to node fields. Each result row feeds one node. + + :param dimensions: List of mappings from a result column to a node field. Each ``dimension`` must be unique. + :type dimensions: [TopologyRequestCustomProjectionDimension] + + :param type: Projection type. Each result row is a node. + :type type: TopologyRequestCustomProjectionType + """ + super().__init__(kwargs) + + self_.dimensions = dimensions + self_.type = type diff --git a/src/datadog_api_client/v1/model/topology_request_custom_projection_dimension.py b/src/datadog_api_client/v1/model/topology_request_custom_projection_dimension.py new file mode 100644 index 0000000000..be3e35b48a --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_request_custom_projection_dimension.py @@ -0,0 +1,47 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class TopologyRequestCustomProjectionDimension(ModelNormal): + validations = { + "dimension": {}, + } + + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + return { + "column": (str,), + "dimension": (str,), + } + + attribute_map = { + "column": "column", + "dimension": "dimension", + } + + def __init__(self_, column: str, dimension: str, **kwargs): + """ + Mapping from one result column to one node field. + + :param column: Column name from the result. Must be a group-by tag key or a formula. + :type column: str + + :param dimension: Node field that receives the column's value: ``id`` , ``title`` , ``subtitle`` , or ``values[N]`` for the value at position N. When ``id`` is not set, each node's ID is derived from the group-by tags (for example, ``env:prod,service:web`` ). When ``title`` is not set, the title is the node's ID. When several rows set the same non- ``id`` field on a node, the last non-null value wins. + :type dimension: str + """ + super().__init__(kwargs) + + self_.column = column + self_.dimension = dimension diff --git a/src/datadog_api_client/v1/model/topology_request_custom_projection_type.py b/src/datadog_api_client/v1/model/topology_request_custom_projection_type.py new file mode 100644 index 0000000000..071733dfa6 --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_request_custom_projection_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 TopologyRequestCustomProjectionType(ModelSimple): + """ + Projection type. Each result row is a node. + + :param value: If omitted defaults to "custom_topology_map_node". Must be one of ["custom_topology_map_node"]. + :type value: str + """ + + allowed_values = { + "custom_topology_map_node", + } + CUSTOM_TOPOLOGY_MAP_NODE: ClassVar["TopologyRequestCustomProjectionType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +TopologyRequestCustomProjectionType.CUSTOM_TOPOLOGY_MAP_NODE = TopologyRequestCustomProjectionType( + "custom_topology_map_node" +) diff --git a/src/datadog_api_client/v1/model/topology_request_custom_response_format.py b/src/datadog_api_client/v1/model/topology_request_custom_response_format.py new file mode 100644 index 0000000000..6a5c5a39c7 --- /dev/null +++ b/src/datadog_api_client/v1/model/topology_request_custom_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 TopologyRequestCustomResponseFormat(ModelSimple): + """ + Response format of a custom topology map request. + + :param value: If omitted defaults to "scalar". Must be one of ["scalar"]. + :type value: str + """ + + allowed_values = { + "scalar", + } + SCALAR: ClassVar["TopologyRequestCustomResponseFormat"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +TopologyRequestCustomResponseFormat.SCALAR = TopologyRequestCustomResponseFormat("scalar") diff --git a/src/datadog_api_client/v1/models/__init__.py b/src/datadog_api_client/v1/models/__init__.py index 4521858305..afec2e6278 100644 --- a/src/datadog_api_client/v1/models/__init__.py +++ b/src/datadog_api_client/v1/models/__init__.py @@ -1297,7 +1297,25 @@ from datadog_api_client.v1.model.toplist_widget_stacked import ToplistWidgetStacked from datadog_api_client.v1.model.toplist_widget_stacked_type import ToplistWidgetStackedType from datadog_api_client.v1.model.toplist_widget_style import ToplistWidgetStyle +from datadog_api_client.v1.model.topology_map_inline_column_kind_scalar import TopologyMapInlineColumnKindScalar +from datadog_api_client.v1.model.topology_map_inline_column_kind_string import TopologyMapInlineColumnKindString +from datadog_api_client.v1.model.topology_map_inline_data import TopologyMapInlineData +from datadog_api_client.v1.model.topology_map_inline_edge_column import TopologyMapInlineEdgeColumn +from datadog_api_client.v1.model.topology_map_inline_edge_column_id import TopologyMapInlineEdgeColumnId +from datadog_api_client.v1.model.topology_map_inline_edges_data import TopologyMapInlineEdgesData +from datadog_api_client.v1.model.topology_map_inline_node_column import TopologyMapInlineNodeColumn +from datadog_api_client.v1.model.topology_map_inline_node_id_column import TopologyMapInlineNodeIdColumn +from datadog_api_client.v1.model.topology_map_inline_node_id_column_id import TopologyMapInlineNodeIdColumnId +from datadog_api_client.v1.model.topology_map_inline_node_string_column import TopologyMapInlineNodeStringColumn +from datadog_api_client.v1.model.topology_map_inline_node_string_column_id import TopologyMapInlineNodeStringColumnId +from datadog_api_client.v1.model.topology_map_inline_node_value_column import TopologyMapInlineNodeValueColumn +from datadog_api_client.v1.model.topology_map_inline_node_value_column_meta import TopologyMapInlineNodeValueColumnMeta +from datadog_api_client.v1.model.topology_map_inline_nodes_data import TopologyMapInlineNodesData +from datadog_api_client.v1.model.topology_map_layout import TopologyMapLayout +from datadog_api_client.v1.model.topology_map_layout_direction import TopologyMapLayoutDirection +from datadog_api_client.v1.model.topology_map_layout_type import TopologyMapLayoutType from datadog_api_client.v1.model.topology_map_widget_definition import TopologyMapWidgetDefinition +from datadog_api_client.v1.model.topology_map_widget_definition_custom import TopologyMapWidgetDefinitionCustom from datadog_api_client.v1.model.topology_map_widget_definition_data_streams import ( TopologyMapWidgetDefinitionDataStreams, ) @@ -1307,6 +1325,13 @@ from datadog_api_client.v1.model.topology_query_data_streams_data_source import TopologyQueryDataStreamsDataSource from datadog_api_client.v1.model.topology_query_service_map import TopologyQueryServiceMap from datadog_api_client.v1.model.topology_query_service_map_data_source import TopologyQueryServiceMapDataSource +from datadog_api_client.v1.model.topology_request_custom import TopologyRequestCustom +from datadog_api_client.v1.model.topology_request_custom_projection import TopologyRequestCustomProjection +from datadog_api_client.v1.model.topology_request_custom_projection_dimension import ( + TopologyRequestCustomProjectionDimension, +) +from datadog_api_client.v1.model.topology_request_custom_projection_type import TopologyRequestCustomProjectionType +from datadog_api_client.v1.model.topology_request_custom_response_format import TopologyRequestCustomResponseFormat from datadog_api_client.v1.model.topology_request_data_streams import TopologyRequestDataStreams from datadog_api_client.v1.model.topology_request_service_map import TopologyRequestServiceMap from datadog_api_client.v1.model.topology_request_type import TopologyRequestType @@ -2534,7 +2559,25 @@ "ToplistWidgetStacked", "ToplistWidgetStackedType", "ToplistWidgetStyle", + "TopologyMapInlineColumnKindScalar", + "TopologyMapInlineColumnKindString", + "TopologyMapInlineData", + "TopologyMapInlineEdgeColumn", + "TopologyMapInlineEdgeColumnId", + "TopologyMapInlineEdgesData", + "TopologyMapInlineNodeColumn", + "TopologyMapInlineNodeIdColumn", + "TopologyMapInlineNodeIdColumnId", + "TopologyMapInlineNodeStringColumn", + "TopologyMapInlineNodeStringColumnId", + "TopologyMapInlineNodeValueColumn", + "TopologyMapInlineNodeValueColumnMeta", + "TopologyMapInlineNodesData", + "TopologyMapLayout", + "TopologyMapLayoutDirection", + "TopologyMapLayoutType", "TopologyMapWidgetDefinition", + "TopologyMapWidgetDefinitionCustom", "TopologyMapWidgetDefinitionDataStreams", "TopologyMapWidgetDefinitionServiceMap", "TopologyMapWidgetDefinitionType", @@ -2542,6 +2585,11 @@ "TopologyQueryDataStreamsDataSource", "TopologyQueryServiceMap", "TopologyQueryServiceMapDataSource", + "TopologyRequestCustom", + "TopologyRequestCustomProjection", + "TopologyRequestCustomProjectionDimension", + "TopologyRequestCustomProjectionType", + "TopologyRequestCustomResponseFormat", "TopologyRequestDataStreams", "TopologyRequestServiceMap", "TopologyRequestType", diff --git a/tests/generated-test/test-runner-data/manifest.json b/tests/generated-test/test-runner-data/manifest.json index 16919a3dbb..33076f6350 100644 --- a/tests/generated-test/test-runner-data/manifest.json +++ b/tests/generated-test/test-runner-data/manifest.json @@ -840,6 +840,13 @@ "scenario": "Create a new dashboard with toplist widget", "version": "v1" }, + { + "feature": "Dashboards", + "feature_file": "../../v1/features/dashboards.feature", + "file": "v1/dashboards/create-a-new-dashboard-with-topology-map-custom-widget.json", + "scenario": "Create a new dashboard with topology_map custom widget", + "version": "v1" + }, { "feature": "Dashboards", "feature_file": "../../v1/features/dashboards.feature", diff --git a/tests/generated-test/test-runner-data/v1/dashboards/create-a-new-dashboard-with-topology-map-custom-widget.json b/tests/generated-test/test-runner-data/v1/dashboards/create-a-new-dashboard-with-topology-map-custom-widget.json new file mode 100644 index 0000000000..f275ce759c --- /dev/null +++ b/tests/generated-test/test-runner-data/v1/dashboards/create-a-new-dashboard-with-topology-map-custom-widget.json @@ -0,0 +1,133 @@ +{ + "api": "Dashboards", + "expected_status": 200, + "feature": "Dashboards", + "id": "v1/Dashboards/Create a new dashboard with topology_map custom widget", + "operation_id": "CreateDashboard", + "request": { + "body": { + "schema": { + "format": null, + "ref": "Dashboard", + "type": "object" + }, + "source": "dashboards_json_payload/topology_map_widget_custom.json", + "value": { + "description": "", + "layout_type": "free", + "notify_list": [], + "template_variables": [], + "title": "{{ unique }}", + "widgets": [ + { + "definition": { + "data": { + "edges": { + "columns": [ + { + "id": "source", + "kind": "string", + "values": [ + "service:web" + ] + }, + { + "id": "target", + "kind": "string", + "values": [ + "service:db" + ] + } + ] + }, + "nodes": { + "columns": [ + { + "id": "id", + "kind": "string", + "values": [ + "service:web", + "service:db" + ] + }, + { + "id": "subtitle", + "kind": "string", + "values": [ + "api-team", + null + ] + }, + { + "id": "values[1]", + "kind": "scalar", + "meta": { + "unit": { + "type": "canonical_unit", + "unit_name": "second" + } + }, + "values": [ + 1.5, + null + ] + } + ] + } + }, + "layout": { + "direction": "left-to-right", + "type": "hierarchical" + }, + "requests": [ + { + "formulas": [ + { + "formula": "a" + } + ], + "projection": { + "dimensions": [ + { + "column": "a", + "dimension": "values[0]" + } + ], + "type": "custom_topology_map_node" + }, + "queries": [ + { + "aggregator": "avg", + "data_source": "metrics", + "name": "a", + "query": "avg:system.cpu.user{*} by {service}" + } + ], + "response_format": "scalar" + } + ], + "title": "", + "title_align": "left", + "title_size": "16", + "type": "topology_map" + }, + "layout": { + "height": 15, + "width": 47, + "x": 0, + "y": 0 + } + } + ] + } + }, + "content_type": "application/json", + "method": "POST", + "pagination": false, + "parameters": [], + "path": "/api/v1/dashboard" + }, + "scenario": "Create a new dashboard with topology_map custom widget", + "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 7f8ed4b0cf..c11782ed7a 100644 --- a/tests/generated-test/test-server-data/v1/dashboards.json +++ b/tests/generated-test/test-server-data/v1/dashboards.json @@ -10352,6 +10352,167 @@ "scenario": "Create a new dashboard with toplist widget", "version": "v1" }, + { + "feature": "Dashboards", + "frozen_at": "2026-10-27T13:31:23.791Z", + "interactions": [ + { + "request": { + "body": { + "type": "json", + "value": { + "description": "", + "layout_type": "free", + "notify_list": [], + "template_variables": [], + "title": "Test-Create_a_new_dashboard_with_topology_map_custom_widget-1793107883", + "widgets": [ + { + "definition": { + "data": { + "edges": { + "columns": [ + { + "id": "source", + "kind": "string", + "values": [ + "service:web" + ] + }, + { + "id": "target", + "kind": "string", + "values": [ + "service:db" + ] + } + ] + }, + "nodes": { + "columns": [ + { + "id": "id", + "kind": "string", + "values": [ + "service:web", + "service:db" + ] + }, + { + "id": "subtitle", + "kind": "string", + "values": [ + "api-team", + null + ] + }, + { + "id": "values[1]", + "kind": "scalar", + "meta": { + "unit": { + "type": "canonical_unit", + "unit_name": "second" + } + }, + "values": [ + 1.5, + null + ] + } + ] + } + }, + "layout": { + "direction": "left-to-right", + "type": "hierarchical" + }, + "requests": [ + { + "formulas": [ + { + "formula": "a" + } + ], + "projection": { + "dimensions": [ + { + "column": "a", + "dimension": "values[0]" + } + ], + "type": "custom_topology_map_node" + }, + "queries": [ + { + "aggregator": "avg", + "data_source": "metrics", + "name": "a", + "query": "avg:system.cpu.user{*} by {service}" + } + ], + "response_format": "scalar" + } + ], + "title": "", + "title_align": "left", + "title_size": "16", + "type": "topology_map" + }, + "layout": { + "height": 15, + "width": 47, + "x": 0, + "y": 0 + } + } + ] + } + }, + "content_type": "application/json", + "method": "POST", + "path": "/api/v1/dashboard", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"id\":\"xnh-jbg-tsu\",\"title\":\"Test-Create_a_new_dashboard_with_topology_map_custom_widget-1793107883\",\"description\":\"\",\"author_handle\":\"adam.hooper@datadoghq.com\",\"author_name\":\"Adam Hooper\",\"layout_type\":\"free\",\"url\":\"/dashboard/xnh-jbg-tsu/test-createanewdashboardwithtopologymapcustomwidget-1793107883\",\"template_variables\":[],\"widgets\":[{\"definition\":{\"data\":{\"edges\":{\"columns\":[{\"id\":\"source\",\"kind\":\"string\",\"values\":[\"service:web\"]},{\"id\":\"target\",\"kind\":\"string\",\"values\":[\"service:db\"]}]},\"nodes\":{\"columns\":[{\"id\":\"id\",\"kind\":\"string\",\"values\":[\"service:web\",\"service:db\"]},{\"id\":\"subtitle\",\"kind\":\"string\",\"values\":[\"api-team\",null]},{\"id\":\"values[1]\",\"kind\":\"scalar\",\"meta\":{\"unit\":{\"type\":\"canonical_unit\",\"unit_name\":\"second\"}},\"values\":[1.5,null]}]}},\"layout\":{\"direction\":\"left-to-right\",\"type\":\"hierarchical\"},\"requests\":[{\"formulas\":[{\"formula\":\"a\"}],\"projection\":{\"dimensions\":[{\"column\":\"a\",\"dimension\":\"values[0]\"}],\"type\":\"custom_topology_map_node\"},\"queries\":[{\"aggregator\":\"avg\",\"data_source\":\"metrics\",\"name\":\"a\",\"query\":\"avg:system.cpu.user{*} by {service}\"}],\"response_format\":\"scalar\"}],\"title\":\"\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"topology_map\"},\"layout\":{\"height\":15,\"width\":47,\"x\":0,\"y\":0},\"id\":4010058712923256}],\"notify_list\":[],\"created_at\":\"2026-10-27T13:31:23.986826+00:00\",\"modified_at\":\"2026-10-27T13:31:23.986826+00:00\",\"experience_type\":\"default\",\"archived_at\":null,\"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/xnh-jbg-tsu", + "query": [] + }, + "response": { + "body": { + "encoding": "text", + "value": "{\"deleted_dashboard_id\":\"xnh-jbg-tsu\"}" + }, + "headers": { + "content-type": "application/json" + }, + "reason": "OK", + "status": 200 + } + } + ], + "scenario": "Create a new dashboard with topology_map custom widget", + "version": "v1" + }, { "feature": "Dashboards", "frozen_at": "2026-03-20T18:16:51.929Z", diff --git a/tests/v1/features/dashboards.feature b/tests/v1/features/dashboards.feature index 10d1ecf15b..311dff9a97 100644 --- a/tests/v1/features/dashboards.feature +++ b/tests/v1/features/dashboards.feature @@ -1218,6 +1218,22 @@ Feature: Dashboards And the response "widgets[0].definition.requests[0].sort.order_by[0].type" is equal to "formula" And the response "widgets[0].definition.requests[0].sort.order_by[0].index" is equal to 0 + @team:ddoghq/dashboards-backend + Scenario: Create a new dashboard with topology_map custom widget + Given new "CreateDashboard" request + And body from file "dashboards_json_payload/topology_map_widget_custom.json" + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.type" is equal to "topology_map" + And the response "widgets[0].definition.layout.type" is equal to "hierarchical" + And the response "widgets[0].definition.layout.direction" is equal to "left-to-right" + And the response "widgets[0].definition.data.nodes.columns[0].id" is equal to "id" + And the response "widgets[0].definition.data.nodes.columns[2].meta.unit.unit_name" is equal to "second" + And the response "widgets[0].definition.data.edges.columns[1].values" is equal to ["service:db"] + And the response "widgets[0].definition.requests[0].response_format" is equal to "scalar" + And the response "widgets[0].definition.requests[0].projection.type" is equal to "custom_topology_map_node" + And the response "widgets[0].definition.requests[0].projection.dimensions[0].dimension" is equal to "values[0]" + @team:ddoghq/dashboards-backend Scenario: Create a new dashboard with topology_map data_streams widget Given new "CreateDashboard" request diff --git a/tests/v1/features/dashboards_json_payload/topology_map_widget_custom.json b/tests/v1/features/dashboards_json_payload/topology_map_widget_custom.json new file mode 100644 index 0000000000..b6aa927a13 --- /dev/null +++ b/tests/v1/features/dashboards_json_payload/topology_map_widget_custom.json @@ -0,0 +1,95 @@ +{ + "title": "{{ unique }}", + "description": "", + "widgets": [ + { + "layout": { + "x": 0, + "y": 0, + "width": 47, + "height": 15 + }, + "definition": { + "title": "", + "title_size": "16", + "title_align": "left", + "type": "topology_map", + "layout": { + "type": "hierarchical", + "direction": "left-to-right" + }, + "data": { + "nodes": { + "columns": [ + { + "kind": "string", + "id": "id", + "values": ["service:web", "service:db"] + }, + { + "kind": "string", + "id": "subtitle", + "values": ["api-team", null] + }, + { + "kind": "scalar", + "id": "values[1]", + "values": [1.5, null], + "meta": { + "unit": { + "type": "canonical_unit", + "unit_name": "second" + } + } + } + ] + }, + "edges": { + "columns": [ + { + "kind": "string", + "id": "source", + "values": ["service:web"] + }, + { + "kind": "string", + "id": "target", + "values": ["service:db"] + } + ] + } + }, + "requests": [ + { + "response_format": "scalar", + "queries": [ + { + "data_source": "metrics", + "name": "a", + "query": "avg:system.cpu.user{*} by {service}", + "aggregator": "avg" + } + ], + "formulas": [ + { + "formula": "a" + } + ], + "projection": { + "type": "custom_topology_map_node", + "dimensions": [ + { + "column": "a", + "dimension": "values[0]" + } + ] + } + } + ] + } + } + ], + "template_variables": [], + "layout_type": "free", + "notify_list": [] +}