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

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::DORAMetricsAPI.new

body = DatadogAPIClient::V2::DORADeploymentPatchRequest.new({
data: DatadogAPIClient::V2::DORADeploymentPatchRequestData.new({
attributes: DatadogAPIClient::V2::DORADeploymentPatchRequestAttributes.new({
change_failure: true,
remediation: DatadogAPIClient::V2::DORADeploymentPatchRemediation.new({
id: "eG42zNIkVjM",
type: DatadogAPIClient::V2::DORADeploymentPatchRemediationType::ROLLBACK,
}),
}),
id: "z_RwVLi7v4Y",
type: DatadogAPIClient::V2::DORADeploymentPatchRequestDataType::DORA_DEPLOYMENT_PATCH_REQUEST,
}),
})
p api_instance.patch_dora_deployment("deployment_id", body)
4 changes: 4 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1981,6 +1981,10 @@
"v2.GetDORADeployment" => {
"deployment_id" => "String",
},
"v2.PatchDORADeployment" => {
"deployment_id" => "String",
"body" => "DORADeploymentPatchRequest",
},
"v2.CreateDORAFailure" => {
"body" => "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
6 changes: 6 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,12 @@ def overrides
"v2.dora_deployment_fetch_response" => "DORADeploymentFetchResponse",
"v2.dora_deployment_object" => "DORADeploymentObject",
"v2.dora_deployment_object_attributes" => "DORADeploymentObjectAttributes",
"v2.dora_deployment_patch_remediation" => "DORADeploymentPatchRemediation",
"v2.dora_deployment_patch_remediation_type" => "DORADeploymentPatchRemediationType",
"v2.dora_deployment_patch_request" => "DORADeploymentPatchRequest",
"v2.dora_deployment_patch_request_attributes" => "DORADeploymentPatchRequestAttributes",
"v2.dora_deployment_patch_request_data" => "DORADeploymentPatchRequestData",
"v2.dora_deployment_patch_request_data_type" => "DORADeploymentPatchRequestDataType",
"v2.dora_deployment_request" => "DORADeploymentRequest",
"v2.dora_deployment_request_attributes" => "DORADeploymentRequestAttributes",
"v2.dora_deployment_request_data" => "DORADeploymentRequestData",
Expand Down
72 changes: 72 additions & 0 deletions lib/datadog_api_client/v2/api/dora_metrics_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -635,5 +635,77 @@ def list_dora_failures_with_http_info(body, opts = {})
end
return data, status_code, headers
end

# Patch a deployment event.
#
# @see #patch_dora_deployment_with_http_info
def patch_dora_deployment(deployment_id, body, opts = {})
data, _status_code, _headers = patch_dora_deployment_with_http_info(deployment_id, body, opts)
data
end

# Patch a deployment event.
#
# Use this API endpoint to patch a deployment event.
#
# @param deployment_id [String] The ID of the deployment event.
# @param body [DORADeploymentPatchRequest]
# @param opts [Hash] the optional parameters
# @return [Array<(DORADeploymentFetchResponse, Integer, Hash)>] DORADeploymentFetchResponse data, response status code and response headers
def patch_dora_deployment_with_http_info(deployment_id, body, opts = {})

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DORAMetricsAPI.patch_dora_deployment ...'
end
# verify the required parameter 'deployment_id' is set
if @api_client.config.client_side_validation && deployment_id.nil?
fail ArgumentError, "Missing the required parameter 'deployment_id' when calling DORAMetricsAPI.patch_dora_deployment"
end
# verify the required parameter 'body' is set
if @api_client.config.client_side_validation && body.nil?
fail ArgumentError, "Missing the required parameter 'body' when calling DORAMetricsAPI.patch_dora_deployment"
end
# resource path
local_var_path = '/api/v2/dora/deployments/{deployment_id}'.sub('{deployment_id}', CGI.escape(deployment_id.to_s).gsub('%2F', '/'))

# query parameters
query_params = opts[:query_params] || {}

# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

# form parameters
form_params = opts[:form_params] || {}

# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

# return_type
return_type = opts[:debug_return_type] || 'DORADeploymentFetchResponse'

# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]

new_options = opts.merge(
:operation => :patch_dora_deployment,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)

data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DORAMetricsAPI#patch_dora_deployment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
end
end
Loading
Loading