Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 107 additions & 8 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:<name>`.
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:
Expand Down
7 changes: 6 additions & 1 deletion src/datadog_api_client/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ def __init__(
self,
settings: Dict[str, Any],
params_map: Dict[str, Dict[str, Any]],
headers_map: Dict[str, List[str]],
headers_map: Dict[str, Any],
api_client: ApiClient,
):
"""Creates an endpoint.
Expand All @@ -708,6 +708,7 @@ def __init__(
:type params_map: dict
:param headers_map: See below key value pairs:
'accept' (list): list of Accept header strings
'api_version' (str): optional Datadog API version header value
'content_type' (list): list of Content-Type header strings
:type headers_map: dict
:param api_client API client instance.
Expand Down Expand Up @@ -780,6 +781,10 @@ def gather_params(self, kwargs):
header_list = self.api_client.select_header_content_type(content_type_headers_list)
params["header"]["Content-Type"] = header_list

api_version = self.headers_map.get("api_version")
if api_version:
params["header"]["DD-API-Version"] = api_version

self.update_params_for_auth(params["header"], params["query"])

return params
Expand Down
2 changes: 1 addition & 1 deletion src/datadog_api_client/v1/api/dashboards_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
)
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
from datadog_api_client.v1.model.delete_shared_dashboard_response import DeleteSharedDashboardResponse
from datadog_api_client.v1.model.shared_dashboard_update_request import SharedDashboardUpdateRequest
from datadog_api_client.v1.model.shared_dashboard_invites import SharedDashboardInvites
from datadog_api_client.v1.model.dashboard_delete_response import DashboardDeleteResponse
from datadog_api_client.v1.model.dashboard_summary_definition import DashboardSummaryDefinition


class DashboardsApi:
Expand Down
27 changes: 27 additions & 0 deletions src/datadog_api_client/v1_20270101/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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 datadog_api_client.api_client import ApiClient, AsyncApiClient
from datadog_api_client.configuration import Configuration
from datadog_api_client.exceptions import (
OpenApiException,
ApiAttributeError,
ApiTypeError,
ApiValueError,
ApiKeyError,
ApiException,
)


__all__ = [
"ApiClient",
"AsyncApiClient",
"Configuration",
"OpenApiException",
"ApiAttributeError",
"ApiTypeError",
"ApiValueError",
"ApiKeyError",
"ApiException",
]
Empty file.
160 changes: 160 additions & 0 deletions src/datadog_api_client/v1_20270101/api/dashboards_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# 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

import collections
from typing import Any, Dict, Union

from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint
from datadog_api_client.configuration import Configuration
from datadog_api_client.model_utils import (
set_attribute_from_path,
get_attribute_from_path,
UnsetType,
unset,
)
from datadog_api_client.v1_20270101.model.dashboard_summary import DashboardSummary
from datadog_api_client.v1_20270101.model.dashboard_summary_definition import DashboardSummaryDefinition


class DashboardsApi:
"""
Manage all your dashboards, as well as access to your shared dashboards, through the API. See the `Dashboards page <https://docs.datadoghq.com/dashboards/>`_ for more information.
"""

def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient(Configuration())
self.api_client = api_client

self._list_dashboards_endpoint = _Endpoint(
settings={
"response_type": (DashboardSummary,),
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v1/dashboard",
"operation_id": "list_dashboards",
"http_method": "GET",
"version": "v1",
},
params_map={
"filter_shared": {
"openapi_types": (bool,),
"attribute": "filter[shared]",
"location": "query",
},
"filter_deleted": {
"openapi_types": (bool,),
"attribute": "filter[deleted]",
"location": "query",
},
"count": {
"openapi_types": (int,),
"attribute": "count",
"location": "query",
},
"start": {
"openapi_types": (int,),
"attribute": "start",
"location": "query",
},
},
headers_map={
"accept": ["application/json"],
"api_version": "2027-01-01",
},
api_client=api_client,
)

def list_dashboards(
self,
*,
filter_shared: Union[bool, UnsetType] = unset,
filter_deleted: Union[bool, UnsetType] = unset,
count: Union[int, UnsetType] = unset,
start: Union[int, UnsetType] = unset,
) -> DashboardSummary:
"""Get all dashboards.

Get all dashboards.

**Note** : This query will only return custom created or cloned dashboards.
This query will not return preset dashboards.

:param filter_shared: When ``true`` , this query only returns shared custom created
or cloned dashboards.
:type filter_shared: bool, optional
:param filter_deleted: When ``true`` , this query returns only deleted custom-created
or cloned dashboards. This parameter is incompatible with ``filter[shared]``.
:type filter_deleted: bool, optional
:param count: The maximum number of dashboards returned in the list.
:type count: int, optional
:param start: The specific offset to use as the beginning of the returned response.
:type start: int, optional
:rtype: DashboardSummary
"""
kwargs: Dict[str, Any] = {}
if filter_shared is not unset:
kwargs["filter_shared"] = filter_shared

if filter_deleted is not unset:
kwargs["filter_deleted"] = filter_deleted

if count is not unset:
kwargs["count"] = count

if start is not unset:
kwargs["start"] = start

return self._list_dashboards_endpoint.call_with_http_info(**kwargs)

def list_dashboards_with_pagination(
self,
*,
filter_shared: Union[bool, UnsetType] = unset,
filter_deleted: Union[bool, UnsetType] = unset,
count: Union[int, UnsetType] = unset,
start: Union[int, UnsetType] = unset,
) -> collections.abc.Iterable[DashboardSummaryDefinition]:
"""Get all dashboards.

Provide a paginated version of :meth:`list_dashboards`, returning all items.

:param filter_shared: When ``true`` , this query only returns shared custom created
or cloned dashboards.
:type filter_shared: bool, optional
:param filter_deleted: When ``true`` , this query returns only deleted custom-created
or cloned dashboards. This parameter is incompatible with ``filter[shared]``.
:type filter_deleted: bool, optional
:param count: The maximum number of dashboards returned in the list.
:type count: int, optional
:param start: The specific offset to use as the beginning of the returned response.
:type start: int, optional

:return: A generator of paginated results.
:rtype: collections.abc.Iterable[DashboardSummaryDefinition]
"""
kwargs: Dict[str, Any] = {}
if filter_shared is not unset:
kwargs["filter_shared"] = filter_shared

if filter_deleted is not unset:
kwargs["filter_deleted"] = filter_deleted

if count is not unset:
kwargs["count"] = count

if start is not unset:
kwargs["start"] = start

local_page_size = get_attribute_from_path(kwargs, "count", 100)
endpoint = self._list_dashboards_endpoint
set_attribute_from_path(kwargs, "count", local_page_size, endpoint.params_map)
pagination = {
"limit_value": local_page_size,
"results_path": "dashboards",
"page_offset_param": "start",
"endpoint": endpoint,
"kwargs": kwargs,
}
return endpoint.call_with_http_info_paginated(pagination)
6 changes: 6 additions & 0 deletions src/datadog_api_client/v1_20270101/apis/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from datadog_api_client.v1_20270101.api.dashboards_api import DashboardsApi


__all__ = [
"DashboardsApi",
]
Empty file.
Loading
Loading