From b4937f6235f0187ef6264da84e2d4c80be8bb2ae Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 25 Aug 2023 12:27:56 +0000 Subject: [PATCH] Regenerate client from commit 1a77c0b6 of spec repo --- .apigentools-info | 8 +-- .generator/schemas/v1/openapi.yaml | 5 ++ .../ListSLOCorrection_2647266873.java | 31 +++++++++ .../ServiceLevelObjectiveCorrectionsApi.java | 56 +++++++++++++++- ...returns_OK_response_with_pagination.freeze | 1 + ...s_returns_OK_response_with_pagination.json | 67 +++++++++++++++++++ ...ervice_level_objective_corrections.feature | 8 +++ 7 files changed, 171 insertions(+), 5 deletions(-) create mode 100644 examples/v1/service-level-objective-corrections/ListSLOCorrection_2647266873.java create mode 100644 src/test/resources/cassettes/features/v1/Get_all_SLO_corrections_returns_OK_response_with_pagination.freeze create mode 100644 src/test/resources/cassettes/features/v1/Get_all_SLO_corrections_returns_OK_response_with_pagination.json diff --git a/.apigentools-info b/.apigentools-info index ff29321183f..db19714c709 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -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" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index ec93ec4e73e..dc922326080 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -27185,6 +27185,7 @@ paths: name: limit required: false schema: + default: 25 format: int64 type: integer responses: @@ -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 diff --git a/examples/v1/service-level-objective-corrections/ListSLOCorrection_2647266873.java b/examples/v1/service-level-objective-corrections/ListSLOCorrection_2647266873.java new file mode 100644 index 00000000000..810bbd8a631 --- /dev/null +++ b/examples/v1/service-level-objective-corrections/ListSLOCorrection_2647266873.java @@ -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 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(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v1/api/ServiceLevelObjectiveCorrectionsApi.java b/src/main/java/com/datadog/api/client/v1/api/ServiceLevelObjectiveCorrectionsApi.java index 76cba4d7463..547d9b0d194 100644 --- a/src/main/java/com/datadog/api/client/v1/api/ServiceLevelObjectiveCorrectionsApi.java +++ b/src/main/java/com/datadog/api/client/v1/api/ServiceLevelObjectiveCorrectionsApi.java @@ -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; @@ -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; @@ -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) { @@ -548,6 +551,57 @@ public CompletableFuture listSLOCorrectionAsync( }); } + /** + * Get all SLO corrections. + * + *

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

See {@link #listSLOCorrectionWithHttpInfo}. + * + * @return SLOCorrectionListResponse + */ + public PaginationIterable 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 args = new LinkedHashMap(); + args.put("optionalParams", parameters); + + PaginationIterable iterator = + new PaginationIterable( + this, + "listSLOCorrection", + resultsPath, + valueGetterPath, + valueSetterPath, + valueSetterParamOptional, + limit, + args); + + return iterator; + } + /** * Get all Service Level Objective corrections. * diff --git a/src/test/resources/cassettes/features/v1/Get_all_SLO_corrections_returns_OK_response_with_pagination.freeze b/src/test/resources/cassettes/features/v1/Get_all_SLO_corrections_returns_OK_response_with_pagination.freeze new file mode 100644 index 00000000000..de2a8e7f23e --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Get_all_SLO_corrections_returns_OK_response_with_pagination.freeze @@ -0,0 +1 @@ +2023-08-25T11:50:34.970Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v1/Get_all_SLO_corrections_returns_OK_response_with_pagination.json b/src/test/resources/cassettes/features/v1/Get_all_SLO_corrections_returns_OK_response_with_pagination.json new file mode 100644 index 00000000000..73fa59db119 --- /dev/null +++ b/src/test/resources/cassettes/features/v1/Get_all_SLO_corrections_returns_OK_response_with_pagination.json @@ -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" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v1/api/service_level_objective_corrections.feature b/src/test/resources/com/datadog/api/client/v1/api/service_level_objective_corrections.feature index 8d7974996f6..5bd777cbd51 100644 --- a/src/test/resources/com/datadog/api/client/v1/api/service_level_objective_corrections.feature +++ b/src/test/resources/com/datadog/api/client/v1/api/service_level_objective_corrections.feature @@ -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