Skip to content

Commit ed9d94e

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

8 files changed

Lines changed: 282 additions & 31 deletions

File tree

.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

api/datadogV2/model_case_attributes.go

Lines changed: 80 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,13 @@ type CaseAttributes struct {
3434
Priority *CasePriority `json:"priority,omitempty"`
3535
// ServiceNow ticket attached to case
3636
ServiceNowTicket NullableServiceNowTicket `json:"service_now_ticket,omitempty"`
37-
// Case status
37+
// Deprecated way of representing the case status, which only supports OPEN, IN_PROGRESS, and CLOSED statuses. Use `status_name` instead.
38+
// Deprecated
3839
Status *CaseStatus `json:"status,omitempty"`
40+
// Status group of the case.
41+
StatusGroup *CaseStatusGroup `json:"status_group,omitempty"`
42+
// Status of the case. Must be one of the existing statuses for the case's type.
43+
StatusName *string `json:"status_name,omitempty"`
3944
// Title
4045
Title *string `json:"title,omitempty"`
4146
// Case type
@@ -433,6 +438,7 @@ func (o *CaseAttributes) UnsetServiceNowTicket() {
433438
}
434439

435440
// GetStatus returns the Status field value if set, zero value otherwise.
441+
// Deprecated
436442
func (o *CaseAttributes) GetStatus() CaseStatus {
437443
if o == nil || o.Status == nil {
438444
var ret CaseStatus
@@ -443,6 +449,7 @@ func (o *CaseAttributes) GetStatus() CaseStatus {
443449

444450
// GetStatusOk returns a tuple with the Status field value if set, nil otherwise
445451
// and a boolean to check if the value has been set.
452+
// Deprecated
446453
func (o *CaseAttributes) GetStatusOk() (*CaseStatus, bool) {
447454
if o == nil || o.Status == nil {
448455
return nil, false
@@ -456,10 +463,67 @@ func (o *CaseAttributes) HasStatus() bool {
456463
}
457464

458465
// SetStatus gets a reference to the given CaseStatus and assigns it to the Status field.
466+
// Deprecated
459467
func (o *CaseAttributes) SetStatus(v CaseStatus) {
460468
o.Status = &v
461469
}
462470

471+
// GetStatusGroup returns the StatusGroup field value if set, zero value otherwise.
472+
func (o *CaseAttributes) GetStatusGroup() CaseStatusGroup {
473+
if o == nil || o.StatusGroup == nil {
474+
var ret CaseStatusGroup
475+
return ret
476+
}
477+
return *o.StatusGroup
478+
}
479+
480+
// GetStatusGroupOk returns a tuple with the StatusGroup field value if set, nil otherwise
481+
// and a boolean to check if the value has been set.
482+
func (o *CaseAttributes) GetStatusGroupOk() (*CaseStatusGroup, bool) {
483+
if o == nil || o.StatusGroup == nil {
484+
return nil, false
485+
}
486+
return o.StatusGroup, true
487+
}
488+
489+
// HasStatusGroup returns a boolean if a field has been set.
490+
func (o *CaseAttributes) HasStatusGroup() bool {
491+
return o != nil && o.StatusGroup != nil
492+
}
493+
494+
// SetStatusGroup gets a reference to the given CaseStatusGroup and assigns it to the StatusGroup field.
495+
func (o *CaseAttributes) SetStatusGroup(v CaseStatusGroup) {
496+
o.StatusGroup = &v
497+
}
498+
499+
// GetStatusName returns the StatusName field value if set, zero value otherwise.
500+
func (o *CaseAttributes) GetStatusName() string {
501+
if o == nil || o.StatusName == nil {
502+
var ret string
503+
return ret
504+
}
505+
return *o.StatusName
506+
}
507+
508+
// GetStatusNameOk returns a tuple with the StatusName field value if set, nil otherwise
509+
// and a boolean to check if the value has been set.
510+
func (o *CaseAttributes) GetStatusNameOk() (*string, bool) {
511+
if o == nil || o.StatusName == nil {
512+
return nil, false
513+
}
514+
return o.StatusName, true
515+
}
516+
517+
// HasStatusName returns a boolean if a field has been set.
518+
func (o *CaseAttributes) HasStatusName() bool {
519+
return o != nil && o.StatusName != nil
520+
}
521+
522+
// SetStatusName gets a reference to the given string and assigns it to the StatusName field.
523+
func (o *CaseAttributes) SetStatusName(v string) {
524+
o.StatusName = &v
525+
}
526+
463527
// GetTitle returns the Title field value if set, zero value otherwise.
464528
func (o *CaseAttributes) GetTitle() string {
465529
if o == nil || o.Title == nil {
@@ -593,6 +657,12 @@ func (o CaseAttributes) MarshalJSON() ([]byte, error) {
593657
if o.Status != nil {
594658
toSerialize["status"] = o.Status
595659
}
660+
if o.StatusGroup != nil {
661+
toSerialize["status_group"] = o.StatusGroup
662+
}
663+
if o.StatusName != nil {
664+
toSerialize["status_name"] = o.StatusName
665+
}
596666
if o.Title != nil {
597667
toSerialize["title"] = o.Title
598668
}
@@ -624,6 +694,8 @@ func (o *CaseAttributes) UnmarshalJSON(bytes []byte) (err error) {
624694
Priority *CasePriority `json:"priority,omitempty"`
625695
ServiceNowTicket NullableServiceNowTicket `json:"service_now_ticket,omitempty"`
626696
Status *CaseStatus `json:"status,omitempty"`
697+
StatusGroup *CaseStatusGroup `json:"status_group,omitempty"`
698+
StatusName *string `json:"status_name,omitempty"`
627699
Title *string `json:"title,omitempty"`
628700
Type *CaseType `json:"type,omitempty"`
629701
TypeId *string `json:"type_id,omitempty"`
@@ -633,7 +705,7 @@ func (o *CaseAttributes) UnmarshalJSON(bytes []byte) (err error) {
633705
}
634706
additionalProperties := make(map[string]interface{})
635707
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
636-
datadog.DeleteKeys(additionalProperties, &[]string{"archived_at", "attributes", "closed_at", "created_at", "custom_attributes", "description", "jira_issue", "key", "modified_at", "priority", "service_now_ticket", "status", "title", "type", "type_id"})
708+
datadog.DeleteKeys(additionalProperties, &[]string{"archived_at", "attributes", "closed_at", "created_at", "custom_attributes", "description", "jira_issue", "key", "modified_at", "priority", "service_now_ticket", "status", "status_group", "status_name", "title", "type", "type_id"})
637709
} else {
638710
return err
639711
}
@@ -659,6 +731,12 @@ func (o *CaseAttributes) UnmarshalJSON(bytes []byte) (err error) {
659731
} else {
660732
o.Status = all.Status
661733
}
734+
if all.StatusGroup != nil && !all.StatusGroup.IsValid() {
735+
hasInvalidField = true
736+
} else {
737+
o.StatusGroup = all.StatusGroup
738+
}
739+
o.StatusName = all.StatusName
662740
o.Title = all.Title
663741
if all.Type != nil && !all.Type.IsValid() {
664742
hasInvalidField = true

api/datadogV2/model_case_create_attributes.go

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ type CaseCreateAttributes struct {
1818
Description *string `json:"description,omitempty"`
1919
// Case priority
2020
Priority *CasePriority `json:"priority,omitempty"`
21+
// Status of the case. Must be one of the existing statuses for the case's type.
22+
StatusName *string `json:"status_name,omitempty"`
2123
// Title
2224
Title string `json:"title"`
2325
// Case type UUID
@@ -134,6 +136,34 @@ func (o *CaseCreateAttributes) SetPriority(v CasePriority) {
134136
o.Priority = &v
135137
}
136138

139+
// GetStatusName returns the StatusName field value if set, zero value otherwise.
140+
func (o *CaseCreateAttributes) GetStatusName() string {
141+
if o == nil || o.StatusName == nil {
142+
var ret string
143+
return ret
144+
}
145+
return *o.StatusName
146+
}
147+
148+
// GetStatusNameOk returns a tuple with the StatusName field value if set, nil otherwise
149+
// and a boolean to check if the value has been set.
150+
func (o *CaseCreateAttributes) GetStatusNameOk() (*string, bool) {
151+
if o == nil || o.StatusName == nil {
152+
return nil, false
153+
}
154+
return o.StatusName, true
155+
}
156+
157+
// HasStatusName returns a boolean if a field has been set.
158+
func (o *CaseCreateAttributes) HasStatusName() bool {
159+
return o != nil && o.StatusName != nil
160+
}
161+
162+
// SetStatusName gets a reference to the given string and assigns it to the StatusName field.
163+
func (o *CaseCreateAttributes) SetStatusName(v string) {
164+
o.StatusName = &v
165+
}
166+
137167
// GetTitle returns the Title field value.
138168
func (o *CaseCreateAttributes) GetTitle() string {
139169
if o == nil {
@@ -195,6 +225,9 @@ func (o CaseCreateAttributes) MarshalJSON() ([]byte, error) {
195225
if o.Priority != nil {
196226
toSerialize["priority"] = o.Priority
197227
}
228+
if o.StatusName != nil {
229+
toSerialize["status_name"] = o.StatusName
230+
}
198231
toSerialize["title"] = o.Title
199232
toSerialize["type_id"] = o.TypeId
200233

@@ -210,6 +243,7 @@ func (o *CaseCreateAttributes) UnmarshalJSON(bytes []byte) (err error) {
210243
CustomAttributes map[string]CustomAttributeValue `json:"custom_attributes,omitempty"`
211244
Description *string `json:"description,omitempty"`
212245
Priority *CasePriority `json:"priority,omitempty"`
246+
StatusName *string `json:"status_name,omitempty"`
213247
Title *string `json:"title"`
214248
TypeId *string `json:"type_id"`
215249
}{}
@@ -224,7 +258,7 @@ func (o *CaseCreateAttributes) UnmarshalJSON(bytes []byte) (err error) {
224258
}
225259
additionalProperties := make(map[string]interface{})
226260
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
227-
datadog.DeleteKeys(additionalProperties, &[]string{"custom_attributes", "description", "priority", "title", "type_id"})
261+
datadog.DeleteKeys(additionalProperties, &[]string{"custom_attributes", "description", "priority", "status_name", "title", "type_id"})
228262
} else {
229263
return err
230264
}
@@ -237,6 +271,7 @@ func (o *CaseCreateAttributes) UnmarshalJSON(bytes []byte) (err error) {
237271
} else {
238272
o.Priority = all.Priority
239273
}
274+
o.StatusName = all.StatusName
240275
o.Title = *all.Title
241276
o.TypeId = *all.TypeId
242277

api/datadogV2/model_case_status.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
1111
)
1212

13-
// CaseStatus Case status
13+
// CaseStatus Deprecated way of representing the case status, which only supports OPEN, IN_PROGRESS, and CLOSED statuses. Use `status_name` instead.
1414
type CaseStatus string
1515

1616
// List of CaseStatus.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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+
5+
package datadogV2
6+
7+
import (
8+
"fmt"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
)
12+
13+
// CaseStatusGroup Status group of the case.
14+
type CaseStatusGroup string
15+
16+
// List of CaseStatusGroup.
17+
const (
18+
CASESTATUSGROUP_SG_OPEN CaseStatusGroup = "SG_OPEN"
19+
CASESTATUSGROUP_SG_IN_PROGRESS CaseStatusGroup = "SG_IN_PROGRESS"
20+
CASESTATUSGROUP_SG_CLOSED CaseStatusGroup = "SG_CLOSED"
21+
)
22+
23+
var allowedCaseStatusGroupEnumValues = []CaseStatusGroup{
24+
CASESTATUSGROUP_SG_OPEN,
25+
CASESTATUSGROUP_SG_IN_PROGRESS,
26+
CASESTATUSGROUP_SG_CLOSED,
27+
}
28+
29+
// GetAllowedValues reeturns the list of possible values.
30+
func (v *CaseStatusGroup) GetAllowedValues() []CaseStatusGroup {
31+
return allowedCaseStatusGroupEnumValues
32+
}
33+
34+
// UnmarshalJSON deserializes the given payload.
35+
func (v *CaseStatusGroup) UnmarshalJSON(src []byte) error {
36+
var value string
37+
err := datadog.Unmarshal(src, &value)
38+
if err != nil {
39+
return err
40+
}
41+
*v = CaseStatusGroup(value)
42+
return nil
43+
}
44+
45+
// NewCaseStatusGroupFromValue returns a pointer to a valid CaseStatusGroup
46+
// for the value passed as argument, or an error if the value passed is not allowed by the enum.
47+
func NewCaseStatusGroupFromValue(v string) (*CaseStatusGroup, error) {
48+
ev := CaseStatusGroup(v)
49+
if ev.IsValid() {
50+
return &ev, nil
51+
}
52+
return nil, fmt.Errorf("invalid value '%v' for CaseStatusGroup: valid values are %v", v, allowedCaseStatusGroupEnumValues)
53+
}
54+
55+
// IsValid return true if the value is valid for the enum, false otherwise.
56+
func (v CaseStatusGroup) IsValid() bool {
57+
for _, existing := range allowedCaseStatusGroupEnumValues {
58+
if existing == v {
59+
return true
60+
}
61+
}
62+
return false
63+
}
64+
65+
// Ptr returns reference to CaseStatusGroup value.
66+
func (v CaseStatusGroup) Ptr() *CaseStatusGroup {
67+
return &v
68+
}

0 commit comments

Comments
 (0)