Skip to content

Commit 13cd288

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit febdee32 of spec repo
1 parent 1622fff commit 13cd288

File tree

7 files changed

+200
-4
lines changed

7 files changed

+200
-4
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.5",
7-
"regenerated": "2023-08-28 20:29:20.861535",
8-
"spec_repo_commit": "0fac706f"
7+
"regenerated": "2023-08-30 07:29:16.616488",
8+
"spec_repo_commit": "febdee32"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.5",
12-
"regenerated": "2023-08-28 20:29:20.877322",
13-
"spec_repo_commit": "0fac706f"
12+
"regenerated": "2023-08-30 07:29:16.629575",
13+
"spec_repo_commit": "febdee32"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27004,6 +27004,7 @@ paths:
2700427004
name: limit
2700527005
required: false
2700627006
schema:
27007+
default: 1000
2700727008
format: int64
2700827009
type: integer
2700927010
- description: The specific offset to use as the beginning of the returned response.
@@ -27048,6 +27049,10 @@ paths:
2704827049
summary: Get all SLOs
2704927050
tags:
2705027051
- Service Level Objectives
27052+
x-pagination:
27053+
limitParam: limit
27054+
pageOffsetParam: offset
27055+
resultsPath: data
2705127056
post:
2705227057
description: Create a service level objective object.
2705327058
operationId: CreateSLO
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2023-08-25T12:33:42.432Z"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
{
2+
"log": {
3+
"_recordingName": "Service Level Objectives/Get all SLOs returns \"OK\" response with pagination",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "a179f385561658282db79e086f7baadf",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 0,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json"
22+
}
23+
],
24+
"headersSize": 500,
25+
"httpVersion": "HTTP/1.1",
26+
"method": "GET",
27+
"queryString": [
28+
{
29+
"name": "limit",
30+
"value": "2"
31+
}
32+
],
33+
"url": "https://api.datadoghq.com/api/v1/slo?limit=2"
34+
},
35+
"response": {
36+
"bodySize": 1491,
37+
"content": {
38+
"mimeType": "application/json",
39+
"size": 1491,
40+
"text": "{\"data\":[{\"id\":\"70e82706f4ae56ff8bdd7f02e767f97c\",\"name\":\"test SLO 1668426861\",\"tags\":[\"type:test\"],\"monitor_tags\":[],\"thresholds\":[{\"timeframe\":\"7d\",\"target\":90.0,\"target_display\":\"90.\"}],\"type\":\"metric\",\"type_id\":1,\"description\":\"\",\"timeframe\":\"7d\",\"target_threshold\":90.0,\"query\":{\"denominator\":\"sum:my.custom.metric{!type:ignored}.as_count()\",\"numerator\":\"sum:my.custom.metric{type:good,!type:ignored}.as_count()\"},\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\"},\"created_at\":1668426862,\"modified_at\":1668426862},{\"id\":\"955ab6301fa656e7b061de4a05ad4774\",\"name\":\"tf-TestAccDatadogServiceLevelObjective_Basic-local-1673543942-updated\",\"tags\":[\"foo:bar\",\"baz\"],\"monitor_tags\":[],\"thresholds\":[{\"timeframe\":\"7d\",\"target\":99.5,\"target_display\":\"99.5\",\"warning\":99.8,\"warning_display\":\"99.8\"},{\"timeframe\":\"30d\",\"target\":98.0,\"target_display\":\"98.\",\"warning\":99.0,\"warning_display\":\"99.\"},{\"timeframe\":\"90d\",\"target\":99.9,\"target_display\":\"99.9\"}],\"type\":\"metric\",\"type_id\":1,\"description\":\"some updated description about foo SLO\",\"timeframe\":\"7d\",\"warning_threshold\":99.8,\"target_threshold\":99.5,\"query\":{\"denominator\":\"sum:my.metric{type:good}.as_count() + sum:my.metric{type:bad}.as_count()\",\"numerator\":\"sum:my.metric{type:good}.as_count()\"},\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\"},\"created_at\":1673543944,\"modified_at\":1673543945}],\"error\":null,\"metadata\":{\"page\":{\"total_count\":3,\"total_filtered_count\":2}}}\n"
41+
},
42+
"cookies": [],
43+
"headers": [
44+
{
45+
"name": "content-type",
46+
"value": "application/json"
47+
}
48+
],
49+
"headersSize": 648,
50+
"httpVersion": "HTTP/1.1",
51+
"redirectURL": "",
52+
"status": 200,
53+
"statusText": "OK"
54+
},
55+
"startedDateTime": "2023-08-25T12:33:42.442Z",
56+
"time": 478
57+
},
58+
{
59+
"_id": "20536200546072f9877a58046da401ba",
60+
"_order": 0,
61+
"cache": {},
62+
"request": {
63+
"bodySize": 0,
64+
"cookies": [],
65+
"headers": [
66+
{
67+
"_fromType": "array",
68+
"name": "accept",
69+
"value": "application/json"
70+
}
71+
],
72+
"headersSize": 509,
73+
"httpVersion": "HTTP/1.1",
74+
"method": "GET",
75+
"queryString": [
76+
{
77+
"name": "limit",
78+
"value": "2"
79+
},
80+
{
81+
"name": "offset",
82+
"value": "2"
83+
}
84+
],
85+
"url": "https://api.datadoghq.com/api/v1/slo?limit=2&offset=2"
86+
},
87+
"response": {
88+
"bodySize": 1130,
89+
"content": {
90+
"mimeType": "application/json",
91+
"size": 1130,
92+
"text": "{\"data\":[{\"id\":\"a17acfd48b7c55d19192e3a697cc1d01\",\"name\":\"test SLO 1677686870\",\"tags\":[],\"monitor_tags\":[],\"thresholds\":[{\"timeframe\":\"7d\",\"target\":90.0,\"target_display\":\"90.\"}],\"type\":\"monitor\",\"type_id\":0,\"description\":\"\",\"timeframe\":\"7d\",\"target_threshold\":90.0,\"monitor_ids\":[112445445],\"creator\":{\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"email\":\"team-intg-tools-libs-spam@datadoghq.com\"},\"created_at\":1677686871,\"modified_at\":1677686871}],\"error\":null,\"metadata\":{\"page\":{\"total_count\":3,\"total_filtered_count\":2}}}\n"
93+
},
94+
"cookies": [],
95+
"headers": [
96+
{
97+
"name": "content-type",
98+
"value": "application/json"
99+
}
100+
],
101+
"headersSize": 648,
102+
"httpVersion": "HTTP/1.1",
103+
"redirectURL": "",
104+
"status": 200,
105+
"statusText": "OK"
106+
},
107+
"startedDateTime": "2023-08-25T12:33:42.924Z",
108+
"time": 454
109+
}
110+
],
111+
"pages": [],
112+
"version": "1.2"
113+
}
114+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Get all SLOs returns "OK" response with pagination
3+
*/
4+
5+
import { client, v1 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v1.ServiceLevelObjectivesApi(configuration);
9+
10+
const params: v1.ServiceLevelObjectivesApiListSLOsRequest = {
11+
limit: 2,
12+
};
13+
14+
(async () => {
15+
try {
16+
for await (const item of apiInstance.listSLOsWithPagination(params)) {
17+
console.log(item);
18+
}
19+
} catch (error) {
20+
console.error(error);
21+
}
22+
})();

features/v1/service_level_objectives.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ Feature: Service Level Objectives
134134
And the response "data" has length 1
135135
And the response "data[0].id" has the same value as "slo.data[0].id"
136136

137+
@replay-only @skip-validation @team:DataDog/slo-app @with-pagination
138+
Scenario: Get all SLOs returns "OK" response with pagination
139+
Given new "ListSLOs" request
140+
And request contains "limit" parameter with value 2
141+
When the request with pagination is sent
142+
Then the response status is 200 OK
143+
And the response has 3 items
144+
137145
@generated @skip @team:DataDog/slo-app
138146
Scenario: Get an SLO's details returns "Not found" response
139147
Given new "GetSLO" request

packages/datadog-api-client-v1/apis/ServiceLevelObjectivesApi.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,6 +1517,52 @@ export class ServiceLevelObjectivesApi {
15171517
});
15181518
}
15191519

1520+
/**
1521+
* Provide a paginated version of listSLOs returning a generator with all the items.
1522+
*/
1523+
public async *listSLOsWithPagination(
1524+
param: ServiceLevelObjectivesApiListSLOsRequest = {},
1525+
options?: Configuration
1526+
): AsyncGenerator<ServiceLevelObjective> {
1527+
let pageSize = 1000;
1528+
if (param.limit !== undefined) {
1529+
pageSize = param.limit;
1530+
}
1531+
param.limit = pageSize;
1532+
while (true) {
1533+
const requestContext = await this.requestFactory.listSLOs(
1534+
param.ids,
1535+
param.query,
1536+
param.tagsQuery,
1537+
param.metricsQuery,
1538+
param.limit,
1539+
param.offset,
1540+
options
1541+
);
1542+
const responseContext = await this.configuration.httpApi.send(
1543+
requestContext
1544+
);
1545+
1546+
const response = await this.responseProcessor.listSLOs(responseContext);
1547+
const responseData = response.data;
1548+
if (responseData === undefined) {
1549+
break;
1550+
}
1551+
const results = responseData;
1552+
for (const item of results) {
1553+
yield item;
1554+
}
1555+
if (results.length < pageSize) {
1556+
break;
1557+
}
1558+
if (param.offset === undefined) {
1559+
param.offset = pageSize;
1560+
} else {
1561+
param.offset = param.offset + pageSize;
1562+
}
1563+
}
1564+
}
1565+
15201566
/**
15211567
* Get a list of service level objective objects for your organization.
15221568
* @param param The request object

0 commit comments

Comments
 (0)