From b13d66c477d8ebdf3a5a9a6d8138acde3da2ca0d Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Sun, 25 Jan 2026 12:20:35 +0000 Subject: [PATCH] Regenerate client from commit e1f3e97 of spec repo --- .generator/schemas/v2/openapi.yaml | 127 +++++++++++ .../v2/dora-metrics/PatchDORADeployment.java | 44 ++++ .../api/client/v2/api/DoraMetricsApi.java | 163 +++++++++++++ .../model/DORADeploymentPatchRemediation.java | 181 +++++++++++++++ .../DORADeploymentPatchRemediationType.java | 61 +++++ .../v2/model/DORADeploymentPatchRequest.java | 147 ++++++++++++ .../DORADeploymentPatchRequestAttributes.java | 168 ++++++++++++++ .../model/DORADeploymentPatchRequestData.java | 214 ++++++++++++++++++ .../DORADeploymentPatchRequestDataType.java | 59 +++++ .../api/client/v2/api/dora_metrics.feature | 18 ++ .../com/datadog/api/client/v2/api/undo.json | 6 + 11 files changed, 1188 insertions(+) create mode 100644 examples/v2/dora-metrics/PatchDORADeployment.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRemediation.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRemediationType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRequestAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRequestData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRequestDataType.java diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 70523726660..3e2dc0ac7ad 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -16972,6 +16972,89 @@ components: - started_at - finished_at type: object + DORADeploymentPatchRemediation: + description: Remediation details for the deployment. + properties: + id: + description: The ID of the remediation action. + example: eG42zNIkVjM + type: string + type: + $ref: '#/components/schemas/DORADeploymentPatchRemediationType' + required: + - id + - type + type: object + DORADeploymentPatchRemediationType: + description: The type of remediation action taken. + enum: + - rollback + - rollforward + example: rollback + type: string + x-enum-varnames: + - ROLLBACK + - ROLLFORWARD + DORADeploymentPatchRequest: + description: Request to patch a DORA deployment event. + example: + data: + attributes: + change_failure: true + remediation: + id: eG42zNIkVjM + type: rollback + id: z_RwVLi7v4Y + type: dora_deployment_patch_request + properties: + data: + $ref: '#/components/schemas/DORADeploymentPatchRequestData' + required: + - data + type: object + DORADeploymentPatchRequestAttributes: + description: Attributes for patching a DORA deployment event. + properties: + change_failure: + description: Indicates whether the deployment resulted in a change failure. + example: true + type: boolean + remediation: + $ref: '#/components/schemas/DORADeploymentPatchRemediation' + type: object + DORADeploymentPatchRequestData: + description: The JSON:API data for patching a deployment. + example: + attributes: + change_failure: true + remediation: + id: eG42zNIkVjM + type: rollback + id: z_RwVLi7v4Y + type: dora_deployment_patch_request + properties: + attributes: + $ref: '#/components/schemas/DORADeploymentPatchRequestAttributes' + id: + description: The ID of the deployment to patch. + example: z_RwVLi7v4Y + type: string + type: + $ref: '#/components/schemas/DORADeploymentPatchRequestDataType' + required: + - type + - id + - attributes + type: object + DORADeploymentPatchRequestDataType: + default: dora_deployment_patch_request + description: JSON:API type for DORA deployment patch request. + enum: + - dora_deployment_patch_request + example: dora_deployment_patch_request + type: string + x-enum-varnames: + - DORA_DEPLOYMENT_PATCH_REQUEST DORADeploymentRequest: description: Request to create a DORA deployment event. properties: @@ -74114,6 +74197,50 @@ paths: operator: OR permissions: - dora_metrics_read + patch: + description: Use this API endpoint to patch a deployment event. + operationId: PatchDORADeployment + parameters: + - description: The ID of the deployment event. + in: path + name: deployment_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DORADeploymentPatchRequest' + required: true + responses: + '202': + content: + application/json: + schema: + $ref: '#/components/schemas/DORADeploymentFetchResponse' + description: Accepted + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Patch a deployment event + tags: + - DORA Metrics + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - dora_metrics_write /api/v2/dora/failure: post: description: 'Use this API endpoint to provide failure data. diff --git a/examples/v2/dora-metrics/PatchDORADeployment.java b/examples/v2/dora-metrics/PatchDORADeployment.java new file mode 100644 index 00000000000..bf3e183513c --- /dev/null +++ b/examples/v2/dora-metrics/PatchDORADeployment.java @@ -0,0 +1,44 @@ +// Patch a deployment event returns "Accepted" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.DoraMetricsApi; +import com.datadog.api.client.v2.model.DORADeploymentFetchResponse; +import com.datadog.api.client.v2.model.DORADeploymentPatchRemediation; +import com.datadog.api.client.v2.model.DORADeploymentPatchRemediationType; +import com.datadog.api.client.v2.model.DORADeploymentPatchRequest; +import com.datadog.api.client.v2.model.DORADeploymentPatchRequestAttributes; +import com.datadog.api.client.v2.model.DORADeploymentPatchRequestData; +import com.datadog.api.client.v2.model.DORADeploymentPatchRequestDataType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + DoraMetricsApi apiInstance = new DoraMetricsApi(defaultClient); + + DORADeploymentPatchRequest body = + new DORADeploymentPatchRequest() + .data( + new DORADeploymentPatchRequestData() + .attributes( + new DORADeploymentPatchRequestAttributes() + .changeFailure(true) + .remediation( + new DORADeploymentPatchRemediation() + .id("eG42zNIkVjM") + .type(DORADeploymentPatchRemediationType.ROLLBACK))) + .id("z_RwVLi7v4Y") + .type(DORADeploymentPatchRequestDataType.DORA_DEPLOYMENT_PATCH_REQUEST)); + + try { + DORADeploymentFetchResponse result = apiInstance.patchDORADeployment("deployment_id", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DoraMetricsApi#patchDORADeployment"); + 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/v2/api/DoraMetricsApi.java b/src/main/java/com/datadog/api/client/v2/api/DoraMetricsApi.java index 4bcd3e5359e..8d03207a8b9 100644 --- a/src/main/java/com/datadog/api/client/v2/api/DoraMetricsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/DoraMetricsApi.java @@ -5,6 +5,7 @@ import com.datadog.api.client.ApiResponse; import com.datadog.api.client.Pair; import com.datadog.api.client.v2.model.DORADeploymentFetchResponse; +import com.datadog.api.client.v2.model.DORADeploymentPatchRequest; import com.datadog.api.client.v2.model.DORADeploymentRequest; import com.datadog.api.client.v2.model.DORADeploymentResponse; import com.datadog.api.client.v2.model.DORADeploymentsListResponse; @@ -1279,4 +1280,166 @@ public CompletableFuture> listDORAFailures false, new GenericType() {}); } + + /** + * Patch a deployment event. + * + *

See {@link #patchDORADeploymentWithHttpInfo}. + * + * @param deploymentId The ID of the deployment event. (required) + * @param body (required) + * @return DORADeploymentFetchResponse + * @throws ApiException if fails to make API call + */ + public DORADeploymentFetchResponse patchDORADeployment( + String deploymentId, DORADeploymentPatchRequest body) throws ApiException { + return patchDORADeploymentWithHttpInfo(deploymentId, body).getData(); + } + + /** + * Patch a deployment event. + * + *

See {@link #patchDORADeploymentWithHttpInfoAsync}. + * + * @param deploymentId The ID of the deployment event. (required) + * @param body (required) + * @return CompletableFuture<DORADeploymentFetchResponse> + */ + public CompletableFuture patchDORADeploymentAsync( + String deploymentId, DORADeploymentPatchRequest body) { + return patchDORADeploymentWithHttpInfoAsync(deploymentId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Use this API endpoint to patch a deployment event. + * + * @param deploymentId The ID of the deployment event. (required) + * @param body (required) + * @return ApiResponse<DORADeploymentFetchResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
403 Not Authorized -
429 Too many requests -
+ */ + public ApiResponse patchDORADeploymentWithHttpInfo( + String deploymentId, DORADeploymentPatchRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'deploymentId' is set + if (deploymentId == null) { + throw new ApiException( + 400, "Missing the required parameter 'deploymentId' when calling patchDORADeployment"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling patchDORADeployment"); + } + // create path and map variables + String localVarPath = + "/api/v2/dora/deployments/{deployment_id}" + .replaceAll( + "\\{" + "deployment_id" + "\\}", apiClient.escapeString(deploymentId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.DoraMetricsApi.patchDORADeployment", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Patch a deployment event. + * + *

See {@link #patchDORADeploymentWithHttpInfo}. + * + * @param deploymentId The ID of the deployment event. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<DORADeploymentFetchResponse>> + */ + public CompletableFuture> + patchDORADeploymentWithHttpInfoAsync(String deploymentId, DORADeploymentPatchRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'deploymentId' is set + if (deploymentId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'deploymentId' when calling patchDORADeployment")); + return result; + } + + // 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 patchDORADeployment")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/dora/deployments/{deployment_id}" + .replaceAll( + "\\{" + "deployment_id" + "\\}", apiClient.escapeString(deploymentId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.DoraMetricsApi.patchDORADeployment", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } 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/DORADeploymentPatchRemediation.java b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRemediation.java new file mode 100644 index 00000000000..a9591a68684 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRemediation.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; + +/** Remediation details for the deployment. */ +@JsonPropertyOrder({ + DORADeploymentPatchRemediation.JSON_PROPERTY_ID, + DORADeploymentPatchRemediation.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DORADeploymentPatchRemediation { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private DORADeploymentPatchRemediationType type; + + public DORADeploymentPatchRemediation() {} + + @JsonCreator + public DORADeploymentPatchRemediation( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + DORADeploymentPatchRemediationType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public DORADeploymentPatchRemediation id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the remediation action. + * + * @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 DORADeploymentPatchRemediation type(DORADeploymentPatchRemediationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of remediation action taken. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DORADeploymentPatchRemediationType getType() { + return type; + } + + public void setType(DORADeploymentPatchRemediationType 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 DORADeploymentPatchRemediation + */ + @JsonAnySetter + public DORADeploymentPatchRemediation 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 DORADeploymentPatchRemediation object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DORADeploymentPatchRemediation doraDeploymentPatchRemediation = + (DORADeploymentPatchRemediation) o; + return Objects.equals(this.id, doraDeploymentPatchRemediation.id) + && Objects.equals(this.type, doraDeploymentPatchRemediation.type) + && Objects.equals( + this.additionalProperties, doraDeploymentPatchRemediation.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DORADeploymentPatchRemediation {\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/DORADeploymentPatchRemediationType.java b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRemediationType.java new file mode 100644 index 00000000000..310a401a29f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRemediationType.java @@ -0,0 +1,61 @@ +/* + * 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 type of remediation action taken. */ +@JsonSerialize( + using = DORADeploymentPatchRemediationType.DORADeploymentPatchRemediationTypeSerializer.class) +public class DORADeploymentPatchRemediationType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("rollback", "rollforward")); + + public static final DORADeploymentPatchRemediationType ROLLBACK = + new DORADeploymentPatchRemediationType("rollback"); + public static final DORADeploymentPatchRemediationType ROLLFORWARD = + new DORADeploymentPatchRemediationType("rollforward"); + + DORADeploymentPatchRemediationType(String value) { + super(value, allowedValues); + } + + public static class DORADeploymentPatchRemediationTypeSerializer + extends StdSerializer { + public DORADeploymentPatchRemediationTypeSerializer( + Class t) { + super(t); + } + + public DORADeploymentPatchRemediationTypeSerializer() { + this(null); + } + + @Override + public void serialize( + DORADeploymentPatchRemediationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static DORADeploymentPatchRemediationType fromValue(String value) { + return new DORADeploymentPatchRemediationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRequest.java b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRequest.java new file mode 100644 index 00000000000..def16ab67d3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRequest.java @@ -0,0 +1,147 @@ +/* + * 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 patch a DORA deployment event. */ +@JsonPropertyOrder({DORADeploymentPatchRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DORADeploymentPatchRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private DORADeploymentPatchRequestData data; + + public DORADeploymentPatchRequest() {} + + @JsonCreator + public DORADeploymentPatchRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + DORADeploymentPatchRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public DORADeploymentPatchRequest data(DORADeploymentPatchRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The JSON:API data for patching a deployment. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DORADeploymentPatchRequestData getData() { + return data; + } + + public void setData(DORADeploymentPatchRequestData 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 DORADeploymentPatchRequest + */ + @JsonAnySetter + public DORADeploymentPatchRequest 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 DORADeploymentPatchRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DORADeploymentPatchRequest doraDeploymentPatchRequest = (DORADeploymentPatchRequest) o; + return Objects.equals(this.data, doraDeploymentPatchRequest.data) + && Objects.equals( + this.additionalProperties, doraDeploymentPatchRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DORADeploymentPatchRequest {\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/DORADeploymentPatchRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRequestAttributes.java new file mode 100644 index 00000000000..9c26d6557db --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRequestAttributes.java @@ -0,0 +1,168 @@ +/* + * 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; + +/** Attributes for patching a DORA deployment event. */ +@JsonPropertyOrder({ + DORADeploymentPatchRequestAttributes.JSON_PROPERTY_CHANGE_FAILURE, + DORADeploymentPatchRequestAttributes.JSON_PROPERTY_REMEDIATION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DORADeploymentPatchRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CHANGE_FAILURE = "change_failure"; + private Boolean changeFailure; + + public static final String JSON_PROPERTY_REMEDIATION = "remediation"; + private DORADeploymentPatchRemediation remediation; + + public DORADeploymentPatchRequestAttributes changeFailure(Boolean changeFailure) { + this.changeFailure = changeFailure; + return this; + } + + /** + * Indicates whether the deployment resulted in a change failure. + * + * @return changeFailure + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CHANGE_FAILURE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getChangeFailure() { + return changeFailure; + } + + public void setChangeFailure(Boolean changeFailure) { + this.changeFailure = changeFailure; + } + + public DORADeploymentPatchRequestAttributes remediation( + DORADeploymentPatchRemediation remediation) { + this.remediation = remediation; + this.unparsed |= remediation.unparsed; + return this; + } + + /** + * Remediation details for the deployment. + * + * @return remediation + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REMEDIATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public DORADeploymentPatchRemediation getRemediation() { + return remediation; + } + + public void setRemediation(DORADeploymentPatchRemediation remediation) { + this.remediation = remediation; + } + + /** + * 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 DORADeploymentPatchRequestAttributes + */ + @JsonAnySetter + public DORADeploymentPatchRequestAttributes 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 DORADeploymentPatchRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DORADeploymentPatchRequestAttributes doraDeploymentPatchRequestAttributes = + (DORADeploymentPatchRequestAttributes) o; + return Objects.equals(this.changeFailure, doraDeploymentPatchRequestAttributes.changeFailure) + && Objects.equals(this.remediation, doraDeploymentPatchRequestAttributes.remediation) + && Objects.equals( + this.additionalProperties, doraDeploymentPatchRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(changeFailure, remediation, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DORADeploymentPatchRequestAttributes {\n"); + sb.append(" changeFailure: ").append(toIndentedString(changeFailure)).append("\n"); + sb.append(" remediation: ").append(toIndentedString(remediation)).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/DORADeploymentPatchRequestData.java b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRequestData.java new file mode 100644 index 00000000000..a72c2312a00 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRequestData.java @@ -0,0 +1,214 @@ +/* + * 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 patching a deployment. */ +@JsonPropertyOrder({ + DORADeploymentPatchRequestData.JSON_PROPERTY_ATTRIBUTES, + DORADeploymentPatchRequestData.JSON_PROPERTY_ID, + DORADeploymentPatchRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DORADeploymentPatchRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private DORADeploymentPatchRequestAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private DORADeploymentPatchRequestDataType type = + DORADeploymentPatchRequestDataType.DORA_DEPLOYMENT_PATCH_REQUEST; + + public DORADeploymentPatchRequestData() {} + + @JsonCreator + public DORADeploymentPatchRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + DORADeploymentPatchRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + DORADeploymentPatchRequestDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public DORADeploymentPatchRequestData attributes( + DORADeploymentPatchRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for patching a DORA deployment event. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DORADeploymentPatchRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(DORADeploymentPatchRequestAttributes attributes) { + this.attributes = attributes; + } + + public DORADeploymentPatchRequestData id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the deployment to patch. + * + * @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 DORADeploymentPatchRequestData type(DORADeploymentPatchRequestDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * JSON:API type for DORA deployment patch request. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DORADeploymentPatchRequestDataType getType() { + return type; + } + + public void setType(DORADeploymentPatchRequestDataType 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 DORADeploymentPatchRequestData + */ + @JsonAnySetter + public DORADeploymentPatchRequestData 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 DORADeploymentPatchRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DORADeploymentPatchRequestData doraDeploymentPatchRequestData = + (DORADeploymentPatchRequestData) o; + return Objects.equals(this.attributes, doraDeploymentPatchRequestData.attributes) + && Objects.equals(this.id, doraDeploymentPatchRequestData.id) + && Objects.equals(this.type, doraDeploymentPatchRequestData.type) + && Objects.equals( + this.additionalProperties, doraDeploymentPatchRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DORADeploymentPatchRequestData {\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/DORADeploymentPatchRequestDataType.java b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRequestDataType.java new file mode 100644 index 00000000000..2ee9d1cd834 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRequestDataType.java @@ -0,0 +1,59 @@ +/* + * 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; + +/** JSON:API type for DORA deployment patch request. */ +@JsonSerialize( + using = DORADeploymentPatchRequestDataType.DORADeploymentPatchRequestDataTypeSerializer.class) +public class DORADeploymentPatchRequestDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("dora_deployment_patch_request")); + + public static final DORADeploymentPatchRequestDataType DORA_DEPLOYMENT_PATCH_REQUEST = + new DORADeploymentPatchRequestDataType("dora_deployment_patch_request"); + + DORADeploymentPatchRequestDataType(String value) { + super(value, allowedValues); + } + + public static class DORADeploymentPatchRequestDataTypeSerializer + extends StdSerializer { + public DORADeploymentPatchRequestDataTypeSerializer( + Class t) { + super(t); + } + + public DORADeploymentPatchRequestDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + DORADeploymentPatchRequestDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static DORADeploymentPatchRequestDataType fromValue(String value) { + return new DORADeploymentPatchRequestDataType(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/dora_metrics.feature b/src/test/resources/com/datadog/api/client/v2/api/dora_metrics.feature index b11b0fc74df..7a3275b54bf 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/dora_metrics.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/dora_metrics.feature @@ -104,6 +104,24 @@ Feature: DORA Metrics When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/ci-app-backend + Scenario: Patch a deployment event returns "Accepted" response + Given a valid "appKeyAuth" key in the system + And new "PatchDORADeployment" request + And request contains "deployment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"change_failure": true, "remediation": {"id": "eG42zNIkVjM", "type": "rollback"}}, "id": "z_RwVLi7v4Y", "type": "dora_deployment_patch_request"}} + When the request is sent + Then the response status is 202 Accepted + + @generated @skip @team:DataDog/ci-app-backend + Scenario: Patch a deployment event returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And new "PatchDORADeployment" request + And request contains "deployment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"change_failure": true, "remediation": {"id": "eG42zNIkVjM", "type": "rollback"}}, "id": "z_RwVLi7v4Y", "type": "dora_deployment_patch_request"}} + When the request is sent + Then the response status is 400 Bad Request + @skip @team:DataDog/ci-app-backend Scenario: Send a deployment event returns "Bad Request" response Given new "CreateDORADeployment" request 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 5a347bddf11..307294e0212 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 @@ -1448,6 +1448,12 @@ "type": "safe" } }, + "PatchDORADeployment": { + "tag": "DORA Metrics", + "undo": { + "type": "idempotent" + } + }, "CreateDORAFailure": { "tag": "DORA Metrics", "undo": {