Skip to content

Commit 078bba5

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 50be271 of spec repo
1 parent c55b731 commit 078bba5

6 files changed

Lines changed: 100 additions & 0 deletions

File tree

‎.generator/schemas/v2/openapi.yaml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249124,6 +249124,15 @@ paths:
249124249124
schema:
249125249125
example: Active
249126249126
type: string
249127+
- description: |-
249128+
Filter on the exact user handle. This filter also returns Datadog-managed users,
249129+
which the list otherwise excludes. Defaults to no filtering.
249130+
in: query
249131+
name: filter[handle]
249132+
required: false
249133+
schema:
249134+
example: example-handle
249135+
type: string
249127249136
responses:
249128249137
"200":
249129249138
content:
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"""
2+
List all users filtered by handle returns "OK" response
3+
"""
4+
5+
from os import environ
6+
from datadog_api_client import ApiClient, Configuration
7+
from datadog_api_client.v2.api.users_api import UsersApi
8+
9+
# there is a valid "user" in the system
10+
USER_DATA_ATTRIBUTES_HANDLE = environ["USER_DATA_ATTRIBUTES_HANDLE"]
11+
12+
configuration = Configuration()
13+
configuration.access_token = environ["DD_BEARER_TOKEN"]
14+
with ApiClient(configuration) as api_client:
15+
api_instance = UsersApi(api_client)
16+
response = api_instance.list_users(
17+
filter_handle=USER_DATA_ATTRIBUTES_HANDLE,
18+
)
19+
20+
print(response)

‎src/datadog_api_client/v2/api/users_api.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,11 @@ def __init__(self, api_client=None):
298298
"attribute": "filter[status]",
299299
"location": "query",
300300
},
301+
"filter_handle": {
302+
"openapi_types": (str,),
303+
"attribute": "filter[handle]",
304+
"location": "query",
305+
},
301306
},
302307
headers_map={
303308
"accept": ["application/json"],
@@ -579,6 +584,7 @@ def list_users(
579584
sort_dir: Union[QuerySortOrder, UnsetType] = unset,
580585
filter: Union[str, UnsetType] = unset,
581586
filter_status: Union[str, UnsetType] = unset,
587+
filter_handle: Union[str, UnsetType] = unset,
582588
) -> UsersResponse:
583589
"""List all users.
584590
@@ -602,6 +608,9 @@ def list_users(
602608
Comma separated list, with possible values ``Active`` , ``Pending`` , and ``Disabled``.
603609
Defaults to no filtering.
604610
:type filter_status: str, optional
611+
:param filter_handle: Filter on the exact user handle. This filter also returns Datadog-managed users,
612+
which the list otherwise excludes. Defaults to no filtering.
613+
:type filter_handle: str, optional
605614
:rtype: UsersResponse
606615
"""
607616
kwargs: Dict[str, Any] = {}
@@ -623,6 +632,9 @@ def list_users(
623632
if filter_status is not unset:
624633
kwargs["filter_status"] = filter_status
625634

635+
if filter_handle is not unset:
636+
kwargs["filter_handle"] = filter_handle
637+
626638
return self._list_users_endpoint.call_with_http_info(**kwargs)
627639

628640
def list_users_with_pagination(
@@ -634,6 +646,7 @@ def list_users_with_pagination(
634646
sort_dir: Union[QuerySortOrder, UnsetType] = unset,
635647
filter: Union[str, UnsetType] = unset,
636648
filter_status: Union[str, UnsetType] = unset,
649+
filter_handle: Union[str, UnsetType] = unset,
637650
) -> collections.abc.Iterable[User]:
638651
"""List all users.
639652
@@ -656,6 +669,9 @@ def list_users_with_pagination(
656669
Comma separated list, with possible values ``Active`` , ``Pending`` , and ``Disabled``.
657670
Defaults to no filtering.
658671
:type filter_status: str, optional
672+
:param filter_handle: Filter on the exact user handle. This filter also returns Datadog-managed users,
673+
which the list otherwise excludes. Defaults to no filtering.
674+
:type filter_handle: str, optional
659675
660676
:return: A generator of paginated results.
661677
:rtype: collections.abc.Iterable[User]
@@ -679,6 +695,9 @@ def list_users_with_pagination(
679695
if filter_status is not unset:
680696
kwargs["filter_status"] = filter_status
681697

698+
if filter_handle is not unset:
699+
kwargs["filter_handle"] = filter_handle
700+
682701
local_page_size = get_attribute_from_path(kwargs, "page_size", 10)
683702
endpoint = self._list_users_endpoint
684703
set_attribute_from_path(kwargs, "page_size", local_page_size, endpoint.params_map)

‎tests/generated-test/test-runner-data/manifest.json‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12614,6 +12614,13 @@
1261412614
"scenario": "Get user details returns \"OK\" response",
1261512615
"version": "v2"
1261612616
},
12617+
{
12618+
"feature": "Users",
12619+
"feature_file": "../../v2/features/users.feature",
12620+
"file": "v2/users/list-all-users-filtered-by-handle-returns-ok-response.json",
12621+
"scenario": "List all users filtered by handle returns \"OK\" response",
12622+
"version": "v2"
12623+
},
1261712624
{
1261812625
"feature": "Users",
1261912626
"feature_file": "../../v2/features/users.feature",
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"api": "Users",
3+
"expected_status": 200,
4+
"feature": "Users",
5+
"id": "v2/Users/List all users filtered by handle returns \"OK\" response",
6+
"operation_id": "ListUsers",
7+
"request": {
8+
"body": null,
9+
"content_type": null,
10+
"method": "GET",
11+
"pagination": false,
12+
"parameters": [
13+
{
14+
"explode": null,
15+
"in": "query",
16+
"name": "filter[handle]",
17+
"required": false,
18+
"schema": {
19+
"format": null,
20+
"ref": null,
21+
"type": "string"
22+
},
23+
"source": {
24+
"path": "user.data.attributes.handle",
25+
"type": "fixture"
26+
},
27+
"style": null
28+
}
29+
],
30+
"path": "/api/v2/users"
31+
},
32+
"scenario": "List all users filtered by handle returns \"OK\" response",
33+
"schema_version": 1,
34+
"version": "v2"
35+
}

‎tests/v2/features/users.feature‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,16 @@ Feature: Users
156156
And the response "data.type" is equal to "users"
157157
And the response "data.attributes.handle" is equal to "{{ unique_lower }}@datadoghq.com"
158158

159+
@team:ddoghq/org-management
160+
Scenario: List all users filtered by handle returns "OK" response
161+
Given there is a valid "user" in the system
162+
And new "ListUsers" request
163+
And request contains "filter[handle]" parameter from "user.data.attributes.handle"
164+
When the request is sent
165+
Then the response status is 200 OK
166+
And the response "meta.page.total_filtered_count" is equal to 1
167+
And the response "data[0].id" has the same value as "user.data.id"
168+
159169
@generated @skip @team:ddoghq/org-management
160170
Scenario: List all users returns "Bad Request" response
161171
Given new "ListUsers" request

0 commit comments

Comments
 (0)