Search in sources :

Example 6 with ManagedChannelWrapper

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()));
    }
}
Also used : ManagedChannelWrapper(com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper) RestoreDatalakeStatusRequest(com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.RestoreDatalakeStatusRequest)

Example 7 with ManagedChannelWrapper

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()));
    }
}
Also used : BackupDatalakeStatusRequest(com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.BackupDatalakeStatusRequest) ManagedChannelWrapper(com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper)

Example 8 with ManagedChannelWrapper

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()));
    }
}
Also used : ManagedChannelWrapper(com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper) BackupDatalakeRequest(com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.BackupDatalakeRequest)

Example 9 with ManagedChannelWrapper

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();
    }
}
Also used : BackupDatalakeStatusRequest(com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.BackupDatalakeStatusRequest) ManagedChannelWrapper(com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper)

Example 10 with ManagedChannelWrapper

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()));
    }
}
Also used : RestoreDatalakeRequest(com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.RestoreDatalakeRequest) ManagedChannelWrapper(com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper)

Aggregations

ManagedChannelWrapper (com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper)32 BackupDatalakeStatusRequest (com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.BackupDatalakeStatusRequest)6 RestoreDatalakeStatusRequest (com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.RestoreDatalakeStatusRequest)6 AuditProto (com.cloudera.thunderhead.service.audit.AuditProto)4 ClusterConnectivityManagementV2BlockingStub (com.cloudera.thunderhead.service.clusterconnectivitymanagementv2.ClusterConnectivityManagementV2Grpc.ClusterConnectivityManagementV2BlockingStub)4 BackupDatalakeRequest (com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.BackupDatalakeRequest)4 RestoreDatalakeRequest (com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.RestoreDatalakeRequest)4 ManagedChannelBuilder (io.grpc.ManagedChannelBuilder)4 com.cloudera.thunderhead.service.datalakedr.datalakeDRGrpc (com.cloudera.thunderhead.service.datalakedr.datalakeDRGrpc)3 com.cloudera.thunderhead.service.datalakedr.datalakeDRGrpc.datalakeDRBlockingStub (com.cloudera.thunderhead.service.datalakedr.datalakeDRGrpc.datalakeDRBlockingStub)3 DatalakeBackupInfo (com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.DatalakeBackupInfo)3 ListDatalakeBackupRequest (com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.ListDatalakeBackupRequest)3 ListDatalakeBackupResponse (com.cloudera.thunderhead.service.datalakedr.datalakeDRProto.ListDatalakeBackupResponse)3 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)3 Strings (com.google.common.base.Strings)3 CcmException (com.sequenceiq.cloudbreak.ccm.exception.CcmException)3 DatalakeDrConfig (com.sequenceiq.cloudbreak.datalakedr.config.DatalakeDrConfig)3 GrpcStatusResponseToDatalakeBackupRestoreStatusResponseConverter (com.sequenceiq.cloudbreak.datalakedr.converter.GrpcStatusResponseToDatalakeBackupRestoreStatusResponseConverter)3 DatalakeBackupStatusResponse (com.sequenceiq.cloudbreak.datalakedr.model.DatalakeBackupStatusResponse)3 DatalakeRestoreStatusResponse (com.sequenceiq.cloudbreak.datalakedr.model.DatalakeRestoreStatusResponse)3