From 9995a37a41eec7abffb2277f8fc85f7b39729ee3 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 4 Jun 2026 17:48:51 +0000 Subject: [PATCH] Regenerate client from commit 94cb0f4 of spec repo --- .generator/schemas/v1/openapi.yaml | 73 ++++ .../client/v1/model/SyntheticsBasicAuth.java | 74 +++- .../v1/model/SyntheticsBasicAuthJWT.java | 360 ++++++++++++++++++ .../SyntheticsBasicAuthJWTAddClaims.java | 166 ++++++++ .../SyntheticsBasicAuthJWTAlgorithm.java | 62 +++ .../v1/model/SyntheticsBasicAuthJWTType.java | 55 +++ 6 files changed, 786 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/datadog/api/client/v1/model/SyntheticsBasicAuthJWT.java create mode 100644 src/main/java/com/datadog/api/client/v1/model/SyntheticsBasicAuthJWTAddClaims.java create mode 100644 src/main/java/com/datadog/api/client/v1/model/SyntheticsBasicAuthJWTAlgorithm.java create mode 100644 src/main/java/com/datadog/api/client/v1/model/SyntheticsBasicAuthJWTType.java diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 82c52ea77c7..01533da0481 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -17287,6 +17287,7 @@ components: - $ref: "#/components/schemas/SyntheticsBasicAuthDigest" - $ref: "#/components/schemas/SyntheticsBasicAuthOauthClient" - $ref: "#/components/schemas/SyntheticsBasicAuthOauthROP" + - $ref: "#/components/schemas/SyntheticsBasicAuthJWT" SyntheticsBasicAuthDigest: description: Object to handle digest authentication when performing the test. properties: @@ -17314,6 +17315,78 @@ components: type: string x-enum-varnames: - DIGEST + SyntheticsBasicAuthJWT: + description: Object to handle JWT authentication when performing the test. + properties: + addClaims: + $ref: "#/components/schemas/SyntheticsBasicAuthJWTAddClaims" + algorithm: + $ref: "#/components/schemas/SyntheticsBasicAuthJWTAlgorithm" + expiresIn: + description: Token time-to-live in seconds. + example: 3600 + format: int64 + minimum: 1 + type: integer + header: + description: Custom JWT header as a JSON string. + example: '{"kid": "my-key-id"}' + type: string + payload: + description: JWT claims as a JSON string. + example: '{"sub": "1234567890", "name": "John Doe"}' + type: string + secret: + description: |- + Signing key for the JWT authentication. Use the shared secret for `HS256` + or the private key (PEM format) for `RS256` and `ES256`. + example: "mysecretkey" + type: string + tokenPrefix: + description: Prefix added before the token in the `Authorization` header. Defaults to `Bearer`. + example: "Bearer" + type: string + type: + $ref: "#/components/schemas/SyntheticsBasicAuthJWTType" + required: + - algorithm + - payload + - secret + - type + type: object + SyntheticsBasicAuthJWTAddClaims: + description: Standard JWT claims to automatically inject. + properties: + exp: + description: Whether to inject the `exp` (expiration) claim. + example: true + type: boolean + iat: + description: Whether to inject the `iat` (issued at) claim. + example: true + type: boolean + type: object + SyntheticsBasicAuthJWTAlgorithm: + description: Algorithm to use for the JWT authentication. + enum: + - HS256 + - RS256 + - ES256 + example: "HS256" + type: string + x-enum-varnames: + - HS256 + - RS256 + - ES256 + SyntheticsBasicAuthJWTType: + default: "jwt" + description: The type of authentication to use when performing the test. + enum: + - jwt + example: "jwt" + type: string + x-enum-varnames: + - JWT SyntheticsBasicAuthNTLM: description: Object to handle `NTLM` authentication when performing the test. properties: diff --git a/src/main/java/com/datadog/api/client/v1/model/SyntheticsBasicAuth.java b/src/main/java/com/datadog/api/client/v1/model/SyntheticsBasicAuth.java index 8b3e4f6a80f..ff5909d887e 100644 --- a/src/main/java/com/datadog/api/client/v1/model/SyntheticsBasicAuth.java +++ b/src/main/java/com/datadog/api/client/v1/model/SyntheticsBasicAuth.java @@ -349,6 +349,51 @@ public SyntheticsBasicAuth deserialize(JsonParser jp, DeserializationContext ctx log.log(Level.FINER, "Input data does not match schema 'SyntheticsBasicAuthOauthROP'", e); } + // deserialize SyntheticsBasicAuthJWT + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (SyntheticsBasicAuthJWT.class.equals(Integer.class) + || SyntheticsBasicAuthJWT.class.equals(Long.class) + || SyntheticsBasicAuthJWT.class.equals(Float.class) + || SyntheticsBasicAuthJWT.class.equals(Double.class) + || SyntheticsBasicAuthJWT.class.equals(Boolean.class) + || SyntheticsBasicAuthJWT.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((SyntheticsBasicAuthJWT.class.equals(Integer.class) + || SyntheticsBasicAuthJWT.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((SyntheticsBasicAuthJWT.class.equals(Float.class) + || SyntheticsBasicAuthJWT.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (SyntheticsBasicAuthJWT.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (SyntheticsBasicAuthJWT.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(SyntheticsBasicAuthJWT.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 (!((SyntheticsBasicAuthJWT) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'SyntheticsBasicAuthJWT'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'SyntheticsBasicAuthJWT'", e); + } + SyntheticsBasicAuth ret = new SyntheticsBasicAuth(); if (match == 1) { ret.setActualInstance(deserialized); @@ -408,6 +453,11 @@ public SyntheticsBasicAuth(SyntheticsBasicAuthOauthROP o) { setActualInstance(o); } + public SyntheticsBasicAuth(SyntheticsBasicAuthJWT o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + static { schemas.put("SyntheticsBasicAuthWeb", new GenericType() {}); schemas.put("SyntheticsBasicAuthSigv4", new GenericType() {}); @@ -416,6 +466,7 @@ public SyntheticsBasicAuth(SyntheticsBasicAuthOauthROP o) { schemas.put( "SyntheticsBasicAuthOauthClient", new GenericType() {}); schemas.put("SyntheticsBasicAuthOauthROP", new GenericType() {}); + schemas.put("SyntheticsBasicAuthJWT", new GenericType() {}); JSON.registerDescendants(SyntheticsBasicAuth.class, Collections.unmodifiableMap(schemas)); } @@ -428,7 +479,7 @@ public Map getSchemas() { * Set the instance that matches the oneOf child schema, check the instance parameter is valid * against the oneOf child schemas: SyntheticsBasicAuthWeb, SyntheticsBasicAuthSigv4, * SyntheticsBasicAuthNTLM, SyntheticsBasicAuthDigest, SyntheticsBasicAuthOauthClient, - * SyntheticsBasicAuthOauthROP + * SyntheticsBasicAuthOauthROP, SyntheticsBasicAuthJWT * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -460,6 +511,10 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } + if (JSON.isInstanceOf(SyntheticsBasicAuthJWT.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { super.setActualInstance(instance); @@ -468,17 +523,17 @@ public void setActualInstance(Object instance) { throw new RuntimeException( "Invalid instance type. Must be SyntheticsBasicAuthWeb, SyntheticsBasicAuthSigv4," + " SyntheticsBasicAuthNTLM, SyntheticsBasicAuthDigest, SyntheticsBasicAuthOauthClient," - + " SyntheticsBasicAuthOauthROP"); + + " SyntheticsBasicAuthOauthROP, SyntheticsBasicAuthJWT"); } /** * Get the actual instance, which can be the following: SyntheticsBasicAuthWeb, * SyntheticsBasicAuthSigv4, SyntheticsBasicAuthNTLM, SyntheticsBasicAuthDigest, - * SyntheticsBasicAuthOauthClient, SyntheticsBasicAuthOauthROP + * SyntheticsBasicAuthOauthClient, SyntheticsBasicAuthOauthROP, SyntheticsBasicAuthJWT * * @return The actual instance (SyntheticsBasicAuthWeb, SyntheticsBasicAuthSigv4, * SyntheticsBasicAuthNTLM, SyntheticsBasicAuthDigest, SyntheticsBasicAuthOauthClient, - * SyntheticsBasicAuthOauthROP) + * SyntheticsBasicAuthOauthROP, SyntheticsBasicAuthJWT) */ @Override public Object getActualInstance() { @@ -551,4 +606,15 @@ public SyntheticsBasicAuthOauthClient getSyntheticsBasicAuthOauthClient() public SyntheticsBasicAuthOauthROP getSyntheticsBasicAuthOauthROP() throws ClassCastException { return (SyntheticsBasicAuthOauthROP) super.getActualInstance(); } + + /** + * Get the actual instance of `SyntheticsBasicAuthJWT`. If the actual instance is not + * `SyntheticsBasicAuthJWT`, the ClassCastException will be thrown. + * + * @return The actual instance of `SyntheticsBasicAuthJWT` + * @throws ClassCastException if the instance is not `SyntheticsBasicAuthJWT` + */ + public SyntheticsBasicAuthJWT getSyntheticsBasicAuthJWT() throws ClassCastException { + return (SyntheticsBasicAuthJWT) super.getActualInstance(); + } } diff --git a/src/main/java/com/datadog/api/client/v1/model/SyntheticsBasicAuthJWT.java b/src/main/java/com/datadog/api/client/v1/model/SyntheticsBasicAuthJWT.java new file mode 100644 index 00000000000..eb2f613efaa --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/SyntheticsBasicAuthJWT.java @@ -0,0 +1,360 @@ +/* + * 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.v1.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; + +/** Object to handle JWT authentication when performing the test. */ +@JsonPropertyOrder({ + SyntheticsBasicAuthJWT.JSON_PROPERTY_ADD_CLAIMS, + SyntheticsBasicAuthJWT.JSON_PROPERTY_ALGORITHM, + SyntheticsBasicAuthJWT.JSON_PROPERTY_EXPIRES_IN, + SyntheticsBasicAuthJWT.JSON_PROPERTY_HEADER, + SyntheticsBasicAuthJWT.JSON_PROPERTY_PAYLOAD, + SyntheticsBasicAuthJWT.JSON_PROPERTY_SECRET, + SyntheticsBasicAuthJWT.JSON_PROPERTY_TOKEN_PREFIX, + SyntheticsBasicAuthJWT.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SyntheticsBasicAuthJWT { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ADD_CLAIMS = "addClaims"; + private SyntheticsBasicAuthJWTAddClaims addClaims; + + public static final String JSON_PROPERTY_ALGORITHM = "algorithm"; + private SyntheticsBasicAuthJWTAlgorithm algorithm; + + public static final String JSON_PROPERTY_EXPIRES_IN = "expiresIn"; + private Long expiresIn; + + public static final String JSON_PROPERTY_HEADER = "header"; + private String header; + + public static final String JSON_PROPERTY_PAYLOAD = "payload"; + private String payload; + + public static final String JSON_PROPERTY_SECRET = "secret"; + private String secret; + + public static final String JSON_PROPERTY_TOKEN_PREFIX = "tokenPrefix"; + private String tokenPrefix; + + public static final String JSON_PROPERTY_TYPE = "type"; + private SyntheticsBasicAuthJWTType type = SyntheticsBasicAuthJWTType.JWT; + + public SyntheticsBasicAuthJWT() {} + + @JsonCreator + public SyntheticsBasicAuthJWT( + @JsonProperty(required = true, value = JSON_PROPERTY_ALGORITHM) + SyntheticsBasicAuthJWTAlgorithm algorithm, + @JsonProperty(required = true, value = JSON_PROPERTY_PAYLOAD) String payload, + @JsonProperty(required = true, value = JSON_PROPERTY_SECRET) String secret, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) SyntheticsBasicAuthJWTType type) { + this.algorithm = algorithm; + this.unparsed |= !algorithm.isValid(); + this.payload = payload; + this.secret = secret; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public SyntheticsBasicAuthJWT addClaims(SyntheticsBasicAuthJWTAddClaims addClaims) { + this.addClaims = addClaims; + this.unparsed |= addClaims.unparsed; + return this; + } + + /** + * Standard JWT claims to automatically inject. + * + * @return addClaims + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ADD_CLAIMS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public SyntheticsBasicAuthJWTAddClaims getAddClaims() { + return addClaims; + } + + public void setAddClaims(SyntheticsBasicAuthJWTAddClaims addClaims) { + this.addClaims = addClaims; + } + + public SyntheticsBasicAuthJWT algorithm(SyntheticsBasicAuthJWTAlgorithm algorithm) { + this.algorithm = algorithm; + this.unparsed |= !algorithm.isValid(); + return this; + } + + /** + * Algorithm to use for the JWT authentication. + * + * @return algorithm + */ + @JsonProperty(JSON_PROPERTY_ALGORITHM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SyntheticsBasicAuthJWTAlgorithm getAlgorithm() { + return algorithm; + } + + public void setAlgorithm(SyntheticsBasicAuthJWTAlgorithm algorithm) { + if (!algorithm.isValid()) { + this.unparsed = true; + } + this.algorithm = algorithm; + } + + public SyntheticsBasicAuthJWT expiresIn(Long expiresIn) { + this.expiresIn = expiresIn; + return this; + } + + /** + * Token time-to-live in seconds. minimum: 1 + * + * @return expiresIn + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EXPIRES_IN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getExpiresIn() { + return expiresIn; + } + + public void setExpiresIn(Long expiresIn) { + this.expiresIn = expiresIn; + } + + public SyntheticsBasicAuthJWT header(String header) { + this.header = header; + return this; + } + + /** + * Custom JWT header as a JSON string. + * + * @return header + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_HEADER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getHeader() { + return header; + } + + public void setHeader(String header) { + this.header = header; + } + + public SyntheticsBasicAuthJWT payload(String payload) { + this.payload = payload; + return this; + } + + /** + * JWT claims as a JSON string. + * + * @return payload + */ + @JsonProperty(JSON_PROPERTY_PAYLOAD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getPayload() { + return payload; + } + + public void setPayload(String payload) { + this.payload = payload; + } + + public SyntheticsBasicAuthJWT secret(String secret) { + this.secret = secret; + return this; + } + + /** + * Signing key for the JWT authentication. Use the shared secret for HS256 or the + * private key (PEM format) for RS256 and ES256. + * + * @return secret + */ + @JsonProperty(JSON_PROPERTY_SECRET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getSecret() { + return secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } + + public SyntheticsBasicAuthJWT tokenPrefix(String tokenPrefix) { + this.tokenPrefix = tokenPrefix; + return this; + } + + /** + * Prefix added before the token in the Authorization header. Defaults to + * Bearer. + * + * @return tokenPrefix + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TOKEN_PREFIX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTokenPrefix() { + return tokenPrefix; + } + + public void setTokenPrefix(String tokenPrefix) { + this.tokenPrefix = tokenPrefix; + } + + public SyntheticsBasicAuthJWT type(SyntheticsBasicAuthJWTType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of authentication to use when performing the test. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public SyntheticsBasicAuthJWTType getType() { + return type; + } + + public void setType(SyntheticsBasicAuthJWTType 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 SyntheticsBasicAuthJWT + */ + @JsonAnySetter + public SyntheticsBasicAuthJWT 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 SyntheticsBasicAuthJWT object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SyntheticsBasicAuthJWT syntheticsBasicAuthJwt = (SyntheticsBasicAuthJWT) o; + return Objects.equals(this.addClaims, syntheticsBasicAuthJwt.addClaims) + && Objects.equals(this.algorithm, syntheticsBasicAuthJwt.algorithm) + && Objects.equals(this.expiresIn, syntheticsBasicAuthJwt.expiresIn) + && Objects.equals(this.header, syntheticsBasicAuthJwt.header) + && Objects.equals(this.payload, syntheticsBasicAuthJwt.payload) + && Objects.equals(this.secret, syntheticsBasicAuthJwt.secret) + && Objects.equals(this.tokenPrefix, syntheticsBasicAuthJwt.tokenPrefix) + && Objects.equals(this.type, syntheticsBasicAuthJwt.type) + && Objects.equals(this.additionalProperties, syntheticsBasicAuthJwt.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + addClaims, + algorithm, + expiresIn, + header, + payload, + secret, + tokenPrefix, + type, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SyntheticsBasicAuthJWT {\n"); + sb.append(" addClaims: ").append(toIndentedString(addClaims)).append("\n"); + sb.append(" algorithm: ").append(toIndentedString(algorithm)).append("\n"); + sb.append(" expiresIn: ").append(toIndentedString(expiresIn)).append("\n"); + sb.append(" header: ").append(toIndentedString(header)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append(" secret: ").append(toIndentedString(secret)).append("\n"); + sb.append(" tokenPrefix: ").append(toIndentedString(tokenPrefix)).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/v1/model/SyntheticsBasicAuthJWTAddClaims.java b/src/main/java/com/datadog/api/client/v1/model/SyntheticsBasicAuthJWTAddClaims.java new file mode 100644 index 00000000000..acadcd893f0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/SyntheticsBasicAuthJWTAddClaims.java @@ -0,0 +1,166 @@ +/* + * 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.v1.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +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; + +/** Standard JWT claims to automatically inject. */ +@JsonPropertyOrder({ + SyntheticsBasicAuthJWTAddClaims.JSON_PROPERTY_EXP, + SyntheticsBasicAuthJWTAddClaims.JSON_PROPERTY_IAT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SyntheticsBasicAuthJWTAddClaims { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_EXP = "exp"; + private Boolean exp; + + public static final String JSON_PROPERTY_IAT = "iat"; + private Boolean iat; + + public SyntheticsBasicAuthJWTAddClaims exp(Boolean exp) { + this.exp = exp; + return this; + } + + /** + * Whether to inject the exp (expiration) claim. + * + * @return exp + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EXP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getExp() { + return exp; + } + + public void setExp(Boolean exp) { + this.exp = exp; + } + + public SyntheticsBasicAuthJWTAddClaims iat(Boolean iat) { + this.iat = iat; + return this; + } + + /** + * Whether to inject the iat (issued at) claim. + * + * @return iat + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_IAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getIat() { + return iat; + } + + public void setIat(Boolean iat) { + this.iat = iat; + } + + /** + * 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 SyntheticsBasicAuthJWTAddClaims + */ + @JsonAnySetter + public SyntheticsBasicAuthJWTAddClaims 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 SyntheticsBasicAuthJWTAddClaims object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SyntheticsBasicAuthJWTAddClaims syntheticsBasicAuthJwtAddClaims = + (SyntheticsBasicAuthJWTAddClaims) o; + return Objects.equals(this.exp, syntheticsBasicAuthJwtAddClaims.exp) + && Objects.equals(this.iat, syntheticsBasicAuthJwtAddClaims.iat) + && Objects.equals( + this.additionalProperties, syntheticsBasicAuthJwtAddClaims.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(exp, iat, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SyntheticsBasicAuthJWTAddClaims {\n"); + sb.append(" exp: ").append(toIndentedString(exp)).append("\n"); + sb.append(" iat: ").append(toIndentedString(iat)).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/v1/model/SyntheticsBasicAuthJWTAlgorithm.java b/src/main/java/com/datadog/api/client/v1/model/SyntheticsBasicAuthJWTAlgorithm.java new file mode 100644 index 00000000000..11af0c4f405 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/SyntheticsBasicAuthJWTAlgorithm.java @@ -0,0 +1,62 @@ +/* + * 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.v1.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; + +/** Algorithm to use for the JWT authentication. */ +@JsonSerialize( + using = SyntheticsBasicAuthJWTAlgorithm.SyntheticsBasicAuthJWTAlgorithmSerializer.class) +public class SyntheticsBasicAuthJWTAlgorithm extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("HS256", "RS256", "ES256")); + + public static final SyntheticsBasicAuthJWTAlgorithm HS256 = + new SyntheticsBasicAuthJWTAlgorithm("HS256"); + public static final SyntheticsBasicAuthJWTAlgorithm RS256 = + new SyntheticsBasicAuthJWTAlgorithm("RS256"); + public static final SyntheticsBasicAuthJWTAlgorithm ES256 = + new SyntheticsBasicAuthJWTAlgorithm("ES256"); + + SyntheticsBasicAuthJWTAlgorithm(String value) { + super(value, allowedValues); + } + + public static class SyntheticsBasicAuthJWTAlgorithmSerializer + extends StdSerializer { + public SyntheticsBasicAuthJWTAlgorithmSerializer(Class t) { + super(t); + } + + public SyntheticsBasicAuthJWTAlgorithmSerializer() { + this(null); + } + + @Override + public void serialize( + SyntheticsBasicAuthJWTAlgorithm value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SyntheticsBasicAuthJWTAlgorithm fromValue(String value) { + return new SyntheticsBasicAuthJWTAlgorithm(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v1/model/SyntheticsBasicAuthJWTType.java b/src/main/java/com/datadog/api/client/v1/model/SyntheticsBasicAuthJWTType.java new file mode 100644 index 00000000000..aaf8a72f0a2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v1/model/SyntheticsBasicAuthJWTType.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.v1.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 type of authentication to use when performing the test. */ +@JsonSerialize(using = SyntheticsBasicAuthJWTType.SyntheticsBasicAuthJWTTypeSerializer.class) +public class SyntheticsBasicAuthJWTType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("jwt")); + + public static final SyntheticsBasicAuthJWTType JWT = new SyntheticsBasicAuthJWTType("jwt"); + + SyntheticsBasicAuthJWTType(String value) { + super(value, allowedValues); + } + + public static class SyntheticsBasicAuthJWTTypeSerializer + extends StdSerializer { + public SyntheticsBasicAuthJWTTypeSerializer(Class t) { + super(t); + } + + public SyntheticsBasicAuthJWTTypeSerializer() { + this(null); + } + + @Override + public void serialize( + SyntheticsBasicAuthJWTType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static SyntheticsBasicAuthJWTType fromValue(String value) { + return new SyntheticsBasicAuthJWTType(value); + } +}