use of com.sequenceiq.cloudbreak.service.OperationException in project cloudbreak by hortonworks.
the class CloudParameterService method getPlatformVariants.
@Retryable(value = GetCloudParameterException.class, maxAttempts = 5, backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000))
public PlatformVariants getPlatformVariants() {
LOGGER.debug("Get platform variants");
GetPlatformVariantsRequest getPlatformVariantsRequest = new GetPlatformVariantsRequest();
eventBus.notify(getPlatformVariantsRequest.selector(), eventFactory.createEvent(getPlatformVariantsRequest));
try {
GetPlatformVariantsResult res = getPlatformVariantsRequest.await();
LOGGER.debug("Platform variants result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.debug("Failed to get platform variants", res.getErrorDetails());
throw new GetCloudParameterException(getCauseMessages(res.getErrorDetails()), res.getErrorDetails());
}
return res.getPlatformVariants();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform variants", e);
throw new OperationException(e);
}
}
use of com.sequenceiq.cloudbreak.service.OperationException in project cloudbreak by hortonworks.
the class CloudParameterService method getRecommendation.
@Retryable(value = GetCloudParameterException.class, maxAttempts = 5, backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000))
public VmRecommendations getRecommendation(String platform) {
LOGGER.debug("Get platform vm recommendation");
GetVirtualMachineRecommendtaionRequest getVirtualMachineRecommendtaionRequest = new GetVirtualMachineRecommendtaionRequest(platform);
eventBus.notify(getVirtualMachineRecommendtaionRequest.selector(), eventFactory.createEvent(getVirtualMachineRecommendtaionRequest));
try {
GetVirtualMachineRecommendationResponse res = getVirtualMachineRecommendtaionRequest.await();
LOGGER.debug("Platform vm recommendation result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.debug("Failed to get platform vm recommendation", res.getErrorDetails());
throw new GetCloudParameterException(getCauseMessages(res.getErrorDetails()), res.getErrorDetails());
}
return res.getRecommendations();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform vm recommendation", e);
throw new OperationException(e);
}
}
use of com.sequenceiq.cloudbreak.service.OperationException in project cloudbreak by hortonworks.
the class CloudParameterService method getPublicIpPools.
@Retryable(value = GetCloudParameterException.class, maxAttempts = 5, backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000))
public CloudIpPools getPublicIpPools(ExtendedCloudCredential cloudCredential, String region, String variant, Map<String, String> filters) {
LOGGER.debug("Get platform publicIpPools");
GetPlatformCloudIpPoolsRequest getPlatformCloudIpPoolsRequest = new GetPlatformCloudIpPoolsRequest(cloudCredential, cloudCredential, variant, region, filters);
eventBus.notify(getPlatformCloudIpPoolsRequest.selector(), Event.wrap(getPlatformCloudIpPoolsRequest));
try {
GetPlatformCloudIpPoolsResult res = getPlatformCloudIpPoolsRequest.await();
LOGGER.debug("Platform publicIpPools result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.debug("Failed to get platform publicIpPools", res.getErrorDetails());
throw new GetCloudParameterException("Failed to get public IP pools for the cloud provider. " + getCauseMessages(res.getErrorDetails()), res.getErrorDetails());
}
return res.getCloudIpPools();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform publicIpPools", e);
throw new OperationException(e);
}
}
use of com.sequenceiq.cloudbreak.service.OperationException in project cloudbreak by hortonworks.
the class CloudParameterService method getGateways.
@Retryable(value = GetCloudParameterException.class, maxAttempts = 5, backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000))
public CloudGateWays getGateways(ExtendedCloudCredential cloudCredential, String region, String variant, Map<String, String> filters) {
LOGGER.debug("Get platform gateways");
GetPlatformCloudGatewaysRequest getPlatformCloudGatewaysRequest = new GetPlatformCloudGatewaysRequest(cloudCredential, cloudCredential, variant, region, filters);
eventBus.notify(getPlatformCloudGatewaysRequest.selector(), Event.wrap(getPlatformCloudGatewaysRequest));
try {
GetPlatformCloudGatewaysResult res = getPlatformCloudGatewaysRequest.await();
LOGGER.debug("Platform gateways result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.debug("Failed to get platform gateways", res.getErrorDetails());
throw new GetCloudParameterException("Failed to get gateways for the cloud provider. " + getCauseMessages(res.getErrorDetails()), res.getErrorDetails());
}
return res.getCloudGateWays();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform gateways", e);
throw new OperationException(e);
}
}
use of com.sequenceiq.cloudbreak.service.OperationException in project cloudbreak by hortonworks.
the class CloudParameterService method getResourceGroups.
@Retryable(value = GetCloudParameterException.class, maxAttempts = 5, backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000))
public CloudResourceGroups getResourceGroups(ExtendedCloudCredential cloudCredential, String region, String platformVariant, Map<String, String> filters) {
LOGGER.debug("Get platform resource groups for credential: [{}]", cloudCredential.getName());
GetPlatformResourceGroupsRequest request = new GetPlatformResourceGroupsRequest(cloudCredential, cloudCredential, platformVariant, region, null);
eventBus.notify(request.selector(), Event.wrap(request));
try {
GetPlatformResourceGroupsResult result = request.await();
LOGGER.debug("Platform ResourceGroupsResult result: {}", result);
if (result.getStatus().equals(EventStatus.FAILED)) {
LOGGER.debug("Failed to get platform ResourceGroupsResult", result.getErrorDetails());
throw new GetCloudParameterException(String.format("Failed to get resource groups tables for the cloud provider: %s. %s", result.getStatusReason(), getCauseMessages(result.getErrorDetails())), result.getErrorDetails());
}
return result.getResourceGroups();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform ResourceGroupsResult", e);
throw new OperationException(e);
}
}
Aggregations