@@ -20,6 +20,7 @@ import { APIErrorResponse } from "../models/APIErrorResponse";
2020import { CreateDeploymentGateParams } from "../models/CreateDeploymentGateParams" ;
2121import { CreateDeploymentRuleParams } from "../models/CreateDeploymentRuleParams" ;
2222import { DeploymentGateResponse } from "../models/DeploymentGateResponse" ;
23+ import { DeploymentGateRulesResponse } from "../models/DeploymentGateRulesResponse" ;
2324import { DeploymentRuleResponse } from "../models/DeploymentRuleResponse" ;
2425import { HTTPCDGatesBadRequestResponse } from "../models/HTTPCDGatesBadRequestResponse" ;
2526import { 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+
14171571export 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
0 commit comments