Skip to content
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.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"
}
}
}
39 changes: 39 additions & 0 deletions data/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
63 changes: 63 additions & 0 deletions docs/v1/DowntimesAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |


Expand Down Expand Up @@ -323,6 +324,68 @@ end
- **Accept**: application/json


## list_monitor_downtimes

> <Array<Downtime>> 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.

> <Array(<Array<Downtime>>, 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 # => <Array<Downtime>>
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&lt;Downtime&gt;**](Downtime.md)

### Authorization

[apiKeyAuth](README.md#apiKeyAuth), [appKeyAuth](README.md#appKeyAuth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json


## update_downtime

> <Downtime> update_downtime(downtime_id, body)
Expand Down
1 change: 1 addition & 0 deletions docs/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions features/v1/downtimes.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<PATH>"
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 "<PATH>"
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 "<PATH>"
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
Expand Down
6 changes: 6 additions & 0 deletions features/v1/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,12 @@
"type": "idempotent"
}
},
"ListMonitorDowntimes": {
"tag": "Downtimes",
"undo": {
"type": "safe"
}
},
"GetMonthlyCustomReports": {
"tag": "Usage Metering",
"undo": {
Expand Down
73 changes: 73 additions & 0 deletions lib/datadog_api_client/v1/api/downtimes_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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<Downtime>]
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<Downtime>, Integer, Hash)>] Array<Downtime> 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<Downtime>'

# 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.
Expand Down