use of com.sequenceiq.common.api.backup.response.BackupResponse in project cloudbreak by hortonworks.
the class EnvironmentClientService method getBackupLocation.
/**
* Get the backup location.
* @param envCrn Environemnt CRN.
* @return backuplocation configured for the environment, If not, returns the log location.
*/
public String getBackupLocation(String environmentCrn) {
DetailedEnvironmentResponse detailedEnvironmentResponse = getByCrn(environmentCrn);
BackupResponse backupResponse = detailedEnvironmentResponse.getBackup();
TelemetryResponse telemetryResponse = detailedEnvironmentResponse.getTelemetry();
if (backupResponse != null && backupResponse.getStorageLocation() != null) {
LOGGER.info("Using the backup location to store the datalake backup");
return backupResponse.getStorageLocation();
} else if (telemetryResponse != null && telemetryResponse.getLogging() != null) {
LOGGER.info("Backup location not configured. Using the log location to store the datalake backup");
return telemetryResponse.getLogging().getStorageLocation();
} else {
LOGGER.error("Could not identify the location to store the backup");
throw new BadRequestException("Backup Location is empty. Datalake backup is not triggered.");
}
}
Aggregations