|
| 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.v2.model.routing_rule_escalation_policy_action_support_hours import ( |
| 18 | + RoutingRuleEscalationPolicyActionSupportHours, |
| 19 | + ) |
| 20 | + from datadog_api_client.v2.model.routing_rule_escalation_policy_action_type import ( |
| 21 | + RoutingRuleEscalationPolicyActionType, |
| 22 | + ) |
| 23 | + from datadog_api_client.v2.model.urgency import Urgency |
| 24 | + |
| 25 | + |
| 26 | +class RoutingRuleEscalationPolicyAction(ModelNormal): |
| 27 | + @cached_property |
| 28 | + def openapi_types(_): |
| 29 | + from datadog_api_client.v2.model.routing_rule_escalation_policy_action_support_hours import ( |
| 30 | + RoutingRuleEscalationPolicyActionSupportHours, |
| 31 | + ) |
| 32 | + from datadog_api_client.v2.model.routing_rule_escalation_policy_action_type import ( |
| 33 | + RoutingRuleEscalationPolicyActionType, |
| 34 | + ) |
| 35 | + from datadog_api_client.v2.model.urgency import Urgency |
| 36 | + |
| 37 | + return { |
| 38 | + "ack_timeout_minutes": (int,), |
| 39 | + "policy_id": (str,), |
| 40 | + "support_hours": (RoutingRuleEscalationPolicyActionSupportHours,), |
| 41 | + "type": (RoutingRuleEscalationPolicyActionType,), |
| 42 | + "urgency": (Urgency,), |
| 43 | + } |
| 44 | + |
| 45 | + attribute_map = { |
| 46 | + "ack_timeout_minutes": "ack_timeout_minutes", |
| 47 | + "policy_id": "policy_id", |
| 48 | + "support_hours": "support_hours", |
| 49 | + "type": "type", |
| 50 | + "urgency": "urgency", |
| 51 | + } |
| 52 | + |
| 53 | + def __init__( |
| 54 | + self_, |
| 55 | + policy_id: str, |
| 56 | + type: RoutingRuleEscalationPolicyActionType, |
| 57 | + ack_timeout_minutes: Union[int, UnsetType] = unset, |
| 58 | + support_hours: Union[RoutingRuleEscalationPolicyActionSupportHours, UnsetType] = unset, |
| 59 | + urgency: Union[Urgency, UnsetType] = unset, |
| 60 | + **kwargs, |
| 61 | + ): |
| 62 | + """ |
| 63 | + Triggers an escalation policy. |
| 64 | +
|
| 65 | + :param ack_timeout_minutes: The number of minutes before an acknowledged page is re-triggered. |
| 66 | + :type ack_timeout_minutes: int, optional |
| 67 | +
|
| 68 | + :param policy_id: The ID of the escalation policy to route to. |
| 69 | + :type policy_id: str |
| 70 | +
|
| 71 | + :param support_hours: Support hours during which the escalation policy will be executed. Outside of these hours, the escalation policy will be on hold and triggered once the next support hours window starts. This is mutually exclusive with the top-level ``time_restriction`` field on the routing rule. |
| 72 | + :type support_hours: RoutingRuleEscalationPolicyActionSupportHours, optional |
| 73 | +
|
| 74 | + :param type: Indicates that the action pages an escalation policy. This action can be set once per routing rule item, and is mutually exclusive with the top-level ``policy_id`` field on the routing rule. |
| 75 | + :type type: RoutingRuleEscalationPolicyActionType |
| 76 | +
|
| 77 | + :param urgency: Specifies the level of urgency for a routing rule (low, high, or dynamic). |
| 78 | + :type urgency: Urgency, optional |
| 79 | + """ |
| 80 | + if ack_timeout_minutes is not unset: |
| 81 | + kwargs["ack_timeout_minutes"] = ack_timeout_minutes |
| 82 | + if support_hours is not unset: |
| 83 | + kwargs["support_hours"] = support_hours |
| 84 | + if urgency is not unset: |
| 85 | + kwargs["urgency"] = urgency |
| 86 | + super().__init__(kwargs) |
| 87 | + |
| 88 | + self_.policy_id = policy_id |
| 89 | + self_.type = type |
0 commit comments