|
12 | 12 | import com.fasterxml.jackson.databind.ObjectMapper; |
13 | 13 | import com.fasterxml.jackson.databind.type.CollectionType; |
14 | 14 | import com.fasterxml.jackson.databind.type.TypeFactory; |
| 15 | +import jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode; |
15 | 16 | import lombok.NonNull; |
16 | 17 | import org.apache.commons.lang3.StringUtils; |
17 | 18 | import org.slf4j.Logger; |
18 | 19 | import org.slf4j.LoggerFactory; |
19 | 20 | import java.io.IOException; |
20 | 21 | import java.nio.file.Files; |
21 | | -import java.util.ArrayList; |
22 | | -import java.util.List; |
23 | | -import java.util.Map; |
24 | | -import java.util.UUID; |
| 22 | +import java.util.*; |
25 | 23 |
|
26 | 24 | public class CxWrapper { |
27 | 25 |
|
@@ -286,6 +284,22 @@ private List<String> buildResultsArgumentsArray(UUID scanId, ReportFormat report |
286 | 284 | return arguments; |
287 | 285 | } |
288 | 286 |
|
| 287 | + public String scaRemediation(String packageFile, String packages, String packageVersion) throws CxException, IOException, InterruptedException { |
| 288 | + List<String> arguments = new ArrayList<>(); |
| 289 | + arguments.add(CxConstants.CMD_UTILS); |
| 290 | + arguments.add(CxConstants.CMD_REMEDIATION); |
| 291 | + arguments.add(CxConstants.SUB_CMD_REMEDIATION_SCA); |
| 292 | + arguments.add(CxConstants.SCA_REMEDIATION_PACKAGE_FILE); |
| 293 | + arguments.add(packageFile); |
| 294 | + arguments.add(CxConstants.SCA_REMEDIATION_PACKAGE); |
| 295 | + arguments.add(packages); |
| 296 | + arguments.add(CxConstants.SCA_REMEDIATION_PACKAGE_VERSION); |
| 297 | + arguments.add(packageVersion); |
| 298 | + |
| 299 | + return Execution.executeCommand(withConfigArguments(arguments), logger, line -> null); |
| 300 | + |
| 301 | + } |
| 302 | + |
289 | 303 | public int getResultsBfl(@NonNull UUID scanId, @NonNull String queryId, List<Node> resultNodes) |
290 | 304 | throws IOException, InterruptedException, CxException { |
291 | 305 | this.logger.info("Executing 'results bfl' command using the CLI."); |
|
0 commit comments