Search in sources :

Example 6 with BackupResponse

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.");
    }
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) BackupResponse(com.sequenceiq.common.api.backup.response.BackupResponse)

Aggregations

BackupResponse (com.sequenceiq.common.api.backup.response.BackupResponse)6 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)4 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)4 StorageLocation (com.sequenceiq.cloudbreak.domain.StorageLocation)2 StorageLocationView (com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView)2 CredentialResponse (com.sequenceiq.environment.api.v1.credential.model.response.CredentialResponse)2 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)1 Json (com.sequenceiq.cloudbreak.common.json.Json)1 FileSystem (com.sequenceiq.cloudbreak.domain.FileSystem)1 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)1 BaseFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView)1 ConfigQueryEntries (com.sequenceiq.common.api.cloudstorage.query.ConfigQueryEntries)1 LoggingResponse (com.sequenceiq.common.api.telemetry.response.LoggingResponse)1 CompactRegionResponse (com.sequenceiq.environment.api.v1.environment.model.response.CompactRegionResponse)1 EnvironmentNetworkResponse (com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse)1 FreeIpaResponse (com.sequenceiq.environment.api.v1.environment.model.response.FreeIpaResponse)1 ProxyResponse (com.sequenceiq.environment.api.v1.proxy.model.response.ProxyResponse)1 EnvironmentDto (com.sequenceiq.environment.environment.dto.EnvironmentDto)1 Test (org.junit.Test)1 Test (org.junit.jupiter.api.Test)1