From cb2f44344126dd3562d2b09b381f4b1edfe11f69 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 4 Oct 2024 15:33:36 +0000 Subject: [PATCH] Regenerate client from commit f28ad048 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 38 +++ .../IncidentIntegrationMetadataMetadata.java | 77 +++++- .../v2/model/MSTeamsIntegrationMetadata.java | 156 ++++++++++++ .../MSTeamsIntegrationMetadataTeamsItem.java | 231 ++++++++++++++++++ 5 files changed, 502 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/datadog/api/client/v2/model/MSTeamsIntegrationMetadata.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/MSTeamsIntegrationMetadataTeamsItem.java diff --git a/.apigentools-info b/.apigentools-info index ed16102918a..fa983e38305 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-04 10:38:24.095988", - "spec_repo_commit": "7a63d530" + "regenerated": "2024-10-04 15:31:57.989019", + "spec_repo_commit": "f28ad048" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-10-04 10:38:24.110677", - "spec_repo_commit": "7a63d530" + "regenerated": "2024-10-04 15:31:58.012298", + "spec_repo_commit": "f28ad048" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 5233ad64ba8..e24460a1bda 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -10640,6 +10640,7 @@ components: oneOf: - $ref: '#/components/schemas/SlackIntegrationMetadata' - $ref: '#/components/schemas/JiraIntegrationMetadata' + - $ref: '#/components/schemas/MSTeamsIntegrationMetadata' IncidentIntegrationMetadataPatchData: description: Incident integration metadata data for a patch request. properties: @@ -13634,6 +13635,43 @@ components: from the other indexes type: string type: object + MSTeamsIntegrationMetadata: + description: Incident integration metadata for the Microsoft Teams integration. + properties: + teams: + description: Array of Microsoft Teams in this integration metadata. + example: [] + items: + $ref: '#/components/schemas/MSTeamsIntegrationMetadataTeamsItem' + type: array + required: + - teams + type: object + MSTeamsIntegrationMetadataTeamsItem: + description: Item in the Microsoft Teams integration metadata teams array. + properties: + ms_channel_id: + description: Microsoft Teams channel ID. + example: 19:abc00abcdef00a0abcdef0abcdef0a@thread.tacv2 + type: string + ms_channel_name: + description: Microsoft Teams channel name. + example: incident-0001-example + type: string + ms_tenant_id: + description: Microsoft Teams tenant ID. + example: 00000000-abcd-0005-0000-000000000000 + type: string + redirect_url: + description: URL redirecting to the Microsoft Teams channel. + example: https://teams.microsoft.com/l/channel/19%3Aabc00abcdef00a0abcdef0abcdef0a%40thread.tacv2/conversations?groupId=12345678-abcd-dcba-abcd-1234567890ab&tenantId=00000000-abcd-0005-0000-000000000000 + type: string + required: + - ms_tenant_id + - ms_channel_id + - ms_channel_name + - redirect_url + type: object Metric: description: Object for a single metric tag configuration. example: diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentIntegrationMetadataMetadata.java b/src/main/java/com/datadog/api/client/v2/model/IncidentIntegrationMetadataMetadata.java index 8d11c7dcde5..3c1a1a9b763 100644 --- a/src/main/java/com/datadog/api/client/v2/model/IncidentIntegrationMetadataMetadata.java +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentIntegrationMetadataMetadata.java @@ -175,6 +175,51 @@ public IncidentIntegrationMetadataMetadata deserialize( log.log(Level.FINER, "Input data does not match schema 'JiraIntegrationMetadata'", e); } + // deserialize MSTeamsIntegrationMetadata + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (MSTeamsIntegrationMetadata.class.equals(Integer.class) + || MSTeamsIntegrationMetadata.class.equals(Long.class) + || MSTeamsIntegrationMetadata.class.equals(Float.class) + || MSTeamsIntegrationMetadata.class.equals(Double.class) + || MSTeamsIntegrationMetadata.class.equals(Boolean.class) + || MSTeamsIntegrationMetadata.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((MSTeamsIntegrationMetadata.class.equals(Integer.class) + || MSTeamsIntegrationMetadata.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((MSTeamsIntegrationMetadata.class.equals(Float.class) + || MSTeamsIntegrationMetadata.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (MSTeamsIntegrationMetadata.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (MSTeamsIntegrationMetadata.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(MSTeamsIntegrationMetadata.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 (!((MSTeamsIntegrationMetadata) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'MSTeamsIntegrationMetadata'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'MSTeamsIntegrationMetadata'", e); + } + IncidentIntegrationMetadataMetadata ret = new IncidentIntegrationMetadataMetadata(); if (match == 1) { ret.setActualInstance(deserialized); @@ -215,9 +260,15 @@ public IncidentIntegrationMetadataMetadata(JiraIntegrationMetadata o) { setActualInstance(o); } + public IncidentIntegrationMetadataMetadata(MSTeamsIntegrationMetadata o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put("SlackIntegrationMetadata", new GenericType() {}); schemas.put("JiraIntegrationMetadata", new GenericType() {}); + schemas.put("MSTeamsIntegrationMetadata", new GenericType() {}); JSON.registerDescendants( IncidentIntegrationMetadataMetadata.class, Collections.unmodifiableMap(schemas)); } @@ -229,7 +280,8 @@ public Map getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: SlackIntegrationMetadata, JiraIntegrationMetadata + * against the oneOf child schemas: SlackIntegrationMetadata, JiraIntegrationMetadata, + * MSTeamsIntegrationMetadata * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -244,20 +296,26 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf(MSTeamsIntegrationMetadata.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } throw new RuntimeException( - "Invalid instance type. Must be SlackIntegrationMetadata, JiraIntegrationMetadata"); + "Invalid instance type. Must be SlackIntegrationMetadata, JiraIntegrationMetadata," + + " MSTeamsIntegrationMetadata"); } /** * Get the actual instance, which can be the following: SlackIntegrationMetadata, - * JiraIntegrationMetadata + * JiraIntegrationMetadata, MSTeamsIntegrationMetadata * - * @return The actual instance (SlackIntegrationMetadata, JiraIntegrationMetadata) + * @return The actual instance (SlackIntegrationMetadata, JiraIntegrationMetadata, + * MSTeamsIntegrationMetadata) */ @Override public Object getActualInstance() { @@ -285,4 +343,15 @@ public SlackIntegrationMetadata getSlackIntegrationMetadata() throws ClassCastEx public JiraIntegrationMetadata getJiraIntegrationMetadata() throws ClassCastException { return (JiraIntegrationMetadata) super.getActualInstance(); } + + /** + * Get the actual instance of `MSTeamsIntegrationMetadata`. If the actual instance is not + * `MSTeamsIntegrationMetadata`, the ClassCastException will be thrown. + * + * @return The actual instance of `MSTeamsIntegrationMetadata` + * @throws ClassCastException if the instance is not `MSTeamsIntegrationMetadata` + */ + public MSTeamsIntegrationMetadata getMSTeamsIntegrationMetadata() throws ClassCastException { + return (MSTeamsIntegrationMetadata) super.getActualInstance(); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/MSTeamsIntegrationMetadata.java b/src/main/java/com/datadog/api/client/v2/model/MSTeamsIntegrationMetadata.java new file mode 100644 index 00000000000..5af14379f50 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MSTeamsIntegrationMetadata.java @@ -0,0 +1,156 @@ +/* + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Incident integration metadata for the Microsoft Teams integration. */ +@JsonPropertyOrder({MSTeamsIntegrationMetadata.JSON_PROPERTY_TEAMS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MSTeamsIntegrationMetadata { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_TEAMS = "teams"; + private List teams = new ArrayList<>(); + + public MSTeamsIntegrationMetadata() {} + + @JsonCreator + public MSTeamsIntegrationMetadata( + @JsonProperty(required = true, value = JSON_PROPERTY_TEAMS) + List teams) { + this.teams = teams; + } + + public MSTeamsIntegrationMetadata teams(List teams) { + this.teams = teams; + for (MSTeamsIntegrationMetadataTeamsItem item : teams) { + this.unparsed |= item.unparsed; + } + return this; + } + + public MSTeamsIntegrationMetadata addTeamsItem(MSTeamsIntegrationMetadataTeamsItem teamsItem) { + this.teams.add(teamsItem); + this.unparsed |= teamsItem.unparsed; + return this; + } + + /** + * Array of Microsoft Teams in this integration metadata. + * + * @return teams + */ + @JsonProperty(JSON_PROPERTY_TEAMS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTeams() { + return teams; + } + + public void setTeams(List teams) { + this.teams = teams; + } + + /** + * 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 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 MSTeamsIntegrationMetadata + */ + @JsonAnySetter + public MSTeamsIntegrationMetadata putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map 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 MSTeamsIntegrationMetadata object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MSTeamsIntegrationMetadata msTeamsIntegrationMetadata = (MSTeamsIntegrationMetadata) o; + return Objects.equals(this.teams, msTeamsIntegrationMetadata.teams) + && Objects.equals( + this.additionalProperties, msTeamsIntegrationMetadata.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(teams, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MSTeamsIntegrationMetadata {\n"); + sb.append(" teams: ").append(toIndentedString(teams)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/MSTeamsIntegrationMetadataTeamsItem.java b/src/main/java/com/datadog/api/client/v2/model/MSTeamsIntegrationMetadataTeamsItem.java new file mode 100644 index 00000000000..a67fea4af82 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MSTeamsIntegrationMetadataTeamsItem.java @@ -0,0 +1,231 @@ +/* + * 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; + +/** Item in the Microsoft Teams integration metadata teams array. */ +@JsonPropertyOrder({ + MSTeamsIntegrationMetadataTeamsItem.JSON_PROPERTY_MS_CHANNEL_ID, + MSTeamsIntegrationMetadataTeamsItem.JSON_PROPERTY_MS_CHANNEL_NAME, + MSTeamsIntegrationMetadataTeamsItem.JSON_PROPERTY_MS_TENANT_ID, + MSTeamsIntegrationMetadataTeamsItem.JSON_PROPERTY_REDIRECT_URL +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MSTeamsIntegrationMetadataTeamsItem { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_MS_CHANNEL_ID = "ms_channel_id"; + private String msChannelId; + + public static final String JSON_PROPERTY_MS_CHANNEL_NAME = "ms_channel_name"; + private String msChannelName; + + public static final String JSON_PROPERTY_MS_TENANT_ID = "ms_tenant_id"; + private String msTenantId; + + public static final String JSON_PROPERTY_REDIRECT_URL = "redirect_url"; + private String redirectUrl; + + public MSTeamsIntegrationMetadataTeamsItem() {} + + @JsonCreator + public MSTeamsIntegrationMetadataTeamsItem( + @JsonProperty(required = true, value = JSON_PROPERTY_MS_CHANNEL_ID) String msChannelId, + @JsonProperty(required = true, value = JSON_PROPERTY_MS_CHANNEL_NAME) String msChannelName, + @JsonProperty(required = true, value = JSON_PROPERTY_MS_TENANT_ID) String msTenantId, + @JsonProperty(required = true, value = JSON_PROPERTY_REDIRECT_URL) String redirectUrl) { + this.msChannelId = msChannelId; + this.msChannelName = msChannelName; + this.msTenantId = msTenantId; + this.redirectUrl = redirectUrl; + } + + public MSTeamsIntegrationMetadataTeamsItem msChannelId(String msChannelId) { + this.msChannelId = msChannelId; + return this; + } + + /** + * Microsoft Teams channel ID. + * + * @return msChannelId + */ + @JsonProperty(JSON_PROPERTY_MS_CHANNEL_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getMsChannelId() { + return msChannelId; + } + + public void setMsChannelId(String msChannelId) { + this.msChannelId = msChannelId; + } + + public MSTeamsIntegrationMetadataTeamsItem msChannelName(String msChannelName) { + this.msChannelName = msChannelName; + return this; + } + + /** + * Microsoft Teams channel name. + * + * @return msChannelName + */ + @JsonProperty(JSON_PROPERTY_MS_CHANNEL_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getMsChannelName() { + return msChannelName; + } + + public void setMsChannelName(String msChannelName) { + this.msChannelName = msChannelName; + } + + public MSTeamsIntegrationMetadataTeamsItem msTenantId(String msTenantId) { + this.msTenantId = msTenantId; + return this; + } + + /** + * Microsoft Teams tenant ID. + * + * @return msTenantId + */ + @JsonProperty(JSON_PROPERTY_MS_TENANT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getMsTenantId() { + return msTenantId; + } + + public void setMsTenantId(String msTenantId) { + this.msTenantId = msTenantId; + } + + public MSTeamsIntegrationMetadataTeamsItem redirectUrl(String redirectUrl) { + this.redirectUrl = redirectUrl; + return this; + } + + /** + * URL redirecting to the Microsoft Teams channel. + * + * @return redirectUrl + */ + @JsonProperty(JSON_PROPERTY_REDIRECT_URL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getRedirectUrl() { + return redirectUrl; + } + + public void setRedirectUrl(String redirectUrl) { + this.redirectUrl = redirectUrl; + } + + /** + * 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 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 MSTeamsIntegrationMetadataTeamsItem + */ + @JsonAnySetter + public MSTeamsIntegrationMetadataTeamsItem putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map 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 MSTeamsIntegrationMetadataTeamsItem object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MSTeamsIntegrationMetadataTeamsItem msTeamsIntegrationMetadataTeamsItem = + (MSTeamsIntegrationMetadataTeamsItem) o; + return Objects.equals(this.msChannelId, msTeamsIntegrationMetadataTeamsItem.msChannelId) + && Objects.equals(this.msChannelName, msTeamsIntegrationMetadataTeamsItem.msChannelName) + && Objects.equals(this.msTenantId, msTeamsIntegrationMetadataTeamsItem.msTenantId) + && Objects.equals(this.redirectUrl, msTeamsIntegrationMetadataTeamsItem.redirectUrl) + && Objects.equals( + this.additionalProperties, msTeamsIntegrationMetadataTeamsItem.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(msChannelId, msChannelName, msTenantId, redirectUrl, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MSTeamsIntegrationMetadataTeamsItem {\n"); + sb.append(" msChannelId: ").append(toIndentedString(msChannelId)).append("\n"); + sb.append(" msChannelName: ").append(toIndentedString(msChannelName)).append("\n"); + sb.append(" msTenantId: ").append(toIndentedString(msTenantId)).append("\n"); + sb.append(" redirectUrl: ").append(toIndentedString(redirectUrl)).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 "); + } +}