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
42 changes: 42 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------------------------------------------------------

Expand Down
33 changes: 33 additions & 0 deletions examples/v2/dora-metrics/PatchDORADeployment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""
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)
response = api_instance.patch_dora_deployment(deployment_id="deployment_id", body=body)

print(response)
48 changes: 48 additions & 0 deletions src/datadog_api_client/v2/api/dora_metrics_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -224,6 +225,32 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._patch_dora_deployment_endpoint = _Endpoint(
settings={
"response_type": (DORADeploymentFetchResponse,),
"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": ["application/json"], "content_type": ["application/json"]},
api_client=api_client,
)

def create_dora_deployment(
self,
body: DORADeploymentRequest,
Expand Down Expand Up @@ -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,
) -> DORADeploymentFetchResponse:
"""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: DORADeploymentFetchResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["deployment_id"] = deployment_id

kwargs["body"] = body

return self._patch_dora_deployment_endpoint.call_with_http_info(**kwargs)
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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")
Loading
Loading