-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pagination parameters to downtimes listing (#1308)
Co-authored-by: ci.datadog-api-spec <[email protected]>
- Loading branch information
1 parent
690439f
commit ffa21b7
Showing
8 changed files
with
247 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...s_1733580485/Get-all-downtimes-returns-OK-response-with-pagination_3916578648/frozen.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"2023-09-05T12:32:39.085Z" |
115 changes: 115 additions & 0 deletions
115
...1733580485/Get-all-downtimes-returns-OK-response-with-pagination_3916578648/recording.har
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
{ | ||
"log": { | ||
"_recordingName": "Downtimes/Get all downtimes returns \"OK\" response with pagination", | ||
"creator": { | ||
"comment": "persister:fs", | ||
"name": "Polly.JS", | ||
"version": "6.0.5" | ||
}, | ||
"entries": [ | ||
{ | ||
"_id": "eab058833e2e3fd977fffe2fa5d6a767", | ||
"_order": 0, | ||
"cache": {}, | ||
"request": { | ||
"bodySize": 0, | ||
"cookies": [], | ||
"headers": [ | ||
{ | ||
"_fromType": "array", | ||
"name": "accept", | ||
"value": "application/json" | ||
} | ||
], | ||
"headersSize": 520, | ||
"httpVersion": "HTTP/1.1", | ||
"method": "GET", | ||
"queryString": [ | ||
{ | ||
"name": "page", | ||
"value": { | ||
"limit": "2" | ||
} | ||
} | ||
], | ||
"url": "https://api.datadoghq.com/api/v2/downtime?page%5Blimit%5D=2" | ||
}, | ||
"response": { | ||
"bodySize": 1126, | ||
"content": { | ||
"mimeType": "application/json", | ||
"size": 1126, | ||
"text": "{\"data\":[{\"type\":\"downtime\",\"attributes\":{\"mute_first_recovery_notification\":false,\"canceled\":null,\"monitor_identifier\":{\"monitor_tags\":[\"*\"]},\"schedule\":{\"start\":\"2023-05-22T03:06:54.072998+00:00\",\"end\":null},\"notify_end_types\":[\"expired\"],\"notify_end_states\":[\"no data\",\"warn\",\"alert\"],\"status\":\"active\",\"scope\":\"host:\\\"java-hostsMuteErrorsTest-local-1684724813\\\"\",\"created\":\"2023-05-22T03:06:54.079122+00:00\",\"display_timezone\":\"UTC\",\"message\":null,\"modified\":\"2023-05-22T03:06:54.079122+00:00\"},\"id\":\"b4613732-f84d-11ed-a766-da7ad0900002\"},{\"type\":\"downtime\",\"attributes\":{\"mute_first_recovery_notification\":false,\"canceled\":null,\"monitor_identifier\":{\"monitor_tags\":[\"*\"]},\"schedule\":{\"start\":\"2023-05-23T03:21:54.687109+00:00\",\"end\":null},\"notify_end_types\":[\"expired\"],\"notify_end_states\":[\"no data\",\"warn\",\"alert\"],\"status\":\"active\",\"scope\":\"host:\\\"java-hostsMuteErrorsTest-local-1684812114\\\"\",\"created\":\"2023-05-23T03:21:54.690618+00:00\",\"display_timezone\":\"UTC\",\"message\":null,\"modified\":\"2023-05-23T03:21:54.690618+00:00\"},\"id\":\"f799770a-f918-11ed-8b48-da7ad0900002\"}],\"meta\":{\"page\":{\"total_filtered_count\":3}}}\n" | ||
}, | ||
"cookies": [], | ||
"headers": [ | ||
{ | ||
"name": "content-type", | ||
"value": "application/json" | ||
} | ||
], | ||
"headersSize": 696, | ||
"httpVersion": "HTTP/1.1", | ||
"redirectURL": "", | ||
"status": 200, | ||
"statusText": "OK" | ||
}, | ||
"startedDateTime": "2023-09-05T12:32:39.094Z", | ||
"time": 491 | ||
}, | ||
{ | ||
"_id": "d373bb44355fb07f5a004f9395685267", | ||
"_order": 0, | ||
"cache": {}, | ||
"request": { | ||
"bodySize": 0, | ||
"cookies": [], | ||
"headers": [ | ||
{ | ||
"_fromType": "array", | ||
"name": "accept", | ||
"value": "application/json" | ||
} | ||
], | ||
"headersSize": 539, | ||
"httpVersion": "HTTP/1.1", | ||
"method": "GET", | ||
"queryString": [ | ||
{ | ||
"name": "page", | ||
"value": { | ||
"limit": "2", | ||
"offset": "2" | ||
} | ||
} | ||
], | ||
"url": "https://api.datadoghq.com/api/v2/downtime?page%5Blimit%5D=2&page%5Boffset%5D=2" | ||
}, | ||
"response": { | ||
"bodySize": 1126, | ||
"content": { | ||
"mimeType": "application/json", | ||
"size": 1126, | ||
"text": "{\"data\":[{\"type\":\"downtime\",\"attributes\":{\"modified\":\"2023-05-24T03:29:35.343207+00:00\",\"created\":\"2023-05-24T03:29:35.343207+00:00\",\"canceled\":null,\"status\":\"active\",\"scope\":\"host:\\\"java-hostsMuteErrorsTest-local-1684898975\\\"\",\"display_timezone\":\"UTC\",\"schedule\":{\"end\":null,\"start\":\"2023-05-24T03:29:35.340446+00:00\"},\"message\":null,\"mute_first_recovery_notification\":false,\"notify_end_types\":[\"expired\"],\"notify_end_states\":[\"warn\",\"no data\",\"alert\"],\"monitor_identifier\":{\"monitor_tags\":[\"*\"]}},\"id\":\"34953930-f9e3-11ed-85d4-da7ad0900002\"}],\"meta\":{\"page\":{\"total_filtered_count\":3}}}\n" | ||
}, | ||
"cookies": [], | ||
"headers": [ | ||
{ | ||
"name": "content-type", | ||
"value": "application/json" | ||
} | ||
], | ||
"headersSize": 696, | ||
"httpVersion": "HTTP/1.1", | ||
"redirectURL": "", | ||
"status": 200, | ||
"statusText": "OK" | ||
}, | ||
"startedDateTime": "2023-09-05T12:32:39.593Z", | ||
"time": 452 | ||
} | ||
], | ||
"pages": [], | ||
"version": "1.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* Get all downtimes returns "OK" response with pagination | ||
*/ | ||
|
||
import { client, v2 } from "@datadog/datadog-api-client"; | ||
|
||
const configuration = client.createConfiguration(); | ||
configuration.unstableOperations["v2.listDowntimes"] = true; | ||
const apiInstance = new v2.DowntimesApi(configuration); | ||
|
||
const params: v2.DowntimesApiListDowntimesRequest = { | ||
pageLimit: 2, | ||
}; | ||
|
||
(async () => { | ||
try { | ||
for await (const item of apiInstance.listDowntimesWithPagination(params)) { | ||
console.log(item); | ||
} | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters