|
| 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 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.query_value_widget_comparison_directionality import ( |
| 18 | + QueryValueWidgetComparisonDirectionality, |
| 19 | + ) |
| 20 | + from datadog_api_client.v1.model.comparison_duration import ComparisonDuration |
| 21 | + from datadog_api_client.v1.model.query_value_widget_comparison_type import QueryValueWidgetComparisonType |
| 22 | + |
| 23 | + |
| 24 | +class QueryValueWidgetComparison(ModelNormal): |
| 25 | + @cached_property |
| 26 | + def openapi_types(_): |
| 27 | + from datadog_api_client.v1.model.query_value_widget_comparison_directionality import ( |
| 28 | + QueryValueWidgetComparisonDirectionality, |
| 29 | + ) |
| 30 | + from datadog_api_client.v1.model.comparison_duration import ComparisonDuration |
| 31 | + from datadog_api_client.v1.model.query_value_widget_comparison_type import QueryValueWidgetComparisonType |
| 32 | + |
| 33 | + return { |
| 34 | + "directionality": (QueryValueWidgetComparisonDirectionality,), |
| 35 | + "duration": (ComparisonDuration,), |
| 36 | + "type": (QueryValueWidgetComparisonType,), |
| 37 | + } |
| 38 | + |
| 39 | + attribute_map = { |
| 40 | + "directionality": "directionality", |
| 41 | + "duration": "duration", |
| 42 | + "type": "type", |
| 43 | + } |
| 44 | + |
| 45 | + def __init__( |
| 46 | + self_, |
| 47 | + duration: ComparisonDuration, |
| 48 | + directionality: Union[QueryValueWidgetComparisonDirectionality, UnsetType] = unset, |
| 49 | + type: Union[QueryValueWidgetComparisonType, UnsetType] = unset, |
| 50 | + **kwargs, |
| 51 | + ): |
| 52 | + """ |
| 53 | + A change indicator that compares the current value to a historical period. |
| 54 | +
|
| 55 | + :param directionality: Color-coding direction: ``increase_better`` (green on rise), ``decrease_better`` (green on drop), or ``neutral`` (no color). |
| 56 | + :type directionality: QueryValueWidgetComparisonDirectionality, optional |
| 57 | +
|
| 58 | + :param duration: The comparison period. Use a preset ``type`` value or set ``type`` to ``custom_timeframe`` and provide ``custom_timeframe`` with explicit millisecond epoch bounds. |
| 59 | + :type duration: ComparisonDuration |
| 60 | +
|
| 61 | + :param type: How the delta is expressed: ``absolute`` (raw difference), ``relative`` (percentage), or ``both``. |
| 62 | + :type type: QueryValueWidgetComparisonType, optional |
| 63 | + """ |
| 64 | + if directionality is not unset: |
| 65 | + kwargs["directionality"] = directionality |
| 66 | + if type is not unset: |
| 67 | + kwargs["type"] = type |
| 68 | + super().__init__(kwargs) |
| 69 | + |
| 70 | + self_.duration = duration |
0 commit comments