Search in sources :

Example 1 with GetPlatformVariantsResult

use of com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformVariantsResult 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));
    }
}
Also used : GetPlatformVariantsResult(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformVariantsResult) GetPlatformVariantsRequest(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformVariantsRequest) PlatformVariants(com.sequenceiq.cloudbreak.cloud.model.PlatformVariants)

Example 2 with GetPlatformVariantsResult

use of com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformVariantsResult in project cloudbreak by hortonworks.

the class CloudParameterService method getPlatformVariants.

public PlatformVariants getPlatformVariants() {
    LOGGER.debug("Get platform variants");
    GetPlatformVariantsRequest getPlatformVariantsRequest = new GetPlatformVariantsRequest();
    eventBus.notify(getPlatformVariantsRequest.selector(), eventFactory.createEvent(getPlatformVariantsRequest));
    try {
        GetPlatformVariantsResult res = getPlatformVariantsRequest.await();
        LOGGER.info("Platform variants result: {}", res);
        if (res.getStatus().equals(EventStatus.FAILED)) {
            LOGGER.error("Failed to get platform variants", res.getErrorDetails());
            throw new OperationException(res.getErrorDetails());
        }
        return res.getPlatformVariants();
    } catch (InterruptedException e) {
        LOGGER.error("Error while getting the platform variants", e);
        throw new OperationException(e);
    }
}
Also used : GetPlatformVariantsResult(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformVariantsResult) GetPlatformVariantsRequest(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformVariantsRequest) OperationException(com.sequenceiq.cloudbreak.service.stack.connector.OperationException)

Aggregations

GetPlatformVariantsRequest (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformVariantsRequest)2 GetPlatformVariantsResult (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformVariantsResult)2 PlatformVariants (com.sequenceiq.cloudbreak.cloud.model.PlatformVariants)1 OperationException (com.sequenceiq.cloudbreak.service.stack.connector.OperationException)1