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
127 changes: 127 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down
44 changes: 44 additions & 0 deletions examples/v2/dora-metrics/PatchDORADeployment.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
}
163 changes: 163 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.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;
Expand Down Expand Up @@ -1279,4 +1280,166 @@ public CompletableFuture<ApiResponse<DORAFailuresListResponse>> listDORAFailures
false,
new GenericType<DORAFailuresListResponse>() {});
}

/**
* Patch a deployment event.
*
* <p>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.
*
* <p>See {@link #patchDORADeploymentWithHttpInfoAsync}.
*
* @param deploymentId The ID of the deployment event. (required)
* @param body (required)
* @return CompletableFuture&lt;DORADeploymentFetchResponse&gt;
*/
public CompletableFuture<DORADeploymentFetchResponse> 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&lt;DORADeploymentFetchResponse&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<DORADeploymentFetchResponse> 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<String, String> localVarHeaderParams = new HashMap<String, String>();

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

/**
* Patch a deployment event.
*
* <p>See {@link #patchDORADeploymentWithHttpInfo}.
*
* @param deploymentId The ID of the deployment event. (required)
* @param body (required)
* @return CompletableFuture&lt;ApiResponse&lt;DORADeploymentFetchResponse&gt;&gt;
*/
public CompletableFuture<ApiResponse<DORADeploymentFetchResponse>>
patchDORADeploymentWithHttpInfoAsync(String deploymentId, DORADeploymentPatchRequest body) {
Object localVarPostBody = body;

// verify the required parameter 'deploymentId' is set
if (deploymentId == null) {
CompletableFuture<ApiResponse<DORADeploymentFetchResponse>> 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<ApiResponse<DORADeploymentFetchResponse>> 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<String, String> localVarHeaderParams = new HashMap<String, String>();

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