diff --git a/.apigentools-info b/.apigentools-info index 5ebed7c8e59..8c54e5d0248 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-05-27 10:37:49.383412", - "spec_repo_commit": "c75940cb" + "regenerated": "2025-05-27 15:21:07.185558", + "spec_repo_commit": "97968943" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-05-27 10:37:49.403493", - "spec_repo_commit": "c75940cb" + "regenerated": "2025-05-27 15:21:07.201322", + "spec_repo_commit": "97968943" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index f24ff618644..5c41dee7d8a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -30384,8 +30384,8 @@ components: description: Defines an action that is executed when a routing rule matches certain criteria. oneOf: - - $ref: '#/components/schemas/SlackAction' - - $ref: '#/components/schemas/TeamsAction' + - $ref: '#/components/schemas/SendSlackMessageAction' + - $ref: '#/components/schemas/SendTeamsMessageAction' RoutingRuleAttributes: description: Defines the configurable attributes of a routing rule, such as actions, query, time restriction, and urgency. @@ -30401,6 +30401,7 @@ components: type: string time_restriction: $ref: '#/components/schemas/TimeRestrictions' + nullable: true urgency: $ref: '#/components/schemas/Urgency' type: object @@ -30416,8 +30417,7 @@ components: properties: data: $ref: '#/components/schemas/RoutingRuleRelationshipsPolicyData' - required: - - data + nullable: true type: object RoutingRuleRelationshipsPolicyData: description: Represents the policy data reference, containing the policy's ID @@ -34489,6 +34489,65 @@ components: required: - selfServiceTrigger type: object + SendSlackMessageAction: + description: Sends a message to a Slack channel. + properties: + channel: + description: The channel ID. + example: CHANNEL + type: string + type: + $ref: '#/components/schemas/SendSlackMessageActionType' + workspace: + description: The workspace ID. + example: WORKSPACE + type: string + required: + - type + - channel + - workspace + type: object + SendSlackMessageActionType: + default: send_slack_message + description: Indicates that the action is a send Slack message action. + enum: + - send_slack_message + example: send_slack_message + type: string + x-enum-varnames: + - SEND_SLACK_MESSAGE + SendTeamsMessageAction: + description: Sends a message to a Microsoft Teams channel. + properties: + channel: + description: The channel ID. + example: CHANNEL + type: string + team: + description: The team ID. + example: TEAM + type: string + tenant: + description: The tenant ID. + example: TENANT + type: string + type: + $ref: '#/components/schemas/SendTeamsMessageActionType' + required: + - type + - channel + - tenant + - team + type: object + SendTeamsMessageActionType: + default: send_teams_message + description: Indicates that the action is a send Microsoft Teams message action. + enum: + - send_teams_message + example: send_teams_message + type: string + x-enum-varnames: + - SEND_TEAMS_MESSAGE SensitiveDataScannerConfigRequest: description: Group reorder request. properties: @@ -36396,26 +36455,6 @@ components: type: string x-enum-varnames: - AGGREGATED_CONNECTION - SlackAction: - description: Sends a message to a Slack channel. - properties: - channel: - description: The channel ID. - example: CHANNEL - type: string - type: - description: Must be set to "send_slack_message". - example: send_slack_message - type: string - workspace: - description: The workspace ID. - example: WORKSPACE - type: string - required: - - type - - channel - - workspace - type: object SlackIntegrationMetadata: description: Incident integration metadata for the Slack integration. properties: @@ -38330,31 +38369,6 @@ components: required: - data type: object - TeamsAction: - description: Sends a message to a Microsoft Teams channel. - properties: - channel: - description: The channel ID. - example: CHANNEL - type: string - team: - description: The team ID. - example: TEAM - type: string - tenant: - description: The tenant ID. - example: TENANT - type: string - type: - description: Must be set to "send_teams_message". - example: send_teams_message - type: string - required: - - type - - channel - - tenant - - team - type: object TeamsField: description: Supported teams field. enum: diff --git a/examples/v2/on-call/SetOnCallTeamRoutingRules.java b/examples/v2/on-call/SetOnCallTeamRoutingRules.java index f6b3d707fee..7d58d6cbb5f 100644 --- a/examples/v2/on-call/SetOnCallTeamRoutingRules.java +++ b/examples/v2/on-call/SetOnCallTeamRoutingRules.java @@ -3,8 +3,10 @@ import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; import com.datadog.api.client.v2.api.OnCallApi; +import com.datadog.api.client.v2.api.OnCallApi.SetOnCallTeamRoutingRulesOptionalParameters; import com.datadog.api.client.v2.model.RoutingRuleAction; -import com.datadog.api.client.v2.model.SlackAction; +import com.datadog.api.client.v2.model.SendSlackMessageAction; +import com.datadog.api.client.v2.model.SendSlackMessageActionType; import com.datadog.api.client.v2.model.TeamRoutingRules; import com.datadog.api.client.v2.model.TeamRoutingRulesRequest; import com.datadog.api.client.v2.model.TeamRoutingRulesRequestData; @@ -41,9 +43,11 @@ public static void main(String[] args) { .actions( Collections.singletonList( new RoutingRuleAction( - new SlackAction() + new SendSlackMessageAction() .channel("channel") - .type("send_slack_message") + .type( + SendSlackMessageActionType + .SEND_SLACK_MESSAGE) .workspace("workspace")))) .query("tags.service:test") .timeRestriction( @@ -60,8 +64,7 @@ public static void main(String[] args) { .endDay(Weekday.TUESDAY) .endTime("17:00:00") .startDay(Weekday.TUESDAY) - .startTime("09:00:00")))) - .urgency(Urgency.HIGH), + .startTime("09:00:00")))), new TeamRoutingRulesRequestRule() .policyId(ESCALATION_POLICY_DATA_ID) .query("") @@ -70,7 +73,11 @@ public static void main(String[] args) { .type(TeamRoutingRulesRequestDataType.TEAM_ROUTING_RULES)); try { - TeamRoutingRules result = apiInstance.setOnCallTeamRoutingRules(DD_TEAM_DATA_ID, body); + TeamRoutingRules result = + apiInstance.setOnCallTeamRoutingRules( + DD_TEAM_DATA_ID, + body, + new SetOnCallTeamRoutingRulesOptionalParameters().include("rules")); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling OnCallApi#setOnCallTeamRoutingRules"); diff --git a/src/main/java/com/datadog/api/client/v2/model/RoutingRuleAction.java b/src/main/java/com/datadog/api/client/v2/model/RoutingRuleAction.java index 7e441d67465..dfdf7884f47 100644 --- a/src/main/java/com/datadog/api/client/v2/model/RoutingRuleAction.java +++ b/src/main/java/com/datadog/api/client/v2/model/RoutingRuleAction.java @@ -77,88 +77,94 @@ public RoutingRuleAction deserialize(JsonParser jp, DeserializationContext ctxt) boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); int match = 0; JsonToken token = tree.traverse(jp.getCodec()).nextToken(); - // deserialize SlackAction + // deserialize SendSlackMessageAction try { boolean attemptParsing = true; // ensure that we respect type coercion as set on the client ObjectMapper - if (SlackAction.class.equals(Integer.class) - || SlackAction.class.equals(Long.class) - || SlackAction.class.equals(Float.class) - || SlackAction.class.equals(Double.class) - || SlackAction.class.equals(Boolean.class) - || SlackAction.class.equals(String.class)) { + if (SendSlackMessageAction.class.equals(Integer.class) + || SendSlackMessageAction.class.equals(Long.class) + || SendSlackMessageAction.class.equals(Float.class) + || SendSlackMessageAction.class.equals(Double.class) + || SendSlackMessageAction.class.equals(Boolean.class) + || SendSlackMessageAction.class.equals(String.class)) { attemptParsing = typeCoercion; if (!attemptParsing) { attemptParsing |= - ((SlackAction.class.equals(Integer.class) || SlackAction.class.equals(Long.class)) + ((SendSlackMessageAction.class.equals(Integer.class) + || SendSlackMessageAction.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); attemptParsing |= - ((SlackAction.class.equals(Float.class) || SlackAction.class.equals(Double.class)) + ((SendSlackMessageAction.class.equals(Float.class) + || SendSlackMessageAction.class.equals(Double.class)) && (token == JsonToken.VALUE_NUMBER_FLOAT || token == JsonToken.VALUE_NUMBER_INT)); attemptParsing |= - (SlackAction.class.equals(Boolean.class) + (SendSlackMessageAction.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); attemptParsing |= - (SlackAction.class.equals(String.class) && token == JsonToken.VALUE_STRING); + (SendSlackMessageAction.class.equals(String.class) + && token == JsonToken.VALUE_STRING); } } if (attemptParsing) { - tmp = tree.traverse(jp.getCodec()).readValueAs(SlackAction.class); + tmp = tree.traverse(jp.getCodec()).readValueAs(SendSlackMessageAction.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 (!((SlackAction) tmp).unparsed) { + if (!((SendSlackMessageAction) tmp).unparsed) { deserialized = tmp; match++; } - log.log(Level.FINER, "Input data matches schema 'SlackAction'"); + log.log(Level.FINER, "Input data matches schema 'SendSlackMessageAction'"); } } catch (Exception e) { // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'SlackAction'", e); + log.log(Level.FINER, "Input data does not match schema 'SendSlackMessageAction'", e); } - // deserialize TeamsAction + // deserialize SendTeamsMessageAction try { boolean attemptParsing = true; // ensure that we respect type coercion as set on the client ObjectMapper - if (TeamsAction.class.equals(Integer.class) - || TeamsAction.class.equals(Long.class) - || TeamsAction.class.equals(Float.class) - || TeamsAction.class.equals(Double.class) - || TeamsAction.class.equals(Boolean.class) - || TeamsAction.class.equals(String.class)) { + if (SendTeamsMessageAction.class.equals(Integer.class) + || SendTeamsMessageAction.class.equals(Long.class) + || SendTeamsMessageAction.class.equals(Float.class) + || SendTeamsMessageAction.class.equals(Double.class) + || SendTeamsMessageAction.class.equals(Boolean.class) + || SendTeamsMessageAction.class.equals(String.class)) { attemptParsing = typeCoercion; if (!attemptParsing) { attemptParsing |= - ((TeamsAction.class.equals(Integer.class) || TeamsAction.class.equals(Long.class)) + ((SendTeamsMessageAction.class.equals(Integer.class) + || SendTeamsMessageAction.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); attemptParsing |= - ((TeamsAction.class.equals(Float.class) || TeamsAction.class.equals(Double.class)) + ((SendTeamsMessageAction.class.equals(Float.class) + || SendTeamsMessageAction.class.equals(Double.class)) && (token == JsonToken.VALUE_NUMBER_FLOAT || token == JsonToken.VALUE_NUMBER_INT)); attemptParsing |= - (TeamsAction.class.equals(Boolean.class) + (SendTeamsMessageAction.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); attemptParsing |= - (TeamsAction.class.equals(String.class) && token == JsonToken.VALUE_STRING); + (SendTeamsMessageAction.class.equals(String.class) + && token == JsonToken.VALUE_STRING); } } if (attemptParsing) { - tmp = tree.traverse(jp.getCodec()).readValueAs(TeamsAction.class); + tmp = tree.traverse(jp.getCodec()).readValueAs(SendTeamsMessageAction.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 (!((TeamsAction) tmp).unparsed) { + if (!((SendTeamsMessageAction) tmp).unparsed) { deserialized = tmp; match++; } - log.log(Level.FINER, "Input data matches schema 'TeamsAction'"); + log.log(Level.FINER, "Input data matches schema 'SendTeamsMessageAction'"); } } catch (Exception e) { // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'TeamsAction'", e); + log.log(Level.FINER, "Input data does not match schema 'SendTeamsMessageAction'", e); } RoutingRuleAction ret = new RoutingRuleAction(); @@ -189,19 +195,19 @@ public RoutingRuleAction() { super("oneOf", Boolean.FALSE); } - public RoutingRuleAction(SlackAction o) { + public RoutingRuleAction(SendSlackMessageAction o) { super("oneOf", Boolean.FALSE); setActualInstance(o); } - public RoutingRuleAction(TeamsAction o) { + public RoutingRuleAction(SendTeamsMessageAction o) { super("oneOf", Boolean.FALSE); setActualInstance(o); } static { - schemas.put("SlackAction", new GenericType() {}); - schemas.put("TeamsAction", new GenericType() {}); + schemas.put("SendSlackMessageAction", new GenericType() {}); + schemas.put("SendTeamsMessageAction", new GenericType() {}); JSON.registerDescendants(RoutingRuleAction.class, Collections.unmodifiableMap(schemas)); } @@ -212,18 +218,18 @@ public Map getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: SlackAction, TeamsAction + * against the oneOf child schemas: SendSlackMessageAction, SendTeamsMessageAction * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). */ @Override public void setActualInstance(Object instance) { - if (JSON.isInstanceOf(SlackAction.class, instance, new HashSet>())) { + if (JSON.isInstanceOf(SendSlackMessageAction.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } - if (JSON.isInstanceOf(TeamsAction.class, instance, new HashSet>())) { + if (JSON.isInstanceOf(SendTeamsMessageAction.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } @@ -232,13 +238,15 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } - throw new RuntimeException("Invalid instance type. Must be SlackAction, TeamsAction"); + throw new RuntimeException( + "Invalid instance type. Must be SendSlackMessageAction, SendTeamsMessageAction"); } /** - * Get the actual instance, which can be the following: SlackAction, TeamsAction + * Get the actual instance, which can be the following: SendSlackMessageAction, + * SendTeamsMessageAction * - * @return The actual instance (SlackAction, TeamsAction) + * @return The actual instance (SendSlackMessageAction, SendTeamsMessageAction) */ @Override public Object getActualInstance() { @@ -246,24 +254,24 @@ public Object getActualInstance() { } /** - * Get the actual instance of `SlackAction`. If the actual instance is not `SlackAction`, the - * ClassCastException will be thrown. + * Get the actual instance of `SendSlackMessageAction`. If the actual instance is not + * `SendSlackMessageAction`, the ClassCastException will be thrown. * - * @return The actual instance of `SlackAction` - * @throws ClassCastException if the instance is not `SlackAction` + * @return The actual instance of `SendSlackMessageAction` + * @throws ClassCastException if the instance is not `SendSlackMessageAction` */ - public SlackAction getSlackAction() throws ClassCastException { - return (SlackAction) super.getActualInstance(); + public SendSlackMessageAction getSendSlackMessageAction() throws ClassCastException { + return (SendSlackMessageAction) super.getActualInstance(); } /** - * Get the actual instance of `TeamsAction`. If the actual instance is not `TeamsAction`, the - * ClassCastException will be thrown. + * Get the actual instance of `SendTeamsMessageAction`. If the actual instance is not + * `SendTeamsMessageAction`, the ClassCastException will be thrown. * - * @return The actual instance of `TeamsAction` - * @throws ClassCastException if the instance is not `TeamsAction` + * @return The actual instance of `SendTeamsMessageAction` + * @throws ClassCastException if the instance is not `SendTeamsMessageAction` */ - public TeamsAction getTeamsAction() throws ClassCastException { - return (TeamsAction) super.getActualInstance(); + public SendTeamsMessageAction getSendTeamsMessageAction() throws ClassCastException { + return (SendTeamsMessageAction) super.getActualInstance(); } } diff --git a/src/main/java/com/datadog/api/client/v2/model/RoutingRuleRelationshipsPolicy.java b/src/main/java/com/datadog/api/client/v2/model/RoutingRuleRelationshipsPolicy.java index 1e31339393f..38dcbf23158 100644 --- a/src/main/java/com/datadog/api/client/v2/model/RoutingRuleRelationshipsPolicy.java +++ b/src/main/java/com/datadog/api/client/v2/model/RoutingRuleRelationshipsPolicy.java @@ -8,7 +8,6 @@ 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; @@ -26,16 +25,6 @@ public class RoutingRuleRelationshipsPolicy { public static final String JSON_PROPERTY_DATA = "data"; private RoutingRuleRelationshipsPolicyData data; - public RoutingRuleRelationshipsPolicy() {} - - @JsonCreator - public RoutingRuleRelationshipsPolicy( - @JsonProperty(required = true, value = JSON_PROPERTY_DATA) - RoutingRuleRelationshipsPolicyData data) { - this.data = data; - this.unparsed |= data.unparsed; - } - public RoutingRuleRelationshipsPolicy data(RoutingRuleRelationshipsPolicyData data) { this.data = data; this.unparsed |= data.unparsed; @@ -47,8 +36,9 @@ public RoutingRuleRelationshipsPolicy data(RoutingRuleRelationshipsPolicyData da * * @return data */ + @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_DATA) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public RoutingRuleRelationshipsPolicyData getData() { return data; } diff --git a/src/main/java/com/datadog/api/client/v2/model/SlackAction.java b/src/main/java/com/datadog/api/client/v2/model/SendSlackMessageAction.java similarity index 76% rename from src/main/java/com/datadog/api/client/v2/model/SlackAction.java rename to src/main/java/com/datadog/api/client/v2/model/SendSlackMessageAction.java index 1875c3d75ad..b67cda9cd0d 100644 --- a/src/main/java/com/datadog/api/client/v2/model/SlackAction.java +++ b/src/main/java/com/datadog/api/client/v2/model/SendSlackMessageAction.java @@ -19,36 +19,37 @@ /** Sends a message to a Slack channel. */ @JsonPropertyOrder({ - SlackAction.JSON_PROPERTY_CHANNEL, - SlackAction.JSON_PROPERTY_TYPE, - SlackAction.JSON_PROPERTY_WORKSPACE + SendSlackMessageAction.JSON_PROPERTY_CHANNEL, + SendSlackMessageAction.JSON_PROPERTY_TYPE, + SendSlackMessageAction.JSON_PROPERTY_WORKSPACE }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class SlackAction { +public class SendSlackMessageAction { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_CHANNEL = "channel"; private String channel; public static final String JSON_PROPERTY_TYPE = "type"; - private String type; + private SendSlackMessageActionType type = SendSlackMessageActionType.SEND_SLACK_MESSAGE; public static final String JSON_PROPERTY_WORKSPACE = "workspace"; private String workspace; - public SlackAction() {} + public SendSlackMessageAction() {} @JsonCreator - public SlackAction( + public SendSlackMessageAction( @JsonProperty(required = true, value = JSON_PROPERTY_CHANNEL) String channel, - @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) String type, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) SendSlackMessageActionType type, @JsonProperty(required = true, value = JSON_PROPERTY_WORKSPACE) String workspace) { this.channel = channel; this.type = type; + this.unparsed |= !type.isValid(); this.workspace = workspace; } - public SlackAction channel(String channel) { + public SendSlackMessageAction channel(String channel) { this.channel = channel; return this; } @@ -68,27 +69,31 @@ public void setChannel(String channel) { this.channel = channel; } - public SlackAction type(String type) { + public SendSlackMessageAction type(SendSlackMessageActionType type) { this.type = type; + this.unparsed |= !type.isValid(); return this; } /** - * Must be set to "send_slack_message". + * Indicates that the action is a send Slack message action. * * @return type */ @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getType() { + public SendSlackMessageActionType getType() { return type; } - public void setType(String type) { + public void setType(SendSlackMessageActionType type) { + if (!type.isValid()) { + this.unparsed = true; + } this.type = type; } - public SlackAction workspace(String workspace) { + public SendSlackMessageAction workspace(String workspace) { this.workspace = workspace; return this; } @@ -120,10 +125,10 @@ public void setWorkspace(String workspace) { * * @param key The arbitrary key to set * @param value The associated value - * @return SlackAction + * @return SendSlackMessageAction */ @JsonAnySetter - public SlackAction putAdditionalProperty(String key, Object value) { + public SendSlackMessageAction putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -154,7 +159,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** Return true if this SlackAction object is equal to o. */ + /** Return true if this SendSlackMessageAction object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -163,11 +168,11 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - SlackAction slackAction = (SlackAction) o; - return Objects.equals(this.channel, slackAction.channel) - && Objects.equals(this.type, slackAction.type) - && Objects.equals(this.workspace, slackAction.workspace) - && Objects.equals(this.additionalProperties, slackAction.additionalProperties); + SendSlackMessageAction sendSlackMessageAction = (SendSlackMessageAction) o; + return Objects.equals(this.channel, sendSlackMessageAction.channel) + && Objects.equals(this.type, sendSlackMessageAction.type) + && Objects.equals(this.workspace, sendSlackMessageAction.workspace) + && Objects.equals(this.additionalProperties, sendSlackMessageAction.additionalProperties); } @Override @@ -178,7 +183,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class SlackAction {\n"); + sb.append("class SendSlackMessageAction {\n"); sb.append(" channel: ").append(toIndentedString(channel)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" workspace: ").append(toIndentedString(workspace)).append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/SendSlackMessageActionType.java b/src/main/java/com/datadog/api/client/v2/model/SendSlackMessageActionType.java new file mode 100644 index 00000000000..2f72c5958e1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SendSlackMessageActionType.java @@ -0,0 +1,57 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Indicates that the action is a send Slack message action. */ +@JsonSerialize(using = SendSlackMessageActionType.SendSlackMessageActionTypeSerializer.class) +public class SendSlackMessageActionType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("send_slack_message")); + + public static final SendSlackMessageActionType SEND_SLACK_MESSAGE = + new SendSlackMessageActionType("send_slack_message"); + + SendSlackMessageActionType(String value) { + super(value, allowedValues); + } + + public static class SendSlackMessageActionTypeSerializer + extends StdSerializer { + public SendSlackMessageActionTypeSerializer(Class t) { + super(t); + } + + public SendSlackMessageActionTypeSerializer() { + this(null); + } + + @Override + public void serialize( + SendSlackMessageActionType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SendSlackMessageActionType fromValue(String value) { + return new SendSlackMessageActionType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TeamsAction.java b/src/main/java/com/datadog/api/client/v2/model/SendTeamsMessageAction.java similarity index 76% rename from src/main/java/com/datadog/api/client/v2/model/TeamsAction.java rename to src/main/java/com/datadog/api/client/v2/model/SendTeamsMessageAction.java index 231ed7170a4..52bd7cc18d7 100644 --- a/src/main/java/com/datadog/api/client/v2/model/TeamsAction.java +++ b/src/main/java/com/datadog/api/client/v2/model/SendTeamsMessageAction.java @@ -19,14 +19,14 @@ /** Sends a message to a Microsoft Teams channel. */ @JsonPropertyOrder({ - TeamsAction.JSON_PROPERTY_CHANNEL, - TeamsAction.JSON_PROPERTY_TEAM, - TeamsAction.JSON_PROPERTY_TENANT, - TeamsAction.JSON_PROPERTY_TYPE + SendTeamsMessageAction.JSON_PROPERTY_CHANNEL, + SendTeamsMessageAction.JSON_PROPERTY_TEAM, + SendTeamsMessageAction.JSON_PROPERTY_TENANT, + SendTeamsMessageAction.JSON_PROPERTY_TYPE }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class TeamsAction { +public class SendTeamsMessageAction { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_CHANNEL = "channel"; private String channel; @@ -38,23 +38,24 @@ public class TeamsAction { private String tenant; public static final String JSON_PROPERTY_TYPE = "type"; - private String type; + private SendTeamsMessageActionType type = SendTeamsMessageActionType.SEND_TEAMS_MESSAGE; - public TeamsAction() {} + public SendTeamsMessageAction() {} @JsonCreator - public TeamsAction( + public SendTeamsMessageAction( @JsonProperty(required = true, value = JSON_PROPERTY_CHANNEL) String channel, @JsonProperty(required = true, value = JSON_PROPERTY_TEAM) String team, @JsonProperty(required = true, value = JSON_PROPERTY_TENANT) String tenant, - @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) String type) { + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) SendTeamsMessageActionType type) { this.channel = channel; this.team = team; this.tenant = tenant; this.type = type; + this.unparsed |= !type.isValid(); } - public TeamsAction channel(String channel) { + public SendTeamsMessageAction channel(String channel) { this.channel = channel; return this; } @@ -74,7 +75,7 @@ public void setChannel(String channel) { this.channel = channel; } - public TeamsAction team(String team) { + public SendTeamsMessageAction team(String team) { this.team = team; return this; } @@ -94,7 +95,7 @@ public void setTeam(String team) { this.team = team; } - public TeamsAction tenant(String tenant) { + public SendTeamsMessageAction tenant(String tenant) { this.tenant = tenant; return this; } @@ -114,23 +115,27 @@ public void setTenant(String tenant) { this.tenant = tenant; } - public TeamsAction type(String type) { + public SendTeamsMessageAction type(SendTeamsMessageActionType type) { this.type = type; + this.unparsed |= !type.isValid(); return this; } /** - * Must be set to "send_teams_message". + * Indicates that the action is a send Microsoft Teams message action. * * @return type */ @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getType() { + public SendTeamsMessageActionType getType() { return type; } - public void setType(String type) { + public void setType(SendTeamsMessageActionType type) { + if (!type.isValid()) { + this.unparsed = true; + } this.type = type; } @@ -146,10 +151,10 @@ public void setType(String type) { * * @param key The arbitrary key to set * @param value The associated value - * @return TeamsAction + * @return SendTeamsMessageAction */ @JsonAnySetter - public TeamsAction putAdditionalProperty(String key, Object value) { + public SendTeamsMessageAction putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -180,7 +185,7 @@ public Object getAdditionalProperty(String key) { return this.additionalProperties.get(key); } - /** Return true if this TeamsAction object is equal to o. */ + /** Return true if this SendTeamsMessageAction object is equal to o. */ @Override public boolean equals(Object o) { if (this == o) { @@ -189,12 +194,12 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - TeamsAction teamsAction = (TeamsAction) o; - return Objects.equals(this.channel, teamsAction.channel) - && Objects.equals(this.team, teamsAction.team) - && Objects.equals(this.tenant, teamsAction.tenant) - && Objects.equals(this.type, teamsAction.type) - && Objects.equals(this.additionalProperties, teamsAction.additionalProperties); + SendTeamsMessageAction sendTeamsMessageAction = (SendTeamsMessageAction) o; + return Objects.equals(this.channel, sendTeamsMessageAction.channel) + && Objects.equals(this.team, sendTeamsMessageAction.team) + && Objects.equals(this.tenant, sendTeamsMessageAction.tenant) + && Objects.equals(this.type, sendTeamsMessageAction.type) + && Objects.equals(this.additionalProperties, sendTeamsMessageAction.additionalProperties); } @Override @@ -205,7 +210,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class TeamsAction {\n"); + sb.append("class SendTeamsMessageAction {\n"); sb.append(" channel: ").append(toIndentedString(channel)).append("\n"); sb.append(" team: ").append(toIndentedString(team)).append("\n"); sb.append(" tenant: ").append(toIndentedString(tenant)).append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/SendTeamsMessageActionType.java b/src/main/java/com/datadog/api/client/v2/model/SendTeamsMessageActionType.java new file mode 100644 index 00000000000..4433a723334 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SendTeamsMessageActionType.java @@ -0,0 +1,57 @@ +/* + * 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.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Indicates that the action is a send Microsoft Teams message action. */ +@JsonSerialize(using = SendTeamsMessageActionType.SendTeamsMessageActionTypeSerializer.class) +public class SendTeamsMessageActionType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("send_teams_message")); + + public static final SendTeamsMessageActionType SEND_TEAMS_MESSAGE = + new SendTeamsMessageActionType("send_teams_message"); + + SendTeamsMessageActionType(String value) { + super(value, allowedValues); + } + + public static class SendTeamsMessageActionTypeSerializer + extends StdSerializer { + public SendTeamsMessageActionTypeSerializer(Class t) { + super(t); + } + + public SendTeamsMessageActionTypeSerializer() { + this(null); + } + + @Override + public void serialize( + SendTeamsMessageActionType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SendTeamsMessageActionType fromValue(String value) { + return new SendTeamsMessageActionType(value); + } +} diff --git a/src/test/resources/cassettes/features/v2/Set_On_Call_team_routing_rules_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Set_On_Call_team_routing_rules_returns_OK_response.freeze index 8f21581f616..72c349683bd 100644 --- a/src/test/resources/cassettes/features/v2/Set_On_Call_team_routing_rules_returns_OK_response.freeze +++ b/src/test/resources/cassettes/features/v2/Set_On_Call_team_routing_rules_returns_OK_response.freeze @@ -1 +1 @@ -2025-05-21T11:01:55.512Z \ No newline at end of file +2025-05-27T08:25:42.329Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Set_On_Call_team_routing_rules_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Set_On_Call_team_routing_rules_returns_OK_response.json index 0d161204503..f707ec16d2b 100644 --- a/src/test/resources/cassettes/features/v2/Set_On_Call_team_routing_rules_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Set_On_Call_team_routing_rules_returns_OK_response.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"email\":\"Test-Set_On_Call_team_routing_rules_returns_OK_response-1747825315@datadoghq.com\",\"title\":\"user title\"},\"type\":\"users\"}}" + "json": "{\"data\":{\"attributes\":{\"email\":\"Test-Set_On_Call_team_routing_rules_returns_OK_response-1748334342@datadoghq.com\",\"title\":\"user title\"},\"type\":\"users\"}}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"type\":\"users\",\"id\":\"022c3a60-3633-11f0-b7ed-ce2381807b05\",\"attributes\":{\"name\":null,\"handle\":\"test-set_on_call_team_routing_rules_returns_ok_response-1747825315@datadoghq.com\",\"created_at\":\"2025-05-21T11:01:55.617066+00:00\",\"modified_at\":\"2025-05-21T11:01:55.617066+00:00\",\"email\":\"test-set_on_call_team_routing_rules_returns_ok_response-1747825315@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/83f881635a4cf010167f0bf22fa154a3?s=48&d=retro\",\"title\":\"user title\",\"verified\":false,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Pending\"},\"relationships\":{\"roles\":{\"data\":[]},\"org\":{\"data\":{\"type\":\"orgs\",\"id\":\"4dee724d-00cc-11ea-a77b-570c9d03c6c5\"}}}}}\n", + "body": "{\"data\":{\"type\":\"users\",\"id\":\"2e2a9a43-3ad4-11f0-a123-c6d5a6dabcf4\",\"attributes\":{\"name\":null,\"handle\":\"test-set_on_call_team_routing_rules_returns_ok_response-1748334342@datadoghq.com\",\"created_at\":\"2025-05-27T08:25:43.050742+00:00\",\"modified_at\":\"2025-05-27T08:25:43.050742+00:00\",\"email\":\"test-set_on_call_team_routing_rules_returns_ok_response-1748334342@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/7dc6399db1883a29b1a0022d05a3996c?s=48&d=retro\",\"title\":\"user title\",\"verified\":false,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Pending\"},\"relationships\":{\"roles\":{\"data\":[]},\"org\":{\"data\":{\"type\":\"orgs\",\"id\":\"4dee724d-00cc-11ea-a77b-570c9d03c6c5\"}}}}}\n", "headers": { "Content-Type": [ "application/json" @@ -27,13 +27,13 @@ "timeToLive": { "unlimited": true }, - "id": "e64a7905-fcd3-e328-ef36-d1f00a0d42a0" + "id": "6a253359-e04a-e41a-4c8d-66c21274648d" }, { "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"handle\":\"test-handle-deb316d25d38fe23\",\"name\":\"test-name-deb316d25d38fe23\"},\"type\":\"team\"}}" + "json": "{\"data\":{\"attributes\":{\"handle\":\"test-handle-1fd6c4543cf4cd88\",\"name\":\"test-name-1fd6c4543cf4cd88\"},\"type\":\"team\"}}" }, "headers": {}, "method": "POST", @@ -42,7 +42,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"type\":\"team\",\"id\":\"68a584b9-c8e4-414a-aedd-31f30ab44d27\",\"attributes\":{\"name\":\"test-name-deb316d25d38fe23\",\"handle\":\"test-handle-deb316d25d38fe23\",\"summary\":null,\"description\":null,\"avatar\":null,\"banner\":1,\"visible_modules\":[],\"hidden_modules\":[],\"created_at\":\"2025-05-21T11:01:55.737730+00:00\",\"modified_at\":\"2025-05-21T11:01:55.737740+00:00\",\"user_count\":0,\"link_count\":0},\"relationships\":{\"team_links\":{\"links\":{\"related\":\"/api/v2/team/68a584b9-c8e4-414a-aedd-31f30ab44d27/links\"}},\"user_team_permissions\":{\"links\":{\"related\":\"/api/v2/team/68a584b9-c8e4-414a-aedd-31f30ab44d27/permission-settings\"}}}}}\n", + "body": "{\"data\":{\"type\":\"team\",\"id\":\"82aa87bd-fdf1-4683-aecd-706133165bb2\",\"attributes\":{\"name\":\"test-name-1fd6c4543cf4cd88\",\"handle\":\"test-handle-1fd6c4543cf4cd88\",\"summary\":null,\"description\":null,\"avatar\":null,\"banner\":1,\"visible_modules\":[],\"hidden_modules\":[],\"created_at\":\"2025-05-27T08:25:43.186129+00:00\",\"modified_at\":\"2025-05-27T08:25:43.186139+00:00\",\"user_count\":0,\"link_count\":0},\"relationships\":{\"team_links\":{\"links\":{\"related\":\"/api/v2/team/82aa87bd-fdf1-4683-aecd-706133165bb2/links\"}},\"user_team_permissions\":{\"links\":{\"related\":\"/api/v2/team/82aa87bd-fdf1-4683-aecd-706133165bb2/permission-settings\"}}}}}\n", "headers": { "Content-Type": [ "application/json" @@ -57,13 +57,13 @@ "timeToLive": { "unlimited": true }, - "id": "5e279696-9952-68c9-3a3a-d48040897950" + "id": "ff1e7b45-1dbd-5a0a-78fa-75d423a4bd32" }, { "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"layers\":[{\"effective_date\":\"2025-05-11T11:01:55.512Z\",\"end_date\":\"2025-05-31T11:01:55.512Z\",\"interval\":{\"days\":1},\"members\":[{\"user\":{\"id\":\"890f29d4-0b7a-11f0-aeb2-760fcae4f596\"}}],\"name\":\"Layer 1\",\"restrictions\":[{\"end_day\":\"friday\",\"end_time\":\"17:00:00\",\"start_day\":\"monday\",\"start_time\":\"09:00:00\"}],\"rotation_start\":\"2025-05-16T11:01:55.512Z\"}],\"name\":\"Test-Set_On_Call_team_routing_rules_returns_OK_response-1747825315\",\"time_zone\":\"America/New_York\"},\"relationships\":{\"teams\":{\"data\":[{\"id\":\"65aea9d0-941c-4607-bf8a-14fc0dac2820\",\"type\":\"teams\"}]}},\"type\":\"schedules\"}}" + "json": "{\"data\":{\"attributes\":{\"layers\":[{\"effective_date\":\"2025-05-17T08:25:42.329Z\",\"end_date\":\"2025-06-06T08:25:42.329Z\",\"interval\":{\"days\":1},\"members\":[{\"user\":{\"id\":\"890f29d4-0b7a-11f0-aeb2-760fcae4f596\"}}],\"name\":\"Layer 1\",\"restrictions\":[{\"end_day\":\"friday\",\"end_time\":\"17:00:00\",\"start_day\":\"monday\",\"start_time\":\"09:00:00\"}],\"rotation_start\":\"2025-05-22T08:25:42.329Z\"}],\"name\":\"Test-Set_On_Call_team_routing_rules_returns_OK_response-1748334342\",\"time_zone\":\"America/New_York\"},\"relationships\":{\"teams\":{\"data\":[{\"id\":\"65aea9d0-941c-4607-bf8a-14fc0dac2820\",\"type\":\"teams\"}]}},\"type\":\"schedules\"}}" }, "headers": {}, "method": "POST", @@ -72,7 +72,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"id\":\"b1819128-6086-4eb2-b555-87f33398825d\",\"type\":\"schedules\",\"attributes\":{\"name\":\"Test-Set_On_Call_team_routing_rules_returns_OK_response-1747825315\",\"time_zone\":\"America/New_York\"},\"relationships\":{\"layers\":{\"data\":[{\"id\":\"19e523ad-b55a-4f32-8c41-008ba17be5fe\",\"type\":\"layers\"}]},\"teams\":{\"data\":[{\"id\":\"65aea9d0-941c-4607-bf8a-14fc0dac2820\",\"type\":\"teams\"}]}}}}", + "body": "{\"data\":{\"id\":\"2eb42c33-6304-4103-9814-25a2e8ce6d02\",\"type\":\"schedules\",\"attributes\":{\"name\":\"Test-Set_On_Call_team_routing_rules_returns_OK_response-1748334342\",\"time_zone\":\"America/New_York\"},\"relationships\":{\"layers\":{\"data\":[{\"id\":\"6f88a332-464d-42b2-94c2-ae9b1e9211eb\",\"type\":\"layers\"}]},\"teams\":{\"data\":[{\"id\":\"65aea9d0-941c-4607-bf8a-14fc0dac2820\",\"type\":\"teams\"}]}}}}", "headers": { "Content-Type": [ "application/vnd.api+json" @@ -87,13 +87,13 @@ "timeToLive": { "unlimited": true }, - "id": "105e223a-bcce-d9e7-b293-415ece603fd4" + "id": "f0fa2280-ca40-7a64-cd75-fcd5fdbd2f92" }, { "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"name\":\"Test-Set_On_Call_team_routing_rules_returns_OK_response-1747825315\",\"resolve_page_on_policy_end\":true,\"retries\":2,\"steps\":[{\"assignment\":\"default\",\"escalate_after_seconds\":3600,\"targets\":[{\"id\":\"68a584b9-c8e4-414a-aedd-31f30ab44d27\",\"type\":\"teams\"},{\"id\":\"b1819128-6086-4eb2-b555-87f33398825d\",\"type\":\"schedules\"},{\"id\":\"022c3a60-3633-11f0-b7ed-ce2381807b05\",\"type\":\"users\"}]},{\"assignment\":\"round-robin\",\"escalate_after_seconds\":3600,\"targets\":[{\"id\":\"68a584b9-c8e4-414a-aedd-31f30ab44d27\",\"type\":\"teams\"}]}]},\"relationships\":{\"teams\":{\"data\":[{\"id\":\"68a584b9-c8e4-414a-aedd-31f30ab44d27\",\"type\":\"teams\"}]}},\"type\":\"policies\"}}" + "json": "{\"data\":{\"attributes\":{\"name\":\"Test-Set_On_Call_team_routing_rules_returns_OK_response-1748334342\",\"resolve_page_on_policy_end\":true,\"retries\":2,\"steps\":[{\"assignment\":\"default\",\"escalate_after_seconds\":3600,\"targets\":[{\"id\":\"82aa87bd-fdf1-4683-aecd-706133165bb2\",\"type\":\"teams\"},{\"id\":\"2eb42c33-6304-4103-9814-25a2e8ce6d02\",\"type\":\"schedules\"},{\"id\":\"2e2a9a43-3ad4-11f0-a123-c6d5a6dabcf4\",\"type\":\"users\"}]},{\"assignment\":\"round-robin\",\"escalate_after_seconds\":3600,\"targets\":[{\"id\":\"82aa87bd-fdf1-4683-aecd-706133165bb2\",\"type\":\"teams\"}]}]},\"relationships\":{\"teams\":{\"data\":[{\"id\":\"82aa87bd-fdf1-4683-aecd-706133165bb2\",\"type\":\"teams\"}]}},\"type\":\"policies\"}}" }, "headers": {}, "method": "POST", @@ -102,7 +102,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"id\":\"4926e7bf-727c-4899-ab45-3cbf3bed0c23\",\"type\":\"policies\",\"attributes\":{\"name\":\"Test-Set_On_Call_team_routing_rules_returns_OK_response-1747825315\",\"resolve_page_on_policy_end\":true,\"retries\":2},\"relationships\":{\"steps\":{\"data\":[{\"id\":\"0b8001d8-17ab-46ab-979e-b426e69b6423\",\"type\":\"steps\"},{\"id\":\"b02f1fc4-3cdc-4b70-bcf2-fae24d5b09f9\",\"type\":\"steps\"}]},\"teams\":{\"data\":[{\"id\":\"68a584b9-c8e4-414a-aedd-31f30ab44d27\",\"type\":\"teams\"}]}}}}", + "body": "{\"data\":{\"id\":\"6a74ecd6-9640-4dde-9827-b00a89e0678d\",\"type\":\"policies\",\"attributes\":{\"name\":\"Test-Set_On_Call_team_routing_rules_returns_OK_response-1748334342\",\"resolve_page_on_policy_end\":true,\"retries\":2},\"relationships\":{\"steps\":{\"data\":[{\"id\":\"a03dc73f-ddba-4c46-bbe0-d7d3256a7133\",\"type\":\"steps\"},{\"id\":\"fead9a26-8f86-4419-8146-f9f2cf45200b\",\"type\":\"steps\"}]},\"teams\":{\"data\":[{\"id\":\"82aa87bd-fdf1-4683-aecd-706133165bb2\",\"type\":\"teams\"}]}}}}", "headers": { "Content-Type": [ "application/vnd.api+json" @@ -117,22 +117,27 @@ "timeToLive": { "unlimited": true }, - "id": "0e8615d7-aa9d-d674-a688-bdb9eaa5a229" + "id": "6e9e0b3e-ce55-1f6f-96d5-89feaeaa337c" }, { "httpRequest": { "body": { "type": "JSON", - "json": "{\"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\"},\"urgency\":\"high\"},{\"policy_id\":\"4926e7bf-727c-4899-ab45-3cbf3bed0c23\",\"query\":\"\",\"urgency\":\"low\"}]},\"id\":\"68a584b9-c8e4-414a-aedd-31f30ab44d27\",\"type\":\"team_routing_rules\"}}" + "json": "{\"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\":\"6a74ecd6-9640-4dde-9827-b00a89e0678d\",\"query\":\"\",\"urgency\":\"low\"}]},\"id\":\"82aa87bd-fdf1-4683-aecd-706133165bb2\",\"type\":\"team_routing_rules\"}}" }, "headers": {}, "method": "PUT", - "path": "/api/v2/on-call/teams/68a584b9-c8e4-414a-aedd-31f30ab44d27/routing-rules", + "path": "/api/v2/on-call/teams/82aa87bd-fdf1-4683-aecd-706133165bb2/routing-rules", + "queryStringParameters": { + "include": [ + "rules" + ] + }, "keepAlive": false, "secure": true }, "httpResponse": { - "body": "{\"data\":{\"id\":\"68a584b9-c8e4-414a-aedd-31f30ab44d27\",\"type\":\"team_routing_rules\",\"relationships\":{\"rules\":{\"data\":[{\"id\":\"virtual-68a584b9-c8e4-414a-aedd-31f30ab44d27-rule-0\",\"type\":\"team_routing_rules\"},{\"id\":\"virtual-68a584b9-c8e4-414a-aedd-31f30ab44d27-rule-1\",\"type\":\"team_routing_rules\"}]}}}}", + "body": "{\"data\":{\"id\":\"82aa87bd-fdf1-4683-aecd-706133165bb2\",\"type\":\"team_routing_rules\",\"relationships\":{\"rules\":{\"data\":[{\"id\":\"virtual-82aa87bd-fdf1-4683-aecd-706133165bb2-rule-0\",\"type\":\"team_routing_rules\"},{\"id\":\"virtual-82aa87bd-fdf1-4683-aecd-706133165bb2-rule-1\",\"type\":\"team_routing_rules\"}]}}},\"included\":[{\"id\":\"virtual-82aa87bd-fdf1-4683-aecd-706133165bb2-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-82aa87bd-fdf1-4683-aecd-706133165bb2-rule-1\",\"type\":\"team_routing_rules\",\"attributes\":{\"actions\":[],\"query\":\"\",\"urgency\":\"low\"},\"relationships\":{\"policy\":{\"data\":{\"id\":\"6a74ecd6-9640-4dde-9827-b00a89e0678d\",\"type\":\"policies\"}}}}]}", "headers": { "Content-Type": [ "application/vnd.api+json" @@ -147,18 +152,18 @@ "timeToLive": { "unlimited": true }, - "id": "6be74749-ec19-730c-33b1-7e7ebfa1dfa2" + "id": "6c28fa5e-57a5-fa63-2c8b-b13fdd0bc722" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/on-call/escalation-policies/4926e7bf-727c-4899-ab45-3cbf3bed0c23", + "path": "/api/v2/on-call/escalation-policies/6a74ecd6-9640-4dde-9827-b00a89e0678d", "keepAlive": false, "secure": true }, "httpResponse": { - "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"policy[4926e7bf-727c-4899-ab45-3cbf3bed0c23] is in use\"}]}", + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"policy[6a74ecd6-9640-4dde-9827-b00a89e0678d] is in use\"}]}", "headers": { "Content-Type": [ "application/vnd.api+json" @@ -173,18 +178,18 @@ "timeToLive": { "unlimited": true }, - "id": "08ef7235-9c22-ce01-3497-60a9c031b0bc" + "id": "80f579c6-b02c-b2e8-ad1c-08c8603c2e80" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/on-call/schedules/b1819128-6086-4eb2-b555-87f33398825d", + "path": "/api/v2/on-call/schedules/2eb42c33-6304-4103-9814-25a2e8ce6d02", "keepAlive": false, "secure": true }, "httpResponse": { - "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"schedule[b1819128-6086-4eb2-b555-87f33398825d] is in use\"}]}", + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"schedule[2eb42c33-6304-4103-9814-25a2e8ce6d02] is in use\"}]}", "headers": { "Content-Type": [ "application/vnd.api+json" @@ -199,13 +204,13 @@ "timeToLive": { "unlimited": true }, - "id": "8e6ce1f8-dcde-105a-54e7-9a32259bcd42" + "id": "1331bb2a-57e5-b930-616b-88fe0575fde2" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/team/68a584b9-c8e4-414a-aedd-31f30ab44d27", + "path": "/api/v2/team/82aa87bd-fdf1-4683-aecd-706133165bb2", "keepAlive": false, "secure": true }, @@ -220,13 +225,13 @@ "timeToLive": { "unlimited": true }, - "id": "4ef8df33-71e6-da6b-7e6f-ea4b3824b0e0" + "id": "701ee978-2a67-8671-1e74-97c9a9f65dd0" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/users/022c3a60-3633-11f0-b7ed-ce2381807b05", + "path": "/api/v2/users/2e2a9a43-3ad4-11f0-a123-c6d5a6dabcf4", "keepAlive": false, "secure": true }, @@ -241,6 +246,6 @@ "timeToLive": { "unlimited": true }, - "id": "e14dfed5-ff4e-78eb-b1d1-b064af6fa05f" + "id": "81b02722-94fc-0041-293e-a911a60e6091" } ] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/on-call.feature b/src/test/resources/com/datadog/api/client/v2/api/on-call.feature index 6ce9161125a..7072fd61c55 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/on-call.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/on-call.feature @@ -154,7 +154,8 @@ 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"}]}, "urgency": "high"}, {"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"}]}}, {"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