use of com.sequenceiq.cloudbreak.service.OperationException 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.service.OperationException in project cloudbreak by hortonworks.
the class CloudParameterService method getRegionsV2.
@Retryable(value = GetCloudParameterException.class, maxAttempts = 5, backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000))
public CloudRegions getRegionsV2(ExtendedCloudCredential cloudCredential, String region, String variant, Map<String, String> filters, boolean availabilityZonesNeeded) {
LOGGER.debug("Get platform regions");
GetPlatformRegionsRequestV2 getPlatformRegionsRequest = new GetPlatformRegionsRequestV2(cloudCredential, cloudCredential, variant, region, filters, availabilityZonesNeeded);
eventBus.notify(getPlatformRegionsRequest.selector(), Event.wrap(getPlatformRegionsRequest));
try {
GetPlatformRegionsResultV2 res = getPlatformRegionsRequest.await();
LOGGER.debug("Platform regions result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.debug("Failed to get platform regions", res.getErrorDetails());
throw new GetCloudParameterException("Failed to get regions from the cloud provider due to network issues or invalid credential. " + getCauseMessages(res.getErrorDetails()), res.getErrorDetails());
}
return res.getCloudRegions();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform regions", e);
throw new OperationException(e);
}
}
use of com.sequenceiq.cloudbreak.service.OperationException in project cloudbreak by hortonworks.
the class CloudParameterService method getRegions.
@Retryable(value = GetCloudParameterException.class, maxAttempts = 5, backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000))
public PlatformRegions getRegions() {
LOGGER.debug("Get platform regions");
GetPlatformRegionsRequest getPlatformRegionsRequest = new GetPlatformRegionsRequest();
eventBus.notify(getPlatformRegionsRequest.selector(), eventFactory.createEvent(getPlatformRegionsRequest));
try {
GetPlatformRegionsResult res = getPlatformRegionsRequest.await();
LOGGER.debug("Platform regions result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.debug("Failed to get platform regions", res.getErrorDetails());
throw new GetCloudParameterException(getCauseMessages(res.getErrorDetails()), res.getErrorDetails());
}
return res.getPlatformRegions();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform regions", e);
throw new OperationException(e);
}
}
use of com.sequenceiq.cloudbreak.service.OperationException in project cloudbreak by hortonworks.
the class CloudParameterService method getCloudNetworks.
@Retryable(value = GetCloudParameterException.class, maxAttempts = 5, backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000))
public CloudNetworks getCloudNetworks(ExtendedCloudCredential cloudCredential, String region, String variant, Map<String, String> filters) {
LOGGER.debug("Get platform cloudnetworks");
GetPlatformNetworksRequest getPlatformNetworksRequest = new GetPlatformNetworksRequest(cloudCredential, cloudCredential, variant, region, filters);
eventBus.notify(getPlatformNetworksRequest.selector(), eventFactory.createEvent(getPlatformNetworksRequest));
try {
GetPlatformNetworksResult res = getPlatformNetworksRequest.await();
LOGGER.debug("Platform networks types result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.debug("Failed to get platform networks", res.getErrorDetails());
throw new GetCloudParameterException("Failed to get networks for the cloud provider. " + getCauseMessages(res.getErrorDetails()), res.getErrorDetails());
}
return res.getCloudNetworks();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform networks", e);
throw new OperationException(e);
}
}
use of com.sequenceiq.cloudbreak.service.OperationException in project cloudbreak by hortonworks.
the class CloudParameterService method getCloudEncryptionKeys.
@Retryable(value = GetCloudParameterException.class, maxAttempts = 5, backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000))
public CloudEncryptionKeys getCloudEncryptionKeys(ExtendedCloudCredential cloudCredential, String region, String variant, Map<String, String> filters) {
LOGGER.debug("Get platform encryptionKeys");
GetPlatformEncryptionKeysRequest getPlatformEncryptionKeysRequest = new GetPlatformEncryptionKeysRequest(cloudCredential, cloudCredential, variant, region, filters);
eventBus.notify(getPlatformEncryptionKeysRequest.selector(), Event.wrap(getPlatformEncryptionKeysRequest));
try {
GetPlatformEncryptionKeysResult res = getPlatformEncryptionKeysRequest.await();
LOGGER.debug("Platform encryptionKeys result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.debug("Failed to get platform encryptionKeys", res.getErrorDetails());
throw new GetCloudParameterException("Failed to get encryption keys for the cloud provider. " + getCauseMessages(res.getErrorDetails()), res.getErrorDetails());
}
return res.getCloudEncryptionKeys();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform encryptionKeys", e);
throw new OperationException(e);
}
}
Aggregations