use of com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformInstanceGroupParameterResult in project cloudbreak by hortonworks.
the class GetPlatformInstanceGroupParametersHandler method accept.
@Override
public void accept(Event<GetPlatformInstanceGroupParameterRequest> getPlatformInstanceGroupParameterRequestEvent) {
LOGGER.info("Received event: {}", getPlatformInstanceGroupParameterRequestEvent);
GetPlatformInstanceGroupParameterRequest request = getPlatformInstanceGroupParameterRequestEvent.getData();
try {
CloudPlatformVariant variant = new CloudPlatformVariant(platform(request.getExtendedCloudCredential().getCloudPlatform()), variant(request.getVariant()));
Map<String, InstanceGroupParameterResponse> instanceGroupParameterResponses = cloudPlatformConnectors.get(variant).parameters().collectInstanceGroupParameters(request.getInstanceGroupParameterRequest());
GetPlatformInstanceGroupParameterResult getPlatformInstanceGroupParameterResult = new GetPlatformInstanceGroupParameterResult(request, instanceGroupParameterResponses);
request.getResult().onNext(getPlatformInstanceGroupParameterResult);
LOGGER.info("Query platform instance group parameters finished.");
} catch (Exception e) {
request.getResult().onNext(new GetPlatformInstanceGroupParameterResult(e.getMessage(), e, request));
}
}
use of com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformInstanceGroupParameterResult in project cloudbreak by hortonworks.
the class CloudParameterService method getInstanceGroupParameters.
public Map<String, InstanceGroupParameterResponse> getInstanceGroupParameters(Credential credential, Set<InstanceGroupParameterRequest> instanceGroups) {
LOGGER.debug("Get platform getInstanceGroupParameters");
ExtendedCloudCredential cloudCredential = credentialToExtendedCloudCredentialConverter.convert(credential);
GetPlatformInstanceGroupParameterRequest getPlatformInstanceGroupParameterRequest = new GetPlatformInstanceGroupParameterRequest(cloudCredential, cloudCredential, instanceGroups, null);
eventBus.notify(getPlatformInstanceGroupParameterRequest.selector(), Event.wrap(getPlatformInstanceGroupParameterRequest));
try {
GetPlatformInstanceGroupParameterResult res = getPlatformInstanceGroupParameterRequest.await();
LOGGER.info("Platform instanceGroupParameterResult result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.error("Failed to get platform instanceGroupParameterResult", res.getErrorDetails());
throw new GetCloudParameterException("Failed to instance group parameters for the cloud provider", res.getErrorDetails());
}
return res.getInstanceGroupParameterResponses();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform publicIpPools", e);
throw new OperationException(e);
}
}
Aggregations