Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 155 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down
41 changes: 41 additions & 0 deletions examples/v2/users/AnonymizeUsers.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
}
1 change: 1 addition & 0 deletions src/main/java/com/datadog/api/client/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
151 changes: 151 additions & 0 deletions src/main/java/com/datadog/api/client/v2/api/UsersApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -55,6 +57,155 @@ public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}

/**
* Anonymize users.
*
* <p>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.
*
* <p>See {@link #anonymizeUsersWithHttpInfoAsync}.
*
* @param body (required)
* @return CompletableFuture&lt;AnonymizeUsersResponse&gt;
*/
public CompletableFuture<AnonymizeUsersResponse> 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 <code>user_access_manage</code> permission.
*
* @param body (required)
* @return ApiResponse&lt;AnonymizeUsersResponse&gt;
* @throws ApiException if fails to make API call
* @http.response.details
* <table border="1">
* <caption>Response details</caption>
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
* <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr>
* <tr><td> 403 </td><td> Authentication error </td><td> - </td></tr>
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
* </table>
*/
public ApiResponse<AnonymizeUsersResponse> 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<String, String> localVarHeaderParams = new HashMap<String, String>();

Invocation.Builder builder =
apiClient.createBuilder(
"v2.UsersApi.anonymizeUsers",
localVarPath,
new ArrayList<Pair>(),
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"application/json"},
new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"});
return apiClient.invokeAPI(
"PUT",
builder,
localVarHeaderParams,
new String[] {"application/json"},
localVarPostBody,
new HashMap<String, Object>(),
false,
new GenericType<AnonymizeUsersResponse>() {});
}

/**
* Anonymize users.
*
* <p>See {@link #anonymizeUsersWithHttpInfo}.
*
* @param body (required)
* @return CompletableFuture&lt;ApiResponse&lt;AnonymizeUsersResponse&gt;&gt;
*/
public CompletableFuture<ApiResponse<AnonymizeUsersResponse>> 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<ApiResponse<AnonymizeUsersResponse>> 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<ApiResponse<AnonymizeUsersResponse>> 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<String, String> localVarHeaderParams = new HashMap<String, String>();

Invocation.Builder builder;
try {
builder =
apiClient.createBuilder(
"v2.UsersApi.anonymizeUsers",
localVarPath,
new ArrayList<Pair>(),
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"application/json"},
new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"});
} catch (ApiException ex) {
CompletableFuture<ApiResponse<AnonymizeUsersResponse>> result = new CompletableFuture<>();
result.completeExceptionally(ex);
return result;
}
return apiClient.invokeAPIAsync(
"PUT",
builder,
localVarHeaderParams,
new String[] {"application/json"},
localVarPostBody,
new HashMap<String, Object>(),
false,
new GenericType<AnonymizeUsersResponse>() {});
}

/**
* Create a user.
*
Expand Down
Loading
Loading