From e636f3e70343d931b5c2a907872e7a5dde5f5d8c Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 18 Jul 2025 16:54:34 +0000 Subject: [PATCH] Regenerate client from commit 0f24b8e of spec repo --- .generated-info | 4 +- .generator/schemas/v2/openapi.yaml | 99 +++++++ .../v2/model/ActionConnectionIntegration.java | 75 ++++- .../ActionConnectionIntegrationUpdate.java | 77 ++++- .../api/client/v2/model/DatadogAPIKey.java | 265 ++++++++++++++++++ .../client/v2/model/DatadogAPIKeyType.java | 54 ++++ .../client/v2/model/DatadogAPIKeyUpdate.java | 262 +++++++++++++++++ .../client/v2/model/DatadogCredentials.java | 209 ++++++++++++++ .../v2/model/DatadogCredentialsUpdate.java | 212 ++++++++++++++ .../client/v2/model/DatadogIntegration.java | 181 ++++++++++++ .../v2/model/DatadogIntegrationType.java | 55 ++++ .../v2/model/DatadogIntegrationUpdate.java | 178 ++++++++++++ 12 files changed, 1661 insertions(+), 10 deletions(-) create mode 100644 src/main/java/com/datadog/api/client/v2/model/DatadogAPIKey.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DatadogAPIKeyType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DatadogAPIKeyUpdate.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DatadogCredentials.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DatadogCredentialsUpdate.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DatadogIntegration.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DatadogIntegrationType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DatadogIntegrationUpdate.java diff --git a/.generated-info b/.generated-info index e7fa87b6f54..ecdaabed89c 100644 --- a/.generated-info +++ b/.generated-info @@ -1,4 +1,4 @@ { - "spec_repo_commit": "dc49df4", - "generated": "2025-07-18 13:58:47.478" + "spec_repo_commit": "0f24b8e", + "generated": "2025-07-18 16:54:34.251" } diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 8f845b4f20d..5a4d2ba1227 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -2016,11 +2016,13 @@ components: description: The definition of `ActionConnectionIntegration` object. oneOf: - $ref: '#/components/schemas/AWSIntegration' + - $ref: '#/components/schemas/DatadogIntegration' - $ref: '#/components/schemas/HTTPIntegration' ActionConnectionIntegrationUpdate: description: The definition of `ActionConnectionIntegrationUpdate` object. oneOf: - $ref: '#/components/schemas/AWSIntegrationUpdate' + - $ref: '#/components/schemas/DatadogIntegrationUpdate' - $ref: '#/components/schemas/HTTPIntegrationUpdate' ActionQuery: description: An action query. This query type is used to trigger an action, @@ -12378,6 +12380,103 @@ components: required: - databaseMonitoringTrigger type: object + DatadogAPIKey: + description: The definition of the `DatadogAPIKey` object. + properties: + api_key: + description: The `DatadogAPIKey` `api_key`. + example: '' + type: string + app_key: + description: The `DatadogAPIKey` `app_key`. + example: '' + type: string + datacenter: + description: The `DatadogAPIKey` `datacenter`. + example: '' + type: string + subdomain: + description: Custom subdomain used for Datadog URLs generated with this + Connection. For example, if this org uses `https://acme.datadoghq.com` + to access Datadog, set this field to `acme`. If this field is omitted, + generated URLs will use the default site URL for its datacenter (see [https://docs.datadoghq.com/getting_started/site](https://docs.datadoghq.com/getting_started/site)). + type: string + type: + $ref: '#/components/schemas/DatadogAPIKeyType' + required: + - type + - datacenter + - api_key + - app_key + type: object + DatadogAPIKeyType: + description: The definition of the `DatadogAPIKey` object. + enum: + - DatadogAPIKey + example: DatadogAPIKey + type: string + x-enum-varnames: + - DATADOGAPIKEY + DatadogAPIKeyUpdate: + description: The definition of the `DatadogAPIKey` object. + properties: + api_key: + description: The `DatadogAPIKeyUpdate` `api_key`. + type: string + app_key: + description: The `DatadogAPIKeyUpdate` `app_key`. + type: string + datacenter: + description: The `DatadogAPIKeyUpdate` `datacenter`. + type: string + subdomain: + description: Custom subdomain used for Datadog URLs generated with this + Connection. For example, if this org uses `https://acme.datadoghq.com` + to access Datadog, set this field to `acme`. If this field is omitted, + generated URLs will use the default site URL for its datacenter (see [https://docs.datadoghq.com/getting_started/site](https://docs.datadoghq.com/getting_started/site)). + type: string + type: + $ref: '#/components/schemas/DatadogAPIKeyType' + required: + - type + type: object + DatadogCredentials: + description: The definition of the `DatadogCredentials` object. + oneOf: + - $ref: '#/components/schemas/DatadogAPIKey' + DatadogCredentialsUpdate: + description: The definition of the `DatadogCredentialsUpdate` object. + oneOf: + - $ref: '#/components/schemas/DatadogAPIKeyUpdate' + DatadogIntegration: + description: The definition of the `DatadogIntegration` object. + properties: + credentials: + $ref: '#/components/schemas/DatadogCredentials' + type: + $ref: '#/components/schemas/DatadogIntegrationType' + required: + - type + - credentials + type: object + DatadogIntegrationType: + description: The definition of the `DatadogIntegrationType` object. + enum: + - Datadog + example: Datadog + type: string + x-enum-varnames: + - DATADOG + DatadogIntegrationUpdate: + description: The definition of the `DatadogIntegrationUpdate` object. + properties: + credentials: + $ref: '#/components/schemas/DatadogCredentialsUpdate' + type: + $ref: '#/components/schemas/DatadogIntegrationType' + required: + - type + type: object Dataset: description: Dataset object. properties: diff --git a/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegration.java b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegration.java index c68f71d6cee..653b8632fd2 100644 --- a/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegration.java +++ b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegration.java @@ -124,6 +124,50 @@ public ActionConnectionIntegration deserialize(JsonParser jp, DeserializationCon log.log(Level.FINER, "Input data does not match schema 'AWSIntegration'", e); } + // deserialize DatadogIntegration + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (DatadogIntegration.class.equals(Integer.class) + || DatadogIntegration.class.equals(Long.class) + || DatadogIntegration.class.equals(Float.class) + || DatadogIntegration.class.equals(Double.class) + || DatadogIntegration.class.equals(Boolean.class) + || DatadogIntegration.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((DatadogIntegration.class.equals(Integer.class) + || DatadogIntegration.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((DatadogIntegration.class.equals(Float.class) + || DatadogIntegration.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (DatadogIntegration.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (DatadogIntegration.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(DatadogIntegration.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 (!((DatadogIntegration) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'DatadogIntegration'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'DatadogIntegration'", e); + } + // deserialize HTTPIntegration try { boolean attemptParsing = true; @@ -203,6 +247,11 @@ public ActionConnectionIntegration(AWSIntegration o) { setActualInstance(o); } + public ActionConnectionIntegration(DatadogIntegration o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + public ActionConnectionIntegration(HTTPIntegration o) { super("oneOf", Boolean.FALSE); setActualInstance(o); @@ -210,6 +259,7 @@ public ActionConnectionIntegration(HTTPIntegration o) { static { schemas.put("AWSIntegration", new GenericType() {}); + schemas.put("DatadogIntegration", new GenericType() {}); schemas.put("HTTPIntegration", new GenericType() {}); JSON.registerDescendants( ActionConnectionIntegration.class, Collections.unmodifiableMap(schemas)); @@ -222,7 +272,7 @@ public Map getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: AWSIntegration, HTTPIntegration + * against the oneOf child schemas: AWSIntegration, DatadogIntegration, HTTPIntegration * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -233,6 +283,10 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf(DatadogIntegration.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } if (JSON.isInstanceOf(HTTPIntegration.class, instance, new HashSet>())) { super.setActualInstance(instance); return; @@ -242,13 +296,15 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } - throw new RuntimeException("Invalid instance type. Must be AWSIntegration, HTTPIntegration"); + throw new RuntimeException( + "Invalid instance type. Must be AWSIntegration, DatadogIntegration, HTTPIntegration"); } /** - * Get the actual instance, which can be the following: AWSIntegration, HTTPIntegration + * Get the actual instance, which can be the following: AWSIntegration, DatadogIntegration, + * HTTPIntegration * - * @return The actual instance (AWSIntegration, HTTPIntegration) + * @return The actual instance (AWSIntegration, DatadogIntegration, HTTPIntegration) */ @Override public Object getActualInstance() { @@ -266,6 +322,17 @@ public AWSIntegration getAWSIntegration() throws ClassCastException { return (AWSIntegration) super.getActualInstance(); } + /** + * Get the actual instance of `DatadogIntegration`. If the actual instance is not + * `DatadogIntegration`, the ClassCastException will be thrown. + * + * @return The actual instance of `DatadogIntegration` + * @throws ClassCastException if the instance is not `DatadogIntegration` + */ + public DatadogIntegration getDatadogIntegration() throws ClassCastException { + return (DatadogIntegration) super.getActualInstance(); + } + /** * Get the actual instance of `HTTPIntegration`. If the actual instance is not `HTTPIntegration`, * the ClassCastException will be thrown. diff --git a/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegrationUpdate.java index 156bcae58b1..b4f67bb7da8 100644 --- a/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegrationUpdate.java +++ b/src/main/java/com/datadog/api/client/v2/model/ActionConnectionIntegrationUpdate.java @@ -128,6 +128,51 @@ public ActionConnectionIntegrationUpdate deserialize(JsonParser jp, Deserializat log.log(Level.FINER, "Input data does not match schema 'AWSIntegrationUpdate'", e); } + // deserialize DatadogIntegrationUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (DatadogIntegrationUpdate.class.equals(Integer.class) + || DatadogIntegrationUpdate.class.equals(Long.class) + || DatadogIntegrationUpdate.class.equals(Float.class) + || DatadogIntegrationUpdate.class.equals(Double.class) + || DatadogIntegrationUpdate.class.equals(Boolean.class) + || DatadogIntegrationUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((DatadogIntegrationUpdate.class.equals(Integer.class) + || DatadogIntegrationUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((DatadogIntegrationUpdate.class.equals(Float.class) + || DatadogIntegrationUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (DatadogIntegrationUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (DatadogIntegrationUpdate.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(DatadogIntegrationUpdate.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 (!((DatadogIntegrationUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'DatadogIntegrationUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'DatadogIntegrationUpdate'", e); + } + // deserialize HTTPIntegrationUpdate try { boolean attemptParsing = true; @@ -208,6 +253,11 @@ public ActionConnectionIntegrationUpdate(AWSIntegrationUpdate o) { setActualInstance(o); } + public ActionConnectionIntegrationUpdate(DatadogIntegrationUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + public ActionConnectionIntegrationUpdate(HTTPIntegrationUpdate o) { super("oneOf", Boolean.FALSE); setActualInstance(o); @@ -215,6 +265,7 @@ public ActionConnectionIntegrationUpdate(HTTPIntegrationUpdate o) { static { schemas.put("AWSIntegrationUpdate", new GenericType() {}); + schemas.put("DatadogIntegrationUpdate", new GenericType() {}); schemas.put("HTTPIntegrationUpdate", new GenericType() {}); JSON.registerDescendants( ActionConnectionIntegrationUpdate.class, Collections.unmodifiableMap(schemas)); @@ -227,7 +278,8 @@ public Map getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: AWSIntegrationUpdate, HTTPIntegrationUpdate + * against the oneOf child schemas: AWSIntegrationUpdate, DatadogIntegrationUpdate, + * HTTPIntegrationUpdate * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -238,6 +290,10 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf(DatadogIntegrationUpdate.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } if (JSON.isInstanceOf(HTTPIntegrationUpdate.class, instance, new HashSet>())) { super.setActualInstance(instance); return; @@ -248,14 +304,16 @@ public void setActualInstance(Object instance) { return; } throw new RuntimeException( - "Invalid instance type. Must be AWSIntegrationUpdate, HTTPIntegrationUpdate"); + "Invalid instance type. Must be AWSIntegrationUpdate, DatadogIntegrationUpdate," + + " HTTPIntegrationUpdate"); } /** * Get the actual instance, which can be the following: AWSIntegrationUpdate, - * HTTPIntegrationUpdate + * DatadogIntegrationUpdate, HTTPIntegrationUpdate * - * @return The actual instance (AWSIntegrationUpdate, HTTPIntegrationUpdate) + * @return The actual instance (AWSIntegrationUpdate, DatadogIntegrationUpdate, + * HTTPIntegrationUpdate) */ @Override public Object getActualInstance() { @@ -273,6 +331,17 @@ public AWSIntegrationUpdate getAWSIntegrationUpdate() throws ClassCastException return (AWSIntegrationUpdate) super.getActualInstance(); } + /** + * Get the actual instance of `DatadogIntegrationUpdate`. If the actual instance is not + * `DatadogIntegrationUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `DatadogIntegrationUpdate` + * @throws ClassCastException if the instance is not `DatadogIntegrationUpdate` + */ + public DatadogIntegrationUpdate getDatadogIntegrationUpdate() throws ClassCastException { + return (DatadogIntegrationUpdate) super.getActualInstance(); + } + /** * Get the actual instance of `HTTPIntegrationUpdate`. If the actual instance is not * `HTTPIntegrationUpdate`, the ClassCastException will be thrown. diff --git a/src/main/java/com/datadog/api/client/v2/model/DatadogAPIKey.java b/src/main/java/com/datadog/api/client/v2/model/DatadogAPIKey.java new file mode 100644 index 00000000000..1b4058da461 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DatadogAPIKey.java @@ -0,0 +1,265 @@ +/* + * 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; + +/** The definition of the DatadogAPIKey object. */ +@JsonPropertyOrder({ + DatadogAPIKey.JSON_PROPERTY_API_KEY, + DatadogAPIKey.JSON_PROPERTY_APP_KEY, + DatadogAPIKey.JSON_PROPERTY_DATACENTER, + DatadogAPIKey.JSON_PROPERTY_SUBDOMAIN, + DatadogAPIKey.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DatadogAPIKey { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_KEY = "api_key"; + private String apiKey; + + public static final String JSON_PROPERTY_APP_KEY = "app_key"; + private String appKey; + + public static final String JSON_PROPERTY_DATACENTER = "datacenter"; + private String datacenter; + + public static final String JSON_PROPERTY_SUBDOMAIN = "subdomain"; + private String subdomain; + + public static final String JSON_PROPERTY_TYPE = "type"; + private DatadogAPIKeyType type; + + public DatadogAPIKey() {} + + @JsonCreator + public DatadogAPIKey( + @JsonProperty(required = true, value = JSON_PROPERTY_API_KEY) String apiKey, + @JsonProperty(required = true, value = JSON_PROPERTY_APP_KEY) String appKey, + @JsonProperty(required = true, value = JSON_PROPERTY_DATACENTER) String datacenter, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) DatadogAPIKeyType type) { + this.apiKey = apiKey; + this.appKey = appKey; + this.datacenter = datacenter; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public DatadogAPIKey apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The DatadogAPIKey api_key. + * + * @return apiKey + */ + @JsonProperty(JSON_PROPERTY_API_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public DatadogAPIKey appKey(String appKey) { + this.appKey = appKey; + return this; + } + + /** + * The DatadogAPIKey app_key. + * + * @return appKey + */ + @JsonProperty(JSON_PROPERTY_APP_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAppKey() { + return appKey; + } + + public void setAppKey(String appKey) { + this.appKey = appKey; + } + + public DatadogAPIKey datacenter(String datacenter) { + this.datacenter = datacenter; + return this; + } + + /** + * The DatadogAPIKey datacenter. + * + * @return datacenter + */ + @JsonProperty(JSON_PROPERTY_DATACENTER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDatacenter() { + return datacenter; + } + + public void setDatacenter(String datacenter) { + this.datacenter = datacenter; + } + + public DatadogAPIKey subdomain(String subdomain) { + this.subdomain = subdomain; + return this; + } + + /** + * Custom subdomain used for Datadog URLs generated with this Connection. For example, if this org + * uses https://acme.datadoghq.com to access Datadog, set this field to acme + * . If this field is omitted, generated URLs will use the default site URL for its + * datacenter (see https://docs.datadoghq.com/getting_started/site). + * + * @return subdomain + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SUBDOMAIN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSubdomain() { + return subdomain; + } + + public void setSubdomain(String subdomain) { + this.subdomain = subdomain; + } + + public DatadogAPIKey type(DatadogAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the DatadogAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DatadogAPIKeyType getType() { + return type; + } + + public void setType(DatadogAPIKeyType 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 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 DatadogAPIKey + */ + @JsonAnySetter + public DatadogAPIKey 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 DatadogAPIKey object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DatadogAPIKey datadogApiKey = (DatadogAPIKey) o; + return Objects.equals(this.apiKey, datadogApiKey.apiKey) + && Objects.equals(this.appKey, datadogApiKey.appKey) + && Objects.equals(this.datacenter, datadogApiKey.datacenter) + && Objects.equals(this.subdomain, datadogApiKey.subdomain) + && Objects.equals(this.type, datadogApiKey.type) + && Objects.equals(this.additionalProperties, datadogApiKey.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiKey, appKey, datacenter, subdomain, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DatadogAPIKey {\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" appKey: ").append(toIndentedString(appKey)).append("\n"); + sb.append(" datacenter: ").append(toIndentedString(datacenter)).append("\n"); + sb.append(" subdomain: ").append(toIndentedString(subdomain)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/DatadogAPIKeyType.java b/src/main/java/com/datadog/api/client/v2/model/DatadogAPIKeyType.java new file mode 100644 index 00000000000..a9ded19d05b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DatadogAPIKeyType.java @@ -0,0 +1,54 @@ +/* + * 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; + +/** The definition of the DatadogAPIKey object. */ +@JsonSerialize(using = DatadogAPIKeyType.DatadogAPIKeyTypeSerializer.class) +public class DatadogAPIKeyType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("DatadogAPIKey")); + + public static final DatadogAPIKeyType DATADOGAPIKEY = new DatadogAPIKeyType("DatadogAPIKey"); + + DatadogAPIKeyType(String value) { + super(value, allowedValues); + } + + public static class DatadogAPIKeyTypeSerializer extends StdSerializer { + public DatadogAPIKeyTypeSerializer(Class t) { + super(t); + } + + public DatadogAPIKeyTypeSerializer() { + this(null); + } + + @Override + public void serialize(DatadogAPIKeyType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static DatadogAPIKeyType fromValue(String value) { + return new DatadogAPIKeyType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/DatadogAPIKeyUpdate.java b/src/main/java/com/datadog/api/client/v2/model/DatadogAPIKeyUpdate.java new file mode 100644 index 00000000000..8a0ebe58f3d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DatadogAPIKeyUpdate.java @@ -0,0 +1,262 @@ +/* + * 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; + +/** The definition of the DatadogAPIKey object. */ +@JsonPropertyOrder({ + DatadogAPIKeyUpdate.JSON_PROPERTY_API_KEY, + DatadogAPIKeyUpdate.JSON_PROPERTY_APP_KEY, + DatadogAPIKeyUpdate.JSON_PROPERTY_DATACENTER, + DatadogAPIKeyUpdate.JSON_PROPERTY_SUBDOMAIN, + DatadogAPIKeyUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DatadogAPIKeyUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_API_KEY = "api_key"; + private String apiKey; + + public static final String JSON_PROPERTY_APP_KEY = "app_key"; + private String appKey; + + public static final String JSON_PROPERTY_DATACENTER = "datacenter"; + private String datacenter; + + public static final String JSON_PROPERTY_SUBDOMAIN = "subdomain"; + private String subdomain; + + public static final String JSON_PROPERTY_TYPE = "type"; + private DatadogAPIKeyType type; + + public DatadogAPIKeyUpdate() {} + + @JsonCreator + public DatadogAPIKeyUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) DatadogAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public DatadogAPIKeyUpdate apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The DatadogAPIKeyUpdate api_key. + * + * @return apiKey + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_API_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public DatadogAPIKeyUpdate appKey(String appKey) { + this.appKey = appKey; + return this; + } + + /** + * The DatadogAPIKeyUpdate app_key. + * + * @return appKey + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_APP_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAppKey() { + return appKey; + } + + public void setAppKey(String appKey) { + this.appKey = appKey; + } + + public DatadogAPIKeyUpdate datacenter(String datacenter) { + this.datacenter = datacenter; + return this; + } + + /** + * The DatadogAPIKeyUpdate datacenter. + * + * @return datacenter + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATACENTER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDatacenter() { + return datacenter; + } + + public void setDatacenter(String datacenter) { + this.datacenter = datacenter; + } + + public DatadogAPIKeyUpdate subdomain(String subdomain) { + this.subdomain = subdomain; + return this; + } + + /** + * Custom subdomain used for Datadog URLs generated with this Connection. For example, if this org + * uses https://acme.datadoghq.com to access Datadog, set this field to acme + * . If this field is omitted, generated URLs will use the default site URL for its + * datacenter (see https://docs.datadoghq.com/getting_started/site). + * + * @return subdomain + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SUBDOMAIN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getSubdomain() { + return subdomain; + } + + public void setSubdomain(String subdomain) { + this.subdomain = subdomain; + } + + public DatadogAPIKeyUpdate type(DatadogAPIKeyType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the DatadogAPIKey object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DatadogAPIKeyType getType() { + return type; + } + + public void setType(DatadogAPIKeyType 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 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 DatadogAPIKeyUpdate + */ + @JsonAnySetter + public DatadogAPIKeyUpdate 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 DatadogAPIKeyUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DatadogAPIKeyUpdate datadogApiKeyUpdate = (DatadogAPIKeyUpdate) o; + return Objects.equals(this.apiKey, datadogApiKeyUpdate.apiKey) + && Objects.equals(this.appKey, datadogApiKeyUpdate.appKey) + && Objects.equals(this.datacenter, datadogApiKeyUpdate.datacenter) + && Objects.equals(this.subdomain, datadogApiKeyUpdate.subdomain) + && Objects.equals(this.type, datadogApiKeyUpdate.type) + && Objects.equals(this.additionalProperties, datadogApiKeyUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiKey, appKey, datacenter, subdomain, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DatadogAPIKeyUpdate {\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" appKey: ").append(toIndentedString(appKey)).append("\n"); + sb.append(" datacenter: ").append(toIndentedString(datacenter)).append("\n"); + sb.append(" subdomain: ").append(toIndentedString(subdomain)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/DatadogCredentials.java b/src/main/java/com/datadog/api/client/v2/model/DatadogCredentials.java new file mode 100644 index 00000000000..9132ca33487 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DatadogCredentials.java @@ -0,0 +1,209 @@ +/* + * 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.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = DatadogCredentials.DatadogCredentialsDeserializer.class) +@JsonSerialize(using = DatadogCredentials.DatadogCredentialsSerializer.class) +public class DatadogCredentials extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(DatadogCredentials.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class DatadogCredentialsSerializer extends StdSerializer { + public DatadogCredentialsSerializer(Class t) { + super(t); + } + + public DatadogCredentialsSerializer() { + this(null); + } + + @Override + public void serialize(DatadogCredentials value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class DatadogCredentialsDeserializer extends StdDeserializer { + public DatadogCredentialsDeserializer() { + this(DatadogCredentials.class); + } + + public DatadogCredentialsDeserializer(Class vc) { + super(vc); + } + + @Override + public DatadogCredentials deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize DatadogAPIKey + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (DatadogAPIKey.class.equals(Integer.class) + || DatadogAPIKey.class.equals(Long.class) + || DatadogAPIKey.class.equals(Float.class) + || DatadogAPIKey.class.equals(Double.class) + || DatadogAPIKey.class.equals(Boolean.class) + || DatadogAPIKey.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((DatadogAPIKey.class.equals(Integer.class) + || DatadogAPIKey.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((DatadogAPIKey.class.equals(Float.class) + || DatadogAPIKey.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (DatadogAPIKey.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (DatadogAPIKey.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(DatadogAPIKey.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 (!((DatadogAPIKey) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'DatadogAPIKey'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'DatadogAPIKey'", e); + } + + DatadogCredentials ret = new DatadogCredentials(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public DatadogCredentials getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "DatadogCredentials cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public DatadogCredentials() { + super("oneOf", Boolean.FALSE); + } + + public DatadogCredentials(DatadogAPIKey o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("DatadogAPIKey", new GenericType() {}); + JSON.registerDescendants(DatadogCredentials.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return DatadogCredentials.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: DatadogAPIKey + * + *

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(DatadogAPIKey.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 DatadogAPIKey"); + } + + /** + * Get the actual instance, which can be the following: DatadogAPIKey + * + * @return The actual instance (DatadogAPIKey) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `DatadogAPIKey`. If the actual instance is not `DatadogAPIKey`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `DatadogAPIKey` + * @throws ClassCastException if the instance is not `DatadogAPIKey` + */ + public DatadogAPIKey getDatadogAPIKey() throws ClassCastException { + return (DatadogAPIKey) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/DatadogCredentialsUpdate.java b/src/main/java/com/datadog/api/client/v2/model/DatadogCredentialsUpdate.java new file mode 100644 index 00000000000..a2c17c33a2b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DatadogCredentialsUpdate.java @@ -0,0 +1,212 @@ +/* + * 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.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize(using = DatadogCredentialsUpdate.DatadogCredentialsUpdateDeserializer.class) +@JsonSerialize(using = DatadogCredentialsUpdate.DatadogCredentialsUpdateSerializer.class) +public class DatadogCredentialsUpdate extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(DatadogCredentialsUpdate.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class DatadogCredentialsUpdateSerializer + extends StdSerializer { + public DatadogCredentialsUpdateSerializer(Class t) { + super(t); + } + + public DatadogCredentialsUpdateSerializer() { + this(null); + } + + @Override + public void serialize( + DatadogCredentialsUpdate value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class DatadogCredentialsUpdateDeserializer + extends StdDeserializer { + public DatadogCredentialsUpdateDeserializer() { + this(DatadogCredentialsUpdate.class); + } + + public DatadogCredentialsUpdateDeserializer(Class vc) { + super(vc); + } + + @Override + public DatadogCredentialsUpdate deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize DatadogAPIKeyUpdate + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (DatadogAPIKeyUpdate.class.equals(Integer.class) + || DatadogAPIKeyUpdate.class.equals(Long.class) + || DatadogAPIKeyUpdate.class.equals(Float.class) + || DatadogAPIKeyUpdate.class.equals(Double.class) + || DatadogAPIKeyUpdate.class.equals(Boolean.class) + || DatadogAPIKeyUpdate.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((DatadogAPIKeyUpdate.class.equals(Integer.class) + || DatadogAPIKeyUpdate.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((DatadogAPIKeyUpdate.class.equals(Float.class) + || DatadogAPIKeyUpdate.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (DatadogAPIKeyUpdate.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (DatadogAPIKeyUpdate.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(DatadogAPIKeyUpdate.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 (!((DatadogAPIKeyUpdate) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'DatadogAPIKeyUpdate'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'DatadogAPIKeyUpdate'", e); + } + + DatadogCredentialsUpdate ret = new DatadogCredentialsUpdate(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public DatadogCredentialsUpdate getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "DatadogCredentialsUpdate cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public DatadogCredentialsUpdate() { + super("oneOf", Boolean.FALSE); + } + + public DatadogCredentialsUpdate(DatadogAPIKeyUpdate o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("DatadogAPIKeyUpdate", new GenericType() {}); + JSON.registerDescendants(DatadogCredentialsUpdate.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return DatadogCredentialsUpdate.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: DatadogAPIKeyUpdate + * + *

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(DatadogAPIKeyUpdate.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 DatadogAPIKeyUpdate"); + } + + /** + * Get the actual instance, which can be the following: DatadogAPIKeyUpdate + * + * @return The actual instance (DatadogAPIKeyUpdate) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `DatadogAPIKeyUpdate`. If the actual instance is not + * `DatadogAPIKeyUpdate`, the ClassCastException will be thrown. + * + * @return The actual instance of `DatadogAPIKeyUpdate` + * @throws ClassCastException if the instance is not `DatadogAPIKeyUpdate` + */ + public DatadogAPIKeyUpdate getDatadogAPIKeyUpdate() throws ClassCastException { + return (DatadogAPIKeyUpdate) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/DatadogIntegration.java b/src/main/java/com/datadog/api/client/v2/model/DatadogIntegration.java new file mode 100644 index 00000000000..a13a6eff674 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DatadogIntegration.java @@ -0,0 +1,181 @@ +/* + * 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; + +/** The definition of the DatadogIntegration object. */ +@JsonPropertyOrder({ + DatadogIntegration.JSON_PROPERTY_CREDENTIALS, + DatadogIntegration.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DatadogIntegration { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private DatadogCredentials credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private DatadogIntegrationType type; + + public DatadogIntegration() {} + + @JsonCreator + public DatadogIntegration( + @JsonProperty(required = true, value = JSON_PROPERTY_CREDENTIALS) + DatadogCredentials credentials, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) DatadogIntegrationType type) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public DatadogIntegration credentials(DatadogCredentials credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the DatadogCredentials object. + * + * @return credentials + */ + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DatadogCredentials getCredentials() { + return credentials; + } + + public void setCredentials(DatadogCredentials credentials) { + this.credentials = credentials; + } + + public DatadogIntegration type(DatadogIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the DatadogIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DatadogIntegrationType getType() { + return type; + } + + public void setType(DatadogIntegrationType 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 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 DatadogIntegration + */ + @JsonAnySetter + public DatadogIntegration 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 DatadogIntegration object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DatadogIntegration datadogIntegration = (DatadogIntegration) o; + return Objects.equals(this.credentials, datadogIntegration.credentials) + && Objects.equals(this.type, datadogIntegration.type) + && Objects.equals(this.additionalProperties, datadogIntegration.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DatadogIntegration {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).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 "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/DatadogIntegrationType.java b/src/main/java/com/datadog/api/client/v2/model/DatadogIntegrationType.java new file mode 100644 index 00000000000..eb3d8bff362 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DatadogIntegrationType.java @@ -0,0 +1,55 @@ +/* + * 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; + +/** The definition of the DatadogIntegrationType object. */ +@JsonSerialize(using = DatadogIntegrationType.DatadogIntegrationTypeSerializer.class) +public class DatadogIntegrationType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("Datadog")); + + public static final DatadogIntegrationType DATADOG = new DatadogIntegrationType("Datadog"); + + DatadogIntegrationType(String value) { + super(value, allowedValues); + } + + public static class DatadogIntegrationTypeSerializer + extends StdSerializer { + public DatadogIntegrationTypeSerializer(Class t) { + super(t); + } + + public DatadogIntegrationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + DatadogIntegrationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static DatadogIntegrationType fromValue(String value) { + return new DatadogIntegrationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/DatadogIntegrationUpdate.java b/src/main/java/com/datadog/api/client/v2/model/DatadogIntegrationUpdate.java new file mode 100644 index 00000000000..043565d35ff --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DatadogIntegrationUpdate.java @@ -0,0 +1,178 @@ +/* + * 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; + +/** The definition of the DatadogIntegrationUpdate object. */ +@JsonPropertyOrder({ + DatadogIntegrationUpdate.JSON_PROPERTY_CREDENTIALS, + DatadogIntegrationUpdate.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DatadogIntegrationUpdate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREDENTIALS = "credentials"; + private DatadogCredentialsUpdate credentials; + + public static final String JSON_PROPERTY_TYPE = "type"; + private DatadogIntegrationType type; + + public DatadogIntegrationUpdate() {} + + @JsonCreator + public DatadogIntegrationUpdate( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) DatadogIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public DatadogIntegrationUpdate credentials(DatadogCredentialsUpdate credentials) { + this.credentials = credentials; + this.unparsed |= credentials.unparsed; + return this; + } + + /** + * The definition of the DatadogCredentialsUpdate object. + * + * @return credentials + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREDENTIALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public DatadogCredentialsUpdate getCredentials() { + return credentials; + } + + public void setCredentials(DatadogCredentialsUpdate credentials) { + this.credentials = credentials; + } + + public DatadogIntegrationUpdate type(DatadogIntegrationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of the DatadogIntegrationType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DatadogIntegrationType getType() { + return type; + } + + public void setType(DatadogIntegrationType 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 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 DatadogIntegrationUpdate + */ + @JsonAnySetter + public DatadogIntegrationUpdate 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 DatadogIntegrationUpdate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DatadogIntegrationUpdate datadogIntegrationUpdate = (DatadogIntegrationUpdate) o; + return Objects.equals(this.credentials, datadogIntegrationUpdate.credentials) + && Objects.equals(this.type, datadogIntegrationUpdate.type) + && Objects.equals(this.additionalProperties, datadogIntegrationUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentials, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DatadogIntegrationUpdate {\n"); + sb.append(" credentials: ").append(toIndentedString(credentials)).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 "); + } +}