Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add query parameters for SLO search endpoint #249

Merged
merged 1 commit into from
Jan 28, 2021
Merged
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
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.4.1.dev2",
"regenerated": "2021-01-28 16:02:52.771548",
"spec_repo_commit": "c2cedbf"
"regenerated": "2021-01-28 17:53:54.712855",
"spec_repo_commit": "f21827d"
},
"v2": {
"apigentools_version": "1.4.1.dev2",
"regenerated": "2021-01-28 16:03:03.187204",
"spec_repo_commit": "c2cedbf"
"regenerated": "2021-01-28 17:54:06.073746",
"spec_repo_commit": "f21827d"
}
}
}
2 changes: 1 addition & 1 deletion docs/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ Class | Method | HTTP request | Description
*ServiceLevelObjectivesApi* | [**delete_slo_timeframe_in_bulk**](ServiceLevelObjectivesApi.md#delete_slo_timeframe_in_bulk) | **POST** /api/v1/slo/bulk_delete | Bulk Delete SLO Timeframes
*ServiceLevelObjectivesApi* | [**get_slo**](ServiceLevelObjectivesApi.md#get_slo) | **GET** /api/v1/slo/{slo_id} | Get a SLO's details
*ServiceLevelObjectivesApi* | [**get_slo_history**](ServiceLevelObjectivesApi.md#get_slo_history) | **GET** /api/v1/slo/{slo_id}/history | Get an SLO's history
*ServiceLevelObjectivesApi* | [**list_slos**](ServiceLevelObjectivesApi.md#list_slos) | **GET** /api/v1/slo | Search SLOs
*ServiceLevelObjectivesApi* | [**list_slos**](ServiceLevelObjectivesApi.md#list_slos) | **GET** /api/v1/slo | Get all SLOs
*ServiceLevelObjectivesApi* | [**update_slo**](ServiceLevelObjectivesApi.md#update_slo) | **PUT** /api/v1/slo/{slo_id} | Update a SLO
*SnapshotsApi* | [**get_graph_snapshot**](SnapshotsApi.md#get_graph_snapshot) | **GET** /api/v1/graph/snapshot | Take graph snapshots
*SyntheticsApi* | [**create_global_variable**](SyntheticsApi.md#create_global_variable) | **POST** /api/v1/synthetics/variables | Create a global variable
Expand Down
23 changes: 15 additions & 8 deletions docs/v1/ServiceLevelObjectivesApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Method | HTTP request | Description
[**delete_slo_timeframe_in_bulk**](ServiceLevelObjectivesApi.md#delete_slo_timeframe_in_bulk) | **POST** /api/v1/slo/bulk_delete | Bulk Delete SLO Timeframes
[**get_slo**](ServiceLevelObjectivesApi.md#get_slo) | **GET** /api/v1/slo/{slo_id} | Get a SLO's details
[**get_slo_history**](ServiceLevelObjectivesApi.md#get_slo_history) | **GET** /api/v1/slo/{slo_id}/history | Get an SLO's history
[**list_slos**](ServiceLevelObjectivesApi.md#list_slos) | **GET** /api/v1/slo | Search SLOs
[**list_slos**](ServiceLevelObjectivesApi.md#list_slos) | **GET** /api/v1/slo | Get all SLOs
[**update_slo**](ServiceLevelObjectivesApi.md#update_slo) | **PUT** /api/v1/slo/{slo_id} | Update a SLO


Expand Down Expand Up @@ -498,11 +498,11 @@ Name | Type | Description | Notes
[[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)

# **list_slos**
> SLOListResponse list_slos(ids)
> SLOListResponse list_slos()

Search SLOs
Get all SLOs

Get multiple service level objective objects by their IDs.
Get a list of service level objective objects for your organization.

### Example

Expand Down Expand Up @@ -531,12 +531,16 @@ configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
with ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = service_level_objectives_api.ServiceLevelObjectivesApi(api_client)
ids = "id1, id2, id3" # str | A comma separated list of the IDs of the service level objectives objects.
ids = "id1, id2, id3" # str | A comma separated list of the IDs of the service level objectives objects. (optional)
query = "monitor" # str | The query string to filter results based on SLO names. (optional)
tags_query = "env:prod" # str | The query string to filter results based on SLO tags. (optional)
metrics_query = "aws.elb.request_count" # str | The query string to filter results based on SLO numerator and denominator. (optional)

# example passing only required values which don't have defaults set
# and optional values
try:
# Search SLOs
api_response = api_instance.list_slos(ids)
# Get all SLOs
api_response = api_instance.list_slos(ids=ids, query=query, tags_query=tags_query, metrics_query=metrics_query)
pprint(api_response)
except ApiException as e:
print("Exception when calling ServiceLevelObjectivesApi->list_slos: %s\n" % e)
Expand All @@ -546,7 +550,10 @@ with ApiClient(configuration) as api_client:

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ids** | **str**| A comma separated list of the IDs of the service level objectives objects. |
**ids** | **str**| A comma separated list of the IDs of the service level objectives objects. | [optional]
**query** | **str**| The query string to filter results based on SLO names. | [optional]
**tags_query** | **str**| The query string to filter results based on SLO tags. | [optional]
**metrics_query** | **str**| The query string to filter results based on SLO numerator and denominator. | [optional]

### Return type

Expand Down
34 changes: 23 additions & 11 deletions src/datadog_api_client/v1/api/service_level_objectives_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,22 +790,23 @@ def __get_slo_history(

def __list_slos(
self,
ids,
**kwargs
):
"""Search SLOs # noqa: E501
"""Get all SLOs # noqa: E501

Get multiple service level objective objects by their IDs. # noqa: E501
Get a list of service level objective objects for your organization. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True

>>> thread = api.list_slos(ids, async_req=True)
>>> thread = api.list_slos(async_req=True)
>>> result = thread.get()

Args:
ids (str): A comma separated list of the IDs of the service level objectives objects.

Keyword Args:
ids (str): A comma separated list of the IDs of the service level objectives objects.. [optional]
query (str): The query string to filter results based on SLO names.. [optional]
tags_query (str): The query string to filter results based on SLO tags.. [optional]
metrics_query (str): The query string to filter results based on SLO numerator and denominator.. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
Expand Down Expand Up @@ -850,8 +851,6 @@ def __list_slos(
'_check_return_type', True
)
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['ids'] = \
ids
return self.call_with_http_info(**kwargs)

self.list_slos = _Endpoint(
Expand All @@ -869,10 +868,11 @@ def __list_slos(
params_map={
'all': [
'ids',
'query',
'tags_query',
'metrics_query',
],
'required': [
'ids',
],
'required': [],
'nullable': [
],
'enum': [
Expand All @@ -888,12 +888,24 @@ def __list_slos(
'openapi_types': {
'ids':
(str,),
'query':
(str,),
'tags_query':
(str,),
'metrics_query':
(str,),
},
'attribute_map': {
'ids': 'ids',
'query': 'query',
'tags_query': 'tags_query',
'metrics_query': 'metrics_query',
},
'location_map': {
'ids': 'query',
'query': 'query',
'tags_query': 'query',
'metrics_query': 'query',
},
'collection_format_map': {
}
Expand Down
28 changes: 25 additions & 3 deletions src/datadog_api_client/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14652,15 +14652,37 @@ paths:
type: safe
/api/v1/slo:
get:
description: Get multiple service level objective objects by their IDs.
description: Get a list of service level objective objects for your organization.
operationId: ListSLOs
parameters:
- description: A comma separated list of the IDs of the service level objectives
objects.
example: id1, id2, id3
in: query
name: ids
required: true
required: false
schema:
type: string
- description: The query string to filter results based on SLO names.
example: monitor
in: query
name: query
required: false
schema:
type: string
- description: The query string to filter results based on SLO tags.
example: env:prod
in: query
name: tags_query
required: false
schema:
type: string
- description: The query string to filter results based on SLO numerator and
denominator.
example: aws.elb.request_count
in: query
name: metrics_query
required: false
schema:
type: string
responses:
Expand Down Expand Up @@ -14688,7 +14710,7 @@ paths:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Not Found
summary: Search SLOs
summary: Get all SLOs
tags:
- Service Level Objectives
x-undo:
Expand Down
36 changes: 18 additions & 18 deletions tests/v1/features/service_level_objectives.feature
Original file line number Diff line number Diff line change
Expand Up @@ -95,44 +95,44 @@ Feature: Service Level Objectives
Then the response status is 200 OK

@generated @skip
Scenario: Get an SLO's history returns "Bad Request" response
Given operation "GetSLOHistory" enabled
And new "GetSLOHistory" request
And request contains "slo_id" parameter from "<PATH>"
Scenario: Get all SLOs returns "Bad Request" response
Given new "ListSLOs" request
When the request is sent
Then the response status is 400 Bad Request

@generated @skip
Scenario: Get an SLO's history returns "Not Found" response
Given operation "GetSLOHistory" enabled
And new "GetSLOHistory" request
And request contains "slo_id" parameter from "<PATH>"
Scenario: Get all SLOs returns "Not Found" response
Given new "ListSLOs" request
When the request is sent
Then the response status is 404 Not Found

@generated @skip
Scenario: Get an SLO's history returns "OK" response
Given operation "GetSLOHistory" enabled
And new "GetSLOHistory" request
And request contains "slo_id" parameter from "<PATH>"
Scenario: Get all SLOs returns "OK" response
Given new "ListSLOs" request
When the request is sent
Then the response status is 200 OK

@generated @skip
Scenario: Search SLOs returns "Bad Request" response
Given new "ListSLOs" request
Scenario: Get an SLO's history returns "Bad Request" response
Given operation "GetSLOHistory" enabled
And new "GetSLOHistory" request
And request contains "slo_id" parameter from "<PATH>"
When the request is sent
Then the response status is 400 Bad Request

@generated @skip
Scenario: Search SLOs returns "Not Found" response
Given new "ListSLOs" request
Scenario: Get an SLO's history returns "Not Found" response
Given operation "GetSLOHistory" enabled
And new "GetSLOHistory" request
And request contains "slo_id" parameter from "<PATH>"
When the request is sent
Then the response status is 404 Not Found

@generated @skip
Scenario: Search SLOs returns "OK" response
Given new "ListSLOs" request
Scenario: Get an SLO's history returns "OK" response
Given operation "GetSLOHistory" enabled
And new "GetSLOHistory" request
And request contains "slo_id" parameter from "<PATH>"
When the request is sent
Then the response status is 200 OK

Expand Down