From 701be5ee790ab48f49de2bc63285b83a19ceaedb Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 2 May 2025 04:33:16 +0000 Subject: [PATCH] Regenerate client from commit 272cce39 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 56 ++++- .../v2/model/EscalationPolicyIncluded.java | 176 +++++---------- .../client/v2/model/EscalationPolicyUser.java | 208 ++++++++++++++++++ .../model/EscalationPolicyUserAttributes.java | 197 +++++++++++++++++ .../v2/model/EscalationPolicyUserType.java | 55 +++++ .../v2/model/ScheduleUserAttributes.java | 35 ++- .../client/v2/model/UserAttributesStatus.java | 57 +++++ 8 files changed, 664 insertions(+), 128 deletions(-) create mode 100644 src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUser.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUserAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUserType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UserAttributesStatus.java diff --git a/.apigentools-info b/.apigentools-info index 450d4ca26d0..cda145f920a 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-05-01 18:50:11.181805", - "spec_repo_commit": "7eb88f6a" + "regenerated": "2025-05-02 04:31:10.898749", + "spec_repo_commit": "272cce39" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-05-01 18:50:11.200952", - "spec_repo_commit": "7eb88f6a" + "regenerated": "2025-05-02 04:31:10.915000", + "spec_repo_commit": "272cce39" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d86f5ef23ca..14c6d2062fa 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -13547,9 +13547,8 @@ components: oneOf: - $ref: '#/components/schemas/TeamReference' - $ref: '#/components/schemas/EscalationPolicyStep' - - $ref: '#/components/schemas/UserTarget' - - $ref: '#/components/schemas/ScheduleTarget' - - $ref: '#/components/schemas/TeamTarget' + - $ref: '#/components/schemas/EscalationPolicyUser' + - $ref: '#/components/schemas/ScheduleData' EscalationPolicyStep: description: Represents a single step in an escalation policy, including its attributes, relationships, and resource type. @@ -13795,6 +13794,44 @@ components: type: string x-enum-varnames: - POLICIES + EscalationPolicyUser: + description: Represents a user object in the context of an escalation policy, + including their `id`, type, and basic attributes. + properties: + attributes: + $ref: '#/components/schemas/EscalationPolicyUserAttributes' + id: + description: The unique user identifier. + type: string + type: + $ref: '#/components/schemas/EscalationPolicyUserType' + required: + - type + type: object + EscalationPolicyUserAttributes: + description: Provides basic user information for an escalation policy, including + a name and email address. + properties: + email: + description: The user's email address. + example: jane.doe@example.com + type: string + name: + description: The user's name. + example: Jane Doe + type: string + status: + $ref: '#/components/schemas/UserAttributesStatus' + type: object + EscalationPolicyUserType: + default: users + description: Users resource type. + enum: + - users + example: users + type: string + x-enum-varnames: + - USERS EscalationTarget: description: Represents an escalation target, which can be a team, user, or schedule. @@ -31730,6 +31767,8 @@ components: description: The user's name. example: Jane Doe type: string + status: + $ref: '#/components/schemas/UserAttributesStatus' type: object ScheduleUserType: default: users @@ -38564,6 +38603,17 @@ components: description: Whether the user is verified. type: boolean type: object + UserAttributesStatus: + description: The user's status. + enum: + - active + - deactivated + - pending + type: string + x-enum-varnames: + - ACTIVE + - DEACTIVATED + - PENDING UserCreateAttributes: description: Attributes of the created user. properties: diff --git a/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyIncluded.java b/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyIncluded.java index 2ab76456ee2..46c834848bb 100644 --- a/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyIncluded.java +++ b/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyIncluded.java @@ -169,132 +169,91 @@ public EscalationPolicyIncluded deserialize(JsonParser jp, DeserializationContex log.log(Level.FINER, "Input data does not match schema 'EscalationPolicyStep'", e); } - // deserialize UserTarget + // deserialize EscalationPolicyUser try { boolean attemptParsing = true; // ensure that we respect type coercion as set on the client ObjectMapper - if (UserTarget.class.equals(Integer.class) - || UserTarget.class.equals(Long.class) - || UserTarget.class.equals(Float.class) - || UserTarget.class.equals(Double.class) - || UserTarget.class.equals(Boolean.class) - || UserTarget.class.equals(String.class)) { + if (EscalationPolicyUser.class.equals(Integer.class) + || EscalationPolicyUser.class.equals(Long.class) + || EscalationPolicyUser.class.equals(Float.class) + || EscalationPolicyUser.class.equals(Double.class) + || EscalationPolicyUser.class.equals(Boolean.class) + || EscalationPolicyUser.class.equals(String.class)) { attemptParsing = typeCoercion; if (!attemptParsing) { attemptParsing |= - ((UserTarget.class.equals(Integer.class) || UserTarget.class.equals(Long.class)) + ((EscalationPolicyUser.class.equals(Integer.class) + || EscalationPolicyUser.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); attemptParsing |= - ((UserTarget.class.equals(Float.class) || UserTarget.class.equals(Double.class)) + ((EscalationPolicyUser.class.equals(Float.class) + || EscalationPolicyUser.class.equals(Double.class)) && (token == JsonToken.VALUE_NUMBER_FLOAT || token == JsonToken.VALUE_NUMBER_INT)); attemptParsing |= - (UserTarget.class.equals(Boolean.class) + (EscalationPolicyUser.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); attemptParsing |= - (UserTarget.class.equals(String.class) && token == JsonToken.VALUE_STRING); - } - } - if (attemptParsing) { - tmp = tree.traverse(jp.getCodec()).readValueAs(UserTarget.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 (!((UserTarget) tmp).unparsed) { - deserialized = tmp; - match++; - } - log.log(Level.FINER, "Input data matches schema 'UserTarget'"); - } - } catch (Exception e) { - // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'UserTarget'", e); - } - - // deserialize ScheduleTarget - try { - boolean attemptParsing = true; - // ensure that we respect type coercion as set on the client ObjectMapper - if (ScheduleTarget.class.equals(Integer.class) - || ScheduleTarget.class.equals(Long.class) - || ScheduleTarget.class.equals(Float.class) - || ScheduleTarget.class.equals(Double.class) - || ScheduleTarget.class.equals(Boolean.class) - || ScheduleTarget.class.equals(String.class)) { - attemptParsing = typeCoercion; - if (!attemptParsing) { - attemptParsing |= - ((ScheduleTarget.class.equals(Integer.class) - || ScheduleTarget.class.equals(Long.class)) - && token == JsonToken.VALUE_NUMBER_INT); - attemptParsing |= - ((ScheduleTarget.class.equals(Float.class) - || ScheduleTarget.class.equals(Double.class)) - && (token == JsonToken.VALUE_NUMBER_FLOAT - || token == JsonToken.VALUE_NUMBER_INT)); - attemptParsing |= - (ScheduleTarget.class.equals(Boolean.class) - && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); - attemptParsing |= - (ScheduleTarget.class.equals(String.class) && token == JsonToken.VALUE_STRING); + (EscalationPolicyUser.class.equals(String.class) + && token == JsonToken.VALUE_STRING); } } if (attemptParsing) { - tmp = tree.traverse(jp.getCodec()).readValueAs(ScheduleTarget.class); + tmp = tree.traverse(jp.getCodec()).readValueAs(EscalationPolicyUser.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 (!((ScheduleTarget) tmp).unparsed) { + if (!((EscalationPolicyUser) tmp).unparsed) { deserialized = tmp; match++; } - log.log(Level.FINER, "Input data matches schema 'ScheduleTarget'"); + log.log(Level.FINER, "Input data matches schema 'EscalationPolicyUser'"); } } catch (Exception e) { // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'ScheduleTarget'", e); + log.log(Level.FINER, "Input data does not match schema 'EscalationPolicyUser'", e); } - // deserialize TeamTarget + // deserialize ScheduleData try { boolean attemptParsing = true; // ensure that we respect type coercion as set on the client ObjectMapper - if (TeamTarget.class.equals(Integer.class) - || TeamTarget.class.equals(Long.class) - || TeamTarget.class.equals(Float.class) - || TeamTarget.class.equals(Double.class) - || TeamTarget.class.equals(Boolean.class) - || TeamTarget.class.equals(String.class)) { + if (ScheduleData.class.equals(Integer.class) + || ScheduleData.class.equals(Long.class) + || ScheduleData.class.equals(Float.class) + || ScheduleData.class.equals(Double.class) + || ScheduleData.class.equals(Boolean.class) + || ScheduleData.class.equals(String.class)) { attemptParsing = typeCoercion; if (!attemptParsing) { attemptParsing |= - ((TeamTarget.class.equals(Integer.class) || TeamTarget.class.equals(Long.class)) + ((ScheduleData.class.equals(Integer.class) || ScheduleData.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); attemptParsing |= - ((TeamTarget.class.equals(Float.class) || TeamTarget.class.equals(Double.class)) + ((ScheduleData.class.equals(Float.class) || ScheduleData.class.equals(Double.class)) && (token == JsonToken.VALUE_NUMBER_FLOAT || token == JsonToken.VALUE_NUMBER_INT)); attemptParsing |= - (TeamTarget.class.equals(Boolean.class) + (ScheduleData.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); attemptParsing |= - (TeamTarget.class.equals(String.class) && token == JsonToken.VALUE_STRING); + (ScheduleData.class.equals(String.class) && token == JsonToken.VALUE_STRING); } } if (attemptParsing) { - tmp = tree.traverse(jp.getCodec()).readValueAs(TeamTarget.class); + tmp = tree.traverse(jp.getCodec()).readValueAs(ScheduleData.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 (!((TeamTarget) tmp).unparsed) { + if (!((ScheduleData) tmp).unparsed) { deserialized = tmp; match++; } - log.log(Level.FINER, "Input data matches schema 'TeamTarget'"); + log.log(Level.FINER, "Input data matches schema 'ScheduleData'"); } } catch (Exception e) { // deserialization failed, continue - log.log(Level.FINER, "Input data does not match schema 'TeamTarget'", e); + log.log(Level.FINER, "Input data does not match schema 'ScheduleData'", e); } EscalationPolicyIncluded ret = new EscalationPolicyIncluded(); @@ -336,17 +295,12 @@ public EscalationPolicyIncluded(EscalationPolicyStep o) { setActualInstance(o); } - public EscalationPolicyIncluded(UserTarget o) { - super("oneOf", Boolean.FALSE); - setActualInstance(o); - } - - public EscalationPolicyIncluded(ScheduleTarget o) { + public EscalationPolicyIncluded(EscalationPolicyUser o) { super("oneOf", Boolean.FALSE); setActualInstance(o); } - public EscalationPolicyIncluded(TeamTarget o) { + public EscalationPolicyIncluded(ScheduleData o) { super("oneOf", Boolean.FALSE); setActualInstance(o); } @@ -354,9 +308,8 @@ public EscalationPolicyIncluded(TeamTarget o) { static { schemas.put("TeamReference", new GenericType() {}); schemas.put("EscalationPolicyStep", new GenericType() {}); - schemas.put("UserTarget", new GenericType() {}); - schemas.put("ScheduleTarget", new GenericType() {}); - schemas.put("TeamTarget", new GenericType() {}); + schemas.put("EscalationPolicyUser", new GenericType() {}); + schemas.put("ScheduleData", new GenericType() {}); JSON.registerDescendants(EscalationPolicyIncluded.class, Collections.unmodifiableMap(schemas)); } @@ -367,8 +320,8 @@ public Map getSchemas() { /** * Set the instance that matches the oneOf child schema, check the instance parameter is valid - * against the oneOf child schemas: TeamReference, EscalationPolicyStep, UserTarget, - * ScheduleTarget, TeamTarget + * against the oneOf child schemas: TeamReference, EscalationPolicyStep, EscalationPolicyUser, + * ScheduleData * *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a * composed schema (allOf, anyOf, oneOf). @@ -383,15 +336,11 @@ public void setActualInstance(Object instance) { super.setActualInstance(instance); return; } - if (JSON.isInstanceOf(UserTarget.class, instance, new HashSet>())) { + if (JSON.isInstanceOf(EscalationPolicyUser.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } - if (JSON.isInstanceOf(ScheduleTarget.class, instance, new HashSet>())) { - super.setActualInstance(instance); - return; - } - if (JSON.isInstanceOf(TeamTarget.class, instance, new HashSet>())) { + if (JSON.isInstanceOf(ScheduleData.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } @@ -401,16 +350,16 @@ public void setActualInstance(Object instance) { return; } throw new RuntimeException( - "Invalid instance type. Must be TeamReference, EscalationPolicyStep, UserTarget," - + " ScheduleTarget, TeamTarget"); + "Invalid instance type. Must be TeamReference, EscalationPolicyStep, EscalationPolicyUser," + + " ScheduleData"); } /** * Get the actual instance, which can be the following: TeamReference, EscalationPolicyStep, - * UserTarget, ScheduleTarget, TeamTarget + * EscalationPolicyUser, ScheduleData * - * @return The actual instance (TeamReference, EscalationPolicyStep, UserTarget, ScheduleTarget, - * TeamTarget) + * @return The actual instance (TeamReference, EscalationPolicyStep, EscalationPolicyUser, + * ScheduleData) */ @Override public Object getActualInstance() { @@ -440,35 +389,24 @@ public EscalationPolicyStep getEscalationPolicyStep() throws ClassCastException } /** - * Get the actual instance of `UserTarget`. If the actual instance is not `UserTarget`, the - * ClassCastException will be thrown. - * - * @return The actual instance of `UserTarget` - * @throws ClassCastException if the instance is not `UserTarget` - */ - public UserTarget getUserTarget() throws ClassCastException { - return (UserTarget) super.getActualInstance(); - } - - /** - * Get the actual instance of `ScheduleTarget`. If the actual instance is not `ScheduleTarget`, - * the ClassCastException will be thrown. + * Get the actual instance of `EscalationPolicyUser`. If the actual instance is not + * `EscalationPolicyUser`, the ClassCastException will be thrown. * - * @return The actual instance of `ScheduleTarget` - * @throws ClassCastException if the instance is not `ScheduleTarget` + * @return The actual instance of `EscalationPolicyUser` + * @throws ClassCastException if the instance is not `EscalationPolicyUser` */ - public ScheduleTarget getScheduleTarget() throws ClassCastException { - return (ScheduleTarget) super.getActualInstance(); + public EscalationPolicyUser getEscalationPolicyUser() throws ClassCastException { + return (EscalationPolicyUser) super.getActualInstance(); } /** - * Get the actual instance of `TeamTarget`. If the actual instance is not `TeamTarget`, the + * Get the actual instance of `ScheduleData`. If the actual instance is not `ScheduleData`, the * ClassCastException will be thrown. * - * @return The actual instance of `TeamTarget` - * @throws ClassCastException if the instance is not `TeamTarget` + * @return The actual instance of `ScheduleData` + * @throws ClassCastException if the instance is not `ScheduleData` */ - public TeamTarget getTeamTarget() throws ClassCastException { - return (TeamTarget) super.getActualInstance(); + public ScheduleData getScheduleData() throws ClassCastException { + return (ScheduleData) super.getActualInstance(); } } diff --git a/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUser.java b/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUser.java new file mode 100644 index 00000000000..455c55c7b87 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUser.java @@ -0,0 +1,208 @@ +/* + * 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; + +/** + * Represents a user object in the context of an escalation policy, including their id, + * type, and basic attributes. + */ +@JsonPropertyOrder({ + EscalationPolicyUser.JSON_PROPERTY_ATTRIBUTES, + EscalationPolicyUser.JSON_PROPERTY_ID, + EscalationPolicyUser.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class EscalationPolicyUser { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private EscalationPolicyUserAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private EscalationPolicyUserType type = EscalationPolicyUserType.USERS; + + public EscalationPolicyUser() {} + + @JsonCreator + public EscalationPolicyUser( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) EscalationPolicyUserType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public EscalationPolicyUser attributes(EscalationPolicyUserAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Provides basic user information for an escalation policy, including a name and email address. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public EscalationPolicyUserAttributes getAttributes() { + return attributes; + } + + public void setAttributes(EscalationPolicyUserAttributes attributes) { + this.attributes = attributes; + } + + public EscalationPolicyUser id(String id) { + this.id = id; + return this; + } + + /** + * The unique user identifier. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public EscalationPolicyUser type(EscalationPolicyUserType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Users resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public EscalationPolicyUserType getType() { + return type; + } + + public void setType(EscalationPolicyUserType 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 EscalationPolicyUser + */ + @JsonAnySetter + public EscalationPolicyUser 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 EscalationPolicyUser object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EscalationPolicyUser escalationPolicyUser = (EscalationPolicyUser) o; + return Objects.equals(this.attributes, escalationPolicyUser.attributes) + && Objects.equals(this.id, escalationPolicyUser.id) + && Objects.equals(this.type, escalationPolicyUser.type) + && Objects.equals(this.additionalProperties, escalationPolicyUser.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EscalationPolicyUser {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).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/EscalationPolicyUserAttributes.java b/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUserAttributes.java new file mode 100644 index 00000000000..652678bddbe --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUserAttributes.java @@ -0,0 +1,197 @@ +/* + * 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.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; + +/** Provides basic user information for an escalation policy, including a name and email address. */ +@JsonPropertyOrder({ + EscalationPolicyUserAttributes.JSON_PROPERTY_EMAIL, + EscalationPolicyUserAttributes.JSON_PROPERTY_NAME, + EscalationPolicyUserAttributes.JSON_PROPERTY_STATUS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class EscalationPolicyUserAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_EMAIL = "email"; + private String email; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_STATUS = "status"; + private UserAttributesStatus status; + + public EscalationPolicyUserAttributes email(String email) { + this.email = email; + return this; + } + + /** + * The user's email address. + * + * @return email + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public EscalationPolicyUserAttributes name(String name) { + this.name = name; + return this; + } + + /** + * The user's name. + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public EscalationPolicyUserAttributes status(UserAttributesStatus status) { + this.status = status; + this.unparsed |= !status.isValid(); + return this; + } + + /** + * The user's status. + * + * @return status + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UserAttributesStatus getStatus() { + return status; + } + + public void setStatus(UserAttributesStatus status) { + if (!status.isValid()) { + this.unparsed = true; + } + this.status = status; + } + + /** + * 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 EscalationPolicyUserAttributes + */ + @JsonAnySetter + public EscalationPolicyUserAttributes 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 EscalationPolicyUserAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EscalationPolicyUserAttributes escalationPolicyUserAttributes = + (EscalationPolicyUserAttributes) o; + return Objects.equals(this.email, escalationPolicyUserAttributes.email) + && Objects.equals(this.name, escalationPolicyUserAttributes.name) + && Objects.equals(this.status, escalationPolicyUserAttributes.status) + && Objects.equals( + this.additionalProperties, escalationPolicyUserAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(email, name, status, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EscalationPolicyUserAttributes {\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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/EscalationPolicyUserType.java b/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUserType.java new file mode 100644 index 00000000000..a4bd98c6aaa --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/EscalationPolicyUserType.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; + +/** Users resource type. */ +@JsonSerialize(using = EscalationPolicyUserType.EscalationPolicyUserTypeSerializer.class) +public class EscalationPolicyUserType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("users")); + + public static final EscalationPolicyUserType USERS = new EscalationPolicyUserType("users"); + + EscalationPolicyUserType(String value) { + super(value, allowedValues); + } + + public static class EscalationPolicyUserTypeSerializer + extends StdSerializer { + public EscalationPolicyUserTypeSerializer(Class t) { + super(t); + } + + public EscalationPolicyUserTypeSerializer() { + this(null); + } + + @Override + public void serialize( + EscalationPolicyUserType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static EscalationPolicyUserType fromValue(String value) { + return new EscalationPolicyUserType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ScheduleUserAttributes.java b/src/main/java/com/datadog/api/client/v2/model/ScheduleUserAttributes.java index 5f9a389be09..71ae33bb78a 100644 --- a/src/main/java/com/datadog/api/client/v2/model/ScheduleUserAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/ScheduleUserAttributes.java @@ -19,7 +19,8 @@ /** Provides basic user information for a schedule, including a name and email address. */ @JsonPropertyOrder({ ScheduleUserAttributes.JSON_PROPERTY_EMAIL, - ScheduleUserAttributes.JSON_PROPERTY_NAME + ScheduleUserAttributes.JSON_PROPERTY_NAME, + ScheduleUserAttributes.JSON_PROPERTY_STATUS }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") @@ -31,6 +32,9 @@ public class ScheduleUserAttributes { public static final String JSON_PROPERTY_NAME = "name"; private String name; + public static final String JSON_PROPERTY_STATUS = "status"; + private UserAttributesStatus status; + public ScheduleUserAttributes email(String email) { this.email = email; return this; @@ -73,6 +77,31 @@ public void setName(String name) { this.name = name; } + public ScheduleUserAttributes status(UserAttributesStatus status) { + this.status = status; + this.unparsed |= !status.isValid(); + return this; + } + + /** + * The user's status. + * + * @return status + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UserAttributesStatus getStatus() { + return status; + } + + public void setStatus(UserAttributesStatus status) { + if (!status.isValid()) { + this.unparsed = true; + } + this.status = status; + } + /** * A container for additional, undeclared properties. This is a holder for any undeclared * properties as specified with the 'additionalProperties' keyword in the OAS document. @@ -131,12 +160,13 @@ public boolean equals(Object o) { ScheduleUserAttributes scheduleUserAttributes = (ScheduleUserAttributes) o; return Objects.equals(this.email, scheduleUserAttributes.email) && Objects.equals(this.name, scheduleUserAttributes.name) + && Objects.equals(this.status, scheduleUserAttributes.status) && Objects.equals(this.additionalProperties, scheduleUserAttributes.additionalProperties); } @Override public int hashCode() { - return Objects.hash(email, name, additionalProperties); + return Objects.hash(email, name, status, additionalProperties); } @Override @@ -145,6 +175,7 @@ public String toString() { sb.append("class ScheduleUserAttributes {\n"); sb.append(" email: ").append(toIndentedString(email)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) .append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/UserAttributesStatus.java b/src/main/java/com/datadog/api/client/v2/model/UserAttributesStatus.java new file mode 100644 index 00000000000..ab0d0f20111 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UserAttributesStatus.java @@ -0,0 +1,57 @@ +/* + * 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 user's status. */ +@JsonSerialize(using = UserAttributesStatus.UserAttributesStatusSerializer.class) +public class UserAttributesStatus extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("active", "deactivated", "pending")); + + public static final UserAttributesStatus ACTIVE = new UserAttributesStatus("active"); + public static final UserAttributesStatus DEACTIVATED = new UserAttributesStatus("deactivated"); + public static final UserAttributesStatus PENDING = new UserAttributesStatus("pending"); + + UserAttributesStatus(String value) { + super(value, allowedValues); + } + + public static class UserAttributesStatusSerializer extends StdSerializer { + public UserAttributesStatusSerializer(Class t) { + super(t); + } + + public UserAttributesStatusSerializer() { + this(null); + } + + @Override + public void serialize( + UserAttributesStatus value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static UserAttributesStatus fromValue(String value) { + return new UserAttributesStatus(value); + } +}