Skip to content

Commit af727e5

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add offset and limit parameter to SLO correction API (#1241)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 9b964a6 commit af727e5

File tree

7 files changed

+80
-29
lines changed

7 files changed

+80
-29
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.4",
7-
"regenerated": "2022-11-17 19:57:05.790197",
8-
"spec_repo_commit": "bc510b70"
7+
"regenerated": "2022-11-18 07:41:33.828692",
8+
"spec_repo_commit": "924476da"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2022-11-17 19:57:05.803372",
13-
"spec_repo_commit": "bc510b70"
12+
"regenerated": "2022-11-18 07:41:33.839885",
13+
"spec_repo_commit": "924476da"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24924,6 +24924,22 @@ paths:
2492424924
get:
2492524925
description: Get all Service Level Objective corrections.
2492624926
operationId: ListSLOCorrection
24927+
parameters:
24928+
- description: The specific offset to use as the beginning of the returned response.
24929+
in: query
24930+
name: offset
24931+
required: false
24932+
schema:
24933+
format: int64
24934+
type: integer
24935+
- description: The number of SLO corrections to return in the response. Default
24936+
is 25.
24937+
in: query
24938+
name: limit
24939+
required: false
24940+
schema:
24941+
format: int64
24942+
type: integer
2492724943
responses:
2492824944
'200':
2492924945
content:

examples/v1/service-level-objective-corrections/ListSLOCorrection.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
configuration = Configuration()
99
with ApiClient(configuration) as api_client:
1010
api_instance = ServiceLevelObjectiveCorrectionsApi(api_client)
11-
response = api_instance.list_slo_correction()
11+
response = api_instance.list_slo_correction(
12+
offset=1,
13+
limit=1,
14+
)
1215

1316
print(response)

src/datadog_api_client/v1/api/service_level_objective_corrections_api.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
# Copyright 2019-Present Datadog, Inc.
44
from __future__ import annotations
55

6-
from typing import Any, Dict
6+
from typing import Any, Dict, Union
77

88
from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint
9+
from datadog_api_client.model_utils import (
10+
UnsetType,
11+
unset,
12+
)
913
from datadog_api_client.v1.model.slo_correction_list_response import SLOCorrectionListResponse
1014
from datadog_api_client.v1.model.slo_correction_response import SLOCorrectionResponse
1115
from datadog_api_client.v1.model.slo_correction_create_request import SLOCorrectionCreateRequest
@@ -106,7 +110,18 @@ def __init__(self, api_client=None):
106110
"version": "v1",
107111
"servers": None,
108112
},
109-
params_map={},
113+
params_map={
114+
"offset": {
115+
"openapi_types": (int,),
116+
"attribute": "offset",
117+
"location": "query",
118+
},
119+
"limit": {
120+
"openapi_types": (int,),
121+
"attribute": "limit",
122+
"location": "query",
123+
},
124+
},
110125
headers_map={
111126
"accept": ["application/json"],
112127
"content_type": [],
@@ -194,14 +209,27 @@ def get_slo_correction(
194209

195210
def list_slo_correction(
196211
self,
212+
*,
213+
offset: Union[int, UnsetType] = unset,
214+
limit: Union[int, UnsetType] = unset,
197215
) -> SLOCorrectionListResponse:
198216
"""Get all SLO corrections.
199217
200218
Get all Service Level Objective corrections.
201219
220+
:param offset: The specific offset to use as the beginning of the returned response.
221+
:type offset: int, optional
222+
:param limit: The number of SLO corrections to return in the response. Default is 25.
223+
:type limit: int, optional
202224
:rtype: SLOCorrectionListResponse
203225
"""
204226
kwargs: Dict[str, Any] = {}
227+
if offset is not unset:
228+
kwargs["offset"] = offset
229+
230+
if limit is not unset:
231+
kwargs["limit"] = limit
232+
205233
return self._list_slo_correction_endpoint.call_with_http_info(**kwargs)
206234

207235
def update_slo_correction(
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-05-12T09:50:16.644Z
1+
2022-11-17T16:38:19.644Z

tests/v1/cassettes/test_scenarios/test_get_all_slo_corrections_returns_ok_response.yaml

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
interactions:
22
- request:
3-
body: '{"name":"Test-Get_all_SLO_corrections_returns_OK_response-1652349016","query":{"denominator":"sum:httpservice.hits{!code:3xx}.as_count()","numerator":"sum:httpservice.hits{code:2xx}.as_count()"},"thresholds":[{"target":95,"timeframe":"7d","warning":98}],"type":"metric"}'
3+
body: '{"name":"Test-Get_all_SLO_corrections_returns_OK_response-1668703099","query":{"denominator":"sum:httpservice.hits{!code:3xx}.as_count()","numerator":"sum:httpservice.hits{code:2xx}.as_count()"},"thresholds":[{"target":95,"timeframe":"7d","warning":98}],"type":"metric"}'
44
headers:
55
accept:
66
- application/json
@@ -10,15 +10,17 @@ interactions:
1010
uri: https://api.datadoghq.com/api/v1/slo
1111
response:
1212
body:
13-
string: '{"data":[{"description":"","monitor_tags":[],"creator":{"handle":"[email protected]","name":null,"email":"[email protected]"},"thresholds":[{"warning":98.0,"warning_display":"98.","target":95.0,"target_display":"95.","timeframe":"7d"}],"type_id":1,"query":{"denominator":"sum:httpservice.hits{!code:3xx}.as_count()","numerator":"sum:httpservice.hits{code:2xx}.as_count()"},"id":"f28e523757705ebe972c5ca88a1bbea8","name":"Test-Get_all_SLO_corrections_returns_OK_response-1652349016","created_at":1652349017,"tags":[],"modified_at":1652349017,"type":"metric"}],"error":null}'
13+
string: '{"data":[{"id":"60569193a09054f6bc6fa6e87fb43031","name":"Test-Get_all_SLO_corrections_returns_OK_response-1668703099","tags":[],"monitor_tags":[],"thresholds":[{"timeframe":"7d","target":95.0,"target_display":"95.","warning":98.0,"warning_display":"98."}],"type":"metric","type_id":1,"description":"","query":{"denominator":"sum:httpservice.hits{!code:3xx}.as_count()","numerator":"sum:httpservice.hits{code:2xx}.as_count()"},"creator":{"name":null,"handle":"[email protected]","email":"[email protected]"},"created_at":1668703100,"modified_at":1668703100}],"error":null}
14+
15+
'
1416
headers:
1517
content-type:
1618
- application/json
1719
status:
1820
code: 200
1921
message: OK
2022
- request:
21-
body: '{"data":{"attributes":{"category":"Other","description":"Test Correction","end":1652352616,"slo_id":"f28e523757705ebe972c5ca88a1bbea8","start":1652349016,"timezone":"UTC"},"type":"correction"}}'
23+
body: '{"data":{"attributes":{"category":"Other","description":"Test Correction","end":1668706699,"slo_id":"60569193a09054f6bc6fa6e87fb43031","start":1668703099,"timezone":"UTC"},"type":"correction"}}'
2224
headers:
2325
accept:
2426
- application/json
@@ -28,8 +30,10 @@ interactions:
2830
uri: https://api.datadoghq.com/api/v1/slo/correction
2931
response:
3032
body:
31-
string: '{"data":{"type":"correction","id":"edf12dbe-d1d8-11ec-b51e-da7ad0902002","attributes":{"slo_id":"f28e523757705ebe972c5ca88a1bbea8","start":1652349016,"end":1652352616,"description":"Test
32-
Correction","category":"Other","timezone":"UTC","created_at":null,"modified_at":null,"rrule":null,"duration":null,"creator":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"[email protected]","email":"[email protected]","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"modifier":null}}}'
33+
string: '{"data":{"type":"correction","id":"3ecd96c6-6696-11ed-9c21-da7ad0902002","attributes":{"slo_id":"60569193a09054f6bc6fa6e87fb43031","start":1668703099,"end":1668706699,"description":"Test
34+
Correction","category":"Other","timezone":"UTC","created_at":null,"modified_at":null,"rrule":null,"duration":null,"creator":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"[email protected]","email":"[email protected]","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"modifier":null}}}
35+
36+
'
3337
headers:
3438
content-type:
3539
- application/json
@@ -42,20 +46,13 @@ interactions:
4246
accept:
4347
- application/json
4448
method: GET
45-
uri: https://api.datadoghq.com/api/v1/slo/correction
49+
uri: https://api.datadoghq.com/api/v1/slo/correction?offset=1&limit=1
4650
response:
4751
body:
48-
string: '{"meta":{"page":{"total_filtered_count":9,"total_count":9}},"data":[{"type":"correction","id":"edf12dbe-d1d8-11ec-b51e-da7ad0902002","attributes":{"slo_id":"f28e523757705ebe972c5ca88a1bbea8","start":1652349016,"end":1652352616,"description":"Test
49-
Correction","category":"Other","timezone":"UTC","created_at":1652349017,"modified_at":1652349017,"rrule":null,"duration":null,"creator":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"[email protected]","email":"[email protected]","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"modifier":null}},{"type":"correction","id":"cf7e09fe-cea6-11ec-899d-da7ad0902002","attributes":{"slo_id":"eed4de481c9c5201bc56f99336b648d5","start":1651997635,"end":1652001235,"description":"Test
50-
Correction","category":"Other","timezone":"UTC","created_at":1651997638,"modified_at":1651997638,"rrule":null,"duration":null,"creator":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"[email protected]","email":"[email protected]","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"modifier":null}},{"type":"correction","id":"c867f6b6-cea6-11ec-a259-da7ad0902002","attributes":{"slo_id":"ea2b55d6e0ba5065b4e9a6e2162b7c47","start":1651997623,"end":1652001223,"description":"Test-Typescript-Update_an_SLO_correction_returns_OK_response-1651997623","category":"Deployment","timezone":"UTC","created_at":1651997626,"modified_at":1651997626,"rrule":null,"duration":null,"creator":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"[email protected]","email":"[email protected]","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"modifier":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"[email protected]","email":"[email protected]","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}}}},{"type":"correction","id":"c6d12322-cea6-11ec-8393-da7ad0902002","attributes":{"slo_id":"1fe6393c1f2b5aa4878309af91bb87c4","start":1651997621,"end":1652001221,"description":"Test
51-
Correction","category":"Other","timezone":"UTC","created_at":1651997623,"modified_at":1651997623,"rrule":null,"duration":null,"creator":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"[email protected]","email":"[email protected]","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"modifier":null}},{"type":"correction","id":"c54af67c-cea6-11ec-a84a-da7ad0902002","attributes":{"slo_id":"bb8ac1a0a71d549a92c0401f6c6ed330","start":1651997618,"end":1652001218,"description":"Test
52-
Correction","category":"Other","timezone":"UTC","created_at":1651997621,"modified_at":1651997621,"rrule":null,"duration":null,"creator":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"[email protected]","email":"[email protected]","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"modifier":null}},{"type":"correction","id":"c3c457a8-cea6-11ec-84fc-da7ad0902002","attributes":{"slo_id":"551fb4b5fbc051c88d14225aecc9ac1c","start":1651997615,"end":null,"description":"Test-Typescript-Create_an_SLO_correction_with_rrule_returns_OK_response-1651997615","category":"Scheduled
53-
Maintenance","timezone":"UTC","created_at":1651997618,"modified_at":1651997618,"rrule":"FREQ=DAILY;INTERVAL=10;COUNT=5","duration":3600,"creator":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"[email protected]","email":"[email protected]","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"modifier":null}},{"type":"correction","id":"c213a3d2-cea6-11ec-9081-da7ad0902002","attributes":{"slo_id":"0a0f064182595b6b919c6f5f31c3204c","start":1651997612,"end":1652001212,"description":"Test-Typescript-Create_an_SLO_correction_returns_OK_response-1651997612","category":"Scheduled
54-
Maintenance","timezone":"UTC","created_at":1651997615,"modified_at":1651997615,"rrule":null,"duration":null,"creator":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"[email protected]","email":"[email protected]","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"modifier":null}},{"type":"correction","id":"db1a997c-c75c-11ec-aabf-da7ad0900002","attributes":{"slo_id":"d89b559b80e35a9793673e500c38e903","start":1651196214,"end":1651199814,"description":"Test-Python-Create_an_SLO_correction_returns_OK_response-1651196214","category":"Scheduled
55-
Maintenance","timezone":"UTC","created_at":1651196216,"modified_at":1651196216,"rrule":null,"duration":null,"creator":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","attributes":{"uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"[email protected]","name":"CI
56-
Account","icon":"https://secure.gravatar.com/avatar/b7c189b5b4c2c429d7c1e0bc3749330e?s=48&d=retro"}}},"modifier":null}},{"type":"correction","id":"c7b20000-c75c-11ec-aabf-da7ad0900002","attributes":{"slo_id":"5ffc7666d8fe54f484312d2703a16a03","start":1651196181,"end":null,"description":"Test-Python-Create_an_SLO_correction_with_rrule_returns_OK_response-1651196181","category":"Scheduled
57-
Maintenance","timezone":"UTC","created_at":1651196184,"modified_at":1651196184,"rrule":"FREQ=DAILY;INTERVAL=10;COUNT=5","duration":3600,"creator":{"data":{"type":"users","id":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","attributes":{"uuid":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","email":"[email protected]","name":"CI
58-
Account","icon":"https://secure.gravatar.com/avatar/b7c189b5b4c2c429d7c1e0bc3749330e?s=48&d=retro"}}},"modifier":null}}]}'
52+
string: '{"data":[{"type":"correction","id":"3ecd96c6-6696-11ed-9c21-da7ad0902002","attributes":{"slo_id":"60569193a09054f6bc6fa6e87fb43031","start":1668703099,"end":1668706699,"description":"Test
53+
Correction","category":"Other","timezone":"UTC","created_at":1668703100,"modified_at":1668703100,"rrule":null,"duration":null,"creator":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"[email protected]","email":"[email protected]","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"modifier":null}}],"meta":{"page":{"total_count":2,"total_filtered_count":1}}}
54+
55+
'
5956
headers:
6057
content-type:
6158
- application/json
@@ -68,11 +65,13 @@ interactions:
6865
accept:
6966
- '*/*'
7067
method: DELETE
71-
uri: https://api.datadoghq.com/api/v1/slo/correction/edf12dbe-d1d8-11ec-b51e-da7ad0902002
68+
uri: https://api.datadoghq.com/api/v1/slo/correction/3ecd96c6-6696-11ed-9c21-da7ad0902002
7269
response:
7370
body:
7471
string: ''
75-
headers: {}
72+
headers:
73+
content-type:
74+
- text/html; charset=utf-8
7675
status:
7776
code: 204
7877
message: No Content
@@ -82,10 +81,12 @@ interactions:
8281
accept:
8382
- application/json
8483
method: DELETE
85-
uri: https://api.datadoghq.com/api/v1/slo/f28e523757705ebe972c5ca88a1bbea8
84+
uri: https://api.datadoghq.com/api/v1/slo/60569193a09054f6bc6fa6e87fb43031
8685
response:
8786
body:
88-
string: '{"data":["f28e523757705ebe972c5ca88a1bbea8"],"error":null}'
87+
string: '{"data":["60569193a09054f6bc6fa6e87fb43031"],"error":null}
88+
89+
'
8990
headers:
9091
content-type:
9192
- application/json

tests/v1/features/service_level_objective_corrections.feature

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,11 @@ Feature: Service Level Objective Corrections
6161
Given there is a valid "slo" in the system
6262
And there is a valid "correction" for "slo"
6363
And new "ListSLOCorrection" request
64+
And request contains "offset" parameter with value 1
65+
And request contains "limit" parameter with value 1
6466
When the request is sent
6567
Then the response status is 200 OK
68+
And the response "data" has length 1
6669

6770
@generated @skip @team:DataDog/slo-app
6871
Scenario: Get an SLO correction for an SLO returns "Bad Request" response

0 commit comments

Comments
 (0)