22
33import com .checkmarx .ast .asca .ScanResult ;
44import com .checkmarx .ast .codebashing .CodeBashing ;
5+ import com .checkmarx .ast .engines .Engines ;
56import com .checkmarx .ast .kicsRealtimeResults .KicsRealtimeResults ;
67import com .checkmarx .ast .learnMore .LearnMore ;
78import com .checkmarx .ast .predicate .CustomState ;
@@ -512,6 +513,15 @@ private List<String> jsonArguments() {
512513 return arguments ;
513514 }
514515
516+ private List <String > jsonArguments2 () {
517+ List <String > arguments = new ArrayList <>();
518+
519+ arguments .add (CxConstants .OUTPUT_FORMAT );
520+ arguments .add (CxConstants .FORMAT_JSON );
521+
522+ return arguments ;
523+ }
524+
515525 private List <String > filterArguments (String filter ) {
516526 List <String > arguments = new ArrayList <>();
517527
@@ -522,4 +532,27 @@ private List<String> filterArguments(String filter) {
522532
523533 return arguments ;
524534 }
525- }
535+
536+ private List <String > engineFilterArguments (String filter ) {
537+ List <String > arguments = new ArrayList <>();
538+
539+ if (StringUtils .isNotBlank (filter )) {
540+ arguments .add (CxConstants .ENGINE_NAME_FILTER );
541+ arguments .add (filter );
542+ }
543+
544+ return arguments ;
545+ }
546+
547+ public Engines listApi (String filter ) throws IOException , InterruptedException , CxException {
548+ this .logger .info ("Fetching the api list using the filter: {}" , filter );
549+
550+ List <String > arguments = new ArrayList <>();
551+ arguments .add (CxConstants .CMD_ENGINES );
552+ arguments .add (CxConstants .SUB_CMD_LIST_API );
553+ arguments .addAll (engineFilterArguments (filter ));
554+ arguments .addAll (jsonArguments2 ());
555+
556+ return Execution .executeCommand (withConfigArguments (arguments ), logger , Engines ::fromLine );
557+ }
558+ }
0 commit comments