@@ -26,6 +26,7 @@ import { APIErrorResponse } from "./models/APIErrorResponse";
2626import { CreateDeploymentGateParams } from "./models/CreateDeploymentGateParams" ;
2727import { CreateDeploymentRuleParams } from "./models/CreateDeploymentRuleParams" ;
2828import { DeploymentGateResponse } from "./models/DeploymentGateResponse" ;
29+ import { DeploymentGateRulesResponse } from "./models/DeploymentGateRulesResponse" ;
2930import { DeploymentRuleResponse } from "./models/DeploymentRuleResponse" ;
3031import { HTTPCDGatesBadRequestResponse } from "./models/HTTPCDGatesBadRequestResponse" ;
3132import { 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+
14721634export 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
0 commit comments