Skip to content

Commit c01378b

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

8 files changed

Lines changed: 108 additions & 29 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

lib/datadog_api_client/inflector.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,7 @@ def overrides
14171417
"v2.cases_response_meta" => "CasesResponseMeta",
14181418
"v2.cases_response_meta_pagination" => "CasesResponseMetaPagination",
14191419
"v2.case_status" => "CaseStatus",
1420+
"v2.case_status_group" => "CaseStatusGroup",
14201421
"v2.case_trigger" => "CaseTrigger",
14211422
"v2.case_trigger_wrapper" => "CaseTriggerWrapper",
14221423
"v2.case_type" => "CaseType",

lib/datadog_api_client/v2/models/case_attributes.rb

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,15 @@ class CaseAttributes
5454
# ServiceNow ticket attached to case
5555
attr_accessor :service_now_ticket
5656

57-
# Case status
57+
# Deprecated way of representing the case status, which only supports OPEN, IN_PROGRESS, and CLOSED statuses. Use `status_name` instead.
5858
attr_accessor :status
5959

60+
# Status group of the case.
61+
attr_accessor :status_group
62+
63+
# Status of the case. Must be one of the existing statuses for the case's type.
64+
attr_accessor :status_name
65+
6066
# Title
6167
attr_accessor :title
6268

@@ -84,6 +90,8 @@ def self.attribute_map
8490
:'priority' => :'priority',
8591
:'service_now_ticket' => :'service_now_ticket',
8692
:'status' => :'status',
93+
:'status_group' => :'status_group',
94+
:'status_name' => :'status_name',
8795
:'title' => :'title',
8896
:'type' => :'type',
8997
:'type_id' => :'type_id'
@@ -106,6 +114,8 @@ def self.openapi_types
106114
:'priority' => :'CasePriority',
107115
:'service_now_ticket' => :'ServiceNowTicket',
108116
:'status' => :'CaseStatus',
117+
:'status_group' => :'CaseStatusGroup',
118+
:'status_name' => :'String',
109119
:'title' => :'String',
110120
:'type' => :'CaseType',
111121
:'type_id' => :'String'
@@ -190,6 +200,14 @@ def initialize(attributes = {})
190200
self.status = attributes[:'status']
191201
end
192202

203+
if attributes.key?(:'status_group')
204+
self.status_group = attributes[:'status_group']
205+
end
206+
207+
if attributes.key?(:'status_name')
208+
self.status_name = attributes[:'status_name']
209+
end
210+
193211
if attributes.key?(:'title')
194212
self.title = attributes[:'title']
195213
end
@@ -241,6 +259,8 @@ def ==(o)
241259
priority == o.priority &&
242260
service_now_ticket == o.service_now_ticket &&
243261
status == o.status &&
262+
status_group == o.status_group &&
263+
status_name == o.status_name &&
244264
title == o.title &&
245265
type == o.type &&
246266
type_id == o.type_id &&
@@ -251,7 +271,7 @@ def ==(o)
251271
# @return [Integer] Hash code
252272
# @!visibility private
253273
def hash
254-
[archived_at, attributes, closed_at, created_at, custom_attributes, description, jira_issue, key, modified_at, priority, service_now_ticket, status, title, type, type_id, additional_properties].hash
274+
[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, additional_properties].hash
255275
end
256276
end
257277
end

lib/datadog_api_client/v2/models/case_create_attributes.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ class CaseCreateAttributes
3030
# Case priority
3131
attr_accessor :priority
3232

33+
# Status of the case. Must be one of the existing statuses for the case's type.
34+
attr_accessor :status_name
35+
3336
# Title
3437
attr_reader :title
3538

@@ -45,6 +48,7 @@ def self.attribute_map
4548
:'custom_attributes' => :'custom_attributes',
4649
:'description' => :'description',
4750
:'priority' => :'priority',
51+
:'status_name' => :'status_name',
4852
:'title' => :'title',
4953
:'type_id' => :'type_id'
5054
}
@@ -57,6 +61,7 @@ def self.openapi_types
5761
:'custom_attributes' => :'Hash<String, CustomAttributeValue>',
5862
:'description' => :'String',
5963
:'priority' => :'CasePriority',
64+
:'status_name' => :'String',
6065
:'title' => :'String',
6166
:'type_id' => :'String'
6267
}
@@ -92,6 +97,10 @@ def initialize(attributes = {})
9297
self.priority = attributes[:'priority']
9398
end
9499

100+
if attributes.key?(:'status_name')
101+
self.status_name = attributes[:'status_name']
102+
end
103+
95104
if attributes.key?(:'title')
96105
self.title = attributes[:'title']
97106
end
@@ -159,6 +168,7 @@ def ==(o)
159168
custom_attributes == o.custom_attributes &&
160169
description == o.description &&
161170
priority == o.priority &&
171+
status_name == o.status_name &&
162172
title == o.title &&
163173
type_id == o.type_id &&
164174
additional_properties == o.additional_properties
@@ -168,7 +178,7 @@ def ==(o)
168178
# @return [Integer] Hash code
169179
# @!visibility private
170180
def hash
171-
[custom_attributes, description, priority, title, type_id, additional_properties].hash
181+
[custom_attributes, description, priority, status_name, title, type_id, additional_properties].hash
172182
end
173183
end
174184
end

lib/datadog_api_client/v2/models/case_status.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
require 'time'
1818

1919
module DatadogAPIClient::V2
20-
# Case status
20+
# Deprecated way of representing the case status, which only supports OPEN, IN_PROGRESS, and CLOSED statuses. Use `status_name` instead.
21+
#
22+
# @deprecated This model is deprecated.
2123
class CaseStatus
2224
include BaseEnumModel
2325

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
=begin
2+
#Datadog API V2 Collection
3+
4+
#Collection of all Datadog Public endpoints.
5+
6+
The version of the OpenAPI document: 1.0
7+
Contact: support@datadoghq.com
8+
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
9+
10+
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
11+
This product includes software developed at Datadog (https://www.datadoghq.com/).
12+
Copyright 2020-Present Datadog, Inc.
13+
14+
=end
15+
16+
require 'date'
17+
require 'time'
18+
19+
module DatadogAPIClient::V2
20+
# Status group of the case.
21+
class CaseStatusGroup
22+
include BaseEnumModel
23+
24+
SG_OPEN = "SG_OPEN".freeze
25+
SG_IN_PROGRESS = "SG_IN_PROGRESS".freeze
26+
SG_CLOSED = "SG_CLOSED".freeze
27+
end
28+
end

lib/datadog_api_client/v2/models/case_update_status_attributes.rb

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,29 @@ module DatadogAPIClient::V2
2121
class CaseUpdateStatusAttributes
2222
include BaseGenericModel
2323

24-
# Case status
25-
attr_reader :status
24+
# Deprecated way of representing the case status, which only supports OPEN, IN_PROGRESS, and CLOSED statuses. Use `status_name` instead.
25+
attr_accessor :status
26+
27+
# Status of the case. Must be one of the existing statuses for the case's type.
28+
attr_accessor :status_name
2629

2730
attr_accessor :additional_properties
2831

2932
# Attribute mapping from ruby-style variable name to JSON key.
3033
# @!visibility private
3134
def self.attribute_map
3235
{
33-
:'status' => :'status'
36+
:'status' => :'status',
37+
:'status_name' => :'status_name'
3438
}
3539
end
3640

3741
# Attribute type mapping.
3842
# @!visibility private
3943
def self.openapi_types
4044
{
41-
:'status' => :'CaseStatus'
45+
:'status' => :'CaseStatus',
46+
:'status_name' => :'String'
4247
}
4348
end
4449

@@ -63,24 +68,10 @@ def initialize(attributes = {})
6368
if attributes.key?(:'status')
6469
self.status = attributes[:'status']
6570
end
66-
end
67-
68-
# Check to see if the all the properties in the model are valid
69-
# @return true if the model is valid
70-
# @!visibility private
71-
def valid?
72-
return false if @status.nil?
73-
true
74-
end
7571

76-
# Custom attribute writer method with validation
77-
# @param status [Object] Object to be assigned
78-
# @!visibility private
79-
def status=(status)
80-
if status.nil?
81-
fail ArgumentError, 'invalid value for "status", status cannot be nil.'
72+
if attributes.key?(:'status_name')
73+
self.status_name = attributes[:'status_name']
8274
end
83-
@status = status
8475
end
8576

8677
# Returns the object in the form of hash, with additionalProperties support.
@@ -110,14 +101,15 @@ def ==(o)
110101
return true if self.equal?(o)
111102
self.class == o.class &&
112103
status == o.status &&
104+
status_name == o.status_name &&
113105
additional_properties == o.additional_properties
114106
end
115107

116108
# Calculates hash code according to all attributes.
117109
# @return [Integer] Hash code
118110
# @!visibility private
119111
def hash
120-
[status, additional_properties].hash
112+
[status, status_name, additional_properties].hash
121113
end
122114
end
123115
end

lib/datadog_api_client/v2/models/issue_case_attributes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class IssueCaseAttributes
5454
# Case priority
5555
attr_accessor :priority
5656

57-
# Case status
57+
# Deprecated way of representing the case status, which only supports OPEN, IN_PROGRESS, and CLOSED statuses. Use `status_name` instead.
5858
attr_accessor :status
5959

6060
# Title of the case.

0 commit comments

Comments
 (0)