From ebd22255f2d8d3ce2eddd38a5683db4631b6f9d8 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 6 Jul 2026 15:17:27 +0000 Subject: [PATCH] Regenerate client from commit c9aabc1 of spec repo --- .generator/schemas/v1/openapi.yaml | 146 ++++++++++++++++++ docs/datadog_api_client.v1.model.rst | 42 +++++ .../model/notebook_create_data_attributes.py | 11 ++ .../notebook_response_data_attributes.py | 11 ++ .../v1/model/notebook_template_variable.py | 131 ++++++++++++++++ ...emplate_variable_available_values_query.py | 53 +++++++ ...ariable_available_values_query_group_by.py | 37 +++++ ...le_available_values_query_log_rum_spans.py | 72 +++++++++ ...variable_available_values_query_metrics.py | 43 ++++++ ..._variable_available_values_query_search.py | 37 +++++ .../model/notebook_update_data_attributes.py | 11 ++ .../notebooks_response_data_attributes.py | 11 ++ src/datadog_api_client/v1/models/__init__.py | 22 +++ tests/v1/features/notebooks.feature | 8 +- 14 files changed, 631 insertions(+), 4 deletions(-) create mode 100644 src/datadog_api_client/v1/model/notebook_template_variable.py create mode 100644 src/datadog_api_client/v1/model/notebook_template_variable_available_values_query.py create mode 100644 src/datadog_api_client/v1/model/notebook_template_variable_available_values_query_group_by.py create mode 100644 src/datadog_api_client/v1/model/notebook_template_variable_available_values_query_log_rum_spans.py create mode 100644 src/datadog_api_client/v1/model/notebook_template_variable_available_values_query_metrics.py create mode 100644 src/datadog_api_client/v1/model/notebook_template_variable_available_values_query_search.py diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 050e782eb9..888611645f 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -11287,6 +11287,12 @@ components: type: string status: $ref: "#/components/schemas/NotebookStatus" + template_variables: + description: List of template variables for this notebook. + items: + $ref: "#/components/schemas/NotebookTemplateVariable" + nullable: true + type: array time: $ref: "#/components/schemas/NotebookGlobalTime" required: @@ -11506,6 +11512,12 @@ components: type: string status: $ref: "#/components/schemas/NotebookStatus" + template_variables: + description: List of template variables for this notebook. + items: + $ref: "#/components/schemas/NotebookTemplateVariable" + nullable: true + type: array time: $ref: "#/components/schemas/NotebookGlobalTime" required: @@ -11548,6 +11560,128 @@ components: type: string x-enum-varnames: - PUBLISHED + NotebookTemplateVariable: + additionalProperties: false + description: Notebook template variable. + properties: + available_values: + description: The list of values that the template variable drop-down is limited to. + example: ["my-host", "host1", "host2"] + items: + description: Template variable value. + minLength: 1 + type: string + nullable: true + type: array + uniqueItems: true + available_values_query: + $ref: "#/components/schemas/NotebookTemplateVariableAvailableValuesQuery" + data_source_mappings: + additionalProperties: + description: The value for the given data source. + type: string + description: Mapping of data source names to template variable values. + type: object + default: + deprecated: true + description: |- + (deprecated) The default value for the template variable on notebook load. + Cannot be used in conjunction with `defaults`. + example: my-host + nullable: true + type: string + defaults: + description: One or many default values for the template variable. Cannot be used in conjunction with `default`. + example: ["my-host-1", "my-host-2"] + items: + description: A default value for the template variable. + minLength: 1 + type: string + type: array + uniqueItems: true + name: + description: The name of the variable. + example: host1 + type: string + placement: + description: The placement of the template variable in the notebook. + example: global + type: string + prefix: + description: The tag prefix associated with the variable. Only tags with this prefix appear in the variable drop-down. + example: host + nullable: true + type: string + type: + description: The type of the template variable. + example: tag + type: string + required: + - name + type: object + NotebookTemplateVariableAvailableValuesQuery: + description: Query used to dynamically populate the list of available values for the template variable. + oneOf: + - $ref: "#/components/schemas/NotebookTemplateVariableAvailableValuesQueryLogRumSpans" + - $ref: "#/components/schemas/NotebookTemplateVariableAvailableValuesQueryMetrics" + NotebookTemplateVariableAvailableValuesQueryGroupBy: + additionalProperties: false + description: A group-by facet for an available values query. + properties: + facet: + description: The facet name to group by. + example: host + type: string + required: + - facet + type: object + NotebookTemplateVariableAvailableValuesQueryLogRumSpans: + additionalProperties: false + description: Available values query for logs, RUM, or spans data sources. + properties: + data_source: + description: The data source for the query. Must be one of `logs`, `rum`, or `spans`. + example: logs + type: string + group_by: + description: Group-by fields for the query. + items: + $ref: "#/components/schemas/NotebookTemplateVariableAvailableValuesQueryGroupBy" + type: array + search: + $ref: "#/components/schemas/NotebookTemplateVariableAvailableValuesQuerySearch" + required: + - data_source + - search + - group_by + type: object + NotebookTemplateVariableAvailableValuesQueryMetrics: + additionalProperties: false + description: Available values query for the metrics data source. + properties: + data_source: + description: The data source for the query. Must be `metrics`. + example: metrics + type: string + query: + description: The metrics query string. + example: "avg:system.cpu.user{*} by {host}" + type: string + required: + - data_source + - query + type: object + NotebookTemplateVariableAvailableValuesQuerySearch: + additionalProperties: false + description: Search parameters for an available values query. + properties: + query: + description: The search query string. + example: "service:web" + type: string + required: + - query + type: object NotebookTimeseriesCellAttributes: description: The attributes of a notebook `timeseries` cell. properties: @@ -11613,6 +11747,12 @@ components: type: string status: $ref: "#/components/schemas/NotebookStatus" + template_variables: + description: List of template variables for this notebook. + items: + $ref: "#/components/schemas/NotebookTemplateVariable" + nullable: true + type: array time: $ref: "#/components/schemas/NotebookGlobalTime" required: @@ -11689,6 +11829,12 @@ components: type: string status: $ref: "#/components/schemas/NotebookStatus" + template_variables: + description: List of template variables for this notebook. + items: + $ref: "#/components/schemas/NotebookTemplateVariable" + nullable: true + type: array time: $ref: "#/components/schemas/NotebookGlobalTime" required: diff --git a/docs/datadog_api_client.v1.model.rst b/docs/datadog_api_client.v1.model.rst index 4a3f774b9d..174a88f490 100644 --- a/docs/datadog_api_client.v1.model.rst +++ b/docs/datadog_api_client.v1.model.rst @@ -3364,6 +3364,48 @@ datadog\_api\_client.v1.model.notebook\_status module :members: :show-inheritance: +datadog\_api\_client.v1.model.notebook\_template\_variable module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.notebook_template_variable + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.notebook\_template\_variable\_available\_values\_query module +------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.notebook_template_variable_available_values_query + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.notebook\_template\_variable\_available\_values\_query\_group\_by module +------------------------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v1.model.notebook_template_variable_available_values_query_group_by + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.notebook\_template\_variable\_available\_values\_query\_log\_rum\_spans module +------------------------------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v1.model.notebook_template_variable_available_values_query_log_rum_spans + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.notebook\_template\_variable\_available\_values\_query\_metrics module +---------------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.notebook_template_variable_available_values_query_metrics + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.notebook\_template\_variable\_available\_values\_query\_search module +--------------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.notebook_template_variable_available_values_query_search + :members: + :show-inheritance: + datadog\_api\_client.v1.model.notebook\_timeseries\_cell\_attributes module --------------------------------------------------------------------------- diff --git a/src/datadog_api_client/v1/model/notebook_create_data_attributes.py b/src/datadog_api_client/v1/model/notebook_create_data_attributes.py index c96f99ff7c..0e4851d7ca 100644 --- a/src/datadog_api_client/v1/model/notebook_create_data_attributes.py +++ b/src/datadog_api_client/v1/model/notebook_create_data_attributes.py @@ -8,6 +8,7 @@ from datadog_api_client.model_utils import ( ModelNormal, cached_property, + none_type, unset, UnsetType, ) @@ -17,6 +18,7 @@ from datadog_api_client.v1.model.notebook_cell_create_request import NotebookCellCreateRequest from datadog_api_client.v1.model.notebook_metadata import NotebookMetadata from datadog_api_client.v1.model.notebook_status import NotebookStatus + from datadog_api_client.v1.model.notebook_template_variable import NotebookTemplateVariable from datadog_api_client.v1.model.notebook_global_time import NotebookGlobalTime from datadog_api_client.v1.model.notebook_relative_time import NotebookRelativeTime from datadog_api_client.v1.model.notebook_absolute_time import NotebookAbsoluteTime @@ -35,6 +37,7 @@ def openapi_types(_): from datadog_api_client.v1.model.notebook_cell_create_request import NotebookCellCreateRequest from datadog_api_client.v1.model.notebook_metadata import NotebookMetadata from datadog_api_client.v1.model.notebook_status import NotebookStatus + from datadog_api_client.v1.model.notebook_template_variable import NotebookTemplateVariable from datadog_api_client.v1.model.notebook_global_time import NotebookGlobalTime return { @@ -42,6 +45,7 @@ def openapi_types(_): "metadata": (NotebookMetadata,), "name": (str,), "status": (NotebookStatus,), + "template_variables": ([NotebookTemplateVariable], none_type), "time": (NotebookGlobalTime,), } @@ -50,6 +54,7 @@ def openapi_types(_): "metadata": "metadata", "name": "name", "status": "status", + "template_variables": "template_variables", "time": "time", } @@ -60,6 +65,7 @@ def __init__( time: Union[NotebookGlobalTime, NotebookRelativeTime, NotebookAbsoluteTime], metadata: Union[NotebookMetadata, UnsetType] = unset, status: Union[NotebookStatus, UnsetType] = unset, + template_variables: Union[List[NotebookTemplateVariable], none_type, UnsetType] = unset, **kwargs, ): """ @@ -77,6 +83,9 @@ def __init__( :param status: Publication status of the notebook. For now, always "published". :type status: NotebookStatus, optional + :param template_variables: List of template variables for this notebook. + :type template_variables: [NotebookTemplateVariable], none_type, optional + :param time: Notebook global timeframe. :type time: NotebookGlobalTime """ @@ -84,6 +93,8 @@ def __init__( kwargs["metadata"] = metadata if status is not unset: kwargs["status"] = status + if template_variables is not unset: + kwargs["template_variables"] = template_variables super().__init__(kwargs) self_.cells = cells diff --git a/src/datadog_api_client/v1/model/notebook_response_data_attributes.py b/src/datadog_api_client/v1/model/notebook_response_data_attributes.py index ca756a983e..afb22ce1c5 100644 --- a/src/datadog_api_client/v1/model/notebook_response_data_attributes.py +++ b/src/datadog_api_client/v1/model/notebook_response_data_attributes.py @@ -9,6 +9,7 @@ ModelNormal, cached_property, datetime, + none_type, unset, UnsetType, ) @@ -19,6 +20,7 @@ from datadog_api_client.v1.model.notebook_cell_response import NotebookCellResponse from datadog_api_client.v1.model.notebook_metadata import NotebookMetadata from datadog_api_client.v1.model.notebook_status import NotebookStatus + from datadog_api_client.v1.model.notebook_template_variable import NotebookTemplateVariable from datadog_api_client.v1.model.notebook_global_time import NotebookGlobalTime from datadog_api_client.v1.model.notebook_relative_time import NotebookRelativeTime from datadog_api_client.v1.model.notebook_absolute_time import NotebookAbsoluteTime @@ -38,6 +40,7 @@ def openapi_types(_): from datadog_api_client.v1.model.notebook_cell_response import NotebookCellResponse from datadog_api_client.v1.model.notebook_metadata import NotebookMetadata from datadog_api_client.v1.model.notebook_status import NotebookStatus + from datadog_api_client.v1.model.notebook_template_variable import NotebookTemplateVariable from datadog_api_client.v1.model.notebook_global_time import NotebookGlobalTime return { @@ -48,6 +51,7 @@ def openapi_types(_): "modified": (datetime,), "name": (str,), "status": (NotebookStatus,), + "template_variables": ([NotebookTemplateVariable], none_type), "time": (NotebookGlobalTime,), } @@ -59,6 +63,7 @@ def openapi_types(_): "modified": "modified", "name": "name", "status": "status", + "template_variables": "template_variables", "time": "time", } read_only_vars = { @@ -76,6 +81,7 @@ def __init__( metadata: Union[NotebookMetadata, UnsetType] = unset, modified: Union[datetime, UnsetType] = unset, status: Union[NotebookStatus, UnsetType] = unset, + template_variables: Union[List[NotebookTemplateVariable], none_type, UnsetType] = unset, **kwargs, ): """ @@ -102,6 +108,9 @@ def __init__( :param status: Publication status of the notebook. For now, always "published". :type status: NotebookStatus, optional + :param template_variables: List of template variables for this notebook. + :type template_variables: [NotebookTemplateVariable], none_type, optional + :param time: Notebook global timeframe. :type time: NotebookGlobalTime """ @@ -115,6 +124,8 @@ def __init__( kwargs["modified"] = modified if status is not unset: kwargs["status"] = status + if template_variables is not unset: + kwargs["template_variables"] = template_variables super().__init__(kwargs) self_.cells = cells diff --git a/src/datadog_api_client/v1/model/notebook_template_variable.py b/src/datadog_api_client/v1/model/notebook_template_variable.py new file mode 100644 index 0000000000..18ba0c157c --- /dev/null +++ b/src/datadog_api_client/v1/model/notebook_template_variable.py @@ -0,0 +1,131 @@ +# 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 Dict, 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.notebook_template_variable_available_values_query import ( + NotebookTemplateVariableAvailableValuesQuery, + ) + from datadog_api_client.v1.model.notebook_template_variable_available_values_query_log_rum_spans import ( + NotebookTemplateVariableAvailableValuesQueryLogRumSpans, + ) + from datadog_api_client.v1.model.notebook_template_variable_available_values_query_metrics import ( + NotebookTemplateVariableAvailableValuesQueryMetrics, + ) + + +class NotebookTemplateVariable(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.notebook_template_variable_available_values_query import ( + NotebookTemplateVariableAvailableValuesQuery, + ) + + return { + "available_values": ([str], none_type), + "available_values_query": (NotebookTemplateVariableAvailableValuesQuery,), + "data_source_mappings": ({str: (str,)},), + "default": (str, none_type), + "defaults": ([str],), + "name": (str,), + "placement": (str,), + "prefix": (str, none_type), + "type": (str,), + } + + attribute_map = { + "available_values": "available_values", + "available_values_query": "available_values_query", + "data_source_mappings": "data_source_mappings", + "default": "default", + "defaults": "defaults", + "name": "name", + "placement": "placement", + "prefix": "prefix", + "type": "type", + } + + def __init__( + self_, + name: str, + available_values: Union[List[str], none_type, UnsetType] = unset, + available_values_query: Union[ + NotebookTemplateVariableAvailableValuesQuery, + NotebookTemplateVariableAvailableValuesQueryLogRumSpans, + NotebookTemplateVariableAvailableValuesQueryMetrics, + UnsetType, + ] = unset, + data_source_mappings: Union[Dict[str, str], UnsetType] = unset, + default: Union[str, none_type, UnsetType] = unset, + defaults: Union[List[str], UnsetType] = unset, + placement: Union[str, UnsetType] = unset, + prefix: Union[str, none_type, UnsetType] = unset, + type: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Notebook template variable. + + :param available_values: The list of values that the template variable drop-down is limited to. + :type available_values: [str], none_type, optional + + :param available_values_query: Query used to dynamically populate the list of available values for the template variable. + :type available_values_query: NotebookTemplateVariableAvailableValuesQuery, optional + + :param data_source_mappings: Mapping of data source names to template variable values. + :type data_source_mappings: {str: (str,)}, optional + + :param default: (deprecated) The default value for the template variable on notebook load. + Cannot be used in conjunction with ``defaults``. **Deprecated**. + :type default: str, none_type, optional + + :param defaults: One or many default values for the template variable. Cannot be used in conjunction with ``default``. + :type defaults: [str], optional + + :param name: The name of the variable. + :type name: str + + :param placement: The placement of the template variable in the notebook. + :type placement: str, optional + + :param prefix: The tag prefix associated with the variable. Only tags with this prefix appear in the variable drop-down. + :type prefix: str, none_type, optional + + :param type: The type of the template variable. + :type type: str, optional + """ + if available_values is not unset: + kwargs["available_values"] = available_values + if available_values_query is not unset: + kwargs["available_values_query"] = available_values_query + if data_source_mappings is not unset: + kwargs["data_source_mappings"] = data_source_mappings + if default is not unset: + kwargs["default"] = default + if defaults is not unset: + kwargs["defaults"] = defaults + if placement is not unset: + kwargs["placement"] = placement + if prefix is not unset: + kwargs["prefix"] = prefix + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) + + self_.name = name diff --git a/src/datadog_api_client/v1/model/notebook_template_variable_available_values_query.py b/src/datadog_api_client/v1/model/notebook_template_variable_available_values_query.py new file mode 100644 index 0000000000..90fb4e2fa6 --- /dev/null +++ b/src/datadog_api_client/v1/model/notebook_template_variable_available_values_query.py @@ -0,0 +1,53 @@ +# 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 NotebookTemplateVariableAvailableValuesQuery(ModelComposed): + def __init__(self, **kwargs): + """ + Query used to dynamically populate the list of available values for the template variable. + + :param data_source: The data source for the query. Must be one of `logs`, `rum`, or `spans`. + :type data_source: str + + :param group_by: Group-by fields for the query. + :type group_by: [NotebookTemplateVariableAvailableValuesQueryGroupBy] + + :param search: Search parameters for an available values query. + :type search: NotebookTemplateVariableAvailableValuesQuerySearch + + :param query: The metrics query string. + :type query: str + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v1.model.notebook_template_variable_available_values_query_log_rum_spans import ( + NotebookTemplateVariableAvailableValuesQueryLogRumSpans, + ) + from datadog_api_client.v1.model.notebook_template_variable_available_values_query_metrics import ( + NotebookTemplateVariableAvailableValuesQueryMetrics, + ) + + return { + "oneOf": [ + NotebookTemplateVariableAvailableValuesQueryLogRumSpans, + NotebookTemplateVariableAvailableValuesQueryMetrics, + ], + } diff --git a/src/datadog_api_client/v1/model/notebook_template_variable_available_values_query_group_by.py b/src/datadog_api_client/v1/model/notebook_template_variable_available_values_query_group_by.py new file mode 100644 index 0000000000..08f1095d17 --- /dev/null +++ b/src/datadog_api_client/v1/model/notebook_template_variable_available_values_query_group_by.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 ( + ModelNormal, + cached_property, +) + + +class NotebookTemplateVariableAvailableValuesQueryGroupBy(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + return { + "facet": (str,), + } + + attribute_map = { + "facet": "facet", + } + + def __init__(self_, facet: str, **kwargs): + """ + A group-by facet for an available values query. + + :param facet: The facet name to group by. + :type facet: str + """ + super().__init__(kwargs) + + self_.facet = facet diff --git a/src/datadog_api_client/v1/model/notebook_template_variable_available_values_query_log_rum_spans.py b/src/datadog_api_client/v1/model/notebook_template_variable_available_values_query_log_rum_spans.py new file mode 100644 index 0000000000..18ae491f0b --- /dev/null +++ b/src/datadog_api_client/v1/model/notebook_template_variable_available_values_query_log_rum_spans.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 List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.notebook_template_variable_available_values_query_group_by import ( + NotebookTemplateVariableAvailableValuesQueryGroupBy, + ) + from datadog_api_client.v1.model.notebook_template_variable_available_values_query_search import ( + NotebookTemplateVariableAvailableValuesQuerySearch, + ) + + +class NotebookTemplateVariableAvailableValuesQueryLogRumSpans(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.notebook_template_variable_available_values_query_group_by import ( + NotebookTemplateVariableAvailableValuesQueryGroupBy, + ) + from datadog_api_client.v1.model.notebook_template_variable_available_values_query_search import ( + NotebookTemplateVariableAvailableValuesQuerySearch, + ) + + return { + "data_source": (str,), + "group_by": ([NotebookTemplateVariableAvailableValuesQueryGroupBy],), + "search": (NotebookTemplateVariableAvailableValuesQuerySearch,), + } + + attribute_map = { + "data_source": "data_source", + "group_by": "group_by", + "search": "search", + } + + def __init__( + self_, + data_source: str, + group_by: List[NotebookTemplateVariableAvailableValuesQueryGroupBy], + search: NotebookTemplateVariableAvailableValuesQuerySearch, + **kwargs, + ): + """ + Available values query for logs, RUM, or spans data sources. + + :param data_source: The data source for the query. Must be one of ``logs`` , ``rum`` , or ``spans``. + :type data_source: str + + :param group_by: Group-by fields for the query. + :type group_by: [NotebookTemplateVariableAvailableValuesQueryGroupBy] + + :param search: Search parameters for an available values query. + :type search: NotebookTemplateVariableAvailableValuesQuerySearch + """ + super().__init__(kwargs) + + self_.data_source = data_source + self_.group_by = group_by + self_.search = search diff --git a/src/datadog_api_client/v1/model/notebook_template_variable_available_values_query_metrics.py b/src/datadog_api_client/v1/model/notebook_template_variable_available_values_query_metrics.py new file mode 100644 index 0000000000..d7fc44a430 --- /dev/null +++ b/src/datadog_api_client/v1/model/notebook_template_variable_available_values_query_metrics.py @@ -0,0 +1,43 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class NotebookTemplateVariableAvailableValuesQueryMetrics(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + return { + "data_source": (str,), + "query": (str,), + } + + attribute_map = { + "data_source": "data_source", + "query": "query", + } + + def __init__(self_, data_source: str, query: str, **kwargs): + """ + Available values query for the metrics data source. + + :param data_source: The data source for the query. Must be ``metrics``. + :type data_source: str + + :param query: The metrics query string. + :type query: str + """ + super().__init__(kwargs) + + self_.data_source = data_source + self_.query = query diff --git a/src/datadog_api_client/v1/model/notebook_template_variable_available_values_query_search.py b/src/datadog_api_client/v1/model/notebook_template_variable_available_values_query_search.py new file mode 100644 index 0000000000..6e8d969fd2 --- /dev/null +++ b/src/datadog_api_client/v1/model/notebook_template_variable_available_values_query_search.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 ( + ModelNormal, + cached_property, +) + + +class NotebookTemplateVariableAvailableValuesQuerySearch(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + return { + "query": (str,), + } + + attribute_map = { + "query": "query", + } + + def __init__(self_, query: str, **kwargs): + """ + Search parameters for an available values query. + + :param query: The search query string. + :type query: str + """ + super().__init__(kwargs) + + self_.query = query diff --git a/src/datadog_api_client/v1/model/notebook_update_data_attributes.py b/src/datadog_api_client/v1/model/notebook_update_data_attributes.py index 159153f3f1..847efd5e51 100644 --- a/src/datadog_api_client/v1/model/notebook_update_data_attributes.py +++ b/src/datadog_api_client/v1/model/notebook_update_data_attributes.py @@ -8,6 +8,7 @@ from datadog_api_client.model_utils import ( ModelNormal, cached_property, + none_type, unset, UnsetType, ) @@ -17,6 +18,7 @@ from datadog_api_client.v1.model.notebook_update_cell import NotebookUpdateCell from datadog_api_client.v1.model.notebook_metadata import NotebookMetadata from datadog_api_client.v1.model.notebook_status import NotebookStatus + from datadog_api_client.v1.model.notebook_template_variable import NotebookTemplateVariable from datadog_api_client.v1.model.notebook_global_time import NotebookGlobalTime from datadog_api_client.v1.model.notebook_cell_create_request import NotebookCellCreateRequest from datadog_api_client.v1.model.notebook_cell_update_request import NotebookCellUpdateRequest @@ -37,6 +39,7 @@ def openapi_types(_): from datadog_api_client.v1.model.notebook_update_cell import NotebookUpdateCell from datadog_api_client.v1.model.notebook_metadata import NotebookMetadata from datadog_api_client.v1.model.notebook_status import NotebookStatus + from datadog_api_client.v1.model.notebook_template_variable import NotebookTemplateVariable from datadog_api_client.v1.model.notebook_global_time import NotebookGlobalTime return { @@ -44,6 +47,7 @@ def openapi_types(_): "metadata": (NotebookMetadata,), "name": (str,), "status": (NotebookStatus,), + "template_variables": ([NotebookTemplateVariable], none_type), "time": (NotebookGlobalTime,), } @@ -52,6 +56,7 @@ def openapi_types(_): "metadata": "metadata", "name": "name", "status": "status", + "template_variables": "template_variables", "time": "time", } @@ -62,6 +67,7 @@ def __init__( time: Union[NotebookGlobalTime, NotebookRelativeTime, NotebookAbsoluteTime], metadata: Union[NotebookMetadata, UnsetType] = unset, status: Union[NotebookStatus, UnsetType] = unset, + template_variables: Union[List[NotebookTemplateVariable], none_type, UnsetType] = unset, **kwargs, ): """ @@ -79,6 +85,9 @@ def __init__( :param status: Publication status of the notebook. For now, always "published". :type status: NotebookStatus, optional + :param template_variables: List of template variables for this notebook. + :type template_variables: [NotebookTemplateVariable], none_type, optional + :param time: Notebook global timeframe. :type time: NotebookGlobalTime """ @@ -86,6 +95,8 @@ def __init__( kwargs["metadata"] = metadata if status is not unset: kwargs["status"] = status + if template_variables is not unset: + kwargs["template_variables"] = template_variables super().__init__(kwargs) self_.cells = cells diff --git a/src/datadog_api_client/v1/model/notebooks_response_data_attributes.py b/src/datadog_api_client/v1/model/notebooks_response_data_attributes.py index 1dcc9753ef..d39b4badec 100644 --- a/src/datadog_api_client/v1/model/notebooks_response_data_attributes.py +++ b/src/datadog_api_client/v1/model/notebooks_response_data_attributes.py @@ -9,6 +9,7 @@ ModelNormal, cached_property, datetime, + none_type, unset, UnsetType, ) @@ -19,6 +20,7 @@ from datadog_api_client.v1.model.notebook_cell_response import NotebookCellResponse from datadog_api_client.v1.model.notebook_metadata import NotebookMetadata from datadog_api_client.v1.model.notebook_status import NotebookStatus + from datadog_api_client.v1.model.notebook_template_variable import NotebookTemplateVariable from datadog_api_client.v1.model.notebook_global_time import NotebookGlobalTime from datadog_api_client.v1.model.notebook_relative_time import NotebookRelativeTime from datadog_api_client.v1.model.notebook_absolute_time import NotebookAbsoluteTime @@ -38,6 +40,7 @@ def openapi_types(_): from datadog_api_client.v1.model.notebook_cell_response import NotebookCellResponse from datadog_api_client.v1.model.notebook_metadata import NotebookMetadata from datadog_api_client.v1.model.notebook_status import NotebookStatus + from datadog_api_client.v1.model.notebook_template_variable import NotebookTemplateVariable from datadog_api_client.v1.model.notebook_global_time import NotebookGlobalTime return { @@ -48,6 +51,7 @@ def openapi_types(_): "modified": (datetime,), "name": (str,), "status": (NotebookStatus,), + "template_variables": ([NotebookTemplateVariable], none_type), "time": (NotebookGlobalTime,), } @@ -59,6 +63,7 @@ def openapi_types(_): "modified": "modified", "name": "name", "status": "status", + "template_variables": "template_variables", "time": "time", } read_only_vars = { @@ -75,6 +80,7 @@ def __init__( metadata: Union[NotebookMetadata, UnsetType] = unset, modified: Union[datetime, UnsetType] = unset, status: Union[NotebookStatus, UnsetType] = unset, + template_variables: Union[List[NotebookTemplateVariable], none_type, UnsetType] = unset, time: Union[NotebookGlobalTime, NotebookRelativeTime, NotebookAbsoluteTime, UnsetType] = unset, **kwargs, ): @@ -102,6 +108,9 @@ def __init__( :param status: Publication status of the notebook. For now, always "published". :type status: NotebookStatus, optional + :param template_variables: List of template variables for this notebook. + :type template_variables: [NotebookTemplateVariable], none_type, optional + :param time: Notebook global timeframe. :type time: NotebookGlobalTime, optional """ @@ -117,6 +126,8 @@ def __init__( kwargs["modified"] = modified if status is not unset: kwargs["status"] = status + if template_variables is not unset: + kwargs["template_variables"] = template_variables if time is not unset: kwargs["time"] = time super().__init__(kwargs) diff --git a/src/datadog_api_client/v1/models/__init__.py b/src/datadog_api_client/v1/models/__init__.py index 0611a0942c..590f845bc7 100644 --- a/src/datadog_api_client/v1/models/__init__.py +++ b/src/datadog_api_client/v1/models/__init__.py @@ -611,6 +611,22 @@ from datadog_api_client.v1.model.notebook_response_data_attributes import NotebookResponseDataAttributes from datadog_api_client.v1.model.notebook_split_by import NotebookSplitBy from datadog_api_client.v1.model.notebook_status import NotebookStatus +from datadog_api_client.v1.model.notebook_template_variable import NotebookTemplateVariable +from datadog_api_client.v1.model.notebook_template_variable_available_values_query import ( + NotebookTemplateVariableAvailableValuesQuery, +) +from datadog_api_client.v1.model.notebook_template_variable_available_values_query_group_by import ( + NotebookTemplateVariableAvailableValuesQueryGroupBy, +) +from datadog_api_client.v1.model.notebook_template_variable_available_values_query_log_rum_spans import ( + NotebookTemplateVariableAvailableValuesQueryLogRumSpans, +) +from datadog_api_client.v1.model.notebook_template_variable_available_values_query_metrics import ( + NotebookTemplateVariableAvailableValuesQueryMetrics, +) +from datadog_api_client.v1.model.notebook_template_variable_available_values_query_search import ( + NotebookTemplateVariableAvailableValuesQuerySearch, +) from datadog_api_client.v1.model.notebook_timeseries_cell_attributes import NotebookTimeseriesCellAttributes from datadog_api_client.v1.model.notebook_toplist_cell_attributes import NotebookToplistCellAttributes from datadog_api_client.v1.model.notebook_update_cell import NotebookUpdateCell @@ -1886,6 +1902,12 @@ "NotebookResponseDataAttributes", "NotebookSplitBy", "NotebookStatus", + "NotebookTemplateVariable", + "NotebookTemplateVariableAvailableValuesQuery", + "NotebookTemplateVariableAvailableValuesQueryGroupBy", + "NotebookTemplateVariableAvailableValuesQueryLogRumSpans", + "NotebookTemplateVariableAvailableValuesQueryMetrics", + "NotebookTemplateVariableAvailableValuesQuerySearch", "NotebookTimeseriesCellAttributes", "NotebookToplistCellAttributes", "NotebookUpdateCell", diff --git a/tests/v1/features/notebooks.feature b/tests/v1/features/notebooks.feature index 3ff8343c9b..1a7dcacb6b 100644 --- a/tests/v1/features/notebooks.feature +++ b/tests/v1/features/notebooks.feature @@ -13,7 +13,7 @@ Feature: Notebooks @generated @skip @team:DataDog/notebooks Scenario: Create a notebook returns "Bad Request" response Given new "CreateNotebook" request - And body with value {"data": {"attributes": {"cells": [{"attributes": {"definition": {"text": "## Some test markdown\n\n```\nvar x, y;\nx = 5;\ny = 6;\n```", "type": "markdown"}}, "type": "notebook_cells"}, {"attributes": {"definition": {"requests": [{"display_type": "line", "q": "avg:system.load.1{*}", "style": {"line_type": "solid", "line_width": "normal", "palette": "dog_classic"}}], "show_legend": true, "type": "timeseries", "yaxis": {"scale": "linear"}}, "graph_size": "m", "split_by": {"keys": [], "tags": []}, "time": null}, "type": "notebook_cells"}], "metadata": {"is_template": false, "take_snapshots": false, "type": "investigation"}, "name": "Example Notebook", "status": "published", "time": {"live_span": "1h"}}, "type": "notebooks"}} + And body with value {"data": {"attributes": {"cells": [{"attributes": {"definition": {"text": "## Some test markdown\n\n```\nvar x, y;\nx = 5;\ny = 6;\n```", "type": "markdown"}}, "type": "notebook_cells"}, {"attributes": {"definition": {"requests": [{"display_type": "line", "q": "avg:system.load.1{*}", "style": {"line_type": "solid", "line_width": "normal", "palette": "dog_classic"}}], "show_legend": true, "type": "timeseries", "yaxis": {"scale": "linear"}}, "graph_size": "m", "split_by": {"keys": [], "tags": []}, "time": null}, "type": "notebook_cells"}], "metadata": {"is_template": false, "take_snapshots": false, "type": "investigation"}, "name": "Example Notebook", "status": "published", "template_variables": [{"available_values": ["my-host", "host1", "host2"], "available_values_query": {"data_source": "logs", "group_by": [{"facet": "host"}], "search": {"query": "service:web"}}, "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "placement": "global", "prefix": "host", "type": "tag"}], "time": {"live_span": "1h"}}, "type": "notebooks"}} When the request is sent Then the response status is 400 Bad Request @@ -98,7 +98,7 @@ Feature: Notebooks Scenario: Update a notebook returns "Bad Request" response Given new "UpdateNotebook" request And request contains "notebook_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"cells": [{"attributes": {"definition": {"text": "## Some test markdown\n\n```\nvar x, y;\nx = 5;\ny = 6;\n```", "type": "markdown"}}, "id": "bzbycoya", "type": "notebook_cells"}, {"attributes": {"definition": {"requests": [{"display_type": "line", "q": "avg:system.load.1{*}", "style": {"line_type": "solid", "line_width": "normal", "palette": "dog_classic"}}], "show_legend": true, "type": "timeseries", "yaxis": {"scale": "linear"}}, "graph_size": "m", "split_by": {"keys": [], "tags": []}, "time": null}, "id": "9k6bc6xc", "type": "notebook_cells"}], "metadata": {"is_template": false, "take_snapshots": false, "type": "investigation"}, "name": "Example Notebook", "status": "published", "time": {"live_span": "1h"}}, "type": "notebooks"}} + And body with value {"data": {"attributes": {"cells": [{"attributes": {"definition": {"text": "## Some test markdown\n\n```\nvar x, y;\nx = 5;\ny = 6;\n```", "type": "markdown"}}, "id": "bzbycoya", "type": "notebook_cells"}, {"attributes": {"definition": {"requests": [{"display_type": "line", "q": "avg:system.load.1{*}", "style": {"line_type": "solid", "line_width": "normal", "palette": "dog_classic"}}], "show_legend": true, "type": "timeseries", "yaxis": {"scale": "linear"}}, "graph_size": "m", "split_by": {"keys": [], "tags": []}, "time": null}, "id": "9k6bc6xc", "type": "notebook_cells"}], "metadata": {"is_template": false, "take_snapshots": false, "type": "investigation"}, "name": "Example Notebook", "status": "published", "template_variables": [{"available_values": ["my-host", "host1", "host2"], "available_values_query": {"data_source": "logs", "group_by": [{"facet": "host"}], "search": {"query": "service:web"}}, "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "placement": "global", "prefix": "host", "type": "tag"}], "time": {"live_span": "1h"}}, "type": "notebooks"}} When the request is sent Then the response status is 400 Bad Request @@ -106,7 +106,7 @@ Feature: Notebooks Scenario: Update a notebook returns "Conflict" response Given new "UpdateNotebook" request And request contains "notebook_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"cells": [{"attributes": {"definition": {"text": "## Some test markdown\n\n```\nvar x, y;\nx = 5;\ny = 6;\n```", "type": "markdown"}}, "id": "bzbycoya", "type": "notebook_cells"}, {"attributes": {"definition": {"requests": [{"display_type": "line", "q": "avg:system.load.1{*}", "style": {"line_type": "solid", "line_width": "normal", "palette": "dog_classic"}}], "show_legend": true, "type": "timeseries", "yaxis": {"scale": "linear"}}, "graph_size": "m", "split_by": {"keys": [], "tags": []}, "time": null}, "id": "9k6bc6xc", "type": "notebook_cells"}], "metadata": {"is_template": false, "take_snapshots": false, "type": "investigation"}, "name": "Example Notebook", "status": "published", "time": {"live_span": "1h"}}, "type": "notebooks"}} + And body with value {"data": {"attributes": {"cells": [{"attributes": {"definition": {"text": "## Some test markdown\n\n```\nvar x, y;\nx = 5;\ny = 6;\n```", "type": "markdown"}}, "id": "bzbycoya", "type": "notebook_cells"}, {"attributes": {"definition": {"requests": [{"display_type": "line", "q": "avg:system.load.1{*}", "style": {"line_type": "solid", "line_width": "normal", "palette": "dog_classic"}}], "show_legend": true, "type": "timeseries", "yaxis": {"scale": "linear"}}, "graph_size": "m", "split_by": {"keys": [], "tags": []}, "time": null}, "id": "9k6bc6xc", "type": "notebook_cells"}], "metadata": {"is_template": false, "take_snapshots": false, "type": "investigation"}, "name": "Example Notebook", "status": "published", "template_variables": [{"available_values": ["my-host", "host1", "host2"], "available_values_query": {"data_source": "logs", "group_by": [{"facet": "host"}], "search": {"query": "service:web"}}, "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "placement": "global", "prefix": "host", "type": "tag"}], "time": {"live_span": "1h"}}, "type": "notebooks"}} When the request is sent Then the response status is 409 Conflict @@ -114,7 +114,7 @@ Feature: Notebooks Scenario: Update a notebook returns "Not Found" response Given new "UpdateNotebook" request And request contains "notebook_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"cells": [{"attributes": {"definition": {"text": "## Some test markdown\n\n```\nvar x, y;\nx = 5;\ny = 6;\n```", "type": "markdown"}}, "id": "bzbycoya", "type": "notebook_cells"}, {"attributes": {"definition": {"requests": [{"display_type": "line", "q": "avg:system.load.1{*}", "style": {"line_type": "solid", "line_width": "normal", "palette": "dog_classic"}}], "show_legend": true, "type": "timeseries", "yaxis": {"scale": "linear"}}, "graph_size": "m", "split_by": {"keys": [], "tags": []}, "time": null}, "id": "9k6bc6xc", "type": "notebook_cells"}], "metadata": {"is_template": false, "take_snapshots": false, "type": "investigation"}, "name": "Example Notebook", "status": "published", "time": {"live_span": "1h"}}, "type": "notebooks"}} + And body with value {"data": {"attributes": {"cells": [{"attributes": {"definition": {"text": "## Some test markdown\n\n```\nvar x, y;\nx = 5;\ny = 6;\n```", "type": "markdown"}}, "id": "bzbycoya", "type": "notebook_cells"}, {"attributes": {"definition": {"requests": [{"display_type": "line", "q": "avg:system.load.1{*}", "style": {"line_type": "solid", "line_width": "normal", "palette": "dog_classic"}}], "show_legend": true, "type": "timeseries", "yaxis": {"scale": "linear"}}, "graph_size": "m", "split_by": {"keys": [], "tags": []}, "time": null}, "id": "9k6bc6xc", "type": "notebook_cells"}], "metadata": {"is_template": false, "take_snapshots": false, "type": "investigation"}, "name": "Example Notebook", "status": "published", "template_variables": [{"available_values": ["my-host", "host1", "host2"], "available_values_query": {"data_source": "logs", "group_by": [{"facet": "host"}], "search": {"query": "service:web"}}, "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "placement": "global", "prefix": "host", "type": "tag"}], "time": {"live_span": "1h"}}, "type": "notebooks"}} When the request is sent Then the response status is 404 Not Found