use of com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.DatalakeBackupInfo in project cloudbreak by hortonworks.
the class DatalakeDrClient method getLastSuccessBackup.
public DatalakeBackupInfo getLastSuccessBackup(String datalakeName, String actorCrn) {
DatalakeBackupInfo datalakeBackupInfo = null;
if (!datalakeDrConfig.isConfigured()) {
return null;
}
checkNotNull(datalakeName);
checkNotNull(actorCrn, "actorCrn should not be null.");
try (ManagedChannelWrapper channelWrapper = makeWrapper()) {
ListDatalakeBackupRequest.Builder builder = ListDatalakeBackupRequest.newBuilder().setDatalakeName(datalakeName);
ListDatalakeBackupResponse response = newStub(channelWrapper.getChannel(), UUID.randomUUID().toString(), actorCrn).listDatalakeBackups(builder.build());
if (response != null && response.getDatalakeInfoList() != null) {
datalakeBackupInfo = response.getDatalakeInfoList().stream().filter(backup -> "SUCCESSFUL".equals(backup.getOverallState())).findFirst().orElse(null);
}
return datalakeBackupInfo;
}
}
use of com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.DatalakeBackupInfo in project cloudbreak by hortonworks.
the class DatalakeDrClient method getLastSuccessfulBackup.
public DatalakeBackupInfo getLastSuccessfulBackup(String datalakeName, String actorCrn, Optional<String> runtime) {
if (!datalakeDrConfig.isConfigured()) {
return null;
}
checkNotNull(datalakeName);
checkNotNull(actorCrn, "actorCrn should not be null.");
try (ManagedChannelWrapper channelWrapper = makeWrapper()) {
ListDatalakeBackupRequest.Builder builder = ListDatalakeBackupRequest.newBuilder().setDatalakeName(datalakeName);
ListDatalakeBackupResponse response = newStub(channelWrapper.getChannel(), UUID.randomUUID().toString(), actorCrn).listDatalakeBackups(builder.build());
if (response != null) {
return response.getDatalakeInfoList().stream().filter(backup -> "SUCCESSFUL".equals(backup.getOverallState())).filter(backup -> runtime.isEmpty() || backup.getRuntimeVersion().equalsIgnoreCase(runtime.get())).peek(backupInfo -> LOGGER.debug("The following successful backup was found for data lake {} and runtime {}: {}", datalakeName, runtime, backupInfo)).findFirst().orElse(null);
}
LOGGER.debug("No successful backup was found for data lake {} and runtime {}", datalakeName, runtime);
return null;
}
}
use of com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.DatalakeBackupInfo in project cloudbreak by hortonworks.
the class DatalakeDrClient method getBackupById.
public DatalakeBackupInfo getBackupById(String datalakeName, String backupId, String actorCrn) {
DatalakeBackupInfo datalakeBackupInfo = null;
if (!datalakeDrConfig.isConfigured()) {
return null;
}
checkNotNull(datalakeName);
checkNotNull(backupId);
checkNotNull(actorCrn, "actorCrn should not be null.");
try (ManagedChannelWrapper channelWrapper = makeWrapper()) {
ListDatalakeBackupRequest.Builder builder = ListDatalakeBackupRequest.newBuilder().setDatalakeName(datalakeName);
ListDatalakeBackupResponse response = newStub(channelWrapper.getChannel(), UUID.randomUUID().toString(), actorCrn).listDatalakeBackups(builder.build());
if (response != null) {
datalakeBackupInfo = response.getDatalakeInfoList().stream().filter(backup -> backupId.equals(backup.getBackupId())).findFirst().orElse(null);
}
return datalakeBackupInfo;
}
}
Aggregations