use of com.sequenceiq.cloudbreak.service.OperationException in project cloudbreak by hortonworks.
the class StackTemplateService method waitGetTemplate.
public String waitGetTemplate(GetPlatformTemplateRequest getPlatformTemplateRequest) {
try {
GetPlatformTemplateResult res = getPlatformTemplateRequest.await();
LOGGER.debug("Get template result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.error("Failed to get template", res.getErrorDetails());
throw new OperationException(res.getErrorDetails());
}
return res.getTemplate();
} catch (InterruptedException e) {
LOGGER.error("Error while getting template: " + getPlatformTemplateRequest.getCloudContext(), e);
throw new OperationException(e);
}
}
use of com.sequenceiq.cloudbreak.service.OperationException in project cloudbreak by hortonworks.
the class CloudParameterService method getDiskTypes.
@Retryable(value = GetCloudParameterException.class, maxAttempts = 5, backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000))
public PlatformDisks getDiskTypes() {
LOGGER.debug("Get platform disktypes");
GetDiskTypesRequest getDiskTypesRequest = new GetDiskTypesRequest();
eventBus.notify(getDiskTypesRequest.selector(), eventFactory.createEvent(getDiskTypesRequest));
try {
GetDiskTypesResult res = getDiskTypesRequest.await();
LOGGER.debug("Platform disk types result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.debug("Failed to get platform disk types", res.getErrorDetails());
throw new GetCloudParameterException(getCauseMessages(res.getErrorDetails()), res.getErrorDetails());
}
return res.getPlatformDisks();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform disk types", e);
throw new OperationException(e);
}
}
use of com.sequenceiq.cloudbreak.service.OperationException in project cloudbreak by hortonworks.
the class CloudParameterService method getCloudSshKeys.
@Retryable(value = GetCloudParameterException.class, maxAttempts = 5, backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000))
public CloudSshKeys getCloudSshKeys(ExtendedCloudCredential cloudCredential, String region, String variant, Map<String, String> filters) {
LOGGER.debug("Get platform sshkeys");
GetPlatformSshKeysRequest getPlatformSshKeysRequest = new GetPlatformSshKeysRequest(cloudCredential, cloudCredential, variant, region, filters);
eventBus.notify(getPlatformSshKeysRequest.selector(), eventFactory.createEvent(getPlatformSshKeysRequest));
try {
GetPlatformSshKeysResult res = getPlatformSshKeysRequest.await();
LOGGER.debug("Platform sshkeys types result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.debug("Failed to get platform sshkeys", res.getErrorDetails());
throw new GetCloudParameterException("Failed to get SSH keys for the cloud provider. " + getCauseMessages(res.getErrorDetails()), res.getErrorDetails());
}
return res.getCloudSshKeys();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform sshkeys", e);
throw new OperationException(e);
}
}
use of com.sequenceiq.cloudbreak.service.OperationException 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.service.OperationException in project cloudbreak by hortonworks.
the class CloudParameterService method getVmTypesV2.
@Retryable(value = GetCloudParameterException.class, maxAttempts = 5, backoff = @Backoff(delay = 1000, multiplier = 2, maxDelay = 10000))
public CloudVmTypes getVmTypesV2(ExtendedCloudCredential cloudCredential, String region, String variant, CdpResourceType stackType, Map<String, String> filters) {
LOGGER.debug("Get platform vmtypes");
boolean hasEnableDistroxInstanceTypesEnabled = entitlementService.enableDistroxInstanceTypesEnabled(cloudCredential.getAccountId());
GetPlatformVmTypesRequest getPlatformVmTypesRequest = new GetPlatformVmTypesRequest(cloudCredential, cloudCredential, variant, region, stackType, hasEnableDistroxInstanceTypesEnabled, filters);
eventBus.notify(getPlatformVmTypesRequest.selector(), Event.wrap(getPlatformVmTypesRequest));
try {
GetPlatformVmTypesResult res = getPlatformVmTypesRequest.await();
LOGGER.debug("Platform vmtypes result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.debug("Failed to get platform vmtypes", res.getErrorDetails());
throw new GetCloudParameterException("Failed to get VM types for the cloud provider. " + getCauseMessages(res.getErrorDetails()), res.getErrorDetails());
}
return res.getCloudVmTypes();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the platform vmtypes", e);
throw new OperationException(e);
}
}
Aggregations