use of com.sequenceiq.cloudbreak.api.model.DiskResponse in project cloudbreak by hortonworks.
the class PlatformRecommendationToPlatformRecommendationResponseConverter method convert.
@Override
public RecommendationResponse convert(PlatformRecommendation source) {
Map<String, VmTypeJson> result = new HashMap<>();
source.getRecommendations().forEach((hostGroupName, vm) -> result.put(hostGroupName, getConversionService().convert(vm, VmTypeJson.class)));
Set<VmTypeJson> vmTypes = source.getVirtualMachines().stream().map(vmType -> getConversionService().convert(vmType, VmTypeJson.class)).collect(Collectors.toSet());
Set<DiskResponse> diskResponses = new HashSet<>();
for (Entry<DiskType, DisplayName> diskTypeDisplayName : source.getDiskTypes().displayNames().entrySet()) {
for (Entry<String, VolumeParameterType> volumeParameterType : source.getDiskTypes().diskMapping().entrySet()) {
if (diskTypeDisplayName.getKey().value().equals(volumeParameterType.getKey())) {
DiskResponse diskResponse = new DiskResponse(diskTypeDisplayName.getKey().value(), volumeParameterType.getValue().name(), diskTypeDisplayName.getValue().value());
diskResponses.add(diskResponse);
}
}
}
return new RecommendationResponse(result, vmTypes, diskResponses);
}
Aggregations