Skip to content

Commit dd208a1

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add OpenAPI spec for incident user-defined fields config endpoints (#3142)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent fc2323e commit dd208a1

30 files changed

+4258
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 863 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Create an incident user-defined field returns "CREATED" response
2+
3+
require "datadog_api_client"
4+
DatadogAPIClient.configure do |config|
5+
config.unstable_operations["v2.create_incident_user_defined_field".to_sym] = true
6+
end
7+
api_instance = DatadogAPIClient::V2::IncidentsAPI.new
8+
9+
body = DatadogAPIClient::V2::IncidentUserDefinedFieldCreateRequest.new({
10+
data: DatadogAPIClient::V2::IncidentUserDefinedFieldCreateData.new({
11+
attributes: DatadogAPIClient::V2::IncidentUserDefinedFieldAttributesCreateRequest.new({
12+
category: DatadogAPIClient::V2::IncidentUserDefinedFieldCategory::WHAT_HAPPENED,
13+
collected: DatadogAPIClient::V2::IncidentUserDefinedFieldCollected::ACTIVE,
14+
default_value: "critical",
15+
display_name: "Root Cause",
16+
name: "root_cause",
17+
ordinal: "1.5",
18+
required: false,
19+
tag_key: "datacenter",
20+
type: DatadogAPIClient::V2::IncidentUserDefinedFieldFieldType::TEXTBOX,
21+
valid_values: [
22+
DatadogAPIClient::V2::IncidentUserDefinedFieldValidValue.new({
23+
description: "A critical severity incident.",
24+
display_name: "Critical",
25+
short_description: "Critical",
26+
value: "critical",
27+
}),
28+
],
29+
}),
30+
relationships: DatadogAPIClient::V2::IncidentUserDefinedFieldCreateRelationships.new({
31+
incident_type: DatadogAPIClient::V2::RelationshipToIncidentType.new({
32+
data: DatadogAPIClient::V2::RelationshipToIncidentTypeData.new({
33+
id: "00000000-0000-0000-0000-000000000000",
34+
type: DatadogAPIClient::V2::IncidentTypeType::INCIDENT_TYPES,
35+
}),
36+
}),
37+
}),
38+
type: DatadogAPIClient::V2::IncidentUserDefinedFieldType::USER_DEFINED_FIELD,
39+
}),
40+
})
41+
p api_instance.create_incident_user_defined_field(body)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Delete an incident user-defined field returns "No Content" response
2+
3+
require "datadog_api_client"
4+
DatadogAPIClient.configure do |config|
5+
config.unstable_operations["v2.delete_incident_user_defined_field".to_sym] = true
6+
end
7+
api_instance = DatadogAPIClient::V2::IncidentsAPI.new
8+
api_instance.delete_incident_user_defined_field("00000000-0000-0000-0000-000000000000")
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Get an incident user-defined field returns "OK" response
2+
3+
require "datadog_api_client"
4+
DatadogAPIClient.configure do |config|
5+
config.unstable_operations["v2.get_incident_user_defined_field".to_sym] = true
6+
end
7+
api_instance = DatadogAPIClient::V2::IncidentsAPI.new
8+
p api_instance.get_incident_user_defined_field("00000000-0000-0000-0000-000000000000")
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Get a list of incident user-defined fields returns "OK" response
2+
3+
require "datadog_api_client"
4+
DatadogAPIClient.configure do |config|
5+
config.unstable_operations["v2.list_incident_user_defined_fields".to_sym] = true
6+
end
7+
api_instance = DatadogAPIClient::V2::IncidentsAPI.new
8+
p api_instance.list_incident_user_defined_fields()
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Update an incident user-defined field returns "OK" response
2+
3+
require "datadog_api_client"
4+
DatadogAPIClient.configure do |config|
5+
config.unstable_operations["v2.update_incident_user_defined_field".to_sym] = true
6+
end
7+
api_instance = DatadogAPIClient::V2::IncidentsAPI.new
8+
9+
body = DatadogAPIClient::V2::IncidentUserDefinedFieldUpdateRequest.new({
10+
data: DatadogAPIClient::V2::IncidentUserDefinedFieldUpdateData.new({
11+
attributes: DatadogAPIClient::V2::IncidentUserDefinedFieldAttributesUpdateRequest.new({
12+
category: DatadogAPIClient::V2::IncidentUserDefinedFieldCategory::WHAT_HAPPENED,
13+
collected: DatadogAPIClient::V2::IncidentUserDefinedFieldCollected::ACTIVE,
14+
default_value: "critical",
15+
display_name: "Root Cause",
16+
ordinal: "1.5",
17+
required: false,
18+
valid_values: [
19+
DatadogAPIClient::V2::IncidentUserDefinedFieldValidValue.new({
20+
description: "A critical severity incident.",
21+
display_name: "Critical",
22+
short_description: "Critical",
23+
value: "critical",
24+
}),
25+
],
26+
}),
27+
id: "00000000-0000-0000-0000-000000000000",
28+
type: DatadogAPIClient::V2::IncidentUserDefinedFieldType::USER_DEFINED_FIELD,
29+
}),
30+
})
31+
p api_instance.update_incident_user_defined_field("00000000-0000-0000-0000-000000000000", body)

features/scenarios_model_mapping.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2327,6 +2327,29 @@
23272327
"incident_type_id" => "String",
23282328
"body" => "IncidentTypePatchRequest",
23292329
},
2330+
"v2.ListIncidentUserDefinedFields" => {
2331+
"page_size" => "Integer",
2332+
"page_number" => "Integer",
2333+
"include_deleted" => "Boolean",
2334+
"filter_incident_type" => "String",
2335+
"include" => "String",
2336+
},
2337+
"v2.CreateIncidentUserDefinedField" => {
2338+
"include" => "String",
2339+
"body" => "IncidentUserDefinedFieldCreateRequest",
2340+
},
2341+
"v2.DeleteIncidentUserDefinedField" => {
2342+
"field_id" => "String",
2343+
},
2344+
"v2.GetIncidentUserDefinedField" => {
2345+
"field_id" => "String",
2346+
"include" => "String",
2347+
},
2348+
"v2.UpdateIncidentUserDefinedField" => {
2349+
"field_id" => "String",
2350+
"include" => "String",
2351+
"body" => "IncidentUserDefinedFieldUpdateRequest",
2352+
},
23302353
"v2.ImportIncident" => {
23312354
"include" => "Array<IncidentImportRelatedObject>",
23322355
"body" => "IncidentImportRequest",

features/v2/incidents.feature

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,30 @@ Feature: Incidents
186186
When the request is sent
187187
Then the response status is 404 Not Found
188188

189+
@generated @skip @team:DataDog/incident-app
190+
Scenario: Create an incident user-defined field returns "Bad Request" response
191+
Given operation "CreateIncidentUserDefinedField" enabled
192+
And new "CreateIncidentUserDefinedField" request
193+
And body with value {"data": {"attributes": {"category": "what_happened", "collected": "active", "default_value": "critical", "display_name": "Root Cause", "name": "root_cause", "ordinal": "1.5", "required": false, "tag_key": "datacenter", "type": 3, "valid_values": [{"description": "A critical severity incident.", "display_name": "Critical", "short_description": "Critical", "value": "critical"}]}, "relationships": {"incident_type": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}}}, "type": "user_defined_field"}}
194+
When the request is sent
195+
Then the response status is 400 Bad Request
196+
197+
@generated @skip @team:DataDog/incident-app
198+
Scenario: Create an incident user-defined field returns "CREATED" response
199+
Given operation "CreateIncidentUserDefinedField" enabled
200+
And new "CreateIncidentUserDefinedField" request
201+
And body with value {"data": {"attributes": {"category": "what_happened", "collected": "active", "default_value": "critical", "display_name": "Root Cause", "name": "root_cause", "ordinal": "1.5", "required": false, "tag_key": "datacenter", "type": 3, "valid_values": [{"description": "A critical severity incident.", "display_name": "Critical", "short_description": "Critical", "value": "critical"}]}, "relationships": {"incident_type": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}}}, "type": "user_defined_field"}}
202+
When the request is sent
203+
Then the response status is 201 CREATED
204+
205+
@generated @skip @team:DataDog/incident-app
206+
Scenario: Create an incident user-defined field returns "Not Found" response
207+
Given operation "CreateIncidentUserDefinedField" enabled
208+
And new "CreateIncidentUserDefinedField" request
209+
And body with value {"data": {"attributes": {"category": "what_happened", "collected": "active", "default_value": "critical", "display_name": "Root Cause", "name": "root_cause", "ordinal": "1.5", "required": false, "tag_key": "datacenter", "type": 3, "valid_values": [{"description": "A critical severity incident.", "display_name": "Critical", "short_description": "Critical", "value": "critical"}]}, "relationships": {"incident_type": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}}}, "type": "user_defined_field"}}
210+
When the request is sent
211+
Then the response status is 404 Not Found
212+
189213
@generated @skip @team:DataDog/incident-app
190214
Scenario: Create global incident handle returns "Bad Request" response
191215
Given operation "CreateGlobalIncidentHandle" enabled
@@ -482,6 +506,30 @@ Feature: Incidents
482506
When the request is sent
483507
Then the response status is 204 OK
484508

509+
@generated @skip @team:DataDog/incident-app
510+
Scenario: Delete an incident user-defined field returns "Bad Request" response
511+
Given operation "DeleteIncidentUserDefinedField" enabled
512+
And new "DeleteIncidentUserDefinedField" request
513+
And request contains "field_id" parameter from "REPLACE.ME"
514+
When the request is sent
515+
Then the response status is 400 Bad Request
516+
517+
@generated @skip @team:DataDog/incident-app
518+
Scenario: Delete an incident user-defined field returns "No Content" response
519+
Given operation "DeleteIncidentUserDefinedField" enabled
520+
And new "DeleteIncidentUserDefinedField" request
521+
And request contains "field_id" parameter from "REPLACE.ME"
522+
When the request is sent
523+
Then the response status is 204 No Content
524+
525+
@generated @skip @team:DataDog/incident-app
526+
Scenario: Delete an incident user-defined field returns "Not Found" response
527+
Given operation "DeleteIncidentUserDefinedField" enabled
528+
And new "DeleteIncidentUserDefinedField" request
529+
And request contains "field_id" parameter from "REPLACE.ME"
530+
When the request is sent
531+
Then the response status is 404 Not Found
532+
485533
@generated @skip @team:DataDog/incident-app
486534
Scenario: Delete global incident handle returns "Bad Request" response
487535
Given operation "DeleteGlobalIncidentHandle" enabled
@@ -647,6 +695,20 @@ Feature: Incidents
647695
When the request is sent
648696
Then the response status is 200 OK
649697

698+
@generated @skip @team:DataDog/incident-app
699+
Scenario: Get a list of incident user-defined fields returns "Bad Request" response
700+
Given operation "ListIncidentUserDefinedFields" enabled
701+
And new "ListIncidentUserDefinedFields" request
702+
When the request is sent
703+
Then the response status is 400 Bad Request
704+
705+
@generated @skip @team:DataDog/incident-app
706+
Scenario: Get a list of incident user-defined fields returns "OK" response
707+
Given operation "ListIncidentUserDefinedFields" enabled
708+
And new "ListIncidentUserDefinedFields" request
709+
When the request is sent
710+
Then the response status is 200 OK
711+
650712
@generated @skip @team:DataDog/incident-app
651713
Scenario: Get a list of incidents returns "Bad Request" response
652714
Given operation "ListIncidents" enabled
@@ -703,6 +765,22 @@ Feature: Incidents
703765
When the request is sent
704766
Then the response status is 200 OK
705767

768+
@generated @skip @team:DataDog/incident-app
769+
Scenario: Get an incident user-defined field returns "Not Found" response
770+
Given operation "GetIncidentUserDefinedField" enabled
771+
And new "GetIncidentUserDefinedField" request
772+
And request contains "field_id" parameter from "REPLACE.ME"
773+
When the request is sent
774+
Then the response status is 404 Not Found
775+
776+
@generated @skip @team:DataDog/incident-app
777+
Scenario: Get an incident user-defined field returns "OK" response
778+
Given operation "GetIncidentUserDefinedField" enabled
779+
And new "GetIncidentUserDefinedField" request
780+
And request contains "field_id" parameter from "REPLACE.ME"
781+
When the request is sent
782+
Then the response status is 200 OK
783+
706784
@generated @skip @team:DataDog/incident-app
707785
Scenario: Get global incident settings returns "Bad Request" response
708786
Given operation "GetGlobalIncidentSettings" enabled
@@ -1243,6 +1321,33 @@ Feature: Incidents
12431321
When the request is sent
12441322
Then the response status is 200 OK
12451323

1324+
@generated @skip @team:DataDog/incident-app
1325+
Scenario: Update an incident user-defined field returns "Bad Request" response
1326+
Given operation "UpdateIncidentUserDefinedField" enabled
1327+
And new "UpdateIncidentUserDefinedField" request
1328+
And request contains "field_id" parameter from "REPLACE.ME"
1329+
And body with value {"data": {"attributes": {"category": "what_happened", "collected": "active", "default_value": "critical", "display_name": "Root Cause", "ordinal": "1.5", "required": false, "valid_values": [{"description": "A critical severity incident.", "display_name": "Critical", "short_description": "Critical", "value": "critical"}]}, "id": "00000000-0000-0000-0000-000000000000", "type": "user_defined_field"}}
1330+
When the request is sent
1331+
Then the response status is 400 Bad Request
1332+
1333+
@generated @skip @team:DataDog/incident-app
1334+
Scenario: Update an incident user-defined field returns "Not Found" response
1335+
Given operation "UpdateIncidentUserDefinedField" enabled
1336+
And new "UpdateIncidentUserDefinedField" request
1337+
And request contains "field_id" parameter from "REPLACE.ME"
1338+
And body with value {"data": {"attributes": {"category": "what_happened", "collected": "active", "default_value": "critical", "display_name": "Root Cause", "ordinal": "1.5", "required": false, "valid_values": [{"description": "A critical severity incident.", "display_name": "Critical", "short_description": "Critical", "value": "critical"}]}, "id": "00000000-0000-0000-0000-000000000000", "type": "user_defined_field"}}
1339+
When the request is sent
1340+
Then the response status is 404 Not Found
1341+
1342+
@generated @skip @team:DataDog/incident-app
1343+
Scenario: Update an incident user-defined field returns "OK" response
1344+
Given operation "UpdateIncidentUserDefinedField" enabled
1345+
And new "UpdateIncidentUserDefinedField" request
1346+
And request contains "field_id" parameter from "REPLACE.ME"
1347+
And body with value {"data": {"attributes": {"category": "what_happened", "collected": "active", "default_value": "critical", "display_name": "Root Cause", "ordinal": "1.5", "required": false, "valid_values": [{"description": "A critical severity incident.", "display_name": "Critical", "short_description": "Critical", "value": "critical"}]}, "id": "00000000-0000-0000-0000-000000000000", "type": "user_defined_field"}}
1348+
When the request is sent
1349+
Then the response status is 200 OK
1350+
12461351
@generated @skip @team:DataDog/incident-app
12471352
Scenario: Update global incident handle returns "Bad Request" response
12481353
Given operation "UpdateGlobalIncidentHandle" enabled

features/v2/undo.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2110,6 +2110,43 @@
21102110
"type": "idempotent"
21112111
}
21122112
},
2113+
"ListIncidentUserDefinedFields": {
2114+
"tag": "Incidents",
2115+
"undo": {
2116+
"type": "safe"
2117+
}
2118+
},
2119+
"CreateIncidentUserDefinedField": {
2120+
"tag": "Incidents",
2121+
"undo": {
2122+
"operationId": "DeleteIncidentUserDefinedField",
2123+
"parameters": [
2124+
{
2125+
"name": "field_id",
2126+
"source": "data.id"
2127+
}
2128+
],
2129+
"type": "unsafe"
2130+
}
2131+
},
2132+
"DeleteIncidentUserDefinedField": {
2133+
"tag": "Incidents",
2134+
"undo": {
2135+
"type": "idempotent"
2136+
}
2137+
},
2138+
"GetIncidentUserDefinedField": {
2139+
"tag": "Incidents",
2140+
"undo": {
2141+
"type": "safe"
2142+
}
2143+
},
2144+
"UpdateIncidentUserDefinedField": {
2145+
"tag": "Incidents",
2146+
"undo": {
2147+
"type": "idempotent"
2148+
}
2149+
},
21132150
"ImportIncident": {
21142151
"tag": "Incidents",
21152152
"undo": {

lib/datadog_api_client/configuration.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ def initialize
286286
"v2.create_incident_postmortem_template": false,
287287
"v2.create_incident_todo": false,
288288
"v2.create_incident_type": false,
289+
"v2.create_incident_user_defined_field": false,
289290
"v2.delete_global_incident_handle": false,
290291
"v2.delete_incident": false,
291292
"v2.delete_incident_attachment": false,
@@ -295,6 +296,7 @@ def initialize
295296
"v2.delete_incident_postmortem_template": false,
296297
"v2.delete_incident_todo": false,
297298
"v2.delete_incident_type": false,
299+
"v2.delete_incident_user_defined_field": false,
298300
"v2.get_global_incident_settings": false,
299301
"v2.get_incident": false,
300302
"v2.get_incident_integration": false,
@@ -303,6 +305,7 @@ def initialize
303305
"v2.get_incident_postmortem_template": false,
304306
"v2.get_incident_todo": false,
305307
"v2.get_incident_type": false,
308+
"v2.get_incident_user_defined_field": false,
306309
"v2.import_incident": false,
307310
"v2.list_global_incident_handles": false,
308311
"v2.list_incident_attachments": false,
@@ -313,6 +316,7 @@ def initialize
313316
"v2.list_incidents": false,
314317
"v2.list_incident_todos": false,
315318
"v2.list_incident_types": false,
319+
"v2.list_incident_user_defined_fields": false,
316320
"v2.search_incidents": false,
317321
"v2.update_global_incident_handle": false,
318322
"v2.update_global_incident_settings": false,
@@ -324,6 +328,7 @@ def initialize
324328
"v2.update_incident_postmortem_template": false,
325329
"v2.update_incident_todo": false,
326330
"v2.update_incident_type": false,
331+
"v2.update_incident_user_defined_field": false,
327332
"v2.create_aws_account_ccm_config": false,
328333
"v2.delete_aws_account_ccm_config": false,
329334
"v2.get_aws_account_ccm_config": false,

0 commit comments

Comments
 (0)