Skip to content

Commit 2ce0591

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit ce55d33 of spec repo
1 parent 1139196 commit 2ce0591

15 files changed

Lines changed: 1692 additions & 0 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3980,6 +3980,114 @@ components:
39803980
description: The `markdownTextAnnotation` `text`.
39813981
type: string
39823982
type: object
3983+
AnonymizeUserError:
3984+
description: Error encountered when anonymizing a specific user.
3985+
properties:
3986+
error:
3987+
description: Error message describing why anonymization failed.
3988+
example: ""
3989+
type: string
3990+
user_id:
3991+
description: UUID of the user that failed to be anonymized.
3992+
example: "00000000-0000-0000-0000-000000000000"
3993+
type: string
3994+
required:
3995+
- user_id
3996+
- error
3997+
type: object
3998+
AnonymizeUsersRequest:
3999+
description: Request body for anonymizing users.
4000+
properties:
4001+
data:
4002+
$ref: "#/components/schemas/AnonymizeUsersRequestData"
4003+
required:
4004+
- data
4005+
type: object
4006+
AnonymizeUsersRequestAttributes:
4007+
description: Attributes of an anonymize users request.
4008+
properties:
4009+
user_ids:
4010+
description: List of user IDs (UUIDs) to anonymize.
4011+
example:
4012+
- "00000000-0000-0000-0000-000000000000"
4013+
items:
4014+
example: "00000000-0000-0000-0000-000000000000"
4015+
type: string
4016+
type: array
4017+
required:
4018+
- user_ids
4019+
type: object
4020+
AnonymizeUsersRequestData:
4021+
description: Object to anonymize a list of users.
4022+
properties:
4023+
attributes:
4024+
$ref: "#/components/schemas/AnonymizeUsersRequestAttributes"
4025+
id:
4026+
description: Unique identifier for the request. Not used server-side.
4027+
example: "00000000-0000-0000-0000-000000000000"
4028+
type: string
4029+
type:
4030+
$ref: "#/components/schemas/AnonymizeUsersRequestType"
4031+
required:
4032+
- type
4033+
- attributes
4034+
type: object
4035+
AnonymizeUsersRequestType:
4036+
default: anonymize_users_request
4037+
description: Type of the anonymize users request.
4038+
enum:
4039+
- anonymize_users_request
4040+
example: anonymize_users_request
4041+
type: string
4042+
x-enum-varnames:
4043+
- ANONYMIZE_USERS_REQUEST
4044+
AnonymizeUsersResponse:
4045+
description: Response containing the result of an anonymize users request.
4046+
properties:
4047+
data:
4048+
$ref: "#/components/schemas/AnonymizeUsersResponseData"
4049+
type: object
4050+
AnonymizeUsersResponseAttributes:
4051+
description: Attributes of an anonymize users response.
4052+
properties:
4053+
anonymize_errors:
4054+
description: List of errors encountered during anonymization, one entry per failed user.
4055+
items:
4056+
$ref: "#/components/schemas/AnonymizeUserError"
4057+
type: array
4058+
anonymized_user_ids:
4059+
description: List of user IDs (UUIDs) that were successfully anonymized.
4060+
example:
4061+
- "00000000-0000-0000-0000-000000000000"
4062+
items:
4063+
example: "00000000-0000-0000-0000-000000000000"
4064+
type: string
4065+
type: array
4066+
required:
4067+
- anonymized_user_ids
4068+
- anonymize_errors
4069+
type: object
4070+
AnonymizeUsersResponseData:
4071+
description: Response data for anonymizing users.
4072+
properties:
4073+
attributes:
4074+
$ref: "#/components/schemas/AnonymizeUsersResponseAttributes"
4075+
id:
4076+
description: Unique identifier of the response.
4077+
example: "00000000-0000-0000-0000-000000000000"
4078+
type: string
4079+
type:
4080+
$ref: "#/components/schemas/AnonymizeUsersResponseType"
4081+
type: object
4082+
AnonymizeUsersResponseType:
4083+
default: anonymize_users_response
4084+
description: Type of the anonymize users response.
4085+
enum:
4086+
- anonymize_users_response
4087+
example: anonymize_users_response
4088+
type: string
4089+
x-enum-varnames:
4090+
- ANONYMIZE_USERS_RESPONSE
39834091
AnthropicAPIKey:
39844092
description: The definition of the `AnthropicAPIKey` object.
39854093
properties:
@@ -82971,6 +83079,53 @@ paths:
8297183079
operator: OR
8297283080
permissions:
8297383081
- security_monitoring_findings_read
83082+
/api/v2/anonymize_users:
83083+
put:
83084+
description: |-
83085+
Anonymize a list of users, removing their personal data. This operation is irreversible.
83086+
Requires the `user_access_manage` permission.
83087+
operationId: AnonymizeUsers
83088+
requestBody:
83089+
content:
83090+
application/json:
83091+
schema:
83092+
$ref: "#/components/schemas/AnonymizeUsersRequest"
83093+
required: true
83094+
responses:
83095+
"200":
83096+
content:
83097+
application/json:
83098+
schema:
83099+
$ref: "#/components/schemas/AnonymizeUsersResponse"
83100+
description: OK
83101+
"400":
83102+
content:
83103+
application/json:
83104+
schema:
83105+
$ref: "#/components/schemas/APIErrorResponse"
83106+
description: Bad Request
83107+
"403":
83108+
content:
83109+
application/json:
83110+
schema:
83111+
$ref: "#/components/schemas/APIErrorResponse"
83112+
description: Authentication error
83113+
"429":
83114+
$ref: "#/components/responses/TooManyRequestsResponse"
83115+
security:
83116+
- apiKeyAuth: []
83117+
appKeyAuth: []
83118+
- AuthZ:
83119+
- user_access_manage
83120+
summary: Anonymize users
83121+
tags:
83122+
- Users
83123+
x-codegen-request-body-name: body
83124+
x-permission:
83125+
operator: OR
83126+
permissions:
83127+
- user_access_manage
83128+
x-unstable: "**Note**: This endpoint is in Preview and may be subject to changes."
8297483129
/api/v2/api_keys:
8297583130
get:
8297683131
description: List all API keys available for your account.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Anonymize users returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.UsersApi;
6+
import com.datadog.api.client.v2.model.AnonymizeUsersRequest;
7+
import com.datadog.api.client.v2.model.AnonymizeUsersRequestAttributes;
8+
import com.datadog.api.client.v2.model.AnonymizeUsersRequestData;
9+
import com.datadog.api.client.v2.model.AnonymizeUsersRequestType;
10+
import com.datadog.api.client.v2.model.AnonymizeUsersResponse;
11+
import java.util.Collections;
12+
13+
public class Example {
14+
public static void main(String[] args) {
15+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
16+
defaultClient.setUnstableOperationEnabled("v2.anonymizeUsers", true);
17+
UsersApi apiInstance = new UsersApi(defaultClient);
18+
19+
AnonymizeUsersRequest body =
20+
new AnonymizeUsersRequest()
21+
.data(
22+
new AnonymizeUsersRequestData()
23+
.attributes(
24+
new AnonymizeUsersRequestAttributes()
25+
.userIds(
26+
Collections.singletonList("00000000-0000-0000-0000-000000000000")))
27+
.id("00000000-0000-0000-0000-000000000000")
28+
.type(AnonymizeUsersRequestType.ANONYMIZE_USERS_REQUEST));
29+
30+
try {
31+
AnonymizeUsersResponse result = apiInstance.anonymizeUsers(body);
32+
System.out.println(result);
33+
} catch (ApiException e) {
34+
System.err.println("Exception when calling UsersApi#anonymizeUsers");
35+
System.err.println("Status code: " + e.getCode());
36+
System.err.println("Reason: " + e.getResponseBody());
37+
System.err.println("Response headers: " + e.getResponseHeaders());
38+
e.printStackTrace();
39+
}
40+
}
41+
}

src/main/java/com/datadog/api/client/ApiClient.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,7 @@ public class ApiClient {
795795
put("v2.updateLLMObsDatasetRecords", false);
796796
put("v2.updateLLMObsExperiment", false);
797797
put("v2.updateLLMObsProject", false);
798+
put("v2.anonymizeUsers", false);
798799
put("v2.createOpenAPI", false);
799800
put("v2.deleteOpenAPI", false);
800801
put("v2.getOpenAPI", false);

src/main/java/com/datadog/api/client/v2/api/UsersApi.java

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import com.datadog.api.client.ApiResponse;
66
import com.datadog.api.client.PaginationIterable;
77
import com.datadog.api.client.Pair;
8+
import com.datadog.api.client.v2.model.AnonymizeUsersRequest;
9+
import com.datadog.api.client.v2.model.AnonymizeUsersResponse;
810
import com.datadog.api.client.v2.model.PermissionsResponse;
911
import com.datadog.api.client.v2.model.QuerySortOrder;
1012
import com.datadog.api.client.v2.model.User;
@@ -55,6 +57,155 @@ public void setApiClient(ApiClient apiClient) {
5557
this.apiClient = apiClient;
5658
}
5759

60+
/**
61+
* Anonymize users.
62+
*
63+
* <p>See {@link #anonymizeUsersWithHttpInfo}.
64+
*
65+
* @param body (required)
66+
* @return AnonymizeUsersResponse
67+
* @throws ApiException if fails to make API call
68+
*/
69+
public AnonymizeUsersResponse anonymizeUsers(AnonymizeUsersRequest body) throws ApiException {
70+
return anonymizeUsersWithHttpInfo(body).getData();
71+
}
72+
73+
/**
74+
* Anonymize users.
75+
*
76+
* <p>See {@link #anonymizeUsersWithHttpInfoAsync}.
77+
*
78+
* @param body (required)
79+
* @return CompletableFuture&lt;AnonymizeUsersResponse&gt;
80+
*/
81+
public CompletableFuture<AnonymizeUsersResponse> anonymizeUsersAsync(AnonymizeUsersRequest body) {
82+
return anonymizeUsersWithHttpInfoAsync(body)
83+
.thenApply(
84+
response -> {
85+
return response.getData();
86+
});
87+
}
88+
89+
/**
90+
* Anonymize a list of users, removing their personal data. This operation is irreversible.
91+
* Requires the <code>user_access_manage</code> permission.
92+
*
93+
* @param body (required)
94+
* @return ApiResponse&lt;AnonymizeUsersResponse&gt;
95+
* @throws ApiException if fails to make API call
96+
* @http.response.details
97+
* <table border="1">
98+
* <caption>Response details</caption>
99+
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
100+
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
101+
* <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr>
102+
* <tr><td> 403 </td><td> Authentication error </td><td> - </td></tr>
103+
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
104+
* </table>
105+
*/
106+
public ApiResponse<AnonymizeUsersResponse> anonymizeUsersWithHttpInfo(AnonymizeUsersRequest body)
107+
throws ApiException {
108+
// Check if unstable operation is enabled
109+
String operationId = "anonymizeUsers";
110+
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
111+
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
112+
} else {
113+
throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId));
114+
}
115+
Object localVarPostBody = body;
116+
117+
// verify the required parameter 'body' is set
118+
if (body == null) {
119+
throw new ApiException(
120+
400, "Missing the required parameter 'body' when calling anonymizeUsers");
121+
}
122+
// create path and map variables
123+
String localVarPath = "/api/v2/anonymize_users";
124+
125+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
126+
127+
Invocation.Builder builder =
128+
apiClient.createBuilder(
129+
"v2.UsersApi.anonymizeUsers",
130+
localVarPath,
131+
new ArrayList<Pair>(),
132+
localVarHeaderParams,
133+
new HashMap<String, String>(),
134+
new String[] {"application/json"},
135+
new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"});
136+
return apiClient.invokeAPI(
137+
"PUT",
138+
builder,
139+
localVarHeaderParams,
140+
new String[] {"application/json"},
141+
localVarPostBody,
142+
new HashMap<String, Object>(),
143+
false,
144+
new GenericType<AnonymizeUsersResponse>() {});
145+
}
146+
147+
/**
148+
* Anonymize users.
149+
*
150+
* <p>See {@link #anonymizeUsersWithHttpInfo}.
151+
*
152+
* @param body (required)
153+
* @return CompletableFuture&lt;ApiResponse&lt;AnonymizeUsersResponse&gt;&gt;
154+
*/
155+
public CompletableFuture<ApiResponse<AnonymizeUsersResponse>> anonymizeUsersWithHttpInfoAsync(
156+
AnonymizeUsersRequest body) {
157+
// Check if unstable operation is enabled
158+
String operationId = "anonymizeUsers";
159+
if (apiClient.isUnstableOperationEnabled("v2." + operationId)) {
160+
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
161+
} else {
162+
CompletableFuture<ApiResponse<AnonymizeUsersResponse>> result = new CompletableFuture<>();
163+
result.completeExceptionally(
164+
new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)));
165+
return result;
166+
}
167+
Object localVarPostBody = body;
168+
169+
// verify the required parameter 'body' is set
170+
if (body == null) {
171+
CompletableFuture<ApiResponse<AnonymizeUsersResponse>> result = new CompletableFuture<>();
172+
result.completeExceptionally(
173+
new ApiException(
174+
400, "Missing the required parameter 'body' when calling anonymizeUsers"));
175+
return result;
176+
}
177+
// create path and map variables
178+
String localVarPath = "/api/v2/anonymize_users";
179+
180+
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
181+
182+
Invocation.Builder builder;
183+
try {
184+
builder =
185+
apiClient.createBuilder(
186+
"v2.UsersApi.anonymizeUsers",
187+
localVarPath,
188+
new ArrayList<Pair>(),
189+
localVarHeaderParams,
190+
new HashMap<String, String>(),
191+
new String[] {"application/json"},
192+
new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"});
193+
} catch (ApiException ex) {
194+
CompletableFuture<ApiResponse<AnonymizeUsersResponse>> result = new CompletableFuture<>();
195+
result.completeExceptionally(ex);
196+
return result;
197+
}
198+
return apiClient.invokeAPIAsync(
199+
"PUT",
200+
builder,
201+
localVarHeaderParams,
202+
new String[] {"application/json"},
203+
localVarPostBody,
204+
new HashMap<String, Object>(),
205+
false,
206+
new GenericType<AnonymizeUsersResponse>() {});
207+
}
208+
58209
/**
59210
* Create a user.
60211
*

0 commit comments

Comments
 (0)