use of com.sequenceiq.cloudbreak.util.PermanentlyFailedException in project cloudbreak by hortonworks.
the class CloudParameterService method getCloudAccessConfigs.
@Retryable(value = GetCloudParameterException.class, maxAttempts = 5, backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000))
public CloudAccessConfigs getCloudAccessConfigs(ExtendedCloudCredential cloudCredential, String region, String variant, Map<String, String> filters) {
LOGGER.debug("Get platform accessConfigs");
GetPlatformCloudAccessConfigsRequest getPlatformCloudAccessConfigsRequest = new GetPlatformCloudAccessConfigsRequest(cloudCredential, cloudCredential, variant, region, filters);
eventBus.notify(getPlatformCloudAccessConfigsRequest.selector(), Event.wrap(getPlatformCloudAccessConfigsRequest));
try {
GetPlatformCloudAccessConfigsResult res = getPlatformCloudAccessConfigsRequest.await();
LOGGER.debug("Platform accessConfigs result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.debug("Failed to get platform accessConfigs, retry again", res.getErrorDetails());
throw new GetCloudParameterException("Failed to get access configs for the cloud provider. " + getCauseMessages(res.getErrorDetails()), res.getErrorDetails());
}
if (res.getStatus().equals(EventStatus.PERMANENTLY_FAILED)) {
LOGGER.debug("Failed to get platform accessConfigs", res.getErrorDetails());
throw new PermanentlyFailedException(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.util.PermanentlyFailedException in project cloudbreak by hortonworks.
the class GetPlatformSecurityGroupsHandler method accept.
@Override
public void accept(Event<GetPlatformSecurityGroupsRequest> getPlatformSecurityGroupsRequest) {
LOGGER.debug("Received event: {}", getPlatformSecurityGroupsRequest);
GetPlatformSecurityGroupsRequest request = getPlatformSecurityGroupsRequest.getData();
try {
CloudPlatformVariant cloudPlatformVariant = new CloudPlatformVariant(Platform.platform(request.getExtendedCloudCredential().getCloudPlatform()), Variant.variant(request.getVariant()));
CloudSecurityGroups securityGroups = cloudPlatformConnectors.get(cloudPlatformVariant).platformResources().securityGroups(request.getExtendedCloudCredential(), Region.region(request.getRegion()), request.getFilters());
GetPlatformSecurityGroupsResult getPlatformSecurityGroupsResult = new GetPlatformSecurityGroupsResult(request.getResourceId(), securityGroups);
request.getResult().onNext(getPlatformSecurityGroupsResult);
LOGGER.debug("Query platform networks types finished.");
} catch (PermanentlyFailedException e) {
request.getResult().onNext(new GetPlatformSecurityGroupsResult(EventStatus.PERMANENTLY_FAILED, e.getMessage(), e, request.getResourceId()));
} catch (Exception e) {
request.getResult().onNext(new GetPlatformSecurityGroupsResult(e.getMessage(), e, request.getResourceId()));
}
}
Aggregations