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
47 changes: 47 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60504,6 +60504,7 @@ components:
- $ref: "#/components/schemas/SendSlackMessageAction"
- $ref: "#/components/schemas/SendTeamsMessageAction"
- $ref: "#/components/schemas/TriggerWorkflowAutomationAction"
- $ref: "#/components/schemas/RoutingRuleEscalationPolicyAction"
RoutingRuleAttributes:
description: Defines the configurable attributes of a routing rule, such as actions, query, time restriction, and urgency.
properties:
Expand All @@ -60521,6 +60522,52 @@ components:
urgency:
$ref: "#/components/schemas/Urgency"
type: object
RoutingRuleEscalationPolicyAction:
description: "Triggers an escalation policy."
properties:
ack_timeout_minutes:
description: "The number of minutes before an acknowledged page is re-triggered."
example: 30
format: int64
type: integer
policy_id:
description: "The ID of the escalation policy to route to."
example: "00000000-0000-0000-0000-000000000000"
type: string
support_hours:
$ref: "#/components/schemas/RoutingRuleEscalationPolicyActionSupportHours"
type:
$ref: "#/components/schemas/RoutingRuleEscalationPolicyActionType"
urgency:
$ref: "#/components/schemas/Urgency"
required:
- type
- policy_id
type: object
RoutingRuleEscalationPolicyActionSupportHours:
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."
properties:
restrictions:
description: "The list of support hours time windows."
items:
$ref: "#/components/schemas/TimeRestriction"
type: array
time_zone:
description: "The time zone in which the support hours are expressed."
example: ""
type: string
required:
- time_zone
type: object
RoutingRuleEscalationPolicyActionType:
default: escalation_policy
description: "Indicates that the action routes to an escalation policy. This action can be set once per routing rule, and cannot be combined with the legacy top-level `policy_id` field on the routing rule."
enum:
- escalation_policy
example: escalation_policy
type: string
x-enum-varnames:
- ESCALATION_POLICY
RoutingRuleRelationships:
description: Specifies relationships for a routing rule, linking to associated policy resources.
properties:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2025-11-27T14:11:49.966Z
2026-05-13T17:02:48.620Z

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions examples/v2/on-call/SetOnCallTeamRoutingRules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
rules: [
DatadogAPIClient::V2::TeamRoutingRulesRequestRule.new({
actions: [
DatadogAPIClient::V2::SendSlackMessageAction.new({
channel: "channel",
type: DatadogAPIClient::V2::SendSlackMessageActionType::SEND_SLACK_MESSAGE,
workspace: "workspace",
DatadogAPIClient::V2::RoutingRuleEscalationPolicyAction.new({
type: DatadogAPIClient::V2::RoutingRuleEscalationPolicyActionType::ESCALATION_POLICY,
policy_id: ESCALATION_POLICY_DATA_ID,
urgency: DatadogAPIClient::V2::Urgency::LOW,
ack_timeout_minutes: 30,
}),
],
query: "tags.service:test",
Expand Down
2 changes: 1 addition & 1 deletion features/v2/on-call.feature
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ Feature: On-Call
And there is a valid "schedule" in the system
And there is a valid "escalation_policy" in the system
And request contains "team_id" parameter from "dd_team.data.id"
And body with value {"data": {"attributes": {"rules": [{"actions": [{"channel": "channel", "type": "send_slack_message", "workspace": "workspace"}], "query": "tags.service:test", "time_restriction": {"time_zone": "Europe/Paris", "restrictions": [{"end_day": "monday", "end_time": "17:00:00", "start_day": "monday", "start_time": "09:00:00"}, {"end_day": "tuesday", "end_time": "17:00:00", "start_day": "tuesday", "start_time": "09:00:00"}]}}, {"policy_id": "{{ escalation_policy.data.id }}", "query": "", "urgency": "low"}]}, "id": "{{ dd_team.data.id }}", "type": "team_routing_rules"}}
And body with value {"data": {"attributes": {"rules": [{"actions": [{"type": "escalation_policy", "policy_id": "{{ escalation_policy.data.id }}", "urgency": "low", "ack_timeout_minutes": 30}], "query": "tags.service:test", "time_restriction": {"time_zone": "Europe/Paris", "restrictions": [{"end_day": "monday", "end_time": "17:00:00", "start_day": "monday", "start_time": "09:00:00"}, {"end_day": "tuesday", "end_time": "17:00:00", "start_day": "tuesday", "start_time": "09:00:00"}]}}, {"policy_id": "{{ escalation_policy.data.id }}", "query": "", "urgency": "low"}]}, "id": "{{ dd_team.data.id }}", "type": "team_routing_rules"}}
And request contains "include" parameter with value "rules"
When the request is sent
Then the response status is 200 OK
Expand Down
3 changes: 3 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4864,6 +4864,9 @@ def overrides
"v2.routing_rule" => "RoutingRule",
"v2.routing_rule_action" => "RoutingRuleAction",
"v2.routing_rule_attributes" => "RoutingRuleAttributes",
"v2.routing_rule_escalation_policy_action" => "RoutingRuleEscalationPolicyAction",
"v2.routing_rule_escalation_policy_action_support_hours" => "RoutingRuleEscalationPolicyActionSupportHours",
"v2.routing_rule_escalation_policy_action_type" => "RoutingRuleEscalationPolicyActionType",
"v2.routing_rule_relationships" => "RoutingRuleRelationships",
"v2.routing_rule_relationships_policy" => "RoutingRuleRelationshipsPolicy",
"v2.routing_rule_relationships_policy_data" => "RoutingRuleRelationshipsPolicyData",
Expand Down
3 changes: 2 additions & 1 deletion lib/datadog_api_client/v2/models/routing_rule_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def openapi_one_of
[
:'SendSlackMessageAction',
:'SendTeamsMessageAction',
:'TriggerWorkflowAutomationAction'
:'TriggerWorkflowAutomationAction',
:'RoutingRuleEscalationPolicyAction'
]
end
# Builds the object
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
=begin
#Datadog API V2 Collection

#Collection of all Datadog Public endpoints.

The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator

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 2020-Present Datadog, Inc.

=end

require 'date'
require 'time'

module DatadogAPIClient::V2
# Triggers an escalation policy.
class RoutingRuleEscalationPolicyAction
include BaseGenericModel

# The number of minutes before an acknowledged page is re-triggered.
attr_accessor :ack_timeout_minutes

# The ID of the escalation policy to route to.
attr_reader :policy_id

# 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.
attr_accessor :support_hours

# Indicates that the action routes to an escalation policy. This action can be set once per routing rule, and cannot be combined with the legacy top-level `policy_id` field on the routing rule.
attr_reader :type

# Specifies the level of urgency for a routing rule (low, high, or dynamic).
attr_accessor :urgency

attr_accessor :additional_properties

# Attribute mapping from ruby-style variable name to JSON key.
# @!visibility private
def self.attribute_map
{
:'ack_timeout_minutes' => :'ack_timeout_minutes',
:'policy_id' => :'policy_id',
:'support_hours' => :'support_hours',
:'type' => :'type',
:'urgency' => :'urgency'
}
end

# Attribute type mapping.
# @!visibility private
def self.openapi_types
{
:'ack_timeout_minutes' => :'Integer',
:'policy_id' => :'String',
:'support_hours' => :'RoutingRuleEscalationPolicyActionSupportHours',
:'type' => :'RoutingRuleEscalationPolicyActionType',
:'urgency' => :'Urgency'
}
end

# Initializes the object
# @param attributes [Hash] Model attributes in the form of hash
# @!visibility private
def initialize(attributes = {})
if (!attributes.is_a?(Hash))
fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RoutingRuleEscalationPolicyAction` initialize method"
end

self.additional_properties = {}
# check to see if the attribute exists and convert string to symbol for hash key
attributes = attributes.each_with_object({}) { |(k, v), h|
if (!self.class.attribute_map.key?(k.to_sym))
self.additional_properties[k.to_sym] = v
else
h[k.to_sym] = v
end
}

if attributes.key?(:'ack_timeout_minutes')
self.ack_timeout_minutes = attributes[:'ack_timeout_minutes']
end

if attributes.key?(:'policy_id')
self.policy_id = attributes[:'policy_id']
end

if attributes.key?(:'support_hours')
self.support_hours = attributes[:'support_hours']
end

if attributes.key?(:'type')
self.type = attributes[:'type']
end

if attributes.key?(:'urgency')
self.urgency = attributes[:'urgency']
end
end

# Check to see if the all the properties in the model are valid
# @return true if the model is valid
# @!visibility private
def valid?
return false if @policy_id.nil?
return false if @type.nil?
true
end

# Custom attribute writer method with validation
# @param policy_id [Object] Object to be assigned
# @!visibility private
def policy_id=(policy_id)
if policy_id.nil?
fail ArgumentError, 'invalid value for "policy_id", policy_id cannot be nil.'
end
@policy_id = policy_id
end

# Custom attribute writer method with validation
# @param type [Object] Object to be assigned
# @!visibility private
def type=(type)
if type.nil?
fail ArgumentError, 'invalid value for "type", type cannot be nil.'
end
@type = type
end

# Returns the object in the form of hash, with additionalProperties support.
# @return [Hash] Returns the object in the form of hash
# @!visibility private
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
if value.nil?
is_nullable = self.class.openapi_nullable.include?(attr)
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
end

hash[param] = _to_hash(value)
end
self.additional_properties.each_pair do |attr, value|
hash[attr] = value
end
hash
end

# Checks equality by comparing each attribute.
# @param o [Object] Object to be compared
# @!visibility private
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
ack_timeout_minutes == o.ack_timeout_minutes &&
policy_id == o.policy_id &&
support_hours == o.support_hours &&
type == o.type &&
urgency == o.urgency &&
additional_properties == o.additional_properties
end

# Calculates hash code according to all attributes.
# @return [Integer] Hash code
# @!visibility private
def hash
[ack_timeout_minutes, policy_id, support_hours, type, urgency, additional_properties].hash
end
end
end
Loading
Loading