use of com.sequenceiq.cloudbreak.api.model.SpecialParameters 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;
}
use of com.sequenceiq.cloudbreak.api.model.SpecialParameters in project cloudbreak by hortonworks.
the class PlatformParameterV1Controller method getSpecialProperties.
@Override
public SpecialParametersJson getSpecialProperties() {
SpecialParameters specialParameters = cloudParameterService.getSpecialParameters();
Map<Platform, PlatformParameters> platformParameters = cloudParameterService.getPlatformParameters();
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);
return specialParametersJson;
}
use of com.sequenceiq.cloudbreak.api.model.SpecialParameters in project cloudbreak by hortonworks.
the class StackValidationRequestToStackValidationConverter method validateNetwork.
private void validateNetwork(Long networkId, NetworkRequest networkRequest, StackValidation stackValidation) {
SpecialParameters specialParameters = cloudParameterCache.getPlatformParameters().get(Platform.platform(stackValidation.getCredential().cloudPlatform())).specialParameters();
if (networkId != null) {
Network network = networkService.get(networkId);
stackValidation.setNetwork(network);
} else if (networkRequest != null) {
Network network = conversionService.convert(networkRequest, Network.class);
stackValidation.setNetwork(network);
} else if (specialParameters.getSpecialParameters().get(PlatformParametersConsts.NETWORK_IS_MANDATORY)) {
throw new BadRequestException("Network is not configured for the validation request!");
}
}
use of com.sequenceiq.cloudbreak.api.model.SpecialParameters in project cloudbreak by hortonworks.
the class PlatformParametersToSpecialParametersJsonConverter method convert.
@Override
public Map<String, Map<String, Boolean>> convert(Map<Platform, PlatformParameters> source) {
Map<String, Map<String, Boolean>> specialParameters = new HashMap<>();
source.keySet().forEach(p -> {
SpecialParameters sp = source.get(p).specialParameters();
specialParameters.put(p.value(), sp.getSpecialParameters());
});
return specialParameters;
}
Aggregations