Skip to content

Commit 17f4160

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 94cb0f4 of spec repo (#3958)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 9e1cb5a commit 17f4160

6 files changed

Lines changed: 786 additions & 4 deletions

File tree

.generator/schemas/v1/openapi.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17308,6 +17308,7 @@ components:
1730817308
- $ref: "#/components/schemas/SyntheticsBasicAuthDigest"
1730917309
- $ref: "#/components/schemas/SyntheticsBasicAuthOauthClient"
1731017310
- $ref: "#/components/schemas/SyntheticsBasicAuthOauthROP"
17311+
- $ref: "#/components/schemas/SyntheticsBasicAuthJWT"
1731117312
SyntheticsBasicAuthDigest:
1731217313
description: Object to handle digest authentication when performing the test.
1731317314
properties:
@@ -17335,6 +17336,78 @@ components:
1733517336
type: string
1733617337
x-enum-varnames:
1733717338
- DIGEST
17339+
SyntheticsBasicAuthJWT:
17340+
description: Object to handle JWT authentication when performing the test.
17341+
properties:
17342+
addClaims:
17343+
$ref: "#/components/schemas/SyntheticsBasicAuthJWTAddClaims"
17344+
algorithm:
17345+
$ref: "#/components/schemas/SyntheticsBasicAuthJWTAlgorithm"
17346+
expiresIn:
17347+
description: Token time-to-live in seconds.
17348+
example: 3600
17349+
format: int64
17350+
minimum: 1
17351+
type: integer
17352+
header:
17353+
description: Custom JWT header as a JSON string.
17354+
example: '{"kid": "my-key-id"}'
17355+
type: string
17356+
payload:
17357+
description: JWT claims as a JSON string.
17358+
example: '{"sub": "1234567890", "name": "John Doe"}'
17359+
type: string
17360+
secret:
17361+
description: |-
17362+
Signing key for the JWT authentication. Use the shared secret for `HS256`
17363+
or the private key (PEM format) for `RS256` and `ES256`.
17364+
example: "mysecretkey"
17365+
type: string
17366+
tokenPrefix:
17367+
description: Prefix added before the token in the `Authorization` header. Defaults to `Bearer`.
17368+
example: "Bearer"
17369+
type: string
17370+
type:
17371+
$ref: "#/components/schemas/SyntheticsBasicAuthJWTType"
17372+
required:
17373+
- algorithm
17374+
- payload
17375+
- secret
17376+
- type
17377+
type: object
17378+
SyntheticsBasicAuthJWTAddClaims:
17379+
description: Standard JWT claims to automatically inject.
17380+
properties:
17381+
exp:
17382+
description: Whether to inject the `exp` (expiration) claim.
17383+
example: true
17384+
type: boolean
17385+
iat:
17386+
description: Whether to inject the `iat` (issued at) claim.
17387+
example: true
17388+
type: boolean
17389+
type: object
17390+
SyntheticsBasicAuthJWTAlgorithm:
17391+
description: Algorithm to use for the JWT authentication.
17392+
enum:
17393+
- HS256
17394+
- RS256
17395+
- ES256
17396+
example: "HS256"
17397+
type: string
17398+
x-enum-varnames:
17399+
- HS256
17400+
- RS256
17401+
- ES256
17402+
SyntheticsBasicAuthJWTType:
17403+
default: "jwt"
17404+
description: The type of authentication to use when performing the test.
17405+
enum:
17406+
- jwt
17407+
example: "jwt"
17408+
type: string
17409+
x-enum-varnames:
17410+
- JWT
1733817411
SyntheticsBasicAuthNTLM:
1733917412
description: Object to handle `NTLM` authentication when performing the test.
1734017413
properties:

src/main/java/com/datadog/api/client/v1/model/SyntheticsBasicAuth.java

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,51 @@ public SyntheticsBasicAuth deserialize(JsonParser jp, DeserializationContext ctx
349349
log.log(Level.FINER, "Input data does not match schema 'SyntheticsBasicAuthOauthROP'", e);
350350
}
351351

352+
// deserialize SyntheticsBasicAuthJWT
353+
try {
354+
boolean attemptParsing = true;
355+
// ensure that we respect type coercion as set on the client ObjectMapper
356+
if (SyntheticsBasicAuthJWT.class.equals(Integer.class)
357+
|| SyntheticsBasicAuthJWT.class.equals(Long.class)
358+
|| SyntheticsBasicAuthJWT.class.equals(Float.class)
359+
|| SyntheticsBasicAuthJWT.class.equals(Double.class)
360+
|| SyntheticsBasicAuthJWT.class.equals(Boolean.class)
361+
|| SyntheticsBasicAuthJWT.class.equals(String.class)) {
362+
attemptParsing = typeCoercion;
363+
if (!attemptParsing) {
364+
attemptParsing |=
365+
((SyntheticsBasicAuthJWT.class.equals(Integer.class)
366+
|| SyntheticsBasicAuthJWT.class.equals(Long.class))
367+
&& token == JsonToken.VALUE_NUMBER_INT);
368+
attemptParsing |=
369+
((SyntheticsBasicAuthJWT.class.equals(Float.class)
370+
|| SyntheticsBasicAuthJWT.class.equals(Double.class))
371+
&& (token == JsonToken.VALUE_NUMBER_FLOAT
372+
|| token == JsonToken.VALUE_NUMBER_INT));
373+
attemptParsing |=
374+
(SyntheticsBasicAuthJWT.class.equals(Boolean.class)
375+
&& (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
376+
attemptParsing |=
377+
(SyntheticsBasicAuthJWT.class.equals(String.class)
378+
&& token == JsonToken.VALUE_STRING);
379+
}
380+
}
381+
if (attemptParsing) {
382+
tmp = tree.traverse(jp.getCodec()).readValueAs(SyntheticsBasicAuthJWT.class);
383+
// TODO: there is no validation against JSON schema constraints
384+
// (min, max, enum, pattern...), this does not perform a strict JSON
385+
// validation, which means the 'match' count may be higher than it should be.
386+
if (!((SyntheticsBasicAuthJWT) tmp).unparsed) {
387+
deserialized = tmp;
388+
match++;
389+
}
390+
log.log(Level.FINER, "Input data matches schema 'SyntheticsBasicAuthJWT'");
391+
}
392+
} catch (Exception e) {
393+
// deserialization failed, continue
394+
log.log(Level.FINER, "Input data does not match schema 'SyntheticsBasicAuthJWT'", e);
395+
}
396+
352397
SyntheticsBasicAuth ret = new SyntheticsBasicAuth();
353398
if (match == 1) {
354399
ret.setActualInstance(deserialized);
@@ -408,6 +453,11 @@ public SyntheticsBasicAuth(SyntheticsBasicAuthOauthROP o) {
408453
setActualInstance(o);
409454
}
410455

456+
public SyntheticsBasicAuth(SyntheticsBasicAuthJWT o) {
457+
super("oneOf", Boolean.FALSE);
458+
setActualInstance(o);
459+
}
460+
411461
static {
412462
schemas.put("SyntheticsBasicAuthWeb", new GenericType<SyntheticsBasicAuthWeb>() {});
413463
schemas.put("SyntheticsBasicAuthSigv4", new GenericType<SyntheticsBasicAuthSigv4>() {});
@@ -416,6 +466,7 @@ public SyntheticsBasicAuth(SyntheticsBasicAuthOauthROP o) {
416466
schemas.put(
417467
"SyntheticsBasicAuthOauthClient", new GenericType<SyntheticsBasicAuthOauthClient>() {});
418468
schemas.put("SyntheticsBasicAuthOauthROP", new GenericType<SyntheticsBasicAuthOauthROP>() {});
469+
schemas.put("SyntheticsBasicAuthJWT", new GenericType<SyntheticsBasicAuthJWT>() {});
419470
JSON.registerDescendants(SyntheticsBasicAuth.class, Collections.unmodifiableMap(schemas));
420471
}
421472

@@ -428,7 +479,7 @@ public Map<String, GenericType> getSchemas() {
428479
* Set the instance that matches the oneOf child schema, check the instance parameter is valid
429480
* against the oneOf child schemas: SyntheticsBasicAuthWeb, SyntheticsBasicAuthSigv4,
430481
* SyntheticsBasicAuthNTLM, SyntheticsBasicAuthDigest, SyntheticsBasicAuthOauthClient,
431-
* SyntheticsBasicAuthOauthROP
482+
* SyntheticsBasicAuthOauthROP, SyntheticsBasicAuthJWT
432483
*
433484
* <p>It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a
434485
* composed schema (allOf, anyOf, oneOf).
@@ -460,6 +511,10 @@ public void setActualInstance(Object instance) {
460511
super.setActualInstance(instance);
461512
return;
462513
}
514+
if (JSON.isInstanceOf(SyntheticsBasicAuthJWT.class, instance, new HashSet<Class<?>>())) {
515+
super.setActualInstance(instance);
516+
return;
517+
}
463518

464519
if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet<Class<?>>())) {
465520
super.setActualInstance(instance);
@@ -468,17 +523,17 @@ public void setActualInstance(Object instance) {
468523
throw new RuntimeException(
469524
"Invalid instance type. Must be SyntheticsBasicAuthWeb, SyntheticsBasicAuthSigv4,"
470525
+ " SyntheticsBasicAuthNTLM, SyntheticsBasicAuthDigest, SyntheticsBasicAuthOauthClient,"
471-
+ " SyntheticsBasicAuthOauthROP");
526+
+ " SyntheticsBasicAuthOauthROP, SyntheticsBasicAuthJWT");
472527
}
473528

474529
/**
475530
* Get the actual instance, which can be the following: SyntheticsBasicAuthWeb,
476531
* SyntheticsBasicAuthSigv4, SyntheticsBasicAuthNTLM, SyntheticsBasicAuthDigest,
477-
* SyntheticsBasicAuthOauthClient, SyntheticsBasicAuthOauthROP
532+
* SyntheticsBasicAuthOauthClient, SyntheticsBasicAuthOauthROP, SyntheticsBasicAuthJWT
478533
*
479534
* @return The actual instance (SyntheticsBasicAuthWeb, SyntheticsBasicAuthSigv4,
480535
* SyntheticsBasicAuthNTLM, SyntheticsBasicAuthDigest, SyntheticsBasicAuthOauthClient,
481-
* SyntheticsBasicAuthOauthROP)
536+
* SyntheticsBasicAuthOauthROP, SyntheticsBasicAuthJWT)
482537
*/
483538
@Override
484539
public Object getActualInstance() {
@@ -551,4 +606,15 @@ public SyntheticsBasicAuthOauthClient getSyntheticsBasicAuthOauthClient()
551606
public SyntheticsBasicAuthOauthROP getSyntheticsBasicAuthOauthROP() throws ClassCastException {
552607
return (SyntheticsBasicAuthOauthROP) super.getActualInstance();
553608
}
609+
610+
/**
611+
* Get the actual instance of `SyntheticsBasicAuthJWT`. If the actual instance is not
612+
* `SyntheticsBasicAuthJWT`, the ClassCastException will be thrown.
613+
*
614+
* @return The actual instance of `SyntheticsBasicAuthJWT`
615+
* @throws ClassCastException if the instance is not `SyntheticsBasicAuthJWT`
616+
*/
617+
public SyntheticsBasicAuthJWT getSyntheticsBasicAuthJWT() throws ClassCastException {
618+
return (SyntheticsBasicAuthJWT) super.getActualInstance();
619+
}
554620
}

0 commit comments

Comments
 (0)