From 88eeec75aba51003a3c93c7fcf454b663a80efc3 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 22 Jan 2026 12:03:04 +0000 Subject: [PATCH] Regenerate client from commit 8b43fc8 of spec repo --- .generator/schemas/v2/openapi.yaml | 170 +++++++++++++++ .../test-optimization/UpdateFlakyTests.java | 45 ++++ .../com/datadog/api/client/ApiClient.java | 1 + .../client/v2/api/TestOptimizationApi.java | 152 +++++++++++++ .../v2/model/UpdateFlakyTestsRequest.java | 145 +++++++++++++ .../UpdateFlakyTestsRequestAttributes.java | 157 ++++++++++++++ .../v2/model/UpdateFlakyTestsRequestData.java | 183 ++++++++++++++++ .../UpdateFlakyTestsRequestDataType.java | 58 +++++ .../v2/model/UpdateFlakyTestsRequestTest.java | 181 ++++++++++++++++ .../UpdateFlakyTestsRequestTestNewState.java | 65 ++++++ .../v2/model/UpdateFlakyTestsResponse.java | 136 ++++++++++++ .../UpdateFlakyTestsResponseAttributes.java | 189 ++++++++++++++++ .../model/UpdateFlakyTestsResponseData.java | 197 +++++++++++++++++ .../UpdateFlakyTestsResponseDataType.java | 58 +++++ .../model/UpdateFlakyTestsResponseResult.java | 203 ++++++++++++++++++ .../client/v2/api/test_optimization.feature | 38 +++- .../com/datadog/api/client/v2/api/undo.json | 6 + 17 files changed, 1977 insertions(+), 7 deletions(-) create mode 100644 examples/v2/test-optimization/UpdateFlakyTests.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequestAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequestData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequestDataType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequestTest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequestTestNewState.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsResponseAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsResponseData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsResponseDataType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsResponseResult.java diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 39f6901f1a8..c7a12f62640 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -61289,6 +61289,136 @@ components: - name - options type: object + UpdateFlakyTestsRequest: + description: Request to update the state of multiple flaky tests. + properties: + data: + $ref: '#/components/schemas/UpdateFlakyTestsRequestData' + required: + - data + type: object + UpdateFlakyTestsRequestAttributes: + description: Attributes for updating flaky test states. + properties: + tests: + description: List of flaky tests to update. + items: + $ref: '#/components/schemas/UpdateFlakyTestsRequestTest' + type: array + required: + - tests + type: object + UpdateFlakyTestsRequestData: + description: The JSON:API data for updating flaky test states. + properties: + attributes: + $ref: '#/components/schemas/UpdateFlakyTestsRequestAttributes' + type: + $ref: '#/components/schemas/UpdateFlakyTestsRequestDataType' + required: + - type + - attributes + type: object + UpdateFlakyTestsRequestDataType: + description: The definition of `UpdateFlakyTestsRequestDataType` object. + enum: + - update_flaky_test_state_request + example: update_flaky_test_state_request + type: string + x-enum-varnames: + - UPDATE_FLAKY_TEST_STATE_REQUEST + UpdateFlakyTestsRequestTest: + description: Details of what tests to update and their new attributes. + properties: + id: + description: The ID of the flaky test. This is the same ID returned by the + Search flaky tests endpoint and corresponds to the test_fingerprint_fqn + field in test run events. + example: 4eb1887a8adb1847 + type: string + new_state: + $ref: '#/components/schemas/UpdateFlakyTestsRequestTestNewState' + required: + - id + - new_state + type: object + UpdateFlakyTestsRequestTestNewState: + description: The new state to set for the flaky test. + enum: + - active + - quarantined + - disabled + - fixed + example: active + type: string + x-enum-varnames: + - ACTIVE + - QUARANTINED + - DISABLED + - FIXED + UpdateFlakyTestsResponse: + description: Response object for updating flaky test states. + properties: + data: + $ref: '#/components/schemas/UpdateFlakyTestsResponseData' + type: object + UpdateFlakyTestsResponseAttributes: + description: Attributes for the update flaky test state response. + properties: + has_errors: + description: '`True` if any errors occurred during the update operations. + `False` if all tests succeeded to be updated.' + example: true + type: boolean + results: + description: Results of the update operation for each test. + items: + $ref: '#/components/schemas/UpdateFlakyTestsResponseResult' + type: array + required: + - has_errors + - results + type: object + UpdateFlakyTestsResponseData: + description: Summary of the update operations. Tells whether a test succeeded + or failed to be updated. + properties: + attributes: + $ref: '#/components/schemas/UpdateFlakyTestsResponseAttributes' + id: + description: The ID of the response. + type: string + type: + $ref: '#/components/schemas/UpdateFlakyTestsResponseDataType' + type: object + UpdateFlakyTestsResponseDataType: + description: The definition of `UpdateFlakyTestsResponseDataType` object. + enum: + - update_flaky_test_state_response + type: string + x-enum-varnames: + - UPDATE_FLAKY_TEST_STATE_RESPONSE + UpdateFlakyTestsResponseResult: + description: Result of updating a single flaky test state. + properties: + error: + description: Error message if the update failed. + type: string + id: + description: The ID of the flaky test from the request. This is the same + ID returned by the Search flaky tests endpoint and corresponds to the + test_fingerprint_fqn field in test run events. + example: 4eb1887a8adb1847 + type: string + success: + description: '`True` if the update was successful, `False` if there were + any errors.' + example: false + type: boolean + required: + - id + - success + type: object UpdateOnCallNotificationRuleRequest: description: A top-level wrapper for updating a notification rule for a user example: @@ -63638,6 +63768,8 @@ components: teams_read: Read Teams data. A User with this permission can view Team names, metadata, and which Users are on each Team. test_optimization_read: View Test Optimization. + test_optimization_write: Update flaky tests from Flaky Tests Management + of Test Optimization. timeseries_query: Query Timeseries data. usage_read: View your organization's usage and usage attribution. user_access_invite: Invite other users to your organization. @@ -94850,6 +94982,44 @@ paths: - incident_settings_write x-unstable: '**Note**: This endpoint is deprecated. See the [Teams API endpoints](https://docs.datadoghq.com/api/latest/teams/).' /api/v2/test/flaky-test-management/tests: + patch: + description: Update the state of multiple flaky tests in Flaky Test Management. + operationId: UpdateFlakyTests + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateFlakyTestsRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateFlakyTestsResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - test_optimization_write + summary: Update flaky test states + tags: + - Test Optimization + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - test_optimization_write + x-unstable: '**Note**: This endpoint is in preview and may be subject to change. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' post: description: List endpoint returning flaky tests from Flaky Test Management. Results are paginated. diff --git a/examples/v2/test-optimization/UpdateFlakyTests.java b/examples/v2/test-optimization/UpdateFlakyTests.java new file mode 100644 index 00000000000..f0d4c1265d0 --- /dev/null +++ b/examples/v2/test-optimization/UpdateFlakyTests.java @@ -0,0 +1,45 @@ +// Update flaky test states returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.TestOptimizationApi; +import com.datadog.api.client.v2.model.UpdateFlakyTestsRequest; +import com.datadog.api.client.v2.model.UpdateFlakyTestsRequestAttributes; +import com.datadog.api.client.v2.model.UpdateFlakyTestsRequestData; +import com.datadog.api.client.v2.model.UpdateFlakyTestsRequestDataType; +import com.datadog.api.client.v2.model.UpdateFlakyTestsRequestTest; +import com.datadog.api.client.v2.model.UpdateFlakyTestsRequestTestNewState; +import com.datadog.api.client.v2.model.UpdateFlakyTestsResponse; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.updateFlakyTests", true); + TestOptimizationApi apiInstance = new TestOptimizationApi(defaultClient); + + UpdateFlakyTestsRequest body = + new UpdateFlakyTestsRequest() + .data( + new UpdateFlakyTestsRequestData() + .attributes( + new UpdateFlakyTestsRequestAttributes() + .tests( + Collections.singletonList( + new UpdateFlakyTestsRequestTest() + .id("4eb1887a8adb1847") + .newState(UpdateFlakyTestsRequestTestNewState.ACTIVE)))) + .type(UpdateFlakyTestsRequestDataType.UPDATE_FLAKY_TEST_STATE_REQUEST)); + + try { + UpdateFlakyTestsResponse result = apiInstance.updateFlakyTests(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling TestOptimizationApi#updateFlakyTests"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 5c25d9425fa..e350ffb739d 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -924,6 +924,7 @@ public class ApiClient { put("v2.listIncidentTeams", false); put("v2.updateIncidentTeam", false); put("v2.searchFlakyTests", false); + put("v2.updateFlakyTests", false); } }; protected static final java.util.logging.Logger logger = diff --git a/src/main/java/com/datadog/api/client/v2/api/TestOptimizationApi.java b/src/main/java/com/datadog/api/client/v2/api/TestOptimizationApi.java index 7335dca2f23..9cbe934357a 100644 --- a/src/main/java/com/datadog/api/client/v2/api/TestOptimizationApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/TestOptimizationApi.java @@ -11,6 +11,8 @@ import com.datadog.api.client.v2.model.FlakyTestsSearchRequestAttributes; import com.datadog.api.client.v2.model.FlakyTestsSearchRequestData; import com.datadog.api.client.v2.model.FlakyTestsSearchResponse; +import com.datadog.api.client.v2.model.UpdateFlakyTestsRequest; +import com.datadog.api.client.v2.model.UpdateFlakyTestsResponse; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.GenericType; import java.util.ArrayList; @@ -295,4 +297,154 @@ public CompletableFuture> searchFlakyTests false, new GenericType() {}); } + + /** + * Update flaky test states. + * + *

See {@link #updateFlakyTestsWithHttpInfo}. + * + * @param body (required) + * @return UpdateFlakyTestsResponse + * @throws ApiException if fails to make API call + */ + public UpdateFlakyTestsResponse updateFlakyTests(UpdateFlakyTestsRequest body) + throws ApiException { + return updateFlakyTestsWithHttpInfo(body).getData(); + } + + /** + * Update flaky test states. + * + *

See {@link #updateFlakyTestsWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<UpdateFlakyTestsResponse> + */ + public CompletableFuture updateFlakyTestsAsync( + UpdateFlakyTestsRequest body) { + return updateFlakyTestsWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update the state of multiple flaky tests in Flaky Test Management. + * + * @param body (required) + * @return ApiResponse<UpdateFlakyTestsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Not Authorized -
429 Too many requests -
+ */ + public ApiResponse updateFlakyTestsWithHttpInfo( + UpdateFlakyTestsRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateFlakyTests"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateFlakyTests"); + } + // create path and map variables + String localVarPath = "/api/v2/test/flaky-test-management/tests"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.TestOptimizationApi.updateFlakyTests", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update flaky test states. + * + *

See {@link #updateFlakyTestsWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<UpdateFlakyTestsResponse>> + */ + public CompletableFuture> updateFlakyTestsWithHttpInfoAsync( + UpdateFlakyTestsRequest body) { + // Check if unstable operation is enabled + String operationId = "updateFlakyTests"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling updateFlakyTests")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/test/flaky-test-management/tests"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.TestOptimizationApi.updateFlakyTests", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequest.java b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequest.java new file mode 100644 index 00000000000..a0f59ad373c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequest.java @@ -0,0 +1,145 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request to update the state of multiple flaky tests. */ +@JsonPropertyOrder({UpdateFlakyTestsRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UpdateFlakyTestsRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private UpdateFlakyTestsRequestData data; + + public UpdateFlakyTestsRequest() {} + + @JsonCreator + public UpdateFlakyTestsRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) UpdateFlakyTestsRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public UpdateFlakyTestsRequest data(UpdateFlakyTestsRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The JSON:API data for updating flaky test states. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UpdateFlakyTestsRequestData getData() { + return data; + } + + public void setData(UpdateFlakyTestsRequestData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return UpdateFlakyTestsRequest + */ + @JsonAnySetter + public UpdateFlakyTestsRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this UpdateFlakyTestsRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFlakyTestsRequest updateFlakyTestsRequest = (UpdateFlakyTestsRequest) o; + return Objects.equals(this.data, updateFlakyTestsRequest.data) + && Objects.equals(this.additionalProperties, updateFlakyTestsRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFlakyTestsRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequestAttributes.java new file mode 100644 index 00000000000..81a70dec992 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequestAttributes.java @@ -0,0 +1,157 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes for updating flaky test states. */ +@JsonPropertyOrder({UpdateFlakyTestsRequestAttributes.JSON_PROPERTY_TESTS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UpdateFlakyTestsRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_TESTS = "tests"; + private List tests = new ArrayList<>(); + + public UpdateFlakyTestsRequestAttributes() {} + + @JsonCreator + public UpdateFlakyTestsRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_TESTS) + List tests) { + this.tests = tests; + } + + public UpdateFlakyTestsRequestAttributes tests(List tests) { + this.tests = tests; + for (UpdateFlakyTestsRequestTest item : tests) { + this.unparsed |= item.unparsed; + } + return this; + } + + public UpdateFlakyTestsRequestAttributes addTestsItem(UpdateFlakyTestsRequestTest testsItem) { + this.tests.add(testsItem); + this.unparsed |= testsItem.unparsed; + return this; + } + + /** + * List of flaky tests to update. + * + * @return tests + */ + @JsonProperty(JSON_PROPERTY_TESTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTests() { + return tests; + } + + public void setTests(List tests) { + this.tests = tests; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return UpdateFlakyTestsRequestAttributes + */ + @JsonAnySetter + public UpdateFlakyTestsRequestAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this UpdateFlakyTestsRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFlakyTestsRequestAttributes updateFlakyTestsRequestAttributes = + (UpdateFlakyTestsRequestAttributes) o; + return Objects.equals(this.tests, updateFlakyTestsRequestAttributes.tests) + && Objects.equals( + this.additionalProperties, updateFlakyTestsRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(tests, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFlakyTestsRequestAttributes {\n"); + sb.append(" tests: ").append(toIndentedString(tests)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequestData.java b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequestData.java new file mode 100644 index 00000000000..ee167260942 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequestData.java @@ -0,0 +1,183 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The JSON:API data for updating flaky test states. */ +@JsonPropertyOrder({ + UpdateFlakyTestsRequestData.JSON_PROPERTY_ATTRIBUTES, + UpdateFlakyTestsRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UpdateFlakyTestsRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private UpdateFlakyTestsRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private UpdateFlakyTestsRequestDataType type; + + public UpdateFlakyTestsRequestData() {} + + @JsonCreator + public UpdateFlakyTestsRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + UpdateFlakyTestsRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + UpdateFlakyTestsRequestDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public UpdateFlakyTestsRequestData attributes(UpdateFlakyTestsRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for updating flaky test states. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UpdateFlakyTestsRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(UpdateFlakyTestsRequestAttributes attributes) { + this.attributes = attributes; + } + + public UpdateFlakyTestsRequestData type(UpdateFlakyTestsRequestDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of UpdateFlakyTestsRequestDataType object. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UpdateFlakyTestsRequestDataType getType() { + return type; + } + + public void setType(UpdateFlakyTestsRequestDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return UpdateFlakyTestsRequestData + */ + @JsonAnySetter + public UpdateFlakyTestsRequestData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this UpdateFlakyTestsRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFlakyTestsRequestData updateFlakyTestsRequestData = (UpdateFlakyTestsRequestData) o; + return Objects.equals(this.attributes, updateFlakyTestsRequestData.attributes) + && Objects.equals(this.type, updateFlakyTestsRequestData.type) + && Objects.equals( + this.additionalProperties, updateFlakyTestsRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFlakyTestsRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequestDataType.java b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequestDataType.java new file mode 100644 index 00000000000..470ca6611d3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequestDataType.java @@ -0,0 +1,58 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of UpdateFlakyTestsRequestDataType object. */ +@JsonSerialize( + using = UpdateFlakyTestsRequestDataType.UpdateFlakyTestsRequestDataTypeSerializer.class) +public class UpdateFlakyTestsRequestDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("update_flaky_test_state_request")); + + public static final UpdateFlakyTestsRequestDataType UPDATE_FLAKY_TEST_STATE_REQUEST = + new UpdateFlakyTestsRequestDataType("update_flaky_test_state_request"); + + UpdateFlakyTestsRequestDataType(String value) { + super(value, allowedValues); + } + + public static class UpdateFlakyTestsRequestDataTypeSerializer + extends StdSerializer { + public UpdateFlakyTestsRequestDataTypeSerializer(Class t) { + super(t); + } + + public UpdateFlakyTestsRequestDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + UpdateFlakyTestsRequestDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static UpdateFlakyTestsRequestDataType fromValue(String value) { + return new UpdateFlakyTestsRequestDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequestTest.java b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequestTest.java new file mode 100644 index 00000000000..8ef4656b714 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequestTest.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Details of what tests to update and their new attributes. */ +@JsonPropertyOrder({ + UpdateFlakyTestsRequestTest.JSON_PROPERTY_ID, + UpdateFlakyTestsRequestTest.JSON_PROPERTY_NEW_STATE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UpdateFlakyTestsRequestTest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_NEW_STATE = "new_state"; + private UpdateFlakyTestsRequestTestNewState newState; + + public UpdateFlakyTestsRequestTest() {} + + @JsonCreator + public UpdateFlakyTestsRequestTest( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_NEW_STATE) + UpdateFlakyTestsRequestTestNewState newState) { + this.id = id; + this.newState = newState; + this.unparsed |= !newState.isValid(); + } + + public UpdateFlakyTestsRequestTest id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the flaky test. This is the same ID returned by the Search flaky tests endpoint and + * corresponds to the test_fingerprint_fqn field in test run events. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public UpdateFlakyTestsRequestTest newState(UpdateFlakyTestsRequestTestNewState newState) { + this.newState = newState; + this.unparsed |= !newState.isValid(); + return this; + } + + /** + * The new state to set for the flaky test. + * + * @return newState + */ + @JsonProperty(JSON_PROPERTY_NEW_STATE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UpdateFlakyTestsRequestTestNewState getNewState() { + return newState; + } + + public void setNewState(UpdateFlakyTestsRequestTestNewState newState) { + if (!newState.isValid()) { + this.unparsed = true; + } + this.newState = newState; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return UpdateFlakyTestsRequestTest + */ + @JsonAnySetter + public UpdateFlakyTestsRequestTest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this UpdateFlakyTestsRequestTest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFlakyTestsRequestTest updateFlakyTestsRequestTest = (UpdateFlakyTestsRequestTest) o; + return Objects.equals(this.id, updateFlakyTestsRequestTest.id) + && Objects.equals(this.newState, updateFlakyTestsRequestTest.newState) + && Objects.equals( + this.additionalProperties, updateFlakyTestsRequestTest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, newState, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFlakyTestsRequestTest {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" newState: ").append(toIndentedString(newState)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequestTestNewState.java b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequestTestNewState.java new file mode 100644 index 00000000000..cb51ebb9638 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsRequestTestNewState.java @@ -0,0 +1,65 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The new state to set for the flaky test. */ +@JsonSerialize( + using = UpdateFlakyTestsRequestTestNewState.UpdateFlakyTestsRequestTestNewStateSerializer.class) +public class UpdateFlakyTestsRequestTestNewState extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("active", "quarantined", "disabled", "fixed")); + + public static final UpdateFlakyTestsRequestTestNewState ACTIVE = + new UpdateFlakyTestsRequestTestNewState("active"); + public static final UpdateFlakyTestsRequestTestNewState QUARANTINED = + new UpdateFlakyTestsRequestTestNewState("quarantined"); + public static final UpdateFlakyTestsRequestTestNewState DISABLED = + new UpdateFlakyTestsRequestTestNewState("disabled"); + public static final UpdateFlakyTestsRequestTestNewState FIXED = + new UpdateFlakyTestsRequestTestNewState("fixed"); + + UpdateFlakyTestsRequestTestNewState(String value) { + super(value, allowedValues); + } + + public static class UpdateFlakyTestsRequestTestNewStateSerializer + extends StdSerializer { + public UpdateFlakyTestsRequestTestNewStateSerializer( + Class t) { + super(t); + } + + public UpdateFlakyTestsRequestTestNewStateSerializer() { + this(null); + } + + @Override + public void serialize( + UpdateFlakyTestsRequestTestNewState value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static UpdateFlakyTestsRequestTestNewState fromValue(String value) { + return new UpdateFlakyTestsRequestTestNewState(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsResponse.java b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsResponse.java new file mode 100644 index 00000000000..d4881d34e58 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsResponse.java @@ -0,0 +1,136 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response object for updating flaky test states. */ +@JsonPropertyOrder({UpdateFlakyTestsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UpdateFlakyTestsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private UpdateFlakyTestsResponseData data; + + public UpdateFlakyTestsResponse data(UpdateFlakyTestsResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Summary of the update operations. Tells whether a test succeeded or failed to be updated. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UpdateFlakyTestsResponseData getData() { + return data; + } + + public void setData(UpdateFlakyTestsResponseData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return UpdateFlakyTestsResponse + */ + @JsonAnySetter + public UpdateFlakyTestsResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this UpdateFlakyTestsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFlakyTestsResponse updateFlakyTestsResponse = (UpdateFlakyTestsResponse) o; + return Objects.equals(this.data, updateFlakyTestsResponse.data) + && Objects.equals(this.additionalProperties, updateFlakyTestsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFlakyTestsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsResponseAttributes.java new file mode 100644 index 00000000000..372088f7704 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsResponseAttributes.java @@ -0,0 +1,189 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes for the update flaky test state response. */ +@JsonPropertyOrder({ + UpdateFlakyTestsResponseAttributes.JSON_PROPERTY_HAS_ERRORS, + UpdateFlakyTestsResponseAttributes.JSON_PROPERTY_RESULTS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UpdateFlakyTestsResponseAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_HAS_ERRORS = "has_errors"; + private Boolean hasErrors; + + public static final String JSON_PROPERTY_RESULTS = "results"; + private List results = new ArrayList<>(); + + public UpdateFlakyTestsResponseAttributes() {} + + @JsonCreator + public UpdateFlakyTestsResponseAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_HAS_ERRORS) Boolean hasErrors, + @JsonProperty(required = true, value = JSON_PROPERTY_RESULTS) + List results) { + this.hasErrors = hasErrors; + this.results = results; + } + + public UpdateFlakyTestsResponseAttributes hasErrors(Boolean hasErrors) { + this.hasErrors = hasErrors; + return this; + } + + /** + * True if any errors occurred during the update operations. False if + * all tests succeeded to be updated. + * + * @return hasErrors + */ + @JsonProperty(JSON_PROPERTY_HAS_ERRORS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getHasErrors() { + return hasErrors; + } + + public void setHasErrors(Boolean hasErrors) { + this.hasErrors = hasErrors; + } + + public UpdateFlakyTestsResponseAttributes results(List results) { + this.results = results; + for (UpdateFlakyTestsResponseResult item : results) { + this.unparsed |= item.unparsed; + } + return this; + } + + public UpdateFlakyTestsResponseAttributes addResultsItem( + UpdateFlakyTestsResponseResult resultsItem) { + this.results.add(resultsItem); + this.unparsed |= resultsItem.unparsed; + return this; + } + + /** + * Results of the update operation for each test. + * + * @return results + */ + @JsonProperty(JSON_PROPERTY_RESULTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getResults() { + return results; + } + + public void setResults(List results) { + this.results = results; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return UpdateFlakyTestsResponseAttributes + */ + @JsonAnySetter + public UpdateFlakyTestsResponseAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this UpdateFlakyTestsResponseAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFlakyTestsResponseAttributes updateFlakyTestsResponseAttributes = + (UpdateFlakyTestsResponseAttributes) o; + return Objects.equals(this.hasErrors, updateFlakyTestsResponseAttributes.hasErrors) + && Objects.equals(this.results, updateFlakyTestsResponseAttributes.results) + && Objects.equals( + this.additionalProperties, updateFlakyTestsResponseAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(hasErrors, results, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFlakyTestsResponseAttributes {\n"); + sb.append(" hasErrors: ").append(toIndentedString(hasErrors)).append("\n"); + sb.append(" results: ").append(toIndentedString(results)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsResponseData.java b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsResponseData.java new file mode 100644 index 00000000000..2ef08da2785 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsResponseData.java @@ -0,0 +1,197 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Summary of the update operations. Tells whether a test succeeded or failed to be updated. */ +@JsonPropertyOrder({ + UpdateFlakyTestsResponseData.JSON_PROPERTY_ATTRIBUTES, + UpdateFlakyTestsResponseData.JSON_PROPERTY_ID, + UpdateFlakyTestsResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UpdateFlakyTestsResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private UpdateFlakyTestsResponseAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private UpdateFlakyTestsResponseDataType type; + + public UpdateFlakyTestsResponseData attributes(UpdateFlakyTestsResponseAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for the update flaky test state response. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UpdateFlakyTestsResponseAttributes getAttributes() { + return attributes; + } + + public void setAttributes(UpdateFlakyTestsResponseAttributes attributes) { + this.attributes = attributes; + } + + public UpdateFlakyTestsResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the response. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public UpdateFlakyTestsResponseData type(UpdateFlakyTestsResponseDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The definition of UpdateFlakyTestsResponseDataType object. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UpdateFlakyTestsResponseDataType getType() { + return type; + } + + public void setType(UpdateFlakyTestsResponseDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return UpdateFlakyTestsResponseData + */ + @JsonAnySetter + public UpdateFlakyTestsResponseData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this UpdateFlakyTestsResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFlakyTestsResponseData updateFlakyTestsResponseData = (UpdateFlakyTestsResponseData) o; + return Objects.equals(this.attributes, updateFlakyTestsResponseData.attributes) + && Objects.equals(this.id, updateFlakyTestsResponseData.id) + && Objects.equals(this.type, updateFlakyTestsResponseData.type) + && Objects.equals( + this.additionalProperties, updateFlakyTestsResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFlakyTestsResponseData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsResponseDataType.java b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsResponseDataType.java new file mode 100644 index 00000000000..3b96f220cb5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsResponseDataType.java @@ -0,0 +1,58 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The definition of UpdateFlakyTestsResponseDataType object. */ +@JsonSerialize( + using = UpdateFlakyTestsResponseDataType.UpdateFlakyTestsResponseDataTypeSerializer.class) +public class UpdateFlakyTestsResponseDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("update_flaky_test_state_response")); + + public static final UpdateFlakyTestsResponseDataType UPDATE_FLAKY_TEST_STATE_RESPONSE = + new UpdateFlakyTestsResponseDataType("update_flaky_test_state_response"); + + UpdateFlakyTestsResponseDataType(String value) { + super(value, allowedValues); + } + + public static class UpdateFlakyTestsResponseDataTypeSerializer + extends StdSerializer { + public UpdateFlakyTestsResponseDataTypeSerializer(Class t) { + super(t); + } + + public UpdateFlakyTestsResponseDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + UpdateFlakyTestsResponseDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static UpdateFlakyTestsResponseDataType fromValue(String value) { + return new UpdateFlakyTestsResponseDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsResponseResult.java b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsResponseResult.java new file mode 100644 index 00000000000..117ecd37583 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateFlakyTestsResponseResult.java @@ -0,0 +1,203 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Result of updating a single flaky test state. */ +@JsonPropertyOrder({ + UpdateFlakyTestsResponseResult.JSON_PROPERTY_ERROR, + UpdateFlakyTestsResponseResult.JSON_PROPERTY_ID, + UpdateFlakyTestsResponseResult.JSON_PROPERTY_SUCCESS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UpdateFlakyTestsResponseResult { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ERROR = "error"; + private String error; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_SUCCESS = "success"; + private Boolean success; + + public UpdateFlakyTestsResponseResult() {} + + @JsonCreator + public UpdateFlakyTestsResponseResult( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_SUCCESS) Boolean success) { + this.id = id; + this.success = success; + } + + public UpdateFlakyTestsResponseResult error(String error) { + this.error = error; + return this; + } + + /** + * Error message if the update failed. + * + * @return error + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ERROR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getError() { + return error; + } + + public void setError(String error) { + this.error = error; + } + + public UpdateFlakyTestsResponseResult id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the flaky test from the request. This is the same ID returned by the Search flaky + * tests endpoint and corresponds to the test_fingerprint_fqn field in test run events. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public UpdateFlakyTestsResponseResult success(Boolean success) { + this.success = success; + return this; + } + + /** + * True if the update was successful, False if there were any errors. + * + * @return success + */ + @JsonProperty(JSON_PROPERTY_SUCCESS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getSuccess() { + return success; + } + + public void setSuccess(Boolean success) { + this.success = success; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return UpdateFlakyTestsResponseResult + */ + @JsonAnySetter + public UpdateFlakyTestsResponseResult putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this UpdateFlakyTestsResponseResult object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFlakyTestsResponseResult updateFlakyTestsResponseResult = + (UpdateFlakyTestsResponseResult) o; + return Objects.equals(this.error, updateFlakyTestsResponseResult.error) + && Objects.equals(this.id, updateFlakyTestsResponseResult.id) + && Objects.equals(this.success, updateFlakyTestsResponseResult.success) + && Objects.equals( + this.additionalProperties, updateFlakyTestsResponseResult.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(error, id, success, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFlakyTestsResponseResult {\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/test_optimization.feature b/src/test/resources/com/datadog/api/client/v2/api/test_optimization.feature index 18af1e9cad9..d21278d7646 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/test_optimization.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/test_optimization.feature @@ -8,35 +8,59 @@ Feature: Test Optimization Given a valid "apiKeyAuth" key in the system And a valid "appKeyAuth" key in the system And an instance of "TestOptimization" API - And operation "SearchFlakyTests" enabled - And new "SearchFlakyTests" request @generated @skip @team:DataDog/ci-app-backend Scenario: Search flaky tests returns "Bad Request" response - Given body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}} + Given operation "SearchFlakyTests" enabled + And new "SearchFlakyTests" request + And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}} When the request is sent Then the response status is 400 Bad Request @skip @team:DataDog/ci-app-backend Scenario: Search flaky tests returns "Bad Request" response with invalid limit - Given body with value {"data": {"attributes": {"filter": {"query": "*"}, "page": {"limit": 2000}, "sort": "fqn"}, "type": "search_flaky_tests_request"}} + Given operation "SearchFlakyTests" enabled + And new "SearchFlakyTests" request + And body with value {"data": {"attributes": {"filter": {"query": "*"}, "page": {"limit": 2000}, "sort": "fqn"}, "type": "search_flaky_tests_request"}} When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/ci-app-backend Scenario: Search flaky tests returns "OK" response - Given body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}} + Given operation "SearchFlakyTests" enabled + And new "SearchFlakyTests" request + And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}} When the request is sent Then the response status is 200 OK @replay-only @skip @skip-validation @team:DataDog/ci-app-backend @with-pagination Scenario: Search flaky tests returns "OK" response with filtered query - Given body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/cart-tracking\""}, "page": {"limit": 10}, "sort": "-last_flaked"}, "type": "search_flaky_tests_request"}} + Given operation "SearchFlakyTests" enabled + And new "SearchFlakyTests" request + And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/cart-tracking\""}, "page": {"limit": 10}, "sort": "-last_flaked"}, "type": "search_flaky_tests_request"}} When the request with pagination is sent Then the response status is 200 OK @generated @skip @team:DataDog/ci-app-backend @with-pagination Scenario: Search flaky tests returns "OK" response with pagination - Given body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}} + Given operation "SearchFlakyTests" enabled + And new "SearchFlakyTests" request + And body with value {"data": {"attributes": {"filter": {"query": "flaky_test_state:active @git.repository.id_v2:\"github.com/datadog/shopist\""}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "failure_rate"}, "type": "search_flaky_tests_request"}} When the request with pagination is sent Then the response status is 200 OK + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Update flaky test states returns "Bad Request" response + Given operation "UpdateFlakyTests" enabled + And new "UpdateFlakyTests" request + And body with value {"data": {"attributes": {"tests": [{"id": "4eb1887a8adb1847", "new_state": "active"}]}, "type": "update_flaky_test_state_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Update flaky test states returns "OK" response + Given operation "UpdateFlakyTests" enabled + And new "UpdateFlakyTests" request + And body with value {"data": {"attributes": {"tests": [{"id": "4eb1887a8adb1847", "new_state": "active"}]}, "type": "update_flaky_test_state_request"}} + When the request is sent + Then the response status is 200 OK diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index bfcee722b4e..980e3bbbace 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -5149,6 +5149,12 @@ "type": "idempotent" } }, + "UpdateFlakyTests": { + "tag": "Test Optimization", + "undo": { + "type": "unsafe" + } + }, "SearchFlakyTests": { "tag": "Test Optimization", "undo": {