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 #182

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:03:45.588352",
"spec_repo_commit": "c2cedbf"
"regenerated": "2021-01-28 17:53:44.274625",
"spec_repo_commit": "f21827d"
},
"v2": {
"apigentools_version": "1.4.1.dev2",
"regenerated": "2021-01-28 16:03:58.136402",
"spec_repo_commit": "c2cedbf"
"regenerated": "2021-01-28 17:53:56.823698",
"spec_repo_commit": "f21827d"
}
}
}
28 changes: 25 additions & 3 deletions data/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
2 changes: 1 addition & 1 deletion docs/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Class | Method | HTTP request | Description
*DatadogAPIClient::V1::ServiceLevelObjectivesApi* | [**delete_slo_timeframe_in_bulk**](ServiceLevelObjectivesApi.md#delete_slo_timeframe_in_bulk) | **POST** /api/v1/slo/bulk_delete | Bulk Delete SLO Timeframes
*DatadogAPIClient::V1::ServiceLevelObjectivesApi* | [**get_slo**](ServiceLevelObjectivesApi.md#get_slo) | **GET** /api/v1/slo/{slo_id} | Get a SLO's details
*DatadogAPIClient::V1::ServiceLevelObjectivesApi* | [**get_slo_history**](ServiceLevelObjectivesApi.md#get_slo_history) | **GET** /api/v1/slo/{slo_id}/history | Get an SLO's history
*DatadogAPIClient::V1::ServiceLevelObjectivesApi* | [**list_slos**](ServiceLevelObjectivesApi.md#list_slos) | **GET** /api/v1/slo | Search SLOs
*DatadogAPIClient::V1::ServiceLevelObjectivesApi* | [**list_slos**](ServiceLevelObjectivesApi.md#list_slos) | **GET** /api/v1/slo | Get all SLOs
*DatadogAPIClient::V1::ServiceLevelObjectivesApi* | [**update_slo**](ServiceLevelObjectivesApi.md#update_slo) | **PUT** /api/v1/slo/{slo_id} | Update a SLO
*DatadogAPIClient::V1::SnapshotsApi* | [**get_graph_snapshot**](SnapshotsApi.md#get_graph_snapshot) | **GET** /api/v1/graph/snapshot | Take graph snapshots
*DatadogAPIClient::V1::SyntheticsApi* | [**create_global_variable**](SyntheticsApi.md#create_global_variable) | **POST** /api/v1/synthetics/variables | Create a global variable
Expand Down
30 changes: 19 additions & 11 deletions docs/v1/ServiceLevelObjectivesApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ All URIs are relative to *https://api.datadoghq.com*
| [**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 @@ -458,11 +458,11 @@ end

## list_slos

> <SLOListResponse> list_slos(ids)
> <SLOListResponse> list_slos(opts)

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.

### Examples

Expand All @@ -479,11 +479,16 @@ DatadogAPIClient::V1.configure do |config|
end

api_instance = DatadogAPIClient::V1::ServiceLevelObjectivesApi.new
ids = 'id1, id2, id3' # String | A comma separated list of the IDs of the service level objectives objects.
opts = {
ids: 'id1, id2, id3', # String | A comma separated list of the IDs of the service level objectives objects.
query: 'monitor', # String | The query string to filter results based on SLO names.
tags_query: 'env:prod', # String | The query string to filter results based on SLO tags.
metrics_query: 'aws.elb.request_count' # String | The query string to filter results based on SLO numerator and denominator.
}

begin
# Search SLOs
result = api_instance.list_slos(ids)
# Get all SLOs
result = api_instance.list_slos(opts)
p result
rescue DatadogAPIClient::V1::ApiError => e
puts "Error when calling ServiceLevelObjectivesApi->list_slos: #{e}"
Expand All @@ -494,12 +499,12 @@ end

This returns an Array which contains the response data, status code and headers.

> <Array(<SLOListResponse>, Integer, Hash)> list_slos_with_http_info(ids)
> <Array(<SLOListResponse>, Integer, Hash)> list_slos_with_http_info(opts)

```ruby
begin
# Search SLOs
data, status_code, headers = api_instance.list_slos_with_http_info(ids)
# Get all SLOs
data, status_code, headers = api_instance.list_slos_with_http_info(opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <SLOListResponse>
Expand All @@ -512,7 +517,10 @@ end

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

### Return type

Expand Down
36 changes: 18 additions & 18 deletions features/v1/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
33 changes: 19 additions & 14 deletions lib/datadog_api_client/v1/api/service_level_objectives_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -482,22 +482,28 @@ def get_slo_history_with_http_info(slo_id, from_ts, to_ts, opts = {})
return data, status_code, headers
end

# Search SLOs
# Get multiple service level objective objects by their IDs.
# @param ids [String] A comma separated list of the IDs of the service level objectives objects.
# Get all SLOs
# Get a list of service level objective objects for your organization.
# @param [Hash] opts the optional parameters
# @option opts [String] :ids A comma separated list of the IDs of the service level objectives objects.
# @option opts [String] :query The query string to filter results based on SLO names.
# @option opts [String] :tags_query The query string to filter results based on SLO tags.
# @option opts [String] :metrics_query The query string to filter results based on SLO numerator and denominator.
# @return [SLOListResponse]
def list_slos(ids, opts = {})
data, _status_code, _headers = list_slos_with_http_info(ids, opts)
def list_slos(opts = {})
data, _status_code, _headers = list_slos_with_http_info(opts)
data
end

# Search SLOs
# Get multiple service level objective objects by their IDs.
# @param ids [String] A comma separated list of the IDs of the service level objectives objects.
# Get all SLOs
# Get a list of service level objective objects for your organization.
# @param [Hash] opts the optional parameters
# @option opts [String] :ids A comma separated list of the IDs of the service level objectives objects.
# @option opts [String] :query The query string to filter results based on SLO names.
# @option opts [String] :tags_query The query string to filter results based on SLO tags.
# @option opts [String] :metrics_query The query string to filter results based on SLO numerator and denominator.
# @return [Array<(SLOListResponse, Integer, Hash)>] SLOListResponse data, response status code and response headers
def list_slos_with_http_info(ids, opts = {})
def list_slos_with_http_info(opts = {})

if @api_client.config.unstable_operations.has_key?(:list_slos)
unstable_enabled = @api_client.config.unstable_operations[:list_slos]
Expand All @@ -511,16 +517,15 @@ def list_slos_with_http_info(ids, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ServiceLevelObjectivesApi.list_slos ...'
end
# verify the required parameter 'ids' is set
if @api_client.config.client_side_validation && ids.nil?
fail ArgumentError, "Missing the required parameter 'ids' when calling ServiceLevelObjectivesApi.list_slos"
end
# resource path
local_var_path = '/api/v1/slo'

# query parameters
query_params = opts[:query_params] || {}
query_params[:'ids'] = ids
query_params[:'ids'] = opts[:'ids'] if !opts[:'ids'].nil?
query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil?
query_params[:'tags_query'] = opts[:'tags_query'] if !opts[:'tags_query'].nil?
query_params[:'metrics_query'] = opts[:'metrics_query'] if !opts[:'metrics_query'].nil?

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