use of com.mercedesbenz.sechub.commons.model.SecHubWebScanApiConfiguration in project sechub by mercedes-benz.
the class SecHubFileStructureDataProviderBuilder method build.
public SecHubFileStructureDataProvider build() {
if (scanType == null) {
throw new IllegalStateException("scanType is not set");
}
if (model == null) {
throw new IllegalStateException("model is not set");
}
MutableSecHubFileStructureDataProvider data = new MutableSecHubFileStructureDataProvider();
switch(scanType) {
case CODE_SCAN:
data.setRootFolderAccepted(true);
addAllUsages(data, model.getCodeScan(), false);
break;
case INFRA_SCAN:
break;
case LICENSE_SCAN:
addAllUsages(data, model.getLicenseScan(), true);
break;
case REPORT:
break;
case UNKNOWN:
break;
case WEB_SCAN:
Optional<SecHubWebScanConfiguration> webScanOpt = model.getWebScan();
if (!webScanOpt.isPresent()) {
throw new IllegalStateException("No webscan present but it is a " + scanType);
}
SecHubWebScanConfiguration webScan = webScanOpt.get();
Optional<SecHubWebScanApiConfiguration> apiOpt = webScan.getApi();
addAllUsages(data, apiOpt, false);
break;
default:
break;
}
return data;
}
Aggregations