Skip to content

Commit c384e1b

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add public patch DORA deployment endpoint (#3123)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 728703b commit c384e1b

17 files changed

+642
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17239,6 +17239,89 @@ components:
1723917239
- started_at
1724017240
- finished_at
1724117241
type: object
17242+
DORADeploymentPatchRemediation:
17243+
description: Remediation details for the deployment.
17244+
properties:
17245+
id:
17246+
description: The ID of the remediation action.
17247+
example: eG42zNIkVjM
17248+
type: string
17249+
type:
17250+
$ref: '#/components/schemas/DORADeploymentPatchRemediationType'
17251+
required:
17252+
- id
17253+
- type
17254+
type: object
17255+
DORADeploymentPatchRemediationType:
17256+
description: The type of remediation action taken.
17257+
enum:
17258+
- rollback
17259+
- rollforward
17260+
example: rollback
17261+
type: string
17262+
x-enum-varnames:
17263+
- ROLLBACK
17264+
- ROLLFORWARD
17265+
DORADeploymentPatchRequest:
17266+
description: Request to patch a DORA deployment event.
17267+
example:
17268+
data:
17269+
attributes:
17270+
change_failure: true
17271+
remediation:
17272+
id: eG42zNIkVjM
17273+
type: rollback
17274+
id: z_RwVLi7v4Y
17275+
type: dora_deployment_patch_request
17276+
properties:
17277+
data:
17278+
$ref: '#/components/schemas/DORADeploymentPatchRequestData'
17279+
required:
17280+
- data
17281+
type: object
17282+
DORADeploymentPatchRequestAttributes:
17283+
description: Attributes for patching a DORA deployment event.
17284+
properties:
17285+
change_failure:
17286+
description: Indicates whether the deployment resulted in a change failure.
17287+
example: true
17288+
type: boolean
17289+
remediation:
17290+
$ref: '#/components/schemas/DORADeploymentPatchRemediation'
17291+
type: object
17292+
DORADeploymentPatchRequestData:
17293+
description: The JSON:API data for patching a deployment.
17294+
example:
17295+
attributes:
17296+
change_failure: true
17297+
remediation:
17298+
id: eG42zNIkVjM
17299+
type: rollback
17300+
id: z_RwVLi7v4Y
17301+
type: dora_deployment_patch_request
17302+
properties:
17303+
attributes:
17304+
$ref: '#/components/schemas/DORADeploymentPatchRequestAttributes'
17305+
id:
17306+
description: The ID of the deployment to patch.
17307+
example: z_RwVLi7v4Y
17308+
type: string
17309+
type:
17310+
$ref: '#/components/schemas/DORADeploymentPatchRequestDataType'
17311+
required:
17312+
- type
17313+
- id
17314+
- attributes
17315+
type: object
17316+
DORADeploymentPatchRequestDataType:
17317+
default: dora_deployment_patch_request
17318+
description: JSON:API type for DORA deployment patch request.
17319+
enum:
17320+
- dora_deployment_patch_request
17321+
example: dora_deployment_patch_request
17322+
type: string
17323+
x-enum-varnames:
17324+
- DORA_DEPLOYMENT_PATCH_REQUEST
1724217325
DORADeploymentRequest:
1724317326
description: Request to create a DORA deployment event.
1724417327
properties:
@@ -74974,6 +75057,46 @@ paths:
7497475057
operator: OR
7497575058
permissions:
7497675059
- dora_metrics_read
75060+
patch:
75061+
description: Use this API endpoint to patch a deployment event.
75062+
operationId: PatchDORADeployment
75063+
parameters:
75064+
- description: The ID of the deployment event.
75065+
in: path
75066+
name: deployment_id
75067+
required: true
75068+
schema:
75069+
type: string
75070+
requestBody:
75071+
content:
75072+
application/json:
75073+
schema:
75074+
$ref: '#/components/schemas/DORADeploymentPatchRequest'
75075+
required: true
75076+
responses:
75077+
'202':
75078+
description: Accepted
75079+
'400':
75080+
content:
75081+
application/json:
75082+
schema:
75083+
$ref: '#/components/schemas/JSONAPIErrorResponse'
75084+
description: Bad Request
75085+
'403':
75086+
$ref: '#/components/responses/NotAuthorizedResponse'
75087+
'429':
75088+
$ref: '#/components/responses/TooManyRequestsResponse'
75089+
security:
75090+
- apiKeyAuth: []
75091+
appKeyAuth: []
75092+
summary: Patch a deployment event
75093+
tags:
75094+
- DORA Metrics
75095+
x-codegen-request-body-name: body
75096+
x-permission:
75097+
operator: OR
75098+
permissions:
75099+
- dora_metrics_write
7497775100
/api/v2/dora/failure:
7497875101
post:
7497975102
description: 'Use this API endpoint to provide failure data.

docs/datadog_api_client.v2.model.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7893,6 +7893,48 @@ datadog\_api\_client.v2.model.dora\_deployment\_object\_attributes module
78937893
:members:
78947894
:show-inheritance:
78957895

7896+
datadog\_api\_client.v2.model.dora\_deployment\_patch\_remediation module
7897+
-------------------------------------------------------------------------
7898+
7899+
.. automodule:: datadog_api_client.v2.model.dora_deployment_patch_remediation
7900+
:members:
7901+
:show-inheritance:
7902+
7903+
datadog\_api\_client.v2.model.dora\_deployment\_patch\_remediation\_type module
7904+
-------------------------------------------------------------------------------
7905+
7906+
.. automodule:: datadog_api_client.v2.model.dora_deployment_patch_remediation_type
7907+
:members:
7908+
:show-inheritance:
7909+
7910+
datadog\_api\_client.v2.model.dora\_deployment\_patch\_request module
7911+
---------------------------------------------------------------------
7912+
7913+
.. automodule:: datadog_api_client.v2.model.dora_deployment_patch_request
7914+
:members:
7915+
:show-inheritance:
7916+
7917+
datadog\_api\_client.v2.model.dora\_deployment\_patch\_request\_attributes module
7918+
---------------------------------------------------------------------------------
7919+
7920+
.. automodule:: datadog_api_client.v2.model.dora_deployment_patch_request_attributes
7921+
:members:
7922+
:show-inheritance:
7923+
7924+
datadog\_api\_client.v2.model.dora\_deployment\_patch\_request\_data module
7925+
---------------------------------------------------------------------------
7926+
7927+
.. automodule:: datadog_api_client.v2.model.dora_deployment_patch_request_data
7928+
:members:
7929+
:show-inheritance:
7930+
7931+
datadog\_api\_client.v2.model.dora\_deployment\_patch\_request\_data\_type module
7932+
---------------------------------------------------------------------------------
7933+
7934+
.. automodule:: datadog_api_client.v2.model.dora_deployment_patch_request_data_type
7935+
:members:
7936+
:show-inheritance:
7937+
78967938
datadog\_api\_client.v2.model.dora\_deployment\_request module
78977939
--------------------------------------------------------------
78987940

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""
2+
Patch a deployment event returns "Accepted" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.dora_metrics_api import DORAMetricsApi
7+
from datadog_api_client.v2.model.dora_deployment_patch_remediation import DORADeploymentPatchRemediation
8+
from datadog_api_client.v2.model.dora_deployment_patch_remediation_type import DORADeploymentPatchRemediationType
9+
from datadog_api_client.v2.model.dora_deployment_patch_request import DORADeploymentPatchRequest
10+
from datadog_api_client.v2.model.dora_deployment_patch_request_attributes import DORADeploymentPatchRequestAttributes
11+
from datadog_api_client.v2.model.dora_deployment_patch_request_data import DORADeploymentPatchRequestData
12+
from datadog_api_client.v2.model.dora_deployment_patch_request_data_type import DORADeploymentPatchRequestDataType
13+
14+
body = DORADeploymentPatchRequest(
15+
data=DORADeploymentPatchRequestData(
16+
attributes=DORADeploymentPatchRequestAttributes(
17+
change_failure=True,
18+
remediation=DORADeploymentPatchRemediation(
19+
id="eG42zNIkVjM",
20+
type=DORADeploymentPatchRemediationType.ROLLBACK,
21+
),
22+
),
23+
id="z_RwVLi7v4Y",
24+
type=DORADeploymentPatchRequestDataType.DORA_DEPLOYMENT_PATCH_REQUEST,
25+
),
26+
)
27+
28+
configuration = Configuration()
29+
with ApiClient(configuration) as api_client:
30+
api_instance = DORAMetricsApi(api_client)
31+
api_instance.patch_dora_deployment(deployment_id="deployment_id", body=body)

src/datadog_api_client/v2/api/dora_metrics_api.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from datadog_api_client.v2.model.dora_deployments_list_response import DORADeploymentsListResponse
1414
from datadog_api_client.v2.model.dora_list_deployments_request import DORAListDeploymentsRequest
1515
from datadog_api_client.v2.model.dora_deployment_fetch_response import DORADeploymentFetchResponse
16+
from datadog_api_client.v2.model.dora_deployment_patch_request import DORADeploymentPatchRequest
1617
from datadog_api_client.v2.model.dora_failure_response import DORAFailureResponse
1718
from datadog_api_client.v2.model.dora_failure_request import DORAFailureRequest
1819
from datadog_api_client.v2.model.dora_failures_list_response import DORAFailuresListResponse
@@ -224,6 +225,32 @@ def __init__(self, api_client=None):
224225
api_client=api_client,
225226
)
226227

228+
self._patch_dora_deployment_endpoint = _Endpoint(
229+
settings={
230+
"response_type": None,
231+
"auth": ["apiKeyAuth", "appKeyAuth"],
232+
"endpoint_path": "/api/v2/dora/deployments/{deployment_id}",
233+
"operation_id": "patch_dora_deployment",
234+
"http_method": "PATCH",
235+
"version": "v2",
236+
},
237+
params_map={
238+
"deployment_id": {
239+
"required": True,
240+
"openapi_types": (str,),
241+
"attribute": "deployment_id",
242+
"location": "path",
243+
},
244+
"body": {
245+
"required": True,
246+
"openapi_types": (DORADeploymentPatchRequest,),
247+
"location": "body",
248+
},
249+
},
250+
headers_map={"accept": ["*/*"], "content_type": ["application/json"]},
251+
api_client=api_client,
252+
)
253+
227254
def create_dora_deployment(
228255
self,
229256
body: DORADeploymentRequest,
@@ -390,3 +417,24 @@ def list_dora_failures(
390417
kwargs["body"] = body
391418

392419
return self._list_dora_failures_endpoint.call_with_http_info(**kwargs)
420+
421+
def patch_dora_deployment(
422+
self,
423+
deployment_id: str,
424+
body: DORADeploymentPatchRequest,
425+
) -> None:
426+
"""Patch a deployment event.
427+
428+
Use this API endpoint to patch a deployment event.
429+
430+
:param deployment_id: The ID of the deployment event.
431+
:type deployment_id: str
432+
:type body: DORADeploymentPatchRequest
433+
:rtype: None
434+
"""
435+
kwargs: Dict[str, Any] = {}
436+
kwargs["deployment_id"] = deployment_id
437+
438+
kwargs["body"] = body
439+
440+
return self._patch_dora_deployment_endpoint.call_with_http_info(**kwargs)
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
from typing import TYPE_CHECKING
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
)
12+
13+
14+
if TYPE_CHECKING:
15+
from datadog_api_client.v2.model.dora_deployment_patch_remediation_type import DORADeploymentPatchRemediationType
16+
17+
18+
class DORADeploymentPatchRemediation(ModelNormal):
19+
@cached_property
20+
def openapi_types(_):
21+
from datadog_api_client.v2.model.dora_deployment_patch_remediation_type import (
22+
DORADeploymentPatchRemediationType,
23+
)
24+
25+
return {
26+
"id": (str,),
27+
"type": (DORADeploymentPatchRemediationType,),
28+
}
29+
30+
attribute_map = {
31+
"id": "id",
32+
"type": "type",
33+
}
34+
35+
def __init__(self_, id: str, type: DORADeploymentPatchRemediationType, **kwargs):
36+
"""
37+
Remediation details for the deployment.
38+
39+
:param id: The ID of the remediation action.
40+
:type id: str
41+
42+
:param type: The type of remediation action taken.
43+
:type type: DORADeploymentPatchRemediationType
44+
"""
45+
super().__init__(kwargs)
46+
47+
self_.id = id
48+
self_.type = type
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
7+
from datadog_api_client.model_utils import (
8+
ModelSimple,
9+
cached_property,
10+
)
11+
12+
from typing import ClassVar
13+
14+
15+
class DORADeploymentPatchRemediationType(ModelSimple):
16+
"""
17+
The type of remediation action taken.
18+
19+
:param value: Must be one of ["rollback", "rollforward"].
20+
:type value: str
21+
"""
22+
23+
allowed_values = {
24+
"rollback",
25+
"rollforward",
26+
}
27+
ROLLBACK: ClassVar["DORADeploymentPatchRemediationType"]
28+
ROLLFORWARD: ClassVar["DORADeploymentPatchRemediationType"]
29+
30+
@cached_property
31+
def openapi_types(_):
32+
return {
33+
"value": (str,),
34+
}
35+
36+
37+
DORADeploymentPatchRemediationType.ROLLBACK = DORADeploymentPatchRemediationType("rollback")
38+
DORADeploymentPatchRemediationType.ROLLFORWARD = DORADeploymentPatchRemediationType("rollforward")

0 commit comments

Comments
 (0)