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
9 changes: 9 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -246626,6 +246626,15 @@ paths:
schema:
example: Active
type: string
- description: |-
Filter on the exact user handle. Also returns Datadog-managed users, which are
otherwise excluded from this list. Defaults to no filtering.
in: query
name: filter[handle]
required: false
schema:
example: example-handle
type: string
responses:
"200":
content:
Expand Down
31 changes: 31 additions & 0 deletions examples/v2/users/ListUsers_850007038.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// List all users filtered by handle 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.api.UsersApi.ListUsersOptionalParameters;
import com.datadog.api.client.v2.model.UsersResponse;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
UsersApi apiInstance = new UsersApi(defaultClient);

// there is a valid "user" in the system
String USER_DATA_ATTRIBUTES_HANDLE = System.getenv("USER_DATA_ATTRIBUTES_HANDLE");

try {
UsersResponse result =
apiInstance.listUsers(
new ListUsersOptionalParameters().filterHandle(USER_DATA_ATTRIBUTES_HANDLE));
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsersApi#listUsers");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
17 changes: 17 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 @@ -1407,6 +1407,7 @@ public static class ListUsersOptionalParameters {
private QuerySortOrder sortDir;
private String filter;
private String filterStatus;
private String filterHandle;

/**
* Set pageSize.
Expand Down Expand Up @@ -1480,6 +1481,18 @@ public ListUsersOptionalParameters filterStatus(String filterStatus) {
this.filterStatus = filterStatus;
return this;
}

/**
* Set filterHandle.
*
* @param filterHandle Filter on the exact user handle. Also returns Datadog-managed users,
* which are otherwise excluded from this list. Defaults to no filtering. (optional)
* @return ListUsersOptionalParameters
*/
public ListUsersOptionalParameters filterHandle(String filterHandle) {
this.filterHandle = filterHandle;
return this;
}
}

/**
Expand Down Expand Up @@ -1618,6 +1631,7 @@ public ApiResponse<UsersResponse> listUsersWithHttpInfo(ListUsersOptionalParamet
QuerySortOrder sortDir = parameters.sortDir;
String filter = parameters.filter;
String filterStatus = parameters.filterStatus;
String filterHandle = parameters.filterHandle;
// create path and map variables
String localVarPath = "/api/v2/users";

Expand All @@ -1630,6 +1644,7 @@ public ApiResponse<UsersResponse> listUsersWithHttpInfo(ListUsersOptionalParamet
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_dir", sortDir));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[status]", filterStatus));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[handle]", filterHandle));

Invocation.Builder builder =
apiClient.createBuilder(
Expand Down Expand Up @@ -1668,6 +1683,7 @@ public CompletableFuture<ApiResponse<UsersResponse>> listUsersWithHttpInfoAsync(
QuerySortOrder sortDir = parameters.sortDir;
String filter = parameters.filter;
String filterStatus = parameters.filterStatus;
String filterHandle = parameters.filterHandle;
// create path and map variables
String localVarPath = "/api/v2/users";

Expand All @@ -1680,6 +1696,7 @@ public CompletableFuture<ApiResponse<UsersResponse>> listUsersWithHttpInfoAsync(
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_dir", sortDir));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[status]", filterStatus));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[handle]", filterHandle));

Invocation.Builder builder;
try {
Expand Down
10 changes: 10 additions & 0 deletions src/test/resources/com/datadog/api/client/v2/api/users.feature
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,16 @@ Feature: Users
And the response "data.type" is equal to "users"
And the response "data.attributes.handle" is equal to "{{ unique_lower }}@datadoghq.com"

@team:ddoghq/org-management
Scenario: List all users filtered by handle returns "OK" response
Given there is a valid "user" in the system
And new "ListUsers" request
And request contains "filter[handle]" parameter from "user.data.attributes.handle"
When the request is sent
Then the response status is 200 OK
And the response "meta.page.total_filtered_count" is equal to 1
And the response "data[0].id" has the same value as "user.data.id"

@generated @skip @team:ddoghq/org-management
Scenario: List all users returns "Bad Request" response
Given new "ListUsers" request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12334,6 +12334,13 @@
"scenario": "Get user details returns \"OK\" response",
"version": "v2"
},
{
"feature": "Users",
"feature_file": "../../com/datadog/api/client/v2/api/users.feature",
"file": "v2/users/list-all-users-filtered-by-handle-returns-ok-response.json",
"scenario": "List all users filtered by handle returns \"OK\" response",
"version": "v2"
},
{
"feature": "Users",
"feature_file": "../../com/datadog/api/client/v2/api/users.feature",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"api": "Users",
"expected_status": 200,
"feature": "Users",
"id": "v2/Users/List all users filtered by handle returns \"OK\" response",
"operation_id": "ListUsers",
"request": {
"body": null,
"content_type": null,
"method": "GET",
"pagination": false,
"parameters": [
{
"explode": null,
"in": "query",
"name": "filter[handle]",
"required": false,
"schema": {
"format": null,
"ref": null,
"type": "string"
},
"source": {
"path": "user.data.attributes.handle",
"type": "fixture"
},
"style": null
}
],
"path": "/api/v2/users"
},
"scenario": "List all users filtered by handle returns \"OK\" response",
"schema_version": 1,
"version": "v2"
}
Loading