Skip to content

Commit c4be5f8

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 948302c of spec repo (DataDog#3447)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 8cc4c59 commit c4be5f8

15 files changed

Lines changed: 301 additions & 26 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.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2026-05-27T20:45:22.423Z

cassettes/features/v1/service_level_objective_corrections/Create-an-SLO-correction-with-slo-query-returns-OK-response.yml

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2026-06-03T15:43:01.600Z

cassettes/features/v1/service_level_objective_corrections/Update-an-SLO-correction-with-slo-query-returns-OK-response.yml

Lines changed: 77 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Create an SLO correction with slo_query returns "OK" response
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V1::ServiceLevelObjectiveCorrectionsAPI.new
5+
6+
body = DatadogAPIClient::V1::SLOCorrectionCreateRequest.new({
7+
data: DatadogAPIClient::V1::SLOCorrectionCreateData.new({
8+
attributes: DatadogAPIClient::V1::SLOCorrectionCreateRequestAttributes.new({
9+
category: DatadogAPIClient::V1::SLOCorrectionCategory::SCHEDULED_MAINTENANCE,
10+
description: "Example-Service-Level-Objective-Correction",
11+
_end: (Time.now + 1 * 3600).to_i,
12+
slo_query: "env:prod service:checkout",
13+
start: Time.now.to_i,
14+
timezone: "UTC",
15+
}),
16+
type: DatadogAPIClient::V1::SLOCorrectionType::CORRECTION,
17+
}),
18+
})
19+
p api_instance.create_slo_correction(body)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Update an SLO correction with slo_query returns "OK" response
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V1::ServiceLevelObjectiveCorrectionsAPI.new
5+
6+
# there is a valid "correction_with_query" in the system
7+
CORRECTION_WITH_QUERY_DATA_ID = ENV["CORRECTION_WITH_QUERY_DATA_ID"]
8+
9+
body = DatadogAPIClient::V1::SLOCorrectionUpdateRequest.new({
10+
data: DatadogAPIClient::V1::SLOCorrectionUpdateData.new({
11+
attributes: DatadogAPIClient::V1::SLOCorrectionUpdateRequestAttributes.new({
12+
category: DatadogAPIClient::V1::SLOCorrectionCategory::SCHEDULED_MAINTENANCE,
13+
description: "Example-Service-Level-Objective-Correction",
14+
_end: (Time.now + 1 * 3600).to_i,
15+
slo_query: "env:staging service:checkout",
16+
start: Time.now.to_i,
17+
timezone: "UTC",
18+
}),
19+
type: DatadogAPIClient::V1::SLOCorrectionType::CORRECTION,
20+
}),
21+
})
22+
p api_instance.update_slo_correction(CORRECTION_WITH_QUERY_DATA_ID, body)

features/v1/given.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,18 @@
234234
"tag": "Service Level Objective Corrections",
235235
"operationId": "CreateSLOCorrection"
236236
},
237+
{
238+
"parameters": [
239+
{
240+
"name": "body",
241+
"value": "{\n \"data\": {\n \"attributes\": {\n \"slo_query\": \"env:prod service:checkout\",\n \"start\": {{ timestamp(\"now\") }},\n \"end\": {{ timestamp(\"now + 1h\") }},\n \"category\": \"Other\",\n \"timezone\": \"UTC\",\n \"description\": \"Test Correction\"\n },\n \"type\": \"correction\"\n }\n}"
242+
}
243+
],
244+
"step": "there is a valid \"correction_with_query\" in the system",
245+
"key": "correction_with_query",
246+
"tag": "Service Level Objective Corrections",
247+
"operationId": "CreateSLOCorrection"
248+
},
237249
{
238250
"parameters": [
239251
{

features/v1/service_level_objective_corrections.feature

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ Feature: Service Level Objective Corrections
4949
And the response "data.type" is equal to "correction"
5050
And the response "data.attributes.rrule" is equal to "FREQ=DAILY;INTERVAL=10;COUNT=5"
5151

52+
@team:DataDog/slo-app
53+
Scenario: Create an SLO correction with slo_query returns "OK" response
54+
Given new "CreateSLOCorrection" request
55+
And body with value {"data": {"attributes": {"category": "Scheduled Maintenance", "description": "{{ unique }}", "end": {{ timestamp("now + 1h") }}, "slo_query": "env:prod service:checkout", "start": {{ timestamp("now") }}, "timezone": "UTC"}, "type": "correction"}}
56+
When the request is sent
57+
Then the response status is 200 OK
58+
And the response "data.type" is equal to "correction"
59+
And the response "data.attributes.category" is equal to "Scheduled Maintenance"
60+
And the response "data.attributes.slo_query" is equal to "env:prod service:checkout"
61+
5262
@generated @skip @team:DataDog/slo-app
5363
Scenario: Delete an SLO correction returns "Not found" response
5464
Given new "DeleteSLOCorrection" request
@@ -114,7 +124,7 @@ Feature: Service Level Objective Corrections
114124
Scenario: Update an SLO correction returns "Not Found" response
115125
Given new "UpdateSLOCorrection" request
116126
And request contains "slo_correction_id" parameter from "REPLACE.ME"
117-
And body with value {"data": {"attributes": {"category": "Scheduled Maintenance", "duration": 3600, "end": 1600000000, "rrule": "FREQ=DAILY;INTERVAL=10;COUNT=5", "start": 1600000000, "timezone": "UTC"}, "type": "correction"}}
127+
And body with value {"data": {"attributes": {"category": "Scheduled Maintenance", "duration": 3600, "end": 1600000000, "rrule": "FREQ=DAILY;INTERVAL=10;COUNT=5", "slo_query": "env:prod service:checkout", "start": 1600000000, "timezone": "UTC"}, "type": "correction"}}
118128
When the request is sent
119129
Then the response status is 404 Not Found
120130

@@ -130,3 +140,14 @@ Feature: Service Level Objective Corrections
130140
And the response "data.id" has the same value as "correction.data.id"
131141
And the response "data.attributes.slo_id" has the same value as "correction.data.attributes.slo_id"
132142
And the response "data.attributes.category" is equal to "Deployment"
143+
144+
@team:DataDog/slo-app
145+
Scenario: Update an SLO correction with slo_query returns "OK" response
146+
Given there is a valid "correction_with_query" in the system
147+
And new "UpdateSLOCorrection" request
148+
And request contains "slo_correction_id" parameter from "correction_with_query.data.id"
149+
And body with value {"data": {"attributes": {"category": "Scheduled Maintenance", "description": "{{ unique }}", "end": {{ timestamp("now + 1h") }}, "slo_query": "env:staging service:checkout", "start": {{ timestamp("now") }}, "timezone": "UTC"}, "type": "correction"}}
150+
When the request is sent
151+
Then the response status is 200 OK
152+
And the response "data.id" has the same value as "correction_with_query.data.id"
153+
And the response "data.attributes.slo_query" is equal to "env:staging service:checkout"

lib/datadog_api_client/v1/api/service_level_objective_corrections_api.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ def create_slo_correction(body, opts = {})
3333

3434
# Create an SLO correction.
3535
#
36-
# Create an SLO Correction.
36+
# Create an SLO correction. Use `slo_id` to apply the correction to a single SLO, or `slo_query` to apply the
37+
# correction to SLOs that match a query. Exactly one of `slo_id` or `slo_query` is required.
3738
#
3839
# @param body [SLOCorrectionCreateRequest] Create an SLO Correction
3940
# @param opts [Hash] the optional parameters

0 commit comments

Comments
 (0)