use of com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformCloudAccessConfigsResult in project cloudbreak by hortonworks.
the class CloudParameterService method getCloudAccessConfigs.
public CloudAccessConfigs getCloudAccessConfigs(Credential credential, String region, String variant, Map<String, String> filters) {
LOGGER.debug("Get platform accessConfigs");
ExtendedCloudCredential cloudCredential = credentialToExtendedCloudCredentialConverter.convert(credential);
GetPlatformCloudAccessConfigsRequest getPlatformCloudAccessConfigsRequest = new GetPlatformCloudAccessConfigsRequest(cloudCredential, cloudCredential, variant, region, filters);
eventBus.notify(getPlatformCloudAccessConfigsRequest.selector(), Event.wrap(getPlatformCloudAccessConfigsRequest));
try {
GetPlatformCloudAccessConfigsResult res = getPlatformCloudAccessConfigsRequest.await();
LOGGER.info("Platform accessConfigs result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.error("Failed to get platform accessConfigs", res.getErrorDetails());
throw new GetCloudParameterException("Failed to get access configs for the cloud provider", res.getErrorDetails());
}
return res.getCloudAccessConfigs();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform accessConfigs", e);
throw new OperationException(e);
}
}
use of com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformCloudAccessConfigsResult in project cloudbreak by hortonworks.
the class GetPlatformAccessConfigsHandler method accept.
@Override
public void accept(Event<GetPlatformCloudAccessConfigsRequest> getPlatformCloudAccessConfigsRequest) {
LOGGER.info("Received event: {}", getPlatformCloudAccessConfigsRequest);
GetPlatformCloudAccessConfigsRequest request = getPlatformCloudAccessConfigsRequest.getData();
try {
CloudPlatformVariant cloudPlatformVariant = new CloudPlatformVariant(Platform.platform(request.getExtendedCloudCredential().getCloudPlatform()), Variant.variant(request.getVariant()));
CloudAccessConfigs cloudAccessConfigs = cloudPlatformConnectors.get(cloudPlatformVariant).platformResources().accessConfigs(request.getCloudCredential(), Region.region(request.getRegion()), request.getFilters());
GetPlatformCloudAccessConfigsResult getPlatformCloudAccessConfigsResult = new GetPlatformCloudAccessConfigsResult(request, cloudAccessConfigs);
request.getResult().onNext(getPlatformCloudAccessConfigsResult);
LOGGER.info("Query platform access configs finished.");
} catch (Exception e) {
request.getResult().onNext(new GetPlatformCloudAccessConfigsResult(e.getMessage(), e, request));
}
}
Aggregations