Skip to content

Commit 8e4b5ac

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

6 files changed

Lines changed: 731 additions & 0 deletions

.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:

api/datadogV1/model_synthetics_basic_auth.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type SyntheticsBasicAuth struct {
1616
SyntheticsBasicAuthDigest *SyntheticsBasicAuthDigest
1717
SyntheticsBasicAuthOauthClient *SyntheticsBasicAuthOauthClient
1818
SyntheticsBasicAuthOauthROP *SyntheticsBasicAuthOauthROP
19+
SyntheticsBasicAuthJWT *SyntheticsBasicAuthJWT
1920

2021
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
2122
UnparsedObject interface{}
@@ -51,6 +52,11 @@ func SyntheticsBasicAuthOauthROPAsSyntheticsBasicAuth(v *SyntheticsBasicAuthOaut
5152
return SyntheticsBasicAuth{SyntheticsBasicAuthOauthROP: v}
5253
}
5354

55+
// SyntheticsBasicAuthJWTAsSyntheticsBasicAuth is a convenience function that returns SyntheticsBasicAuthJWT wrapped in SyntheticsBasicAuth.
56+
func SyntheticsBasicAuthJWTAsSyntheticsBasicAuth(v *SyntheticsBasicAuthJWT) SyntheticsBasicAuth {
57+
return SyntheticsBasicAuth{SyntheticsBasicAuthJWT: v}
58+
}
59+
5460
// UnmarshalJSON turns data into one of the pointers in the struct.
5561
func (obj *SyntheticsBasicAuth) UnmarshalJSON(data []byte) error {
5662
var err error
@@ -157,6 +163,23 @@ func (obj *SyntheticsBasicAuth) UnmarshalJSON(data []byte) error {
157163
obj.SyntheticsBasicAuthOauthROP = nil
158164
}
159165

166+
// try to unmarshal data into SyntheticsBasicAuthJWT
167+
err = datadog.Unmarshal(data, &obj.SyntheticsBasicAuthJWT)
168+
if err == nil {
169+
if obj.SyntheticsBasicAuthJWT != nil && obj.SyntheticsBasicAuthJWT.UnparsedObject == nil {
170+
jsonSyntheticsBasicAuthJWT, _ := datadog.Marshal(obj.SyntheticsBasicAuthJWT)
171+
if string(jsonSyntheticsBasicAuthJWT) == "{}" { // empty struct
172+
obj.SyntheticsBasicAuthJWT = nil
173+
} else {
174+
match++
175+
}
176+
} else {
177+
obj.SyntheticsBasicAuthJWT = nil
178+
}
179+
} else {
180+
obj.SyntheticsBasicAuthJWT = nil
181+
}
182+
160183
if match != 1 { // more than 1 match
161184
// reset to nil
162185
obj.SyntheticsBasicAuthWeb = nil
@@ -165,6 +188,7 @@ func (obj *SyntheticsBasicAuth) UnmarshalJSON(data []byte) error {
165188
obj.SyntheticsBasicAuthDigest = nil
166189
obj.SyntheticsBasicAuthOauthClient = nil
167190
obj.SyntheticsBasicAuthOauthROP = nil
191+
obj.SyntheticsBasicAuthJWT = nil
168192
return datadog.Unmarshal(data, &obj.UnparsedObject)
169193
}
170194
return nil // exactly one match
@@ -196,6 +220,10 @@ func (obj SyntheticsBasicAuth) MarshalJSON() ([]byte, error) {
196220
return datadog.Marshal(&obj.SyntheticsBasicAuthOauthROP)
197221
}
198222

223+
if obj.SyntheticsBasicAuthJWT != nil {
224+
return datadog.Marshal(&obj.SyntheticsBasicAuthJWT)
225+
}
226+
199227
if obj.UnparsedObject != nil {
200228
return datadog.Marshal(obj.UnparsedObject)
201229
}
@@ -228,6 +256,10 @@ func (obj *SyntheticsBasicAuth) GetActualInstance() interface{} {
228256
return obj.SyntheticsBasicAuthOauthROP
229257
}
230258

259+
if obj.SyntheticsBasicAuthJWT != nil {
260+
return obj.SyntheticsBasicAuthJWT
261+
}
262+
231263
// all schemas are nil
232264
return nil
233265
}

0 commit comments

Comments
 (0)