Skip to content

Commit d7f1f88

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add flexible status_name support for Case Management API (#3090)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent bea235d commit d7f1f88

File tree

9 files changed

+125
-12
lines changed

9 files changed

+125
-12
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9229,6 +9229,10 @@ components:
92299229
$ref: '#/components/schemas/ServiceNowTicket'
92309230
status:
92319231
$ref: '#/components/schemas/CaseStatus'
9232+
status_group:
9233+
$ref: '#/components/schemas/CaseStatusGroup'
9234+
status_name:
9235+
$ref: '#/components/schemas/CaseStatusName'
92329236
title:
92339237
description: Title
92349238
example: Memory leak investigation on API
@@ -9295,6 +9299,8 @@ components:
92959299
type: string
92969300
priority:
92979301
$ref: '#/components/schemas/CasePriority'
9302+
status_name:
9303+
$ref: '#/components/schemas/CaseStatusName'
92989304
title:
92999305
description: Title
93009306
example: Security breach investigation
@@ -9463,7 +9469,9 @@ components:
94639469
- PRIORITY
94649470
- STATUS
94659471
CaseStatus:
9466-
description: Case status
9472+
deprecated: true
9473+
description: Deprecated way of representing the case status, which only supports
9474+
OPEN, IN_PROGRESS, and CLOSED statuses. Use `status_name` instead.
94679475
enum:
94689476
- OPEN
94699477
- IN_PROGRESS
@@ -9474,6 +9482,23 @@ components:
94749482
- OPEN
94759483
- IN_PROGRESS
94769484
- CLOSED
9485+
CaseStatusGroup:
9486+
description: Status group of the case.
9487+
enum:
9488+
- SG_OPEN
9489+
- SG_IN_PROGRESS
9490+
- SG_CLOSED
9491+
example: SG_OPEN
9492+
type: string
9493+
x-enum-varnames:
9494+
- SG_OPEN
9495+
- SG_IN_PROGRESS
9496+
- SG_CLOSED
9497+
CaseStatusName:
9498+
description: Status of the case. Must be one of the existing statuses for the
9499+
case's type.
9500+
example: Open
9501+
type: string
94779502
CaseTrigger:
94789503
description: Trigger a workflow from a Case. For automatic triggering a handle
94799504
must be configured and the workflow must be published.
@@ -9697,8 +9722,9 @@ components:
96979722
properties:
96989723
status:
96999724
$ref: '#/components/schemas/CaseStatus'
9700-
required:
9701-
- status
9725+
deprecated: true
9726+
status_name:
9727+
$ref: '#/components/schemas/CaseStatusName'
97029728
type: object
97039729
CaseUpdateStatusRequest:
97049730
description: Case update status request

docs/datadog_api_client.v2.model.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3063,6 +3063,13 @@ datadog\_api\_client.v2.model.case\_status module
30633063
:members:
30643064
:show-inheritance:
30653065

3066+
datadog\_api\_client.v2.model.case\_status\_group module
3067+
--------------------------------------------------------
3068+
3069+
.. automodule:: datadog_api_client.v2.model.case_status_group
3070+
:members:
3071+
:show-inheritance:
3072+
30663073
datadog\_api\_client.v2.model.case\_trigger module
30673074
--------------------------------------------------
30683075

src/datadog_api_client/v2/model/case_attributes.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from datadog_api_client.v2.model.case_priority import CasePriority
2323
from datadog_api_client.v2.model.service_now_ticket import ServiceNowTicket
2424
from datadog_api_client.v2.model.case_status import CaseStatus
25+
from datadog_api_client.v2.model.case_status_group import CaseStatusGroup
2526
from datadog_api_client.v2.model.case_type import CaseType
2627

2728

@@ -34,6 +35,7 @@ def openapi_types(_):
3435
from datadog_api_client.v2.model.case_priority import CasePriority
3536
from datadog_api_client.v2.model.service_now_ticket import ServiceNowTicket
3637
from datadog_api_client.v2.model.case_status import CaseStatus
38+
from datadog_api_client.v2.model.case_status_group import CaseStatusGroup
3739
from datadog_api_client.v2.model.case_type import CaseType
3840

3941
return {
@@ -49,6 +51,8 @@ def openapi_types(_):
4951
"priority": (CasePriority,),
5052
"service_now_ticket": (ServiceNowTicket,),
5153
"status": (CaseStatus,),
54+
"status_group": (CaseStatusGroup,),
55+
"status_name": (str,),
5256
"title": (str,),
5357
"type": (CaseType,),
5458
"type_id": (str,),
@@ -67,6 +71,8 @@ def openapi_types(_):
6771
"priority": "priority",
6872
"service_now_ticket": "service_now_ticket",
6973
"status": "status",
74+
"status_group": "status_group",
75+
"status_name": "status_name",
7076
"title": "title",
7177
"type": "type",
7278
"type_id": "type_id",
@@ -94,6 +100,8 @@ def __init__(
94100
priority: Union[CasePriority, UnsetType] = unset,
95101
service_now_ticket: Union[ServiceNowTicket, none_type, UnsetType] = unset,
96102
status: Union[CaseStatus, UnsetType] = unset,
103+
status_group: Union[CaseStatusGroup, UnsetType] = unset,
104+
status_name: Union[str, UnsetType] = unset,
97105
title: Union[str, UnsetType] = unset,
98106
type: Union[CaseType, UnsetType] = unset,
99107
type_id: Union[str, UnsetType] = unset,
@@ -135,9 +143,15 @@ def __init__(
135143
:param service_now_ticket: ServiceNow ticket attached to case
136144
:type service_now_ticket: ServiceNowTicket, none_type, optional
137145
138-
:param status: Case status
146+
:param status: Deprecated way of representing the case status, which only supports OPEN, IN_PROGRESS, and CLOSED statuses. Use ``status_name`` instead. **Deprecated**.
139147
:type status: CaseStatus, optional
140148
149+
:param status_group: Status group of the case.
150+
:type status_group: CaseStatusGroup, optional
151+
152+
:param status_name: Status of the case. Must be one of the existing statuses for the case's type.
153+
:type status_name: str, optional
154+
141155
:param title: Title
142156
:type title: str, optional
143157
@@ -171,6 +185,10 @@ def __init__(
171185
kwargs["service_now_ticket"] = service_now_ticket
172186
if status is not unset:
173187
kwargs["status"] = status
188+
if status_group is not unset:
189+
kwargs["status_group"] = status_group
190+
if status_name is not unset:
191+
kwargs["status_name"] = status_name
174192
if title is not unset:
175193
kwargs["title"] = title
176194
if type is not unset:

src/datadog_api_client/v2/model/case_create_attributes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def openapi_types(_):
2828
"custom_attributes": ({str: (CustomAttributeValue,)},),
2929
"description": (str,),
3030
"priority": (CasePriority,),
31+
"status_name": (str,),
3132
"title": (str,),
3233
"type_id": (str,),
3334
}
@@ -36,6 +37,7 @@ def openapi_types(_):
3637
"custom_attributes": "custom_attributes",
3738
"description": "description",
3839
"priority": "priority",
40+
"status_name": "status_name",
3941
"title": "title",
4042
"type_id": "type_id",
4143
}
@@ -47,6 +49,7 @@ def __init__(
4749
custom_attributes: Union[Dict[str, CustomAttributeValue], UnsetType] = unset,
4850
description: Union[str, UnsetType] = unset,
4951
priority: Union[CasePriority, UnsetType] = unset,
52+
status_name: Union[str, UnsetType] = unset,
5053
**kwargs,
5154
):
5255
"""
@@ -61,6 +64,9 @@ def __init__(
6164
:param priority: Case priority
6265
:type priority: CasePriority, optional
6366
67+
:param status_name: Status of the case. Must be one of the existing statuses for the case's type.
68+
:type status_name: str, optional
69+
6470
:param title: Title
6571
:type title: str
6672
@@ -73,6 +79,8 @@ def __init__(
7379
kwargs["description"] = description
7480
if priority is not unset:
7581
kwargs["priority"] = priority
82+
if status_name is not unset:
83+
kwargs["status_name"] = status_name
7684
super().__init__(kwargs)
7785

7886
self_.title = title

src/datadog_api_client/v2/model/case_status.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
class CaseStatus(ModelSimple):
1616
"""
17-
Case status
17+
Deprecated way of representing the case status, which only supports OPEN, IN_PROGRESS, and CLOSED statuses. Use `status_name` instead.
1818
1919
:param value: Must be one of ["OPEN", "IN_PROGRESS", "CLOSED"].
2020
:type value: str
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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 CaseStatusGroup(ModelSimple):
16+
"""
17+
Status group of the case.
18+
19+
:param value: Must be one of ["SG_OPEN", "SG_IN_PROGRESS", "SG_CLOSED"].
20+
:type value: str
21+
"""
22+
23+
allowed_values = {
24+
"SG_OPEN",
25+
"SG_IN_PROGRESS",
26+
"SG_CLOSED",
27+
}
28+
SG_OPEN: ClassVar["CaseStatusGroup"]
29+
SG_IN_PROGRESS: ClassVar["CaseStatusGroup"]
30+
SG_CLOSED: ClassVar["CaseStatusGroup"]
31+
32+
@cached_property
33+
def openapi_types(_):
34+
return {
35+
"value": (str,),
36+
}
37+
38+
39+
CaseStatusGroup.SG_OPEN = CaseStatusGroup("SG_OPEN")
40+
CaseStatusGroup.SG_IN_PROGRESS = CaseStatusGroup("SG_IN_PROGRESS")
41+
CaseStatusGroup.SG_CLOSED = CaseStatusGroup("SG_CLOSED")

src/datadog_api_client/v2/model/case_update_status_attributes.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
# Copyright 2019-Present Datadog, Inc.
44
from __future__ import annotations
55

6-
from typing import TYPE_CHECKING
6+
from typing import Union, TYPE_CHECKING
77

88
from datadog_api_client.model_utils import (
99
ModelNormal,
1010
cached_property,
11+
unset,
12+
UnsetType,
1113
)
1214

1315

@@ -22,19 +24,28 @@ def openapi_types(_):
2224

2325
return {
2426
"status": (CaseStatus,),
27+
"status_name": (str,),
2528
}
2629

2730
attribute_map = {
2831
"status": "status",
32+
"status_name": "status_name",
2933
}
3034

31-
def __init__(self_, status: CaseStatus, **kwargs):
35+
def __init__(
36+
self_, status: Union[CaseStatus, UnsetType] = unset, status_name: Union[str, UnsetType] = unset, **kwargs
37+
):
3238
"""
3339
Case update status attributes
3440
35-
:param status: Case status
36-
:type status: CaseStatus
41+
:param status: Deprecated way of representing the case status, which only supports OPEN, IN_PROGRESS, and CLOSED statuses. Use ``status_name`` instead. **Deprecated**.
42+
:type status: CaseStatus, optional
43+
44+
:param status_name: Status of the case. Must be one of the existing statuses for the case's type.
45+
:type status_name: str, optional
3746
"""
47+
if status is not unset:
48+
kwargs["status"] = status
49+
if status_name is not unset:
50+
kwargs["status_name"] = status_name
3851
super().__init__(kwargs)
39-
40-
self_.status = status

src/datadog_api_client/v2/model/issue_case_attributes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def __init__(
117117
:param priority: Case priority
118118
:type priority: CasePriority, optional
119119
120-
:param status: Case status
120+
:param status: Deprecated way of representing the case status, which only supports OPEN, IN_PROGRESS, and CLOSED statuses. Use ``status_name`` instead. **Deprecated**.
121121
:type status: CaseStatus, optional
122122
123123
:param title: Title of the case.

src/datadog_api_client/v2/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,7 @@
675675
from datadog_api_client.v2.model.case_response import CaseResponse
676676
from datadog_api_client.v2.model.case_sortable_field import CaseSortableField
677677
from datadog_api_client.v2.model.case_status import CaseStatus
678+
from datadog_api_client.v2.model.case_status_group import CaseStatusGroup
678679
from datadog_api_client.v2.model.case_trigger import CaseTrigger
679680
from datadog_api_client.v2.model.case_trigger_wrapper import CaseTriggerWrapper
680681
from datadog_api_client.v2.model.case_type import CaseType
@@ -6206,6 +6207,7 @@
62066207
"CaseResponse",
62076208
"CaseSortableField",
62086209
"CaseStatus",
6210+
"CaseStatusGroup",
62096211
"CaseTrigger",
62106212
"CaseTriggerWrapper",
62116213
"CaseType",

0 commit comments

Comments
 (0)