Skip to content

Commit 780a107

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 1807d3d of spec repo
1 parent b481b06 commit 780a107

File tree

15 files changed

+1692
-0
lines changed

15 files changed

+1692
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3734,6 +3734,114 @@ components:
37343734
description: The `markdownTextAnnotation` `text`.
37353735
type: string
37363736
type: object
3737+
AnonymizeUserError:
3738+
description: Error encountered when anonymizing a specific user.
3739+
properties:
3740+
error:
3741+
description: Error message describing why anonymization failed.
3742+
example: ""
3743+
type: string
3744+
user_id:
3745+
description: UUID of the user that failed to be anonymized.
3746+
example: "00000000-0000-0000-0000-000000000000"
3747+
type: string
3748+
required:
3749+
- user_id
3750+
- error
3751+
type: object
3752+
AnonymizeUsersRequest:
3753+
description: Request body for anonymizing users.
3754+
properties:
3755+
data:
3756+
$ref: "#/components/schemas/AnonymizeUsersRequestData"
3757+
required:
3758+
- data
3759+
type: object
3760+
AnonymizeUsersRequestAttributes:
3761+
description: Attributes of an anonymize users request.
3762+
properties:
3763+
user_ids:
3764+
description: List of user IDs (UUIDs) to anonymize.
3765+
example:
3766+
- "00000000-0000-0000-0000-000000000000"
3767+
items:
3768+
example: "00000000-0000-0000-0000-000000000000"
3769+
type: string
3770+
type: array
3771+
required:
3772+
- user_ids
3773+
type: object
3774+
AnonymizeUsersRequestData:
3775+
description: Object to anonymize a list of users.
3776+
properties:
3777+
attributes:
3778+
$ref: "#/components/schemas/AnonymizeUsersRequestAttributes"
3779+
id:
3780+
description: Unique identifier for the request. Not used server-side.
3781+
example: "00000000-0000-0000-0000-000000000000"
3782+
type: string
3783+
type:
3784+
$ref: "#/components/schemas/AnonymizeUsersRequestType"
3785+
required:
3786+
- type
3787+
- attributes
3788+
type: object
3789+
AnonymizeUsersRequestType:
3790+
default: anonymize_users_request
3791+
description: Type of the anonymize users request.
3792+
enum:
3793+
- anonymize_users_request
3794+
example: anonymize_users_request
3795+
type: string
3796+
x-enum-varnames:
3797+
- ANONYMIZE_USERS_REQUEST
3798+
AnonymizeUsersResponse:
3799+
description: Response containing the result of an anonymize users request.
3800+
properties:
3801+
data:
3802+
$ref: "#/components/schemas/AnonymizeUsersResponseData"
3803+
type: object
3804+
AnonymizeUsersResponseAttributes:
3805+
description: Attributes of an anonymize users response.
3806+
properties:
3807+
anonymize_errors:
3808+
description: List of errors encountered during anonymization, one entry per failed user.
3809+
items:
3810+
$ref: "#/components/schemas/AnonymizeUserError"
3811+
type: array
3812+
anonymized_user_ids:
3813+
description: List of user IDs (UUIDs) that were successfully anonymized.
3814+
example:
3815+
- "00000000-0000-0000-0000-000000000000"
3816+
items:
3817+
example: "00000000-0000-0000-0000-000000000000"
3818+
type: string
3819+
type: array
3820+
required:
3821+
- anonymized_user_ids
3822+
- anonymize_errors
3823+
type: object
3824+
AnonymizeUsersResponseData:
3825+
description: Response data for anonymizing users.
3826+
properties:
3827+
attributes:
3828+
$ref: "#/components/schemas/AnonymizeUsersResponseAttributes"
3829+
id:
3830+
description: Unique identifier of the response.
3831+
example: "00000000-0000-0000-0000-000000000000"
3832+
type: string
3833+
type:
3834+
$ref: "#/components/schemas/AnonymizeUsersResponseType"
3835+
type: object
3836+
AnonymizeUsersResponseType:
3837+
default: anonymize_users_response
3838+
description: Type of the anonymize users response.
3839+
enum:
3840+
- anonymize_users_response
3841+
example: anonymize_users_response
3842+
type: string
3843+
x-enum-varnames:
3844+
- ANONYMIZE_USERS_RESPONSE
37373845
AnthropicAPIKey:
37383846
description: The definition of the `AnthropicAPIKey` object.
37393847
properties:
@@ -76578,6 +76686,53 @@ paths:
7657876686
operator: OR
7657976687
permissions:
7658076688
- security_monitoring_findings_read
76689+
/api/v2/anonymize_users:
76690+
put:
76691+
description: |-
76692+
Anonymize a list of users, removing their personal data. This operation is irreversible.
76693+
Requires the `user_access_manage` permission.
76694+
operationId: AnonymizeUsers
76695+
requestBody:
76696+
content:
76697+
application/json:
76698+
schema:
76699+
$ref: "#/components/schemas/AnonymizeUsersRequest"
76700+
required: true
76701+
responses:
76702+
"200":
76703+
content:
76704+
application/json:
76705+
schema:
76706+
$ref: "#/components/schemas/AnonymizeUsersResponse"
76707+
description: OK
76708+
"400":
76709+
content:
76710+
application/json:
76711+
schema:
76712+
$ref: "#/components/schemas/APIErrorResponse"
76713+
description: Bad Request
76714+
"403":
76715+
content:
76716+
application/json:
76717+
schema:
76718+
$ref: "#/components/schemas/APIErrorResponse"
76719+
description: Authentication error
76720+
"429":
76721+
$ref: "#/components/responses/TooManyRequestsResponse"
76722+
security:
76723+
- apiKeyAuth: []
76724+
appKeyAuth: []
76725+
- AuthZ:
76726+
- user_access_manage
76727+
summary: Anonymize users
76728+
tags:
76729+
- Users
76730+
x-codegen-request-body-name: body
76731+
x-permission:
76732+
operator: OR
76733+
permissions:
76734+
- user_access_manage
76735+
x-unstable: "**Note**: This endpoint is in Preview and may be subject to changes."
7658176736
/api/v2/api_keys:
7658276737
get:
7658376738
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
@@ -764,6 +764,7 @@ public class ApiClient {
764764
put("v2.listFleetSchedules", false);
765765
put("v2.triggerFleetSchedule", false);
766766
put("v2.updateFleetSchedule", false);
767+
put("v2.anonymizeUsers", false);
767768
put("v2.createOpenAPI", false);
768769
put("v2.deleteOpenAPI", false);
769770
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)