Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 142 additions & 2 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
47 changes: 47 additions & 0 deletions examples/v2/dora-metrics/PatchDORADeploymentByVersion.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
}
1 change: 1 addition & 0 deletions src/main/java/com/datadog/api/client/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
155 changes: 155 additions & 0 deletions src/main/java/com/datadog/api/client/v2/api/DoraMetricsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1442,4 +1443,158 @@ public CompletableFuture<ApiResponse<Void>> patchDORADeploymentWithHttpInfoAsync
false,
null);
}

/**
* Patch a deployment event by version.
*
* <p>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.
*
* <p>See {@link #patchDORADeploymentByVersionWithHttpInfoAsync}.
*
* @param body (required)
* @return CompletableFuture
*/
public CompletableFuture<Void> 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&lt;Void&gt;
* @throws ApiException if fails to make API call
* @http.response.details
* <table border="1">
* <caption>Response details</caption>
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
* <tr><td> 202 </td><td> Accepted </td><td> - </td></tr>
* <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr>
* <tr><td> 403 </td><td> Not Authorized </td><td> - </td></tr>
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
* </table>
*/
public ApiResponse<Void> 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<String, String> localVarHeaderParams = new HashMap<String, String>();

Invocation.Builder builder =
apiClient.createBuilder(
"v2.DoraMetricsApi.patchDORADeploymentByVersion",
localVarPath,
new ArrayList<Pair>(),
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"*/*"},
new String[] {"apiKeyAuth", "appKeyAuth"});
return apiClient.invokeAPI(
"PATCH",
builder,
localVarHeaderParams,
new String[] {"application/json"},
localVarPostBody,
new HashMap<String, Object>(),
false,
null);
}

/**
* Patch a deployment event by version.
*
* <p>See {@link #patchDORADeploymentByVersionWithHttpInfo}.
*
* @param body (required)
* @return CompletableFuture&lt;ApiResponse&lt;Void&gt;&gt;
*/
public CompletableFuture<ApiResponse<Void>> 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<ApiResponse<Void>> 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<ApiResponse<Void>> 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<String, String> localVarHeaderParams = new HashMap<String, String>();

Invocation.Builder builder;
try {
builder =
apiClient.createBuilder(
"v2.DoraMetricsApi.patchDORADeploymentByVersion",
localVarPath,
new ArrayList<Pair>(),
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"*/*"},
new String[] {"apiKeyAuth", "appKeyAuth"});
} catch (ApiException ex) {
CompletableFuture<ApiResponse<Void>> result = new CompletableFuture<>();
result.completeExceptionally(ex);
return result;
}
return apiClient.invokeAPIAsync(
"PATCH",
builder,
localVarHeaderParams,
new String[] {"application/json"},
localVarPostBody,
new HashMap<String, Object>(),
false,
null);
}
}
Loading
Loading