Skip to content

Commit 381b012

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 948302c of spec repo (#3952)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 604dc85 commit 381b012

15 files changed

Lines changed: 468 additions & 21 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: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Create an SLO correction with slo_query returns "OK" response
2+
import com.datadog.api.client.ApiClient;
3+
import com.datadog.api.client.ApiException;
4+
import com.datadog.api.client.v1.api.ServiceLevelObjectiveCorrectionsApi;
5+
import com.datadog.api.client.v1.model.SLOCorrectionCategory;
6+
import com.datadog.api.client.v1.model.SLOCorrectionCreateData;
7+
import com.datadog.api.client.v1.model.SLOCorrectionCreateRequest;
8+
import com.datadog.api.client.v1.model.SLOCorrectionCreateRequestAttributes;
9+
import com.datadog.api.client.v1.model.SLOCorrectionResponse;
10+
import com.datadog.api.client.v1.model.SLOCorrectionType;
11+
import java.time.OffsetDateTime;
12+
13+
public class Example {
14+
public static void main(String[] args) {
15+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
16+
ServiceLevelObjectiveCorrectionsApi apiInstance =
17+
new ServiceLevelObjectiveCorrectionsApi(defaultClient);
18+
19+
SLOCorrectionCreateRequest body =
20+
new SLOCorrectionCreateRequest()
21+
.data(
22+
new SLOCorrectionCreateData()
23+
.attributes(
24+
new SLOCorrectionCreateRequestAttributes()
25+
.category(SLOCorrectionCategory.SCHEDULED_MAINTENANCE)
26+
.description("Example-Service-Level-Objective-Correction")
27+
.end(OffsetDateTime.now().plusHours(1).toInstant().getEpochSecond())
28+
.sloQuery("env:prod service:checkout")
29+
.start(OffsetDateTime.now().toInstant().getEpochSecond())
30+
.timezone("UTC"))
31+
.type(SLOCorrectionType.CORRECTION));
32+
33+
try {
34+
SLOCorrectionResponse result = apiInstance.createSLOCorrection(body);
35+
System.out.println(result);
36+
} catch (ApiException e) {
37+
System.err.println(
38+
"Exception when calling ServiceLevelObjectiveCorrectionsApi#createSLOCorrection");
39+
System.err.println("Status code: " + e.getCode());
40+
System.err.println("Reason: " + e.getResponseBody());
41+
System.err.println("Response headers: " + e.getResponseHeaders());
42+
e.printStackTrace();
43+
}
44+
}
45+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Update an SLO correction with slo_query returns "OK" response
2+
import com.datadog.api.client.ApiClient;
3+
import com.datadog.api.client.ApiException;
4+
import com.datadog.api.client.v1.api.ServiceLevelObjectiveCorrectionsApi;
5+
import com.datadog.api.client.v1.model.SLOCorrectionCategory;
6+
import com.datadog.api.client.v1.model.SLOCorrectionResponse;
7+
import com.datadog.api.client.v1.model.SLOCorrectionType;
8+
import com.datadog.api.client.v1.model.SLOCorrectionUpdateData;
9+
import com.datadog.api.client.v1.model.SLOCorrectionUpdateRequest;
10+
import com.datadog.api.client.v1.model.SLOCorrectionUpdateRequestAttributes;
11+
import java.time.OffsetDateTime;
12+
13+
public class Example {
14+
public static void main(String[] args) {
15+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
16+
ServiceLevelObjectiveCorrectionsApi apiInstance =
17+
new ServiceLevelObjectiveCorrectionsApi(defaultClient);
18+
19+
// there is a valid "correction_with_query" in the system
20+
String CORRECTION_WITH_QUERY_DATA_ID = System.getenv("CORRECTION_WITH_QUERY_DATA_ID");
21+
22+
SLOCorrectionUpdateRequest body =
23+
new SLOCorrectionUpdateRequest()
24+
.data(
25+
new SLOCorrectionUpdateData()
26+
.attributes(
27+
new SLOCorrectionUpdateRequestAttributes()
28+
.category(SLOCorrectionCategory.SCHEDULED_MAINTENANCE)
29+
.description("Example-Service-Level-Objective-Correction")
30+
.end(OffsetDateTime.now().plusHours(1).toInstant().getEpochSecond())
31+
.sloQuery("env:staging service:checkout")
32+
.start(OffsetDateTime.now().toInstant().getEpochSecond())
33+
.timezone("UTC"))
34+
.type(SLOCorrectionType.CORRECTION));
35+
36+
try {
37+
SLOCorrectionResponse result =
38+
apiInstance.updateSLOCorrection(CORRECTION_WITH_QUERY_DATA_ID, body);
39+
System.out.println(result);
40+
} catch (ApiException e) {
41+
System.err.println(
42+
"Exception when calling ServiceLevelObjectiveCorrectionsApi#updateSLOCorrection");
43+
System.err.println("Status code: " + e.getCode());
44+
System.err.println("Reason: " + e.getResponseBody());
45+
System.err.println("Response headers: " + e.getResponseHeaders());
46+
e.printStackTrace();
47+
}
48+
}
49+
}

src/main/java/com/datadog/api/client/v1/api/ServiceLevelObjectiveCorrectionsApi.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ public CompletableFuture<SLOCorrectionResponse> createSLOCorrectionAsync(
8282
}
8383

8484
/**
85-
* Create an SLO Correction.
85+
* Create an SLO correction. Use <code>slo_id</code> to apply the correction to a single SLO, or
86+
* <code>slo_query</code> to apply the correction to SLOs that match a query. Exactly one of
87+
* <code>slo_id</code> or <code>slo_query</code> is required.
8688
*
8789
* @param body Create an SLO Correction (required)
8890
* @return ApiResponse&lt;SLOCorrectionResponse&gt;

src/main/java/com/datadog/api/client/v1/model/SLOCorrectionCreateData.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public SLOCorrectionCreateData attributes(SLOCorrectionCreateRequestAttributes a
5050
/**
5151
* The attribute object associated with the SLO correction to be created.
5252
*
53+
* <p>Exactly one of <code>slo_id</code> or <code>slo_query</code> must be provided.
54+
*
5355
* @return attributes
5456
*/
5557
@jakarta.annotation.Nullable

src/main/java/com/datadog/api/client/v1/model/SLOCorrectionCreateRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import java.util.Map;
1717
import java.util.Objects;
1818

19-
/** An object that defines a correction to be applied to an SLO. */
19+
/** An object that defines a correction to be applied to one or more SLOs. */
2020
@JsonPropertyOrder({SLOCorrectionCreateRequest.JSON_PROPERTY_DATA})
2121
@jakarta.annotation.Generated(
2222
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")

src/main/java/com/datadog/api/client/v1/model/SLOCorrectionCreateRequestAttributes.java

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,19 @@
1717
import java.util.Map;
1818
import java.util.Objects;
1919

20-
/** The attribute object associated with the SLO correction to be created. */
20+
/**
21+
* The attribute object associated with the SLO correction to be created.
22+
*
23+
* <p>Exactly one of <code>slo_id</code> or <code>slo_query</code> must be provided.
24+
*/
2125
@JsonPropertyOrder({
2226
SLOCorrectionCreateRequestAttributes.JSON_PROPERTY_CATEGORY,
2327
SLOCorrectionCreateRequestAttributes.JSON_PROPERTY_DESCRIPTION,
2428
SLOCorrectionCreateRequestAttributes.JSON_PROPERTY_DURATION,
2529
SLOCorrectionCreateRequestAttributes.JSON_PROPERTY_END,
2630
SLOCorrectionCreateRequestAttributes.JSON_PROPERTY_RRULE,
2731
SLOCorrectionCreateRequestAttributes.JSON_PROPERTY_SLO_ID,
32+
SLOCorrectionCreateRequestAttributes.JSON_PROPERTY_SLO_QUERY,
2833
SLOCorrectionCreateRequestAttributes.JSON_PROPERTY_START,
2934
SLOCorrectionCreateRequestAttributes.JSON_PROPERTY_TIMEZONE
3035
})
@@ -50,6 +55,9 @@ public class SLOCorrectionCreateRequestAttributes {
5055
public static final String JSON_PROPERTY_SLO_ID = "slo_id";
5156
private String sloId;
5257

58+
public static final String JSON_PROPERTY_SLO_QUERY = "slo_query";
59+
private String sloQuery;
60+
5361
public static final String JSON_PROPERTY_START = "start";
5462
private Long start;
5563

@@ -61,11 +69,9 @@ public SLOCorrectionCreateRequestAttributes() {}
6169
@JsonCreator
6270
public SLOCorrectionCreateRequestAttributes(
6371
@JsonProperty(required = true, value = JSON_PROPERTY_CATEGORY) SLOCorrectionCategory category,
64-
@JsonProperty(required = true, value = JSON_PROPERTY_SLO_ID) String sloId,
6572
@JsonProperty(required = true, value = JSON_PROPERTY_START) Long start) {
6673
this.category = category;
6774
this.unparsed |= !category.isValid();
68-
this.sloId = sloId;
6975
this.start = start;
7076
}
7177

@@ -185,12 +191,13 @@ public SLOCorrectionCreateRequestAttributes sloId(String sloId) {
185191
}
186192

187193
/**
188-
* ID of the SLO that this correction applies to.
194+
* ID of the single SLO that this correction applies to.
189195
*
190196
* @return sloId
191197
*/
198+
@jakarta.annotation.Nullable
192199
@JsonProperty(JSON_PROPERTY_SLO_ID)
193-
@JsonInclude(value = JsonInclude.Include.ALWAYS)
200+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
194201
public String getSloId() {
195202
return sloId;
196203
}
@@ -199,6 +206,29 @@ public void setSloId(String sloId) {
199206
this.sloId = sloId;
200207
}
201208

209+
public SLOCorrectionCreateRequestAttributes sloQuery(String sloQuery) {
210+
this.sloQuery = sloQuery;
211+
return this;
212+
}
213+
214+
/**
215+
* Query that matches the SLOs this correction applies to. The query uses the <a
216+
* href="https://docs.datadoghq.com/events/explorer/searching/">Events search syntax</a> and can
217+
* filter SLOs by SLO tags.
218+
*
219+
* @return sloQuery
220+
*/
221+
@jakarta.annotation.Nullable
222+
@JsonProperty(JSON_PROPERTY_SLO_QUERY)
223+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
224+
public String getSloQuery() {
225+
return sloQuery;
226+
}
227+
228+
public void setSloQuery(String sloQuery) {
229+
this.sloQuery = sloQuery;
230+
}
231+
202232
public SLOCorrectionCreateRequestAttributes start(Long start) {
203233
this.start = start;
204234
return this;
@@ -303,6 +333,7 @@ public boolean equals(Object o) {
303333
&& Objects.equals(this.end, sloCorrectionCreateRequestAttributes.end)
304334
&& Objects.equals(this.rrule, sloCorrectionCreateRequestAttributes.rrule)
305335
&& Objects.equals(this.sloId, sloCorrectionCreateRequestAttributes.sloId)
336+
&& Objects.equals(this.sloQuery, sloCorrectionCreateRequestAttributes.sloQuery)
306337
&& Objects.equals(this.start, sloCorrectionCreateRequestAttributes.start)
307338
&& Objects.equals(this.timezone, sloCorrectionCreateRequestAttributes.timezone)
308339
&& Objects.equals(
@@ -312,7 +343,16 @@ public boolean equals(Object o) {
312343
@Override
313344
public int hashCode() {
314345
return Objects.hash(
315-
category, description, duration, end, rrule, sloId, start, timezone, additionalProperties);
346+
category,
347+
description,
348+
duration,
349+
end,
350+
rrule,
351+
sloId,
352+
sloQuery,
353+
start,
354+
timezone,
355+
additionalProperties);
316356
}
317357

318358
@Override
@@ -325,6 +365,7 @@ public String toString() {
325365
sb.append(" end: ").append(toIndentedString(end)).append("\n");
326366
sb.append(" rrule: ").append(toIndentedString(rrule)).append("\n");
327367
sb.append(" sloId: ").append(toIndentedString(sloId)).append("\n");
368+
sb.append(" sloQuery: ").append(toIndentedString(sloQuery)).append("\n");
328369
sb.append(" start: ").append(toIndentedString(start)).append("\n");
329370
sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n");
330371
sb.append(" additionalProperties: ")

0 commit comments

Comments
 (0)