Skip to content

Commit 342766a

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 948302c of spec repo (#3641)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 494d8a4 commit 342766a

15 files changed

Lines changed: 311 additions & 17 deletions

.generator/schemas/v1/openapi.yaml

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13177,13 +13177,16 @@ components:
1317713177
type: object
1317813178
SLOCorrectionCreateRequest:
1317913179
description: |-
13180-
An object that defines a correction to be applied to an SLO.
13180+
An object that defines a correction to be applied to one or more SLOs.
1318113181
properties:
1318213182
data:
1318313183
$ref: "#/components/schemas/SLOCorrectionCreateData"
1318413184
type: object
1318513185
SLOCorrectionCreateRequestAttributes:
13186-
description: The attribute object associated with the SLO correction to be created.
13186+
description: |-
13187+
The attribute object associated with the SLO correction to be created.
13188+
13189+
Exactly one of `slo_id` or `slo_query` must be provided.
1318713190
properties:
1318813191
category:
1318913192
$ref: "#/components/schemas/SLOCorrectionCategory"
@@ -13207,9 +13210,16 @@ components:
1320713210
example: FREQ=DAILY;INTERVAL=10;COUNT=5
1320813211
type: string
1320913212
slo_id:
13210-
description: ID of the SLO that this correction applies to.
13213+
description: ID of the single SLO that this correction applies to.
1321113214
example: sloId
1321213215
type: string
13216+
slo_query:
13217+
description: |-
13218+
Query that matches the SLOs this correction applies to.
13219+
The query uses the [Events search syntax](https://docs.datadoghq.com/events/explorer/searching/)
13220+
and can filter SLOs by SLO tags.
13221+
example: "env:prod service:checkout"
13222+
type: string
1321313223
start:
1321413224
description: Starting time of the correction in epoch seconds.
1321513225
example: 1600000000
@@ -13220,7 +13230,6 @@ components:
1322013230
example: UTC
1322113231
type: string
1322213232
required:
13223-
- slo_id
1322413233
- start
1322513234
- category
1322613235
type: object
@@ -13284,7 +13293,12 @@ components:
1328413293
nullable: true
1328513294
type: string
1328613295
slo_id:
13287-
description: ID of the SLO that this correction applies to.
13296+
description: ID of the single SLO that this correction applies to.
13297+
nullable: true
13298+
type: string
13299+
slo_query:
13300+
description: Query that matches the SLOs this correction applies to.
13301+
nullable: true
1328813302
type: string
1328913303
start:
1329013304
description: Starting time of the correction in epoch seconds.
@@ -13356,6 +13370,13 @@ components:
1335613370
are `FREQ`, `INTERVAL`, `COUNT`, `UNTIL` and `BYDAY`.
1335713371
example: FREQ=DAILY;INTERVAL=10;COUNT=5
1335813372
type: string
13373+
slo_query:
13374+
description: |-
13375+
Query that matches the SLOs this correction applies to.
13376+
The query uses the [Events search syntax](https://docs.datadoghq.com/events/explorer/searching/)
13377+
and can filter SLOs by SLO tags.
13378+
example: "env:prod service:checkout"
13379+
type: string
1335913380
start:
1336013381
description: Starting time of the correction in epoch seconds.
1336113382
example: 1600000000
@@ -37493,7 +37514,8 @@ paths:
3749337514
- slos_read
3749437515
post:
3749537516
description: |-
37496-
Create an SLO Correction.
37517+
Create an SLO correction. Use `slo_id` to apply the correction to a single SLO, or `slo_query` to apply the
37518+
correction to SLOs that match a query. Exactly one of `slo_id` or `slo_query` is required.
3749737519
operationId: CreateSLOCorrection
3749837520
requestBody:
3749937521
content:
@@ -37510,6 +37532,17 @@ paths:
3751037532
start: 1600000000
3751137533
timezone: UTC
3751237534
type: correction
37535+
slo_query:
37536+
value:
37537+
data:
37538+
attributes:
37539+
category: "Scheduled Maintenance"
37540+
description: "Planned maintenance window for checkout services."
37541+
end: 1600003600
37542+
slo_query: "env:prod service:checkout"
37543+
start: 1600000000
37544+
timezone: UTC
37545+
type: correction
3751337546
schema:
3751437547
$ref: "#/components/schemas/SLOCorrectionCreateRequest"
3751537548
description: Create an SLO Correction
@@ -37669,6 +37702,17 @@ paths:
3766937702
start: 1600000000
3767037703
timezone: UTC
3767137704
type: correction
37705+
slo_query:
37706+
value:
37707+
data:
37708+
attributes:
37709+
category: "Scheduled Maintenance"
37710+
description: "Updated correction for checkout services."
37711+
end: 1600003600
37712+
slo_query: "env:prod service:checkout"
37713+
start: 1600000000
37714+
timezone: UTC
37715+
type: correction
3767237716
schema:
3767337717
$ref: "#/components/schemas/SLOCorrectionUpdateRequest"
3767437718
description: The edited SLO correction object.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""
2+
Create an SLO correction with slo_query returns "OK" response
3+
"""
4+
5+
from datetime import datetime
6+
from dateutil.relativedelta import relativedelta
7+
from datadog_api_client import ApiClient, Configuration
8+
from datadog_api_client.v1.api.service_level_objective_corrections_api import ServiceLevelObjectiveCorrectionsApi
9+
from datadog_api_client.v1.model.slo_correction_category import SLOCorrectionCategory
10+
from datadog_api_client.v1.model.slo_correction_create_data import SLOCorrectionCreateData
11+
from datadog_api_client.v1.model.slo_correction_create_request import SLOCorrectionCreateRequest
12+
from datadog_api_client.v1.model.slo_correction_create_request_attributes import SLOCorrectionCreateRequestAttributes
13+
from datadog_api_client.v1.model.slo_correction_type import SLOCorrectionType
14+
15+
body = SLOCorrectionCreateRequest(
16+
data=SLOCorrectionCreateData(
17+
attributes=SLOCorrectionCreateRequestAttributes(
18+
category=SLOCorrectionCategory.SCHEDULED_MAINTENANCE,
19+
description="Example-Service-Level-Objective-Correction",
20+
end=int((datetime.now() + relativedelta(hours=1)).timestamp()),
21+
slo_query="env:prod service:checkout",
22+
start=int(datetime.now().timestamp()),
23+
timezone="UTC",
24+
),
25+
type=SLOCorrectionType.CORRECTION,
26+
),
27+
)
28+
29+
configuration = Configuration()
30+
with ApiClient(configuration) as api_client:
31+
api_instance = ServiceLevelObjectiveCorrectionsApi(api_client)
32+
response = api_instance.create_slo_correction(body=body)
33+
34+
print(response)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
"""
2+
Update an SLO correction with slo_query returns "OK" response
3+
"""
4+
5+
from datetime import datetime
6+
from dateutil.relativedelta import relativedelta
7+
from os import environ
8+
from datadog_api_client import ApiClient, Configuration
9+
from datadog_api_client.v1.api.service_level_objective_corrections_api import ServiceLevelObjectiveCorrectionsApi
10+
from datadog_api_client.v1.model.slo_correction_category import SLOCorrectionCategory
11+
from datadog_api_client.v1.model.slo_correction_type import SLOCorrectionType
12+
from datadog_api_client.v1.model.slo_correction_update_data import SLOCorrectionUpdateData
13+
from datadog_api_client.v1.model.slo_correction_update_request import SLOCorrectionUpdateRequest
14+
from datadog_api_client.v1.model.slo_correction_update_request_attributes import SLOCorrectionUpdateRequestAttributes
15+
16+
# there is a valid "correction_with_query" in the system
17+
CORRECTION_WITH_QUERY_DATA_ID = environ["CORRECTION_WITH_QUERY_DATA_ID"]
18+
19+
body = SLOCorrectionUpdateRequest(
20+
data=SLOCorrectionUpdateData(
21+
attributes=SLOCorrectionUpdateRequestAttributes(
22+
category=SLOCorrectionCategory.SCHEDULED_MAINTENANCE,
23+
description="Example-Service-Level-Objective-Correction",
24+
end=int((datetime.now() + relativedelta(hours=1)).timestamp()),
25+
slo_query="env:staging service:checkout",
26+
start=int(datetime.now().timestamp()),
27+
timezone="UTC",
28+
),
29+
type=SLOCorrectionType.CORRECTION,
30+
),
31+
)
32+
33+
configuration = Configuration()
34+
with ApiClient(configuration) as api_client:
35+
api_instance = ServiceLevelObjectiveCorrectionsApi(api_client)
36+
response = api_instance.update_slo_correction(slo_correction_id=CORRECTION_WITH_QUERY_DATA_ID, body=body)
37+
38+
print(response)

src/datadog_api_client/v1/api/service_level_objective_corrections_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ def create_slo_correction(
159159
) -> SLOCorrectionResponse:
160160
"""Create an SLO correction.
161161
162-
Create an SLO Correction.
162+
Create an SLO correction. Use ``slo_id`` to apply the correction to a single SLO, or ``slo_query`` to apply the
163+
correction to SLOs that match a query. Exactly one of ``slo_id`` or ``slo_query`` is required.
163164
164165
:param body: Create an SLO Correction
165166
:type body: SLOCorrectionCreateRequest

src/datadog_api_client/v1/model/slo_correction_create_data.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ def __init__(
4848
The data object associated with the SLO correction to be created.
4949
5050
:param attributes: The attribute object associated with the SLO correction to be created.
51+
52+
Exactly one of ``slo_id`` or ``slo_query`` must be provided.
5153
:type attributes: SLOCorrectionCreateRequestAttributes, optional
5254
5355
:param type: SLO correction resource type.

src/datadog_api_client/v1/model/slo_correction_create_request.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def openapi_types(_):
3232

3333
def __init__(self_, data: Union[SLOCorrectionCreateData, UnsetType] = unset, **kwargs):
3434
"""
35-
An object that defines a correction to be applied to an SLO.
35+
An object that defines a correction to be applied to one or more SLOs.
3636
3737
:param data: The data object associated with the SLO correction to be created.
3838
:type data: SLOCorrectionCreateData, optional

src/datadog_api_client/v1/model/slo_correction_create_request_attributes.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def openapi_types(_):
2929
"end": (int,),
3030
"rrule": (str,),
3131
"slo_id": (str,),
32+
"slo_query": (str,),
3233
"start": (int,),
3334
"timezone": (str,),
3435
}
@@ -40,25 +41,29 @@ def openapi_types(_):
4041
"end": "end",
4142
"rrule": "rrule",
4243
"slo_id": "slo_id",
44+
"slo_query": "slo_query",
4345
"start": "start",
4446
"timezone": "timezone",
4547
}
4648

4749
def __init__(
4850
self_,
4951
category: SLOCorrectionCategory,
50-
slo_id: str,
5152
start: int,
5253
description: Union[str, UnsetType] = unset,
5354
duration: Union[int, UnsetType] = unset,
5455
end: Union[int, UnsetType] = unset,
5556
rrule: Union[str, UnsetType] = unset,
57+
slo_id: Union[str, UnsetType] = unset,
58+
slo_query: Union[str, UnsetType] = unset,
5659
timezone: Union[str, UnsetType] = unset,
5760
**kwargs,
5861
):
5962
"""
6063
The attribute object associated with the SLO correction to be created.
6164
65+
Exactly one of ``slo_id`` or ``slo_query`` must be provided.
66+
6267
:param category: Category the SLO correction belongs to.
6368
:type category: SLOCorrectionCategory
6469
@@ -75,8 +80,13 @@ def __init__(
7580
are ``FREQ`` , ``INTERVAL`` , ``COUNT`` , ``UNTIL`` and ``BYDAY``.
7681
:type rrule: str, optional
7782
78-
:param slo_id: ID of the SLO that this correction applies to.
79-
:type slo_id: str
83+
:param slo_id: ID of the single SLO that this correction applies to.
84+
:type slo_id: str, optional
85+
86+
:param slo_query: Query that matches the SLOs this correction applies to.
87+
The query uses the `Events search syntax <https://docs.datadoghq.com/events/explorer/searching/>`_
88+
and can filter SLOs by SLO tags.
89+
:type slo_query: str, optional
8090
8191
:param start: Starting time of the correction in epoch seconds.
8292
:type start: int
@@ -92,10 +102,13 @@ def __init__(
92102
kwargs["end"] = end
93103
if rrule is not unset:
94104
kwargs["rrule"] = rrule
105+
if slo_id is not unset:
106+
kwargs["slo_id"] = slo_id
107+
if slo_query is not unset:
108+
kwargs["slo_query"] = slo_query
95109
if timezone is not unset:
96110
kwargs["timezone"] = timezone
97111
super().__init__(kwargs)
98112

99113
self_.category = category
100-
self_.slo_id = slo_id
101114
self_.start = start

src/datadog_api_client/v1/model/slo_correction_response_attributes.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ def openapi_types(_):
4141
"modified_at": (int, none_type),
4242
"modifier": (SLOCorrectionResponseAttributesModifier,),
4343
"rrule": (str, none_type),
44-
"slo_id": (str,),
44+
"slo_id": (str, none_type),
45+
"slo_query": (str, none_type),
4546
"start": (int,),
4647
"timezone": (str,),
4748
}
@@ -57,6 +58,7 @@ def openapi_types(_):
5758
"modifier": "modifier",
5859
"rrule": "rrule",
5960
"slo_id": "slo_id",
61+
"slo_query": "slo_query",
6062
"start": "start",
6163
"timezone": "timezone",
6264
}
@@ -75,7 +77,8 @@ def __init__(
7577
modified_at: Union[int, none_type, UnsetType] = unset,
7678
modifier: Union[SLOCorrectionResponseAttributesModifier, none_type, UnsetType] = unset,
7779
rrule: Union[str, none_type, UnsetType] = unset,
78-
slo_id: Union[str, UnsetType] = unset,
80+
slo_id: Union[str, none_type, UnsetType] = unset,
81+
slo_query: Union[str, none_type, UnsetType] = unset,
7982
start: Union[int, UnsetType] = unset,
8083
timezone: Union[str, UnsetType] = unset,
8184
**kwargs,
@@ -111,8 +114,11 @@ def __init__(
111114
are ``FREQ`` , ``INTERVAL`` , ``COUNT`` , ``UNTIL`` and ``BYDAY``.
112115
:type rrule: str, none_type, optional
113116
114-
:param slo_id: ID of the SLO that this correction applies to.
115-
:type slo_id: str, optional
117+
:param slo_id: ID of the single SLO that this correction applies to.
118+
:type slo_id: str, none_type, optional
119+
120+
:param slo_query: Query that matches the SLOs this correction applies to.
121+
:type slo_query: str, none_type, optional
116122
117123
:param start: Starting time of the correction in epoch seconds.
118124
:type start: int, optional
@@ -140,6 +146,8 @@ def __init__(
140146
kwargs["rrule"] = rrule
141147
if slo_id is not unset:
142148
kwargs["slo_id"] = slo_id
149+
if slo_query is not unset:
150+
kwargs["slo_query"] = slo_query
143151
if start is not unset:
144152
kwargs["start"] = start
145153
if timezone is not unset:

src/datadog_api_client/v1/model/slo_correction_update_request_attributes.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def openapi_types(_):
2828
"duration": (int,),
2929
"end": (int,),
3030
"rrule": (str,),
31+
"slo_query": (str,),
3132
"start": (int,),
3233
"timezone": (str,),
3334
}
@@ -38,6 +39,7 @@ def openapi_types(_):
3839
"duration": "duration",
3940
"end": "end",
4041
"rrule": "rrule",
42+
"slo_query": "slo_query",
4143
"start": "start",
4244
"timezone": "timezone",
4345
}
@@ -49,6 +51,7 @@ def __init__(
4951
duration: Union[int, UnsetType] = unset,
5052
end: Union[int, UnsetType] = unset,
5153
rrule: Union[str, UnsetType] = unset,
54+
slo_query: Union[str, UnsetType] = unset,
5255
start: Union[int, UnsetType] = unset,
5356
timezone: Union[str, UnsetType] = unset,
5457
**kwargs,
@@ -72,6 +75,11 @@ def __init__(
7275
are ``FREQ`` , ``INTERVAL`` , ``COUNT`` , ``UNTIL`` and ``BYDAY``.
7376
:type rrule: str, optional
7477
78+
:param slo_query: Query that matches the SLOs this correction applies to.
79+
The query uses the `Events search syntax <https://docs.datadoghq.com/events/explorer/searching/>`_
80+
and can filter SLOs by SLO tags.
81+
:type slo_query: str, optional
82+
7583
:param start: Starting time of the correction in epoch seconds.
7684
:type start: int, optional
7785
@@ -88,6 +96,8 @@ def __init__(
8896
kwargs["end"] = end
8997
if rrule is not unset:
9098
kwargs["rrule"] = rrule
99+
if slo_query is not unset:
100+
kwargs["slo_query"] = slo_query
91101
if start is not unset:
92102
kwargs["start"] = start
93103
if timezone is not unset:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2026-05-27T20:45:22.423Z

0 commit comments

Comments
 (0)