Search in sources :

Example 1 with PlatformOrchestrators

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);
    }
}
Also used : PlatformOrchestrators(com.sequenceiq.cloudbreak.cloud.model.PlatformOrchestrators) Orchestrator(com.sequenceiq.cloudbreak.cloud.model.Orchestrator)

Example 2 with PlatformOrchestrators

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;
}
Also used : PlatformOrchestrators(com.sequenceiq.cloudbreak.cloud.model.PlatformOrchestrators)

Example 3 with PlatformOrchestrators

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;
}
Also used : PlatformRegions(com.sequenceiq.cloudbreak.cloud.model.PlatformRegions) Platform(com.sequenceiq.cloudbreak.cloud.model.Platform) HashMap(java.util.HashMap) PlatformRegionsJson(com.sequenceiq.cloudbreak.api.model.PlatformRegionsJson) PlatformDisks(com.sequenceiq.cloudbreak.cloud.model.PlatformDisks) PlatformVirtualMachines(com.sequenceiq.cloudbreak.cloud.model.PlatformVirtualMachines) PlatformVariantsJson(com.sequenceiq.cloudbreak.api.model.PlatformVariantsJson) SpecialParametersJson(com.sequenceiq.cloudbreak.api.model.SpecialParametersJson) SpecialParameters(com.sequenceiq.cloudbreak.api.model.SpecialParameters) PlatformOrchestratorsJson(com.sequenceiq.cloudbreak.api.model.PlatformOrchestratorsJson) TagSpecificationsJson(com.sequenceiq.cloudbreak.api.model.TagSpecificationsJson) PlatformDisksJson(com.sequenceiq.cloudbreak.api.model.PlatformDisksJson) PlatformVariants(com.sequenceiq.cloudbreak.cloud.model.PlatformVariants) PlatformParameters(com.sequenceiq.cloudbreak.cloud.PlatformParameters) PlatformOrchestrators(com.sequenceiq.cloudbreak.cloud.model.PlatformOrchestrators) PlatformVirtualMachinesJson(com.sequenceiq.cloudbreak.api.model.PlatformVirtualMachinesJson) HashMap(java.util.HashMap) Map(java.util.Map)

Example 4 with PlatformOrchestrators

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));
    }
}
Also used : Platform(com.sequenceiq.cloudbreak.cloud.model.Platform) PlatformOrchestrator(com.sequenceiq.cloudbreak.cloud.model.PlatformOrchestrator) Collection(java.util.Collection) PlatformOrchestrators(com.sequenceiq.cloudbreak.cloud.model.PlatformOrchestrators) GetPlatformOrchestratorsRequest(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformOrchestratorsRequest) GetPlatformOrchestratorsResult(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformOrchestratorsResult) Orchestrator(com.sequenceiq.cloudbreak.cloud.model.Orchestrator) PlatformOrchestrator(com.sequenceiq.cloudbreak.cloud.model.PlatformOrchestrator)

Aggregations

PlatformOrchestrators (com.sequenceiq.cloudbreak.cloud.model.PlatformOrchestrators)4 Orchestrator (com.sequenceiq.cloudbreak.cloud.model.Orchestrator)2 Platform (com.sequenceiq.cloudbreak.cloud.model.Platform)2 PlatformDisksJson (com.sequenceiq.cloudbreak.api.model.PlatformDisksJson)1 PlatformOrchestratorsJson (com.sequenceiq.cloudbreak.api.model.PlatformOrchestratorsJson)1 PlatformRegionsJson (com.sequenceiq.cloudbreak.api.model.PlatformRegionsJson)1 PlatformVariantsJson (com.sequenceiq.cloudbreak.api.model.PlatformVariantsJson)1 PlatformVirtualMachinesJson (com.sequenceiq.cloudbreak.api.model.PlatformVirtualMachinesJson)1 SpecialParameters (com.sequenceiq.cloudbreak.api.model.SpecialParameters)1 SpecialParametersJson (com.sequenceiq.cloudbreak.api.model.SpecialParametersJson)1 TagSpecificationsJson (com.sequenceiq.cloudbreak.api.model.TagSpecificationsJson)1 PlatformParameters (com.sequenceiq.cloudbreak.cloud.PlatformParameters)1 GetPlatformOrchestratorsRequest (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformOrchestratorsRequest)1 GetPlatformOrchestratorsResult (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformOrchestratorsResult)1 PlatformDisks (com.sequenceiq.cloudbreak.cloud.model.PlatformDisks)1 PlatformOrchestrator (com.sequenceiq.cloudbreak.cloud.model.PlatformOrchestrator)1 PlatformRegions (com.sequenceiq.cloudbreak.cloud.model.PlatformRegions)1 PlatformVariants (com.sequenceiq.cloudbreak.cloud.model.PlatformVariants)1 PlatformVirtualMachines (com.sequenceiq.cloudbreak.cloud.model.PlatformVirtualMachines)1 Collection (java.util.Collection)1