Skip to content

Commit de0caac

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit ccb1c01 of spec repo
1 parent b7b888c commit de0caac

File tree

10 files changed

+333
-0
lines changed

10 files changed

+333
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16644,6 +16644,14 @@ components:
1664416644
required:
1664516645
- id
1664616646
type: object
16647+
DeploymentGateRulesResponse:
16648+
description: Response for a deployment gate rules.
16649+
properties:
16650+
data:
16651+
items:
16652+
$ref: '#/components/schemas/DeploymentRuleResponseData'
16653+
type: array
16654+
type: object
1664716655
DeploymentMetadata:
1664816656
description: Metadata object containing the publication creation information.
1664916657
properties:
@@ -64391,6 +64399,50 @@ paths:
6439164399

6439264400
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
6439364401
/api/v2/deployment_gates/{gate_id}/rules:
64402+
get:
64403+
description: Endpoint to get rules for a deployment gate.
64404+
operationId: GetDeploymentGateRules
64405+
parameters:
64406+
- description: The ID of the deployment gate.
64407+
in: path
64408+
name: gate_id
64409+
required: true
64410+
schema:
64411+
type: string
64412+
responses:
64413+
'200':
64414+
content:
64415+
application/json:
64416+
schema:
64417+
$ref: '#/components/schemas/DeploymentGateRulesResponse'
64418+
description: OK
64419+
'400':
64420+
$ref: '#/components/responses/HTTPCDGatesBadRequestResponse'
64421+
'401':
64422+
$ref: '#/components/responses/UnauthorizedResponse'
64423+
'403':
64424+
$ref: '#/components/responses/ForbiddenResponse'
64425+
'429':
64426+
$ref: '#/components/responses/TooManyRequestsResponse'
64427+
'500':
64428+
content:
64429+
application/json:
64430+
schema:
64431+
$ref: '#/components/schemas/HTTPCIAppErrors'
64432+
description: Internal Server Error
64433+
security:
64434+
- apiKeyAuth: []
64435+
appKeyAuth: []
64436+
summary: Get rules for a deployment gate
64437+
tags:
64438+
- Deployment Gates
64439+
x-permission:
64440+
operator: OR
64441+
permissions:
64442+
- deployment_gates_read
64443+
x-unstable: '**Note**: This endpoint is in preview and may be subject to change.
64444+
64445+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
6439464446
post:
6439564447
description: Endpoint to create a deployment rule. A gate for the rule must
6439664448
already exist.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Get rules for a deployment gate returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.getDeploymentGateRules"] = true;
9+
const apiInstance = new v2.DeploymentGatesApi(configuration);
10+
11+
const params: v2.DeploymentGatesApiGetDeploymentGateRulesRequest = {
12+
gateId: "gate_id",
13+
};
14+
15+
apiInstance
16+
.getDeploymentGateRules(params)
17+
.then((data: v2.DeploymentGateRulesResponse) => {
18+
console.log(
19+
"API called successfully. Returned data: " + JSON.stringify(data)
20+
);
21+
})
22+
.catch((error: any) => console.error(error));

features/support/scenarios_model_mapping.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5320,6 +5320,13 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
53205320
},
53215321
"operationResponseType": "DeploymentGateResponse",
53225322
},
5323+
"v2.GetDeploymentGateRules": {
5324+
"gateId": {
5325+
"type": "string",
5326+
"format": "",
5327+
},
5328+
"operationResponseType": "DeploymentGateRulesResponse",
5329+
},
53235330
"v2.CreateDeploymentRule": {
53245331
"gateId": {
53255332
"type": "string",

features/v2/deployment_gates.feature

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,22 @@ Feature: Deployment Gates
207207
When the request is sent
208208
Then the response status is 200 OK
209209

210+
@generated @skip @team:DataDog/ci-app-backend
211+
Scenario: Get rules for a deployment gate returns "Bad request." response
212+
Given operation "GetDeploymentGateRules" enabled
213+
And new "GetDeploymentGateRules" request
214+
And request contains "gate_id" parameter from "REPLACE.ME"
215+
When the request is sent
216+
Then the response status is 400 Bad request.
217+
218+
@generated @skip @team:DataDog/ci-app-backend
219+
Scenario: Get rules for a deployment gate returns "OK" response
220+
Given operation "GetDeploymentGateRules" enabled
221+
And new "GetDeploymentGateRules" request
222+
And request contains "gate_id" parameter from "REPLACE.ME"
223+
When the request is sent
224+
Then the response status is 200 OK
225+
210226
@team:DataDog/ci-app-backend
211227
Scenario: Update deployment gate returns "Bad Request" response
212228
Given operation "UpdateDeploymentGate" enabled

features/v2/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,6 +1323,12 @@
13231323
"type": "unsafe"
13241324
}
13251325
},
1326+
"GetDeploymentGateRules": {
1327+
"tag": "Deployment Gates",
1328+
"undo": {
1329+
"type": "safe"
1330+
}
1331+
},
13261332
"CreateDeploymentRule": {
13271333
"tag": "Deployment Gates",
13281334
"undo": {

packages/datadog-api-client-common/configuration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ export function createConfiguration(
273273
"v2.deleteDeploymentGate": false,
274274
"v2.deleteDeploymentRule": false,
275275
"v2.getDeploymentGate": false,
276+
"v2.getDeploymentGateRules": false,
276277
"v2.getDeploymentRule": false,
277278
"v2.updateDeploymentGate": false,
278279
"v2.updateDeploymentRule": false,

packages/datadog-api-client-v2/apis/DeploymentGatesApi.ts

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { APIErrorResponse } from "../models/APIErrorResponse";
2020
import { CreateDeploymentGateParams } from "../models/CreateDeploymentGateParams";
2121
import { CreateDeploymentRuleParams } from "../models/CreateDeploymentRuleParams";
2222
import { DeploymentGateResponse } from "../models/DeploymentGateResponse";
23+
import { DeploymentGateRulesResponse } from "../models/DeploymentGateRulesResponse";
2324
import { DeploymentRuleResponse } from "../models/DeploymentRuleResponse";
2425
import { HTTPCDGatesBadRequestResponse } from "../models/HTTPCDGatesBadRequestResponse";
2526
import { HTTPCDGatesNotFoundResponse } from "../models/HTTPCDGatesNotFoundResponse";
@@ -249,6 +250,46 @@ export class DeploymentGatesApiRequestFactory extends BaseAPIRequestFactory {
249250
return requestContext;
250251
}
251252

253+
public async getDeploymentGateRules(
254+
gateId: string,
255+
_options?: Configuration
256+
): Promise<RequestContext> {
257+
const _config = _options || this.configuration;
258+
259+
logger.warn("Using unstable operation 'getDeploymentGateRules'");
260+
if (!_config.unstableOperations["v2.getDeploymentGateRules"]) {
261+
throw new Error(
262+
"Unstable operation 'getDeploymentGateRules' is disabled"
263+
);
264+
}
265+
266+
// verify required parameter 'gateId' is not null or undefined
267+
if (gateId === null || gateId === undefined) {
268+
throw new RequiredError("gateId", "getDeploymentGateRules");
269+
}
270+
271+
// Path Params
272+
const localVarPath = "/api/v2/deployment_gates/{gate_id}/rules".replace(
273+
"{gate_id}",
274+
encodeURIComponent(String(gateId))
275+
);
276+
277+
// Make Request Context
278+
const requestContext = _config
279+
.getServer("v2.DeploymentGatesApi.getDeploymentGateRules")
280+
.makeRequestContext(localVarPath, HttpMethod.GET);
281+
requestContext.setHeaderParam("Accept", "application/json");
282+
requestContext.setHttpConfig(_config.httpConfig);
283+
284+
// Apply auth methods
285+
applySecurityAuthentication(_config, requestContext, [
286+
"apiKeyAuth",
287+
"appKeyAuth",
288+
]);
289+
290+
return requestContext;
291+
}
292+
252293
public async getDeploymentRule(
253294
gateId: string,
254295
id: string,
@@ -981,6 +1022,111 @@ export class DeploymentGatesApiResponseProcessor {
9811022
);
9821023
}
9831024

1025+
/**
1026+
* Unwraps the actual response sent by the server from the response context and deserializes the response content
1027+
* to the expected objects
1028+
*
1029+
* @params response Response returned by the server for a request to getDeploymentGateRules
1030+
* @throws ApiException if the response code was not in [200, 299]
1031+
*/
1032+
public async getDeploymentGateRules(
1033+
response: ResponseContext
1034+
): Promise<DeploymentGateRulesResponse> {
1035+
const contentType = ObjectSerializer.normalizeMediaType(
1036+
response.headers["content-type"]
1037+
);
1038+
if (response.httpStatusCode === 200) {
1039+
const body: DeploymentGateRulesResponse = ObjectSerializer.deserialize(
1040+
ObjectSerializer.parse(await response.body.text(), contentType),
1041+
"DeploymentGateRulesResponse"
1042+
) as DeploymentGateRulesResponse;
1043+
return body;
1044+
}
1045+
if (response.httpStatusCode === 400) {
1046+
const bodyText = ObjectSerializer.parse(
1047+
await response.body.text(),
1048+
contentType
1049+
);
1050+
let body: HTTPCDGatesBadRequestResponse;
1051+
try {
1052+
body = ObjectSerializer.deserialize(
1053+
bodyText,
1054+
"HTTPCDGatesBadRequestResponse"
1055+
) as HTTPCDGatesBadRequestResponse;
1056+
} catch (error) {
1057+
logger.debug(`Got error deserializing error: ${error}`);
1058+
throw new ApiException<HTTPCDGatesBadRequestResponse>(
1059+
response.httpStatusCode,
1060+
bodyText
1061+
);
1062+
}
1063+
throw new ApiException<HTTPCDGatesBadRequestResponse>(
1064+
response.httpStatusCode,
1065+
body
1066+
);
1067+
}
1068+
if (
1069+
response.httpStatusCode === 401 ||
1070+
response.httpStatusCode === 403 ||
1071+
response.httpStatusCode === 429
1072+
) {
1073+
const bodyText = ObjectSerializer.parse(
1074+
await response.body.text(),
1075+
contentType
1076+
);
1077+
let body: APIErrorResponse;
1078+
try {
1079+
body = ObjectSerializer.deserialize(
1080+
bodyText,
1081+
"APIErrorResponse"
1082+
) as APIErrorResponse;
1083+
} catch (error) {
1084+
logger.debug(`Got error deserializing error: ${error}`);
1085+
throw new ApiException<APIErrorResponse>(
1086+
response.httpStatusCode,
1087+
bodyText
1088+
);
1089+
}
1090+
throw new ApiException<APIErrorResponse>(response.httpStatusCode, body);
1091+
}
1092+
if (response.httpStatusCode === 500) {
1093+
const bodyText = ObjectSerializer.parse(
1094+
await response.body.text(),
1095+
contentType
1096+
);
1097+
let body: HTTPCIAppErrors;
1098+
try {
1099+
body = ObjectSerializer.deserialize(
1100+
bodyText,
1101+
"HTTPCIAppErrors"
1102+
) as HTTPCIAppErrors;
1103+
} catch (error) {
1104+
logger.debug(`Got error deserializing error: ${error}`);
1105+
throw new ApiException<HTTPCIAppErrors>(
1106+
response.httpStatusCode,
1107+
bodyText
1108+
);
1109+
}
1110+
throw new ApiException<HTTPCIAppErrors>(response.httpStatusCode, body);
1111+
}
1112+
1113+
// Work around for missing responses in specification, e.g. for petstore.yaml
1114+
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
1115+
const body: DeploymentGateRulesResponse = ObjectSerializer.deserialize(
1116+
ObjectSerializer.parse(await response.body.text(), contentType),
1117+
"DeploymentGateRulesResponse",
1118+
""
1119+
) as DeploymentGateRulesResponse;
1120+
return body;
1121+
}
1122+
1123+
const body = (await response.body.text()) || "";
1124+
throw new ApiException<string>(
1125+
response.httpStatusCode,
1126+
'Unknown API Status Code!\nBody: "' + body + '"'
1127+
);
1128+
}
1129+
9841130
/**
9851131
* Unwraps the actual response sent by the server from the response context and deserializes the response content
9861132
* to the expected objects
@@ -1414,6 +1560,14 @@ export interface DeploymentGatesApiGetDeploymentGateRequest {
14141560
id: string;
14151561
}
14161562

1563+
export interface DeploymentGatesApiGetDeploymentGateRulesRequest {
1564+
/**
1565+
* The ID of the deployment gate.
1566+
* @type string
1567+
*/
1568+
gateId: string;
1569+
}
1570+
14171571
export interface DeploymentGatesApiGetDeploymentRuleRequest {
14181572
/**
14191573
* The ID of the deployment gate.
@@ -1580,6 +1734,27 @@ export class DeploymentGatesApi {
15801734
});
15811735
}
15821736

1737+
/**
1738+
* Endpoint to get rules for a deployment gate.
1739+
* @param param The request object
1740+
*/
1741+
public getDeploymentGateRules(
1742+
param: DeploymentGatesApiGetDeploymentGateRulesRequest,
1743+
options?: Configuration
1744+
): Promise<DeploymentGateRulesResponse> {
1745+
const requestContextPromise = this.requestFactory.getDeploymentGateRules(
1746+
param.gateId,
1747+
options
1748+
);
1749+
return requestContextPromise.then((requestContext) => {
1750+
return this.configuration.httpApi
1751+
.send(requestContext)
1752+
.then((responseContext) => {
1753+
return this.responseProcessor.getDeploymentGateRules(responseContext);
1754+
});
1755+
});
1756+
}
1757+
15831758
/**
15841759
* Endpoint to get a deployment rule.
15851760
* @param param The request object

packages/datadog-api-client-v2/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ export {
300300
DeploymentGatesApiDeleteDeploymentGateRequest,
301301
DeploymentGatesApiDeleteDeploymentRuleRequest,
302302
DeploymentGatesApiGetDeploymentGateRequest,
303+
DeploymentGatesApiGetDeploymentGateRulesRequest,
303304
DeploymentGatesApiGetDeploymentRuleRequest,
304305
DeploymentGatesApiUpdateDeploymentGateRequest,
305306
DeploymentGatesApiUpdateDeploymentRuleRequest,
@@ -1875,6 +1876,7 @@ export { DeploymentGateResponseData } from "./models/DeploymentGateResponseData"
18751876
export { DeploymentGateResponseDataAttributes } from "./models/DeploymentGateResponseDataAttributes";
18761877
export { DeploymentGateResponseDataAttributesCreatedBy } from "./models/DeploymentGateResponseDataAttributesCreatedBy";
18771878
export { DeploymentGateResponseDataAttributesUpdatedBy } from "./models/DeploymentGateResponseDataAttributesUpdatedBy";
1879+
export { DeploymentGateRulesResponse } from "./models/DeploymentGateRulesResponse";
18781880
export { DeploymentMetadata } from "./models/DeploymentMetadata";
18791881
export { DeploymentRelationship } from "./models/DeploymentRelationship";
18801882
export { DeploymentRelationshipData } from "./models/DeploymentRelationshipData";

0 commit comments

Comments
 (0)