diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 73163c4c177d..c054fc5351c0 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -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: @@ -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: diff --git a/cassettes/features/v2/on-call/Set-On-Call-team-routing-rules-returns-OK-response.frozen b/cassettes/features/v2/on-call/Set-On-Call-team-routing-rules-returns-OK-response.frozen index 7a29240030ea..4828503afda3 100644 --- a/cassettes/features/v2/on-call/Set-On-Call-team-routing-rules-returns-OK-response.frozen +++ b/cassettes/features/v2/on-call/Set-On-Call-team-routing-rules-returns-OK-response.frozen @@ -1 +1 @@ -2025-11-27T14:11:49.966Z \ No newline at end of file +2026-05-13T17:02:48.620Z \ No newline at end of file diff --git a/cassettes/features/v2/on-call/Set-On-Call-team-routing-rules-returns-OK-response.yml b/cassettes/features/v2/on-call/Set-On-Call-team-routing-rules-returns-OK-response.yml index 1b0da60b4aae..157718a67eaf 100644 --- a/cassettes/features/v2/on-call/Set-On-Call-team-routing-rules-returns-OK-response.yml +++ b/cassettes/features/v2/on-call/Set-On-Call-team-routing-rules-returns-OK-response.yml @@ -1,9 +1,9 @@ http_interactions: -- recorded_at: Thu, 27 Nov 2025 14:11:49 GMT +- recorded_at: Wed, 13 May 2026 17:02:48 GMT request: body: encoding: UTF-8 - string: '{"data":{"attributes":{"email":"Test-Set_On_Call_team_routing_rules_returns_OK_response-1764252709@datadoghq.com","title":"user + string: '{"data":{"attributes":{"email":"Test-Set_On_Call_team_routing_rules_returns_OK_response-1778691768@datadoghq.com","title":"user title"},"type":"users"}}' headers: Accept: @@ -15,7 +15,7 @@ http_interactions: response: body: encoding: UTF-8 - string: '{"data":{"type":"users","id":"0473ca92-cb9b-11f0-85f9-9a82ffe01443","attributes":{"name":null,"handle":"test-set_on_call_team_routing_rules_returns_ok_response-1764252709@datadoghq.com","created_at":"2025-11-27T14:11:50.355271+00:00","modified_at":"2025-11-27T14:11:50.355271+00:00","email":"test-set_on_call_team_routing_rules_returns_ok_response-1764252709@datadoghq.com","icon":"https://secure.gravatar.com/avatar/ad92f892fdf302962d879c0d02664d8e?s=48&d=retro","title":"user + string: '{"data":{"type":"users","id":"8ba1338f-2ba8-4bbd-8bac-8ec9af981753","attributes":{"uuid":"8ba1338f-2ba8-4bbd-8bac-8ec9af981753","name":null,"handle":"test-set_on_call_team_routing_rules_returns_ok_response-1778691768@datadoghq.com","created_at":"2026-05-13T17:02:49.927240+00:00","modified_at":"2026-05-13T17:02:49.927240+00:00","email":"test-set_on_call_team_routing_rules_returns_ok_response-1778691768@datadoghq.com","icon":"https://secure.gravatar.com/avatar/946e009de7afa32586fa1a76112404d9?s=48&d=retro","title":"user title","verified":false,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Pending","last_login_time":null},"relationships":{"roles":{"data":[]},"org":{"data":{"type":"orgs","id":"4dee724d-00cc-11ea-a77b-570c9d03c6c5"}}}}} ' @@ -25,11 +25,11 @@ http_interactions: status: code: 201 message: Created -- recorded_at: Thu, 27 Nov 2025 14:11:49 GMT +- recorded_at: Wed, 13 May 2026 17:02:48 GMT request: body: encoding: UTF-8 - string: '{"data":{"attributes":{"handle":"test-handle-a7692378c203a880","name":"test-name-a7692378c203a880"},"type":"team"}}' + string: '{"data":{"attributes":{"handle":"test-handle-1707339b9878658c","name":"test-name-1707339b9878658c"},"type":"team"}}' headers: Accept: - application/json @@ -40,19 +40,19 @@ http_interactions: response: body: encoding: UTF-8 - string: '{"data":{"id":"ba4fe917-0da4-4b40-96da-f9d7306d97d8","type":"team","attributes":{"avatar":null,"banner":14,"created_at":"2025-11-27T14:11:50.842947+00:00","description":null,"handle":"test-handle-a7692378c203a880","hidden_modules":[],"link_count":0,"modified_at":"2025-11-27T14:11:50.842947+00:00","name":"test-name-a7692378c203a880","summary":null,"user_count":0,"visible_modules":[]},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/ba4fe917-0da4-4b40-96da-f9d7306d97d8/links"}},"user_team_permissions":{"links":{"related":"/api/v2/team/ba4fe917-0da4-4b40-96da-f9d7306d97d8/permission-settings"}}}}}' + string: '{"data":{"id":"88f4bcb7-f8c9-4523-9fb7-eceecb1f8611","type":"team","attributes":{"avatar":null,"banner":14,"created_at":"2026-05-13T17:02:50.456619+00:00","description":null,"handle":"test-handle-1707339b9878658c","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2026-05-13T17:02:50.456619+00:00","name":"test-name-1707339b9878658c","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/88f4bcb7-f8c9-4523-9fb7-eceecb1f8611/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/88f4bcb7-f8c9-4523-9fb7-eceecb1f8611/permission-settings"}}}}}' headers: Content-Type: - application/vnd.api+json status: code: 201 message: Created -- recorded_at: Thu, 27 Nov 2025 14:11:49 GMT +- recorded_at: Wed, 13 May 2026 17:02:48 GMT request: body: encoding: UTF-8 - string: '{"data":{"attributes":{"layers":[{"effective_date":"2025-11-17T14:11:49.966Z","end_date":"2025-12-07T14:11:49.966Z","interval":{"days":1},"members":[{"user":{"id":"0473ca92-cb9b-11f0-85f9-9a82ffe01443"}}],"name":"Layer - 1","restrictions":[{"end_day":"friday","end_time":"17:00:00","start_day":"monday","start_time":"09:00:00"}],"rotation_start":"2025-11-22T14:11:49.966Z"}],"name":"Test-Set_On_Call_team_routing_rules_returns_OK_response-1764252709","time_zone":"America/New_York"},"relationships":{"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}},"type":"schedules"}}' + string: '{"data":{"attributes":{"layers":[{"effective_date":"2026-05-03T17:02:48.620Z","end_date":"2026-05-23T17:02:48.620Z","interval":{"days":1},"members":[{"user":{"id":"8ba1338f-2ba8-4bbd-8bac-8ec9af981753"}}],"name":"Layer + 1","restrictions":[{"end_day":"friday","end_time":"17:00:00","start_day":"monday","start_time":"09:00:00"}],"rotation_start":"2026-05-08T17:02:48.620Z"}],"name":"Test-Set_On_Call_team_routing_rules_returns_OK_response-1778691768","time_zone":"America/New_York"},"relationships":{"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}},"type":"schedules"}}' headers: Accept: - application/json @@ -63,18 +63,18 @@ http_interactions: response: body: encoding: UTF-8 - string: '{"data":{"id":"1f9b0595-17a3-4d95-9b2e-edcea3b6e737","type":"schedules","attributes":{"name":"Test-Set_On_Call_team_routing_rules_returns_OK_response-1764252709","time_zone":"America/New_York"},"relationships":{"layers":{"data":[{"id":"0eecb6fe-83c6-48c9-9e0e-82379498f733","type":"layers"}]},"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}}}}' + string: '{"data":{"id":"f077460e-c850-4a68-b662-6aa051b453ac","type":"schedules","attributes":{"name":"Test-Set_On_Call_team_routing_rules_returns_OK_response-1778691768","time_zone":"America/New_York"},"relationships":{"layers":{"data":[{"id":"ef374f68-26a5-488d-abea-5776eab7351f","type":"layers"}]},"teams":{"data":[{"id":"65aea9d0-941c-4607-bf8a-14fc0dac2820","type":"teams"}]}}}}' headers: Content-Type: - application/vnd.api+json status: code: 201 message: Created -- recorded_at: Thu, 27 Nov 2025 14:11:49 GMT +- recorded_at: Wed, 13 May 2026 17:02:48 GMT request: body: encoding: UTF-8 - string: '{"data":{"attributes":{"name":"Test-Set_On_Call_team_routing_rules_returns_OK_response-1764252709","resolve_page_on_policy_end":true,"retries":2,"steps":[{"assignment":"default","escalate_after_seconds":3600,"targets":[{"id":"ba4fe917-0da4-4b40-96da-f9d7306d97d8","type":"teams"},{"id":"1f9b0595-17a3-4d95-9b2e-edcea3b6e737","type":"schedules"},{"config":{"schedule":{"position":"previous"}},"id":"1f9b0595-17a3-4d95-9b2e-edcea3b6e737","type":"schedules"},{"id":"0473ca92-cb9b-11f0-85f9-9a82ffe01443","type":"users"}]},{"assignment":"round-robin","escalate_after_seconds":3600,"targets":[{"id":"ba4fe917-0da4-4b40-96da-f9d7306d97d8","type":"teams"}]}]},"relationships":{"teams":{"data":[{"id":"ba4fe917-0da4-4b40-96da-f9d7306d97d8","type":"teams"}]}},"type":"policies"}}' + string: '{"data":{"attributes":{"name":"Test-Set_On_Call_team_routing_rules_returns_OK_response-1778691768","resolve_page_on_policy_end":true,"retries":2,"steps":[{"assignment":"default","escalate_after_seconds":3600,"targets":[{"id":"88f4bcb7-f8c9-4523-9fb7-eceecb1f8611","type":"teams"},{"id":"f077460e-c850-4a68-b662-6aa051b453ac","type":"schedules"},{"config":{"schedule":{"position":"previous"}},"id":"f077460e-c850-4a68-b662-6aa051b453ac","type":"schedules"},{"id":"8ba1338f-2ba8-4bbd-8bac-8ec9af981753","type":"users"}]},{"assignment":"round-robin","escalate_after_seconds":3600,"targets":[{"id":"88f4bcb7-f8c9-4523-9fb7-eceecb1f8611","type":"teams"}]}]},"relationships":{"teams":{"data":[{"id":"88f4bcb7-f8c9-4523-9fb7-eceecb1f8611","type":"teams"}]}},"type":"policies"}}' headers: Accept: - application/json @@ -85,65 +85,65 @@ http_interactions: response: body: encoding: UTF-8 - string: '{"data":{"id":"66f0e922-2834-4d68-aa0b-98cc81fc2a9d","type":"policies","attributes":{"name":"Test-Set_On_Call_team_routing_rules_returns_OK_response-1764252709","resolve_page_on_policy_end":true,"retries":2},"relationships":{"steps":{"data":[{"id":"533f661e-6a1f-4327-8d3f-035add94cff8","type":"steps"},{"id":"b8948730-6aec-4a51-8662-cce4026b94dc","type":"steps"}]},"teams":{"data":[{"id":"ba4fe917-0da4-4b40-96da-f9d7306d97d8","type":"teams"}]}}}}' + string: '{"data":{"id":"f7d6f87d-fff4-4ed5-a466-67ad2ee998d5","type":"policies","attributes":{"name":"Test-Set_On_Call_team_routing_rules_returns_OK_response-1778691768","resolve_page_on_policy_end":true,"retries":2,"tags":[]},"relationships":{"steps":{"data":[{"id":"0acbd132-0eb2-4cd6-b2b8-421912186e5c","type":"steps"},{"id":"542a6a4e-d82a-40a5-8641-76c224a8f185","type":"steps"}]},"teams":{"data":[{"id":"88f4bcb7-f8c9-4523-9fb7-eceecb1f8611","type":"teams"}]}}}}' headers: Content-Type: - application/vnd.api+json status: code: 201 message: Created -- recorded_at: Thu, 27 Nov 2025 14:11:49 GMT +- recorded_at: Wed, 13 May 2026 17:02:48 GMT request: body: encoding: UTF-8 - string: '{"data":{"attributes":{"rules":[{"actions":[{"channel":"channel","type":"send_slack_message","workspace":"workspace"}],"query":"tags.service:test","time_restriction":{"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"}],"time_zone":"Europe/Paris"}},{"policy_id":"66f0e922-2834-4d68-aa0b-98cc81fc2a9d","query":"","urgency":"low"}]},"id":"ba4fe917-0da4-4b40-96da-f9d7306d97d8","type":"team_routing_rules"}}' + string: '{"data":{"attributes":{"rules":[{"actions":[{"ack_timeout_minutes":30,"policy_id":"f7d6f87d-fff4-4ed5-a466-67ad2ee998d5","type":"escalation_policy","urgency":"low"}],"query":"tags.service:test","time_restriction":{"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"}],"time_zone":"Europe/Paris"}},{"policy_id":"f7d6f87d-fff4-4ed5-a466-67ad2ee998d5","query":"","urgency":"low"}]},"id":"88f4bcb7-f8c9-4523-9fb7-eceecb1f8611","type":"team_routing_rules"}}' headers: Accept: - application/json Content-Type: - application/json method: PUT - uri: https://api.datadoghq.com/api/v2/on-call/teams/ba4fe917-0da4-4b40-96da-f9d7306d97d8/routing-rules?include=rules + uri: https://api.datadoghq.com/api/v2/on-call/teams/88f4bcb7-f8c9-4523-9fb7-eceecb1f8611/routing-rules?include=rules response: body: encoding: UTF-8 - string: '{"data":{"id":"ba4fe917-0da4-4b40-96da-f9d7306d97d8","type":"team_routing_rules","relationships":{"rules":{"data":[{"id":"virtual-ba4fe917-0da4-4b40-96da-f9d7306d97d8-rule-0","type":"team_routing_rules"},{"id":"virtual-ba4fe917-0da4-4b40-96da-f9d7306d97d8-rule-1","type":"team_routing_rules"}]}}},"included":[{"id":"virtual-ba4fe917-0da4-4b40-96da-f9d7306d97d8-rule-0","type":"team_routing_rules","attributes":{"actions":[{"type":"send_slack_message","channel":"channel","workspace":"workspace"}],"query":"tags.service:test","time_restriction":{"time_zone":"Europe/Paris","restrictions":[{"start_time":"09:00:00","start_day":"monday","end_time":"17:00:00","end_day":"monday"},{"start_time":"09:00:00","start_day":"tuesday","end_time":"17:00:00","end_day":"tuesday"}]}},"relationships":{"policy":{"data":null}}},{"id":"virtual-ba4fe917-0da4-4b40-96da-f9d7306d97d8-rule-1","type":"team_routing_rules","attributes":{"actions":[],"query":"","urgency":"low"},"relationships":{"policy":{"data":{"id":"66f0e922-2834-4d68-aa0b-98cc81fc2a9d","type":"policies"}}}}]}' + string: '{"data":{"id":"88f4bcb7-f8c9-4523-9fb7-eceecb1f8611","type":"team_routing_rules","relationships":{"rules":{"data":[{"id":"2a597a36-6802-4fd0-966a-fa7aedf24360","type":"team_routing_rules"},{"id":"cddd10dd-33ef-4d55-a761-d3cf16d4c472","type":"team_routing_rules"}]}}},"included":[{"id":"2a597a36-6802-4fd0-966a-fa7aedf24360","type":"team_routing_rules","attributes":{"actions":[{"type":"escalation_policy","policy_id":"f7d6f87d-fff4-4ed5-a466-67ad2ee998d5","ack_timeout_minutes":30,"urgency":"low"}],"query":"tags.service:test","time_restriction":{"time_zone":"Europe/Paris","restrictions":[{"start_time":"09:00:00","start_day":"monday","end_time":"17:00:00","end_day":"monday"},{"start_time":"09:00:00","start_day":"tuesday","end_time":"17:00:00","end_day":"tuesday"}]},"urgency":"low"},"relationships":{"policy":{"data":{"id":"f7d6f87d-fff4-4ed5-a466-67ad2ee998d5","type":"policies"}}}},{"id":"cddd10dd-33ef-4d55-a761-d3cf16d4c472","type":"team_routing_rules","attributes":{"actions":[{"type":"escalation_policy","policy_id":"f7d6f87d-fff4-4ed5-a466-67ad2ee998d5","urgency":"low"}],"query":"","urgency":"low"},"relationships":{"policy":{"data":{"id":"f7d6f87d-fff4-4ed5-a466-67ad2ee998d5","type":"policies"}}}}]}' headers: Content-Type: - application/vnd.api+json status: code: 200 message: OK -- recorded_at: Thu, 27 Nov 2025 14:11:49 GMT +- recorded_at: Wed, 13 May 2026 17:02:48 GMT request: body: encoding: UTF-8 - string: '{"data":{"attributes":{"rules":[]},"id":"ba4fe917-0da4-4b40-96da-f9d7306d97d8","type":"team_routing_rules"}}' + string: '{"data":{"attributes":{"rules":[]},"id":"88f4bcb7-f8c9-4523-9fb7-eceecb1f8611","type":"team_routing_rules"}}' headers: Accept: - application/json Content-Type: - application/json method: PUT - uri: https://api.datadoghq.com/api/v2/on-call/teams/ba4fe917-0da4-4b40-96da-f9d7306d97d8/routing-rules + uri: https://api.datadoghq.com/api/v2/on-call/teams/88f4bcb7-f8c9-4523-9fb7-eceecb1f8611/routing-rules response: body: encoding: UTF-8 - string: '{"data":{"id":"ba4fe917-0da4-4b40-96da-f9d7306d97d8","type":"team_routing_rules","relationships":{"rules":{"data":[]}}}}' + string: '{"data":{"id":"88f4bcb7-f8c9-4523-9fb7-eceecb1f8611","type":"team_routing_rules","relationships":{"rules":{"data":[]}}}}' headers: Content-Type: - application/vnd.api+json status: code: 200 message: OK -- recorded_at: Thu, 27 Nov 2025 14:11:49 GMT +- recorded_at: Wed, 13 May 2026 17:02:48 GMT request: body: null headers: Accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/on-call/escalation-policies/66f0e922-2834-4d68-aa0b-98cc81fc2a9d + uri: https://api.datadoghq.com/api/v2/on-call/escalation-policies/f7d6f87d-fff4-4ed5-a466-67ad2ee998d5 response: body: encoding: UTF-8 @@ -152,14 +152,14 @@ http_interactions: status: code: 204 message: No Content -- recorded_at: Thu, 27 Nov 2025 14:11:49 GMT +- recorded_at: Wed, 13 May 2026 17:02:48 GMT request: body: null headers: Accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/on-call/schedules/1f9b0595-17a3-4d95-9b2e-edcea3b6e737 + uri: https://api.datadoghq.com/api/v2/on-call/schedules/f077460e-c850-4a68-b662-6aa051b453ac response: body: encoding: UTF-8 @@ -168,14 +168,14 @@ http_interactions: status: code: 204 message: No Content -- recorded_at: Thu, 27 Nov 2025 14:11:49 GMT +- recorded_at: Wed, 13 May 2026 17:02:48 GMT request: body: null headers: Accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/team/ba4fe917-0da4-4b40-96da-f9d7306d97d8 + uri: https://api.datadoghq.com/api/v2/team/88f4bcb7-f8c9-4523-9fb7-eceecb1f8611 response: body: encoding: UTF-8 @@ -184,14 +184,14 @@ http_interactions: status: code: 204 message: No Content -- recorded_at: Thu, 27 Nov 2025 14:11:49 GMT +- recorded_at: Wed, 13 May 2026 17:02:48 GMT request: body: null headers: Accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/users/0473ca92-cb9b-11f0-85f9-9a82ffe01443 + uri: https://api.datadoghq.com/api/v2/users/8ba1338f-2ba8-4bbd-8bac-8ec9af981753 response: body: encoding: UTF-8 diff --git a/examples/v2/on-call/SetOnCallTeamRoutingRules.rb b/examples/v2/on-call/SetOnCallTeamRoutingRules.rb index f293be78238d..5524bdd190a8 100644 --- a/examples/v2/on-call/SetOnCallTeamRoutingRules.rb +++ b/examples/v2/on-call/SetOnCallTeamRoutingRules.rb @@ -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", diff --git a/features/v2/on-call.feature b/features/v2/on-call.feature index 0f4b2a0e3402..70221fe1daec 100644 --- a/features/v2/on-call.feature +++ b/features/v2/on-call.feature @@ -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 diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 9f5558e0d1ac..1df003a39814 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -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", diff --git a/lib/datadog_api_client/v2/models/routing_rule_action.rb b/lib/datadog_api_client/v2/models/routing_rule_action.rb index cd4d3b04d05d..3ae2b1f7a81f 100644 --- a/lib/datadog_api_client/v2/models/routing_rule_action.rb +++ b/lib/datadog_api_client/v2/models/routing_rule_action.rb @@ -28,7 +28,8 @@ def openapi_one_of [ :'SendSlackMessageAction', :'SendTeamsMessageAction', - :'TriggerWorkflowAutomationAction' + :'TriggerWorkflowAutomationAction', + :'RoutingRuleEscalationPolicyAction' ] end # Builds the object diff --git a/lib/datadog_api_client/v2/models/routing_rule_escalation_policy_action.rb b/lib/datadog_api_client/v2/models/routing_rule_escalation_policy_action.rb new file mode 100644 index 000000000000..29e9a8fe1f99 --- /dev/null +++ b/lib/datadog_api_client/v2/models/routing_rule_escalation_policy_action.rb @@ -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 diff --git a/lib/datadog_api_client/v2/models/routing_rule_escalation_policy_action_support_hours.rb b/lib/datadog_api_client/v2/models/routing_rule_escalation_policy_action_support_hours.rb new file mode 100644 index 000000000000..41b5d8af45a1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/routing_rule_escalation_policy_action_support_hours.rb @@ -0,0 +1,135 @@ +=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 + # 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. + class RoutingRuleEscalationPolicyActionSupportHours + include BaseGenericModel + + # The list of support hours time windows. + attr_accessor :restrictions + + # The time zone in which the support hours are expressed. + attr_reader :time_zone + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'restrictions' => :'restrictions', + :'time_zone' => :'time_zone' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'restrictions' => :'Array', + :'time_zone' => :'String' + } + 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::RoutingRuleEscalationPolicyActionSupportHours` 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?(:'restrictions') + if (value = attributes[:'restrictions']).is_a?(Array) + self.restrictions = value + end + end + + if attributes.key?(:'time_zone') + self.time_zone = attributes[:'time_zone'] + 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 @time_zone.nil? + true + end + + # Custom attribute writer method with validation + # @param time_zone [Object] Object to be assigned + # @!visibility private + def time_zone=(time_zone) + if time_zone.nil? + fail ArgumentError, 'invalid value for "time_zone", time_zone cannot be nil.' + end + @time_zone = time_zone + 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 && + restrictions == o.restrictions && + time_zone == o.time_zone && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [restrictions, time_zone, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/routing_rule_escalation_policy_action_type.rb b/lib/datadog_api_client/v2/models/routing_rule_escalation_policy_action_type.rb new file mode 100644 index 000000000000..f1cdf1897979 --- /dev/null +++ b/lib/datadog_api_client/v2/models/routing_rule_escalation_policy_action_type.rb @@ -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. 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. + class RoutingRuleEscalationPolicyActionType + include BaseEnumModel + + ESCALATION_POLICY = "escalation_policy".freeze + end +end