use of com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformPrivateDnsZonesResult in project cloudbreak by hortonworks.
the class CloudParameterService method getPrivateDnsZones.
@Retryable(value = GetCloudParameterException.class, maxAttempts = 5, backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000))
public CloudPrivateDnsZones getPrivateDnsZones(ExtendedCloudCredential cloudCredential, String platformVariant, Map<String, String> filters) {
LOGGER.debug("Get platform private DNS zones for credential: [{}]", cloudCredential.getName());
GetPlatformPrivateDnsZonesRequest request = new GetPlatformPrivateDnsZonesRequest(cloudCredential, cloudCredential, platformVariant, null);
eventBus.notify(request.selector(), Event.wrap(request));
try {
GetPlatformPrivateDnsZonesResult result = request.await();
LOGGER.debug("Platform PrivateDnsZonesResult result: {}", result);
if (result.getStatus().equals(EventStatus.FAILED)) {
LOGGER.debug("Failed to get platform PrivateDnsZonesResult", result.getErrorDetails());
throw new GetCloudParameterException(String.format("Failed to get private dns zones for the cloud provider: %s. %s", result.getStatusReason(), getCauseMessages(result.getErrorDetails())), result.getErrorDetails());
}
return result.getPrivateDnsZones();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform PrivateDnsZonesResult", e);
throw new OperationException(e);
}
}
use of com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformPrivateDnsZonesResult in project cloudbreak by hortonworks.
the class GetPlatformPrivateDnsZonesHandler method accept.
@Override
public void accept(Event<GetPlatformPrivateDnsZonesRequest> event) {
LOGGER.debug("Received event to retrieve private DNS zones: {}", event);
GetPlatformPrivateDnsZonesRequest request = event.getData();
try {
CloudPlatformVariant cloudPlatformVariant = new CloudPlatformVariant(Platform.platform(request.getExtendedCloudCredential().getCloudPlatform()), Variant.variant(request.getVariant()));
CloudPrivateDnsZones privateDnsZones = cloudPlatformConnectors.get(cloudPlatformVariant).platformResources().privateDnsZones(request.getExtendedCloudCredential(), request.getFilters());
GetPlatformPrivateDnsZonesResult result = new GetPlatformPrivateDnsZonesResult(request.getResourceId(), privateDnsZones);
request.getResult().onNext(result);
LOGGER.debug("Query platform private DNS zones finished.");
} catch (RuntimeException e) {
request.getResult().onNext(new GetPlatformPrivateDnsZonesResult(e.getMessage(), e, request.getResourceId()));
}
}
Aggregations