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
42 changes: 42 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22994,6 +22994,35 @@ components:
$ref: '#/components/schemas/EscalationPolicyIncluded'
type: array
type: object
EscalationPolicyAction:
description: Triggers an escalation policy when the routing rule matches.
properties:
policy_id:
description: The ID of the escalation policy to trigger.
example: fad4eee1-13f5-40d8-886b-4e56d8d5d1c6
type: string
support_hours:
$ref: '#/components/schemas/TimeRestrictions'
description: Defines the support hours during which the escalation policy
will be executed.
nullable: true
type:
$ref: '#/components/schemas/EscalationPolicyActionType'
urgency:
$ref: '#/components/schemas/Urgency'
required:
- type
- policy_id
type: object
EscalationPolicyActionType:
default: escalation_policy
description: Indicates that the action is an escalation policy action.
enum:
- escalation_policy
example: escalation_policy
type: string
x-enum-varnames:
- ESCALATION_POLICY
EscalationPolicyCreateRequest:
description: Represents a request to create a new escalation policy, including
the policy data.
Expand Down Expand Up @@ -52369,6 +52398,7 @@ components:
oneOf:
- $ref: '#/components/schemas/SendSlackMessageAction'
- $ref: '#/components/schemas/SendTeamsMessageAction'
- $ref: '#/components/schemas/EscalationPolicyAction'
RoutingRuleAttributes:
description: Defines the configurable attributes of a routing rule, such as
actions, query, time restriction, and urgency.
Expand Down Expand Up @@ -91487,6 +91517,12 @@ paths:
name: include
schema:
type: string
- description: When set to `true`, escalation policies are returned as actions
within routing rules rather than as a separate `policy_id` field.
in: query
name: use_policy_action
schema:
type: boolean
responses:
'200':
content:
Expand Down Expand Up @@ -91524,6 +91560,12 @@ paths:
name: include
schema:
type: string
- description: When set to `true`, escalation policies are returned as actions
within routing rules rather than as a separate `policy_id` field.
in: query
name: use_policy_action
schema:
type: boolean
requestBody:
content:
application/json:
Expand Down
14 changes: 14 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9559,6 +9559,20 @@ datadog\_api\_client.v2.model.escalation\_policy module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.escalation\_policy\_action module
---------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.escalation_policy_action
:members:
:show-inheritance:

datadog\_api\_client.v2.model.escalation\_policy\_action\_type module
---------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.escalation_policy_action_type
:members:
:show-inheritance:

datadog\_api\_client.v2.model.escalation\_policy\_create\_request module
------------------------------------------------------------------------

Expand Down
22 changes: 22 additions & 0 deletions src/datadog_api_client/v2/api/on_call_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ def __init__(self, api_client=None):
"attribute": "include",
"location": "query",
},
"use_policy_action": {
"openapi_types": (bool,),
"attribute": "use_policy_action",
"location": "query",
},
},
headers_map={
"accept": ["application/json"],
Expand Down Expand Up @@ -527,6 +532,11 @@ def __init__(self, api_client=None):
"attribute": "include",
"location": "query",
},
"use_policy_action": {
"openapi_types": (bool,),
"attribute": "use_policy_action",
"location": "query",
},
"body": {
"required": True,
"openapi_types": (TeamRoutingRulesRequest,),
Expand Down Expand Up @@ -855,6 +865,7 @@ def get_on_call_team_routing_rules(
team_id: str,
*,
include: Union[str, UnsetType] = unset,
use_policy_action: Union[bool, UnsetType] = unset,
) -> TeamRoutingRules:
"""Get On-Call team routing rules.

Expand All @@ -864,6 +875,8 @@ def get_on_call_team_routing_rules(
:type team_id: str
:param include: Comma-separated list of included relationships to be returned. Allowed values: ``rules`` , ``rules.policy``.
:type include: str, optional
:param use_policy_action: When set to ``true`` , escalation policies are returned as actions within routing rules rather than as a separate ``policy_id`` field.
:type use_policy_action: bool, optional
:rtype: TeamRoutingRules
"""
kwargs: Dict[str, Any] = {}
Expand All @@ -872,6 +885,9 @@ def get_on_call_team_routing_rules(
if include is not unset:
kwargs["include"] = include

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

return self._get_on_call_team_routing_rules_endpoint.call_with_http_info(**kwargs)

def get_schedule_on_call_user(
Expand Down Expand Up @@ -1026,6 +1042,7 @@ def set_on_call_team_routing_rules(
body: TeamRoutingRulesRequest,
*,
include: Union[str, UnsetType] = unset,
use_policy_action: Union[bool, UnsetType] = unset,
) -> TeamRoutingRules:
"""Set On-Call team routing rules.

Expand All @@ -1036,6 +1053,8 @@ def set_on_call_team_routing_rules(
:type body: TeamRoutingRulesRequest
:param include: Comma-separated list of included relationships to be returned. Allowed values: ``rules`` , ``rules.policy``.
:type include: str, optional
:param use_policy_action: When set to ``true`` , escalation policies are returned as actions within routing rules rather than as a separate ``policy_id`` field.
:type use_policy_action: bool, optional
:rtype: TeamRoutingRules
"""
kwargs: Dict[str, Any] = {}
Expand All @@ -1044,6 +1063,9 @@ def set_on_call_team_routing_rules(
if include is not unset:
kwargs["include"] = include

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

kwargs["body"] = body

return self._set_on_call_team_routing_rules_endpoint.call_with_http_info(**kwargs)
Expand Down
73 changes: 73 additions & 0 deletions src/datadog_api_client/v2/model/escalation_policy_action.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# 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

from typing import Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
unset,
UnsetType,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.time_restrictions import TimeRestrictions
from datadog_api_client.v2.model.escalation_policy_action_type import EscalationPolicyActionType
from datadog_api_client.v2.model.urgency import Urgency


class EscalationPolicyAction(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.time_restrictions import TimeRestrictions
from datadog_api_client.v2.model.escalation_policy_action_type import EscalationPolicyActionType
from datadog_api_client.v2.model.urgency import Urgency

return {
"policy_id": (str,),
"support_hours": (TimeRestrictions,),
"type": (EscalationPolicyActionType,),
"urgency": (Urgency,),
}

attribute_map = {
"policy_id": "policy_id",
"support_hours": "support_hours",
"type": "type",
"urgency": "urgency",
}

def __init__(
self_,
policy_id: str,
type: EscalationPolicyActionType,
support_hours: Union[TimeRestrictions, UnsetType] = unset,
urgency: Union[Urgency, UnsetType] = unset,
**kwargs,
):
"""
Triggers an escalation policy when the routing rule matches.

:param policy_id: The ID of the escalation policy to trigger.
:type policy_id: str

:param support_hours: Holds time zone information and a list of time restrictions for a routing rule.
:type support_hours: TimeRestrictions, optional

:param type: Indicates that the action is an escalation policy action.
:type type: EscalationPolicyActionType

:param urgency: Specifies the level of urgency for a routing rule (low, high, or dynamic).
:type urgency: Urgency, optional
"""
if support_hours is not unset:
kwargs["support_hours"] = support_hours
if urgency is not unset:
kwargs["urgency"] = urgency
super().__init__(kwargs)

self_.policy_id = policy_id
self_.type = type
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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


from datadog_api_client.model_utils import (
ModelSimple,
cached_property,
)

from typing import ClassVar


class EscalationPolicyActionType(ModelSimple):
"""
Indicates that the action is an escalation policy action.

:param value: If omitted defaults to "escalation_policy". Must be one of ["escalation_policy"].
:type value: str
"""

allowed_values = {
"escalation_policy",
}
ESCALATION_POLICY: ClassVar["EscalationPolicyActionType"]

@cached_property
def openapi_types(_):
return {
"value": (str,),
}


EscalationPolicyActionType.ESCALATION_POLICY = EscalationPolicyActionType("escalation_policy")
11 changes: 11 additions & 0 deletions src/datadog_api_client/v2/model/routing_rule_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ def __init__(self, **kwargs):

:param tenant: The tenant ID.
:type tenant: str

:param policy_id: The ID of the escalation policy to trigger.
:type policy_id: str

:param support_hours: Holds time zone information and a list of time restrictions for a routing rule.
:type support_hours: TimeRestrictions, optional

:param urgency: Specifies the level of urgency for a routing rule (low, high, or dynamic).
:type urgency: Urgency, optional
"""
super().__init__(kwargs)

Expand All @@ -43,10 +52,12 @@ def _composed_schemas(_):
# loading
from datadog_api_client.v2.model.send_slack_message_action import SendSlackMessageAction
from datadog_api_client.v2.model.send_teams_message_action import SendTeamsMessageAction
from datadog_api_client.v2.model.escalation_policy_action import EscalationPolicyAction

return {
"oneOf": [
SendSlackMessageAction,
SendTeamsMessageAction,
EscalationPolicyAction,
],
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from datadog_api_client.v2.model.urgency import Urgency
from datadog_api_client.v2.model.send_slack_message_action import SendSlackMessageAction
from datadog_api_client.v2.model.send_teams_message_action import SendTeamsMessageAction
from datadog_api_client.v2.model.escalation_policy_action import EscalationPolicyAction


class RoutingRuleAttributes(ModelNormal):
Expand All @@ -45,7 +46,8 @@ def openapi_types(_):
def __init__(
self_,
actions: Union[
List[Union[RoutingRuleAction, SendSlackMessageAction, SendTeamsMessageAction]], UnsetType
List[Union[RoutingRuleAction, SendSlackMessageAction, SendTeamsMessageAction, EscalationPolicyAction]],
UnsetType,
] = unset,
query: Union[str, UnsetType] = unset,
time_restriction: Union[TimeRestrictions, UnsetType] = unset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from datadog_api_client.v2.model.urgency import Urgency
from datadog_api_client.v2.model.send_slack_message_action import SendSlackMessageAction
from datadog_api_client.v2.model.send_teams_message_action import SendTeamsMessageAction
from datadog_api_client.v2.model.escalation_policy_action import EscalationPolicyAction


class TeamRoutingRulesRequestRule(ModelNormal):
Expand Down Expand Up @@ -47,7 +48,8 @@ def openapi_types(_):
def __init__(
self_,
actions: Union[
List[Union[RoutingRuleAction, SendSlackMessageAction, SendTeamsMessageAction]], UnsetType
List[Union[RoutingRuleAction, SendSlackMessageAction, SendTeamsMessageAction, EscalationPolicyAction]],
UnsetType,
] = unset,
policy_id: Union[str, UnsetType] = unset,
query: Union[str, UnsetType] = unset,
Expand Down
4 changes: 4 additions & 0 deletions src/datadog_api_client/v2/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1883,6 +1883,8 @@
from datadog_api_client.v2.model.error_handler import ErrorHandler
from datadog_api_client.v2.model.escalation import Escalation
from datadog_api_client.v2.model.escalation_policy import EscalationPolicy
from datadog_api_client.v2.model.escalation_policy_action import EscalationPolicyAction
from datadog_api_client.v2.model.escalation_policy_action_type import EscalationPolicyActionType
from datadog_api_client.v2.model.escalation_policy_create_request import EscalationPolicyCreateRequest
from datadog_api_client.v2.model.escalation_policy_create_request_data import EscalationPolicyCreateRequestData
from datadog_api_client.v2.model.escalation_policy_create_request_data_attributes import (
Expand Down Expand Up @@ -7653,6 +7655,8 @@
"ErrorHandler",
"Escalation",
"EscalationPolicy",
"EscalationPolicyAction",
"EscalationPolicyActionType",
"EscalationPolicyCreateRequest",
"EscalationPolicyCreateRequestData",
"EscalationPolicyCreateRequestDataAttributes",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2026-02-18T16:57:05.121Z
2026-01-07T12:38:45.716Z
Loading