use of com.sequenceiq.cloudbreak.cloud.event.platform.GetDiskTypesResult in project cloudbreak by hortonworks.
the class CloudParameterService method getDiskTypes.
public PlatformDisks getDiskTypes() {
LOGGER.debug("Get platform disktypes");
GetDiskTypesRequest getDiskTypesRequest = new GetDiskTypesRequest();
eventBus.notify(getDiskTypesRequest.selector(), eventFactory.createEvent(getDiskTypesRequest));
try {
GetDiskTypesResult res = getDiskTypesRequest.await();
LOGGER.info("Platform disk types result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.error("Failed to get platform disk types", res.getErrorDetails());
throw new OperationException(res.getErrorDetails());
}
return res.getPlatformDisks();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform disk types", e);
throw new OperationException(e);
}
}
use of com.sequenceiq.cloudbreak.cloud.event.platform.GetDiskTypesResult in project cloudbreak by hortonworks.
the class GetDiskTypesHandler method accept.
@Override
public void accept(Event<GetDiskTypesRequest> getDiskTypesRequestEvent) {
LOGGER.info("Received event: {}", getDiskTypesRequestEvent);
GetDiskTypesRequest request = getDiskTypesRequestEvent.getData();
try {
Map<Platform, Collection<DiskType>> platformDiskTypes = Maps.newHashMap();
Map<Platform, DiskType> defaultDiskTypes = Maps.newHashMap();
Map<Platform, Map<String, VolumeParameterType>> diskMappings = Maps.newHashMap();
Map<Platform, Map<DiskType, DisplayName>> diskDisplayNames = Maps.newHashMap();
for (Entry<Platform, Collection<Variant>> connector : cloudPlatformConnectors.getPlatformVariants().getPlatformToVariants().entrySet()) {
DiskTypes diskTypes = cloudPlatformConnectors.getDefault(connector.getKey()).parameters().diskTypes();
defaultDiskTypes.put(connector.getKey(), diskTypes.defaultType());
platformDiskTypes.put(connector.getKey(), diskTypes.types());
diskMappings.put(connector.getKey(), diskTypes.diskMapping());
diskDisplayNames.put(connector.getKey(), diskTypes.displayNames());
}
GetDiskTypesResult getDiskTypesResult = new GetDiskTypesResult(request, new PlatformDisks(platformDiskTypes, defaultDiskTypes, diskMappings, diskDisplayNames));
request.getResult().onNext(getDiskTypesResult);
LOGGER.info("Query platform disk types finished.");
} catch (RuntimeException e) {
request.getResult().onNext(new GetDiskTypesResult(e.getMessage(), e, request));
}
}
Aggregations