Skip to content

Commit 0a69195

Browse files
api-clients-generation-pipeline[bot]jirikuncarci.datadog-api-spec
authored
Add filter parameter for listing teams and services (#148)
* Fix incident related tests * Fix incident related tests * Fix incident related tests * Regenerate client from commit 6a8fa99 of spec repo Co-authored-by: Jiri Kuncar <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 2ce94ee commit 0a69195

15 files changed

+144
-80
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.3.0",
7-
"regenerated": "2020-11-11 14:04:17.890709",
8-
"spec_repo_commit": "99c92ca"
7+
"regenerated": "2020-11-12 14:38:24.654767",
8+
"spec_repo_commit": "6a8fa99"
99
},
1010
"v2": {
1111
"apigentools_version": "1.3.0",
12-
"regenerated": "2020-11-11 14:04:27.637287",
13-
"spec_repo_commit": "99c92ca"
12+
"regenerated": "2020-11-12 14:38:35.318198",
13+
"spec_repo_commit": "6a8fa99"
1414
}
1515
}
1616
}

docs/v2/IncidentServicesApi.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Method | HTTP request | Description
77
[**create_incident_service**](IncidentServicesApi.md#create_incident_service) | **POST** /api/v2/services | Create a new incident service
88
[**delete_incident_service**](IncidentServicesApi.md#delete_incident_service) | **DELETE** /api/v2/services/{service_id} | Delete an existing incident service
99
[**get_incident_service**](IncidentServicesApi.md#get_incident_service) | **GET** /api/v2/services/{service_id} | Get details of an incident service
10-
[**get_incident_services**](IncidentServicesApi.md#get_incident_services) | **GET** /api/v2/services | Get a list of all incident services
10+
[**list_incident_services**](IncidentServicesApi.md#list_incident_services) | **GET** /api/v2/services | Get a list of all incident services
1111
[**update_incident_service**](IncidentServicesApi.md#update_incident_service) | **PATCH** /api/v2/services/{service_id} | Update an existing incident service
1212

1313

@@ -300,8 +300,8 @@ Name | Type | Description | Notes
300300

301301
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
302302

303-
# **get_incident_services**
304-
> IncidentServicesResponse get_incident_services()
303+
# **list_incident_services**
304+
> IncidentServicesResponse list_incident_services()
305305
306306
Get a list of all incident services
307307

@@ -348,15 +348,16 @@ with datadog_api_client.v2.ApiClient(configuration) as api_client:
348348
include = "users" # str | Specifies which types of related objects should be included in the response. (optional) if omitted the server will use the default value of "users"
349349
page_size = 10 # int | Size for a given page. (optional) if omitted the server will use the default value of 10
350350
page_offset = 0 # int | Specific offset to use as the beginning of the returned page. (optional) if omitted the server will use the default value of 0
351+
filter = "ExampleServiceName" # str | A search query that filters services by name. (optional)
351352

352353
# example passing only required values which don't have defaults set
353354
# and optional values
354355
try:
355356
# Get a list of all incident services
356-
api_response = api_instance.get_incident_services(include=include, page_size=page_size, page_offset=page_offset)
357+
api_response = api_instance.list_incident_services(include=include, page_size=page_size, page_offset=page_offset, filter=filter)
357358
pprint(api_response)
358359
except datadog_api_client.v2.ApiException as e:
359-
print("Exception when calling IncidentServicesApi->get_incident_services: %s\n" % e)
360+
print("Exception when calling IncidentServicesApi->list_incident_services: %s\n" % e)
360361
```
361362

362363
### Parameters
@@ -366,6 +367,7 @@ Name | Type | Description | Notes
366367
**include** | **str**| Specifies which types of related objects should be included in the response. | [optional] if omitted the server will use the default value of "users"
367368
**page_size** | **int**| Size for a given page. | [optional] if omitted the server will use the default value of 10
368369
**page_offset** | **int**| Specific offset to use as the beginning of the returned page. | [optional] if omitted the server will use the default value of 0
370+
**filter** | **str**| A search query that filters services by name. | [optional]
369371

370372
### Return type
371373

docs/v2/IncidentTeamsApi.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Method | HTTP request | Description
77
[**create_incident_team**](IncidentTeamsApi.md#create_incident_team) | **POST** /api/v2/teams | Create a new incident team
88
[**delete_incident_team**](IncidentTeamsApi.md#delete_incident_team) | **DELETE** /api/v2/teams/{team_id} | Delete an existing incident team
99
[**get_incident_team**](IncidentTeamsApi.md#get_incident_team) | **GET** /api/v2/teams/{team_id} | Get details of an incident team
10-
[**get_incident_teams**](IncidentTeamsApi.md#get_incident_teams) | **GET** /api/v2/teams | Get a list of all incident teams
10+
[**list_incident_teams**](IncidentTeamsApi.md#list_incident_teams) | **GET** /api/v2/teams | Get a list of all incident teams
1111
[**update_incident_team**](IncidentTeamsApi.md#update_incident_team) | **PATCH** /api/v2/teams/{team_id} | Update an existing incident team
1212

1313

@@ -300,8 +300,8 @@ Name | Type | Description | Notes
300300

301301
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
302302

303-
# **get_incident_teams**
304-
> IncidentTeamsResponse get_incident_teams()
303+
# **list_incident_teams**
304+
> IncidentTeamsResponse list_incident_teams()
305305
306306
Get a list of all incident teams
307307

@@ -348,15 +348,16 @@ with datadog_api_client.v2.ApiClient(configuration) as api_client:
348348
include = "users" # str | Specifies which types of related objects should be included in the response. (optional) if omitted the server will use the default value of "users"
349349
page_size = 10 # int | Size for a given page. (optional) if omitted the server will use the default value of 10
350350
page_offset = 0 # int | Specific offset to use as the beginning of the returned page. (optional) if omitted the server will use the default value of 0
351+
filter = "ExampleTeamName" # str | A search query that filters teams by name. (optional)
351352

352353
# example passing only required values which don't have defaults set
353354
# and optional values
354355
try:
355356
# Get a list of all incident teams
356-
api_response = api_instance.get_incident_teams(include=include, page_size=page_size, page_offset=page_offset)
357+
api_response = api_instance.list_incident_teams(include=include, page_size=page_size, page_offset=page_offset, filter=filter)
357358
pprint(api_response)
358359
except datadog_api_client.v2.ApiException as e:
359-
print("Exception when calling IncidentTeamsApi->get_incident_teams: %s\n" % e)
360+
print("Exception when calling IncidentTeamsApi->list_incident_teams: %s\n" % e)
360361
```
361362

362363
### Parameters
@@ -366,6 +367,7 @@ Name | Type | Description | Notes
366367
**include** | **str**| Specifies which types of related objects should be included in the response. | [optional] if omitted the server will use the default value of "users"
367368
**page_size** | **int**| Size for a given page. | [optional] if omitted the server will use the default value of 10
368369
**page_offset** | **int**| Specific offset to use as the beginning of the returned page. | [optional] if omitted the server will use the default value of 0
370+
**filter** | **str**| A search query that filters teams by name. | [optional]
369371

370372
### Return type
371373

docs/v2/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ Class | Method | HTTP request | Description
118118
*IncidentServicesApi* | [**create_incident_service**](IncidentServicesApi.md#create_incident_service) | **POST** /api/v2/services | Create a new incident service
119119
*IncidentServicesApi* | [**delete_incident_service**](IncidentServicesApi.md#delete_incident_service) | **DELETE** /api/v2/services/{service_id} | Delete an existing incident service
120120
*IncidentServicesApi* | [**get_incident_service**](IncidentServicesApi.md#get_incident_service) | **GET** /api/v2/services/{service_id} | Get details of an incident service
121-
*IncidentServicesApi* | [**get_incident_services**](IncidentServicesApi.md#get_incident_services) | **GET** /api/v2/services | Get a list of all incident services
121+
*IncidentServicesApi* | [**list_incident_services**](IncidentServicesApi.md#list_incident_services) | **GET** /api/v2/services | Get a list of all incident services
122122
*IncidentServicesApi* | [**update_incident_service**](IncidentServicesApi.md#update_incident_service) | **PATCH** /api/v2/services/{service_id} | Update an existing incident service
123123
*IncidentTeamsApi* | [**create_incident_team**](IncidentTeamsApi.md#create_incident_team) | **POST** /api/v2/teams | Create a new incident team
124124
*IncidentTeamsApi* | [**delete_incident_team**](IncidentTeamsApi.md#delete_incident_team) | **DELETE** /api/v2/teams/{team_id} | Delete an existing incident team
125125
*IncidentTeamsApi* | [**get_incident_team**](IncidentTeamsApi.md#get_incident_team) | **GET** /api/v2/teams/{team_id} | Get details of an incident team
126-
*IncidentTeamsApi* | [**get_incident_teams**](IncidentTeamsApi.md#get_incident_teams) | **GET** /api/v2/teams | Get a list of all incident teams
126+
*IncidentTeamsApi* | [**list_incident_teams**](IncidentTeamsApi.md#list_incident_teams) | **GET** /api/v2/teams | Get a list of all incident teams
127127
*IncidentTeamsApi* | [**update_incident_team**](IncidentTeamsApi.md#update_incident_team) | **PATCH** /api/v2/teams/{team_id} | Update an existing incident team
128128
*LogsApi* | [**aggregate_logs**](LogsApi.md#aggregate_logs) | **POST** /api/v2/logs/analytics/aggregate | Aggregate events
129129
*LogsApi* | [**list_logs**](LogsApi.md#list_logs) | **POST** /api/v2/logs/events/search | Get a list of logs

src/datadog_api_client/v2/api/incident_services_api.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ def __get_incident_service(
409409
callable=__get_incident_service
410410
)
411411

412-
def __get_incident_services(
412+
def __list_incident_services(
413413
self,
414414
**kwargs
415415
):
@@ -419,14 +419,15 @@ def __get_incident_services(
419419
This method makes a synchronous HTTP request by default. To make an
420420
asynchronous HTTP request, please pass async_req=True
421421
422-
>>> thread = api.get_incident_services(async_req=True)
422+
>>> thread = api.list_incident_services(async_req=True)
423423
>>> result = thread.get()
424424
425425
426426
Keyword Args:
427427
include (str): Specifies which types of related objects should be included in the response.. [optional] if omitted the server will use the default value of "users"
428428
page_size (int): Size for a given page.. [optional] if omitted the server will use the default value of 10
429429
page_offset (int): Specific offset to use as the beginning of the returned page.. [optional] if omitted the server will use the default value of 0
430+
filter (str): A search query that filters services by name.. [optional]
430431
_return_http_data_only (bool): response data without head status
431432
code and headers. Default is True.
432433
_preload_content (bool): if False, the urllib3.HTTPResponse object
@@ -473,15 +474,15 @@ def __get_incident_services(
473474
kwargs['_host_index'] = kwargs.get('_host_index')
474475
return self.call_with_http_info(**kwargs)
475476

476-
self.get_incident_services = Endpoint(
477+
self.list_incident_services = Endpoint(
477478
settings={
478479
'response_type': (IncidentServicesResponse,),
479480
'auth': [
480481
'apiKeyAuth',
481482
'appKeyAuth'
482483
],
483484
'endpoint_path': '/api/v2/services',
484-
'operation_id': 'get_incident_services',
485+
'operation_id': 'list_incident_services',
485486
'http_method': 'GET',
486487
'servers': None,
487488
},
@@ -490,6 +491,7 @@ def __get_incident_services(
490491
'include',
491492
'page_size',
492493
'page_offset',
494+
'filter',
493495
],
494496
'required': [],
495497
'nullable': [
@@ -516,16 +518,20 @@ def __get_incident_services(
516518
(int,),
517519
'page_offset':
518520
(int,),
521+
'filter':
522+
(str,),
519523
},
520524
'attribute_map': {
521525
'include': 'include',
522526
'page_size': 'page[size]',
523527
'page_offset': 'page[offset]',
528+
'filter': 'filter',
524529
},
525530
'location_map': {
526531
'include': 'query',
527532
'page_size': 'query',
528533
'page_offset': 'query',
534+
'filter': 'query',
529535
},
530536
'collection_format_map': {
531537
}
@@ -537,7 +543,7 @@ def __get_incident_services(
537543
'content_type': [],
538544
},
539545
api_client=api_client,
540-
callable=__get_incident_services
546+
callable=__list_incident_services
541547
)
542548

543549
def __update_incident_service(

src/datadog_api_client/v2/api/incident_teams_api.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ def __get_incident_team(
409409
callable=__get_incident_team
410410
)
411411

412-
def __get_incident_teams(
412+
def __list_incident_teams(
413413
self,
414414
**kwargs
415415
):
@@ -419,14 +419,15 @@ def __get_incident_teams(
419419
This method makes a synchronous HTTP request by default. To make an
420420
asynchronous HTTP request, please pass async_req=True
421421
422-
>>> thread = api.get_incident_teams(async_req=True)
422+
>>> thread = api.list_incident_teams(async_req=True)
423423
>>> result = thread.get()
424424
425425
426426
Keyword Args:
427427
include (str): Specifies which types of related objects should be included in the response.. [optional] if omitted the server will use the default value of "users"
428428
page_size (int): Size for a given page.. [optional] if omitted the server will use the default value of 10
429429
page_offset (int): Specific offset to use as the beginning of the returned page.. [optional] if omitted the server will use the default value of 0
430+
filter (str): A search query that filters teams by name.. [optional]
430431
_return_http_data_only (bool): response data without head status
431432
code and headers. Default is True.
432433
_preload_content (bool): if False, the urllib3.HTTPResponse object
@@ -473,15 +474,15 @@ def __get_incident_teams(
473474
kwargs['_host_index'] = kwargs.get('_host_index')
474475
return self.call_with_http_info(**kwargs)
475476

476-
self.get_incident_teams = Endpoint(
477+
self.list_incident_teams = Endpoint(
477478
settings={
478479
'response_type': (IncidentTeamsResponse,),
479480
'auth': [
480481
'apiKeyAuth',
481482
'appKeyAuth'
482483
],
483484
'endpoint_path': '/api/v2/teams',
484-
'operation_id': 'get_incident_teams',
485+
'operation_id': 'list_incident_teams',
485486
'http_method': 'GET',
486487
'servers': None,
487488
},
@@ -490,6 +491,7 @@ def __get_incident_teams(
490491
'include',
491492
'page_size',
492493
'page_offset',
494+
'filter',
493495
],
494496
'required': [],
495497
'nullable': [
@@ -516,16 +518,20 @@ def __get_incident_teams(
516518
(int,),
517519
'page_offset':
518520
(int,),
521+
'filter':
522+
(str,),
519523
},
520524
'attribute_map': {
521525
'include': 'include',
522526
'page_size': 'page[size]',
523527
'page_offset': 'page[offset]',
528+
'filter': 'filter',
524529
},
525530
'location_map': {
526531
'include': 'query',
527532
'page_size': 'query',
528533
'page_offset': 'query',
534+
'filter': 'query',
529535
},
530536
'collection_format_map': {
531537
}
@@ -537,7 +543,7 @@ def __get_incident_teams(
537543
'content_type': [],
538544
},
539545
api_client=api_client,
540-
callable=__get_incident_teams
546+
callable=__list_incident_teams
541547
)
542548

543549
def __update_incident_team(

src/datadog_api_client/v2/configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,12 @@ def __init__(self, host=None,
208208
"create_incident_service": False,
209209
"delete_incident_service": False,
210210
"get_incident_service": False,
211-
"get_incident_services": False,
211+
"list_incident_services": False,
212212
"update_incident_service": False,
213213
"create_incident_team": False,
214214
"delete_incident_team": False,
215215
"get_incident_team": False,
216-
"get_incident_teams": False,
216+
"list_incident_teams": False,
217217
"update_incident_team": False,
218218
"list_logs": False,
219219
"list_logs_get": False,

src/datadog_api_client/v2/openapi.yaml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ components:
2828
enum:
2929
- users
3030
type: string
31+
IncidentServiceSearchQueryParameter:
32+
description: A search query that filters services by name.
33+
in: query
34+
name: filter
35+
required: false
36+
schema:
37+
example: ExampleServiceName
38+
type: string
3139
IncidentTeamIDPathParameter:
3240
description: The ID of the incident team.
3341
in: path
@@ -45,6 +53,14 @@ components:
4553
enum:
4654
- users
4755
type: string
56+
IncidentTeamSearchQueryParameter:
57+
description: A search query that filters teams by name.
58+
in: query
59+
name: filter
60+
required: false
61+
schema:
62+
example: ExampleTeamName
63+
type: string
4864
PageNumber:
4965
description: Specific page number to return.
5066
in: query
@@ -4149,11 +4165,12 @@ paths:
41494165
description: Get all incident services uploaded for the requesting user's organization.
41504166
If the `include[users]` query parameter is provided, the included attribute
41514167
will contain the users related to these incident services.
4152-
operationId: GetIncidentServices
4168+
operationId: ListIncidentServices
41534169
parameters:
41544170
- $ref: '#/components/parameters/IncidentServiceIncludeQueryParameter'
41554171
- $ref: '#/components/parameters/PageSize'
41564172
- $ref: '#/components/parameters/PageOffset'
4173+
- $ref: '#/components/parameters/IncidentServiceSearchQueryParameter'
41574174
responses:
41584175
'200':
41594176
content:
@@ -4299,11 +4316,12 @@ paths:
42994316
description: Get all incident teams for the requesting user's organization.
43004317
If the `include[users]` query parameter is provided, the included attribute
43014318
will contain the users related to these incident teams.
4302-
operationId: GetIncidentTeams
4319+
operationId: ListIncidentTeams
43034320
parameters:
43044321
- $ref: '#/components/parameters/IncidentTeamIncludeQueryParameter'
43054322
- $ref: '#/components/parameters/PageSize'
43064323
- $ref: '#/components/parameters/PageOffset'
4324+
- $ref: '#/components/parameters/IncidentTeamSearchQueryParameter'
43074325
responses:
43084326
'200':
43094327
content:

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,8 @@ def expect_equal_value(context, response_path, fixture_path):
443443

444444

445445
@then(parsers.parse('the response "{response_path}" has length {fixture_length:d}'))
446-
def expect_equal_value(api_request, fixtures, response_path, fixture_length):
447-
response_value = glom(api_request["response"][0], response_path)
446+
def expect_equal_value(context, response_path, fixture_length):
447+
response_value = glom(context["api_request"]["response"][0], response_path)
448448
assert fixture_length == len(response_value)
449449

450450

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2020-10-23T13:13:17.460940-05:00
1+
2020-11-12T12:00:07.594132+01:00

0 commit comments

Comments
 (0)