Skip to content
Merged
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
24 changes: 24 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103275,6 +103275,7 @@ components:
- $ref: "#/components/schemas/SendTeamsMessageAction"
- $ref: "#/components/schemas/TriggerWorkflowAutomationAction"
- $ref: "#/components/schemas/RoutingRuleEscalationPolicyAction"
- $ref: "#/components/schemas/RoutingRuleRerouteToTeamAction"
RoutingRuleAttributes:
description: Defines the configurable attributes of a routing rule, such as actions, query, time restriction, and urgency.
properties:
Expand Down Expand Up @@ -103373,6 +103374,29 @@ components:
type: string
x-enum-varnames:
- POLICIES
RoutingRuleRerouteToTeamAction:
description: "Reroutes the page to another team, which then evaluates it against its own routing rules. Each routing rule can include this action only once. It can be combined only with `send_slack_message` and `send_teams_message` actions. It can't be used with `escalation_policy` or `workflow` actions, or when the routing rule sets `policy_id`."
properties:
destination_team_id:
description: "The ID of the team to reroute the page to."
example: "00000000-0000-0000-0000-000000000000"
format: uuid
type: string
type:
$ref: "#/components/schemas/RoutingRuleRerouteToTeamActionType"
required:
- type
- destination_team_id
type: object
RoutingRuleRerouteToTeamActionType:
default: reroute_to_team
description: "Indicates that the action reroutes the page to another team's routing rules."
enum:
- reroute_to_team
example: reroute_to_team
type: string
x-enum-varnames:
- REROUTE_TO_TEAM
RoutingRuleType:
default: team_routing_rules
description: Team routing rules resource type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,52 @@ public RoutingRuleAction deserialize(JsonParser jp, DeserializationContext ctxt)
Level.FINER, "Input data does not match schema 'RoutingRuleEscalationPolicyAction'", e);
}

// deserialize RoutingRuleRerouteToTeamAction
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (RoutingRuleRerouteToTeamAction.class.equals(Integer.class)
|| RoutingRuleRerouteToTeamAction.class.equals(Long.class)
|| RoutingRuleRerouteToTeamAction.class.equals(Float.class)
|| RoutingRuleRerouteToTeamAction.class.equals(Double.class)
|| RoutingRuleRerouteToTeamAction.class.equals(Boolean.class)
|| RoutingRuleRerouteToTeamAction.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |=
((RoutingRuleRerouteToTeamAction.class.equals(Integer.class)
|| RoutingRuleRerouteToTeamAction.class.equals(Long.class))
&& token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |=
((RoutingRuleRerouteToTeamAction.class.equals(Float.class)
|| RoutingRuleRerouteToTeamAction.class.equals(Double.class))
&& (token == JsonToken.VALUE_NUMBER_FLOAT
|| token == JsonToken.VALUE_NUMBER_INT));
attemptParsing |=
(RoutingRuleRerouteToTeamAction.class.equals(Boolean.class)
&& (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |=
(RoutingRuleRerouteToTeamAction.class.equals(String.class)
&& token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
tmp = tree.traverse(jp.getCodec()).readValueAs(RoutingRuleRerouteToTeamAction.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
if (!((RoutingRuleRerouteToTeamAction) tmp).unparsed) {
deserialized = tmp;
match++;
}
log.log(Level.FINER, "Input data matches schema 'RoutingRuleRerouteToTeamAction'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(
Level.FINER, "Input data does not match schema 'RoutingRuleRerouteToTeamAction'", e);
}

RoutingRuleAction ret = new RoutingRuleAction();
if (match == 1) {
ret.setActualInstance(deserialized);
Expand Down Expand Up @@ -307,6 +353,11 @@ public RoutingRuleAction(RoutingRuleEscalationPolicyAction o) {
setActualInstance(o);
}

public RoutingRuleAction(RoutingRuleRerouteToTeamAction o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

static {
schemas.put("SendSlackMessageAction", new GenericType<SendSlackMessageAction>() {});
schemas.put("SendTeamsMessageAction", new GenericType<SendTeamsMessageAction>() {});
Expand All @@ -315,6 +366,8 @@ public RoutingRuleAction(RoutingRuleEscalationPolicyAction o) {
schemas.put(
"RoutingRuleEscalationPolicyAction",
new GenericType<RoutingRuleEscalationPolicyAction>() {});
schemas.put(
"RoutingRuleRerouteToTeamAction", new GenericType<RoutingRuleRerouteToTeamAction>() {});
JSON.registerDescendants(RoutingRuleAction.class, Collections.unmodifiableMap(schemas));
}

Expand All @@ -326,7 +379,8 @@ public Map<String, GenericType> getSchemas() {
/**
* Set the instance that matches the oneOf child schema, check the instance parameter is valid
* against the oneOf child schemas: SendSlackMessageAction, SendTeamsMessageAction,
* TriggerWorkflowAutomationAction, RoutingRuleEscalationPolicyAction
* TriggerWorkflowAutomationAction, RoutingRuleEscalationPolicyAction,
* RoutingRuleRerouteToTeamAction
*
* <p>It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a
* composed schema (allOf, anyOf, oneOf).
Expand All @@ -351,22 +405,30 @@ public void setActualInstance(Object instance) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(
RoutingRuleRerouteToTeamAction.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}

if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException(
"Invalid instance type. Must be SendSlackMessageAction, SendTeamsMessageAction,"
+ " TriggerWorkflowAutomationAction, RoutingRuleEscalationPolicyAction");
+ " TriggerWorkflowAutomationAction, RoutingRuleEscalationPolicyAction,"
+ " RoutingRuleRerouteToTeamAction");
}

/**
* Get the actual instance, which can be the following: SendSlackMessageAction,
* SendTeamsMessageAction, TriggerWorkflowAutomationAction, RoutingRuleEscalationPolicyAction
* SendTeamsMessageAction, TriggerWorkflowAutomationAction, RoutingRuleEscalationPolicyAction,
* RoutingRuleRerouteToTeamAction
*
* @return The actual instance (SendSlackMessageAction, SendTeamsMessageAction,
* TriggerWorkflowAutomationAction, RoutingRuleEscalationPolicyAction)
* TriggerWorkflowAutomationAction, RoutingRuleEscalationPolicyAction,
* RoutingRuleRerouteToTeamAction)
*/
@Override
public Object getActualInstance() {
Expand Down Expand Up @@ -418,4 +480,16 @@ public RoutingRuleEscalationPolicyAction getRoutingRuleEscalationPolicyAction()
throws ClassCastException {
return (RoutingRuleEscalationPolicyAction) super.getActualInstance();
}

/**
* Get the actual instance of `RoutingRuleRerouteToTeamAction`. If the actual instance is not
* `RoutingRuleRerouteToTeamAction`, the ClassCastException will be thrown.
*
* @return The actual instance of `RoutingRuleRerouteToTeamAction`
* @throws ClassCastException if the instance is not `RoutingRuleRerouteToTeamAction`
*/
public RoutingRuleRerouteToTeamAction getRoutingRuleRerouteToTeamAction()
throws ClassCastException {
return (RoutingRuleRerouteToTeamAction) super.getActualInstance();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
/*
* 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.
*/

package com.datadog.api.client.v2.model;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;

/**
* Reroutes the page to another team, which then evaluates it against its own routing rules. Each
* routing rule can include this action only once. It can be combined only with <code>
* send_slack_message</code> and <code>send_teams_message</code> actions. It can't be used with
* <code>escalation_policy</code> or <code>workflow</code> actions, or when the routing rule sets
* <code>policy_id</code>.
*/
@JsonPropertyOrder({
RoutingRuleRerouteToTeamAction.JSON_PROPERTY_DESTINATION_TEAM_ID,
RoutingRuleRerouteToTeamAction.JSON_PROPERTY_TYPE
})
@jakarta.annotation.Generated(
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
public class RoutingRuleRerouteToTeamAction {
@JsonIgnore public boolean unparsed = false;
public static final String JSON_PROPERTY_DESTINATION_TEAM_ID = "destination_team_id";
private UUID destinationTeamId;

public static final String JSON_PROPERTY_TYPE = "type";
private RoutingRuleRerouteToTeamActionType type =
RoutingRuleRerouteToTeamActionType.REROUTE_TO_TEAM;

public RoutingRuleRerouteToTeamAction() {}

@JsonCreator
public RoutingRuleRerouteToTeamAction(
@JsonProperty(required = true, value = JSON_PROPERTY_DESTINATION_TEAM_ID)
UUID destinationTeamId,
@JsonProperty(required = true, value = JSON_PROPERTY_TYPE)
RoutingRuleRerouteToTeamActionType type) {
this.destinationTeamId = destinationTeamId;
this.type = type;
this.unparsed |= !type.isValid();
}

public RoutingRuleRerouteToTeamAction destinationTeamId(UUID destinationTeamId) {
this.destinationTeamId = destinationTeamId;
return this;
}

/**
* The ID of the team to reroute the page to.
*
* @return destinationTeamId
*/
@JsonProperty(JSON_PROPERTY_DESTINATION_TEAM_ID)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public UUID getDestinationTeamId() {
return destinationTeamId;
}

public void setDestinationTeamId(UUID destinationTeamId) {
this.destinationTeamId = destinationTeamId;
}

public RoutingRuleRerouteToTeamAction type(RoutingRuleRerouteToTeamActionType type) {
this.type = type;
this.unparsed |= !type.isValid();
return this;
}

/**
* Indicates that the action reroutes the page to another team's routing rules.
*
* @return type
*/
@JsonProperty(JSON_PROPERTY_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public RoutingRuleRerouteToTeamActionType getType() {
return type;
}

public void setType(RoutingRuleRerouteToTeamActionType type) {
if (!type.isValid()) {
this.unparsed = true;
}
this.type = type;
}

/**
* A container for additional, undeclared properties. This is a holder for any undeclared
* properties as specified with the 'additionalProperties' keyword in the OAS document.
*/
private Map<String, Object> additionalProperties;

/**
* Set the additional (undeclared) property with the specified name and value. If the property
* does not already exist, create it otherwise replace it.
*
* @param key The arbitrary key to set
* @param value The associated value
* @return RoutingRuleRerouteToTeamAction
*/
@JsonAnySetter
public RoutingRuleRerouteToTeamAction putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<String, Object>();
}
this.additionalProperties.put(key, value);
return this;
}

/**
* Return the additional (undeclared) property.
*
* @return The additional properties
*/
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
}

/**
* Return the additional (undeclared) property with the specified name.
*
* @param key The arbitrary key to get
* @return The specific additional property for the given key
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
return null;
}
return this.additionalProperties.get(key);
}

/** Return true if this RoutingRuleRerouteToTeamAction object is equal to o. */
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RoutingRuleRerouteToTeamAction routingRuleRerouteToTeamAction =
(RoutingRuleRerouteToTeamAction) o;
return Objects.equals(this.destinationTeamId, routingRuleRerouteToTeamAction.destinationTeamId)
&& Objects.equals(this.type, routingRuleRerouteToTeamAction.type)
&& Objects.equals(
this.additionalProperties, routingRuleRerouteToTeamAction.additionalProperties);
}

@Override
public int hashCode() {
return Objects.hash(destinationTeamId, type, additionalProperties);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class RoutingRuleRerouteToTeamAction {\n");
sb.append(" destinationTeamId: ").append(toIndentedString(destinationTeamId)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" additionalProperties: ")
.append(toIndentedString(additionalProperties))
.append("\n");
sb.append('}');
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
Loading
Loading