diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index bf2effce63..82c52f0447 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -10354,6 +10354,16 @@ components: type: string status: $ref: '#/components/schemas/NotebookStatus' + template_variables: + description: List of template variables for this notebook. + example: + - available_values: [] + default: '*' + name: host + prefix: host + items: + $ref: '#/components/schemas/NotebookTemplateVariable' + type: array time: $ref: '#/components/schemas/NotebookGlobalTime' required: @@ -10657,6 +10667,39 @@ components: type: string x-enum-varnames: - PUBLISHED + NotebookTemplateVariable: + description: Template variable for a notebook. + 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. + type: string + nullable: true + type: array + default: + description: The default value for the template variable. + example: '*' + nullable: true + type: string + name: + description: The name of the variable. + example: host + 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 + required: + - name + type: object NotebookTimeseriesCellAttributes: description: The attributes of a notebook `timeseries` cell. properties: @@ -10760,6 +10803,16 @@ components: type: string status: $ref: '#/components/schemas/NotebookStatus' + template_variables: + description: List of template variables for this notebook. + example: + - available_values: [] + default: '*' + name: host + prefix: host + items: + $ref: '#/components/schemas/NotebookTemplateVariable' + type: array time: $ref: '#/components/schemas/NotebookGlobalTime' required: @@ -10836,6 +10889,16 @@ components: type: string status: $ref: '#/components/schemas/NotebookStatus' + template_variables: + description: List of template variables for this notebook. + example: + - available_values: [] + default: '*' + name: host + prefix: host + items: + $ref: '#/components/schemas/NotebookTemplateVariable' + 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 b20c86c2ba..b1fd71d234 100644 --- a/docs/datadog_api_client.v1.model.rst +++ b/docs/datadog_api_client.v1.model.rst @@ -2909,6 +2909,13 @@ 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\_timeseries\_cell\_attributes module --------------------------------------------------------------------------- diff --git a/examples/v1/notebooks/CreateNotebook.py b/examples/v1/notebooks/CreateNotebook.py index d21720995e..4181971e6c 100644 --- a/examples/v1/notebooks/CreateNotebook.py +++ b/examples/v1/notebooks/CreateNotebook.py @@ -17,6 +17,7 @@ from datadog_api_client.v1.model.notebook_resource_type import NotebookResourceType 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_timeseries_cell_attributes import NotebookTimeseriesCellAttributes from datadog_api_client.v1.model.timeseries_widget_definition import TimeseriesWidgetDefinition from datadog_api_client.v1.model.timeseries_widget_definition_type import TimeseriesWidgetDefinitionType @@ -73,6 +74,17 @@ ], name="Example-Notebook", status=NotebookStatus.PUBLISHED, + template_variables=[ + NotebookTemplateVariable( + name="example-notebook", + prefix="host", + available_values=[ + "host1", + "host2", + ], + default="*", + ), + ], time=NotebookRelativeTime( live_span=WidgetLiveSpan.PAST_ONE_HOUR, ), diff --git a/examples/v1/notebooks/UpdateNotebook.py b/examples/v1/notebooks/UpdateNotebook.py index c38d25748c..310e88611c 100644 --- a/examples/v1/notebooks/UpdateNotebook.py +++ b/examples/v1/notebooks/UpdateNotebook.py @@ -15,6 +15,7 @@ from datadog_api_client.v1.model.notebook_resource_type import NotebookResourceType 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_timeseries_cell_attributes import NotebookTimeseriesCellAttributes from datadog_api_client.v1.model.notebook_update_data import NotebookUpdateData from datadog_api_client.v1.model.notebook_update_data_attributes import NotebookUpdateDataAttributes @@ -77,6 +78,14 @@ ], name="Example-Notebook-updated", status=NotebookStatus.PUBLISHED, + template_variables=[ + NotebookTemplateVariable( + name="example-notebook", + prefix="service", + available_values=[], + default="*", + ), + ], time=NotebookRelativeTime( live_span=WidgetLiveSpan.PAST_ONE_HOUR, ), 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..288b2861e3 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 @@ -17,6 +17,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 +36,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 +44,7 @@ def openapi_types(_): "metadata": (NotebookMetadata,), "name": (str,), "status": (NotebookStatus,), + "template_variables": ([NotebookTemplateVariable],), "time": (NotebookGlobalTime,), } @@ -50,6 +53,7 @@ def openapi_types(_): "metadata": "metadata", "name": "name", "status": "status", + "template_variables": "template_variables", "time": "time", } @@ -60,6 +64,7 @@ def __init__( time: Union[NotebookGlobalTime, NotebookRelativeTime, NotebookAbsoluteTime], metadata: Union[NotebookMetadata, UnsetType] = unset, status: Union[NotebookStatus, UnsetType] = unset, + template_variables: Union[List[NotebookTemplateVariable], UnsetType] = unset, **kwargs, ): """ @@ -77,6 +82,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], optional + :param time: Notebook global timeframe. :type time: NotebookGlobalTime """ @@ -84,6 +92,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_template_variable.py b/src/datadog_api_client/v1/model/notebook_template_variable.py new file mode 100644 index 0000000000..8258829681 --- /dev/null +++ b/src/datadog_api_client/v1/model/notebook_template_variable.py @@ -0,0 +1,65 @@ +# 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, + none_type, + unset, + UnsetType, +) + + +class NotebookTemplateVariable(ModelNormal): + @cached_property + def openapi_types(_): + return { + "available_values": ([str], none_type), + "default": (str, none_type), + "name": (str,), + "prefix": (str, none_type), + } + + attribute_map = { + "available_values": "available_values", + "default": "default", + "name": "name", + "prefix": "prefix", + } + + def __init__( + self_, + name: str, + available_values: Union[List[str], none_type, UnsetType] = unset, + default: Union[str, none_type, UnsetType] = unset, + prefix: Union[str, none_type, UnsetType] = unset, + **kwargs, + ): + """ + Template variable for a notebook. + + :param available_values: The list of values that the template variable drop-down is limited to. + :type available_values: [str], none_type, optional + + :param default: The default value for the template variable. + :type default: str, none_type, optional + + :param name: The name of the variable. + :type name: str + + :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 + """ + if available_values is not unset: + kwargs["available_values"] = available_values + if default is not unset: + kwargs["default"] = default + if prefix is not unset: + kwargs["prefix"] = prefix + super().__init__(kwargs) + + self_.name = name 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..b295590c82 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 @@ -17,6 +17,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 +38,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 +46,7 @@ def openapi_types(_): "metadata": (NotebookMetadata,), "name": (str,), "status": (NotebookStatus,), + "template_variables": ([NotebookTemplateVariable],), "time": (NotebookGlobalTime,), } @@ -52,6 +55,7 @@ def openapi_types(_): "metadata": "metadata", "name": "name", "status": "status", + "template_variables": "template_variables", "time": "time", } @@ -62,6 +66,7 @@ def __init__( time: Union[NotebookGlobalTime, NotebookRelativeTime, NotebookAbsoluteTime], metadata: Union[NotebookMetadata, UnsetType] = unset, status: Union[NotebookStatus, UnsetType] = unset, + template_variables: Union[List[NotebookTemplateVariable], UnsetType] = unset, **kwargs, ): """ @@ -79,6 +84,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], optional + :param time: Notebook global timeframe. :type time: NotebookGlobalTime """ @@ -86,6 +94,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..bc04ddb779 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 @@ -19,6 +19,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 +39,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 +50,7 @@ def openapi_types(_): "modified": (datetime,), "name": (str,), "status": (NotebookStatus,), + "template_variables": ([NotebookTemplateVariable],), "time": (NotebookGlobalTime,), } @@ -59,6 +62,7 @@ def openapi_types(_): "modified": "modified", "name": "name", "status": "status", + "template_variables": "template_variables", "time": "time", } read_only_vars = { @@ -75,6 +79,7 @@ def __init__( metadata: Union[NotebookMetadata, UnsetType] = unset, modified: Union[datetime, UnsetType] = unset, status: Union[NotebookStatus, UnsetType] = unset, + template_variables: Union[List[NotebookTemplateVariable], UnsetType] = unset, time: Union[NotebookGlobalTime, NotebookRelativeTime, NotebookAbsoluteTime, UnsetType] = unset, **kwargs, ): @@ -102,6 +107,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], optional + :param time: Notebook global timeframe. :type time: NotebookGlobalTime, optional """ @@ -117,6 +125,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 1710446bfc..53f86032f6 100644 --- a/src/datadog_api_client/v1/models/__init__.py +++ b/src/datadog_api_client/v1/models/__init__.py @@ -485,6 +485,7 @@ 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_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 @@ -1566,6 +1567,7 @@ "NotebookResponseDataAttributes", "NotebookSplitBy", "NotebookStatus", + "NotebookTemplateVariable", "NotebookTimeseriesCellAttributes", "NotebookToplistCellAttributes", "NotebookUpdateCell", diff --git a/tests/v1/features/given.json b/tests/v1/features/given.json index 2606012caa..aa9fec2638 100644 --- a/tests/v1/features/given.json +++ b/tests/v1/features/given.json @@ -178,7 +178,7 @@ "parameters": [ { "name": "body", - "value": "{\n \"data\": {\n \"type\": \"notebooks\",\n \"attributes\": {\n \"name\": \"{{ unique }}\",\n \"time\": { \"live_span\": \"1h\" },\n \"cells\": [\n {\n \"attributes\": {\n \"definition\": {\n \"text\": \"# {{ unique }} notebook text\",\n \"type\": \"markdown\"\n }\n },\n \"type\": \"notebook_cells\"\n }\n ]\n }\n }\n}\n" + "value": "{\n \"data\": {\n \"type\": \"notebooks\",\n \"attributes\": {\n \"name\": \"{{ unique }}\",\n \"time\": { \"live_span\": \"1h\" },\n \"cells\": [\n {\n \"attributes\": {\n \"definition\": {\n \"text\": \"# {{ unique }} notebook text\",\n \"type\": \"markdown\"\n }\n },\n \"type\": \"notebook_cells\"\n }\n ],\n \"template_variables\": [\n {\n \"name\": \"{{ unique_lower }}\",\n \"prefix\": \"host\",\n \"available_values\": [],\n \"default\": \"*\"\n }\n ]\n }\n }\n}\n" } ], "step": "there is a valid \"notebook\" in the system", diff --git a/tests/v1/features/notebook_payload.json b/tests/v1/features/notebook_payload.json index 04b2b683fb..b9beeac570 100644 --- a/tests/v1/features/notebook_payload.json +++ b/tests/v1/features/notebook_payload.json @@ -14,6 +14,14 @@ }, "type": "notebook_cells" } + ], + "template_variables": [ + { + "name": "{{ unique_lower }}", + "prefix": "host", + "available_values": [], + "default": "*" + } ] } } diff --git a/tests/v1/features/notebooks.feature b/tests/v1/features/notebooks.feature index 3ff8343c9b..903686d1cc 100644 --- a/tests/v1/features/notebooks.feature +++ b/tests/v1/features/notebooks.feature @@ -13,19 +13,22 @@ 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": [], "default": "*", "name": "host", "prefix": "host"}], "time": {"live_span": "1h"}}, "type": "notebooks"}} When the request is sent Then the response status is 400 Bad Request @team:DataDog/notebooks Scenario: Create a notebook returns "OK" 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"}], "name": "{{ unique }}", "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"}], "name": "{{ unique }}", "status": "published", "template_variables": [{"name": "{{ unique_lower }}", "prefix": "host", "available_values": ["host1", "host2"], "default": "*"}], "time": {"live_span": "1h"}}, "type": "notebooks"}} When the request is sent Then the response status is 200 OK And the response "data.type" is equal to "notebooks" And the response "data.attributes.name" is equal to "{{ unique }}" And the response "data.attributes.cells[0].attributes.definition.text" is equal to "## Some test markdown\n\n```\nvar x, y;\nx = 5;\ny = 6;\n```" + And the response "data.attributes.template_variables[0].name" is equal to "{{ unique_lower }}" + And the response "data.attributes.template_variables[0].prefix" is equal to "host" + And the response "data.attributes.template_variables[0].default" is equal to "*" @skip @team:DataDog/notebooks Scenario: Delete a notebook returns "Bad Request" response @@ -72,6 +75,9 @@ Feature: Notebooks Then the response status is 200 OK And the response "data.attributes.name" has the same value as "notebook.data.attributes.name" And the response "data.attributes.cells[0].attributes.definition.type" has the same value as "notebook.data.attributes.cells[0].attributes.definition.type" + And the response "data.attributes.template_variables[0].name" has the same value as "notebook.data.attributes.template_variables[0].name" + And the response "data.attributes.template_variables[0].prefix" is equal to "host" + And the response "data.attributes.template_variables[0].default" is equal to "*" @generated @skip @team:DataDog/notebooks Scenario: Get all notebooks returns "Bad Request" response @@ -98,7 +104,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": [], "default": "*", "name": "host", "prefix": "host"}], "time": {"live_span": "1h"}}, "type": "notebooks"}} When the request is sent Then the response status is 400 Bad Request @@ -106,7 +112,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": [], "default": "*", "name": "host", "prefix": "host"}], "time": {"live_span": "1h"}}, "type": "notebooks"}} When the request is sent Then the response status is 409 Conflict @@ -114,7 +120,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": [], "default": "*", "name": "host", "prefix": "host"}], "time": {"live_span": "1h"}}, "type": "notebooks"}} When the request is sent Then the response status is 404 Not Found @@ -123,8 +129,11 @@ Feature: Notebooks Given new "UpdateNotebook" request And there is a valid "notebook" in the system And request contains "notebook_id" parameter from "notebook.data.id" - 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"}], "name": "{{ unique }}-updated", "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"}], "name": "{{ unique }}-updated", "status": "published", "template_variables": [{"name": "{{ unique_lower }}", "prefix": "service", "available_values": [], "default": "*"}], "time": {"live_span": "1h"}}, "type": "notebooks"}} When the request is sent Then the response status is 200 OK And the response "data.attributes.name" is equal to "{{ unique }}-updated" And the response "data.attributes.status" is equal to "published" + And the response "data.attributes.template_variables[0].name" is equal to "{{ unique_lower }}" + And the response "data.attributes.template_variables[0].prefix" is equal to "service" + And the response "data.attributes.template_variables[0].default" is equal to "*" diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_test_suite_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_test_suite_returns_ok_response.frozen index 957e037f23..62723cd8d2 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_a_test_suite_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_create_a_test_suite_returns_ok_response.frozen @@ -1 +1 @@ -2026-02-18T16:57:05.121Z \ No newline at end of file +2026-01-07T12:38:45.716Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_test_suite_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_test_suite_returns_ok_response.yaml index ee353eaab8..d29e21551c 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_a_test_suite_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_create_a_test_suite_returns_ok_response.yaml @@ -11,10 +11,10 @@ interactions: uri: https://api.datadoghq.com/api/v2/synthetics/suites response: body: - string: '{"data":{"type":"suites","attributes":{"type":"suite","monitor_id":259845717,"name":"Example - suite name","options":{},"tests":[],"tags":["env:production"],"public_id":"hik-xp5-9q6","created_at":"2026-02-18T16:57:05.583051+00:00","modified_at":"2026-02-18T16:57:05.583051+00:00","created_by":{"name":"Corentin - Girard","email":"corentin.girard@datadoghq.com","handle":"corentin.girard@datadoghq.com"},"message":"Notification - message","org_id":321813,"modified_by":{"name":"Corentin Girard","email":"corentin.girard@datadoghq.com","handle":"corentin.girard@datadoghq.com"}},"id":"hik-xp5-9q6"}} + string: '{"data":{"type":"suites","id":"36n-bb6-njj","attributes":{"tags":["env:production"],"type":"suite","created_by":{"email":"team-intg-tools-libs-spam@datadoghq.com","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account"},"created_at":"2026-01-07T12:38:46.109472+00:00","modified_at":"2026-01-07T12:38:46.109472+00:00","message":"Notification + message","public_id":"36n-bb6-njj","options":{},"modified_by":{"email":"team-intg-tools-libs-spam@datadoghq.com","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","name":"CI + Account"},"tests":[],"name":"Example suite name","org_id":321813,"monitor_id":249141773}}} ' headers: @@ -24,7 +24,7 @@ interactions: code: 200 message: OK - request: - body: '{"data":{"attributes":{"public_ids":["hik-xp5-9q6"]},"type":"delete_suites_request"}}' + body: '{"data":{"attributes":{"public_ids":["36n-bb6-njj"]},"type":"delete_suites_request"}}' headers: accept: - application/json @@ -34,7 +34,8 @@ interactions: uri: https://api.datadoghq.com/api/v2/synthetics/suites/bulk-delete response: body: - string: '{"data":[{"type":"suites","attributes":{"deleted_at":"2026-02-18 16:57:06.420679","public_id":"hik-xp5-9q6"},"id":"hik-xp5-9q6"}]} + string: '{"data":[{"type":"suites","attributes":{"public_id":"36n-bb6-njj","deleted_at":"2026-01-07 + 12:38:46.679914"},"id":"36n-bb6-njj"}]} ' headers: