Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 50 additions & 6 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13177,13 +13177,16 @@ components:
type: object
SLOCorrectionCreateRequest:
description: |-
An object that defines a correction to be applied to an SLO.
An object that defines a correction to be applied to one or more SLOs.
properties:
data:
$ref: "#/components/schemas/SLOCorrectionCreateData"
type: object
SLOCorrectionCreateRequestAttributes:
description: The attribute object associated with the SLO correction to be created.
description: |-
The attribute object associated with the SLO correction to be created.

Exactly one of `slo_id` or `slo_query` must be provided.
properties:
category:
$ref: "#/components/schemas/SLOCorrectionCategory"
Expand All @@ -13207,9 +13210,16 @@ components:
example: FREQ=DAILY;INTERVAL=10;COUNT=5
type: string
slo_id:
description: ID of the SLO that this correction applies to.
description: ID of the single SLO that this correction applies to.
example: sloId
type: string
slo_query:
description: |-
Query that matches the SLOs this correction applies to.
The query uses the [Events search syntax](https://docs.datadoghq.com/events/explorer/searching/)
and can filter SLOs by SLO tags.
example: "env:prod service:checkout"
type: string
start:
description: Starting time of the correction in epoch seconds.
example: 1600000000
Expand All @@ -13220,7 +13230,6 @@ components:
example: UTC
type: string
required:
- slo_id
- start
- category
type: object
Expand Down Expand Up @@ -13284,7 +13293,12 @@ components:
nullable: true
type: string
slo_id:
description: ID of the SLO that this correction applies to.
description: ID of the single SLO that this correction applies to.
nullable: true
type: string
slo_query:
description: Query that matches the SLOs this correction applies to.
nullable: true
type: string
start:
description: Starting time of the correction in epoch seconds.
Expand Down Expand Up @@ -13356,6 +13370,13 @@ components:
are `FREQ`, `INTERVAL`, `COUNT`, `UNTIL` and `BYDAY`.
example: FREQ=DAILY;INTERVAL=10;COUNT=5
type: string
slo_query:
description: |-
Query that matches the SLOs this correction applies to.
The query uses the [Events search syntax](https://docs.datadoghq.com/events/explorer/searching/)
and can filter SLOs by SLO tags.
example: "env:prod service:checkout"
type: string
start:
description: Starting time of the correction in epoch seconds.
example: 1600000000
Expand Down Expand Up @@ -37493,7 +37514,8 @@ paths:
- slos_read
post:
description: |-
Create an SLO Correction.
Create an SLO correction. Use `slo_id` to apply the correction to a single SLO, or `slo_query` to apply the
correction to SLOs that match a query. Exactly one of `slo_id` or `slo_query` is required.
operationId: CreateSLOCorrection
requestBody:
content:
Expand All @@ -37510,6 +37532,17 @@ paths:
start: 1600000000
timezone: UTC
type: correction
slo_query:
value:
data:
attributes:
category: "Scheduled Maintenance"
description: "Planned maintenance window for checkout services."
end: 1600003600
slo_query: "env:prod service:checkout"
start: 1600000000
timezone: UTC
type: correction
schema:
$ref: "#/components/schemas/SLOCorrectionCreateRequest"
description: Create an SLO Correction
Expand Down Expand Up @@ -37669,6 +37702,17 @@ paths:
start: 1600000000
timezone: UTC
type: correction
slo_query:
value:
data:
attributes:
category: "Scheduled Maintenance"
description: "Updated correction for checkout services."
end: 1600003600
slo_query: "env:prod service:checkout"
start: 1600000000
timezone: UTC
type: correction
schema:
$ref: "#/components/schemas/SLOCorrectionUpdateRequest"
description: The edited SLO correction object.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Create an SLO correction with slo_query returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.ServiceLevelObjectiveCorrectionsApi;
import com.datadog.api.client.v1.model.SLOCorrectionCategory;
import com.datadog.api.client.v1.model.SLOCorrectionCreateData;
import com.datadog.api.client.v1.model.SLOCorrectionCreateRequest;
import com.datadog.api.client.v1.model.SLOCorrectionCreateRequestAttributes;
import com.datadog.api.client.v1.model.SLOCorrectionResponse;
import com.datadog.api.client.v1.model.SLOCorrectionType;
import java.time.OffsetDateTime;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
ServiceLevelObjectiveCorrectionsApi apiInstance =
new ServiceLevelObjectiveCorrectionsApi(defaultClient);

SLOCorrectionCreateRequest body =
new SLOCorrectionCreateRequest()
.data(
new SLOCorrectionCreateData()
.attributes(
new SLOCorrectionCreateRequestAttributes()
.category(SLOCorrectionCategory.SCHEDULED_MAINTENANCE)
.description("Example-Service-Level-Objective-Correction")
.end(OffsetDateTime.now().plusHours(1).toInstant().getEpochSecond())
.sloQuery("env:prod service:checkout")
.start(OffsetDateTime.now().toInstant().getEpochSecond())
.timezone("UTC"))
.type(SLOCorrectionType.CORRECTION));

try {
SLOCorrectionResponse result = apiInstance.createSLOCorrection(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println(
"Exception when calling ServiceLevelObjectiveCorrectionsApi#createSLOCorrection");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Update an SLO correction with slo_query returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.ServiceLevelObjectiveCorrectionsApi;
import com.datadog.api.client.v1.model.SLOCorrectionCategory;
import com.datadog.api.client.v1.model.SLOCorrectionResponse;
import com.datadog.api.client.v1.model.SLOCorrectionType;
import com.datadog.api.client.v1.model.SLOCorrectionUpdateData;
import com.datadog.api.client.v1.model.SLOCorrectionUpdateRequest;
import com.datadog.api.client.v1.model.SLOCorrectionUpdateRequestAttributes;
import java.time.OffsetDateTime;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
ServiceLevelObjectiveCorrectionsApi apiInstance =
new ServiceLevelObjectiveCorrectionsApi(defaultClient);

// there is a valid "correction_with_query" in the system
String CORRECTION_WITH_QUERY_DATA_ID = System.getenv("CORRECTION_WITH_QUERY_DATA_ID");

SLOCorrectionUpdateRequest body =
new SLOCorrectionUpdateRequest()
.data(
new SLOCorrectionUpdateData()
.attributes(
new SLOCorrectionUpdateRequestAttributes()
.category(SLOCorrectionCategory.SCHEDULED_MAINTENANCE)
.description("Example-Service-Level-Objective-Correction")
.end(OffsetDateTime.now().plusHours(1).toInstant().getEpochSecond())
.sloQuery("env:staging service:checkout")
.start(OffsetDateTime.now().toInstant().getEpochSecond())
.timezone("UTC"))
.type(SLOCorrectionType.CORRECTION));

try {
SLOCorrectionResponse result =
apiInstance.updateSLOCorrection(CORRECTION_WITH_QUERY_DATA_ID, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println(
"Exception when calling ServiceLevelObjectiveCorrectionsApi#updateSLOCorrection");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ public CompletableFuture<SLOCorrectionResponse> createSLOCorrectionAsync(
}

/**
* Create an SLO Correction.
* Create an SLO correction. Use <code>slo_id</code> to apply the correction to a single SLO, or
* <code>slo_query</code> to apply the correction to SLOs that match a query. Exactly one of
* <code>slo_id</code> or <code>slo_query</code> is required.
*
* @param body Create an SLO Correction (required)
* @return ApiResponse&lt;SLOCorrectionResponse&gt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public SLOCorrectionCreateData attributes(SLOCorrectionCreateRequestAttributes a
/**
* The attribute object associated with the SLO correction to be created.
*
* <p>Exactly one of <code>slo_id</code> or <code>slo_query</code> must be provided.
*
* @return attributes
*/
@jakarta.annotation.Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.Map;
import java.util.Objects;

/** An object that defines a correction to be applied to an SLO. */
/** An object that defines a correction to be applied to one or more SLOs. */
@JsonPropertyOrder({SLOCorrectionCreateRequest.JSON_PROPERTY_DATA})
@jakarta.annotation.Generated(
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,19 @@
import java.util.Map;
import java.util.Objects;

/** The attribute object associated with the SLO correction to be created. */
/**
* The attribute object associated with the SLO correction to be created.
*
* <p>Exactly one of <code>slo_id</code> or <code>slo_query</code> must be provided.
*/
@JsonPropertyOrder({
SLOCorrectionCreateRequestAttributes.JSON_PROPERTY_CATEGORY,
SLOCorrectionCreateRequestAttributes.JSON_PROPERTY_DESCRIPTION,
SLOCorrectionCreateRequestAttributes.JSON_PROPERTY_DURATION,
SLOCorrectionCreateRequestAttributes.JSON_PROPERTY_END,
SLOCorrectionCreateRequestAttributes.JSON_PROPERTY_RRULE,
SLOCorrectionCreateRequestAttributes.JSON_PROPERTY_SLO_ID,
SLOCorrectionCreateRequestAttributes.JSON_PROPERTY_SLO_QUERY,
SLOCorrectionCreateRequestAttributes.JSON_PROPERTY_START,
SLOCorrectionCreateRequestAttributes.JSON_PROPERTY_TIMEZONE
})
Expand All @@ -50,6 +55,9 @@ public class SLOCorrectionCreateRequestAttributes {
public static final String JSON_PROPERTY_SLO_ID = "slo_id";
private String sloId;

public static final String JSON_PROPERTY_SLO_QUERY = "slo_query";
private String sloQuery;

public static final String JSON_PROPERTY_START = "start";
private Long start;

Expand All @@ -61,11 +69,9 @@ public SLOCorrectionCreateRequestAttributes() {}
@JsonCreator
public SLOCorrectionCreateRequestAttributes(
@JsonProperty(required = true, value = JSON_PROPERTY_CATEGORY) SLOCorrectionCategory category,
@JsonProperty(required = true, value = JSON_PROPERTY_SLO_ID) String sloId,
@JsonProperty(required = true, value = JSON_PROPERTY_START) Long start) {
this.category = category;
this.unparsed |= !category.isValid();
this.sloId = sloId;
this.start = start;
}

Expand Down Expand Up @@ -185,12 +191,13 @@ public SLOCorrectionCreateRequestAttributes sloId(String sloId) {
}

/**
* ID of the SLO that this correction applies to.
* ID of the single SLO that this correction applies to.
*
* @return sloId
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SLO_ID)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getSloId() {
return sloId;
}
Expand All @@ -199,6 +206,29 @@ public void setSloId(String sloId) {
this.sloId = sloId;
}

public SLOCorrectionCreateRequestAttributes sloQuery(String sloQuery) {
this.sloQuery = sloQuery;
return this;
}

/**
* Query that matches the SLOs this correction applies to. The query uses the <a
* href="https://docs.datadoghq.com/events/explorer/searching/">Events search syntax</a> and can
* filter SLOs by SLO tags.
*
* @return sloQuery
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_SLO_QUERY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getSloQuery() {
return sloQuery;
}

public void setSloQuery(String sloQuery) {
this.sloQuery = sloQuery;
}

public SLOCorrectionCreateRequestAttributes start(Long start) {
this.start = start;
return this;
Expand Down Expand Up @@ -303,6 +333,7 @@ public boolean equals(Object o) {
&& Objects.equals(this.end, sloCorrectionCreateRequestAttributes.end)
&& Objects.equals(this.rrule, sloCorrectionCreateRequestAttributes.rrule)
&& Objects.equals(this.sloId, sloCorrectionCreateRequestAttributes.sloId)
&& Objects.equals(this.sloQuery, sloCorrectionCreateRequestAttributes.sloQuery)
&& Objects.equals(this.start, sloCorrectionCreateRequestAttributes.start)
&& Objects.equals(this.timezone, sloCorrectionCreateRequestAttributes.timezone)
&& Objects.equals(
Expand All @@ -312,7 +343,16 @@ public boolean equals(Object o) {
@Override
public int hashCode() {
return Objects.hash(
category, description, duration, end, rrule, sloId, start, timezone, additionalProperties);
category,
description,
duration,
end,
rrule,
sloId,
sloQuery,
start,
timezone,
additionalProperties);
}

@Override
Expand All @@ -325,6 +365,7 @@ public String toString() {
sb.append(" end: ").append(toIndentedString(end)).append("\n");
sb.append(" rrule: ").append(toIndentedString(rrule)).append("\n");
sb.append(" sloId: ").append(toIndentedString(sloId)).append("\n");
sb.append(" sloQuery: ").append(toIndentedString(sloQuery)).append("\n");
sb.append(" start: ").append(toIndentedString(start)).append("\n");
sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n");
sb.append(" additionalProperties: ")
Expand Down
Loading
Loading