From 283e2215971f81bb25abf1385ae95935af9513e2 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 10 Aug 2026 09:50:29 +0000 Subject: [PATCH] Regenerate client from commit 66ad698 of spec repo --- .generator/schemas/v2/openapi.yaml | 144 +++++++- .../PatchDORADeploymentByVersion.java | 47 +++ .../com/datadog/api/client/ApiClient.java | 1 + .../api/client/v2/api/DoraMetricsApi.java | 155 +++++++++ ...RADeploymentPatchByVersionRemediation.java | 326 ++++++++++++++++++ ...ploymentPatchByVersionRemediationByID.java | 127 +++++++ ...entPatchByVersionRemediationByVersion.java | 132 +++++++ .../DORADeploymentPatchByVersionRequest.java | 151 ++++++++ ...oymentPatchByVersionRequestAttributes.java | 272 +++++++++++++++ ...RADeploymentPatchByVersionRequestData.java | 191 ++++++++++ .../model/DORADeploymentPatchRemediation.java | 40 ++- .../DORADeploymentPatchRequestAttributes.java | 3 +- .../api/client/v2/api/dora_metrics.feature | 27 ++ .../com/datadog/api/client/v2/api/undo.json | 6 + 14 files changed, 1614 insertions(+), 8 deletions(-) create mode 100644 examples/v2/dora-metrics/PatchDORADeploymentByVersion.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchByVersionRemediation.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchByVersionRemediationByID.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchByVersionRemediationByVersion.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchByVersionRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchByVersionRequestAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchByVersionRequestData.java diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 2c0f436fe34..523635b57e9 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -29678,15 +29678,109 @@ components: - service - started_at type: object + DORADeploymentPatchByVersionRemediation: + description: Remediation details for the deployment. Optional, but required to calculate failed deployment recovery time. Specify either `id` or `version` to identify the remediation deployment, but not both. + oneOf: + - $ref: "#/components/schemas/DORADeploymentPatchByVersionRemediationByID" + - $ref: "#/components/schemas/DORADeploymentPatchByVersionRemediationByVersion" + DORADeploymentPatchByVersionRemediationByID: + additionalProperties: false + description: Remediation details identified by the ID of the remediation deployment. + properties: + id: + description: The ID of the remediation deployment. + example: eG42zNIkVjM + type: string + type: + $ref: "#/components/schemas/DORADeploymentPatchRemediationType" + required: + - id + - type + type: object + DORADeploymentPatchByVersionRemediationByVersion: + additionalProperties: false + description: Remediation details identified by the version of the remediation deployment, matched against the same service and environment as the failed deployment. + properties: + type: + $ref: "#/components/schemas/DORADeploymentPatchRemediationType" + version: + description: The version of the remediation deployment. + example: v1.2.4 + type: string + required: + - version + - type + type: object + DORADeploymentPatchByVersionRequest: + description: Request to patch a DORA deployment event identified by service, environment, and version. + example: + data: + attributes: + change_failure: true + env: "production" + remediation: + type: "rollback" + version: "v1.2.2" + service: "my-service" + version: "v1.2.3" + type: "dora_deployment_patch_request" + properties: + data: + $ref: "#/components/schemas/DORADeploymentPatchByVersionRequestData" + required: + - data + type: object + DORADeploymentPatchByVersionRequestAttributes: + description: Attributes for patching a DORA deployment event identified by service, environment, and version. + properties: + change_failure: + description: Indicates whether the deployment resulted in a change failure. + example: true + type: boolean + env: + description: The environment the deployment was performed in. + example: prod + type: string + remediation: + $ref: "#/components/schemas/DORADeploymentPatchByVersionRemediation" + service: + description: The name of the service that was deployed. + example: my-service + type: string + version: + description: "The version deployed. This can be seen in the Service Catalog or in the APM Deployment Tracking." + example: v1.2.3 + type: string + required: + - service + - env + - version + - change_failure + type: object + DORADeploymentPatchByVersionRequestData: + description: The JSON:API data for patching a deployment identified by service, environment, and version. + properties: + attributes: + $ref: "#/components/schemas/DORADeploymentPatchByVersionRequestAttributes" + type: + $ref: "#/components/schemas/DORADeploymentPatchRequestDataType" + required: + - type + - attributes + type: object DORADeploymentPatchRemediation: - description: Remediation details for the deployment. Optional, but required to calculate failed deployment recovery time. + description: Remediation details for the deployment. Optional, but required to calculate failed deployment recovery time. Specify either `id` or `version` to identify the remediation deployment, but not both. properties: id: - description: The ID of the remediation deployment. Required when the failed deployment must be linked to a remediation deployment. + description: The ID of the remediation deployment. Use this or `version` to identify the remediation deployment, but not both. example: eG42zNIkVjM type: string type: $ref: "#/components/schemas/DORADeploymentPatchRemediationType" + version: + description: The version of the remediation deployment, matched against the same service and environment as the failed deployment. Use this or `id` to identify the remediation deployment, but not both. + example: v1.2.4 + type: string type: object DORADeploymentPatchRemediationType: description: The type of remediation action taken. Required when the failed deployment must be linked to a remediation deployment. @@ -140417,6 +140511,52 @@ paths: permissions: - dora_metrics_write /api/v2/dora/deployments: + patch: + description: |- + Update a deployment's change failure status, identifying the deployment by its service, environment, and version instead of its ID. Use this to mark a deployment as a change failure or back to stable. You can optionally include remediation details to enable failed deployment recovery time calculation. If multiple deployments match the given service, environment, and version, the most recently finished one is updated. + operationId: PatchDORADeploymentByVersion + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + change_failure: true + env: production + service: my-service + version: v1.2.3 + type: dora_deployment_patch_request + schema: + $ref: "#/components/schemas/DORADeploymentPatchByVersionRequest" + required: true + responses: + "202": + 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 by version + tags: ["DORA Metrics"] + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - dora_metrics_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). post: description: |- Use this API endpoint to get a list of deployment events. diff --git a/examples/v2/dora-metrics/PatchDORADeploymentByVersion.java b/examples/v2/dora-metrics/PatchDORADeploymentByVersion.java new file mode 100644 index 00000000000..28b31863cba --- /dev/null +++ b/examples/v2/dora-metrics/PatchDORADeploymentByVersion.java @@ -0,0 +1,47 @@ +// Patch a deployment event by version 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.DORADeploymentPatchByVersionRemediation; +import com.datadog.api.client.v2.model.DORADeploymentPatchByVersionRemediationByVersion; +import com.datadog.api.client.v2.model.DORADeploymentPatchByVersionRequest; +import com.datadog.api.client.v2.model.DORADeploymentPatchByVersionRequestAttributes; +import com.datadog.api.client.v2.model.DORADeploymentPatchByVersionRequestData; +import com.datadog.api.client.v2.model.DORADeploymentPatchRemediationType; +import com.datadog.api.client.v2.model.DORADeploymentPatchRequestDataType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.patchDORADeploymentByVersion", true); + DoraMetricsApi apiInstance = new DoraMetricsApi(defaultClient); + + DORADeploymentPatchByVersionRequest body = + new DORADeploymentPatchByVersionRequest() + .data( + new DORADeploymentPatchByVersionRequestData() + .attributes( + new DORADeploymentPatchByVersionRequestAttributes() + .changeFailure(true) + .env("production") + .remediation( + new DORADeploymentPatchByVersionRemediation( + new DORADeploymentPatchByVersionRemediationByVersion() + .type(DORADeploymentPatchRemediationType.ROLLBACK) + .version("v1.2.2"))) + .service("my-service") + .version("v1.2.3")) + .type(DORADeploymentPatchRequestDataType.DORA_DEPLOYMENT_PATCH_REQUEST)); + + try { + apiInstance.patchDORADeploymentByVersion(body); + } catch (ApiException e) { + System.err.println("Exception when calling DoraMetricsApi#patchDORADeploymentByVersion"); + 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 4f71f6beac8..0d8443e0d1a 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1085,6 +1085,7 @@ public class ApiClient { put("v2.triggerDeploymentGatesEvaluation", false); put("v2.updateDeploymentGate", false); put("v2.updateDeploymentRule", false); + put("v2.patchDORADeploymentByVersion", false); put("v2.cloneForm", false); put("v2.createAndPublishForm", false); put("v2.createForm", false); 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 e9849140fce..782f53a204b 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.DORADeploymentPatchByVersionRequest; import com.datadog.api.client.v2.model.DORADeploymentPatchRequest; import com.datadog.api.client.v2.model.DORADeploymentRequest; import com.datadog.api.client.v2.model.DORADeploymentResponse; @@ -1442,4 +1443,158 @@ public CompletableFuture> patchDORADeploymentWithHttpInfoAsync false, null); } + + /** + * Patch a deployment event by version. + * + *

See {@link #patchDORADeploymentByVersionWithHttpInfo}. + * + * @param body (required) + * @throws ApiException if fails to make API call + */ + public void patchDORADeploymentByVersion(DORADeploymentPatchByVersionRequest body) + throws ApiException { + patchDORADeploymentByVersionWithHttpInfo(body); + } + + /** + * Patch a deployment event by version. + * + *

See {@link #patchDORADeploymentByVersionWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture + */ + public CompletableFuture patchDORADeploymentByVersionAsync( + DORADeploymentPatchByVersionRequest body) { + return patchDORADeploymentByVersionWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update a deployment's change failure status, identifying the deployment by its service, + * environment, and version instead of its ID. Use this to mark a deployment as a change failure + * or back to stable. You can optionally include remediation details to enable failed deployment + * recovery time calculation. If multiple deployments match the given service, environment, and + * version, the most recently finished one is updated. + * + * @param body (required) + * @return ApiResponse<Void> + * @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 patchDORADeploymentByVersionWithHttpInfo( + DORADeploymentPatchByVersionRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "patchDORADeploymentByVersion"; + 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 patchDORADeploymentByVersion"); + } + // create path and map variables + String localVarPath = "/api/v2/dora/deployments"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.DoraMetricsApi.patchDORADeploymentByVersion", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Patch a deployment event by version. + * + *

See {@link #patchDORADeploymentByVersionWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> patchDORADeploymentByVersionWithHttpInfoAsync( + DORADeploymentPatchByVersionRequest body) { + // Check if unstable operation is enabled + String operationId = "patchDORADeploymentByVersion"; + 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 patchDORADeploymentByVersion")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/dora/deployments"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.DoraMetricsApi.patchDORADeploymentByVersion", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + 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, + null); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchByVersionRemediation.java b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchByVersionRemediation.java new file mode 100644 index 00000000000..c7c15ba2cac --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchByVersionRemediation.java @@ -0,0 +1,326 @@ +/* + * 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.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize( + using = + DORADeploymentPatchByVersionRemediation.DORADeploymentPatchByVersionRemediationDeserializer + .class) +@JsonSerialize( + using = + DORADeploymentPatchByVersionRemediation.DORADeploymentPatchByVersionRemediationSerializer + .class) +public class DORADeploymentPatchByVersionRemediation extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(DORADeploymentPatchByVersionRemediation.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class DORADeploymentPatchByVersionRemediationSerializer + extends StdSerializer { + public DORADeploymentPatchByVersionRemediationSerializer( + Class t) { + super(t); + } + + public DORADeploymentPatchByVersionRemediationSerializer() { + this(null); + } + + @Override + public void serialize( + DORADeploymentPatchByVersionRemediation value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class DORADeploymentPatchByVersionRemediationDeserializer + extends StdDeserializer { + public DORADeploymentPatchByVersionRemediationDeserializer() { + this(DORADeploymentPatchByVersionRemediation.class); + } + + public DORADeploymentPatchByVersionRemediationDeserializer(Class vc) { + super(vc); + } + + @Override + public DORADeploymentPatchByVersionRemediation deserialize( + JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize DORADeploymentPatchByVersionRemediationByID + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (DORADeploymentPatchByVersionRemediationByID.class.equals(Integer.class) + || DORADeploymentPatchByVersionRemediationByID.class.equals(Long.class) + || DORADeploymentPatchByVersionRemediationByID.class.equals(Float.class) + || DORADeploymentPatchByVersionRemediationByID.class.equals(Double.class) + || DORADeploymentPatchByVersionRemediationByID.class.equals(Boolean.class) + || DORADeploymentPatchByVersionRemediationByID.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((DORADeploymentPatchByVersionRemediationByID.class.equals(Integer.class) + || DORADeploymentPatchByVersionRemediationByID.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((DORADeploymentPatchByVersionRemediationByID.class.equals(Float.class) + || DORADeploymentPatchByVersionRemediationByID.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (DORADeploymentPatchByVersionRemediationByID.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (DORADeploymentPatchByVersionRemediationByID.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = + tree.traverse(jp.getCodec()) + .readValueAs(DORADeploymentPatchByVersionRemediationByID.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((DORADeploymentPatchByVersionRemediationByID) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log( + Level.FINER, + "Input data matches schema 'DORADeploymentPatchByVersionRemediationByID'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'DORADeploymentPatchByVersionRemediationByID'", + e); + } + + // deserialize DORADeploymentPatchByVersionRemediationByVersion + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (DORADeploymentPatchByVersionRemediationByVersion.class.equals(Integer.class) + || DORADeploymentPatchByVersionRemediationByVersion.class.equals(Long.class) + || DORADeploymentPatchByVersionRemediationByVersion.class.equals(Float.class) + || DORADeploymentPatchByVersionRemediationByVersion.class.equals(Double.class) + || DORADeploymentPatchByVersionRemediationByVersion.class.equals(Boolean.class) + || DORADeploymentPatchByVersionRemediationByVersion.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((DORADeploymentPatchByVersionRemediationByVersion.class.equals(Integer.class) + || DORADeploymentPatchByVersionRemediationByVersion.class.equals( + Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((DORADeploymentPatchByVersionRemediationByVersion.class.equals(Float.class) + || DORADeploymentPatchByVersionRemediationByVersion.class.equals( + Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (DORADeploymentPatchByVersionRemediationByVersion.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (DORADeploymentPatchByVersionRemediationByVersion.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = + tree.traverse(jp.getCodec()) + .readValueAs(DORADeploymentPatchByVersionRemediationByVersion.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((DORADeploymentPatchByVersionRemediationByVersion) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log( + Level.FINER, + "Input data matches schema 'DORADeploymentPatchByVersionRemediationByVersion'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'DORADeploymentPatchByVersionRemediationByVersion'", + e); + } + + DORADeploymentPatchByVersionRemediation ret = new DORADeploymentPatchByVersionRemediation(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public DORADeploymentPatchByVersionRemediation getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "DORADeploymentPatchByVersionRemediation cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public DORADeploymentPatchByVersionRemediation() { + super("oneOf", Boolean.FALSE); + } + + public DORADeploymentPatchByVersionRemediation(DORADeploymentPatchByVersionRemediationByID o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public DORADeploymentPatchByVersionRemediation( + DORADeploymentPatchByVersionRemediationByVersion o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put( + "DORADeploymentPatchByVersionRemediationByID", + new GenericType() {}); + schemas.put( + "DORADeploymentPatchByVersionRemediationByVersion", + new GenericType() {}); + JSON.registerDescendants( + DORADeploymentPatchByVersionRemediation.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return DORADeploymentPatchByVersionRemediation.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: DORADeploymentPatchByVersionRemediationByID, + * DORADeploymentPatchByVersionRemediationByVersion + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf( + DORADeploymentPatchByVersionRemediationByID.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf( + DORADeploymentPatchByVersionRemediationByVersion.class, + instance, + new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be DORADeploymentPatchByVersionRemediationByID," + + " DORADeploymentPatchByVersionRemediationByVersion"); + } + + /** + * Get the actual instance, which can be the following: + * DORADeploymentPatchByVersionRemediationByID, DORADeploymentPatchByVersionRemediationByVersion + * + * @return The actual instance (DORADeploymentPatchByVersionRemediationByID, + * DORADeploymentPatchByVersionRemediationByVersion) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `DORADeploymentPatchByVersionRemediationByID`. If the actual + * instance is not `DORADeploymentPatchByVersionRemediationByID`, the ClassCastException will be + * thrown. + * + * @return The actual instance of `DORADeploymentPatchByVersionRemediationByID` + * @throws ClassCastException if the instance is not `DORADeploymentPatchByVersionRemediationByID` + */ + public DORADeploymentPatchByVersionRemediationByID + getDORADeploymentPatchByVersionRemediationByID() throws ClassCastException { + return (DORADeploymentPatchByVersionRemediationByID) super.getActualInstance(); + } + + /** + * Get the actual instance of `DORADeploymentPatchByVersionRemediationByVersion`. If the actual + * instance is not `DORADeploymentPatchByVersionRemediationByVersion`, the ClassCastException will + * be thrown. + * + * @return The actual instance of `DORADeploymentPatchByVersionRemediationByVersion` + * @throws ClassCastException if the instance is not + * `DORADeploymentPatchByVersionRemediationByVersion` + */ + public DORADeploymentPatchByVersionRemediationByVersion + getDORADeploymentPatchByVersionRemediationByVersion() throws ClassCastException { + return (DORADeploymentPatchByVersionRemediationByVersion) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchByVersionRemediationByID.java b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchByVersionRemediationByID.java new file mode 100644 index 00000000000..8b47e131733 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchByVersionRemediationByID.java @@ -0,0 +1,127 @@ +/* + * 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.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.Objects; + +/** Remediation details identified by the ID of the remediation deployment. */ +@JsonPropertyOrder({ + DORADeploymentPatchByVersionRemediationByID.JSON_PROPERTY_ID, + DORADeploymentPatchByVersionRemediationByID.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DORADeploymentPatchByVersionRemediationByID { + @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 DORADeploymentPatchByVersionRemediationByID() {} + + @JsonCreator + public DORADeploymentPatchByVersionRemediationByID( + @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 DORADeploymentPatchByVersionRemediationByID id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the remediation deployment. + * + * @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 DORADeploymentPatchByVersionRemediationByID type(DORADeploymentPatchRemediationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of remediation action taken. Required when the failed deployment must be linked to a + * remediation deployment. + * + * @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; + } + + /** Return true if this DORADeploymentPatchByVersionRemediationByID object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DORADeploymentPatchByVersionRemediationByID doraDeploymentPatchByVersionRemediationById = + (DORADeploymentPatchByVersionRemediationByID) o; + return Objects.equals(this.id, doraDeploymentPatchByVersionRemediationById.id) + && Objects.equals(this.type, doraDeploymentPatchByVersionRemediationById.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DORADeploymentPatchByVersionRemediationByID {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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/DORADeploymentPatchByVersionRemediationByVersion.java b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchByVersionRemediationByVersion.java new file mode 100644 index 00000000000..33b41316160 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchByVersionRemediationByVersion.java @@ -0,0 +1,132 @@ +/* + * 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.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.Objects; + +/** + * Remediation details identified by the version of the remediation deployment, matched against the + * same service and environment as the failed deployment. + */ +@JsonPropertyOrder({ + DORADeploymentPatchByVersionRemediationByVersion.JSON_PROPERTY_TYPE, + DORADeploymentPatchByVersionRemediationByVersion.JSON_PROPERTY_VERSION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DORADeploymentPatchByVersionRemediationByVersion { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_TYPE = "type"; + private DORADeploymentPatchRemediationType type; + + public static final String JSON_PROPERTY_VERSION = "version"; + private String version; + + public DORADeploymentPatchByVersionRemediationByVersion() {} + + @JsonCreator + public DORADeploymentPatchByVersionRemediationByVersion( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + DORADeploymentPatchRemediationType type, + @JsonProperty(required = true, value = JSON_PROPERTY_VERSION) String version) { + this.type = type; + this.unparsed |= !type.isValid(); + this.version = version; + } + + public DORADeploymentPatchByVersionRemediationByVersion type( + DORADeploymentPatchRemediationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of remediation action taken. Required when the failed deployment must be linked to a + * remediation deployment. + * + * @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; + } + + public DORADeploymentPatchByVersionRemediationByVersion version(String version) { + this.version = version; + return this; + } + + /** + * The version of the remediation deployment. + * + * @return version + */ + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + /** Return true if this DORADeploymentPatchByVersionRemediationByVersion object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DORADeploymentPatchByVersionRemediationByVersion + doraDeploymentPatchByVersionRemediationByVersion = + (DORADeploymentPatchByVersionRemediationByVersion) o; + return Objects.equals(this.type, doraDeploymentPatchByVersionRemediationByVersion.type) + && Objects.equals(this.version, doraDeploymentPatchByVersionRemediationByVersion.version); + } + + @Override + public int hashCode() { + return Objects.hash(type, version); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DORADeploymentPatchByVersionRemediationByVersion {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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/DORADeploymentPatchByVersionRequest.java b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchByVersionRequest.java new file mode 100644 index 00000000000..731344d84fd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchByVersionRequest.java @@ -0,0 +1,151 @@ +/* + * 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 identified by service, environment, and version. */ +@JsonPropertyOrder({DORADeploymentPatchByVersionRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DORADeploymentPatchByVersionRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private DORADeploymentPatchByVersionRequestData data; + + public DORADeploymentPatchByVersionRequest() {} + + @JsonCreator + public DORADeploymentPatchByVersionRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + DORADeploymentPatchByVersionRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public DORADeploymentPatchByVersionRequest data(DORADeploymentPatchByVersionRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The JSON:API data for patching a deployment identified by service, environment, and version. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DORADeploymentPatchByVersionRequestData getData() { + return data; + } + + public void setData(DORADeploymentPatchByVersionRequestData data) { + this.data = data; + if (data != null) { + this.unparsed |= data.unparsed; + } + } + + /** + * 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 DORADeploymentPatchByVersionRequest + */ + @JsonAnySetter + public DORADeploymentPatchByVersionRequest 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 DORADeploymentPatchByVersionRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DORADeploymentPatchByVersionRequest doraDeploymentPatchByVersionRequest = + (DORADeploymentPatchByVersionRequest) o; + return Objects.equals(this.data, doraDeploymentPatchByVersionRequest.data) + && Objects.equals( + this.additionalProperties, doraDeploymentPatchByVersionRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DORADeploymentPatchByVersionRequest {\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/DORADeploymentPatchByVersionRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchByVersionRequestAttributes.java new file mode 100644 index 00000000000..8b9915449b4 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchByVersionRequestAttributes.java @@ -0,0 +1,272 @@ +/* + * 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; + +/** + * Attributes for patching a DORA deployment event identified by service, environment, and version. + */ +@JsonPropertyOrder({ + DORADeploymentPatchByVersionRequestAttributes.JSON_PROPERTY_CHANGE_FAILURE, + DORADeploymentPatchByVersionRequestAttributes.JSON_PROPERTY_ENV, + DORADeploymentPatchByVersionRequestAttributes.JSON_PROPERTY_REMEDIATION, + DORADeploymentPatchByVersionRequestAttributes.JSON_PROPERTY_SERVICE, + DORADeploymentPatchByVersionRequestAttributes.JSON_PROPERTY_VERSION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DORADeploymentPatchByVersionRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CHANGE_FAILURE = "change_failure"; + private Boolean changeFailure; + + public static final String JSON_PROPERTY_ENV = "env"; + private String env; + + public static final String JSON_PROPERTY_REMEDIATION = "remediation"; + private DORADeploymentPatchByVersionRemediation remediation; + + public static final String JSON_PROPERTY_SERVICE = "service"; + private String service; + + public static final String JSON_PROPERTY_VERSION = "version"; + private String version; + + public DORADeploymentPatchByVersionRequestAttributes() {} + + @JsonCreator + public DORADeploymentPatchByVersionRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CHANGE_FAILURE) Boolean changeFailure, + @JsonProperty(required = true, value = JSON_PROPERTY_ENV) String env, + @JsonProperty(required = true, value = JSON_PROPERTY_SERVICE) String service, + @JsonProperty(required = true, value = JSON_PROPERTY_VERSION) String version) { + this.changeFailure = changeFailure; + this.env = env; + this.service = service; + this.version = version; + } + + public DORADeploymentPatchByVersionRequestAttributes changeFailure(Boolean changeFailure) { + this.changeFailure = changeFailure; + return this; + } + + /** + * Indicates whether the deployment resulted in a change failure. + * + * @return changeFailure + */ + @JsonProperty(JSON_PROPERTY_CHANGE_FAILURE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getChangeFailure() { + return changeFailure; + } + + public void setChangeFailure(Boolean changeFailure) { + this.changeFailure = changeFailure; + } + + public DORADeploymentPatchByVersionRequestAttributes env(String env) { + this.env = env; + return this; + } + + /** + * The environment the deployment was performed in. + * + * @return env + */ + @JsonProperty(JSON_PROPERTY_ENV) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getEnv() { + return env; + } + + public void setEnv(String env) { + this.env = env; + } + + public DORADeploymentPatchByVersionRequestAttributes remediation( + DORADeploymentPatchByVersionRemediation remediation) { + this.remediation = remediation; + this.unparsed |= remediation.unparsed; + return this; + } + + /** + * Remediation details for the deployment. Optional, but required to calculate failed deployment + * recovery time. Specify either id or version to identify the + * remediation deployment, but not both. + * + * @return remediation + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_REMEDIATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public DORADeploymentPatchByVersionRemediation getRemediation() { + return remediation; + } + + public void setRemediation(DORADeploymentPatchByVersionRemediation remediation) { + this.remediation = remediation; + if (remediation != null) { + this.unparsed |= remediation.unparsed; + } + } + + public DORADeploymentPatchByVersionRequestAttributes service(String service) { + this.service = service; + return this; + } + + /** + * The name of the service that was deployed. + * + * @return service + */ + @JsonProperty(JSON_PROPERTY_SERVICE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getService() { + return service; + } + + public void setService(String service) { + this.service = service; + } + + public DORADeploymentPatchByVersionRequestAttributes version(String version) { + this.version = version; + return this; + } + + /** + * The version deployed. This can be seen in the Service Catalog or in the APM Deployment + * Tracking. + * + * @return version + */ + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + /** + * 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 DORADeploymentPatchByVersionRequestAttributes + */ + @JsonAnySetter + public DORADeploymentPatchByVersionRequestAttributes 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 DORADeploymentPatchByVersionRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DORADeploymentPatchByVersionRequestAttributes doraDeploymentPatchByVersionRequestAttributes = + (DORADeploymentPatchByVersionRequestAttributes) o; + return Objects.equals( + this.changeFailure, doraDeploymentPatchByVersionRequestAttributes.changeFailure) + && Objects.equals(this.env, doraDeploymentPatchByVersionRequestAttributes.env) + && Objects.equals( + this.remediation, doraDeploymentPatchByVersionRequestAttributes.remediation) + && Objects.equals(this.service, doraDeploymentPatchByVersionRequestAttributes.service) + && Objects.equals(this.version, doraDeploymentPatchByVersionRequestAttributes.version) + && Objects.equals( + this.additionalProperties, + doraDeploymentPatchByVersionRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(changeFailure, env, remediation, service, version, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DORADeploymentPatchByVersionRequestAttributes {\n"); + sb.append(" changeFailure: ").append(toIndentedString(changeFailure)).append("\n"); + sb.append(" env: ").append(toIndentedString(env)).append("\n"); + sb.append(" remediation: ").append(toIndentedString(remediation)).append("\n"); + sb.append(" service: ").append(toIndentedString(service)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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/DORADeploymentPatchByVersionRequestData.java b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchByVersionRequestData.java new file mode 100644 index 00000000000..2469b9d891b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchByVersionRequestData.java @@ -0,0 +1,191 @@ +/* + * 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 identified by service, environment, and version. */ +@JsonPropertyOrder({ + DORADeploymentPatchByVersionRequestData.JSON_PROPERTY_ATTRIBUTES, + DORADeploymentPatchByVersionRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class DORADeploymentPatchByVersionRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private DORADeploymentPatchByVersionRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private DORADeploymentPatchRequestDataType type = + DORADeploymentPatchRequestDataType.DORA_DEPLOYMENT_PATCH_REQUEST; + + public DORADeploymentPatchByVersionRequestData() {} + + @JsonCreator + public DORADeploymentPatchByVersionRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + DORADeploymentPatchByVersionRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + DORADeploymentPatchRequestDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public DORADeploymentPatchByVersionRequestData attributes( + DORADeploymentPatchByVersionRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for patching a DORA deployment event identified by service, environment, and + * version. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public DORADeploymentPatchByVersionRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(DORADeploymentPatchByVersionRequestAttributes attributes) { + this.attributes = attributes; + if (attributes != null) { + this.unparsed |= attributes.unparsed; + } + } + + public DORADeploymentPatchByVersionRequestData 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 DORADeploymentPatchByVersionRequestData + */ + @JsonAnySetter + public DORADeploymentPatchByVersionRequestData 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 DORADeploymentPatchByVersionRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DORADeploymentPatchByVersionRequestData doraDeploymentPatchByVersionRequestData = + (DORADeploymentPatchByVersionRequestData) o; + return Objects.equals(this.attributes, doraDeploymentPatchByVersionRequestData.attributes) + && Objects.equals(this.type, doraDeploymentPatchByVersionRequestData.type) + && Objects.equals( + this.additionalProperties, + doraDeploymentPatchByVersionRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DORADeploymentPatchByVersionRequestData {\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/DORADeploymentPatchRemediation.java b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRemediation.java index 5ed11346ec4..f807fd81135 100644 --- a/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRemediation.java +++ b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRemediation.java @@ -18,11 +18,13 @@ /** * Remediation details for the deployment. Optional, but required to calculate failed deployment - * recovery time. + * recovery time. Specify either id or version to identify the remediation + * deployment, but not both. */ @JsonPropertyOrder({ DORADeploymentPatchRemediation.JSON_PROPERTY_ID, - DORADeploymentPatchRemediation.JSON_PROPERTY_TYPE + DORADeploymentPatchRemediation.JSON_PROPERTY_TYPE, + DORADeploymentPatchRemediation.JSON_PROPERTY_VERSION }) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") @@ -34,14 +36,17 @@ public class DORADeploymentPatchRemediation { public static final String JSON_PROPERTY_TYPE = "type"; private DORADeploymentPatchRemediationType type; + public static final String JSON_PROPERTY_VERSION = "version"; + private String version; + public DORADeploymentPatchRemediation id(String id) { this.id = id; return this; } /** - * The ID of the remediation deployment. Required when the failed deployment must be linked to a - * remediation deployment. + * The ID of the remediation deployment. Use this or version to identify the + * remediation deployment, but not both. * * @return id */ @@ -82,6 +87,29 @@ public void setType(DORADeploymentPatchRemediationType type) { this.type = type; } + public DORADeploymentPatchRemediation version(String version) { + this.version = version; + return this; + } + + /** + * The version of the remediation deployment, matched against the same service and environment as + * the failed deployment. Use this or id to identify the remediation deployment, but + * not both. + * + * @return version + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + /** * A container for additional, undeclared properties. This is a holder for any undeclared * properties as specified with the 'additionalProperties' keyword in the OAS document. @@ -141,13 +169,14 @@ public boolean equals(Object o) { (DORADeploymentPatchRemediation) o; return Objects.equals(this.id, doraDeploymentPatchRemediation.id) && Objects.equals(this.type, doraDeploymentPatchRemediation.type) + && Objects.equals(this.version, doraDeploymentPatchRemediation.version) && Objects.equals( this.additionalProperties, doraDeploymentPatchRemediation.additionalProperties); } @Override public int hashCode() { - return Objects.hash(id, type, additionalProperties); + return Objects.hash(id, type, version, additionalProperties); } @Override @@ -156,6 +185,7 @@ public String toString() { sb.append("class DORADeploymentPatchRemediation {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) .append("\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 index 9bd2de539cc..248d6d0c34e 100644 --- a/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRequestAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/DORADeploymentPatchRequestAttributes.java @@ -61,7 +61,8 @@ public DORADeploymentPatchRequestAttributes remediation( /** * Remediation details for the deployment. Optional, but required to calculate failed deployment - * recovery time. + * recovery time. Specify either id or version to identify the + * remediation deployment, but not both. * * @return remediation */ 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 d0dc8943ad9..a8249df9a71 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 @@ -148,6 +148,33 @@ 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 by version returns "Accepted" response + Given a valid "appKeyAuth" key in the system + And operation "PatchDORADeploymentByVersion" enabled + And new "PatchDORADeploymentByVersion" request + And body with value {"data": {"attributes": {"change_failure": true, "env": "production", "remediation": {"type": "rollback", "version": "v1.2.2"}, "service": "my-service", "version": "v1.2.3"}, "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 by version returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And operation "PatchDORADeploymentByVersion" enabled + And new "PatchDORADeploymentByVersion" request + And body with value {"data": {"attributes": {"change_failure": true, "env": "production", "remediation": {"type": "rollback", "version": "v1.2.2"}, "service": "my-service", "version": "v1.2.3"}, "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: Patch a deployment event by version with a missing version returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And operation "PatchDORADeploymentByVersion" enabled + And new "PatchDORADeploymentByVersion" request + And body with value {"data": {"attributes": {"change_failure": true, "env": "production", "service": "my-service"}, "type": "dora_deployment_patch_request"}} + When the request is sent + Then the response status is 400 Bad Request + @generated @skip @team:DataDog/ci-app-backend Scenario: Patch a deployment event returns "Accepted" response Given a valid "appKeyAuth" key in the system 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 1060e48a484..e9536c917bd 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 @@ -2374,6 +2374,12 @@ "type": "idempotent" } }, + "PatchDORADeploymentByVersion": { + "tag": "DORA Metrics", + "undo": { + "type": "idempotent" + } + }, "ListDORADeployments": { "tag": "DORA Metrics", "undo": {