|
| 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.embedded_app_widget_input import EmbeddedAppWidgetInput |
| 19 | + from datadog_api_client.v1.model.widget_time import WidgetTime |
| 20 | + from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign |
| 21 | + from datadog_api_client.v1.model.embedded_app_widget_definition_type import EmbeddedAppWidgetDefinitionType |
| 22 | + from datadog_api_client.v1.model.widget_legacy_live_span import WidgetLegacyLiveSpan |
| 23 | + from datadog_api_client.v1.model.widget_new_live_span import WidgetNewLiveSpan |
| 24 | + from datadog_api_client.v1.model.widget_new_fixed_span import WidgetNewFixedSpan |
| 25 | + |
| 26 | + |
| 27 | +class EmbeddedAppWidgetDefinition(ModelNormal): |
| 28 | + validations = { |
| 29 | + "description": { |
| 30 | + "max_length": 5000, |
| 31 | + }, |
| 32 | + } |
| 33 | + |
| 34 | + @cached_property |
| 35 | + def additional_properties_type(_): |
| 36 | + return None |
| 37 | + |
| 38 | + @cached_property |
| 39 | + def openapi_types(_): |
| 40 | + from datadog_api_client.v1.model.widget_custom_link import WidgetCustomLink |
| 41 | + from datadog_api_client.v1.model.embedded_app_widget_input import EmbeddedAppWidgetInput |
| 42 | + from datadog_api_client.v1.model.widget_time import WidgetTime |
| 43 | + from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign |
| 44 | + from datadog_api_client.v1.model.embedded_app_widget_definition_type import EmbeddedAppWidgetDefinitionType |
| 45 | + |
| 46 | + return { |
| 47 | + "app_id": (str,), |
| 48 | + "custom_links": ([WidgetCustomLink],), |
| 49 | + "description": (str,), |
| 50 | + "inputs": ([EmbeddedAppWidgetInput],), |
| 51 | + "template_id": (str,), |
| 52 | + "time": (WidgetTime,), |
| 53 | + "title": (str,), |
| 54 | + "title_align": (WidgetTextAlign,), |
| 55 | + "title_size": (str,), |
| 56 | + "type": (EmbeddedAppWidgetDefinitionType,), |
| 57 | + } |
| 58 | + |
| 59 | + attribute_map = { |
| 60 | + "app_id": "app_id", |
| 61 | + "custom_links": "custom_links", |
| 62 | + "description": "description", |
| 63 | + "inputs": "inputs", |
| 64 | + "template_id": "template_id", |
| 65 | + "time": "time", |
| 66 | + "title": "title", |
| 67 | + "title_align": "title_align", |
| 68 | + "title_size": "title_size", |
| 69 | + "type": "type", |
| 70 | + } |
| 71 | + |
| 72 | + def __init__( |
| 73 | + self_, |
| 74 | + type: EmbeddedAppWidgetDefinitionType, |
| 75 | + app_id: Union[str, UnsetType] = unset, |
| 76 | + custom_links: Union[List[WidgetCustomLink], UnsetType] = unset, |
| 77 | + description: Union[str, UnsetType] = unset, |
| 78 | + inputs: Union[List[EmbeddedAppWidgetInput], UnsetType] = unset, |
| 79 | + template_id: Union[str, UnsetType] = unset, |
| 80 | + time: Union[WidgetTime, WidgetLegacyLiveSpan, WidgetNewLiveSpan, WidgetNewFixedSpan, UnsetType] = unset, |
| 81 | + title: Union[str, UnsetType] = unset, |
| 82 | + title_align: Union[WidgetTextAlign, UnsetType] = unset, |
| 83 | + title_size: Union[str, UnsetType] = unset, |
| 84 | + **kwargs, |
| 85 | + ): |
| 86 | + """ |
| 87 | + The embedded app widget displays an App Builder app on a dashboard. Exactly one of ``app_id`` or ``template_id`` must be provided; they cannot be provided together. |
| 88 | +
|
| 89 | + :param app_id: UUID of the App Builder app to embed. |
| 90 | + :type app_id: str, optional |
| 91 | +
|
| 92 | + :param custom_links: List of custom links. |
| 93 | + :type custom_links: [WidgetCustomLink], optional |
| 94 | +
|
| 95 | + :param description: The description of the widget. |
| 96 | + :type description: str, optional |
| 97 | +
|
| 98 | + :param inputs: Inputs passed to the embedded app. |
| 99 | + :type inputs: [EmbeddedAppWidgetInput], optional |
| 100 | +
|
| 101 | + :param template_id: ID of the built-in app template to embed. |
| 102 | + :type template_id: str, optional |
| 103 | +
|
| 104 | + :param time: Time setting for the widget. |
| 105 | + :type time: WidgetTime, optional |
| 106 | +
|
| 107 | + :param title: Title of the widget. |
| 108 | + :type title: str, optional |
| 109 | +
|
| 110 | + :param title_align: How to align the text on the widget. |
| 111 | + :type title_align: WidgetTextAlign, optional |
| 112 | +
|
| 113 | + :param title_size: Size of the title. |
| 114 | + :type title_size: str, optional |
| 115 | +
|
| 116 | + :param type: Type of the embedded app widget. |
| 117 | + :type type: EmbeddedAppWidgetDefinitionType |
| 118 | + """ |
| 119 | + if app_id is not unset: |
| 120 | + kwargs["app_id"] = app_id |
| 121 | + if custom_links is not unset: |
| 122 | + kwargs["custom_links"] = custom_links |
| 123 | + if description is not unset: |
| 124 | + kwargs["description"] = description |
| 125 | + if inputs is not unset: |
| 126 | + kwargs["inputs"] = inputs |
| 127 | + if template_id is not unset: |
| 128 | + kwargs["template_id"] = template_id |
| 129 | + if time is not unset: |
| 130 | + kwargs["time"] = time |
| 131 | + if title is not unset: |
| 132 | + kwargs["title"] = title |
| 133 | + if title_align is not unset: |
| 134 | + kwargs["title_align"] = title_align |
| 135 | + if title_size is not unset: |
| 136 | + kwargs["title_size"] = title_size |
| 137 | + super().__init__(kwargs) |
| 138 | + |
| 139 | + self_.type = type |
0 commit comments