Skip to content

Commit 154f7db

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit c193713 of spec repo
1 parent fde4bb4 commit 154f7db

14 files changed

Lines changed: 349 additions & 35 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65461,6 +65461,7 @@ components:
6546165461
- $ref: "#/components/schemas/SendSlackMessageAction"
6546265462
- $ref: "#/components/schemas/SendTeamsMessageAction"
6546365463
- $ref: "#/components/schemas/TriggerWorkflowAutomationAction"
65464+
- $ref: "#/components/schemas/RoutingRuleEscalationPolicyAction"
6546465465
RoutingRuleAttributes:
6546565466
description: Defines the configurable attributes of a routing rule, such as actions, query, time restriction, and urgency.
6546665467
properties:
@@ -65478,6 +65479,52 @@ components:
6547865479
urgency:
6547965480
$ref: "#/components/schemas/Urgency"
6548065481
type: object
65482+
RoutingRuleEscalationPolicyAction:
65483+
description: "Triggers an escalation policy."
65484+
properties:
65485+
ack_timeout_minutes:
65486+
description: "The number of minutes before an acknowledged page is re-triggered."
65487+
example: 30
65488+
format: int64
65489+
type: integer
65490+
policy_id:
65491+
description: "The ID of the escalation policy to route to."
65492+
example: "00000000-0000-0000-0000-000000000000"
65493+
type: string
65494+
support_hours:
65495+
$ref: "#/components/schemas/RoutingRuleEscalationPolicyActionSupportHours"
65496+
type:
65497+
$ref: "#/components/schemas/RoutingRuleEscalationPolicyActionType"
65498+
urgency:
65499+
$ref: "#/components/schemas/Urgency"
65500+
required:
65501+
- type
65502+
- policy_id
65503+
type: object
65504+
RoutingRuleEscalationPolicyActionSupportHours:
65505+
description: "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."
65506+
properties:
65507+
restrictions:
65508+
description: "The list of support hours time windows."
65509+
items:
65510+
$ref: "#/components/schemas/TimeRestriction"
65511+
type: array
65512+
time_zone:
65513+
description: "The time zone in which the support hours are expressed."
65514+
example: ""
65515+
type: string
65516+
required:
65517+
- time_zone
65518+
type: object
65519+
RoutingRuleEscalationPolicyActionType:
65520+
default: escalation_policy
65521+
description: "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."
65522+
enum:
65523+
- escalation_policy
65524+
example: escalation_policy
65525+
type: string
65526+
x-enum-varnames:
65527+
- ESCALATION_POLICY
6548165528
RoutingRuleRelationships:
6548265529
description: Specifies relationships for a routing rule, linking to associated policy resources.
6548365530
properties:
@@ -85180,7 +85227,7 @@ components:
8518085227
type: string
8518185228
type: object
8518285229
TimeRestrictions:
85183-
description: Holds time zone information and a list of time restrictions for a routing rule.
85230+
description: Time restrictions during which the routing rule is active. Outside of these hours, the rule does not match and routing continues to subsequent rules. This is mutually exclusive with the action-level `support_hours` field.
8518485231
properties:
8518585232
restrictions:
8518685233
description: Defines the list of time-based restrictions.

docs/datadog_api_client.v2.model.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28452,6 +28452,27 @@ datadog\_api\_client.v2.model.routing\_rule\_attributes module
2845228452
:members:
2845328453
:show-inheritance:
2845428454

28455+
datadog\_api\_client.v2.model.routing\_rule\_escalation\_policy\_action module
28456+
------------------------------------------------------------------------------
28457+
28458+
.. automodule:: datadog_api_client.v2.model.routing_rule_escalation_policy_action
28459+
:members:
28460+
:show-inheritance:
28461+
28462+
datadog\_api\_client.v2.model.routing\_rule\_escalation\_policy\_action\_support\_hours module
28463+
----------------------------------------------------------------------------------------------
28464+
28465+
.. automodule:: datadog_api_client.v2.model.routing_rule_escalation_policy_action_support_hours
28466+
:members:
28467+
:show-inheritance:
28468+
28469+
datadog\_api\_client.v2.model.routing\_rule\_escalation\_policy\_action\_type module
28470+
------------------------------------------------------------------------------------
28471+
28472+
.. automodule:: datadog_api_client.v2.model.routing_rule_escalation_policy_action_type
28473+
:members:
28474+
:show-inheritance:
28475+
2845528476
datadog\_api\_client.v2.model.routing\_rule\_relationships module
2845628477
-----------------------------------------------------------------
2845728478

examples/v2/on-call/SetOnCallTeamRoutingRules.py

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
from os import environ
66
from datadog_api_client import ApiClient, Configuration
77
from datadog_api_client.v2.api.on_call_api import OnCallApi
8-
from datadog_api_client.v2.model.send_slack_message_action import SendSlackMessageAction
9-
from datadog_api_client.v2.model.send_slack_message_action_type import SendSlackMessageActionType
8+
from datadog_api_client.v2.model.routing_rule_escalation_policy_action import RoutingRuleEscalationPolicyAction
9+
from datadog_api_client.v2.model.routing_rule_escalation_policy_action_support_hours import (
10+
RoutingRuleEscalationPolicyActionSupportHours,
11+
)
12+
from datadog_api_client.v2.model.routing_rule_escalation_policy_action_type import RoutingRuleEscalationPolicyActionType
1013
from datadog_api_client.v2.model.team_routing_rules_request import TeamRoutingRulesRequest
1114
from datadog_api_client.v2.model.team_routing_rules_request_data import TeamRoutingRulesRequestData
1215
from datadog_api_client.v2.model.team_routing_rules_request_data_attributes import TeamRoutingRulesRequestDataAttributes
@@ -29,13 +32,13 @@
2932
rules=[
3033
TeamRoutingRulesRequestRule(
3134
actions=[
32-
SendSlackMessageAction(
33-
channel="channel",
34-
type=SendSlackMessageActionType.SEND_SLACK_MESSAGE,
35-
workspace="workspace",
35+
RoutingRuleEscalationPolicyAction(
36+
type=RoutingRuleEscalationPolicyActionType.ESCALATION_POLICY,
37+
policy_id=ESCALATION_POLICY_DATA_ID,
38+
urgency=Urgency.LOW,
3639
),
3740
],
38-
query="tags.service:test",
41+
query="tags.service:time_restrictions",
3942
time_restriction=TimeRestrictions(
4043
time_zone="Europe/Paris",
4144
restrictions=[
@@ -54,11 +57,49 @@
5457
],
5558
),
5659
),
60+
TeamRoutingRulesRequestRule(
61+
actions=[
62+
RoutingRuleEscalationPolicyAction(
63+
type=RoutingRuleEscalationPolicyActionType.ESCALATION_POLICY,
64+
policy_id=ESCALATION_POLICY_DATA_ID,
65+
urgency=Urgency.LOW,
66+
ack_timeout_minutes=30,
67+
support_hours=RoutingRuleEscalationPolicyActionSupportHours(
68+
time_zone="Europe/Paris",
69+
restrictions=[
70+
TimeRestriction(
71+
end_day=Weekday.WEDNESDAY,
72+
end_time="17:00:00",
73+
start_day=Weekday.WEDNESDAY,
74+
start_time="09:00:00",
75+
),
76+
TimeRestriction(
77+
end_day=Weekday.THURSDAY,
78+
end_time="17:00:00",
79+
start_day=Weekday.THURSDAY,
80+
start_time="09:00:00",
81+
),
82+
],
83+
),
84+
),
85+
],
86+
query="tags.service:support_hours_and_acknowledgment_timeout",
87+
),
5788
TeamRoutingRulesRequestRule(
5889
policy_id=ESCALATION_POLICY_DATA_ID,
59-
query="",
90+
query="tags.service:legacy_policy_definition",
6091
urgency=Urgency.LOW,
6192
),
93+
TeamRoutingRulesRequestRule(
94+
actions=[
95+
RoutingRuleEscalationPolicyAction(
96+
type=RoutingRuleEscalationPolicyActionType.ESCALATION_POLICY,
97+
policy_id=ESCALATION_POLICY_DATA_ID,
98+
urgency=Urgency.LOW,
99+
),
100+
],
101+
query="",
102+
),
62103
],
63104
),
64105
id=DD_TEAM_DATA_ID,

src/datadog_api_client/v2/model/routing_rule_action.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ def __init__(self, **kwargs):
3232
3333
:param handle: The handle of the Workflow Automation to trigger.
3434
:type handle: str
35+
36+
:param ack_timeout_minutes: The number of minutes before an acknowledged page is re-triggered.
37+
:type ack_timeout_minutes: int, optional
38+
39+
:param policy_id: The ID of the escalation policy to route to.
40+
:type policy_id: str
41+
42+
: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.
43+
:type support_hours: RoutingRuleEscalationPolicyActionSupportHours, optional
44+
45+
:param urgency: Specifies the level of urgency for a routing rule (low, high, or dynamic).
46+
:type urgency: Urgency, optional
3547
"""
3648
super().__init__(kwargs)
3749

@@ -47,11 +59,13 @@ def _composed_schemas(_):
4759
from datadog_api_client.v2.model.send_slack_message_action import SendSlackMessageAction
4860
from datadog_api_client.v2.model.send_teams_message_action import SendTeamsMessageAction
4961
from datadog_api_client.v2.model.trigger_workflow_automation_action import TriggerWorkflowAutomationAction
62+
from datadog_api_client.v2.model.routing_rule_escalation_policy_action import RoutingRuleEscalationPolicyAction
5063

5164
return {
5265
"oneOf": [
5366
SendSlackMessageAction,
5467
SendTeamsMessageAction,
5568
TriggerWorkflowAutomationAction,
69+
RoutingRuleEscalationPolicyAction,
5670
],
5771
}

src/datadog_api_client/v2/model/routing_rule_attributes.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from datadog_api_client.v2.model.send_slack_message_action import SendSlackMessageAction
2121
from datadog_api_client.v2.model.send_teams_message_action import SendTeamsMessageAction
2222
from datadog_api_client.v2.model.trigger_workflow_automation_action import TriggerWorkflowAutomationAction
23+
from datadog_api_client.v2.model.routing_rule_escalation_policy_action import RoutingRuleEscalationPolicyAction
2324

2425

2526
class RoutingRuleAttributes(ModelNormal):
@@ -48,7 +49,11 @@ def __init__(
4849
actions: Union[
4950
List[
5051
Union[
51-
RoutingRuleAction, SendSlackMessageAction, SendTeamsMessageAction, TriggerWorkflowAutomationAction
52+
RoutingRuleAction,
53+
SendSlackMessageAction,
54+
SendTeamsMessageAction,
55+
TriggerWorkflowAutomationAction,
56+
RoutingRuleEscalationPolicyAction,
5257
]
5358
],
5459
UnsetType,
@@ -67,7 +72,7 @@ def __init__(
6772
:param query: Defines the query or condition that triggers this routing rule.
6873
:type query: str, optional
6974
70-
:param time_restriction: Holds time zone information and a list of time restrictions for a routing rule.
75+
:param time_restriction: Time restrictions during which the routing rule is active. Outside of these hours, the rule does not match and routing continues to subsequent rules. This is mutually exclusive with the action-level ``support_hours`` field.
7176
:type time_restriction: TimeRestrictions, optional
7277
7378
:param urgency: Specifies the level of urgency for a routing rule (low, high, or dynamic).
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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.v2.model.time_restriction import TimeRestriction
18+
19+
20+
class RoutingRuleEscalationPolicyActionSupportHours(ModelNormal):
21+
@cached_property
22+
def openapi_types(_):
23+
from datadog_api_client.v2.model.time_restriction import TimeRestriction
24+
25+
return {
26+
"restrictions": ([TimeRestriction],),
27+
"time_zone": (str,),
28+
}
29+
30+
attribute_map = {
31+
"restrictions": "restrictions",
32+
"time_zone": "time_zone",
33+
}
34+
35+
def __init__(self_, time_zone: str, restrictions: Union[List[TimeRestriction], UnsetType] = unset, **kwargs):
36+
"""
37+
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.
38+
39+
:param restrictions: The list of support hours time windows.
40+
:type restrictions: [TimeRestriction], optional
41+
42+
:param time_zone: The time zone in which the support hours are expressed.
43+
:type time_zone: str
44+
"""
45+
if restrictions is not unset:
46+
kwargs["restrictions"] = restrictions
47+
super().__init__(kwargs)
48+
49+
self_.time_zone = time_zone

0 commit comments

Comments
 (0)