use of com.sequenceiq.environment.api.v1.platformresource.model.VmTypeResponse in project cloudbreak by hortonworks.
the class VmTypeToVmTypeV1ResponseConverter method convert.
public VmTypeResponse convert(VmType source) {
VmTypeResponse vmTypeResponse = new VmTypeResponse();
List<VolumeParameterConfigResponse> 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);
vmTypeResponse.setVmTypeMetaJson(vmTypeMetaJson);
vmTypeResponse.setValue(source.value());
return vmTypeResponse;
}
use of com.sequenceiq.environment.api.v1.platformresource.model.VmTypeResponse in project cloudbreak by hortonworks.
the class SdxRecommendationServiceTest method createPlatformVmtypesResponse.
private PlatformVmtypesResponse createPlatformVmtypesResponse() {
Map<String, VirtualMachinesResponse> vmTypes = new HashMap<>();
VirtualMachinesResponse virtualMachinesResponse = new VirtualMachinesResponse();
Set<VmTypeResponse> virtualMachines = new HashSet<>();
virtualMachines.add(new VmTypeResponse("large", createVmTypeMetaJson(10, 1000.0F)));
virtualMachines.add(new VmTypeResponse("medium", createVmTypeMetaJson(8, 800.0F)));
virtualMachines.add(new VmTypeResponse("mediumv2", createVmTypeMetaJson(8, 1000.0F)));
virtualMachines.add(new VmTypeResponse("small", createVmTypeMetaJson(2, 200.0F)));
virtualMachinesResponse.setVirtualMachines(virtualMachines);
vmTypes.put("eu-central-1", virtualMachinesResponse);
return new PlatformVmtypesResponse(vmTypes);
}
use of com.sequenceiq.environment.api.v1.platformresource.model.VmTypeResponse in project cloudbreak by hortonworks.
the class SdxRecommendationService method getAvailableVmTypes.
private List<VmTypeResponse> getAvailableVmTypes(String credentialCrn, String cloudPlatform, String region, String availabilityZone) {
PlatformVmtypesResponse platformVmtypesResponse = environmentClientService.getVmTypesByCredential(credentialCrn, region, cloudPlatform, CdpResourceType.DATALAKE, availabilityZone);
Set<com.sequenceiq.environment.api.v1.platformresource.model.VmTypeResponse> vmTypes = Collections.emptySet();
if (platformVmtypesResponse.getVmTypes() != null && StringUtils.isNotBlank(availabilityZone)) {
vmTypes = platformVmtypesResponse.getVmTypes().get(availabilityZone).getVirtualMachines();
} else if (platformVmtypesResponse.getVmTypes() != null && !platformVmtypesResponse.getVmTypes().isEmpty()) {
vmTypes = platformVmtypesResponse.getVmTypes().values().iterator().next().getVirtualMachines();
}
return vmTypeConverter.convert(vmTypes);
}
use of com.sequenceiq.environment.api.v1.platformresource.model.VmTypeResponse in project cloudbreak by hortonworks.
the class CloudVmTypesToPlatformVmTypesV1ResponseConverter method convert.
public PlatformVmtypesResponse convert(CloudVmTypes source) {
Map<String, VirtualMachinesResponse> result = new HashMap<>();
for (Entry<String, Set<VmType>> entry : source.getCloudVmResponses().entrySet()) {
Set<VmTypeResponse> vmTypeRespons = new HashSet<>();
for (VmType vmType : entry.getValue()) {
vmTypeRespons.add(vmTypeToVmTypeV1ResponseConverter.convert(vmType));
}
VirtualMachinesResponse virtualMachinesResponse = new VirtualMachinesResponse();
VmType defaultVmType = source.getDefaultCloudVmResponses().get(entry.getKey());
if (defaultVmType != null) {
virtualMachinesResponse.setDefaultVirtualMachine(vmTypeToVmTypeV1ResponseConverter.convert(defaultVmType));
}
virtualMachinesResponse.setVirtualMachines(vmTypeRespons);
result.put(entry.getKey(), virtualMachinesResponse);
}
return new PlatformVmtypesResponse(result);
}
Aggregations