use of com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformVariantsRequest 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));
}
}
use of com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformVariantsRequest 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);
}
}
Aggregations