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
34 changes: 34 additions & 0 deletions examples/v2/dora-metrics/PatchDORADeployment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Patch a deployment event returns "Accepted" response
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.DORAMetricsApi(configuration);

const params: v2.DORAMetricsApiPatchDORADeploymentRequest = {
body: {
data: {
attributes: {
changeFailure: true,
remediation: {
id: "eG42zNIkVjM",
type: "rollback",
},
},
id: "z_RwVLi7v4Y",
type: "dora_deployment_patch_request",
},
},
deploymentId: "deployment_id",
};

apiInstance
.patchDORADeployment(params)
.then((data: v2.DORADeploymentFetchResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
11 changes: 11 additions & 0 deletions features/support/scenarios_model_mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5650,6 +5650,17 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
},
"operationResponseType": "DORADeploymentFetchResponse",
},
"v2.PatchDORADeployment": {
"deploymentId": {
"type": "string",
"format": "",
},
"body": {
"type": "DORADeploymentPatchRequest",
"format": "",
},
"operationResponseType": "DORADeploymentFetchResponse",
},
"v2.CreateDORAFailure": {
"body": {
"type": "DORAFailureRequest",
Expand Down
18 changes: 18 additions & 0 deletions features/v2/dora_metrics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -1448,6 +1448,12 @@
"type": "safe"
}
},
"PatchDORADeployment": {
"tag": "DORA Metrics",
"undo": {
"type": "idempotent"
}
},
"CreateDORAFailure": {
"tag": "DORA Metrics",
"undo": {
Expand Down
Loading