Skip to content

Commit da33c26

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

File tree

8 files changed

+311
-0
lines changed

8 files changed

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

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": {

private/bdd_runner/src/support/scenarios_model_mapping.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5330,6 +5330,13 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
53305330
},
53315331
operationResponseType: "DeploymentGateResponse",
53325332
},
5333+
"DeploymentGatesApi.V2.GetDeploymentGateRules": {
5334+
gateId: {
5335+
type: "string",
5336+
format: "",
5337+
},
5338+
operationResponseType: "DeploymentGateRulesResponse",
5339+
},
53335340
"DeploymentGatesApi.V2.CreateDeploymentRule": {
53345341
gateId: {
53355342
type: "string",

services/deployment_gates/src/v2/DeploymentGatesApi.ts

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { APIErrorResponse } from "./models/APIErrorResponse";
2626
import { CreateDeploymentGateParams } from "./models/CreateDeploymentGateParams";
2727
import { CreateDeploymentRuleParams } from "./models/CreateDeploymentRuleParams";
2828
import { DeploymentGateResponse } from "./models/DeploymentGateResponse";
29+
import { DeploymentGateRulesResponse } from "./models/DeploymentGateRulesResponse";
2930
import { DeploymentRuleResponse } from "./models/DeploymentRuleResponse";
3031
import { HTTPCDGatesBadRequestResponse } from "./models/HTTPCDGatesBadRequestResponse";
3132
import { HTTPCDGatesNotFoundResponse } from "./models/HTTPCDGatesNotFoundResponse";
@@ -330,6 +331,60 @@ export class DeploymentGatesApiRequestFactory extends BaseAPIRequestFactory {
330331
return requestContext;
331332
}
332333

334+
public async getDeploymentGateRules(
335+
gateId: string,
336+
_options?: Configuration,
337+
): Promise<RequestContext> {
338+
const _config = _options || this.configuration;
339+
340+
if (
341+
!_config.unstableOperations[
342+
"DeploymentGatesApi.v2.getDeploymentGateRules"
343+
]
344+
) {
345+
throw new Error(
346+
"Unstable operation 'getDeploymentGateRules' is disabled. Enable it by setting `configuration.unstableOperations['DeploymentGatesApi.v2.getDeploymentGateRules'] = true`",
347+
);
348+
}
349+
350+
// verify required parameter 'gateId' is not null or undefined
351+
if (gateId === null || gateId === undefined) {
352+
throw new RequiredError("gateId", "getDeploymentGateRules");
353+
}
354+
355+
// Path Params
356+
const localVarPath = "/api/v2/deployment_gates/{gate_id}/rules".replace(
357+
"{gate_id}",
358+
encodeURIComponent(String(gateId)),
359+
);
360+
361+
// Make Request Context
362+
const { server, overrides } = _config.getServerAndOverrides(
363+
"DeploymentGatesApi.v2.getDeploymentGateRules",
364+
DeploymentGatesApi.operationServers,
365+
);
366+
const requestContext = server.makeRequestContext(
367+
localVarPath,
368+
HttpMethod.GET,
369+
overrides,
370+
);
371+
requestContext.setHeaderParam("Accept", "application/json");
372+
requestContext.setHttpConfig(_config.httpConfig);
373+
374+
// Set User-Agent
375+
if (this.userAgent) {
376+
requestContext.setHeaderParam("User-Agent", this.userAgent);
377+
}
378+
379+
// Apply auth methods
380+
applySecurityAuthentication(_config, requestContext, [
381+
"apiKeyAuth",
382+
"appKeyAuth",
383+
]);
384+
385+
return requestContext;
386+
}
387+
333388
public async getDeploymentRule(
334389
gateId: string,
335390
id: string,
@@ -1060,6 +1115,105 @@ export class DeploymentGatesApiResponseProcessor {
10601115
);
10611116
}
10621117

1118+
/**
1119+
* Unwraps the actual response sent by the server from the response context and deserializes the response content
1120+
* to the expected objects
1121+
*
1122+
* @params response Response returned by the server for a request to getDeploymentGateRules
1123+
* @throws ApiException if the response code was not in [200, 299]
1124+
*/
1125+
public async getDeploymentGateRules(
1126+
response: ResponseContext,
1127+
): Promise<DeploymentGateRulesResponse> {
1128+
const contentType = normalizeMediaType(response.headers["content-type"]);
1129+
if (response.httpStatusCode === 200) {
1130+
const body: DeploymentGateRulesResponse = deserialize(
1131+
parse(await response.body.text(), contentType),
1132+
TypingInfo,
1133+
"DeploymentGateRulesResponse",
1134+
) as DeploymentGateRulesResponse;
1135+
return body;
1136+
}
1137+
if (response.httpStatusCode === 400) {
1138+
const bodyText = parse(await response.body.text(), contentType);
1139+
let body: HTTPCDGatesBadRequestResponse;
1140+
try {
1141+
body = deserialize(
1142+
bodyText,
1143+
TypingInfo,
1144+
"HTTPCDGatesBadRequestResponse",
1145+
) as HTTPCDGatesBadRequestResponse;
1146+
} catch (error) {
1147+
logger.debug(`Got error deserializing error: ${error}`);
1148+
throw new ApiException<HTTPCDGatesBadRequestResponse>(
1149+
response.httpStatusCode,
1150+
bodyText,
1151+
);
1152+
}
1153+
throw new ApiException<HTTPCDGatesBadRequestResponse>(
1154+
response.httpStatusCode,
1155+
body,
1156+
);
1157+
}
1158+
if (
1159+
response.httpStatusCode === 401 ||
1160+
response.httpStatusCode === 403 ||
1161+
response.httpStatusCode === 429
1162+
) {
1163+
const bodyText = parse(await response.body.text(), contentType);
1164+
let body: APIErrorResponse;
1165+
try {
1166+
body = deserialize(
1167+
bodyText,
1168+
TypingInfo,
1169+
"APIErrorResponse",
1170+
) as APIErrorResponse;
1171+
} catch (error) {
1172+
logger.debug(`Got error deserializing error: ${error}`);
1173+
throw new ApiException<APIErrorResponse>(
1174+
response.httpStatusCode,
1175+
bodyText,
1176+
);
1177+
}
1178+
throw new ApiException<APIErrorResponse>(response.httpStatusCode, body);
1179+
}
1180+
if (response.httpStatusCode === 500) {
1181+
const bodyText = parse(await response.body.text(), contentType);
1182+
let body: HTTPCIAppErrors;
1183+
try {
1184+
body = deserialize(
1185+
bodyText,
1186+
TypingInfo,
1187+
"HTTPCIAppErrors",
1188+
) as HTTPCIAppErrors;
1189+
} catch (error) {
1190+
logger.debug(`Got error deserializing error: ${error}`);
1191+
throw new ApiException<HTTPCIAppErrors>(
1192+
response.httpStatusCode,
1193+
bodyText,
1194+
);
1195+
}
1196+
throw new ApiException<HTTPCIAppErrors>(response.httpStatusCode, body);
1197+
}
1198+
1199+
// Work around for missing responses in specification, e.g. for petstore.yaml
1200+
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
1201+
const body: DeploymentGateRulesResponse = deserialize(
1202+
parse(await response.body.text(), contentType),
1203+
TypingInfo,
1204+
"DeploymentGateRulesResponse",
1205+
"",
1206+
) as DeploymentGateRulesResponse;
1207+
return body;
1208+
}
1209+
1210+
const body = (await response.body.text()) || "";
1211+
throw new ApiException<string>(
1212+
response.httpStatusCode,
1213+
'Unknown API Status Code!\nBody: "' + body + '"',
1214+
);
1215+
}
1216+
10631217
/**
10641218
* Unwraps the actual response sent by the server from the response context and deserializes the response content
10651219
* to the expected objects
@@ -1469,6 +1623,14 @@ export interface DeploymentGatesApiGetDeploymentGateRequest {
14691623
id: string;
14701624
}
14711625

1626+
export interface DeploymentGatesApiGetDeploymentGateRulesRequest {
1627+
/**
1628+
* The ID of the deployment gate.
1629+
* @type string
1630+
*/
1631+
gateId: string;
1632+
}
1633+
14721634
export interface DeploymentGatesApiGetDeploymentRuleRequest {
14731635
/**
14741636
* The ID of the deployment gate.
@@ -1638,6 +1800,27 @@ export class DeploymentGatesApi {
16381800
});
16391801
}
16401802

1803+
/**
1804+
* Endpoint to get rules for a deployment gate.
1805+
* @param param The request object
1806+
*/
1807+
public getDeploymentGateRules(
1808+
param: DeploymentGatesApiGetDeploymentGateRulesRequest,
1809+
options?: Configuration,
1810+
): Promise<DeploymentGateRulesResponse> {
1811+
const requestContextPromise = this.requestFactory.getDeploymentGateRules(
1812+
param.gateId,
1813+
options,
1814+
);
1815+
return requestContextPromise.then((requestContext) => {
1816+
return this.configuration.httpApi
1817+
.send(requestContext)
1818+
.then((responseContext) => {
1819+
return this.responseProcessor.getDeploymentGateRules(responseContext);
1820+
});
1821+
});
1822+
}
1823+
16411824
/**
16421825
* Endpoint to get a deployment rule.
16431826
* @param param The request object

services/deployment_gates/src/v2/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export {
44
DeploymentGatesApiDeleteDeploymentGateRequest,
55
DeploymentGatesApiDeleteDeploymentRuleRequest,
66
DeploymentGatesApiGetDeploymentGateRequest,
7+
DeploymentGatesApiGetDeploymentGateRulesRequest,
78
DeploymentGatesApiGetDeploymentRuleRequest,
89
DeploymentGatesApiUpdateDeploymentGateRequest,
910
DeploymentGatesApiUpdateDeploymentRuleRequest,
@@ -23,6 +24,7 @@ export { DeploymentGateResponseData } from "./models/DeploymentGateResponseData"
2324
export { DeploymentGateResponseDataAttributes } from "./models/DeploymentGateResponseDataAttributes";
2425
export { DeploymentGateResponseDataAttributesCreatedBy } from "./models/DeploymentGateResponseDataAttributesCreatedBy";
2526
export { DeploymentGateResponseDataAttributesUpdatedBy } from "./models/DeploymentGateResponseDataAttributesUpdatedBy";
27+
export { DeploymentGateRulesResponse } from "./models/DeploymentGateRulesResponse";
2628
export { DeploymentRuleDataType } from "./models/DeploymentRuleDataType";
2729
export { DeploymentRuleOptionsFaultyDeploymentDetection } from "./models/DeploymentRuleOptionsFaultyDeploymentDetection";
2830
export { DeploymentRuleOptionsMonitor } from "./models/DeploymentRuleOptionsMonitor";
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { AttributeTypeMap } from "@datadog/datadog-api-client";
2+
3+
import { DeploymentRuleResponseData } from "./DeploymentRuleResponseData";
4+
5+
/**
6+
* Response for a deployment gate rules.
7+
*/
8+
export class DeploymentGateRulesResponse {
9+
"data"?: Array<DeploymentRuleResponseData>;
10+
/**
11+
* A container for additional, undeclared properties.
12+
* This is a holder for any undeclared properties as specified with
13+
* the 'additionalProperties' keyword in the OAS document.
14+
*/
15+
"additionalProperties"?: { [key: string]: any };
16+
/**
17+
* @ignore
18+
*/
19+
"_unparsed"?: boolean;
20+
21+
/**
22+
* @ignore
23+
*/
24+
static readonly attributeTypeMap: AttributeTypeMap = {
25+
data: {
26+
baseName: "data",
27+
type: "Array<DeploymentRuleResponseData>",
28+
},
29+
additionalProperties: {
30+
baseName: "additionalProperties",
31+
type: "{ [key: string]: any; }",
32+
},
33+
};
34+
35+
/**
36+
* @ignore
37+
*/
38+
static getAttributeTypeMap(): AttributeTypeMap {
39+
return DeploymentGateRulesResponse.attributeTypeMap;
40+
}
41+
42+
public constructor() {}
43+
}

0 commit comments

Comments
 (0)