From fd361666fd452e471e9f63937339a73cf0bd423b Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 29 Jan 2026 10:56:50 +0000 Subject: [PATCH] Regenerate client from commit 4862f88 of spec repo --- .generator/schemas/v2/openapi.yaml | 123 ++++++++++++++++++ docs/datadog_api_client.v2.model.rst | 42 ++++++ .../v2/dora-metrics/PatchDORADeployment.py | 31 +++++ .../v2/api/dora_metrics_api.py | 48 +++++++ .../dora_deployment_patch_remediation.py | 48 +++++++ .../dora_deployment_patch_remediation_type.py | 38 ++++++ .../v2/model/dora_deployment_patch_request.py | 40 ++++++ ...ora_deployment_patch_request_attributes.py | 54 ++++++++ .../dora_deployment_patch_request_data.py | 66 ++++++++++ ...dora_deployment_patch_request_data_type.py | 37 ++++++ src/datadog_api_client/v2/models/__init__.py | 12 ++ ...ent_event_returns_accepted_response.frozen | 1 + ...yment_event_returns_accepted_response.yaml | 38 ++++++ ..._event_returns_bad_request_response.frozen | 1 + ...nt_event_returns_bad_request_response.yaml | 39 ++++++ tests/v2/features/dora_metrics.feature | 18 +++ tests/v2/features/undo.json | 6 + 17 files changed, 642 insertions(+) create mode 100644 examples/v2/dora-metrics/PatchDORADeployment.py create mode 100644 src/datadog_api_client/v2/model/dora_deployment_patch_remediation.py create mode 100644 src/datadog_api_client/v2/model/dora_deployment_patch_remediation_type.py create mode 100644 src/datadog_api_client/v2/model/dora_deployment_patch_request.py create mode 100644 src/datadog_api_client/v2/model/dora_deployment_patch_request_attributes.py create mode 100644 src/datadog_api_client/v2/model/dora_deployment_patch_request_data.py create mode 100644 src/datadog_api_client/v2/model/dora_deployment_patch_request_data_type.py create mode 100644 tests/v2/cassettes/test_scenarios/test_patch_a_deployment_event_returns_accepted_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_patch_a_deployment_event_returns_accepted_response.yaml create mode 100644 tests/v2/cassettes/test_scenarios/test_patch_a_deployment_event_returns_bad_request_response.frozen create mode 100644 tests/v2/cassettes/test_scenarios/test_patch_a_deployment_event_returns_bad_request_response.yaml diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 147e01bf6b..17d8b9eef1 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -16975,6 +16975,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: @@ -74157,6 +74240,46 @@ 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': + 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. diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 41d22bb2b4..1b8392e045 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -7760,6 +7760,48 @@ datadog\_api\_client.v2.model.dora\_deployment\_object\_attributes module :members: :show-inheritance: +datadog\_api\_client.v2.model.dora\_deployment\_patch\_remediation module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.dora_deployment_patch_remediation + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.dora\_deployment\_patch\_remediation\_type module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.dora_deployment_patch_remediation_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.dora\_deployment\_patch\_request module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.dora_deployment_patch_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.dora\_deployment\_patch\_request\_attributes module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.dora_deployment_patch_request_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.dora\_deployment\_patch\_request\_data module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.dora_deployment_patch_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.dora\_deployment\_patch\_request\_data\_type module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.dora_deployment_patch_request_data_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.dora\_deployment\_request module -------------------------------------------------------------- diff --git a/examples/v2/dora-metrics/PatchDORADeployment.py b/examples/v2/dora-metrics/PatchDORADeployment.py new file mode 100644 index 0000000000..c144b42c52 --- /dev/null +++ b/examples/v2/dora-metrics/PatchDORADeployment.py @@ -0,0 +1,31 @@ +""" +Patch a deployment event returns "Accepted" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.dora_metrics_api import DORAMetricsApi +from datadog_api_client.v2.model.dora_deployment_patch_remediation import DORADeploymentPatchRemediation +from datadog_api_client.v2.model.dora_deployment_patch_remediation_type import DORADeploymentPatchRemediationType +from datadog_api_client.v2.model.dora_deployment_patch_request import DORADeploymentPatchRequest +from datadog_api_client.v2.model.dora_deployment_patch_request_attributes import DORADeploymentPatchRequestAttributes +from datadog_api_client.v2.model.dora_deployment_patch_request_data import DORADeploymentPatchRequestData +from datadog_api_client.v2.model.dora_deployment_patch_request_data_type import DORADeploymentPatchRequestDataType + +body = DORADeploymentPatchRequest( + data=DORADeploymentPatchRequestData( + attributes=DORADeploymentPatchRequestAttributes( + change_failure=True, + remediation=DORADeploymentPatchRemediation( + id="eG42zNIkVjM", + type=DORADeploymentPatchRemediationType.ROLLBACK, + ), + ), + id="z_RwVLi7v4Y", + type=DORADeploymentPatchRequestDataType.DORA_DEPLOYMENT_PATCH_REQUEST, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = DORAMetricsApi(api_client) + api_instance.patch_dora_deployment(deployment_id="deployment_id", body=body) diff --git a/src/datadog_api_client/v2/api/dora_metrics_api.py b/src/datadog_api_client/v2/api/dora_metrics_api.py index 31f81aa5b4..733c295f98 100644 --- a/src/datadog_api_client/v2/api/dora_metrics_api.py +++ b/src/datadog_api_client/v2/api/dora_metrics_api.py @@ -13,6 +13,7 @@ from datadog_api_client.v2.model.dora_deployments_list_response import DORADeploymentsListResponse from datadog_api_client.v2.model.dora_list_deployments_request import DORAListDeploymentsRequest from datadog_api_client.v2.model.dora_deployment_fetch_response import DORADeploymentFetchResponse +from datadog_api_client.v2.model.dora_deployment_patch_request import DORADeploymentPatchRequest from datadog_api_client.v2.model.dora_failure_response import DORAFailureResponse from datadog_api_client.v2.model.dora_failure_request import DORAFailureRequest from datadog_api_client.v2.model.dora_failures_list_response import DORAFailuresListResponse @@ -224,6 +225,32 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._patch_dora_deployment_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/dora/deployments/{deployment_id}", + "operation_id": "patch_dora_deployment", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "deployment_id": { + "required": True, + "openapi_types": (str,), + "attribute": "deployment_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (DORADeploymentPatchRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["*/*"], "content_type": ["application/json"]}, + api_client=api_client, + ) + def create_dora_deployment( self, body: DORADeploymentRequest, @@ -390,3 +417,24 @@ def list_dora_failures( kwargs["body"] = body return self._list_dora_failures_endpoint.call_with_http_info(**kwargs) + + def patch_dora_deployment( + self, + deployment_id: str, + body: DORADeploymentPatchRequest, + ) -> None: + """Patch a deployment event. + + Use this API endpoint to patch a deployment event. + + :param deployment_id: The ID of the deployment event. + :type deployment_id: str + :type body: DORADeploymentPatchRequest + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["deployment_id"] = deployment_id + + kwargs["body"] = body + + return self._patch_dora_deployment_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/model/dora_deployment_patch_remediation.py b/src/datadog_api_client/v2/model/dora_deployment_patch_remediation.py new file mode 100644 index 0000000000..88d0c8b2d6 --- /dev/null +++ b/src/datadog_api_client/v2/model/dora_deployment_patch_remediation.py @@ -0,0 +1,48 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.dora_deployment_patch_remediation_type import DORADeploymentPatchRemediationType + + +class DORADeploymentPatchRemediation(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.dora_deployment_patch_remediation_type import ( + DORADeploymentPatchRemediationType, + ) + + return { + "id": (str,), + "type": (DORADeploymentPatchRemediationType,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__(self_, id: str, type: DORADeploymentPatchRemediationType, **kwargs): + """ + Remediation details for the deployment. + + :param id: The ID of the remediation action. + :type id: str + + :param type: The type of remediation action taken. + :type type: DORADeploymentPatchRemediationType + """ + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/dora_deployment_patch_remediation_type.py b/src/datadog_api_client/v2/model/dora_deployment_patch_remediation_type.py new file mode 100644 index 0000000000..5d396eb1a8 --- /dev/null +++ b/src/datadog_api_client/v2/model/dora_deployment_patch_remediation_type.py @@ -0,0 +1,38 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class DORADeploymentPatchRemediationType(ModelSimple): + """ + The type of remediation action taken. + + :param value: Must be one of ["rollback", "rollforward"]. + :type value: str + """ + + allowed_values = { + "rollback", + "rollforward", + } + ROLLBACK: ClassVar["DORADeploymentPatchRemediationType"] + ROLLFORWARD: ClassVar["DORADeploymentPatchRemediationType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +DORADeploymentPatchRemediationType.ROLLBACK = DORADeploymentPatchRemediationType("rollback") +DORADeploymentPatchRemediationType.ROLLFORWARD = DORADeploymentPatchRemediationType("rollforward") diff --git a/src/datadog_api_client/v2/model/dora_deployment_patch_request.py b/src/datadog_api_client/v2/model/dora_deployment_patch_request.py new file mode 100644 index 0000000000..d26f9b4e53 --- /dev/null +++ b/src/datadog_api_client/v2/model/dora_deployment_patch_request.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.dora_deployment_patch_request_data import DORADeploymentPatchRequestData + + +class DORADeploymentPatchRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.dora_deployment_patch_request_data import DORADeploymentPatchRequestData + + return { + "data": (DORADeploymentPatchRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: DORADeploymentPatchRequestData, **kwargs): + """ + Request to patch a DORA deployment event. + + :param data: The JSON:API data for patching a deployment. + :type data: DORADeploymentPatchRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/dora_deployment_patch_request_attributes.py b/src/datadog_api_client/v2/model/dora_deployment_patch_request_attributes.py new file mode 100644 index 0000000000..0ac78c2e74 --- /dev/null +++ b/src/datadog_api_client/v2/model/dora_deployment_patch_request_attributes.py @@ -0,0 +1,54 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.dora_deployment_patch_remediation import DORADeploymentPatchRemediation + + +class DORADeploymentPatchRequestAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.dora_deployment_patch_remediation import DORADeploymentPatchRemediation + + return { + "change_failure": (bool,), + "remediation": (DORADeploymentPatchRemediation,), + } + + attribute_map = { + "change_failure": "change_failure", + "remediation": "remediation", + } + + def __init__( + self_, + change_failure: Union[bool, UnsetType] = unset, + remediation: Union[DORADeploymentPatchRemediation, UnsetType] = unset, + **kwargs, + ): + """ + Attributes for patching a DORA deployment event. + + :param change_failure: Indicates whether the deployment resulted in a change failure. + :type change_failure: bool, optional + + :param remediation: Remediation details for the deployment. + :type remediation: DORADeploymentPatchRemediation, optional + """ + if change_failure is not unset: + kwargs["change_failure"] = change_failure + if remediation is not unset: + kwargs["remediation"] = remediation + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/dora_deployment_patch_request_data.py b/src/datadog_api_client/v2/model/dora_deployment_patch_request_data.py new file mode 100644 index 0000000000..ff86a1c978 --- /dev/null +++ b/src/datadog_api_client/v2/model/dora_deployment_patch_request_data.py @@ -0,0 +1,66 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.dora_deployment_patch_request_attributes import ( + DORADeploymentPatchRequestAttributes, + ) + from datadog_api_client.v2.model.dora_deployment_patch_request_data_type import DORADeploymentPatchRequestDataType + + +class DORADeploymentPatchRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.dora_deployment_patch_request_attributes import ( + DORADeploymentPatchRequestAttributes, + ) + from datadog_api_client.v2.model.dora_deployment_patch_request_data_type import ( + DORADeploymentPatchRequestDataType, + ) + + return { + "attributes": (DORADeploymentPatchRequestAttributes,), + "id": (str,), + "type": (DORADeploymentPatchRequestDataType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: DORADeploymentPatchRequestAttributes, + id: str, + type: DORADeploymentPatchRequestDataType, + **kwargs, + ): + """ + The JSON:API data for patching a deployment. + + :param attributes: Attributes for patching a DORA deployment event. + :type attributes: DORADeploymentPatchRequestAttributes + + :param id: The ID of the deployment to patch. + :type id: str + + :param type: JSON:API type for DORA deployment patch request. + :type type: DORADeploymentPatchRequestDataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/dora_deployment_patch_request_data_type.py b/src/datadog_api_client/v2/model/dora_deployment_patch_request_data_type.py new file mode 100644 index 0000000000..33d119404d --- /dev/null +++ b/src/datadog_api_client/v2/model/dora_deployment_patch_request_data_type.py @@ -0,0 +1,37 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class DORADeploymentPatchRequestDataType(ModelSimple): + """ + JSON:API type for DORA deployment patch request. + + :param value: If omitted defaults to "dora_deployment_patch_request". Must be one of ["dora_deployment_patch_request"]. + :type value: str + """ + + allowed_values = { + "dora_deployment_patch_request", + } + DORA_DEPLOYMENT_PATCH_REQUEST: ClassVar["DORADeploymentPatchRequestDataType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +DORADeploymentPatchRequestDataType.DORA_DEPLOYMENT_PATCH_REQUEST = DORADeploymentPatchRequestDataType( + "dora_deployment_patch_request" +) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 010c5fb61c..f0052356a0 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -1390,6 +1390,12 @@ from datadog_api_client.v2.model.dora_deployment_fetch_response import DORADeploymentFetchResponse from datadog_api_client.v2.model.dora_deployment_object import DORADeploymentObject from datadog_api_client.v2.model.dora_deployment_object_attributes import DORADeploymentObjectAttributes +from datadog_api_client.v2.model.dora_deployment_patch_remediation import DORADeploymentPatchRemediation +from datadog_api_client.v2.model.dora_deployment_patch_remediation_type import DORADeploymentPatchRemediationType +from datadog_api_client.v2.model.dora_deployment_patch_request import DORADeploymentPatchRequest +from datadog_api_client.v2.model.dora_deployment_patch_request_attributes import DORADeploymentPatchRequestAttributes +from datadog_api_client.v2.model.dora_deployment_patch_request_data import DORADeploymentPatchRequestData +from datadog_api_client.v2.model.dora_deployment_patch_request_data_type import DORADeploymentPatchRequestDataType from datadog_api_client.v2.model.dora_deployment_request import DORADeploymentRequest from datadog_api_client.v2.model.dora_deployment_request_attributes import DORADeploymentRequestAttributes from datadog_api_client.v2.model.dora_deployment_request_data import DORADeploymentRequestData @@ -6769,6 +6775,12 @@ "DORADeploymentFetchResponse", "DORADeploymentObject", "DORADeploymentObjectAttributes", + "DORADeploymentPatchRemediation", + "DORADeploymentPatchRemediationType", + "DORADeploymentPatchRequest", + "DORADeploymentPatchRequestAttributes", + "DORADeploymentPatchRequestData", + "DORADeploymentPatchRequestDataType", "DORADeploymentRequest", "DORADeploymentRequestAttributes", "DORADeploymentRequestData", diff --git a/tests/v2/cassettes/test_scenarios/test_patch_a_deployment_event_returns_accepted_response.frozen b/tests/v2/cassettes/test_scenarios/test_patch_a_deployment_event_returns_accepted_response.frozen new file mode 100644 index 0000000000..53c8b2fcbb --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_patch_a_deployment_event_returns_accepted_response.frozen @@ -0,0 +1 @@ +2026-01-29T09:25:52.032Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_patch_a_deployment_event_returns_accepted_response.yaml b/tests/v2/cassettes/test_scenarios/test_patch_a_deployment_event_returns_accepted_response.yaml new file mode 100644 index 0000000000..e806c5ca40 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_patch_a_deployment_event_returns_accepted_response.yaml @@ -0,0 +1,38 @@ +interactions: +- request: + body: '{"data":{"attributes":{"finished_at":1769678752000000000,"git":{"commit_sha":"66adc9350f2cc9b250b69abddab733dd55e1a588","repository_url":"https://github.com/organization/example-repository"},"id":"08a3dbc57bb781a5","service":"shopist","started_at":1769675152000000000,"version":"v1.12.07"}}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/dora/deployment + response: + body: + string: '{"data":{"id":"08a3dbc57bb781a5","type":"dora_deployment"}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: '{"data":{"attributes":{"change_failure":true,"remediation":{"id":"eG42zNIkVjM","type":"rollback"}},"id":"08a3dbc57bb781a5","type":"dora_deployment_patch_request"}}' + headers: + accept: + - '*/*' + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/dora/deployments/08a3dbc57bb781a5 + response: + body: + string: '{"data":null}' + headers: + content-type: + - application/vnd.api+json + status: + code: 202 + message: Accepted +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_patch_a_deployment_event_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_patch_a_deployment_event_returns_bad_request_response.frozen new file mode 100644 index 0000000000..52bae6cfe7 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_patch_a_deployment_event_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2026-01-29T09:25:52.758Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_patch_a_deployment_event_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_patch_a_deployment_event_returns_bad_request_response.yaml new file mode 100644 index 0000000000..89afbb7721 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_patch_a_deployment_event_returns_bad_request_response.yaml @@ -0,0 +1,39 @@ +interactions: +- request: + body: '{"data":{"attributes":{"finished_at":1769678752000000000,"git":{"commit_sha":"66adc9350f2cc9b250b69abddab733dd55e1a588","repository_url":"https://github.com/organization/example-repository"},"id":"bf100f167795c925","service":"shopist","started_at":1769675152000000000,"version":"v1.12.07"}}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/dora/deployment + response: + body: + string: '{"data":{"id":"bf100f167795c925","type":"dora_deployment"}}' + headers: + content-type: + - application/vnd.api+json + status: + code: 200 + message: OK +- request: + body: '{"data":{"attributes":{"change_failure":true,"remediation":{"id":"eG42zNIkVjM","type":"wrong_type"}},"id":"bf100f167795c925","type":"dora_deployment_patch_request"}}' + headers: + accept: + - '*/*' + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/dora/deployments/bf100f167795c925 + response: + body: + string: '{"errors":[{"status":"400","title":"Bad Request","detail":"attribute + \"type\" must be one of \"rollback rollforward\""}]}' + headers: + content-type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/features/dora_metrics.feature b/tests/v2/features/dora_metrics.feature index b11b0fc74d..7a3275b54b 100644 --- a/tests/v2/features/dora_metrics.feature +++ b/tests/v2/features/dora_metrics.feature @@ -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 diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 5a347bddf1..307294e021 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1448,6 +1448,12 @@ "type": "safe" } }, + "PatchDORADeployment": { + "tag": "DORA Metrics", + "undo": { + "type": "idempotent" + } + }, "CreateDORAFailure": { "tag": "DORA Metrics", "undo": {