Skip to content

Commit 1fe91b2

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

File tree

51 files changed

+4972
-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.

51 files changed

+4972
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 901 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* Create a change request returns "Created" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.createChangeRequest"] = true;
9+
const apiInstance = new v2.ChangeManagementApi(configuration);
10+
11+
const params: v2.ChangeManagementApiCreateChangeRequestRequest = {
12+
body: {
13+
data: {
14+
attributes: {
15+
changeRequestLinkedIncidentUuid: "00000000-0000-0000-0000-000000000000",
16+
changeRequestMaintenanceWindowQuery: "",
17+
changeRequestPlan:
18+
"1. Deploy to staging 2. Run tests 3. Deploy to production",
19+
changeRequestRisk: "LOW",
20+
changeRequestType: "NORMAL",
21+
description: "Deploying new payment service v2.1",
22+
endDate: new Date(2024, 1, 2, 15, 0, 0, 0),
23+
projectId: "d4bbe1af-f36e-42f1-87c1-493ca35c320e",
24+
requestedTeams: ["team-handle-1"],
25+
startDate: new Date(2024, 1, 1, 3, 0, 0, 0),
26+
title: "Deploy new payment service",
27+
},
28+
type: "change_request",
29+
},
30+
},
31+
};
32+
33+
apiInstance
34+
.createChangeRequest(params)
35+
.then((data: v2.ChangeRequestResponse) => {
36+
console.log(
37+
"API called successfully. Returned data: " + JSON.stringify(data)
38+
);
39+
})
40+
.catch((error: any) => console.error(error));
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* Create a change request branch returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.createChangeRequestBranch"] = true;
9+
const apiInstance = new v2.ChangeManagementApi(configuration);
10+
11+
const params: v2.ChangeManagementApiCreateChangeRequestBranchRequest = {
12+
body: {
13+
data: {
14+
attributes: {
15+
branchName: "chm/CHM-1234",
16+
repoId: "DataDog/dd-source",
17+
},
18+
type: "change_request_branch",
19+
},
20+
},
21+
changeRequestId: "change_request_id",
22+
};
23+
24+
apiInstance
25+
.createChangeRequestBranch(params)
26+
.then((data: v2.ChangeRequestResponse) => {
27+
console.log(
28+
"API called successfully. Returned data: " + JSON.stringify(data)
29+
);
30+
})
31+
.catch((error: any) => console.error(error));
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Delete a change request decision returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.deleteChangeRequestDecision"] = true;
9+
const apiInstance = new v2.ChangeManagementApi(configuration);
10+
11+
const params: v2.ChangeManagementApiDeleteChangeRequestDecisionRequest = {
12+
changeRequestId: "change_request_id",
13+
decisionId: "decision_id",
14+
};
15+
16+
apiInstance
17+
.deleteChangeRequestDecision(params)
18+
.then((data: v2.ChangeRequestResponse) => {
19+
console.log(
20+
"API called successfully. Returned data: " + JSON.stringify(data)
21+
);
22+
})
23+
.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 a change request returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.getChangeRequest"] = true;
9+
const apiInstance = new v2.ChangeManagementApi(configuration);
10+
11+
const params: v2.ChangeManagementApiGetChangeRequestRequest = {
12+
changeRequestId: "change_request_id",
13+
};
14+
15+
apiInstance
16+
.getChangeRequest(params)
17+
.then((data: v2.ChangeRequestResponse) => {
18+
console.log(
19+
"API called successfully. Returned data: " + JSON.stringify(data)
20+
);
21+
})
22+
.catch((error: any) => console.error(error));
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/**
2+
* Update a change request returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.updateChangeRequest"] = true;
9+
const apiInstance = new v2.ChangeManagementApi(configuration);
10+
11+
const params: v2.ChangeManagementApiUpdateChangeRequestRequest = {
12+
body: {
13+
data: {
14+
attributes: {
15+
changeRequestPlan: "Updated deployment plan",
16+
changeRequestRisk: "LOW",
17+
changeRequestType: "NORMAL",
18+
endDate: new Date(2024, 1, 2, 15, 0, 0, 0),
19+
id: "CHM-1234",
20+
startDate: new Date(2024, 1, 1, 3, 0, 0, 0),
21+
},
22+
relationships: {
23+
changeRequestDecisions: {
24+
data: [
25+
{
26+
id: "decision-id-0",
27+
type: "change_request_decision",
28+
},
29+
],
30+
},
31+
},
32+
type: "change_request",
33+
},
34+
included: [
35+
{
36+
attributes: {
37+
changeRequestStatus: "REQUESTED",
38+
requestReason: "Please review and approve this change",
39+
},
40+
id: "decision-id-0",
41+
relationships: {
42+
requestedUser: {
43+
data: {
44+
id: "00000000-0000-0000-0000-000000000000",
45+
type: "user",
46+
},
47+
},
48+
},
49+
type: "change_request_decision",
50+
},
51+
],
52+
},
53+
changeRequestId: "change_request_id",
54+
};
55+
56+
apiInstance
57+
.updateChangeRequest(params)
58+
.then((data: v2.ChangeRequestResponse) => {
59+
console.log(
60+
"API called successfully. Returned data: " + JSON.stringify(data)
61+
);
62+
})
63+
.catch((error: any) => console.error(error));
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/**
2+
* Update a change request decision returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.updateChangeRequestDecision"] = true;
9+
const apiInstance = new v2.ChangeManagementApi(configuration);
10+
11+
const params: v2.ChangeManagementApiUpdateChangeRequestDecisionRequest = {
12+
body: {
13+
data: {
14+
attributes: {
15+
id: "CHM-1234",
16+
},
17+
relationships: {
18+
changeRequestDecisions: {
19+
data: [
20+
{
21+
id: "decision-id-0",
22+
type: "change_request_decision",
23+
},
24+
],
25+
},
26+
},
27+
type: "change_request",
28+
},
29+
included: [
30+
{
31+
attributes: {
32+
changeRequestStatus: "REQUESTED",
33+
requestReason: "Please review and approve this change",
34+
},
35+
id: "decision-id-0",
36+
relationships: {
37+
requestedUser: {
38+
data: {
39+
id: "00000000-0000-0000-0000-000000000000",
40+
type: "user",
41+
},
42+
},
43+
},
44+
type: "change_request_decision",
45+
},
46+
],
47+
},
48+
changeRequestId: "change_request_id",
49+
decisionId: "decision_id",
50+
};
51+
52+
apiInstance
53+
.updateChangeRequestDecision(params)
54+
.then((data: v2.ChangeRequestResponse) => {
55+
console.log(
56+
"API called successfully. Returned data: " + JSON.stringify(data)
57+
);
58+
})
59+
.catch((error: any) => console.error(error));

features/support/scenarios_model_mapping.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3805,6 +3805,68 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
38053805
},
38063806
"operationResponseType": "ListRelationCatalogResponse",
38073807
},
3808+
"v2.CreateChangeRequest": {
3809+
"body": {
3810+
"type": "ChangeRequestCreateRequest",
3811+
"format": "",
3812+
},
3813+
"operationResponseType": "ChangeRequestResponse",
3814+
},
3815+
"v2.GetChangeRequest": {
3816+
"changeRequestId": {
3817+
"type": "string",
3818+
"format": "",
3819+
},
3820+
"operationResponseType": "ChangeRequestResponse",
3821+
},
3822+
"v2.UpdateChangeRequest": {
3823+
"changeRequestId": {
3824+
"type": "string",
3825+
"format": "",
3826+
},
3827+
"body": {
3828+
"type": "ChangeRequestUpdateRequest",
3829+
"format": "",
3830+
},
3831+
"operationResponseType": "ChangeRequestResponse",
3832+
},
3833+
"v2.CreateChangeRequestBranch": {
3834+
"changeRequestId": {
3835+
"type": "string",
3836+
"format": "",
3837+
},
3838+
"body": {
3839+
"type": "ChangeRequestBranchCreateRequest",
3840+
"format": "",
3841+
},
3842+
"operationResponseType": "ChangeRequestResponse",
3843+
},
3844+
"v2.DeleteChangeRequestDecision": {
3845+
"changeRequestId": {
3846+
"type": "string",
3847+
"format": "",
3848+
},
3849+
"decisionId": {
3850+
"type": "string",
3851+
"format": "",
3852+
},
3853+
"operationResponseType": "ChangeRequestResponse",
3854+
},
3855+
"v2.UpdateChangeRequestDecision": {
3856+
"changeRequestId": {
3857+
"type": "string",
3858+
"format": "",
3859+
},
3860+
"decisionId": {
3861+
"type": "string",
3862+
"format": "",
3863+
},
3864+
"body": {
3865+
"type": "ChangeRequestDecisionUpdateRequest",
3866+
"format": "",
3867+
},
3868+
"operationResponseType": "ChangeRequestResponse",
3869+
},
38083870
"v2.CreateCIAppPipelineEvent": {
38093871
"body": {
38103872
"type": "CIAppCreatePipelineEventRequest",

0 commit comments

Comments
 (0)