use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.VmTypeV4Response in project cloudbreak by hortonworks.
the class PlatformRecommendationToPlatformRecommendationV4ResponseConverter method convert.
public RecommendationV4Response convert(PlatformRecommendation source) {
Map<String, VmTypeV4Response> result = new HashMap<>();
source.getRecommendations().forEach((hostGroupName, vm) -> result.put(hostGroupName, vmTypeToVmTypeV4ResponseConverter.convert(vm)));
Set<VmTypeV4Response> vmTypes = source.getVirtualMachines().stream().map(vmType -> vmTypeToVmTypeV4ResponseConverter.convert(vmType)).collect(Collectors.toSet());
Set<DiskV4Response> 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())) {
DiskV4Response diskResponse = new DiskV4Response(diskTypeDisplayName.getKey().value(), volumeParameterType.getValue().name(), diskTypeDisplayName.getValue().value());
diskResponses.add(diskResponse);
}
}
}
Map<String, InstanceCountV4Response> instanceCounts = new TreeMap<>();
source.getInstanceCounts().forEach((hostGroupName, instanceCount) -> instanceCounts.put(hostGroupName, new InstanceCountV4Response(instanceCount.getMinimumCount(), instanceCount.getMaximumCount())));
GatewayRecommendationV4Response gateway = new GatewayRecommendationV4Response(source.getGatewayRecommendation().getHostGroups());
AutoscaleRecommendationV4Response autoscaleRecommendation = new AutoscaleRecommendationV4Response(source.getAutoscaleRecommendation().getTimeBasedHostGroups(), source.getAutoscaleRecommendation().getLoadBasedHostGroups());
ResizeRecommendationV4Response resizeRecommendation = new ResizeRecommendationV4Response(source.getResizeRecommendation().getScaleUpHostGroups(), source.getResizeRecommendation().getScaleDownHostGroups());
return new RecommendationV4Response(result, vmTypes, diskResponses, instanceCounts, gateway, autoscaleRecommendation, resizeRecommendation);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.VmTypeV4Response in project cloudbreak by hortonworks.
the class VmTypeToVmTypeV4ResponseConverter method convert.
public VmTypeV4Response convert(VmType source) {
VmTypeV4Response vmTypeV4Response = new VmTypeV4Response();
List<VolumeParameterConfigV4Response> configs = new ArrayList<>();
convertVolumeConfig(configs, source.getMetaData().getAutoAttachedConfig());
convertVolumeConfig(configs, source.getMetaData().getEphemeralConfig());
convertVolumeConfig(configs, source.getMetaData().getMagneticConfig());
convertVolumeConfig(configs, source.getMetaData().getSsdConfig());
convertVolumeConfig(configs, source.getMetaData().getSt1Config());
VmTypeMetaJson vmTypeMetaJson = new VmTypeMetaJson();
vmTypeMetaJson.setProperties(source.getMetaData().getProperties());
vmTypeMetaJson.setConfigs(configs);
vmTypeV4Response.setVmTypeMetaJson(vmTypeMetaJson);
vmTypeV4Response.setValue(source.value());
return vmTypeV4Response;
}
Aggregations