From 517cd1eda94698959b2f8811e30cc1bbfd34f8f6 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 5 Apr 2021 14:17:36 +0000 Subject: [PATCH] Regenerate client from commit bd111f9 of spec repo --- .apigentools-info | 8 +- data/v1/openapi.yaml | 39 ++++++++++ docs/v1/DowntimesAPI.md | 63 ++++++++++++++++ docs/v1/README.md | 1 + features/v1/downtimes.feature | 21 ++++++ features/v1/undo.json | 6 ++ .../v1/api/downtimes_api.rb | 73 +++++++++++++++++++ 7 files changed, 207 insertions(+), 4 deletions(-) diff --git a/.apigentools-info b/.apigentools-info index b5c22e28c99c..787351d90725 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.4.1.dev6", - "regenerated": "2021-04-02 09:24:10.451056", - "spec_repo_commit": "cc1654e" + "regenerated": "2021-04-05 14:17:23.447081", + "spec_repo_commit": "bd111f9" }, "v2": { "apigentools_version": "1.4.1.dev6", - "regenerated": "2021-04-02 09:24:25.098751", - "spec_repo_commit": "cc1654e" + "regenerated": "2021-04-05 14:17:34.819265", + "spec_repo_commit": "bd111f9" } } } \ No newline at end of file diff --git a/data/v1/openapi.yaml b/data/v1/openapi.yaml index 54ec5d4af430..4092dfca5552 100644 --- a/data/v1/openapi.yaml +++ b/data/v1/openapi.yaml @@ -15312,6 +15312,45 @@ paths: x-codegen-request-body-name: body x-undo: type: idempotent + /api/v1/monitor/{monitor_id}/downtimes: + get: + description: Get all downtimes for the specified monitor + operationId: ListMonitorDowntimes + parameters: + - description: The id of the monitor + in: path + name: monitor_id + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Downtime' + type: array + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Monitor Not Found error + summary: Get all downtimes for a monitor + tags: + - Downtimes + x-codegen-request-body-name: body + x-undo: + type: safe /api/v1/monthly_custom_reports: get: description: Get monthly custom reports. diff --git a/docs/v1/DowntimesAPI.md b/docs/v1/DowntimesAPI.md index 1b6970f67044..1292d368e596 100644 --- a/docs/v1/DowntimesAPI.md +++ b/docs/v1/DowntimesAPI.md @@ -9,6 +9,7 @@ All URIs are relative to *https://api.datadoghq.com* | [**create_downtime**](DowntimesAPI.md#create_downtime) | **POST** /api/v1/downtime | Schedule a downtime | | [**get_downtime**](DowntimesAPI.md#get_downtime) | **GET** /api/v1/downtime/{downtime_id} | Get a downtime | | [**list_downtimes**](DowntimesAPI.md#list_downtimes) | **GET** /api/v1/downtime | Get all downtimes | +| [**list_monitor_downtimes**](DowntimesAPI.md#list_monitor_downtimes) | **GET** /api/v1/monitor/{monitor_id}/downtimes | Get all downtimes for a monitor | | [**update_downtime**](DowntimesAPI.md#update_downtime) | **PUT** /api/v1/downtime/{downtime_id} | Update a downtime | @@ -323,6 +324,68 @@ end - **Accept**: application/json +## list_monitor_downtimes + +> > list_monitor_downtimes(monitor_id) + +Get all downtimes for a monitor + +Get all downtimes for the specified monitor + +### Examples + +```ruby +require 'datadog_api_client' +api_instance = DatadogAPIClient::V1::DowntimesAPI.new +monitor_id = 789 # Integer | The id of the monitor + +begin + # Get all downtimes for a monitor + result = api_instance.list_monitor_downtimes(monitor_id) + p result +rescue DatadogAPIClient::V1::APIError => e + puts "Error when calling DowntimesAPI->list_monitor_downtimes: #{e}" +end +``` + +#### Using the list_monitor_downtimes_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> >, Integer, Hash)> list_monitor_downtimes_with_http_info(monitor_id) + +```ruby +begin + # Get all downtimes for a monitor + data, status_code, headers = api_instance.list_monitor_downtimes_with_http_info(monitor_id) + p status_code # => 2xx + p headers # => { ... } + p data # => > +rescue DatadogAPIClient::V1::APIError => e + puts "Error when calling DowntimesAPI->list_monitor_downtimes_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **monitor_id** | **Integer** | The id of the monitor | | + +### Return type + +[**Array<Downtime>**](Downtime.md) + +### Authorization + +[apiKeyAuth](README.md#apiKeyAuth), [appKeyAuth](README.md#appKeyAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + ## update_downtime > update_downtime(downtime_id, body) diff --git a/docs/v1/README.md b/docs/v1/README.md index f1a4264d2895..8a2be8820df0 100644 --- a/docs/v1/README.md +++ b/docs/v1/README.md @@ -68,6 +68,7 @@ Class | Method | HTTP request | Description *DatadogAPIClient::V1::DowntimesAPI* | [**create_downtime**](DowntimesAPI.md#create_downtime) | **POST** /api/v1/downtime | Schedule a downtime *DatadogAPIClient::V1::DowntimesAPI* | [**get_downtime**](DowntimesAPI.md#get_downtime) | **GET** /api/v1/downtime/{downtime_id} | Get a downtime *DatadogAPIClient::V1::DowntimesAPI* | [**list_downtimes**](DowntimesAPI.md#list_downtimes) | **GET** /api/v1/downtime | Get all downtimes +*DatadogAPIClient::V1::DowntimesAPI* | [**list_monitor_downtimes**](DowntimesAPI.md#list_monitor_downtimes) | **GET** /api/v1/monitor/{monitor_id}/downtimes | Get all downtimes for a monitor *DatadogAPIClient::V1::DowntimesAPI* | [**update_downtime**](DowntimesAPI.md#update_downtime) | **PUT** /api/v1/downtime/{downtime_id} | Update a downtime *DatadogAPIClient::V1::EventsAPI* | [**get_event**](EventsAPI.md#get_event) | **GET** /api/v1/events/{event_id} | Get an event *DatadogAPIClient::V1::EventsAPI* | [**list_events**](EventsAPI.md#list_events) | **GET** /api/v1/events | Query the event stream diff --git a/features/v1/downtimes.feature b/features/v1/downtimes.feature index 672bdfa5beae..35bc99e6354d 100644 --- a/features/v1/downtimes.feature +++ b/features/v1/downtimes.feature @@ -60,6 +60,27 @@ Feature: Downtimes When the request is sent Then the response status is 200 OK + @generated @skip + Scenario: Get all downtimes for a monitor returns "Bad Request" response + Given new "ListMonitorDowntimes" request + And request contains "monitor_id" parameter from "" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip + Scenario: Get all downtimes for a monitor returns "Monitor Not Found error" response + Given new "ListMonitorDowntimes" request + And request contains "monitor_id" parameter from "" + When the request is sent + Then the response status is 404 Monitor Not Found error + + @generated @skip + Scenario: Get all downtimes for a monitor returns "OK" response + Given new "ListMonitorDowntimes" request + And request contains "monitor_id" parameter from "" + When the request is sent + Then the response status is 200 OK + @generated @skip Scenario: Get all downtimes returns "OK" response Given new "ListDowntimes" request diff --git a/features/v1/undo.json b/features/v1/undo.json index f0cd9cd624b6..69e4badc12f6 100644 --- a/features/v1/undo.json +++ b/features/v1/undo.json @@ -627,6 +627,12 @@ "type": "idempotent" } }, + "ListMonitorDowntimes": { + "tag": "Downtimes", + "undo": { + "type": "safe" + } + }, "GetMonthlyCustomReports": { "tag": "Usage Metering", "undo": { diff --git a/lib/datadog_api_client/v1/api/downtimes_api.rb b/lib/datadog_api_client/v1/api/downtimes_api.rb index 23d08e33ca4b..8a8394f8ca42 100644 --- a/lib/datadog_api_client/v1/api/downtimes_api.rb +++ b/lib/datadog_api_client/v1/api/downtimes_api.rb @@ -388,6 +388,79 @@ def list_downtimes_with_http_info(opts = {}) return data, status_code, headers end + # Get all downtimes for a monitor + # Get all downtimes for the specified monitor + # @param monitor_id [Integer] The id of the monitor + # @param [Hash] opts the optional parameters + # @return [Array] + def list_monitor_downtimes(monitor_id, opts = {}) + data, _status_code, _headers = list_monitor_downtimes_with_http_info(monitor_id, opts) + data + end + + # Get all downtimes for a monitor + # Get all downtimes for the specified monitor + # @param monitor_id [Integer] The id of the monitor + # @param [Hash] opts the optional parameters + # @return [Array<(Array, Integer, Hash)>] Array data, response status code and response headers + def list_monitor_downtimes_with_http_info(monitor_id, opts = {}) + + if @api_client.config.unstable_operations.has_key?(:list_monitor_downtimes) + unstable_enabled = @api_client.config.unstable_operations[:list_monitor_downtimes] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "list_monitor_downtimes") + else + raise APIError.new(message: format("Unstable operation '%s' is disabled", "list_monitor_downtimes")) + end + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DowntimesAPI.list_monitor_downtimes ...' + end + # verify the required parameter 'monitor_id' is set + if @api_client.config.client_side_validation && monitor_id.nil? + fail ArgumentError, "Missing the required parameter 'monitor_id' when calling DowntimesAPI.list_monitor_downtimes" + end + # resource path + local_var_path = '/api/v1/monitor/{monitor_id}/downtimes'.sub('{' + 'monitor_id' + '}', CGI.escape(monitor_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Array' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_monitor_downtimes, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DowntimesAPI#list_monitor_downtimes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update a downtime # Update a single downtime by `downtime_id`. # @param downtime_id [Integer] ID of the downtime to update.