Skip to content

Commit 57b8768

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Refactor DORAEvent response definitions into DORADeployment and DORAIncident (#3038)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 3d77f00 commit 57b8768

13 files changed

Lines changed: 782 additions & 278 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 254 additions & 173 deletions
Large diffs are not rendered by default.

docs/datadog_api_client.v2.model.rst

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7214,6 +7214,27 @@ datadog\_api\_client.v2.model.domain\_allowlist\_type module
72147214
:members:
72157215
:show-inheritance:
72167216

7217+
datadog\_api\_client.v2.model.dora\_deployment\_fetch\_response module
7218+
----------------------------------------------------------------------
7219+
7220+
.. automodule:: datadog_api_client.v2.model.dora_deployment_fetch_response
7221+
:members:
7222+
:show-inheritance:
7223+
7224+
datadog\_api\_client.v2.model.dora\_deployment\_object module
7225+
-------------------------------------------------------------
7226+
7227+
.. automodule:: datadog_api_client.v2.model.dora_deployment_object
7228+
:members:
7229+
:show-inheritance:
7230+
7231+
datadog\_api\_client.v2.model.dora\_deployment\_object\_attributes module
7232+
-------------------------------------------------------------------------
7233+
7234+
.. automodule:: datadog_api_client.v2.model.dora_deployment_object_attributes
7235+
:members:
7236+
:show-inheritance:
7237+
72177238
datadog\_api\_client.v2.model.dora\_deployment\_request module
72187239
--------------------------------------------------------------
72197240

@@ -7256,10 +7277,17 @@ datadog\_api\_client.v2.model.dora\_deployment\_type module
72567277
:members:
72577278
:show-inheritance:
72587279

7259-
datadog\_api\_client.v2.model.dora\_event module
7260-
------------------------------------------------
7280+
datadog\_api\_client.v2.model.dora\_deployments\_list\_response module
7281+
----------------------------------------------------------------------
72617282

7262-
.. automodule:: datadog_api_client.v2.model.dora_event
7283+
.. automodule:: datadog_api_client.v2.model.dora_deployments_list_response
7284+
:members:
7285+
:show-inheritance:
7286+
7287+
datadog\_api\_client.v2.model.dora\_failure\_fetch\_response module
7288+
-------------------------------------------------------------------
7289+
7290+
.. automodule:: datadog_api_client.v2.model.dora_failure_fetch_response
72637291
:members:
72647292
:show-inheritance:
72657293

@@ -7305,10 +7333,10 @@ datadog\_api\_client.v2.model.dora\_failure\_type module
73057333
:members:
73067334
:show-inheritance:
73077335

7308-
datadog\_api\_client.v2.model.dora\_fetch\_response module
7309-
----------------------------------------------------------
7336+
datadog\_api\_client.v2.model.dora\_failures\_list\_response module
7337+
-------------------------------------------------------------------
73107338

7311-
.. automodule:: datadog_api_client.v2.model.dora_fetch_response
7339+
.. automodule:: datadog_api_client.v2.model.dora_failures_list_response
73127340
:members:
73137341
:show-inheritance:
73147342

@@ -7319,6 +7347,20 @@ datadog\_api\_client.v2.model.dora\_git\_info module
73197347
:members:
73207348
:show-inheritance:
73217349

7350+
datadog\_api\_client.v2.model.dora\_incident\_object module
7351+
-----------------------------------------------------------
7352+
7353+
.. automodule:: datadog_api_client.v2.model.dora_incident_object
7354+
:members:
7355+
:show-inheritance:
7356+
7357+
datadog\_api\_client.v2.model.dora\_incident\_object\_attributes module
7358+
-----------------------------------------------------------------------
7359+
7360+
.. automodule:: datadog_api_client.v2.model.dora_incident_object_attributes
7361+
:members:
7362+
:show-inheritance:
7363+
73227364
datadog\_api\_client.v2.model.dora\_list\_deployments\_request module
73237365
---------------------------------------------------------------------
73247366

@@ -7375,13 +7417,6 @@ datadog\_api\_client.v2.model.dora\_list\_failures\_request\_data\_type module
73757417
:members:
73767418
:show-inheritance:
73777419

7378-
datadog\_api\_client.v2.model.dora\_list\_response module
7379-
---------------------------------------------------------
7380-
7381-
.. automodule:: datadog_api_client.v2.model.dora_list_response
7382-
:members:
7383-
:show-inheritance:
7384-
73857420
datadog\_api\_client.v2.model.downtime\_create\_request module
73867421
--------------------------------------------------------------
73877422

src/datadog_api_client/v2/api/dora_metrics_api.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
from datadog_api_client.configuration import Configuration
1111
from datadog_api_client.v2.model.dora_deployment_response import DORADeploymentResponse
1212
from datadog_api_client.v2.model.dora_deployment_request import DORADeploymentRequest
13-
from datadog_api_client.v2.model.dora_list_response import DORAListResponse
13+
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
15-
from datadog_api_client.v2.model.dora_fetch_response import DORAFetchResponse
15+
from datadog_api_client.v2.model.dora_deployment_fetch_response import DORADeploymentFetchResponse
1616
from datadog_api_client.v2.model.dora_failure_response import DORAFailureResponse
1717
from datadog_api_client.v2.model.dora_failure_request import DORAFailureRequest
18+
from datadog_api_client.v2.model.dora_failures_list_response import DORAFailuresListResponse
1819
from datadog_api_client.v2.model.dora_list_failures_request import DORAListFailuresRequest
20+
from datadog_api_client.v2.model.dora_failure_fetch_response import DORAFailureFetchResponse
1921

2022

2123
class DORAMetricsApi:
@@ -138,7 +140,7 @@ def __init__(self, api_client=None):
138140

139141
self._get_dora_deployment_endpoint = _Endpoint(
140142
settings={
141-
"response_type": (DORAFetchResponse,),
143+
"response_type": (DORADeploymentFetchResponse,),
142144
"auth": ["apiKeyAuth", "appKeyAuth"],
143145
"endpoint_path": "/api/v2/dora/deployments/{deployment_id}",
144146
"operation_id": "get_dora_deployment",
@@ -161,7 +163,7 @@ def __init__(self, api_client=None):
161163

162164
self._get_dora_failure_endpoint = _Endpoint(
163165
settings={
164-
"response_type": (DORAFetchResponse,),
166+
"response_type": (DORAFailureFetchResponse,),
165167
"auth": ["apiKeyAuth", "appKeyAuth"],
166168
"endpoint_path": "/api/v2/dora/failures/{failure_id}",
167169
"operation_id": "get_dora_failure",
@@ -184,7 +186,7 @@ def __init__(self, api_client=None):
184186

185187
self._list_dora_deployments_endpoint = _Endpoint(
186188
settings={
187-
"response_type": (DORAListResponse,),
189+
"response_type": (DORADeploymentsListResponse,),
188190
"auth": ["apiKeyAuth", "appKeyAuth"],
189191
"endpoint_path": "/api/v2/dora/deployments",
190192
"operation_id": "list_dora_deployments",
@@ -204,7 +206,7 @@ def __init__(self, api_client=None):
204206

205207
self._list_dora_failures_endpoint = _Endpoint(
206208
settings={
207-
"response_type": (DORAListResponse,),
209+
"response_type": (DORAFailuresListResponse,),
208210
"auth": ["apiKeyAuth", "appKeyAuth"],
209211
"endpoint_path": "/api/v2/dora/failures",
210212
"operation_id": "list_dora_failures",
@@ -326,14 +328,14 @@ def delete_dora_failure(
326328
def get_dora_deployment(
327329
self,
328330
deployment_id: str,
329-
) -> DORAFetchResponse:
331+
) -> DORADeploymentFetchResponse:
330332
"""Get a deployment event.
331333
332334
Use this API endpoint to get a deployment event.
333335
334336
:param deployment_id: The ID of the deployment event.
335337
:type deployment_id: str
336-
:rtype: DORAFetchResponse
338+
:rtype: DORADeploymentFetchResponse
337339
"""
338340
kwargs: Dict[str, Any] = {}
339341
kwargs["deployment_id"] = deployment_id
@@ -343,14 +345,14 @@ def get_dora_deployment(
343345
def get_dora_failure(
344346
self,
345347
failure_id: str,
346-
) -> DORAFetchResponse:
348+
) -> DORAFailureFetchResponse:
347349
"""Get a failure event.
348350
349351
Use this API endpoint to get a failure event.
350352
351353
:param failure_id: The ID of the failure event.
352354
:type failure_id: str
353-
:rtype: DORAFetchResponse
355+
:rtype: DORAFailureFetchResponse
354356
"""
355357
kwargs: Dict[str, Any] = {}
356358
kwargs["failure_id"] = failure_id
@@ -360,13 +362,13 @@ def get_dora_failure(
360362
def list_dora_deployments(
361363
self,
362364
body: DORAListDeploymentsRequest,
363-
) -> DORAListResponse:
365+
) -> DORADeploymentsListResponse:
364366
"""Get a list of deployment events.
365367
366368
Use this API endpoint to get a list of deployment events.
367369
368370
:type body: DORAListDeploymentsRequest
369-
:rtype: DORAListResponse
371+
:rtype: DORADeploymentsListResponse
370372
"""
371373
kwargs: Dict[str, Any] = {}
372374
kwargs["body"] = body
@@ -376,13 +378,13 @@ def list_dora_deployments(
376378
def list_dora_failures(
377379
self,
378380
body: DORAListFailuresRequest,
379-
) -> DORAListResponse:
381+
) -> DORAFailuresListResponse:
380382
"""Get a list of failure events.
381383
382384
Use this API endpoint to get a list of failure events.
383385
384386
:type body: DORAListFailuresRequest
385-
:rtype: DORAListResponse
387+
:rtype: DORAFailuresListResponse
386388
"""
387389
kwargs: Dict[str, Any] = {}
388390
kwargs["body"] = body
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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 Union, TYPE_CHECKING
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
unset,
12+
UnsetType,
13+
)
14+
15+
16+
if TYPE_CHECKING:
17+
from datadog_api_client.v2.model.dora_deployment_object import DORADeploymentObject
18+
19+
20+
class DORADeploymentFetchResponse(ModelNormal):
21+
@cached_property
22+
def openapi_types(_):
23+
from datadog_api_client.v2.model.dora_deployment_object import DORADeploymentObject
24+
25+
return {
26+
"data": (DORADeploymentObject,),
27+
}
28+
29+
attribute_map = {
30+
"data": "data",
31+
}
32+
33+
def __init__(self_, data: Union[DORADeploymentObject, UnsetType] = unset, **kwargs):
34+
"""
35+
Response for fetching a single deployment event.
36+
37+
:param data: A DORA deployment event.
38+
:type data: DORADeploymentObject, optional
39+
"""
40+
if data is not unset:
41+
kwargs["data"] = data
42+
super().__init__(kwargs)
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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 Union, TYPE_CHECKING
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
unset,
12+
UnsetType,
13+
)
14+
15+
16+
if TYPE_CHECKING:
17+
from datadog_api_client.v2.model.dora_deployment_object_attributes import DORADeploymentObjectAttributes
18+
from datadog_api_client.v2.model.dora_deployment_type import DORADeploymentType
19+
20+
21+
class DORADeploymentObject(ModelNormal):
22+
@cached_property
23+
def openapi_types(_):
24+
from datadog_api_client.v2.model.dora_deployment_object_attributes import DORADeploymentObjectAttributes
25+
from datadog_api_client.v2.model.dora_deployment_type import DORADeploymentType
26+
27+
return {
28+
"attributes": (DORADeploymentObjectAttributes,),
29+
"id": (str,),
30+
"type": (DORADeploymentType,),
31+
}
32+
33+
attribute_map = {
34+
"attributes": "attributes",
35+
"id": "id",
36+
"type": "type",
37+
}
38+
39+
def __init__(
40+
self_,
41+
attributes: Union[DORADeploymentObjectAttributes, UnsetType] = unset,
42+
id: Union[str, UnsetType] = unset,
43+
type: Union[DORADeploymentType, UnsetType] = unset,
44+
**kwargs,
45+
):
46+
"""
47+
A DORA deployment event.
48+
49+
:param attributes: The attributes of the deployment event.
50+
:type attributes: DORADeploymentObjectAttributes, optional
51+
52+
:param id: The ID of the deployment event.
53+
:type id: str, optional
54+
55+
:param type: JSON:API type for DORA deployment events.
56+
:type type: DORADeploymentType, optional
57+
"""
58+
if attributes is not unset:
59+
kwargs["attributes"] = attributes
60+
if id is not unset:
61+
kwargs["id"] = id
62+
if type is not unset:
63+
kwargs["type"] = type
64+
super().__init__(kwargs)

0 commit comments

Comments
 (0)