Search in sources :

Example 1 with Variant

use of com.sequenceiq.cloudbreak.cloud.model.Variant in project cloudbreak by hortonworks.

the class CloudPlatformConnectors method cloudPlatformConnectors.

@PostConstruct
public void cloudPlatformConnectors() {
    platformToVariants = HashMultimap.create();
    for (CloudConnector connector : cloudConnectors) {
        map.put(new CloudPlatformVariant(connector.platform(), connector.variant()), connector);
        platformToVariants.put(connector.platform(), connector.variant());
    }
    Map<Platform, Variant> environmentDefaults = extractEnvironmentDefaultVariants();
    setupDefaultVariants(platformToVariants, environmentDefaults);
    LOGGER.debug(map.toString());
    LOGGER.debug(defaultVariants.toString());
}
Also used : Variant(com.sequenceiq.cloudbreak.cloud.model.Variant) CloudPlatformVariant(com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant) CloudConnector(com.sequenceiq.cloudbreak.cloud.CloudConnector) Platform(com.sequenceiq.cloudbreak.cloud.model.Platform) CloudPlatformVariant(com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant) PostConstruct(javax.annotation.PostConstruct)

Example 2 with Variant

use of com.sequenceiq.cloudbreak.cloud.model.Variant in project cloudbreak by hortonworks.

the class CheckPlatformVariantHandler method accept.

@Override
public void accept(Event<CheckPlatformVariantRequest> defaultPlatformVariantRequestEvent) {
    LOGGER.info("Received event: {}", defaultPlatformVariantRequestEvent);
    CheckPlatformVariantRequest request = defaultPlatformVariantRequestEvent.getData();
    try {
        CloudConnector cc = cloudPlatformConnectors.get(request.getCloudContext().getPlatform(), request.getCloudContext().getVariant());
        Variant defaultVariant = cc.variant();
        CheckPlatformVariantResult platformParameterResult = new CheckPlatformVariantResult(request, defaultVariant);
        request.getResult().onNext(platformParameterResult);
        LOGGER.info("Query platform variant finished.");
    } catch (RuntimeException e) {
        request.getResult().onNext(new CheckPlatformVariantResult(e.getMessage(), e, request));
    }
}
Also used : Variant(com.sequenceiq.cloudbreak.cloud.model.Variant) CloudConnector(com.sequenceiq.cloudbreak.cloud.CloudConnector) CheckPlatformVariantRequest(com.sequenceiq.cloudbreak.cloud.event.platform.CheckPlatformVariantRequest) CheckPlatformVariantResult(com.sequenceiq.cloudbreak.cloud.event.platform.CheckPlatformVariantResult)

Aggregations

CloudConnector (com.sequenceiq.cloudbreak.cloud.CloudConnector)2 Variant (com.sequenceiq.cloudbreak.cloud.model.Variant)2 CheckPlatformVariantRequest (com.sequenceiq.cloudbreak.cloud.event.platform.CheckPlatformVariantRequest)1 CheckPlatformVariantResult (com.sequenceiq.cloudbreak.cloud.event.platform.CheckPlatformVariantResult)1 CloudPlatformVariant (com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant)1 Platform (com.sequenceiq.cloudbreak.cloud.model.Platform)1 PostConstruct (javax.annotation.PostConstruct)1