diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e83df8269e5..7f2cc7c1b2c 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -3734,6 +3734,114 @@ components: description: The `markdownTextAnnotation` `text`. type: string type: object + AnonymizeUserError: + description: Error encountered when anonymizing a specific user. + properties: + error: + description: Error message describing why anonymization failed. + example: "" + type: string + user_id: + description: UUID of the user that failed to be anonymized. + example: "00000000-0000-0000-0000-000000000000" + type: string + required: + - user_id + - error + type: object + AnonymizeUsersRequest: + description: Request body for anonymizing users. + properties: + data: + $ref: "#/components/schemas/AnonymizeUsersRequestData" + required: + - data + type: object + AnonymizeUsersRequestAttributes: + description: Attributes of an anonymize users request. + properties: + user_ids: + description: List of user IDs (UUIDs) to anonymize. + example: + - "00000000-0000-0000-0000-000000000000" + items: + example: "00000000-0000-0000-0000-000000000000" + type: string + type: array + required: + - user_ids + type: object + AnonymizeUsersRequestData: + description: Object to anonymize a list of users. + properties: + attributes: + $ref: "#/components/schemas/AnonymizeUsersRequestAttributes" + id: + description: Unique identifier for the request. Not used server-side. + example: "00000000-0000-0000-0000-000000000000" + type: string + type: + $ref: "#/components/schemas/AnonymizeUsersRequestType" + required: + - type + - attributes + type: object + AnonymizeUsersRequestType: + default: anonymize_users_request + description: Type of the anonymize users request. + enum: + - anonymize_users_request + example: anonymize_users_request + type: string + x-enum-varnames: + - ANONYMIZE_USERS_REQUEST + AnonymizeUsersResponse: + description: Response containing the result of an anonymize users request. + properties: + data: + $ref: "#/components/schemas/AnonymizeUsersResponseData" + type: object + AnonymizeUsersResponseAttributes: + description: Attributes of an anonymize users response. + properties: + anonymize_errors: + description: List of errors encountered during anonymization, one entry per failed user. + items: + $ref: "#/components/schemas/AnonymizeUserError" + type: array + anonymized_user_ids: + description: List of user IDs (UUIDs) that were successfully anonymized. + example: + - "00000000-0000-0000-0000-000000000000" + items: + example: "00000000-0000-0000-0000-000000000000" + type: string + type: array + required: + - anonymized_user_ids + - anonymize_errors + type: object + AnonymizeUsersResponseData: + description: Response data for anonymizing users. + properties: + attributes: + $ref: "#/components/schemas/AnonymizeUsersResponseAttributes" + id: + description: Unique identifier of the response. + example: "00000000-0000-0000-0000-000000000000" + type: string + type: + $ref: "#/components/schemas/AnonymizeUsersResponseType" + type: object + AnonymizeUsersResponseType: + default: anonymize_users_response + description: Type of the anonymize users response. + enum: + - anonymize_users_response + example: anonymize_users_response + type: string + x-enum-varnames: + - ANONYMIZE_USERS_RESPONSE AnthropicAPIKey: description: The definition of the `AnthropicAPIKey` object. properties: @@ -76578,6 +76686,53 @@ paths: operator: OR permissions: - security_monitoring_findings_read + /api/v2/anonymize_users: + put: + description: |- + Anonymize a list of users, removing their personal data. This operation is irreversible. + Requires the `user_access_manage` permission. + operationId: AnonymizeUsers + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/AnonymizeUsersRequest" + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/AnonymizeUsersResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Authentication error + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - user_access_manage + summary: Anonymize users + tags: + - Users + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - user_access_manage + x-unstable: "**Note**: This endpoint is in Preview and may be subject to changes." /api/v2/api_keys: get: description: List all API keys available for your account. diff --git a/examples/v2/users/AnonymizeUsers.java b/examples/v2/users/AnonymizeUsers.java new file mode 100644 index 00000000000..2fab4c20ef2 --- /dev/null +++ b/examples/v2/users/AnonymizeUsers.java @@ -0,0 +1,41 @@ +// Anonymize users returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.UsersApi; +import com.datadog.api.client.v2.model.AnonymizeUsersRequest; +import com.datadog.api.client.v2.model.AnonymizeUsersRequestAttributes; +import com.datadog.api.client.v2.model.AnonymizeUsersRequestData; +import com.datadog.api.client.v2.model.AnonymizeUsersRequestType; +import com.datadog.api.client.v2.model.AnonymizeUsersResponse; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.anonymizeUsers", true); + UsersApi apiInstance = new UsersApi(defaultClient); + + AnonymizeUsersRequest body = + new AnonymizeUsersRequest() + .data( + new AnonymizeUsersRequestData() + .attributes( + new AnonymizeUsersRequestAttributes() + .userIds( + Collections.singletonList("00000000-0000-0000-0000-000000000000"))) + .id("00000000-0000-0000-0000-000000000000") + .type(AnonymizeUsersRequestType.ANONYMIZE_USERS_REQUEST)); + + try { + AnonymizeUsersResponse result = apiInstance.anonymizeUsers(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UsersApi#anonymizeUsers"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 2f10dceeb03..d98b85b5824 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -764,6 +764,7 @@ public class ApiClient { put("v2.listFleetSchedules", false); put("v2.triggerFleetSchedule", false); put("v2.updateFleetSchedule", false); + put("v2.anonymizeUsers", false); put("v2.createOpenAPI", false); put("v2.deleteOpenAPI", false); put("v2.getOpenAPI", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/UsersApi.java b/src/main/java/com/datadog/api/client/v2/api/UsersApi.java index f348e82138d..342463f92af 100644 --- a/src/main/java/com/datadog/api/client/v2/api/UsersApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/UsersApi.java @@ -5,6 +5,8 @@ import com.datadog.api.client.ApiResponse; import com.datadog.api.client.PaginationIterable; import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.AnonymizeUsersRequest; +import com.datadog.api.client.v2.model.AnonymizeUsersResponse; import com.datadog.api.client.v2.model.PermissionsResponse; import com.datadog.api.client.v2.model.QuerySortOrder; import com.datadog.api.client.v2.model.User; @@ -55,6 +57,155 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * Anonymize users. + * + *

See {@link #anonymizeUsersWithHttpInfo}. + * + * @param body (required) + * @return AnonymizeUsersResponse + * @throws ApiException if fails to make API call + */ + public AnonymizeUsersResponse anonymizeUsers(AnonymizeUsersRequest body) throws ApiException { + return anonymizeUsersWithHttpInfo(body).getData(); + } + + /** + * Anonymize users. + * + *

See {@link #anonymizeUsersWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<AnonymizeUsersResponse> + */ + public CompletableFuture anonymizeUsersAsync(AnonymizeUsersRequest body) { + return anonymizeUsersWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Anonymize a list of users, removing their personal data. This operation is irreversible. + * Requires the user_access_manage permission. + * + * @param body (required) + * @return ApiResponse<AnonymizeUsersResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Authentication error -
429 Too many requests -
+ */ + public ApiResponse anonymizeUsersWithHttpInfo(AnonymizeUsersRequest body) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "anonymizeUsers"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling anonymizeUsers"); + } + // create path and map variables + String localVarPath = "/api/v2/anonymize_users"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.UsersApi.anonymizeUsers", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Anonymize users. + * + *

See {@link #anonymizeUsersWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<AnonymizeUsersResponse>> + */ + public CompletableFuture> anonymizeUsersWithHttpInfoAsync( + AnonymizeUsersRequest body) { + // Check if unstable operation is enabled + String operationId = "anonymizeUsers"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling anonymizeUsers")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/anonymize_users"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.UsersApi.anonymizeUsers", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Create a user. * diff --git a/src/main/java/com/datadog/api/client/v2/model/AnonymizeUserError.java b/src/main/java/com/datadog/api/client/v2/model/AnonymizeUserError.java new file mode 100644 index 00000000000..4865448c06b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnonymizeUserError.java @@ -0,0 +1,173 @@ +/* + * 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; + +/** Error encountered when anonymizing a specific user. */ +@JsonPropertyOrder({ + AnonymizeUserError.JSON_PROPERTY_ERROR, + AnonymizeUserError.JSON_PROPERTY_USER_ID +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnonymizeUserError { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ERROR = "error"; + private String error; + + public static final String JSON_PROPERTY_USER_ID = "user_id"; + private String userId; + + public AnonymizeUserError() {} + + @JsonCreator + public AnonymizeUserError( + @JsonProperty(required = true, value = JSON_PROPERTY_ERROR) String error, + @JsonProperty(required = true, value = JSON_PROPERTY_USER_ID) String userId) { + this.error = error; + this.userId = userId; + } + + public AnonymizeUserError error(String error) { + this.error = error; + return this; + } + + /** + * Error message describing why anonymization failed. + * + * @return error + */ + @JsonProperty(JSON_PROPERTY_ERROR) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getError() { + return error; + } + + public void setError(String error) { + this.error = error; + } + + public AnonymizeUserError userId(String userId) { + this.userId = userId; + return this; + } + + /** + * UUID of the user that failed to be anonymized. + * + * @return userId + */ + @JsonProperty(JSON_PROPERTY_USER_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + /** + * 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 AnonymizeUserError + */ + @JsonAnySetter + public AnonymizeUserError 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 AnonymizeUserError object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnonymizeUserError anonymizeUserError = (AnonymizeUserError) o; + return Objects.equals(this.error, anonymizeUserError.error) + && Objects.equals(this.userId, anonymizeUserError.userId) + && Objects.equals(this.additionalProperties, anonymizeUserError.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(error, userId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnonymizeUserError {\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" userId: ").append(toIndentedString(userId)).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/AnonymizeUsersRequest.java b/src/main/java/com/datadog/api/client/v2/model/AnonymizeUsersRequest.java new file mode 100644 index 00000000000..ef14ac48cd9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnonymizeUsersRequest.java @@ -0,0 +1,145 @@ +/* + * 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; + +/** Request body for anonymizing users. */ +@JsonPropertyOrder({AnonymizeUsersRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnonymizeUsersRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private AnonymizeUsersRequestData data; + + public AnonymizeUsersRequest() {} + + @JsonCreator + public AnonymizeUsersRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) AnonymizeUsersRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public AnonymizeUsersRequest data(AnonymizeUsersRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Object to anonymize a list of users. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnonymizeUsersRequestData getData() { + return data; + } + + public void setData(AnonymizeUsersRequestData data) { + this.data = data; + } + + /** + * 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 AnonymizeUsersRequest + */ + @JsonAnySetter + public AnonymizeUsersRequest 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 AnonymizeUsersRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnonymizeUsersRequest anonymizeUsersRequest = (AnonymizeUsersRequest) o; + return Objects.equals(this.data, anonymizeUsersRequest.data) + && Objects.equals(this.additionalProperties, anonymizeUsersRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnonymizeUsersRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).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/AnonymizeUsersRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AnonymizeUsersRequestAttributes.java new file mode 100644 index 00000000000..a26f372b7d8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnonymizeUsersRequestAttributes.java @@ -0,0 +1,152 @@ +/* + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes of an anonymize users request. */ +@JsonPropertyOrder({AnonymizeUsersRequestAttributes.JSON_PROPERTY_USER_IDS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnonymizeUsersRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_USER_IDS = "user_ids"; + private List userIds = new ArrayList<>(); + + public AnonymizeUsersRequestAttributes() {} + + @JsonCreator + public AnonymizeUsersRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_USER_IDS) List userIds) { + this.userIds = userIds; + } + + public AnonymizeUsersRequestAttributes userIds(List userIds) { + this.userIds = userIds; + return this; + } + + public AnonymizeUsersRequestAttributes addUserIdsItem(String userIdsItem) { + this.userIds.add(userIdsItem); + return this; + } + + /** + * List of user IDs (UUIDs) to anonymize. + * + * @return userIds + */ + @JsonProperty(JSON_PROPERTY_USER_IDS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getUserIds() { + return userIds; + } + + public void setUserIds(List userIds) { + this.userIds = userIds; + } + + /** + * 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 AnonymizeUsersRequestAttributes + */ + @JsonAnySetter + public AnonymizeUsersRequestAttributes 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 AnonymizeUsersRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnonymizeUsersRequestAttributes anonymizeUsersRequestAttributes = + (AnonymizeUsersRequestAttributes) o; + return Objects.equals(this.userIds, anonymizeUsersRequestAttributes.userIds) + && Objects.equals( + this.additionalProperties, anonymizeUsersRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(userIds, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnonymizeUsersRequestAttributes {\n"); + sb.append(" userIds: ").append(toIndentedString(userIds)).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/AnonymizeUsersRequestData.java b/src/main/java/com/datadog/api/client/v2/model/AnonymizeUsersRequestData.java new file mode 100644 index 00000000000..ad4f957bdbd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnonymizeUsersRequestData.java @@ -0,0 +1,209 @@ +/* + * 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; + +/** Object to anonymize a list of users. */ +@JsonPropertyOrder({ + AnonymizeUsersRequestData.JSON_PROPERTY_ATTRIBUTES, + AnonymizeUsersRequestData.JSON_PROPERTY_ID, + AnonymizeUsersRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnonymizeUsersRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AnonymizeUsersRequestAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AnonymizeUsersRequestType type = AnonymizeUsersRequestType.ANONYMIZE_USERS_REQUEST; + + public AnonymizeUsersRequestData() {} + + @JsonCreator + public AnonymizeUsersRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + AnonymizeUsersRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AnonymizeUsersRequestType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AnonymizeUsersRequestData attributes(AnonymizeUsersRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of an anonymize users request. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnonymizeUsersRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(AnonymizeUsersRequestAttributes attributes) { + this.attributes = attributes; + } + + public AnonymizeUsersRequestData id(String id) { + this.id = id; + return this; + } + + /** + * Unique identifier for the request. Not used server-side. + * + * @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 AnonymizeUsersRequestData type(AnonymizeUsersRequestType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of the anonymize users request. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AnonymizeUsersRequestType getType() { + return type; + } + + public void setType(AnonymizeUsersRequestType 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 AnonymizeUsersRequestData + */ + @JsonAnySetter + public AnonymizeUsersRequestData 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 AnonymizeUsersRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnonymizeUsersRequestData anonymizeUsersRequestData = (AnonymizeUsersRequestData) o; + return Objects.equals(this.attributes, anonymizeUsersRequestData.attributes) + && Objects.equals(this.id, anonymizeUsersRequestData.id) + && Objects.equals(this.type, anonymizeUsersRequestData.type) + && Objects.equals( + this.additionalProperties, anonymizeUsersRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnonymizeUsersRequestData {\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/AnonymizeUsersRequestType.java b/src/main/java/com/datadog/api/client/v2/model/AnonymizeUsersRequestType.java new file mode 100644 index 00000000000..baa566ffcc5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnonymizeUsersRequestType.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; + +/** Type of the anonymize users request. */ +@JsonSerialize(using = AnonymizeUsersRequestType.AnonymizeUsersRequestTypeSerializer.class) +public class AnonymizeUsersRequestType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("anonymize_users_request")); + + public static final AnonymizeUsersRequestType ANONYMIZE_USERS_REQUEST = + new AnonymizeUsersRequestType("anonymize_users_request"); + + AnonymizeUsersRequestType(String value) { + super(value, allowedValues); + } + + public static class AnonymizeUsersRequestTypeSerializer + extends StdSerializer { + public AnonymizeUsersRequestTypeSerializer(Class t) { + super(t); + } + + public AnonymizeUsersRequestTypeSerializer() { + this(null); + } + + @Override + public void serialize( + AnonymizeUsersRequestType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AnonymizeUsersRequestType fromValue(String value) { + return new AnonymizeUsersRequestType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AnonymizeUsersResponse.java b/src/main/java/com/datadog/api/client/v2/model/AnonymizeUsersResponse.java new file mode 100644 index 00000000000..754602ecb4f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnonymizeUsersResponse.java @@ -0,0 +1,136 @@ +/* + * 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; + +/** Response containing the result of an anonymize users request. */ +@JsonPropertyOrder({AnonymizeUsersResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnonymizeUsersResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private AnonymizeUsersResponseData data; + + public AnonymizeUsersResponse data(AnonymizeUsersResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Response data for anonymizing users. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AnonymizeUsersResponseData getData() { + return data; + } + + public void setData(AnonymizeUsersResponseData data) { + this.data = data; + } + + /** + * 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 AnonymizeUsersResponse + */ + @JsonAnySetter + public AnonymizeUsersResponse 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 AnonymizeUsersResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnonymizeUsersResponse anonymizeUsersResponse = (AnonymizeUsersResponse) o; + return Objects.equals(this.data, anonymizeUsersResponse.data) + && Objects.equals(this.additionalProperties, anonymizeUsersResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnonymizeUsersResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).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/AnonymizeUsersResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/AnonymizeUsersResponseAttributes.java new file mode 100644 index 00000000000..2647434c819 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnonymizeUsersResponseAttributes.java @@ -0,0 +1,196 @@ +/* + * 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.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes of an anonymize users response. */ +@JsonPropertyOrder({ + AnonymizeUsersResponseAttributes.JSON_PROPERTY_ANONYMIZE_ERRORS, + AnonymizeUsersResponseAttributes.JSON_PROPERTY_ANONYMIZED_USER_IDS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnonymizeUsersResponseAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ANONYMIZE_ERRORS = "anonymize_errors"; + private List anonymizeErrors = new ArrayList<>(); + + public static final String JSON_PROPERTY_ANONYMIZED_USER_IDS = "anonymized_user_ids"; + private List anonymizedUserIds = new ArrayList<>(); + + public AnonymizeUsersResponseAttributes() {} + + @JsonCreator + public AnonymizeUsersResponseAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_ANONYMIZE_ERRORS) + List anonymizeErrors, + @JsonProperty(required = true, value = JSON_PROPERTY_ANONYMIZED_USER_IDS) + List anonymizedUserIds) { + this.anonymizeErrors = anonymizeErrors; + this.anonymizedUserIds = anonymizedUserIds; + } + + public AnonymizeUsersResponseAttributes anonymizeErrors( + List anonymizeErrors) { + this.anonymizeErrors = anonymizeErrors; + for (AnonymizeUserError item : anonymizeErrors) { + this.unparsed |= item.unparsed; + } + return this; + } + + public AnonymizeUsersResponseAttributes addAnonymizeErrorsItem( + AnonymizeUserError anonymizeErrorsItem) { + this.anonymizeErrors.add(anonymizeErrorsItem); + this.unparsed |= anonymizeErrorsItem.unparsed; + return this; + } + + /** + * List of errors encountered during anonymization, one entry per failed user. + * + * @return anonymizeErrors + */ + @JsonProperty(JSON_PROPERTY_ANONYMIZE_ERRORS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getAnonymizeErrors() { + return anonymizeErrors; + } + + public void setAnonymizeErrors(List anonymizeErrors) { + this.anonymizeErrors = anonymizeErrors; + } + + public AnonymizeUsersResponseAttributes anonymizedUserIds(List anonymizedUserIds) { + this.anonymizedUserIds = anonymizedUserIds; + return this; + } + + public AnonymizeUsersResponseAttributes addAnonymizedUserIdsItem(String anonymizedUserIdsItem) { + this.anonymizedUserIds.add(anonymizedUserIdsItem); + return this; + } + + /** + * List of user IDs (UUIDs) that were successfully anonymized. + * + * @return anonymizedUserIds + */ + @JsonProperty(JSON_PROPERTY_ANONYMIZED_USER_IDS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getAnonymizedUserIds() { + return anonymizedUserIds; + } + + public void setAnonymizedUserIds(List anonymizedUserIds) { + this.anonymizedUserIds = anonymizedUserIds; + } + + /** + * 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 AnonymizeUsersResponseAttributes + */ + @JsonAnySetter + public AnonymizeUsersResponseAttributes 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 AnonymizeUsersResponseAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnonymizeUsersResponseAttributes anonymizeUsersResponseAttributes = + (AnonymizeUsersResponseAttributes) o; + return Objects.equals(this.anonymizeErrors, anonymizeUsersResponseAttributes.anonymizeErrors) + && Objects.equals( + this.anonymizedUserIds, anonymizeUsersResponseAttributes.anonymizedUserIds) + && Objects.equals( + this.additionalProperties, anonymizeUsersResponseAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(anonymizeErrors, anonymizedUserIds, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnonymizeUsersResponseAttributes {\n"); + sb.append(" anonymizeErrors: ").append(toIndentedString(anonymizeErrors)).append("\n"); + sb.append(" anonymizedUserIds: ").append(toIndentedString(anonymizedUserIds)).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/AnonymizeUsersResponseData.java b/src/main/java/com/datadog/api/client/v2/model/AnonymizeUsersResponseData.java new file mode 100644 index 00000000000..7982c792683 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnonymizeUsersResponseData.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; + +/** Response data for anonymizing users. */ +@JsonPropertyOrder({ + AnonymizeUsersResponseData.JSON_PROPERTY_ATTRIBUTES, + AnonymizeUsersResponseData.JSON_PROPERTY_ID, + AnonymizeUsersResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AnonymizeUsersResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AnonymizeUsersResponseAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AnonymizeUsersResponseType type = AnonymizeUsersResponseType.ANONYMIZE_USERS_RESPONSE; + + public AnonymizeUsersResponseData attributes(AnonymizeUsersResponseAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of an anonymize users response. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AnonymizeUsersResponseAttributes getAttributes() { + return attributes; + } + + public void setAttributes(AnonymizeUsersResponseAttributes attributes) { + this.attributes = attributes; + } + + public AnonymizeUsersResponseData id(String id) { + this.id = id; + return this; + } + + /** + * Unique identifier of the response. + * + * @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 AnonymizeUsersResponseData type(AnonymizeUsersResponseType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of the anonymize users response. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AnonymizeUsersResponseType getType() { + return type; + } + + public void setType(AnonymizeUsersResponseType 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 AnonymizeUsersResponseData + */ + @JsonAnySetter + public AnonymizeUsersResponseData 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 AnonymizeUsersResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnonymizeUsersResponseData anonymizeUsersResponseData = (AnonymizeUsersResponseData) o; + return Objects.equals(this.attributes, anonymizeUsersResponseData.attributes) + && Objects.equals(this.id, anonymizeUsersResponseData.id) + && Objects.equals(this.type, anonymizeUsersResponseData.type) + && Objects.equals( + this.additionalProperties, anonymizeUsersResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnonymizeUsersResponseData {\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/AnonymizeUsersResponseType.java b/src/main/java/com/datadog/api/client/v2/model/AnonymizeUsersResponseType.java new file mode 100644 index 00000000000..5e8bec6134b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AnonymizeUsersResponseType.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; + +/** Type of the anonymize users response. */ +@JsonSerialize(using = AnonymizeUsersResponseType.AnonymizeUsersResponseTypeSerializer.class) +public class AnonymizeUsersResponseType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("anonymize_users_response")); + + public static final AnonymizeUsersResponseType ANONYMIZE_USERS_RESPONSE = + new AnonymizeUsersResponseType("anonymize_users_response"); + + AnonymizeUsersResponseType(String value) { + super(value, allowedValues); + } + + public static class AnonymizeUsersResponseTypeSerializer + extends StdSerializer { + public AnonymizeUsersResponseTypeSerializer(Class t) { + super(t); + } + + public AnonymizeUsersResponseTypeSerializer() { + this(null); + } + + @Override + public void serialize( + AnonymizeUsersResponseType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AnonymizeUsersResponseType fromValue(String value) { + return new AnonymizeUsersResponseType(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 1f11ffb7e77..1df03bf2666 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -362,6 +362,12 @@ "type": "safe" } }, + "AnonymizeUsers": { + "tag": "Users", + "undo": { + "type": "idempotent" + } + }, "ListAPIKeys": { "tag": "Key Management", "undo": { diff --git a/src/test/resources/com/datadog/api/client/v2/api/users.feature b/src/test/resources/com/datadog/api/client/v2/api/users.feature index ce27d729985..bb2f3fb989b 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/users.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/users.feature @@ -7,6 +7,22 @@ Feature: Users And a valid "appKeyAuth" key in the system And an instance of "Users" API + @generated @skip @team:DataDog/team-aaa-identity + Scenario: Anonymize users returns "Bad Request" response + Given operation "AnonymizeUsers" enabled + And new "AnonymizeUsers" request + And body with value {"data": {"attributes": {"user_ids": ["00000000-0000-0000-0000-000000000000"]}, "id": "00000000-0000-0000-0000-000000000000", "type": "anonymize_users_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/team-aaa-identity + Scenario: Anonymize users returns "OK" response + Given operation "AnonymizeUsers" enabled + And new "AnonymizeUsers" request + And body with value {"data": {"attributes": {"user_ids": ["00000000-0000-0000-0000-000000000000"]}, "id": "00000000-0000-0000-0000-000000000000", "type": "anonymize_users_request"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/team-aaa-identity Scenario: Create a user returns "Bad Request" response Given new "CreateUser" request