use of com.sequenceiq.cloudbreak.cloud.model.PlatformOrchestrators in project cloudbreak by hortonworks.
the class StackDecorator method prepareOrchestratorIfNotExist.
private void prepareOrchestratorIfNotExist(Stack subject, Credential credential) {
if (subject.getOrchestrator() == null) {
PlatformOrchestrators orchestrators = cloudParameterService.getOrchestrators();
Orchestrator orchestrator = orchestrators.getDefaults().get(Platform.platform(credential.cloudPlatform()));
com.sequenceiq.cloudbreak.domain.Orchestrator orchestratorObject = new com.sequenceiq.cloudbreak.domain.Orchestrator();
orchestratorObject.setType(orchestrator.value());
subject.setOrchestrator(orchestratorObject);
}
}
use of com.sequenceiq.cloudbreak.cloud.model.PlatformOrchestrators in project cloudbreak by hortonworks.
the class PlatformParameterV1Controller method getOchestratorsByType.
@Override
public Collection<String> getOchestratorsByType(String type) {
PlatformOrchestrators orchestrators = cloudParameterService.getOrchestrators();
Collection<String> strings = conversionService.convert(orchestrators, PlatformOrchestratorsJson.class).getOrchestrators().get(type.toUpperCase());
return strings == null ? new ArrayList<>() : strings;
}
use of com.sequenceiq.cloudbreak.cloud.model.PlatformOrchestrators 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.cloud.model.PlatformOrchestrators in project cloudbreak by hortonworks.
the class GetPlatformOrchestratorsHandler method accept.
@Override
public void accept(Event<GetPlatformOrchestratorsRequest> getPlatformOrchestratorsRequest) {
LOGGER.info("Received event: {}", getPlatformOrchestratorsRequest);
GetPlatformOrchestratorsRequest request = getPlatformOrchestratorsRequest.getData();
try {
Map<Platform, Collection<Orchestrator>> platformCollectionHashMap = Maps.newHashMap();
Map<Platform, Orchestrator> defaults = Maps.newHashMap();
for (Entry<Platform, Collection<Variant>> connector : cloudPlatformConnectors.getPlatformVariants().getPlatformToVariants().entrySet()) {
PlatformOrchestrator platformOrchestrator = cloudPlatformConnectors.getDefault(connector.getKey()).parameters().orchestratorParams();
platformCollectionHashMap.put(connector.getKey(), platformOrchestrator.types());
defaults.put(connector.getKey(), platformOrchestrator.defaultType());
}
GetPlatformOrchestratorsResult getPlatformOrchestratorsResult = new GetPlatformOrchestratorsResult(request, new PlatformOrchestrators(platformCollectionHashMap, defaults));
request.getResult().onNext(getPlatformOrchestratorsResult);
LOGGER.info("Query platform orchestrators types finished.");
} catch (RuntimeException e) {
request.getResult().onNext(new GetPlatformOrchestratorsResult(e.getMessage(), e, request));
}
}
Aggregations