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
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.5",
"regenerated": "2023-08-23 20:02:05.705723",
"spec_repo_commit": "7e4a4121"
"regenerated": "2023-08-25 12:25:23.973683",
"spec_repo_commit": "1a77c0b6"
},
"v2": {
"apigentools_version": "1.6.5",
"regenerated": "2023-08-23 20:02:05.718719",
"spec_repo_commit": "7e4a4121"
"regenerated": "2023-08-25 12:25:23.986999",
"spec_repo_commit": "1a77c0b6"
}
}
}
5 changes: 5 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27185,6 +27185,7 @@ paths:
name: limit
required: false
schema:
default: 25
format: int64
type: integer
responses:
Expand All @@ -27210,6 +27211,10 @@ paths:
summary: Get all SLO corrections
tags:
- Service Level Objective Corrections
x-pagination:
limitParam: limit
pageOffsetParam: offset
resultsPath: data
post:
description: Create an SLO Correction.
operationId: CreateSLOCorrection
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Get all SLO corrections returns "OK" response with pagination

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.PaginationIterable;
import com.datadog.api.client.v1.api.ServiceLevelObjectiveCorrectionsApi;
import com.datadog.api.client.v1.api.ServiceLevelObjectiveCorrectionsApi.ListSLOCorrectionOptionalParameters;
import com.datadog.api.client.v1.model.SLOCorrection;

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

try {
PaginationIterable<SLOCorrection> iterable =
apiInstance.listSLOCorrectionWithPagination(
new ListSLOCorrectionOptionalParameters().limit(2L));

for (SLOCorrection item : iterable) {
System.out.println(item);
}
} catch (RuntimeException e) {
System.err.println(
"Exception when calling"
+ " ServiceLevelObjectiveCorrectionsApi#listSLOCorrectionWithPagination");
System.err.println("Reason: " + e.getMessage());
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.ApiResponse;
import com.datadog.api.client.PaginationIterable;
import com.datadog.api.client.Pair;
import com.datadog.api.client.v1.model.SLOCorrection;
import com.datadog.api.client.v1.model.SLOCorrectionCreateRequest;
import com.datadog.api.client.v1.model.SLOCorrectionListResponse;
import com.datadog.api.client.v1.model.SLOCorrectionResponse;
Expand All @@ -12,6 +14,7 @@
import jakarta.ws.rs.core.GenericType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -481,7 +484,7 @@ public ListSLOCorrectionOptionalParameters offset(Long offset) {
* Set limit.
*
* @param limit The number of SLO corrections to return in the response. Default is 25.
* (optional)
* (optional, default to 25)
* @return ListSLOCorrectionOptionalParameters
*/
public ListSLOCorrectionOptionalParameters limit(Long limit) {
Expand Down Expand Up @@ -548,6 +551,57 @@ public CompletableFuture<SLOCorrectionListResponse> listSLOCorrectionAsync(
});
}

/**
* Get all SLO corrections.
*
* <p>See {@link #listSLOCorrectionWithHttpInfo}.
*
* @return PaginationIterable&lt;SLOCorrection&gt;
*/
public PaginationIterable<SLOCorrection> listSLOCorrectionWithPagination() {
ListSLOCorrectionOptionalParameters parameters = new ListSLOCorrectionOptionalParameters();
return listSLOCorrectionWithPagination(parameters);
}

/**
* Get all SLO corrections.
*
* <p>See {@link #listSLOCorrectionWithHttpInfo}.
*
* @return SLOCorrectionListResponse
*/
public PaginationIterable<SLOCorrection> listSLOCorrectionWithPagination(
ListSLOCorrectionOptionalParameters parameters) {
String resultsPath = "getData";
String valueGetterPath = "";
String valueSetterPath = "offset";
Boolean valueSetterParamOptional = true;
Long limit;

if (parameters.limit == null) {
limit = 25l;
parameters.limit(limit);
} else {
limit = parameters.limit;
}

LinkedHashMap<String, Object> args = new LinkedHashMap<String, Object>();
args.put("optionalParams", parameters);

PaginationIterable iterator =
new PaginationIterable(
this,
"listSLOCorrection",
resultsPath,
valueGetterPath,
valueSetterPath,
valueSetterParamOptional,
limit,
args);

return iterator;
}

/**
* Get all Service Level Objective corrections.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-08-25T11:50:34.970Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[
{
"httpRequest": {
"headers": {},
"method": "GET",
"path": "/api/v1/slo/correction",
"queryStringParameters": {
"limit": [
"2"
]
},
"keepAlive": false,
"secure": true
},
"httpResponse": {
"body": "{\"data\":[{\"type\":\"correction\",\"id\":\"fb76e0fa-bf7b-11ed-ba7e-da7ad0902002\",\"attributes\":{\"slo_id\":\"a17acfd48b7c55d19192e3a697cc1d01\",\"start\":1678255200,\"end\":1678355280,\"description\":\"\",\"category\":\"Other\",\"timezone\":\"UTC\",\"created_at\":1678477473,\"modified_at\":1678477473,\"rrule\":null,\"duration\":null,\"creator\":{\"data\":{\"type\":\"users\",\"id\":\"35c75d43-eba0-11e9-a77a-2b3585ff5dfb\",\"attributes\":{\"uuid\":\"35c75d43-eba0-11e9-a77a-2b3585ff5dfb\",\"handle\":\"support-nickautotestingorg\",\"email\":\"support-user-prod@datadoghq.com\",\"name\":\"Datadog Support\",\"icon\":\"https://secure.gravatar.com/avatar/e6952b5f29fe2d996cf4e63f40db9e71?s=48&d=retro\"}}},\"modifier\":null}},{\"type\":\"correction\",\"id\":\"2d16c2ee-bf70-11ed-895f-da7ad0902002\",\"attributes\":{\"slo_id\":\"70e82706f4ae56ff8bdd7f02e767f97c\",\"start\":1678255200,\"end\":1678339140,\"description\":\"\",\"category\":\"Other\",\"timezone\":\"UTC\",\"created_at\":1678472403,\"modified_at\":1678472403,\"rrule\":null,\"duration\":null,\"creator\":{\"data\":{\"type\":\"users\",\"id\":\"35c75d43-eba0-11e9-a77a-2b3585ff5dfb\",\"attributes\":{\"uuid\":\"35c75d43-eba0-11e9-a77a-2b3585ff5dfb\",\"handle\":\"support-nickautotestingorg\",\"email\":\"support-user-prod@datadoghq.com\",\"name\":\"Datadog Support\",\"icon\":\"https://secure.gravatar.com/avatar/e6952b5f29fe2d996cf4e63f40db9e71?s=48&d=retro\"}}},\"modifier\":null}}],\"meta\":{\"page\":{\"total_count\":3,\"total_filtered_count\":2}}}\n",
"headers": {
"Content-Type": [
"application/json"
]
},
"statusCode": 200,
"reasonPhrase": "OK"
},
"times": {
"remainingTimes": 1
},
"timeToLive": {
"unlimited": true
},
"id": "a4725668-1b35-9bab-3677-12eda16a1905"
},
{
"httpRequest": {
"headers": {},
"method": "GET",
"path": "/api/v1/slo/correction",
"queryStringParameters": {
"limit": [
"2"
],
"offset": [
"2"
]
},
"keepAlive": false,
"secure": true
},
"httpResponse": {
"body": "{\"data\":[{\"type\":\"correction\",\"id\":\"cc2316d2-bf6e-11ed-82f2-da7ad0902002\",\"attributes\":{\"slo_id\":\"955ab6301fa656e7b061de4a05ad4774\",\"start\":1678255200,\"end\":1678339140,\"description\":\"\",\"category\":\"Other\",\"timezone\":\"UTC\",\"created_at\":1678471811,\"modified_at\":1678471811,\"rrule\":null,\"duration\":null,\"creator\":{\"data\":{\"type\":\"users\",\"id\":\"35c75d43-eba0-11e9-a77a-2b3585ff5dfb\",\"attributes\":{\"uuid\":\"35c75d43-eba0-11e9-a77a-2b3585ff5dfb\",\"handle\":\"support-nickautotestingorg\",\"email\":\"support-user-prod@datadoghq.com\",\"name\":\"Datadog Support\",\"icon\":\"https://secure.gravatar.com/avatar/e6952b5f29fe2d996cf4e63f40db9e71?s=48&d=retro\"}}},\"modifier\":null}}],\"meta\":{\"page\":{\"total_count\":3,\"total_filtered_count\":1}}}\n",
"headers": {
"Content-Type": [
"application/json"
]
},
"statusCode": 200,
"reasonPhrase": "OK"
},
"times": {
"remainingTimes": 1
},
"timeToLive": {
"unlimited": true
},
"id": "95d50d9a-0ada-960f-9b57-178aacd8f885"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ Feature: Service Level Objective Corrections
Then the response status is 200 OK
And the response "data" has length 1

@replay-only @skip-validation @team:DataDog/slo-app @with-pagination
Scenario: Get all SLO corrections returns "OK" response with pagination
Given new "ListSLOCorrection" request
And request contains "limit" parameter with value 2
When the request with pagination is sent
Then the response status is 200 OK
And the response has 3 items

@generated @skip @team:DataDog/slo-app
Scenario: Get an SLO correction for an SLO returns "Bad Request" response
Given new "GetSLOCorrection" request
Expand Down