diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 2c0f436fe3..523635b57e 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -29678,15 +29678,109 @@ components: - service - started_at type: object + DORADeploymentPatchByVersionRemediation: + description: Remediation details for the deployment. Optional, but required to calculate failed deployment recovery time. Specify either `id` or `version` to identify the remediation deployment, but not both. + oneOf: + - $ref: "#/components/schemas/DORADeploymentPatchByVersionRemediationByID" + - $ref: "#/components/schemas/DORADeploymentPatchByVersionRemediationByVersion" + DORADeploymentPatchByVersionRemediationByID: + additionalProperties: false + description: Remediation details identified by the ID of the remediation deployment. + properties: + id: + description: The ID of the remediation deployment. + example: eG42zNIkVjM + type: string + type: + $ref: "#/components/schemas/DORADeploymentPatchRemediationType" + required: + - id + - type + type: object + DORADeploymentPatchByVersionRemediationByVersion: + additionalProperties: false + description: Remediation details identified by the version of the remediation deployment, matched against the same service and environment as the failed deployment. + properties: + type: + $ref: "#/components/schemas/DORADeploymentPatchRemediationType" + version: + description: The version of the remediation deployment. + example: v1.2.4 + type: string + required: + - version + - type + type: object + DORADeploymentPatchByVersionRequest: + description: Request to patch a DORA deployment event identified by service, environment, and version. + example: + data: + attributes: + change_failure: true + env: "production" + remediation: + type: "rollback" + version: "v1.2.2" + service: "my-service" + version: "v1.2.3" + type: "dora_deployment_patch_request" + properties: + data: + $ref: "#/components/schemas/DORADeploymentPatchByVersionRequestData" + required: + - data + type: object + DORADeploymentPatchByVersionRequestAttributes: + description: Attributes for patching a DORA deployment event identified by service, environment, and version. + properties: + change_failure: + description: Indicates whether the deployment resulted in a change failure. + example: true + type: boolean + env: + description: The environment the deployment was performed in. + example: prod + type: string + remediation: + $ref: "#/components/schemas/DORADeploymentPatchByVersionRemediation" + service: + description: The name of the service that was deployed. + example: my-service + type: string + version: + description: "The version deployed. This can be seen in the Service Catalog or in the APM Deployment Tracking." + example: v1.2.3 + type: string + required: + - service + - env + - version + - change_failure + type: object + DORADeploymentPatchByVersionRequestData: + description: The JSON:API data for patching a deployment identified by service, environment, and version. + properties: + attributes: + $ref: "#/components/schemas/DORADeploymentPatchByVersionRequestAttributes" + type: + $ref: "#/components/schemas/DORADeploymentPatchRequestDataType" + required: + - type + - attributes + type: object DORADeploymentPatchRemediation: - description: Remediation details for the deployment. Optional, but required to calculate failed deployment recovery time. + description: Remediation details for the deployment. Optional, but required to calculate failed deployment recovery time. Specify either `id` or `version` to identify the remediation deployment, but not both. properties: id: - description: The ID of the remediation deployment. Required when the failed deployment must be linked to a remediation deployment. + description: The ID of the remediation deployment. Use this or `version` to identify the remediation deployment, but not both. example: eG42zNIkVjM type: string type: $ref: "#/components/schemas/DORADeploymentPatchRemediationType" + version: + description: The version of the remediation deployment, matched against the same service and environment as the failed deployment. Use this or `id` to identify the remediation deployment, but not both. + example: v1.2.4 + type: string type: object DORADeploymentPatchRemediationType: description: The type of remediation action taken. Required when the failed deployment must be linked to a remediation deployment. @@ -140417,6 +140511,52 @@ paths: permissions: - dora_metrics_write /api/v2/dora/deployments: + patch: + description: |- + Update a deployment's change failure status, identifying the deployment by its service, environment, and version instead of its ID. Use this to mark a deployment as a change failure or back to stable. You can optionally include remediation details to enable failed deployment recovery time calculation. If multiple deployments match the given service, environment, and version, the most recently finished one is updated. + operationId: PatchDORADeploymentByVersion + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + change_failure: true + env: production + service: my-service + version: v1.2.3 + type: dora_deployment_patch_request + schema: + $ref: "#/components/schemas/DORADeploymentPatchByVersionRequest" + 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 by version + tags: ["DORA Metrics"] + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - dora_metrics_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). post: description: |- Use this API endpoint to get a list of deployment events. diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 5339b07ae2..bef1404b01 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -13122,6 +13122,41 @@ datadog\_api\_client.v2.model.dora\_deployment\_object\_attributes module :members: :show-inheritance: +datadog\_api\_client.v2.model.dora\_deployment\_patch\_by\_version\_remediation module +-------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.dora_deployment_patch_by_version_remediation + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.dora\_deployment\_patch\_by\_version\_remediation\_by\_id module +---------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.dora_deployment_patch_by_version_remediation_by_id + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.dora\_deployment\_patch\_by\_version\_request module +---------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.dora_deployment_patch_by_version_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.dora\_deployment\_patch\_by\_version\_request\_attributes module +---------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.dora_deployment_patch_by_version_request_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.dora\_deployment\_patch\_by\_version\_request\_data module +---------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.dora_deployment_patch_by_version_request_data + :members: + :show-inheritance: + datadog\_api\_client.v2.model.dora\_deployment\_patch\_remediation module ------------------------------------------------------------------------- diff --git a/examples/v2/dora-metrics/PatchDORADeploymentByVersion.py b/examples/v2/dora-metrics/PatchDORADeploymentByVersion.py new file mode 100644 index 0000000000..ca77f7b7e3 --- /dev/null +++ b/examples/v2/dora-metrics/PatchDORADeploymentByVersion.py @@ -0,0 +1,40 @@ +""" +Patch a deployment event by version 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_by_version_remediation_by_version import ( + DORADeploymentPatchByVersionRemediationByVersion, +) +from datadog_api_client.v2.model.dora_deployment_patch_by_version_request import DORADeploymentPatchByVersionRequest +from datadog_api_client.v2.model.dora_deployment_patch_by_version_request_attributes import ( + DORADeploymentPatchByVersionRequestAttributes, +) +from datadog_api_client.v2.model.dora_deployment_patch_by_version_request_data import ( + DORADeploymentPatchByVersionRequestData, +) +from datadog_api_client.v2.model.dora_deployment_patch_remediation_type import DORADeploymentPatchRemediationType +from datadog_api_client.v2.model.dora_deployment_patch_request_data_type import DORADeploymentPatchRequestDataType + +body = DORADeploymentPatchByVersionRequest( + data=DORADeploymentPatchByVersionRequestData( + attributes=DORADeploymentPatchByVersionRequestAttributes( + change_failure=True, + env="production", + remediation=DORADeploymentPatchByVersionRemediationByVersion( + type=DORADeploymentPatchRemediationType.ROLLBACK, + version="v1.2.2", + ), + service="my-service", + version="v1.2.3", + ), + type=DORADeploymentPatchRequestDataType.DORA_DEPLOYMENT_PATCH_REQUEST, + ), +) + +configuration = Configuration() +configuration.unstable_operations["patch_dora_deployment_by_version"] = True +with ApiClient(configuration) as api_client: + api_instance = DORAMetricsApi(api_client) + api_instance.patch_dora_deployment_by_version(body=body) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 3678cf3e2a..9c01331488 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -495,6 +495,7 @@ def __init__( "v2.trigger_deployment_gates_evaluation": False, "v2.update_deployment_gate": False, "v2.update_deployment_rule": False, + "v2.patch_dora_deployment_by_version": False, "v2.clone_form": False, "v2.create_and_publish_form": False, "v2.create_form": False, 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 a2264709b6..4e912e092f 100644 --- a/src/datadog_api_client/v2/api/dora_metrics_api.py +++ b/src/datadog_api_client/v2/api/dora_metrics_api.py @@ -10,6 +10,7 @@ from datadog_api_client.configuration import Configuration from datadog_api_client.v2.model.dora_deployment_response import DORADeploymentResponse from datadog_api_client.v2.model.dora_deployment_request import DORADeploymentRequest +from datadog_api_client.v2.model.dora_deployment_patch_by_version_request import DORADeploymentPatchByVersionRequest 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 @@ -251,6 +252,26 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._patch_dora_deployment_by_version_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/dora/deployments", + "operation_id": "patch_dora_deployment_by_version", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (DORADeploymentPatchByVersionRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["*/*"], "content_type": ["application/json"]}, + api_client=api_client, + ) + def create_dora_deployment( self, body: DORADeploymentRequest, @@ -432,3 +453,19 @@ def patch_dora_deployment( kwargs["body"] = body return self._patch_dora_deployment_endpoint.call_with_http_info(**kwargs) + + def patch_dora_deployment_by_version( + self, + body: DORADeploymentPatchByVersionRequest, + ) -> None: + """Patch a deployment event by version. + + Update a deployment's change failure status, identifying the deployment by its service, environment, and version instead of its ID. Use this to mark a deployment as a change failure or back to stable. You can optionally include remediation details to enable failed deployment recovery time calculation. If multiple deployments match the given service, environment, and version, the most recently finished one is updated. + + :type body: DORADeploymentPatchByVersionRequest + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._patch_dora_deployment_by_version_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/model/dora_deployment_patch_by_version_remediation.py b/src/datadog_api_client/v2/model/dora_deployment_patch_by_version_remediation.py new file mode 100644 index 0000000000..6ac38da53f --- /dev/null +++ b/src/datadog_api_client/v2/model/dora_deployment_patch_by_version_remediation.py @@ -0,0 +1,50 @@ +# 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 ( + ModelComposed, + cached_property, +) + + +class DORADeploymentPatchByVersionRemediation(ModelComposed): + def __init__(self, **kwargs): + """ + Remediation details for the deployment. Optional, but required to calculate failed deployment recovery time. Specify either ``id`` or ``version`` to identify the remediation deployment, but not both. + + :param id: The ID of the remediation deployment. + :type id: str + + :param type: The type of remediation action taken. Required when the failed deployment must be linked to a remediation deployment. + :type type: DORADeploymentPatchRemediationType + + :param version: The version of the remediation deployment. + :type version: str + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v2.model.dora_deployment_patch_by_version_remediation_by_id import ( + DORADeploymentPatchByVersionRemediationByID, + ) + from datadog_api_client.v2.model.dora_deployment_patch_by_version_remediation_by_version import ( + DORADeploymentPatchByVersionRemediationByVersion, + ) + + return { + "oneOf": [ + DORADeploymentPatchByVersionRemediationByID, + DORADeploymentPatchByVersionRemediationByVersion, + ], + } diff --git a/src/datadog_api_client/v2/model/dora_deployment_patch_by_version_remediation_by_id.py b/src/datadog_api_client/v2/model/dora_deployment_patch_by_version_remediation_by_id.py new file mode 100644 index 0000000000..dac96d0d14 --- /dev/null +++ b/src/datadog_api_client/v2/model/dora_deployment_patch_by_version_remediation_by_id.py @@ -0,0 +1,52 @@ +# 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 DORADeploymentPatchByVersionRemediationByID(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @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 identified by the ID of the remediation deployment. + + :param id: The ID of the remediation deployment. + :type id: str + + :param type: The type of remediation action taken. Required when the failed deployment must be linked to a remediation deployment. + :type type: DORADeploymentPatchRemediationType + """ + super().__init__(kwargs) + + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/dora_deployment_patch_by_version_remediation_by_version.py b/src/datadog_api_client/v2/model/dora_deployment_patch_by_version_remediation_by_version.py new file mode 100644 index 0000000000..c5aee82e1c --- /dev/null +++ b/src/datadog_api_client/v2/model/dora_deployment_patch_by_version_remediation_by_version.py @@ -0,0 +1,52 @@ +# 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 DORADeploymentPatchByVersionRemediationByVersion(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.dora_deployment_patch_remediation_type import ( + DORADeploymentPatchRemediationType, + ) + + return { + "type": (DORADeploymentPatchRemediationType,), + "version": (str,), + } + + attribute_map = { + "type": "type", + "version": "version", + } + + def __init__(self_, type: DORADeploymentPatchRemediationType, version: str, **kwargs): + """ + Remediation details identified by the version of the remediation deployment, matched against the same service and environment as the failed deployment. + + :param type: The type of remediation action taken. Required when the failed deployment must be linked to a remediation deployment. + :type type: DORADeploymentPatchRemediationType + + :param version: The version of the remediation deployment. + :type version: str + """ + super().__init__(kwargs) + + self_.type = type + self_.version = version diff --git a/src/datadog_api_client/v2/model/dora_deployment_patch_by_version_request.py b/src/datadog_api_client/v2/model/dora_deployment_patch_by_version_request.py new file mode 100644 index 0000000000..7eba7dc7e1 --- /dev/null +++ b/src/datadog_api_client/v2/model/dora_deployment_patch_by_version_request.py @@ -0,0 +1,44 @@ +# 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_by_version_request_data import ( + DORADeploymentPatchByVersionRequestData, + ) + + +class DORADeploymentPatchByVersionRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.dora_deployment_patch_by_version_request_data import ( + DORADeploymentPatchByVersionRequestData, + ) + + return { + "data": (DORADeploymentPatchByVersionRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: DORADeploymentPatchByVersionRequestData, **kwargs): + """ + Request to patch a DORA deployment event identified by service, environment, and version. + + :param data: The JSON:API data for patching a deployment identified by service, environment, and version. + :type data: DORADeploymentPatchByVersionRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/dora_deployment_patch_by_version_request_attributes.py b/src/datadog_api_client/v2/model/dora_deployment_patch_by_version_request_attributes.py new file mode 100644 index 0000000000..1a4e6bbe28 --- /dev/null +++ b/src/datadog_api_client/v2/model/dora_deployment_patch_by_version_request_attributes.py @@ -0,0 +1,90 @@ +# 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_by_version_remediation import ( + DORADeploymentPatchByVersionRemediation, + ) + from datadog_api_client.v2.model.dora_deployment_patch_by_version_remediation_by_id import ( + DORADeploymentPatchByVersionRemediationByID, + ) + from datadog_api_client.v2.model.dora_deployment_patch_by_version_remediation_by_version import ( + DORADeploymentPatchByVersionRemediationByVersion, + ) + + +class DORADeploymentPatchByVersionRequestAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.dora_deployment_patch_by_version_remediation import ( + DORADeploymentPatchByVersionRemediation, + ) + + return { + "change_failure": (bool,), + "env": (str,), + "remediation": (DORADeploymentPatchByVersionRemediation,), + "service": (str,), + "version": (str,), + } + + attribute_map = { + "change_failure": "change_failure", + "env": "env", + "remediation": "remediation", + "service": "service", + "version": "version", + } + + def __init__( + self_, + change_failure: bool, + env: str, + service: str, + version: str, + remediation: Union[ + DORADeploymentPatchByVersionRemediation, + DORADeploymentPatchByVersionRemediationByID, + DORADeploymentPatchByVersionRemediationByVersion, + UnsetType, + ] = unset, + **kwargs, + ): + """ + Attributes for patching a DORA deployment event identified by service, environment, and version. + + :param change_failure: Indicates whether the deployment resulted in a change failure. + :type change_failure: bool + + :param env: The environment the deployment was performed in. + :type env: str + + :param remediation: Remediation details for the deployment. Optional, but required to calculate failed deployment recovery time. Specify either ``id`` or ``version`` to identify the remediation deployment, but not both. + :type remediation: DORADeploymentPatchByVersionRemediation, optional + + :param service: The name of the service that was deployed. + :type service: str + + :param version: The version deployed. This can be seen in the Service Catalog or in the APM Deployment Tracking. + :type version: str + """ + if remediation is not unset: + kwargs["remediation"] = remediation + super().__init__(kwargs) + + self_.change_failure = change_failure + self_.env = env + self_.service = service + self_.version = version diff --git a/src/datadog_api_client/v2/model/dora_deployment_patch_by_version_request_data.py b/src/datadog_api_client/v2/model/dora_deployment_patch_by_version_request_data.py new file mode 100644 index 0000000000..6e272d671e --- /dev/null +++ b/src/datadog_api_client/v2/model/dora_deployment_patch_by_version_request_data.py @@ -0,0 +1,59 @@ +# 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_by_version_request_attributes import ( + DORADeploymentPatchByVersionRequestAttributes, + ) + from datadog_api_client.v2.model.dora_deployment_patch_request_data_type import DORADeploymentPatchRequestDataType + + +class DORADeploymentPatchByVersionRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.dora_deployment_patch_by_version_request_attributes import ( + DORADeploymentPatchByVersionRequestAttributes, + ) + from datadog_api_client.v2.model.dora_deployment_patch_request_data_type import ( + DORADeploymentPatchRequestDataType, + ) + + return { + "attributes": (DORADeploymentPatchByVersionRequestAttributes,), + "type": (DORADeploymentPatchRequestDataType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, + attributes: DORADeploymentPatchByVersionRequestAttributes, + type: DORADeploymentPatchRequestDataType, + **kwargs, + ): + """ + The JSON:API data for patching a deployment identified by service, environment, and version. + + :param attributes: Attributes for patching a DORA deployment event identified by service, environment, and version. + :type attributes: DORADeploymentPatchByVersionRequestAttributes + + :param type: JSON:API type for DORA deployment patch request. + :type type: DORADeploymentPatchRequestDataType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type 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 index 62647ecf08..b26031e19b 100644 --- a/src/datadog_api_client/v2/model/dora_deployment_patch_remediation.py +++ b/src/datadog_api_client/v2/model/dora_deployment_patch_remediation.py @@ -27,30 +27,38 @@ def openapi_types(_): return { "id": (str,), "type": (DORADeploymentPatchRemediationType,), + "version": (str,), } attribute_map = { "id": "id", "type": "type", + "version": "version", } def __init__( self_, id: Union[str, UnsetType] = unset, type: Union[DORADeploymentPatchRemediationType, UnsetType] = unset, + version: Union[str, UnsetType] = unset, **kwargs, ): """ - Remediation details for the deployment. Optional, but required to calculate failed deployment recovery time. + Remediation details for the deployment. Optional, but required to calculate failed deployment recovery time. Specify either ``id`` or ``version`` to identify the remediation deployment, but not both. - :param id: The ID of the remediation deployment. Required when the failed deployment must be linked to a remediation deployment. + :param id: The ID of the remediation deployment. Use this or ``version`` to identify the remediation deployment, but not both. :type id: str, optional :param type: The type of remediation action taken. Required when the failed deployment must be linked to a remediation deployment. :type type: DORADeploymentPatchRemediationType, optional + + :param version: The version of the remediation deployment, matched against the same service and environment as the failed deployment. Use this or ``id`` to identify the remediation deployment, but not both. + :type version: str, optional """ if id is not unset: kwargs["id"] = id if type is not unset: kwargs["type"] = type + if version is not unset: + kwargs["version"] = version super().__init__(kwargs) 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 index 7fb6bd1a19..7c1ff410e6 100644 --- 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 @@ -44,7 +44,7 @@ def __init__( :param change_failure: Indicates whether the deployment resulted in a change failure. :type change_failure: bool, optional - :param remediation: Remediation details for the deployment. Optional, but required to calculate failed deployment recovery time. + :param remediation: Remediation details for the deployment. Optional, but required to calculate failed deployment recovery time. Specify either ``id`` or ``version`` to identify the remediation deployment, but not both. :type remediation: DORADeploymentPatchRemediation, optional """ if change_failure is not unset: diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index d24ea0d032..c98d1ac694 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -2229,6 +2229,22 @@ 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_by_version_remediation import ( + DORADeploymentPatchByVersionRemediation, +) +from datadog_api_client.v2.model.dora_deployment_patch_by_version_remediation_by_id import ( + DORADeploymentPatchByVersionRemediationByID, +) +from datadog_api_client.v2.model.dora_deployment_patch_by_version_remediation_by_version import ( + DORADeploymentPatchByVersionRemediationByVersion, +) +from datadog_api_client.v2.model.dora_deployment_patch_by_version_request import DORADeploymentPatchByVersionRequest +from datadog_api_client.v2.model.dora_deployment_patch_by_version_request_attributes import ( + DORADeploymentPatchByVersionRequestAttributes, +) +from datadog_api_client.v2.model.dora_deployment_patch_by_version_request_data import ( + DORADeploymentPatchByVersionRequestData, +) 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 @@ -12189,6 +12205,12 @@ "DORADeploymentFetchResponse", "DORADeploymentObject", "DORADeploymentObjectAttributes", + "DORADeploymentPatchByVersionRemediation", + "DORADeploymentPatchByVersionRemediationByID", + "DORADeploymentPatchByVersionRemediationByVersion", + "DORADeploymentPatchByVersionRequest", + "DORADeploymentPatchByVersionRequestAttributes", + "DORADeploymentPatchByVersionRequestData", "DORADeploymentPatchRemediation", "DORADeploymentPatchRemediationType", "DORADeploymentPatchRequest", diff --git a/tests/v2/features/dora_metrics.feature b/tests/v2/features/dora_metrics.feature index d0dc8943ad..a8249df9a7 100644 --- a/tests/v2/features/dora_metrics.feature +++ b/tests/v2/features/dora_metrics.feature @@ -148,6 +148,33 @@ 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 by version returns "Accepted" response + Given a valid "appKeyAuth" key in the system + And operation "PatchDORADeploymentByVersion" enabled + And new "PatchDORADeploymentByVersion" request + And body with value {"data": {"attributes": {"change_failure": true, "env": "production", "remediation": {"type": "rollback", "version": "v1.2.2"}, "service": "my-service", "version": "v1.2.3"}, "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 by version returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And operation "PatchDORADeploymentByVersion" enabled + And new "PatchDORADeploymentByVersion" request + And body with value {"data": {"attributes": {"change_failure": true, "env": "production", "remediation": {"type": "rollback", "version": "v1.2.2"}, "service": "my-service", "version": "v1.2.3"}, "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: Patch a deployment event by version with a missing version returns "Bad Request" response + Given a valid "appKeyAuth" key in the system + And operation "PatchDORADeploymentByVersion" enabled + And new "PatchDORADeploymentByVersion" request + And body with value {"data": {"attributes": {"change_failure": true, "env": "production", "service": "my-service"}, "type": "dora_deployment_patch_request"}} + When the request is sent + Then the response status is 400 Bad Request + @generated @skip @team:DataDog/ci-app-backend Scenario: Patch a deployment event returns "Accepted" response Given a valid "appKeyAuth" key in the system diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 1060e48a48..e9536c917b 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -2374,6 +2374,12 @@ "type": "idempotent" } }, + "PatchDORADeploymentByVersion": { + "tag": "DORA Metrics", + "undo": { + "type": "idempotent" + } + }, "ListDORADeployments": { "tag": "DORA Metrics", "undo": {