Skip to content

Commit c3ec7f0

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

31 files changed

+3593
-13
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 863 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* Create an incident user-defined field returns "CREATED" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.createIncidentUserDefinedField"] = true;
9+
const apiInstance = new v2.IncidentsApi(configuration);
10+
11+
const params: v2.IncidentsApiCreateIncidentUserDefinedFieldRequest = {
12+
body: {
13+
data: {
14+
attributes: {
15+
category: "what_happened",
16+
collected: "active",
17+
defaultValue: "critical",
18+
displayName: "Root Cause",
19+
name: "root_cause",
20+
ordinal: "1.5",
21+
required: false,
22+
tagKey: "datacenter",
23+
type: 3,
24+
validValues: [
25+
{
26+
description: "A critical severity incident.",
27+
displayName: "Critical",
28+
shortDescription: "Critical",
29+
value: "critical",
30+
},
31+
],
32+
},
33+
relationships: {
34+
incidentType: {
35+
data: {
36+
id: "00000000-0000-0000-0000-000000000000",
37+
type: "incident_types",
38+
},
39+
},
40+
},
41+
type: "user_defined_field",
42+
},
43+
},
44+
};
45+
46+
apiInstance
47+
.createIncidentUserDefinedField(params)
48+
.then((data: v2.IncidentUserDefinedFieldResponse) => {
49+
console.log(
50+
"API called successfully. Returned data: " + JSON.stringify(data)
51+
);
52+
})
53+
.catch((error: any) => console.error(error));
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Delete an incident user-defined field returns "No Content" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.deleteIncidentUserDefinedField"] = true;
9+
const apiInstance = new v2.IncidentsApi(configuration);
10+
11+
const params: v2.IncidentsApiDeleteIncidentUserDefinedFieldRequest = {
12+
fieldId: "00000000-0000-0000-0000-000000000000",
13+
};
14+
15+
apiInstance
16+
.deleteIncidentUserDefinedField(params)
17+
.then((data: any) => {
18+
console.log(
19+
"API called successfully. Returned data: " + JSON.stringify(data)
20+
);
21+
})
22+
.catch((error: any) => console.error(error));
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Get an incident user-defined field returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.getIncidentUserDefinedField"] = true;
9+
const apiInstance = new v2.IncidentsApi(configuration);
10+
11+
const params: v2.IncidentsApiGetIncidentUserDefinedFieldRequest = {
12+
fieldId: "00000000-0000-0000-0000-000000000000",
13+
};
14+
15+
apiInstance
16+
.getIncidentUserDefinedField(params)
17+
.then((data: v2.IncidentUserDefinedFieldResponse) => {
18+
console.log(
19+
"API called successfully. Returned data: " + JSON.stringify(data)
20+
);
21+
})
22+
.catch((error: any) => console.error(error));
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* Get a list of incident user-defined fields returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.listIncidentUserDefinedFields"] = true;
9+
const apiInstance = new v2.IncidentsApi(configuration);
10+
11+
apiInstance
12+
.listIncidentUserDefinedFields()
13+
.then((data: v2.IncidentUserDefinedFieldListResponse) => {
14+
console.log(
15+
"API called successfully. Returned data: " + JSON.stringify(data)
16+
);
17+
})
18+
.catch((error: any) => console.error(error));
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* Update an incident user-defined field returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.updateIncidentUserDefinedField"] = true;
9+
const apiInstance = new v2.IncidentsApi(configuration);
10+
11+
const params: v2.IncidentsApiUpdateIncidentUserDefinedFieldRequest = {
12+
body: {
13+
data: {
14+
attributes: {
15+
category: "what_happened",
16+
collected: "active",
17+
defaultValue: "critical",
18+
displayName: "Root Cause",
19+
ordinal: "1.5",
20+
required: false,
21+
validValues: [
22+
{
23+
description: "A critical severity incident.",
24+
displayName: "Critical",
25+
shortDescription: "Critical",
26+
value: "critical",
27+
},
28+
],
29+
},
30+
id: "00000000-0000-0000-0000-000000000000",
31+
type: "user_defined_field",
32+
},
33+
},
34+
fieldId: "00000000-0000-0000-0000-000000000000",
35+
};
36+
37+
apiInstance
38+
.updateIncidentUserDefinedField(params)
39+
.then((data: v2.IncidentUserDefinedFieldResponse) => {
40+
console.log(
41+
"API called successfully. Returned data: " + JSON.stringify(data)
42+
);
43+
})
44+
.catch((error: any) => console.error(error));

features/support/scenarios_model_mapping.ts

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6580,6 +6580,73 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
65806580
},
65816581
"operationResponseType": "IncidentTypeResponse",
65826582
},
6583+
"v2.ListIncidentUserDefinedFields": {
6584+
"pageSize": {
6585+
"type": "number",
6586+
"format": "int64",
6587+
},
6588+
"pageNumber": {
6589+
"type": "number",
6590+
"format": "int64",
6591+
},
6592+
"includeDeleted": {
6593+
"type": "boolean",
6594+
"format": "",
6595+
},
6596+
"filterIncidentType": {
6597+
"type": "string",
6598+
"format": "",
6599+
},
6600+
"include": {
6601+
"type": "string",
6602+
"format": "",
6603+
},
6604+
"operationResponseType": "IncidentUserDefinedFieldListResponse",
6605+
},
6606+
"v2.CreateIncidentUserDefinedField": {
6607+
"include": {
6608+
"type": "string",
6609+
"format": "",
6610+
},
6611+
"body": {
6612+
"type": "IncidentUserDefinedFieldCreateRequest",
6613+
"format": "",
6614+
},
6615+
"operationResponseType": "IncidentUserDefinedFieldResponse",
6616+
},
6617+
"v2.GetIncidentUserDefinedField": {
6618+
"fieldId": {
6619+
"type": "string",
6620+
"format": "",
6621+
},
6622+
"include": {
6623+
"type": "string",
6624+
"format": "",
6625+
},
6626+
"operationResponseType": "IncidentUserDefinedFieldResponse",
6627+
},
6628+
"v2.DeleteIncidentUserDefinedField": {
6629+
"fieldId": {
6630+
"type": "string",
6631+
"format": "",
6632+
},
6633+
"operationResponseType": "{}",
6634+
},
6635+
"v2.UpdateIncidentUserDefinedField": {
6636+
"fieldId": {
6637+
"type": "string",
6638+
"format": "",
6639+
},
6640+
"include": {
6641+
"type": "string",
6642+
"format": "",
6643+
},
6644+
"body": {
6645+
"type": "IncidentUserDefinedFieldUpdateRequest",
6646+
"format": "",
6647+
},
6648+
"operationResponseType": "IncidentUserDefinedFieldResponse",
6649+
},
65836650
"v2.ImportIncident": {
65846651
"include": {
65856652
"type": "Array<IncidentImportRelatedObject>",

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

0 commit comments

Comments
 (0)