Skip to content

Commit b398bfc

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add OpenAPI spec for Change Management endpoints (#3502)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 3778ca2 commit b398bfc

File tree

55 files changed

+4916
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+4916
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 901 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
@endpoint(change-management) @endpoint(change-management-v2)
2+
Feature: Change Management
3+
View and manage change requests within Change Management. See the [Case
4+
Management
5+
page](https://docs.datadoghq.com/service_management/case_management/) for
6+
more information.
7+
8+
Background:
9+
Given a valid "apiKeyAuth" key in the system
10+
And a valid "appKeyAuth" key in the system
11+
And an instance of "ChangeManagement" API
12+
13+
@generated @skip @team:DataDog/case-management
14+
Scenario: Create a change request branch returns "Bad Request" response
15+
Given operation "CreateChangeRequestBranch" enabled
16+
And new "CreateChangeRequestBranch" request
17+
And request contains "change_request_id" parameter from "REPLACE.ME"
18+
And body with value {"data": {"attributes": {"branch_name": "chm/CHM-1234", "repo_id": "DataDog/dd-source"}, "type": "change_request_branch"}}
19+
When the request is sent
20+
Then the response status is 400 Bad Request
21+
22+
@generated @skip @team:DataDog/case-management
23+
Scenario: Create a change request branch returns "Not Found" response
24+
Given operation "CreateChangeRequestBranch" enabled
25+
And new "CreateChangeRequestBranch" request
26+
And request contains "change_request_id" parameter from "REPLACE.ME"
27+
And body with value {"data": {"attributes": {"branch_name": "chm/CHM-1234", "repo_id": "DataDog/dd-source"}, "type": "change_request_branch"}}
28+
When the request is sent
29+
Then the response status is 404 Not Found
30+
31+
@generated @skip @team:DataDog/case-management
32+
Scenario: Create a change request branch returns "OK" response
33+
Given operation "CreateChangeRequestBranch" enabled
34+
And new "CreateChangeRequestBranch" request
35+
And request contains "change_request_id" parameter from "REPLACE.ME"
36+
And body with value {"data": {"attributes": {"branch_name": "chm/CHM-1234", "repo_id": "DataDog/dd-source"}, "type": "change_request_branch"}}
37+
When the request is sent
38+
Then the response status is 200 OK
39+
40+
@generated @skip @team:DataDog/case-management
41+
Scenario: Create a change request returns "Bad Request" response
42+
Given operation "CreateChangeRequest" enabled
43+
And new "CreateChangeRequest" request
44+
And body with value {"data": {"attributes": {"change_request_linked_incident_uuid": "00000000-0000-0000-0000-000000000000", "change_request_maintenance_window_query": "", "change_request_plan": "1. Deploy to staging 2. Run tests 3. Deploy to production", "change_request_risk": "LOW", "change_request_type": "NORMAL", "description": "Deploying new payment service v2.1", "end_date": "2024-01-02T15:00:00Z", "project_id": "d4bbe1af-f36e-42f1-87c1-493ca35c320e", "requested_teams": ["team-handle-1"], "start_date": "2024-01-01T03:00:00Z", "title": "Deploy new payment service"}, "type": "change_request"}}
45+
When the request is sent
46+
Then the response status is 400 Bad Request
47+
48+
@generated @skip @team:DataDog/case-management
49+
Scenario: Create a change request returns "Created" response
50+
Given operation "CreateChangeRequest" enabled
51+
And new "CreateChangeRequest" request
52+
And body with value {"data": {"attributes": {"change_request_linked_incident_uuid": "00000000-0000-0000-0000-000000000000", "change_request_maintenance_window_query": "", "change_request_plan": "1. Deploy to staging 2. Run tests 3. Deploy to production", "change_request_risk": "LOW", "change_request_type": "NORMAL", "description": "Deploying new payment service v2.1", "end_date": "2024-01-02T15:00:00Z", "project_id": "d4bbe1af-f36e-42f1-87c1-493ca35c320e", "requested_teams": ["team-handle-1"], "start_date": "2024-01-01T03:00:00Z", "title": "Deploy new payment service"}, "type": "change_request"}}
53+
When the request is sent
54+
Then the response status is 201 Created
55+
56+
@generated @skip @team:DataDog/case-management
57+
Scenario: Delete a change request decision returns "Bad Request" response
58+
Given operation "DeleteChangeRequestDecision" enabled
59+
And new "DeleteChangeRequestDecision" request
60+
And request contains "change_request_id" parameter from "REPLACE.ME"
61+
And request contains "decision_id" parameter from "REPLACE.ME"
62+
When the request is sent
63+
Then the response status is 400 Bad Request
64+
65+
@generated @skip @team:DataDog/case-management
66+
Scenario: Delete a change request decision returns "Not Found" response
67+
Given operation "DeleteChangeRequestDecision" enabled
68+
And new "DeleteChangeRequestDecision" request
69+
And request contains "change_request_id" parameter from "REPLACE.ME"
70+
And request contains "decision_id" parameter from "REPLACE.ME"
71+
When the request is sent
72+
Then the response status is 404 Not Found
73+
74+
@generated @skip @team:DataDog/case-management
75+
Scenario: Delete a change request decision returns "OK" response
76+
Given operation "DeleteChangeRequestDecision" enabled
77+
And new "DeleteChangeRequestDecision" request
78+
And request contains "change_request_id" parameter from "REPLACE.ME"
79+
And request contains "decision_id" parameter from "REPLACE.ME"
80+
When the request is sent
81+
Then the response status is 200 OK
82+
83+
@generated @skip @team:DataDog/case-management
84+
Scenario: Get a change request returns "Bad Request" response
85+
Given operation "GetChangeRequest" enabled
86+
And new "GetChangeRequest" request
87+
And request contains "change_request_id" parameter from "REPLACE.ME"
88+
When the request is sent
89+
Then the response status is 400 Bad Request
90+
91+
@generated @skip @team:DataDog/case-management
92+
Scenario: Get a change request returns "Not Found" response
93+
Given operation "GetChangeRequest" enabled
94+
And new "GetChangeRequest" request
95+
And request contains "change_request_id" parameter from "REPLACE.ME"
96+
When the request is sent
97+
Then the response status is 404 Not Found
98+
99+
@generated @skip @team:DataDog/case-management
100+
Scenario: Get a change request returns "OK" response
101+
Given operation "GetChangeRequest" enabled
102+
And new "GetChangeRequest" request
103+
And request contains "change_request_id" parameter from "REPLACE.ME"
104+
When the request is sent
105+
Then the response status is 200 OK
106+
107+
@generated @skip @team:DataDog/case-management
108+
Scenario: Update a change request decision returns "Bad Request" response
109+
Given operation "UpdateChangeRequestDecision" enabled
110+
And new "UpdateChangeRequestDecision" request
111+
And request contains "change_request_id" parameter from "REPLACE.ME"
112+
And request contains "decision_id" parameter from "REPLACE.ME"
113+
And body with value {"data": {"attributes": {"id": "CHM-1234"}, "relationships": {"change_request_decisions": {"data": [{"id": "decision-id-0", "type": "change_request_decision"}]}}, "type": "change_request"}, "included": [{"attributes": {"change_request_status": "REQUESTED", "request_reason": "Please review and approve this change"}, "id": "decision-id-0", "relationships": {"requested_user": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "user"}}}, "type": "change_request_decision"}]}
114+
When the request is sent
115+
Then the response status is 400 Bad Request
116+
117+
@generated @skip @team:DataDog/case-management
118+
Scenario: Update a change request decision returns "Not Found" response
119+
Given operation "UpdateChangeRequestDecision" enabled
120+
And new "UpdateChangeRequestDecision" request
121+
And request contains "change_request_id" parameter from "REPLACE.ME"
122+
And request contains "decision_id" parameter from "REPLACE.ME"
123+
And body with value {"data": {"attributes": {"id": "CHM-1234"}, "relationships": {"change_request_decisions": {"data": [{"id": "decision-id-0", "type": "change_request_decision"}]}}, "type": "change_request"}, "included": [{"attributes": {"change_request_status": "REQUESTED", "request_reason": "Please review and approve this change"}, "id": "decision-id-0", "relationships": {"requested_user": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "user"}}}, "type": "change_request_decision"}]}
124+
When the request is sent
125+
Then the response status is 404 Not Found
126+
127+
@generated @skip @team:DataDog/case-management
128+
Scenario: Update a change request decision returns "OK" response
129+
Given operation "UpdateChangeRequestDecision" enabled
130+
And new "UpdateChangeRequestDecision" request
131+
And request contains "change_request_id" parameter from "REPLACE.ME"
132+
And request contains "decision_id" parameter from "REPLACE.ME"
133+
And body with value {"data": {"attributes": {"id": "CHM-1234"}, "relationships": {"change_request_decisions": {"data": [{"id": "decision-id-0", "type": "change_request_decision"}]}}, "type": "change_request"}, "included": [{"attributes": {"change_request_status": "REQUESTED", "request_reason": "Please review and approve this change"}, "id": "decision-id-0", "relationships": {"requested_user": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "user"}}}, "type": "change_request_decision"}]}
134+
When the request is sent
135+
Then the response status is 200 OK
136+
137+
@generated @skip @team:DataDog/case-management
138+
Scenario: Update a change request returns "Bad Request" response
139+
Given operation "UpdateChangeRequest" enabled
140+
And new "UpdateChangeRequest" request
141+
And request contains "change_request_id" parameter from "REPLACE.ME"
142+
And body with value {"data": {"attributes": {"change_request_plan": "Updated deployment plan", "change_request_risk": "LOW", "change_request_type": "NORMAL", "end_date": "2024-01-02T15:00:00Z", "id": "CHM-1234", "start_date": "2024-01-01T03:00:00Z"}, "relationships": {"change_request_decisions": {"data": [{"id": "decision-id-0", "type": "change_request_decision"}]}}, "type": "change_request"}, "included": [{"attributes": {"change_request_status": "REQUESTED", "request_reason": "Please review and approve this change"}, "id": "decision-id-0", "relationships": {"requested_user": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "user"}}}, "type": "change_request_decision"}]}
143+
When the request is sent
144+
Then the response status is 400 Bad Request
145+
146+
@generated @skip @team:DataDog/case-management
147+
Scenario: Update a change request returns "Not Found" response
148+
Given operation "UpdateChangeRequest" enabled
149+
And new "UpdateChangeRequest" request
150+
And request contains "change_request_id" parameter from "REPLACE.ME"
151+
And body with value {"data": {"attributes": {"change_request_plan": "Updated deployment plan", "change_request_risk": "LOW", "change_request_type": "NORMAL", "end_date": "2024-01-02T15:00:00Z", "id": "CHM-1234", "start_date": "2024-01-01T03:00:00Z"}, "relationships": {"change_request_decisions": {"data": [{"id": "decision-id-0", "type": "change_request_decision"}]}}, "type": "change_request"}, "included": [{"attributes": {"change_request_status": "REQUESTED", "request_reason": "Please review and approve this change"}, "id": "decision-id-0", "relationships": {"requested_user": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "user"}}}, "type": "change_request_decision"}]}
152+
When the request is sent
153+
Then the response status is 404 Not Found
154+
155+
@generated @skip @team:DataDog/case-management
156+
Scenario: Update a change request returns "OK" response
157+
Given operation "UpdateChangeRequest" enabled
158+
And new "UpdateChangeRequest" request
159+
And request contains "change_request_id" parameter from "REPLACE.ME"
160+
And body with value {"data": {"attributes": {"change_request_plan": "Updated deployment plan", "change_request_risk": "LOW", "change_request_type": "NORMAL", "end_date": "2024-01-02T15:00:00Z", "id": "CHM-1234", "start_date": "2024-01-01T03:00:00Z"}, "relationships": {"change_request_decisions": {"data": [{"id": "decision-id-0", "type": "change_request_decision"}]}}, "type": "change_request"}, "included": [{"attributes": {"change_request_status": "REQUESTED", "request_reason": "Please review and approve this change"}, "id": "decision-id-0", "relationships": {"requested_user": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "user"}}}, "type": "change_request_decision"}]}
161+
When the request is sent
162+
Then the response status is 200 OK

features/v2/undo.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,46 @@
972972
"type": "safe"
973973
}
974974
},
975+
"CreateChangeRequest": {
976+
"tag": "Change Management",
977+
"undo": {
978+
"operationId": "TODO",
979+
"parameters": [],
980+
"type": "unsafe"
981+
}
982+
},
983+
"GetChangeRequest": {
984+
"tag": "Change Management",
985+
"undo": {
986+
"type": "safe"
987+
}
988+
},
989+
"UpdateChangeRequest": {
990+
"tag": "Change Management",
991+
"undo": {
992+
"type": "idempotent"
993+
}
994+
},
995+
"CreateChangeRequestBranch": {
996+
"tag": "Change Management",
997+
"undo": {
998+
"operationId": "TODO",
999+
"parameters": [],
1000+
"type": "unsafe"
1001+
}
1002+
},
1003+
"DeleteChangeRequestDecision": {
1004+
"tag": "Change Management",
1005+
"undo": {
1006+
"type": "idempotent"
1007+
}
1008+
},
1009+
"UpdateChangeRequestDecision": {
1010+
"tag": "Change Management",
1011+
"undo": {
1012+
"type": "idempotent"
1013+
}
1014+
},
9751015
"CreateCIAppPipelineEvent": {
9761016
"tag": "CI Visibility Pipelines",
9771017
"undo": {

packages/datadog-api-client/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ apiInstance
363363
| Case Management | @datadog/datadog-api-client-case-management | [README.md](../../services/case-management/README.md) |
364364
| Case Management Attribute | @datadog/datadog-api-client-case-management-attribute | [README.md](../../services/case-management-attribute/README.md) |
365365
| Case Management Type | @datadog/datadog-api-client-case-management-type | [README.md](../../services/case-management-type/README.md) |
366+
| Change Management | @datadog/datadog-api-client-change-management | [README.md](../../services/change-management/README.md) |
366367
| CI Visibility Pipelines | @datadog/datadog-api-client-ci-visibility-pipelines | [README.md](../../services/ci-visibility-pipelines/README.md) |
367368
| CI Visibility Tests | @datadog/datadog-api-client-ci-visibility-tests | [README.md](../../services/ci-visibility-tests/README.md) |
368369
| Cloud Authentication | @datadog/datadog-api-client-cloud-authentication | [README.md](../../services/cloud-authentication/README.md) |

private/bdd_runner/src/support/scenarios_model_mapping.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3815,6 +3815,68 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
38153815
},
38163816
operationResponseType: "ListRelationCatalogResponse",
38173817
},
3818+
"ChangeManagementApi.V2.CreateChangeRequest": {
3819+
body: {
3820+
type: "ChangeRequestCreateRequest",
3821+
format: "",
3822+
},
3823+
operationResponseType: "ChangeRequestResponse",
3824+
},
3825+
"ChangeManagementApi.V2.GetChangeRequest": {
3826+
changeRequestId: {
3827+
type: "string",
3828+
format: "",
3829+
},
3830+
operationResponseType: "ChangeRequestResponse",
3831+
},
3832+
"ChangeManagementApi.V2.UpdateChangeRequest": {
3833+
changeRequestId: {
3834+
type: "string",
3835+
format: "",
3836+
},
3837+
body: {
3838+
type: "ChangeRequestUpdateRequest",
3839+
format: "",
3840+
},
3841+
operationResponseType: "ChangeRequestResponse",
3842+
},
3843+
"ChangeManagementApi.V2.CreateChangeRequestBranch": {
3844+
changeRequestId: {
3845+
type: "string",
3846+
format: "",
3847+
},
3848+
body: {
3849+
type: "ChangeRequestBranchCreateRequest",
3850+
format: "",
3851+
},
3852+
operationResponseType: "ChangeRequestResponse",
3853+
},
3854+
"ChangeManagementApi.V2.DeleteChangeRequestDecision": {
3855+
changeRequestId: {
3856+
type: "string",
3857+
format: "",
3858+
},
3859+
decisionId: {
3860+
type: "string",
3861+
format: "",
3862+
},
3863+
operationResponseType: "ChangeRequestResponse",
3864+
},
3865+
"ChangeManagementApi.V2.UpdateChangeRequestDecision": {
3866+
changeRequestId: {
3867+
type: "string",
3868+
format: "",
3869+
},
3870+
decisionId: {
3871+
type: "string",
3872+
format: "",
3873+
},
3874+
body: {
3875+
type: "ChangeRequestDecisionUpdateRequest",
3876+
format: "",
3877+
},
3878+
operationResponseType: "ChangeRequestResponse",
3879+
},
38183880
"CIVisibilityPipelinesApi.V2.CreateCIAppPipelineEvent": {
38193881
body: {
38203882
type: "CIAppCreatePipelineEventRequest",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# @datadog/datadog-api-client-change-management
2+
3+
## Description
4+
5+
View and manage change requests within Change Management. See the [Case Management page](https://docs.datadoghq.com/service_management/case_management/) for more information.
6+
7+
## Navigation
8+
9+
- [Installation](#installation)
10+
- [Getting Started](#getting-started)
11+
12+
## Installation
13+
14+
```sh
15+
# NPM
16+
npm install @datadog/datadog-api-client-change-management
17+
# Yarn
18+
yarn add @datadog/datadog-api-client-change-management
19+
```
20+
21+
## Getting Started
22+
```ts
23+
import { createConfiguration } from "@datadog/datadog-api-client";
24+
import { ChangeManagementApiV2 } from "@datadog/datadog-api-client-change-management";
25+
import { v2 } from "@datadog/datadog-api-client-change-management";
26+
27+
const configuration = createConfiguration();
28+
// Enable unstable operations
29+
const configurationOpts = {
30+
unstableOperations: {
31+
"ChangeManagementApi.v2.createChangeRequest": true
32+
}
33+
}
34+
35+
const configuration = createConfiguration(configurationOpts);
36+
const apiInstance = new ChangeManagementApiV2(configuration);
37+
const params = {/* parameters */};
38+
39+
apiInstance.createChangeRequest(params).then((data) => {
40+
console.log("API called successfully. Returned data: " + JSON.stringify(data));
41+
}).catch((error) => {
42+
console.error("Error calling API: " + error);
43+
});
44+
```
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "@datadog/datadog-api-client-change-management",
3+
"description": "",
4+
"author": "",
5+
"keywords": [
6+
"api",
7+
"fetch",
8+
"typescript"
9+
],
10+
"license": "Apache-2.0",
11+
"licenses": [
12+
{
13+
"type": "Apache-2.0",
14+
"url": "http://www.apache.org/licenses/LICENSE-2.0"
15+
}
16+
],
17+
"repository": {
18+
"type": "git",
19+
"url": "https://github.com/DataDog/datadog-api-client-typescript.git",
20+
"directory": "services/change-management"
21+
},
22+
"files": [
23+
"dist/**/*"
24+
],
25+
"main": "./dist/index.js",
26+
"typings": "./dist/index.d.ts",
27+
"scripts": {
28+
"prepack": "yarn workspace @datadog/datadog-api-client build && yarn build",
29+
"build": "yarn generate-version-files && tsc",
30+
"generate-version-files": "node -p \"'export const version = ' + JSON.stringify(require('./package.json').version)\" > src/version.ts"
31+
},
32+
"dependencies": {
33+
"@datadog/datadog-api-client": "^2.0.0-beta.2"
34+
},
35+
"devDependencies": {
36+
"typescript": "5.8.3"
37+
},
38+
"engines": {
39+
"node": ">=18.0.0"
40+
},
41+
"version": "0.0.1",
42+
"packageManager": "yarn@4.9.1"
43+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * as v2 from "./v2";
2+
3+
export { ChangeManagementApi as ChangeManagementApiV2 } from "./v2/ChangeManagementApi";

0 commit comments

Comments
 (0)