use of com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper in project cloudbreak by hortonworks.
the class DatalakeDrClient method getRestoreStatus.
public DatalakeRestoreStatusResponse getRestoreStatus(String datalakeName, String restoreId, String backupName, String actorCrn) {
if (!datalakeDrConfig.isConfigured()) {
return missingConnectorResponseOnRestore();
}
checkNotNull(datalakeName);
checkNotNull(actorCrn, "actorCrn should not be null.");
try (ManagedChannelWrapper channelWrapper = makeWrapper()) {
RestoreDatalakeStatusRequest.Builder builder = RestoreDatalakeStatusRequest.newBuilder().setDatalakeName(datalakeName);
if (!Strings.isNullOrEmpty(restoreId)) {
builder.setRestoreId(restoreId);
}
return statusConverter.convert(newStub(channelWrapper.getChannel(), UUID.randomUUID().toString(), actorCrn).restoreDatalakeStatus(builder.build()));
}
}
use of com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper in project cloudbreak by hortonworks.
the class DatalakeDrClient method getBackupStatus.
public DatalakeBackupStatusResponse getBackupStatus(String datalakeName, String backupId, String backupName, String actorCrn) {
if (!datalakeDrConfig.isConfigured()) {
return missingConnectorResponseOnBackup();
}
checkNotNull(datalakeName);
checkNotNull(actorCrn, "actorCrn should not be null.");
try (ManagedChannelWrapper channelWrapper = makeWrapper()) {
BackupDatalakeStatusRequest.Builder builder = BackupDatalakeStatusRequest.newBuilder().setDatalakeName(datalakeName);
if (!Strings.isNullOrEmpty(backupId)) {
builder.setBackupId(backupId);
}
if (!Strings.isNullOrEmpty(backupName)) {
builder.setBackupName(backupName);
}
return statusConverter.convert(newStub(channelWrapper.getChannel(), UUID.randomUUID().toString(), actorCrn).backupDatalakeStatus(builder.build()));
}
}
use of com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper in project cloudbreak by hortonworks.
the class DatalakeDrClient method triggerBackup.
public DatalakeBackupStatusResponse triggerBackup(String datalakeName, String backupLocation, String backupName, String actorCrn) {
if (!datalakeDrConfig.isConfigured()) {
return missingConnectorResponseOnBackup();
}
checkNotNull(datalakeName);
checkNotNull(actorCrn, "actorCrn should not be null.");
checkNotNull(backupLocation);
try (ManagedChannelWrapper channelWrapper = makeWrapper()) {
BackupDatalakeRequest.Builder builder = BackupDatalakeRequest.newBuilder().setDatalakeName(datalakeName).setBackupLocation(backupLocation).setCloseDbConnections(true);
if (!Strings.isNullOrEmpty(backupName)) {
builder.setBackupName(backupName);
}
return statusConverter.convert(newStub(channelWrapper.getChannel(), UUID.randomUUID().toString(), actorCrn).backupDatalake(builder.build()));
}
}
use of com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper in project cloudbreak by hortonworks.
the class DatalakeDrClient method getBackupId.
public String getBackupId(String datalakeName, String backupName, String actorCrn) {
if (!datalakeDrConfig.isConfigured()) {
throw new IllegalStateException("altus.datalakedr.endpoint is not enabled or configured appropriately!");
}
checkNotNull(datalakeName);
checkNotNull(actorCrn, "actorCrn should not be null.");
try (ManagedChannelWrapper channelWrapper = makeWrapper()) {
BackupDatalakeStatusRequest.Builder builder = BackupDatalakeStatusRequest.newBuilder().setDatalakeName(datalakeName);
if (!Strings.isNullOrEmpty(backupName)) {
builder.setBackupName(backupName);
}
return newStub(channelWrapper.getChannel(), UUID.randomUUID().toString(), actorCrn).backupDatalakeStatus(builder.build()).getBackupId();
}
}
use of com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper in project cloudbreak by hortonworks.
the class DatalakeDrClient method triggerRestore.
public DatalakeRestoreStatusResponse triggerRestore(String datalakeName, String backupId, String backupLocationOverride, String actorCrn) {
if (!datalakeDrConfig.isConfigured()) {
return missingConnectorResponseOnRestore();
}
checkNotNull(datalakeName);
checkNotNull(actorCrn, "actorCrn should not be null.");
try (ManagedChannelWrapper channelWrapper = makeWrapper()) {
RestoreDatalakeRequest.Builder builder = RestoreDatalakeRequest.newBuilder().setDatalakeName(datalakeName);
if (!Strings.isNullOrEmpty(backupId)) {
builder.setBackupId(backupId);
}
if (!Strings.isNullOrEmpty(backupLocationOverride)) {
builder.setBackupLocationOverride(backupLocationOverride);
}
return statusConverter.convert(newStub(channelWrapper.getChannel(), UUID.randomUUID().toString(), actorCrn).restoreDatalake(builder.build()));
}
}
Aggregations