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
32 changes: 32 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59535,6 +59535,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 @@ -59552,6 +59553,37 @@ components:
urgency:
$ref: "#/components/schemas/Urgency"
type: object
RoutingRuleEscalationPolicyAction:
description: "Routes the page to an escalation policy, optionally restricted to business hours."
properties:
ack_timeout_minutes:
description: "The number of minutes before an unacknowledged page is re-escalated."
example: 10
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/TimeRestrictions"
type:
$ref: "#/components/schemas/RoutingRuleEscalationPolicyActionType"
urgency:
$ref: "#/components/schemas/Urgency"
required:
- type
- policy_id
type: object
RoutingRuleEscalationPolicyActionType:
default: escalation_policy
description: "Indicates that the action routes to an escalation policy."
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
31 changes: 29 additions & 2 deletions examples/v2/on-call/SetOnCallTeamRoutingRules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,36 @@
}),
}),
DatadogAPIClient::V2::TeamRoutingRulesRequestRule.new({
policy_id: ESCALATION_POLICY_DATA_ID,
actions: [
DatadogAPIClient::V2::RoutingRuleEscalationPolicyAction.new({
ack_timeout_minutes: 10,
policy_id: ESCALATION_POLICY_DATA_ID,
support_hours: DatadogAPIClient::V2::TimeRestrictions.new({
time_zone: "Europe/Paris",
restrictions: [
DatadogAPIClient::V2::TimeRestriction.new({
end_day: DatadogAPIClient::V2::Weekday::FRIDAY,
end_time: "17:00:00",
start_day: DatadogAPIClient::V2::Weekday::MONDAY,
start_time: "09:00:00",
}),
],
}),
type: DatadogAPIClient::V2::RoutingRuleEscalationPolicyActionType::ESCALATION_POLICY,
urgency: DatadogAPIClient::V2::Urgency::LOW,
}),
],
query: "tags.service:test",
}),
DatadogAPIClient::V2::TeamRoutingRulesRequestRule.new({
actions: [
DatadogAPIClient::V2::RoutingRuleEscalationPolicyAction.new({
policy_id: ESCALATION_POLICY_DATA_ID,
type: DatadogAPIClient::V2::RoutingRuleEscalationPolicyActionType::ESCALATION_POLICY,
urgency: DatadogAPIClient::V2::Urgency::LOW,
}),
],
query: "",
urgency: DatadogAPIClient::V2::Urgency::LOW,
}),
],
}),
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": [{"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"}]}}, {"actions": [{"ack_timeout_minutes": 10, "policy_id": "{{ escalation_policy.data.id }}", "support_hours": {"time_zone": "Europe/Paris", "restrictions": [{"end_day": "friday", "end_time": "17:00:00", "start_day": "monday", "start_time": "09:00:00"}]}, "type": "escalation_policy", "urgency": "low"}], "query": "tags.service:test"}, {"actions": [{"policy_id": "{{ escalation_policy.data.id }}", "type": "escalation_policy", "urgency": "low"}], "query": ""}]}, "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
2 changes: 2 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4820,6 +4820,8 @@ 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_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
# Routes the page to an escalation policy, optionally restricted to business hours.
class RoutingRuleEscalationPolicyAction
include BaseGenericModel

# The number of minutes before an unacknowledged page is re-escalated.
attr_accessor :ack_timeout_minutes

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

# Holds time zone information and a list of time restrictions for a routing rule.
attr_accessor :support_hours

# Indicates that the action routes to an escalation policy.
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' => :'TimeRestrictions',
:'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
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
=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
# Indicates that the action routes to an escalation policy.
class RoutingRuleEscalationPolicyActionType
include BaseEnumModel

ESCALATION_POLICY = "escalation_policy".freeze
end
end
Loading