Skip to content

Commit 4bb4b2b

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add user status to schema and fix escalation policy included (#2829)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent be475d7 commit 4bb4b2b

File tree

8 files changed

+664
-128
lines changed

8 files changed

+664
-128
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-05-01 18:50:11.181805",
8-
"spec_repo_commit": "7eb88f6a"
7+
"regenerated": "2025-05-02 04:31:10.898749",
8+
"spec_repo_commit": "272cce39"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-05-01 18:50:11.200952",
13-
"spec_repo_commit": "7eb88f6a"
12+
"regenerated": "2025-05-02 04:31:10.915000",
13+
"spec_repo_commit": "272cce39"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13547,9 +13547,8 @@ components:
1354713547
oneOf:
1354813548
- $ref: '#/components/schemas/TeamReference'
1354913549
- $ref: '#/components/schemas/EscalationPolicyStep'
13550-
- $ref: '#/components/schemas/UserTarget'
13551-
- $ref: '#/components/schemas/ScheduleTarget'
13552-
- $ref: '#/components/schemas/TeamTarget'
13550+
- $ref: '#/components/schemas/EscalationPolicyUser'
13551+
- $ref: '#/components/schemas/ScheduleData'
1355313552
EscalationPolicyStep:
1355413553
description: Represents a single step in an escalation policy, including its
1355513554
attributes, relationships, and resource type.
@@ -13795,6 +13794,44 @@ components:
1379513794
type: string
1379613795
x-enum-varnames:
1379713796
- POLICIES
13797+
EscalationPolicyUser:
13798+
description: Represents a user object in the context of an escalation policy,
13799+
including their `id`, type, and basic attributes.
13800+
properties:
13801+
attributes:
13802+
$ref: '#/components/schemas/EscalationPolicyUserAttributes'
13803+
id:
13804+
description: The unique user identifier.
13805+
type: string
13806+
type:
13807+
$ref: '#/components/schemas/EscalationPolicyUserType'
13808+
required:
13809+
- type
13810+
type: object
13811+
EscalationPolicyUserAttributes:
13812+
description: Provides basic user information for an escalation policy, including
13813+
a name and email address.
13814+
properties:
13815+
email:
13816+
description: The user's email address.
13817+
example: jane.doe@example.com
13818+
type: string
13819+
name:
13820+
description: The user's name.
13821+
example: Jane Doe
13822+
type: string
13823+
status:
13824+
$ref: '#/components/schemas/UserAttributesStatus'
13825+
type: object
13826+
EscalationPolicyUserType:
13827+
default: users
13828+
description: Users resource type.
13829+
enum:
13830+
- users
13831+
example: users
13832+
type: string
13833+
x-enum-varnames:
13834+
- USERS
1379813835
EscalationTarget:
1379913836
description: Represents an escalation target, which can be a team, user, or
1380013837
schedule.
@@ -31730,6 +31767,8 @@ components:
3173031767
description: The user's name.
3173131768
example: Jane Doe
3173231769
type: string
31770+
status:
31771+
$ref: '#/components/schemas/UserAttributesStatus'
3173331772
type: object
3173431773
ScheduleUserType:
3173531774
default: users
@@ -38564,6 +38603,17 @@ components:
3856438603
description: Whether the user is verified.
3856538604
type: boolean
3856638605
type: object
38606+
UserAttributesStatus:
38607+
description: The user's status.
38608+
enum:
38609+
- active
38610+
- deactivated
38611+
- pending
38612+
type: string
38613+
x-enum-varnames:
38614+
- ACTIVE
38615+
- DEACTIVATED
38616+
- PENDING
3856738617
UserCreateAttributes:
3856838618
description: Attributes of the created user.
3856938619
properties:

src/main/java/com/datadog/api/client/v2/model/EscalationPolicyIncluded.java

Lines changed: 57 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -169,132 +169,91 @@ public EscalationPolicyIncluded deserialize(JsonParser jp, DeserializationContex
169169
log.log(Level.FINER, "Input data does not match schema 'EscalationPolicyStep'", e);
170170
}
171171

172-
// deserialize UserTarget
172+
// deserialize EscalationPolicyUser
173173
try {
174174
boolean attemptParsing = true;
175175
// ensure that we respect type coercion as set on the client ObjectMapper
176-
if (UserTarget.class.equals(Integer.class)
177-
|| UserTarget.class.equals(Long.class)
178-
|| UserTarget.class.equals(Float.class)
179-
|| UserTarget.class.equals(Double.class)
180-
|| UserTarget.class.equals(Boolean.class)
181-
|| UserTarget.class.equals(String.class)) {
176+
if (EscalationPolicyUser.class.equals(Integer.class)
177+
|| EscalationPolicyUser.class.equals(Long.class)
178+
|| EscalationPolicyUser.class.equals(Float.class)
179+
|| EscalationPolicyUser.class.equals(Double.class)
180+
|| EscalationPolicyUser.class.equals(Boolean.class)
181+
|| EscalationPolicyUser.class.equals(String.class)) {
182182
attemptParsing = typeCoercion;
183183
if (!attemptParsing) {
184184
attemptParsing |=
185-
((UserTarget.class.equals(Integer.class) || UserTarget.class.equals(Long.class))
185+
((EscalationPolicyUser.class.equals(Integer.class)
186+
|| EscalationPolicyUser.class.equals(Long.class))
186187
&& token == JsonToken.VALUE_NUMBER_INT);
187188
attemptParsing |=
188-
((UserTarget.class.equals(Float.class) || UserTarget.class.equals(Double.class))
189+
((EscalationPolicyUser.class.equals(Float.class)
190+
|| EscalationPolicyUser.class.equals(Double.class))
189191
&& (token == JsonToken.VALUE_NUMBER_FLOAT
190192
|| token == JsonToken.VALUE_NUMBER_INT));
191193
attemptParsing |=
192-
(UserTarget.class.equals(Boolean.class)
194+
(EscalationPolicyUser.class.equals(Boolean.class)
193195
&& (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
194196
attemptParsing |=
195-
(UserTarget.class.equals(String.class) && token == JsonToken.VALUE_STRING);
196-
}
197-
}
198-
if (attemptParsing) {
199-
tmp = tree.traverse(jp.getCodec()).readValueAs(UserTarget.class);
200-
// TODO: there is no validation against JSON schema constraints
201-
// (min, max, enum, pattern...), this does not perform a strict JSON
202-
// validation, which means the 'match' count may be higher than it should be.
203-
if (!((UserTarget) tmp).unparsed) {
204-
deserialized = tmp;
205-
match++;
206-
}
207-
log.log(Level.FINER, "Input data matches schema 'UserTarget'");
208-
}
209-
} catch (Exception e) {
210-
// deserialization failed, continue
211-
log.log(Level.FINER, "Input data does not match schema 'UserTarget'", e);
212-
}
213-
214-
// deserialize ScheduleTarget
215-
try {
216-
boolean attemptParsing = true;
217-
// ensure that we respect type coercion as set on the client ObjectMapper
218-
if (ScheduleTarget.class.equals(Integer.class)
219-
|| ScheduleTarget.class.equals(Long.class)
220-
|| ScheduleTarget.class.equals(Float.class)
221-
|| ScheduleTarget.class.equals(Double.class)
222-
|| ScheduleTarget.class.equals(Boolean.class)
223-
|| ScheduleTarget.class.equals(String.class)) {
224-
attemptParsing = typeCoercion;
225-
if (!attemptParsing) {
226-
attemptParsing |=
227-
((ScheduleTarget.class.equals(Integer.class)
228-
|| ScheduleTarget.class.equals(Long.class))
229-
&& token == JsonToken.VALUE_NUMBER_INT);
230-
attemptParsing |=
231-
((ScheduleTarget.class.equals(Float.class)
232-
|| ScheduleTarget.class.equals(Double.class))
233-
&& (token == JsonToken.VALUE_NUMBER_FLOAT
234-
|| token == JsonToken.VALUE_NUMBER_INT));
235-
attemptParsing |=
236-
(ScheduleTarget.class.equals(Boolean.class)
237-
&& (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
238-
attemptParsing |=
239-
(ScheduleTarget.class.equals(String.class) && token == JsonToken.VALUE_STRING);
197+
(EscalationPolicyUser.class.equals(String.class)
198+
&& token == JsonToken.VALUE_STRING);
240199
}
241200
}
242201
if (attemptParsing) {
243-
tmp = tree.traverse(jp.getCodec()).readValueAs(ScheduleTarget.class);
202+
tmp = tree.traverse(jp.getCodec()).readValueAs(EscalationPolicyUser.class);
244203
// TODO: there is no validation against JSON schema constraints
245204
// (min, max, enum, pattern...), this does not perform a strict JSON
246205
// validation, which means the 'match' count may be higher than it should be.
247-
if (!((ScheduleTarget) tmp).unparsed) {
206+
if (!((EscalationPolicyUser) tmp).unparsed) {
248207
deserialized = tmp;
249208
match++;
250209
}
251-
log.log(Level.FINER, "Input data matches schema 'ScheduleTarget'");
210+
log.log(Level.FINER, "Input data matches schema 'EscalationPolicyUser'");
252211
}
253212
} catch (Exception e) {
254213
// deserialization failed, continue
255-
log.log(Level.FINER, "Input data does not match schema 'ScheduleTarget'", e);
214+
log.log(Level.FINER, "Input data does not match schema 'EscalationPolicyUser'", e);
256215
}
257216

258-
// deserialize TeamTarget
217+
// deserialize ScheduleData
259218
try {
260219
boolean attemptParsing = true;
261220
// ensure that we respect type coercion as set on the client ObjectMapper
262-
if (TeamTarget.class.equals(Integer.class)
263-
|| TeamTarget.class.equals(Long.class)
264-
|| TeamTarget.class.equals(Float.class)
265-
|| TeamTarget.class.equals(Double.class)
266-
|| TeamTarget.class.equals(Boolean.class)
267-
|| TeamTarget.class.equals(String.class)) {
221+
if (ScheduleData.class.equals(Integer.class)
222+
|| ScheduleData.class.equals(Long.class)
223+
|| ScheduleData.class.equals(Float.class)
224+
|| ScheduleData.class.equals(Double.class)
225+
|| ScheduleData.class.equals(Boolean.class)
226+
|| ScheduleData.class.equals(String.class)) {
268227
attemptParsing = typeCoercion;
269228
if (!attemptParsing) {
270229
attemptParsing |=
271-
((TeamTarget.class.equals(Integer.class) || TeamTarget.class.equals(Long.class))
230+
((ScheduleData.class.equals(Integer.class) || ScheduleData.class.equals(Long.class))
272231
&& token == JsonToken.VALUE_NUMBER_INT);
273232
attemptParsing |=
274-
((TeamTarget.class.equals(Float.class) || TeamTarget.class.equals(Double.class))
233+
((ScheduleData.class.equals(Float.class) || ScheduleData.class.equals(Double.class))
275234
&& (token == JsonToken.VALUE_NUMBER_FLOAT
276235
|| token == JsonToken.VALUE_NUMBER_INT));
277236
attemptParsing |=
278-
(TeamTarget.class.equals(Boolean.class)
237+
(ScheduleData.class.equals(Boolean.class)
279238
&& (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
280239
attemptParsing |=
281-
(TeamTarget.class.equals(String.class) && token == JsonToken.VALUE_STRING);
240+
(ScheduleData.class.equals(String.class) && token == JsonToken.VALUE_STRING);
282241
}
283242
}
284243
if (attemptParsing) {
285-
tmp = tree.traverse(jp.getCodec()).readValueAs(TeamTarget.class);
244+
tmp = tree.traverse(jp.getCodec()).readValueAs(ScheduleData.class);
286245
// TODO: there is no validation against JSON schema constraints
287246
// (min, max, enum, pattern...), this does not perform a strict JSON
288247
// validation, which means the 'match' count may be higher than it should be.
289-
if (!((TeamTarget) tmp).unparsed) {
248+
if (!((ScheduleData) tmp).unparsed) {
290249
deserialized = tmp;
291250
match++;
292251
}
293-
log.log(Level.FINER, "Input data matches schema 'TeamTarget'");
252+
log.log(Level.FINER, "Input data matches schema 'ScheduleData'");
294253
}
295254
} catch (Exception e) {
296255
// deserialization failed, continue
297-
log.log(Level.FINER, "Input data does not match schema 'TeamTarget'", e);
256+
log.log(Level.FINER, "Input data does not match schema 'ScheduleData'", e);
298257
}
299258

300259
EscalationPolicyIncluded ret = new EscalationPolicyIncluded();
@@ -336,27 +295,21 @@ public EscalationPolicyIncluded(EscalationPolicyStep o) {
336295
setActualInstance(o);
337296
}
338297

339-
public EscalationPolicyIncluded(UserTarget o) {
340-
super("oneOf", Boolean.FALSE);
341-
setActualInstance(o);
342-
}
343-
344-
public EscalationPolicyIncluded(ScheduleTarget o) {
298+
public EscalationPolicyIncluded(EscalationPolicyUser o) {
345299
super("oneOf", Boolean.FALSE);
346300
setActualInstance(o);
347301
}
348302

349-
public EscalationPolicyIncluded(TeamTarget o) {
303+
public EscalationPolicyIncluded(ScheduleData o) {
350304
super("oneOf", Boolean.FALSE);
351305
setActualInstance(o);
352306
}
353307

354308
static {
355309
schemas.put("TeamReference", new GenericType<TeamReference>() {});
356310
schemas.put("EscalationPolicyStep", new GenericType<EscalationPolicyStep>() {});
357-
schemas.put("UserTarget", new GenericType<UserTarget>() {});
358-
schemas.put("ScheduleTarget", new GenericType<ScheduleTarget>() {});
359-
schemas.put("TeamTarget", new GenericType<TeamTarget>() {});
311+
schemas.put("EscalationPolicyUser", new GenericType<EscalationPolicyUser>() {});
312+
schemas.put("ScheduleData", new GenericType<ScheduleData>() {});
360313
JSON.registerDescendants(EscalationPolicyIncluded.class, Collections.unmodifiableMap(schemas));
361314
}
362315

@@ -367,8 +320,8 @@ public Map<String, GenericType> getSchemas() {
367320

368321
/**
369322
* Set the instance that matches the oneOf child schema, check the instance parameter is valid
370-
* against the oneOf child schemas: TeamReference, EscalationPolicyStep, UserTarget,
371-
* ScheduleTarget, TeamTarget
323+
* against the oneOf child schemas: TeamReference, EscalationPolicyStep, EscalationPolicyUser,
324+
* ScheduleData
372325
*
373326
* <p>It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a
374327
* composed schema (allOf, anyOf, oneOf).
@@ -383,15 +336,11 @@ public void setActualInstance(Object instance) {
383336
super.setActualInstance(instance);
384337
return;
385338
}
386-
if (JSON.isInstanceOf(UserTarget.class, instance, new HashSet<Class<?>>())) {
339+
if (JSON.isInstanceOf(EscalationPolicyUser.class, instance, new HashSet<Class<?>>())) {
387340
super.setActualInstance(instance);
388341
return;
389342
}
390-
if (JSON.isInstanceOf(ScheduleTarget.class, instance, new HashSet<Class<?>>())) {
391-
super.setActualInstance(instance);
392-
return;
393-
}
394-
if (JSON.isInstanceOf(TeamTarget.class, instance, new HashSet<Class<?>>())) {
343+
if (JSON.isInstanceOf(ScheduleData.class, instance, new HashSet<Class<?>>())) {
395344
super.setActualInstance(instance);
396345
return;
397346
}
@@ -401,16 +350,16 @@ public void setActualInstance(Object instance) {
401350
return;
402351
}
403352
throw new RuntimeException(
404-
"Invalid instance type. Must be TeamReference, EscalationPolicyStep, UserTarget,"
405-
+ " ScheduleTarget, TeamTarget");
353+
"Invalid instance type. Must be TeamReference, EscalationPolicyStep, EscalationPolicyUser,"
354+
+ " ScheduleData");
406355
}
407356

408357
/**
409358
* Get the actual instance, which can be the following: TeamReference, EscalationPolicyStep,
410-
* UserTarget, ScheduleTarget, TeamTarget
359+
* EscalationPolicyUser, ScheduleData
411360
*
412-
* @return The actual instance (TeamReference, EscalationPolicyStep, UserTarget, ScheduleTarget,
413-
* TeamTarget)
361+
* @return The actual instance (TeamReference, EscalationPolicyStep, EscalationPolicyUser,
362+
* ScheduleData)
414363
*/
415364
@Override
416365
public Object getActualInstance() {
@@ -440,35 +389,24 @@ public EscalationPolicyStep getEscalationPolicyStep() throws ClassCastException
440389
}
441390

442391
/**
443-
* Get the actual instance of `UserTarget`. If the actual instance is not `UserTarget`, the
444-
* ClassCastException will be thrown.
445-
*
446-
* @return The actual instance of `UserTarget`
447-
* @throws ClassCastException if the instance is not `UserTarget`
448-
*/
449-
public UserTarget getUserTarget() throws ClassCastException {
450-
return (UserTarget) super.getActualInstance();
451-
}
452-
453-
/**
454-
* Get the actual instance of `ScheduleTarget`. If the actual instance is not `ScheduleTarget`,
455-
* the ClassCastException will be thrown.
392+
* Get the actual instance of `EscalationPolicyUser`. If the actual instance is not
393+
* `EscalationPolicyUser`, the ClassCastException will be thrown.
456394
*
457-
* @return The actual instance of `ScheduleTarget`
458-
* @throws ClassCastException if the instance is not `ScheduleTarget`
395+
* @return The actual instance of `EscalationPolicyUser`
396+
* @throws ClassCastException if the instance is not `EscalationPolicyUser`
459397
*/
460-
public ScheduleTarget getScheduleTarget() throws ClassCastException {
461-
return (ScheduleTarget) super.getActualInstance();
398+
public EscalationPolicyUser getEscalationPolicyUser() throws ClassCastException {
399+
return (EscalationPolicyUser) super.getActualInstance();
462400
}
463401

464402
/**
465-
* Get the actual instance of `TeamTarget`. If the actual instance is not `TeamTarget`, the
403+
* Get the actual instance of `ScheduleData`. If the actual instance is not `ScheduleData`, the
466404
* ClassCastException will be thrown.
467405
*
468-
* @return The actual instance of `TeamTarget`
469-
* @throws ClassCastException if the instance is not `TeamTarget`
406+
* @return The actual instance of `ScheduleData`
407+
* @throws ClassCastException if the instance is not `ScheduleData`
470408
*/
471-
public TeamTarget getTeamTarget() throws ClassCastException {
472-
return (TeamTarget) super.getActualInstance();
409+
public ScheduleData getScheduleData() throws ClassCastException {
410+
return (ScheduleData) super.getActualInstance();
473411
}
474412
}

0 commit comments

Comments
 (0)