diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 78d7e42b5b..f3fc4e80ea 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -1823,6 +1823,38 @@ components: x-enum-varnames: - CUSTOM_TIMEBOARD - CUSTOM_SCREENBOARD + DataProjectionQuery: + description: Query configuration for a data projection request. + properties: + data_source: + description: Data source for the query. + example: logs + type: string + indexes: + description: List of indexes to query. + items: + description: Index name. + type: string + type: array + query_string: + description: The query string to filter events. + example: "service:web-store" + type: string + storage: + description: Storage location for the query. + type: string + required: + - query_string + - data_source + type: object + DataProjectionRequestType: + description: Type of a data projection request. + enum: + - data_projection + example: data_projection + type: string + x-enum-varnames: + - DATA_PROJECTION DeleteSharedDashboardResponse: description: Response containing token of deleted shared dashboard. properties: @@ -11338,6 +11370,150 @@ components: maxItems: 2 minItems: 2 type: array + PointPlotDimension: + description: Dimension of the point plot. + enum: + - group + - time + - y + - radius + example: y + type: string + x-enum-varnames: + - GROUP + - TIME + - Y + - RADIUS + PointPlotProjection: + description: Projection configuration for the point plot widget. + properties: + dimensions: + description: List of dimension mappings for the projection. + items: + $ref: "#/components/schemas/PointPlotProjectionDimension" + type: array + extra_columns: + description: Additional columns to include in the projection. + items: + description: Column name. + type: string + type: array + type: + $ref: "#/components/schemas/PointPlotProjectionType" + required: + - type + - dimensions + type: object + PointPlotProjectionDimension: + description: Dimension mapping for the point plot projection. + properties: + alias: + description: Alias for the column. + type: string + column: + description: Source column name from the dataset. + example: duration + type: string + dimension: + $ref: "#/components/schemas/PointPlotDimension" + required: + - column + - dimension + type: object + PointPlotProjectionType: + description: Type of the projection. + enum: + - point_plot + example: point_plot + type: string + x-enum-varnames: + - POINT_PLOT + PointPlotWidgetDefinition: + description: The point plot displays individual data points over time. + properties: + custom_links: + description: List of custom links. + items: + $ref: "#/components/schemas/WidgetCustomLink" + type: array + description: + description: The description of the widget. + type: string + legend: + $ref: "#/components/schemas/PointPlotWidgetLegend" + markers: + description: List of markers for the widget. + items: + $ref: "#/components/schemas/WidgetMarker" + type: array + requests: + description: List of request configurations for the widget. + items: + $ref: "#/components/schemas/PointPlotWidgetRequest" + type: array + time: + $ref: "#/components/schemas/WidgetTime" + title: + description: Title of the widget. + type: string + title_align: + $ref: "#/components/schemas/WidgetTextAlign" + title_size: + description: Size of the title. + type: string + type: + $ref: "#/components/schemas/PointPlotWidgetDefinitionType" + yaxis: + $ref: "#/components/schemas/WidgetAxis" + required: + - type + - requests + type: object + PointPlotWidgetDefinitionType: + default: point_plot + description: Type of the point plot widget. + enum: + - point_plot + example: point_plot + type: string + x-enum-varnames: + - POINT_PLOT + PointPlotWidgetLegend: + description: Legend configuration for the point plot widget. + properties: + type: + $ref: "#/components/schemas/PointPlotWidgetLegendType" + required: + - type + type: object + PointPlotWidgetLegendType: + description: Type of legend to show for the point plot widget. + enum: + - automatic + - none + example: automatic + type: string + x-enum-varnames: + - AUTOMATIC + - NONE + PointPlotWidgetRequest: + description: Request configuration for the point plot widget. + properties: + limit: + description: Maximum number of data points to return. + format: int64 + type: integer + projection: + $ref: "#/components/schemas/PointPlotProjection" + query: + $ref: "#/components/schemas/DataProjectionQuery" + request_type: + $ref: "#/components/schemas/DataProjectionRequestType" + required: + - request_type + - query + - projection + type: object PowerpackTemplateVariableContents: description: Powerpack template variable contents. properties: @@ -25604,6 +25780,7 @@ components: - $ref: "#/components/schemas/MonitorSummaryWidgetDefinition" - $ref: "#/components/schemas/NoteWidgetDefinition" - $ref: "#/components/schemas/PowerpackWidgetDefinition" + - $ref: "#/components/schemas/PointPlotWidgetDefinition" - $ref: "#/components/schemas/QueryValueWidgetDefinition" - $ref: "#/components/schemas/RetentionCurveWidgetDefinition" - $ref: "#/components/schemas/RunWorkflowWidgetDefinition" diff --git a/docs/datadog_api_client.v1.model.rst b/docs/datadog_api_client.v1.model.rst index c40bfd6f0e..9b46a58093 100644 --- a/docs/datadog_api_client.v1.model.rst +++ b/docs/datadog_api_client.v1.model.rst @@ -676,6 +676,20 @@ datadog\_api\_client.v1.model.dashboard\_type module :members: :show-inheritance: +datadog\_api\_client.v1.model.data\_projection\_query module +------------------------------------------------------------ + +.. automodule:: datadog_api_client.v1.model.data_projection_query + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.data\_projection\_request\_type module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.data_projection_request_type + :members: + :show-inheritance: + datadog\_api\_client.v1.model.delete\_shared\_dashboard\_response module ------------------------------------------------------------------------ @@ -3441,6 +3455,69 @@ datadog\_api\_client.v1.model.point module :members: :show-inheritance: +datadog\_api\_client.v1.model.point\_plot\_dimension module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.point_plot_dimension + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.point\_plot\_projection module +------------------------------------------------------------ + +.. automodule:: datadog_api_client.v1.model.point_plot_projection + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.point\_plot\_projection\_dimension module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.point_plot_projection_dimension + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.point\_plot\_projection\_type module +------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v1.model.point_plot_projection_type + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.point\_plot\_widget\_definition module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.point_plot_widget_definition + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.point\_plot\_widget\_definition\_type module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.point_plot_widget_definition_type + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.point\_plot\_widget\_legend module +---------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.point_plot_widget_legend + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.point\_plot\_widget\_legend\_type module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.point_plot_widget_legend_type + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.point\_plot\_widget\_request module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.point_plot_widget_request + :members: + :show-inheritance: + datadog\_api\_client.v1.model.powerpack\_template\_variable\_contents module ---------------------------------------------------------------------------- diff --git a/examples/v1/dashboards/CreateDashboard_2049446128.py b/examples/v1/dashboards/CreateDashboard_2049446128.py new file mode 100644 index 0000000000..2c46684c05 --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_2049446128.py @@ -0,0 +1,63 @@ +""" +Create a new dashboard with point_plot 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.data_projection_query import DataProjectionQuery +from datadog_api_client.v1.model.data_projection_request_type import DataProjectionRequestType +from datadog_api_client.v1.model.point_plot_dimension import PointPlotDimension +from datadog_api_client.v1.model.point_plot_projection import PointPlotProjection +from datadog_api_client.v1.model.point_plot_projection_dimension import PointPlotProjectionDimension +from datadog_api_client.v1.model.point_plot_projection_type import PointPlotProjectionType +from datadog_api_client.v1.model.point_plot_widget_definition import PointPlotWidgetDefinition +from datadog_api_client.v1.model.point_plot_widget_definition_type import PointPlotWidgetDefinitionType +from datadog_api_client.v1.model.point_plot_widget_request import PointPlotWidgetRequest +from datadog_api_client.v1.model.widget import Widget +from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign + +body = Dashboard( + title="Example-Dashboard", + layout_type=DashboardLayoutType.ORDERED, + widgets=[ + Widget( + definition=PointPlotWidgetDefinition( + title="", + title_size="16", + title_align=WidgetTextAlign.LEFT, + type=PointPlotWidgetDefinitionType.POINT_PLOT, + requests=[ + PointPlotWidgetRequest( + request_type=DataProjectionRequestType.DATA_PROJECTION, + query=DataProjectionQuery( + query_string="service:web-store", + data_source="logs", + ), + projection=PointPlotProjection( + type=PointPlotProjectionType.POINT_PLOT, + dimensions=[ + PointPlotProjectionDimension( + column="host", + dimension=PointPlotDimension.GROUP, + ), + PointPlotProjectionDimension( + column="@duration", + dimension=PointPlotDimension.Y, + ), + ], + ), + ), + ], + ), + ), + ], +) + +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/data_projection_query.py b/src/datadog_api_client/v1/model/data_projection_query.py new file mode 100644 index 0000000000..c20aaffdb7 --- /dev/null +++ b/src/datadog_api_client/v1/model/data_projection_query.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, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class DataProjectionQuery(ModelNormal): + @cached_property + def openapi_types(_): + return { + "data_source": (str,), + "indexes": ([str],), + "query_string": (str,), + "storage": (str,), + } + + attribute_map = { + "data_source": "data_source", + "indexes": "indexes", + "query_string": "query_string", + "storage": "storage", + } + + def __init__( + self_, + data_source: str, + query_string: str, + indexes: Union[List[str], UnsetType] = unset, + storage: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Query configuration for a data projection request. + + :param data_source: Data source for the query. + :type data_source: str + + :param indexes: List of indexes to query. + :type indexes: [str], optional + + :param query_string: The query string to filter events. + :type query_string: str + + :param storage: Storage location for the query. + :type storage: str, optional + """ + if indexes is not unset: + kwargs["indexes"] = indexes + if storage is not unset: + kwargs["storage"] = storage + super().__init__(kwargs) + + self_.data_source = data_source + self_.query_string = query_string diff --git a/src/datadog_api_client/v1/model/data_projection_request_type.py b/src/datadog_api_client/v1/model/data_projection_request_type.py new file mode 100644 index 0000000000..b3d968ee69 --- /dev/null +++ b/src/datadog_api_client/v1/model/data_projection_request_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 DataProjectionRequestType(ModelSimple): + """ + Type of a data projection request. + + :param value: If omitted defaults to "data_projection". Must be one of ["data_projection"]. + :type value: str + """ + + allowed_values = { + "data_projection", + } + DATA_PROJECTION: ClassVar["DataProjectionRequestType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +DataProjectionRequestType.DATA_PROJECTION = DataProjectionRequestType("data_projection") diff --git a/src/datadog_api_client/v1/model/point_plot_dimension.py b/src/datadog_api_client/v1/model/point_plot_dimension.py new file mode 100644 index 0000000000..e34131aa3e --- /dev/null +++ b/src/datadog_api_client/v1/model/point_plot_dimension.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 PointPlotDimension(ModelSimple): + """ + Dimension of the point plot. + + :param value: Must be one of ["group", "time", "y", "radius"]. + :type value: str + """ + + allowed_values = { + "group", + "time", + "y", + "radius", + } + GROUP: ClassVar["PointPlotDimension"] + TIME: ClassVar["PointPlotDimension"] + Y: ClassVar["PointPlotDimension"] + RADIUS: ClassVar["PointPlotDimension"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +PointPlotDimension.GROUP = PointPlotDimension("group") +PointPlotDimension.TIME = PointPlotDimension("time") +PointPlotDimension.Y = PointPlotDimension("y") +PointPlotDimension.RADIUS = PointPlotDimension("radius") diff --git a/src/datadog_api_client/v1/model/point_plot_projection.py b/src/datadog_api_client/v1/model/point_plot_projection.py new file mode 100644 index 0000000000..24e08f3184 --- /dev/null +++ b/src/datadog_api_client/v1/model/point_plot_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, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.point_plot_projection_dimension import PointPlotProjectionDimension + from datadog_api_client.v1.model.point_plot_projection_type import PointPlotProjectionType + + +class PointPlotProjection(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.point_plot_projection_dimension import PointPlotProjectionDimension + from datadog_api_client.v1.model.point_plot_projection_type import PointPlotProjectionType + + return { + "dimensions": ([PointPlotProjectionDimension],), + "extra_columns": ([str],), + "type": (PointPlotProjectionType,), + } + + attribute_map = { + "dimensions": "dimensions", + "extra_columns": "extra_columns", + "type": "type", + } + + def __init__( + self_, + dimensions: List[PointPlotProjectionDimension], + type: PointPlotProjectionType, + extra_columns: Union[List[str], UnsetType] = unset, + **kwargs, + ): + """ + Projection configuration for the point plot widget. + + :param dimensions: List of dimension mappings for the projection. + :type dimensions: [PointPlotProjectionDimension] + + :param extra_columns: Additional columns to include in the projection. + :type extra_columns: [str], optional + + :param type: Type of the projection. + :type type: PointPlotProjectionType + """ + if extra_columns is not unset: + kwargs["extra_columns"] = extra_columns + super().__init__(kwargs) + + self_.dimensions = dimensions + self_.type = type diff --git a/src/datadog_api_client/v1/model/point_plot_projection_dimension.py b/src/datadog_api_client/v1/model/point_plot_projection_dimension.py new file mode 100644 index 0000000000..712819cc18 --- /dev/null +++ b/src/datadog_api_client/v1/model/point_plot_projection_dimension.py @@ -0,0 +1,55 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.point_plot_dimension import PointPlotDimension + + +class PointPlotProjectionDimension(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.point_plot_dimension import PointPlotDimension + + return { + "alias": (str,), + "column": (str,), + "dimension": (PointPlotDimension,), + } + + attribute_map = { + "alias": "alias", + "column": "column", + "dimension": "dimension", + } + + def __init__(self_, column: str, dimension: PointPlotDimension, alias: Union[str, UnsetType] = unset, **kwargs): + """ + Dimension mapping for the point plot projection. + + :param alias: Alias for the column. + :type alias: str, optional + + :param column: Source column name from the dataset. + :type column: str + + :param dimension: Dimension of the point plot. + :type dimension: PointPlotDimension + """ + if alias is not unset: + kwargs["alias"] = alias + super().__init__(kwargs) + + self_.column = column + self_.dimension = dimension diff --git a/src/datadog_api_client/v1/model/point_plot_projection_type.py b/src/datadog_api_client/v1/model/point_plot_projection_type.py new file mode 100644 index 0000000000..40de2aac07 --- /dev/null +++ b/src/datadog_api_client/v1/model/point_plot_projection_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 PointPlotProjectionType(ModelSimple): + """ + Type of the projection. + + :param value: If omitted defaults to "point_plot". Must be one of ["point_plot"]. + :type value: str + """ + + allowed_values = { + "point_plot", + } + POINT_PLOT: ClassVar["PointPlotProjectionType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +PointPlotProjectionType.POINT_PLOT = PointPlotProjectionType("point_plot") diff --git a/src/datadog_api_client/v1/model/point_plot_widget_definition.py b/src/datadog_api_client/v1/model/point_plot_widget_definition.py new file mode 100644 index 0000000000..9142b16c6e --- /dev/null +++ b/src/datadog_api_client/v1/model/point_plot_widget_definition.py @@ -0,0 +1,142 @@ +# 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.point_plot_widget_legend import PointPlotWidgetLegend + from datadog_api_client.v1.model.widget_marker import WidgetMarker + from datadog_api_client.v1.model.point_plot_widget_request import PointPlotWidgetRequest + 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.point_plot_widget_definition_type import PointPlotWidgetDefinitionType + from datadog_api_client.v1.model.widget_axis import WidgetAxis + 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 PointPlotWidgetDefinition(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.widget_custom_link import WidgetCustomLink + from datadog_api_client.v1.model.point_plot_widget_legend import PointPlotWidgetLegend + from datadog_api_client.v1.model.widget_marker import WidgetMarker + from datadog_api_client.v1.model.point_plot_widget_request import PointPlotWidgetRequest + 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.point_plot_widget_definition_type import PointPlotWidgetDefinitionType + from datadog_api_client.v1.model.widget_axis import WidgetAxis + + return { + "custom_links": ([WidgetCustomLink],), + "description": (str,), + "legend": (PointPlotWidgetLegend,), + "markers": ([WidgetMarker],), + "requests": ([PointPlotWidgetRequest],), + "time": (WidgetTime,), + "title": (str,), + "title_align": (WidgetTextAlign,), + "title_size": (str,), + "type": (PointPlotWidgetDefinitionType,), + "yaxis": (WidgetAxis,), + } + + attribute_map = { + "custom_links": "custom_links", + "description": "description", + "legend": "legend", + "markers": "markers", + "requests": "requests", + "time": "time", + "title": "title", + "title_align": "title_align", + "title_size": "title_size", + "type": "type", + "yaxis": "yaxis", + } + + def __init__( + self_, + requests: List[PointPlotWidgetRequest], + type: PointPlotWidgetDefinitionType, + custom_links: Union[List[WidgetCustomLink], UnsetType] = unset, + description: Union[str, UnsetType] = unset, + legend: Union[PointPlotWidgetLegend, UnsetType] = unset, + markers: Union[List[WidgetMarker], 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, + yaxis: Union[WidgetAxis, UnsetType] = unset, + **kwargs, + ): + """ + The point plot displays individual data points over time. + + :param custom_links: List of custom links. + :type custom_links: [WidgetCustomLink], optional + + :param description: The description of the widget. + :type description: str, optional + + :param legend: Legend configuration for the point plot widget. + :type legend: PointPlotWidgetLegend, optional + + :param markers: List of markers for the widget. + :type markers: [WidgetMarker], optional + + :param requests: List of request configurations for the widget. + :type requests: [PointPlotWidgetRequest] + + :param time: Time setting for the widget. + :type time: WidgetTime, optional + + :param title: Title of the widget. + :type title: str, optional + + :param title_align: How to align the text on the widget. + :type title_align: WidgetTextAlign, optional + + :param title_size: Size of the title. + :type title_size: str, optional + + :param type: Type of the point plot widget. + :type type: PointPlotWidgetDefinitionType + + :param yaxis: Axis controls for the widget. + :type yaxis: WidgetAxis, optional + """ + if custom_links is not unset: + kwargs["custom_links"] = custom_links + if description is not unset: + kwargs["description"] = description + if legend is not unset: + kwargs["legend"] = legend + if markers is not unset: + kwargs["markers"] = markers + 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 + if yaxis is not unset: + kwargs["yaxis"] = yaxis + super().__init__(kwargs) + + self_.requests = requests + self_.type = type diff --git a/src/datadog_api_client/v1/model/point_plot_widget_definition_type.py b/src/datadog_api_client/v1/model/point_plot_widget_definition_type.py new file mode 100644 index 0000000000..ffca2194b2 --- /dev/null +++ b/src/datadog_api_client/v1/model/point_plot_widget_definition_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class PointPlotWidgetDefinitionType(ModelSimple): + """ + Type of the point plot widget. + + :param value: If omitted defaults to "point_plot". Must be one of ["point_plot"]. + :type value: str + """ + + allowed_values = { + "point_plot", + } + POINT_PLOT: ClassVar["PointPlotWidgetDefinitionType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +PointPlotWidgetDefinitionType.POINT_PLOT = PointPlotWidgetDefinitionType("point_plot") diff --git a/src/datadog_api_client/v1/model/point_plot_widget_legend.py b/src/datadog_api_client/v1/model/point_plot_widget_legend.py new file mode 100644 index 0000000000..8b7c53de14 --- /dev/null +++ b/src/datadog_api_client/v1/model/point_plot_widget_legend.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.point_plot_widget_legend_type import PointPlotWidgetLegendType + + +class PointPlotWidgetLegend(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.point_plot_widget_legend_type import PointPlotWidgetLegendType + + return { + "type": (PointPlotWidgetLegendType,), + } + + attribute_map = { + "type": "type", + } + + def __init__(self_, type: PointPlotWidgetLegendType, **kwargs): + """ + Legend configuration for the point plot widget. + + :param type: Type of legend to show for the point plot widget. + :type type: PointPlotWidgetLegendType + """ + super().__init__(kwargs) + + self_.type = type diff --git a/src/datadog_api_client/v1/model/point_plot_widget_legend_type.py b/src/datadog_api_client/v1/model/point_plot_widget_legend_type.py new file mode 100644 index 0000000000..6e0a40ef61 --- /dev/null +++ b/src/datadog_api_client/v1/model/point_plot_widget_legend_type.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 PointPlotWidgetLegendType(ModelSimple): + """ + Type of legend to show for the point plot widget. + + :param value: Must be one of ["automatic", "none"]. + :type value: str + """ + + allowed_values = { + "automatic", + "none", + } + AUTOMATIC: ClassVar["PointPlotWidgetLegendType"] + NONE: ClassVar["PointPlotWidgetLegendType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +PointPlotWidgetLegendType.AUTOMATIC = PointPlotWidgetLegendType("automatic") +PointPlotWidgetLegendType.NONE = PointPlotWidgetLegendType("none") diff --git a/src/datadog_api_client/v1/model/point_plot_widget_request.py b/src/datadog_api_client/v1/model/point_plot_widget_request.py new file mode 100644 index 0000000000..0660f6edca --- /dev/null +++ b/src/datadog_api_client/v1/model/point_plot_widget_request.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.point_plot_projection import PointPlotProjection + from datadog_api_client.v1.model.data_projection_query import DataProjectionQuery + from datadog_api_client.v1.model.data_projection_request_type import DataProjectionRequestType + + +class PointPlotWidgetRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.point_plot_projection import PointPlotProjection + from datadog_api_client.v1.model.data_projection_query import DataProjectionQuery + from datadog_api_client.v1.model.data_projection_request_type import DataProjectionRequestType + + return { + "limit": (int,), + "projection": (PointPlotProjection,), + "query": (DataProjectionQuery,), + "request_type": (DataProjectionRequestType,), + } + + attribute_map = { + "limit": "limit", + "projection": "projection", + "query": "query", + "request_type": "request_type", + } + + def __init__( + self_, + projection: PointPlotProjection, + query: DataProjectionQuery, + request_type: DataProjectionRequestType, + limit: Union[int, UnsetType] = unset, + **kwargs, + ): + """ + Request configuration for the point plot widget. + + :param limit: Maximum number of data points to return. + :type limit: int, optional + + :param projection: Projection configuration for the point plot widget. + :type projection: PointPlotProjection + + :param query: Query configuration for a data projection request. + :type query: DataProjectionQuery + + :param request_type: Type of a data projection request. + :type request_type: DataProjectionRequestType + """ + if limit is not unset: + kwargs["limit"] = limit + super().__init__(kwargs) + + self_.projection = projection + self_.query = query + self_.request_type = request_type diff --git a/src/datadog_api_client/v1/model/widget.py b/src/datadog_api_client/v1/model/widget.py index 9f4f619bf9..3aeb9e0caa 100644 --- a/src/datadog_api_client/v1/model/widget.py +++ b/src/datadog_api_client/v1/model/widget.py @@ -41,6 +41,7 @@ from datadog_api_client.v1.model.monitor_summary_widget_definition import MonitorSummaryWidgetDefinition from datadog_api_client.v1.model.note_widget_definition import NoteWidgetDefinition from datadog_api_client.v1.model.powerpack_widget_definition import PowerpackWidgetDefinition + from datadog_api_client.v1.model.point_plot_widget_definition import PointPlotWidgetDefinition from datadog_api_client.v1.model.query_value_widget_definition import QueryValueWidgetDefinition from datadog_api_client.v1.model.retention_curve_widget_definition import RetentionCurveWidgetDefinition from datadog_api_client.v1.model.run_workflow_widget_definition import RunWorkflowWidgetDefinition @@ -105,6 +106,7 @@ def __init__( MonitorSummaryWidgetDefinition, NoteWidgetDefinition, PowerpackWidgetDefinition, + PointPlotWidgetDefinition, QueryValueWidgetDefinition, RetentionCurveWidgetDefinition, RunWorkflowWidgetDefinition, diff --git a/src/datadog_api_client/v1/model/widget_definition.py b/src/datadog_api_client/v1/model/widget_definition.py index 83cea25969..6ceb2b0cca 100644 --- a/src/datadog_api_client/v1/model/widget_definition.py +++ b/src/datadog_api_client/v1/model/widget_definition.py @@ -236,6 +236,9 @@ def __init__(self, **kwargs): :param template_variables: Powerpack template variables. :type template_variables: PowerpackTemplateVariables, optional + :param legend: Legend configuration for the point plot widget. + :type legend: PointPlotWidgetLegend, optional + :param autoscale: Whether to use auto-scaling or not. :type autoscale: bool, optional @@ -329,9 +332,6 @@ def __init__(self, **kwargs): :param hide_total: Show the total value in this widget. :type hide_total: bool, optional - :param legend: Configuration of the legend. - :type legend: SunburstWidgetLegend, optional - :param has_search_bar: Controls the display of the search bar. :type has_search_bar: TableWidgetHasSearchBar, optional @@ -389,6 +389,7 @@ def _composed_schemas(_): from datadog_api_client.v1.model.monitor_summary_widget_definition import MonitorSummaryWidgetDefinition from datadog_api_client.v1.model.note_widget_definition import NoteWidgetDefinition from datadog_api_client.v1.model.powerpack_widget_definition import PowerpackWidgetDefinition + from datadog_api_client.v1.model.point_plot_widget_definition import PointPlotWidgetDefinition from datadog_api_client.v1.model.query_value_widget_definition import QueryValueWidgetDefinition from datadog_api_client.v1.model.retention_curve_widget_definition import RetentionCurveWidgetDefinition from datadog_api_client.v1.model.run_workflow_widget_definition import RunWorkflowWidgetDefinition @@ -432,6 +433,7 @@ def _composed_schemas(_): MonitorSummaryWidgetDefinition, NoteWidgetDefinition, PowerpackWidgetDefinition, + PointPlotWidgetDefinition, QueryValueWidgetDefinition, RetentionCurveWidgetDefinition, RunWorkflowWidgetDefinition, diff --git a/src/datadog_api_client/v1/models/__init__.py b/src/datadog_api_client/v1/models/__init__.py index d760159cb2..74c9c174e4 100644 --- a/src/datadog_api_client/v1/models/__init__.py +++ b/src/datadog_api_client/v1/models/__init__.py @@ -94,6 +94,8 @@ from datadog_api_client.v1.model.dashboard_template_variable_preset import DashboardTemplateVariablePreset from datadog_api_client.v1.model.dashboard_template_variable_preset_value import DashboardTemplateVariablePresetValue from datadog_api_client.v1.model.dashboard_type import DashboardType +from datadog_api_client.v1.model.data_projection_query import DataProjectionQuery +from datadog_api_client.v1.model.data_projection_request_type import DataProjectionRequestType from datadog_api_client.v1.model.delete_shared_dashboard_response import DeleteSharedDashboardResponse from datadog_api_client.v1.model.deleted_monitor import DeletedMonitor from datadog_api_client.v1.model.distribution_point import DistributionPoint @@ -615,6 +617,15 @@ from datadog_api_client.v1.model.pager_duty_service_name import PagerDutyServiceName from datadog_api_client.v1.model.pagination import Pagination from datadog_api_client.v1.model.point import Point +from datadog_api_client.v1.model.point_plot_dimension import PointPlotDimension +from datadog_api_client.v1.model.point_plot_projection import PointPlotProjection +from datadog_api_client.v1.model.point_plot_projection_dimension import PointPlotProjectionDimension +from datadog_api_client.v1.model.point_plot_projection_type import PointPlotProjectionType +from datadog_api_client.v1.model.point_plot_widget_definition import PointPlotWidgetDefinition +from datadog_api_client.v1.model.point_plot_widget_definition_type import PointPlotWidgetDefinitionType +from datadog_api_client.v1.model.point_plot_widget_legend import PointPlotWidgetLegend +from datadog_api_client.v1.model.point_plot_widget_legend_type import PointPlotWidgetLegendType +from datadog_api_client.v1.model.point_plot_widget_request import PointPlotWidgetRequest from datadog_api_client.v1.model.powerpack_template_variable_contents import PowerpackTemplateVariableContents from datadog_api_client.v1.model.powerpack_template_variables import PowerpackTemplateVariables from datadog_api_client.v1.model.powerpack_widget_definition import PowerpackWidgetDefinition @@ -1431,6 +1442,8 @@ "DashboardTemplateVariablePreset", "DashboardTemplateVariablePresetValue", "DashboardType", + "DataProjectionQuery", + "DataProjectionRequestType", "DeleteSharedDashboardResponse", "DeletedMonitor", "DistributionPoint", @@ -1826,6 +1839,15 @@ "PagerDutyServiceName", "Pagination", "Point", + "PointPlotDimension", + "PointPlotProjection", + "PointPlotProjectionDimension", + "PointPlotProjectionType", + "PointPlotWidgetDefinition", + "PointPlotWidgetDefinitionType", + "PointPlotWidgetLegend", + "PointPlotWidgetLegendType", + "PointPlotWidgetRequest", "PowerpackTemplateVariableContents", "PowerpackTemplateVariables", "PowerpackWidgetDefinition", diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_point_plot_widget.frozen b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_point_plot_widget.frozen new file mode 100644 index 0000000000..8f6732ce12 --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_point_plot_widget.frozen @@ -0,0 +1 @@ +2026-04-30T15:58:43.378Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_point_plot_widget.yaml b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_point_plot_widget.yaml new file mode 100644 index 0000000000..e143d3914f --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_point_plot_widget.yaml @@ -0,0 +1,37 @@ +interactions: +- request: + body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_point_plot_widget-1777564723","widgets":[{"definition":{"requests":[{"projection":{"dimensions":[{"column":"host","dimension":"group"},{"column":"@duration","dimension":"y"}],"type":"point_plot"},"query":{"data_source":"logs","query_string":"service:web-store"},"request_type":"data_projection"}],"title":"","title_align":"left","title_size":"16","type":"point_plot"}}]}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/dashboard + response: + body: + string: '{"id":"w8g-9wi-uav","title":"Test-Create_a_new_dashboard_with_point_plot_widget-1777564723","description":null,"author_handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","author_name":"CI + Account","layout_type":"ordered","url":"/dashboard/w8g-9wi-uav/test-createanewdashboardwithpointplotwidget-1777564723","template_variables":null,"widgets":[{"definition":{"requests":[{"projection":{"dimensions":[{"column":"host","dimension":"group"},{"column":"@duration","dimension":"y"}],"type":"point_plot"},"query":{"data_source":"logs","query_string":"service:web-store"},"request_type":"data_projection"}],"title":"","title_align":"left","title_size":"16","type":"point_plot"},"id":1386353259406476}],"notify_list":null,"created_at":"2026-04-30T15:58:43.645158+00:00","modified_at":"2026-04-30T15:58:43.645158+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/w8g-9wi-uav + response: + body: + string: '{"deleted_dashboard_id":"w8g-9wi-uav"}' + 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 2541faab2d..655b599b89 100644 --- a/tests/v1/features/dashboards.feature +++ b/tests/v1/features/dashboards.feature @@ -739,6 +739,18 @@ Feature: Dashboards And the response "widgets[0].definition.type" is equal to "note" And the response "widgets[0].definition.content" is equal to "# Example Note" + @team:DataDog/dashboards-backend + Scenario: Create a new dashboard with point_plot widget + Given new "CreateDashboard" request + And body from file "dashboards_json_payload/point_plot_widget.json" + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.type" is equal to "point_plot" + And the response "widgets[0].definition.requests[0].request_type" is equal to "data_projection" + And the response "widgets[0].definition.requests[0].projection.type" is equal to "point_plot" + And the response "widgets[0].definition.requests[0].projection.dimensions[0].dimension" is equal to "group" + And the response "widgets[0].definition.requests[0].projection.dimensions[1].dimension" is equal to "y" + @team:DataDog/dashboards-backend Scenario: Create a new dashboard with powerpack widget Given new "CreateDashboard" request diff --git a/tests/v1/features/dashboards_json_payload/point_plot_widget.json b/tests/v1/features/dashboards_json_payload/point_plot_widget.json new file mode 100644 index 0000000000..c8e340c707 --- /dev/null +++ b/tests/v1/features/dashboards_json_payload/point_plot_widget.json @@ -0,0 +1,36 @@ +{ + "title": "{{ unique }}", + "layout_type": "ordered", + "widgets": [ + { + "definition": { + "title": "", + "title_size": "16", + "title_align": "left", + "type": "point_plot", + "requests": [ + { + "request_type": "data_projection", + "query": { + "query_string": "service:web-store", + "data_source": "logs" + }, + "projection": { + "type": "point_plot", + "dimensions": [ + { + "column": "host", + "dimension": "group" + }, + { + "column": "@duration", + "dimension": "y" + } + ] + } + } + ] + } + } + ] +}