use of com.sequenceiq.cloudbreak.cloud.model.PlatformVariants in project cloudbreak by hortonworks.
the class GetPlatformVariantsHandler method accept.
@Override
public void accept(Event<GetPlatformVariantsRequest> getPlatformVariantsRequestEvent) {
LOGGER.info("Received event: {}", getPlatformVariantsRequestEvent);
GetPlatformVariantsRequest request = getPlatformVariantsRequestEvent.getData();
try {
PlatformVariants pv = cloudPlatformConnectors.getPlatformVariants();
GetPlatformVariantsResult platformVariantResult = new GetPlatformVariantsResult(request, pv);
request.getResult().onNext(platformVariantResult);
LOGGER.info("Query platform variant finished.");
} catch (RuntimeException e) {
request.getResult().onNext(new GetPlatformVariantsResult(e.getMessage(), e, request));
}
}
use of com.sequenceiq.cloudbreak.cloud.model.PlatformVariants in project cloudbreak by hortonworks.
the class PlatformParameterV1Controller method getPlatformVariantByType.
@Override
public Collection<String> getPlatformVariantByType(String type) {
PlatformVariants pv = cloudParameterService.getPlatformVariants();
Collection<String> strings = conversionService.convert(pv, PlatformVariantsJson.class).getPlatformToVariants().get(type.toUpperCase());
return strings == null ? new ArrayList<>() : strings;
}
use of com.sequenceiq.cloudbreak.cloud.model.PlatformVariants in project cloudbreak by hortonworks.
the class PlatformParameterV1Controller method getPlatforms.
@Override
public Map<String, Object> getPlatforms(Boolean extended) {
PlatformVariants pv = cloudParameterService.getPlatformVariants();
PlatformDisks diskTypes = cloudParameterService.getDiskTypes();
PlatformRegions regions = cloudParameterService.getRegions();
PlatformVirtualMachines vmtypes = new PlatformVirtualMachines();
PlatformOrchestrators orchestrators = cloudParameterService.getOrchestrators();
Map<Platform, PlatformParameters> platformParameters = cloudParameterService.getPlatformParameters();
SpecialParameters specialParameters = cloudParameterService.getSpecialParameters();
Map<String, Object> map = new HashMap<>();
map.put("variants", conversionService.convert(pv, PlatformVariantsJson.class));
map.put("disks", conversionService.convert(diskTypes, PlatformDisksJson.class));
map.put("regions", conversionService.convert(regions, PlatformRegionsJson.class));
map.put("virtualMachines", conversionService.convert(vmtypes, PlatformVirtualMachinesJson.class));
map.put("orchestrators", conversionService.convert(orchestrators, PlatformOrchestratorsJson.class));
map.put("tagspecifications", conversionService.convert(platformParameters, TagSpecificationsJson.class));
Map<String, Boolean> globalParameters = conversionService.convert(specialParameters, Map.class);
Map<String, Map<String, Boolean>> platformSpecificParameters = conversionService.convert(platformParameters, Map.class);
SpecialParametersJson specialParametersJson = new SpecialParametersJson();
specialParametersJson.setSpecialParameters(globalParameters);
specialParametersJson.setPlatformSpecificSpecialParameters(platformSpecificParameters);
map.put("specialParameters", specialParametersJson);
return map;
}
Aggregations