diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 7056d83d64..817b35746c 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -1780,14 +1780,11 @@ components: - INVITE - EMBED DashboardSummary: - description: Dashboard summary response. - properties: - dashboards: - description: List of dashboard definitions. - items: - $ref: "#/components/schemas/DashboardSummaryDefinition" - type: array - type: object + description: Dashboard summary response with API-versioned representations. + oneOf: + - $ref: "#/components/schemas/DashboardSummary_V1" + - $ref: "#/components/schemas/DashboardSummary_20270101" + x-datadog-api-versioned: true DashboardSummaryDefinition: description: Dashboard definition. properties: @@ -1825,6 +1822,108 @@ components: description: URL of the dashboard. type: string type: object + DashboardSummaryDefinition_20270101: + description: Dashboard definition. + properties: + author: + $ref: "#/components/schemas/Creator" + created: + description: Date of creation of the dashboard. + format: date-time + nullable: true + readOnly: true + type: string + icon: + description: URL to the icon of the dashboard. + nullable: true + readOnly: true + type: string + id: + $ref: "#/components/schemas/DashboardSummaryID_20270101" + integration_id: + description: The short name of the integration. + nullable: true + readOnly: true + type: string + is_favorite: + description: Whether the dashboard is in the favorites. + readOnly: true + type: boolean + is_read_only: + description: Whether the dashboard is read only. + readOnly: true + type: boolean + is_shared: + description: Whether the dashboard is publicly shared. + readOnly: true + type: boolean + last_view_date: + description: Date when the dashboard was last viewed. + nullable: true + readOnly: true + type: string + modified: + description: Date of last edition of the dashboard. + format: date-time + nullable: true + readOnly: true + type: string + popularity: + description: Popularity of the dashboard. + format: int32 + maximum: 5 + readOnly: true + type: integer + tags: + description: List of team names representing ownership of the dashboard. + items: + description: The name of a Datadog team, formatted as `team:`. + type: string + nullable: true + readOnly: true + type: array + title: + description: Title of the dashboard. + readOnly: true + type: string + type: + description: The type of the dashboard. + readOnly: true + type: string + url: + description: URL path to the dashboard. + readOnly: true + type: string + type: object + DashboardSummaryID_20270101: + description: ID of the dashboard. + oneOf: + - type: string + - format: int64 + type: integer + DashboardSummary_20270101: + description: Dashboard summary response. + properties: + dashboards: + description: List of dashboard definitions. + items: + $ref: "#/components/schemas/DashboardSummaryDefinition_20270101" + type: array + total: + description: Number of dashboards. + format: int64 + readOnly: true + type: integer + type: object + DashboardSummary_V1: + description: Dashboard summary response. + properties: + dashboards: + description: List of dashboard definitions. + items: + $ref: "#/components/schemas/DashboardSummaryDefinition" + type: array + type: object DashboardTab: description: Dashboard tab for organizing widgets. properties: diff --git a/src/datadog_api_client/v1/api/dashboards_api.py b/src/datadog_api_client/v1/api/dashboards_api.py index 88b7b4c560..baaa841618 100644 --- a/src/datadog_api_client/v1/api/dashboards_api.py +++ b/src/datadog_api_client/v1/api/dashboards_api.py @@ -16,7 +16,6 @@ ) from datadog_api_client.v1.model.dashboard_bulk_delete_request import DashboardBulkDeleteRequest from datadog_api_client.v1.model.dashboard_summary import DashboardSummary -from datadog_api_client.v1.model.dashboard_summary_definition import DashboardSummaryDefinition from datadog_api_client.v1.model.dashboard_restore_request import DashboardRestoreRequest from datadog_api_client.v1.model.dashboard import Dashboard from datadog_api_client.v1.model.shared_dashboard import SharedDashboard @@ -603,7 +602,7 @@ def list_dashboards_with_pagination( filter_deleted: Union[bool, UnsetType] = unset, count: Union[int, UnsetType] = unset, start: Union[int, UnsetType] = unset, - ) -> collections.abc.Iterable[DashboardSummaryDefinition]: + ) -> collections.abc.Iterable[None]: """Get all dashboards. Provide a paginated version of :meth:`list_dashboards`, returning all items. @@ -620,7 +619,7 @@ def list_dashboards_with_pagination( :type start: int, optional :return: A generator of paginated results. - :rtype: collections.abc.Iterable[DashboardSummaryDefinition] + :rtype: collections.abc.Iterable[None] """ kwargs: Dict[str, Any] = {} if filter_shared is not unset: diff --git a/src/datadog_api_client/v1/model/dashboard_summary.py b/src/datadog_api_client/v1/model/dashboard_summary.py index 6d91e1aec9..07c8a51b08 100644 --- a/src/datadog_api_client/v1/model/dashboard_summary.py +++ b/src/datadog_api_client/v1/model/dashboard_summary.py @@ -3,40 +3,41 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import List, Union, TYPE_CHECKING from datadog_api_client.model_utils import ( - ModelNormal, + ModelComposed, cached_property, - unset, - UnsetType, ) -if TYPE_CHECKING: - from datadog_api_client.v1.model.dashboard_summary_definition import DashboardSummaryDefinition - - -class DashboardSummary(ModelNormal): - @cached_property - def openapi_types(_): - from datadog_api_client.v1.model.dashboard_summary_definition import DashboardSummaryDefinition - - return { - "dashboards": ([DashboardSummaryDefinition],), - } - - attribute_map = { - "dashboards": "dashboards", - } - - def __init__(self_, dashboards: Union[List[DashboardSummaryDefinition], UnsetType] = unset, **kwargs): +class DashboardSummary(ModelComposed): + def __init__(self, **kwargs): """ - Dashboard summary response. + Dashboard summary response with API-versioned representations. :param dashboards: List of dashboard definitions. :type dashboards: [DashboardSummaryDefinition], optional + + :param total: Number of dashboards. + :type total: int, optional """ - if dashboards is not unset: - kwargs["dashboards"] = dashboards 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.dashboard_summary_v1 import DashboardSummary_V1 + from datadog_api_client.v1.model.dashboard_summary_20270101 import DashboardSummary_20270101 + + return { + "oneOf": [ + DashboardSummary_V1, + DashboardSummary_20270101, + ], + } diff --git a/src/datadog_api_client/v1/model/dashboard_summary_20270101.py b/src/datadog_api_client/v1/model/dashboard_summary_20270101.py new file mode 100644 index 0000000000..8a4a0ce83d --- /dev/null +++ b/src/datadog_api_client/v1/model/dashboard_summary_20270101.py @@ -0,0 +1,59 @@ +# 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.dashboard_summary_definition_20270101 import DashboardSummaryDefinition_20270101 + + +class DashboardSummary_20270101(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.dashboard_summary_definition_20270101 import ( + DashboardSummaryDefinition_20270101, + ) + + return { + "dashboards": ([DashboardSummaryDefinition_20270101],), + "total": (int,), + } + + attribute_map = { + "dashboards": "dashboards", + "total": "total", + } + read_only_vars = { + "total", + } + + def __init__( + self_, + dashboards: Union[List[DashboardSummaryDefinition_20270101], UnsetType] = unset, + total: Union[int, UnsetType] = unset, + **kwargs, + ): + """ + Dashboard summary response. + + :param dashboards: List of dashboard definitions. + :type dashboards: [DashboardSummaryDefinition_20270101], optional + + :param total: Number of dashboards. + :type total: int, optional + """ + if dashboards is not unset: + kwargs["dashboards"] = dashboards + if total is not unset: + kwargs["total"] = total + super().__init__(kwargs) diff --git a/src/datadog_api_client/v1/model/dashboard_summary_definition_20270101.py b/src/datadog_api_client/v1/model/dashboard_summary_definition_20270101.py new file mode 100644 index 0000000000..01ea499621 --- /dev/null +++ b/src/datadog_api_client/v1/model/dashboard_summary_definition_20270101.py @@ -0,0 +1,184 @@ +# 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, + datetime, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.creator import Creator + from datadog_api_client.v1.model.dashboard_summary_id_20270101 import DashboardSummaryID_20270101 + + +class DashboardSummaryDefinition_20270101(ModelNormal): + validations = { + "popularity": { + "inclusive_maximum": 5, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.creator import Creator + from datadog_api_client.v1.model.dashboard_summary_id_20270101 import DashboardSummaryID_20270101 + + return { + "author": (Creator,), + "created": (datetime, none_type), + "icon": (str, none_type), + "id": (DashboardSummaryID_20270101,), + "integration_id": (str, none_type), + "is_favorite": (bool,), + "is_read_only": (bool,), + "is_shared": (bool,), + "last_view_date": (str, none_type), + "modified": (datetime, none_type), + "popularity": (int,), + "tags": ([str], none_type), + "title": (str,), + "type": (str,), + "url": (str,), + } + + attribute_map = { + "author": "author", + "created": "created", + "icon": "icon", + "id": "id", + "integration_id": "integration_id", + "is_favorite": "is_favorite", + "is_read_only": "is_read_only", + "is_shared": "is_shared", + "last_view_date": "last_view_date", + "modified": "modified", + "popularity": "popularity", + "tags": "tags", + "title": "title", + "type": "type", + "url": "url", + } + read_only_vars = { + "author", + "created", + "icon", + "integration_id", + "is_favorite", + "is_read_only", + "is_shared", + "last_view_date", + "modified", + "popularity", + "tags", + "title", + "type", + "url", + } + + def __init__( + self_, + author: Union[Creator, UnsetType] = unset, + created: Union[datetime, none_type, UnsetType] = unset, + icon: Union[str, none_type, UnsetType] = unset, + id: Union[DashboardSummaryID_20270101, str, int, UnsetType] = unset, + integration_id: Union[str, none_type, UnsetType] = unset, + is_favorite: Union[bool, UnsetType] = unset, + is_read_only: Union[bool, UnsetType] = unset, + is_shared: Union[bool, UnsetType] = unset, + last_view_date: Union[str, none_type, UnsetType] = unset, + modified: Union[datetime, none_type, UnsetType] = unset, + popularity: Union[int, UnsetType] = unset, + tags: Union[List[str], none_type, UnsetType] = unset, + title: Union[str, UnsetType] = unset, + type: Union[str, UnsetType] = unset, + url: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Dashboard definition. + + :param author: Object describing the creator of the shared element. + :type author: Creator, optional + + :param created: Date of creation of the dashboard. + :type created: datetime, none_type, optional + + :param icon: URL to the icon of the dashboard. + :type icon: str, none_type, optional + + :param id: ID of the dashboard. + :type id: DashboardSummaryID_20270101, optional + + :param integration_id: The short name of the integration. + :type integration_id: str, none_type, optional + + :param is_favorite: Whether the dashboard is in the favorites. + :type is_favorite: bool, optional + + :param is_read_only: Whether the dashboard is read only. + :type is_read_only: bool, optional + + :param is_shared: Whether the dashboard is publicly shared. + :type is_shared: bool, optional + + :param last_view_date: Date when the dashboard was last viewed. + :type last_view_date: str, none_type, optional + + :param modified: Date of last edition of the dashboard. + :type modified: datetime, none_type, optional + + :param popularity: Popularity of the dashboard. + :type popularity: int, optional + + :param tags: List of team names representing ownership of the dashboard. + :type tags: [str], none_type, optional + + :param title: Title of the dashboard. + :type title: str, optional + + :param type: The type of the dashboard. + :type type: str, optional + + :param url: URL path to the dashboard. + :type url: str, optional + """ + if author is not unset: + kwargs["author"] = author + if created is not unset: + kwargs["created"] = created + if icon is not unset: + kwargs["icon"] = icon + if id is not unset: + kwargs["id"] = id + if integration_id is not unset: + kwargs["integration_id"] = integration_id + if is_favorite is not unset: + kwargs["is_favorite"] = is_favorite + if is_read_only is not unset: + kwargs["is_read_only"] = is_read_only + if is_shared is not unset: + kwargs["is_shared"] = is_shared + if last_view_date is not unset: + kwargs["last_view_date"] = last_view_date + if modified is not unset: + kwargs["modified"] = modified + if popularity is not unset: + kwargs["popularity"] = popularity + if tags is not unset: + kwargs["tags"] = tags + if title is not unset: + kwargs["title"] = title + if type is not unset: + kwargs["type"] = type + if url is not unset: + kwargs["url"] = url + super().__init__(kwargs) diff --git a/src/datadog_api_client/v1/model/dashboard_summary_id_20270101.py b/src/datadog_api_client/v1/model/dashboard_summary_id_20270101.py new file mode 100644 index 0000000000..b58f6053a8 --- /dev/null +++ b/src/datadog_api_client/v1/model/dashboard_summary_id_20270101.py @@ -0,0 +1,34 @@ +# 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 DashboardSummaryID_20270101(ModelComposed): + def __init__(self, **kwargs): + """ + ID of the dashboard. + """ + 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 + return { + "oneOf": [ + str, + int, + ], + } diff --git a/src/datadog_api_client/v1/model/dashboard_summary_v1.py b/src/datadog_api_client/v1/model/dashboard_summary_v1.py new file mode 100644 index 0000000000..7976e01f62 --- /dev/null +++ b/src/datadog_api_client/v1/model/dashboard_summary_v1.py @@ -0,0 +1,42 @@ +# 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.dashboard_summary_definition import DashboardSummaryDefinition + + +class DashboardSummary_V1(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.dashboard_summary_definition import DashboardSummaryDefinition + + return { + "dashboards": ([DashboardSummaryDefinition],), + } + + attribute_map = { + "dashboards": "dashboards", + } + + def __init__(self_, dashboards: Union[List[DashboardSummaryDefinition], UnsetType] = unset, **kwargs): + """ + Dashboard summary response. + + :param dashboards: List of dashboard definitions. + :type dashboards: [DashboardSummaryDefinition], optional + """ + if dashboards is not unset: + kwargs["dashboards"] = dashboards + super().__init__(kwargs) diff --git a/src/datadog_api_client/v1/models/__init__.py b/src/datadog_api_client/v1/models/__init__.py index eec653fe66..0ca509db27 100644 --- a/src/datadog_api_client/v1/models/__init__.py +++ b/src/datadog_api_client/v1/models/__init__.py @@ -97,6 +97,10 @@ from datadog_api_client.v1.model.dashboard_share_type import DashboardShareType from datadog_api_client.v1.model.dashboard_summary import DashboardSummary from datadog_api_client.v1.model.dashboard_summary_definition import DashboardSummaryDefinition +from datadog_api_client.v1.model.dashboard_summary_definition_20270101 import DashboardSummaryDefinition_20270101 +from datadog_api_client.v1.model.dashboard_summary_id_20270101 import DashboardSummaryID_20270101 +from datadog_api_client.v1.model.dashboard_summary_20270101 import DashboardSummary_20270101 +from datadog_api_client.v1.model.dashboard_summary_v1 import DashboardSummary_V1 from datadog_api_client.v1.model.dashboard_tab import DashboardTab from datadog_api_client.v1.model.dashboard_template_variable import DashboardTemplateVariable from datadog_api_client.v1.model.dashboard_template_variable_preset import DashboardTemplateVariablePreset @@ -1549,6 +1553,10 @@ "DashboardShareType", "DashboardSummary", "DashboardSummaryDefinition", + "DashboardSummaryDefinition_20270101", + "DashboardSummaryID_20270101", + "DashboardSummary_20270101", + "DashboardSummary_V1", "DashboardTab", "DashboardTemplateVariable", "DashboardTemplateVariablePreset",