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 @@ -249124,6 +249124,15 @@ paths:
schema:
example: Active
type: string
- description: |-
Filter on the exact user handle. This filter also returns Datadog-managed users,
which the list otherwise excludes. Defaults to no filtering.
in: query
name: filter[handle]
required: false
schema:
example: example-handle
type: string
responses:
"200":
content:
Expand Down
14 changes: 14 additions & 0 deletions examples/v2/users/ListUsers_850007038.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# List all users filtered by handle returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::UsersAPI.new

# there is a valid "user" in the system
USER_DATA_ATTRIBUTES_HANDLE = ENV["USER_DATA_ATTRIBUTES_HANDLE"]
opts = {
filter_handle: USER_DATA_ATTRIBUTES_HANDLE,
}
p api_instance.list_users(opts)
1 change: 1 addition & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,7 @@
"sort_dir" => "QuerySortOrder",
"filter" => "String",
"filter_status" => "String",
"filter_handle" => "String",
},
"v2.CreateUser" => {
"body" => "UserCreateRequest",
Expand Down
10 changes: 10 additions & 0 deletions features/v2/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
7 changes: 7 additions & 0 deletions generated-test/test-runner-data/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12614,6 +12614,13 @@
"scenario": "Get user details returns \"OK\" response",
"version": "v2"
},
{
"feature": "Users",
"feature_file": "../../features/v2/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": "../../features/v2/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"
}
2 changes: 2 additions & 0 deletions lib/datadog_api_client/v2/api/users_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ def list_users(opts = {})
# @option opts [QuerySortOrder] :sort_dir Direction of sort. Options: `asc`, `desc`.
# @option opts [String] :filter Filter all users by the given string. Defaults to no filtering.
# @option opts [String] :filter_status Filter on status attribute. Comma separated list, with possible values `Active`, `Pending`, and `Disabled`. Defaults to no filtering.
# @option opts [String] :filter_handle Filter on the exact user handle. This filter also returns Datadog-managed users, which the list otherwise excludes. Defaults to no filtering.
# @return [Array<(UsersResponse, Integer, Hash)>] UsersResponse data, response status code and response headers
def list_users_with_http_info(opts = {})

Expand All @@ -729,6 +730,7 @@ def list_users_with_http_info(opts = {})
query_params[:'sort_dir'] = opts[:'sort_dir'] if !opts[:'sort_dir'].nil?
query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
query_params[:'filter[status]'] = opts[:'filter_status'] if !opts[:'filter_status'].nil?
query_params[:'filter[handle]'] = opts[:'filter_handle'] if !opts[:'filter_handle'].nil?

# header parameters
header_params = opts[:header_params] || {}
Expand Down
Loading