|
| 1 | +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. |
| 2 | +# This product includes software developed at Datadog (https://www.datadoghq.com/). |
| 3 | +# Copyright 2019-Present Datadog, Inc. |
| 4 | +from __future__ import annotations |
| 5 | + |
| 6 | +from typing import List, Union, TYPE_CHECKING |
| 7 | + |
| 8 | +from datadog_api_client.model_utils import ( |
| 9 | + ModelNormal, |
| 10 | + cached_property, |
| 11 | + unset, |
| 12 | + UnsetType, |
| 13 | +) |
| 14 | + |
| 15 | + |
| 16 | +if TYPE_CHECKING: |
| 17 | + from datadog_api_client.v1.model.widget_custom_link import WidgetCustomLink |
| 18 | + from datadog_api_client.v1.model.wildcard_widget_request import WildcardWidgetRequest |
| 19 | + from datadog_api_client.v1.model.wildcard_widget_specification import WildcardWidgetSpecification |
| 20 | + from datadog_api_client.v1.model.widget_time import WidgetTime |
| 21 | + from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign |
| 22 | + from datadog_api_client.v1.model.wildcard_widget_definition_type import WildcardWidgetDefinitionType |
| 23 | + from datadog_api_client.v1.model.tree_map_widget_request import TreeMapWidgetRequest |
| 24 | + from datadog_api_client.v1.model.timeseries_widget_request import TimeseriesWidgetRequest |
| 25 | + from datadog_api_client.v1.model.list_stream_widget_request import ListStreamWidgetRequest |
| 26 | + from datadog_api_client.v1.model.distribution_widget_request import DistributionWidgetRequest |
| 27 | + from datadog_api_client.v1.model.widget_legacy_live_span import WidgetLegacyLiveSpan |
| 28 | + from datadog_api_client.v1.model.widget_new_live_span import WidgetNewLiveSpan |
| 29 | + from datadog_api_client.v1.model.widget_new_fixed_span import WidgetNewFixedSpan |
| 30 | + |
| 31 | + |
| 32 | +class WildcardWidgetDefinition(ModelNormal): |
| 33 | + @cached_property |
| 34 | + def openapi_types(_): |
| 35 | + from datadog_api_client.v1.model.widget_custom_link import WidgetCustomLink |
| 36 | + from datadog_api_client.v1.model.wildcard_widget_request import WildcardWidgetRequest |
| 37 | + from datadog_api_client.v1.model.wildcard_widget_specification import WildcardWidgetSpecification |
| 38 | + from datadog_api_client.v1.model.widget_time import WidgetTime |
| 39 | + from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign |
| 40 | + from datadog_api_client.v1.model.wildcard_widget_definition_type import WildcardWidgetDefinitionType |
| 41 | + |
| 42 | + return { |
| 43 | + "custom_links": ([WidgetCustomLink],), |
| 44 | + "requests": ([WildcardWidgetRequest],), |
| 45 | + "specification": (WildcardWidgetSpecification,), |
| 46 | + "time": (WidgetTime,), |
| 47 | + "title": (str,), |
| 48 | + "title_align": (WidgetTextAlign,), |
| 49 | + "title_size": (str,), |
| 50 | + "type": (WildcardWidgetDefinitionType,), |
| 51 | + } |
| 52 | + |
| 53 | + attribute_map = { |
| 54 | + "custom_links": "custom_links", |
| 55 | + "requests": "requests", |
| 56 | + "specification": "specification", |
| 57 | + "time": "time", |
| 58 | + "title": "title", |
| 59 | + "title_align": "title_align", |
| 60 | + "title_size": "title_size", |
| 61 | + "type": "type", |
| 62 | + } |
| 63 | + |
| 64 | + def __init__( |
| 65 | + self_, |
| 66 | + requests: List[ |
| 67 | + Union[ |
| 68 | + WildcardWidgetRequest, |
| 69 | + TreeMapWidgetRequest, |
| 70 | + TimeseriesWidgetRequest, |
| 71 | + ListStreamWidgetRequest, |
| 72 | + DistributionWidgetRequest, |
| 73 | + ] |
| 74 | + ], |
| 75 | + specification: WildcardWidgetSpecification, |
| 76 | + type: WildcardWidgetDefinitionType, |
| 77 | + custom_links: Union[List[WidgetCustomLink], UnsetType] = unset, |
| 78 | + time: Union[WidgetTime, WidgetLegacyLiveSpan, WidgetNewLiveSpan, WidgetNewFixedSpan, UnsetType] = unset, |
| 79 | + title: Union[str, UnsetType] = unset, |
| 80 | + title_align: Union[WidgetTextAlign, UnsetType] = unset, |
| 81 | + title_size: Union[str, UnsetType] = unset, |
| 82 | + **kwargs, |
| 83 | + ): |
| 84 | + """ |
| 85 | + Custom visualization widget using Vega or Vega-Lite specifications. Combines standard Datadog data requests with a Vega or Vega-Lite JSON specification for flexible, custom visualizations. |
| 86 | +
|
| 87 | + :param custom_links: List of custom links. |
| 88 | + :type custom_links: [WidgetCustomLink], optional |
| 89 | +
|
| 90 | + :param requests: List of data requests for the wildcard widget. |
| 91 | + :type requests: [WildcardWidgetRequest] |
| 92 | +
|
| 93 | + :param specification: Vega or Vega-Lite specification for custom visualization rendering. See https://vega.github.io/vega-lite/ for the full grammar reference. |
| 94 | + :type specification: WildcardWidgetSpecification |
| 95 | +
|
| 96 | + :param time: Time setting for the widget. |
| 97 | + :type time: WidgetTime, optional |
| 98 | +
|
| 99 | + :param title: Title of the widget. |
| 100 | + :type title: str, optional |
| 101 | +
|
| 102 | + :param title_align: How to align the text on the widget. |
| 103 | + :type title_align: WidgetTextAlign, optional |
| 104 | +
|
| 105 | + :param title_size: Size of the title. |
| 106 | + :type title_size: str, optional |
| 107 | +
|
| 108 | + :param type: Type of the wildcard widget. |
| 109 | + :type type: WildcardWidgetDefinitionType |
| 110 | + """ |
| 111 | + if custom_links is not unset: |
| 112 | + kwargs["custom_links"] = custom_links |
| 113 | + if time is not unset: |
| 114 | + kwargs["time"] = time |
| 115 | + if title is not unset: |
| 116 | + kwargs["title"] = title |
| 117 | + if title_align is not unset: |
| 118 | + kwargs["title_align"] = title_align |
| 119 | + if title_size is not unset: |
| 120 | + kwargs["title_size"] = title_size |
| 121 | + super().__init__(kwargs) |
| 122 | + |
| 123 | + self_.requests = requests |
| 124 | + self_.specification = specification |
| 125 | + self_.type = type |
0 commit comments