@@ -94,6 +94,45 @@ export class CxWrapper {
9494 return list ;
9595 }
9696
97+
98+ initializeCommandsEngine ( formatRequired : boolean ) : string [ ] {
99+ const list : string [ ] = [ ] ;
100+ if ( this . config . clientId ) {
101+ list . push ( CxConstants . CLIENT_ID ) ;
102+ list . push ( this . config . clientId ) ;
103+ }
104+ if ( this . config . clientSecret ) {
105+ list . push ( CxConstants . CLIENT_SECRET ) ;
106+ list . push ( this . config . clientSecret ) ;
107+ }
108+ if ( this . config . apiKey ) {
109+ list . push ( CxConstants . API_KEY ) ;
110+ list . push ( this . config . apiKey ) ;
111+ }
112+ if ( this . config . baseUri ) {
113+ list . push ( CxConstants . BASE_URI ) ;
114+ list . push ( this . config . baseUri ) ;
115+ }
116+ if ( this . config . baseAuthUri ) {
117+ list . push ( CxConstants . BASE_AUTH_URI ) ;
118+ list . push ( this . config . baseAuthUri ) ;
119+ }
120+ if ( this . config . tenant ) {
121+ list . push ( CxConstants . TENANT ) ;
122+ list . push ( this . config . tenant ) ;
123+ }
124+ if ( this . config . additionalParameters ) {
125+ this . prepareAdditionalParams ( this . config . additionalParameters ) . forEach ( function ( param ) {
126+ list . push ( param )
127+ } )
128+ }
129+ if ( formatRequired ) {
130+ list . push ( CxConstants . OUTPUT_FORMAT ) ;
131+ list . push ( CxConstants . FORMAT_JSON ) ;
132+ }
133+ return list ;
134+ }
135+
97136 async authValidate ( ) : Promise < CxCommandOutput > {
98137 const commands : string [ ] = [ CxConstants . CMD_AUTH , CxConstants . SUB_CMD_VALIDATE ] ;
99138 commands . push ( ...this . initializeCommands ( false ) ) ;
@@ -169,6 +208,18 @@ export class CxWrapper {
169208 return await exec . executeCommands ( this . config . pathToExecutable , commands , CxConstants . SCAN_TYPE ) ;
170209 }
171210
211+
212+ async engineList ( engineName :string ) :Promise < CxCommandOutput > {
213+ const commands :string [ ] = [ CxConstants . CMD_ENGINE , "list-api" ]
214+ if ( engineName != "" ) {
215+ commands . push ( CxConstants . FLAG_ENGINE_NAME ) ;
216+ commands . push ( engineName )
217+ }
218+ commands . push ( ...this . initializeCommandsEngine ( true ) ) ;
219+ const exec = new ExecutionService ( ) ;
220+ return await exec . executeCommands ( this . config . pathToExecutable , commands ) ;
221+ }
222+
172223 async projectList ( filters : string ) : Promise < CxCommandOutput > {
173224 const validated_filters = this . filterArguments ( filters ) ;
174225 const commands : string [ ] = [ CxConstants . CMD_PROJECT , "list" ] . concat ( validated_filters ) ;
0 commit comments