use of com.google.spanner.admin.database.v1.DeleteBackupRequest in project java-spanner by googleapis.
the class GapicSpannerRpc method deleteBackup.
@Override
public void deleteBackup(String backupName) {
acquireAdministrativeRequestsRateLimiter();
final DeleteBackupRequest request = DeleteBackupRequest.newBuilder().setName(backupName).build();
final GrpcCallContext context = newCallContext(null, backupName, request, DatabaseAdminGrpc.getDeleteBackupMethod());
runWithRetryOnAdministrativeRequestsExceeded(() -> {
databaseAdminStub.deleteBackupCallable().call(request, context);
return null;
});
}
use of com.google.spanner.admin.database.v1.DeleteBackupRequest in project java-spanner by googleapis.
the class DatabaseAdminClient method deleteBackup.
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a pending or completed [Backup][google.spanner.admin.database.v1.Backup].
*
* <p>Sample code:
*
* <pre>{@code
* try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
* String name = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString();
* databaseAdminClient.deleteBackup(name);
* }
* }</pre>
*
* @param name Required. Name of the backup to delete. Values are of the form
* `projects/<project>/instances/<instance>/backups/<backup>`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteBackup(String name) {
DeleteBackupRequest request = DeleteBackupRequest.newBuilder().setName(name).build();
deleteBackup(request);
}
use of com.google.spanner.admin.database.v1.DeleteBackupRequest in project java-bigtable by googleapis.
the class BigtableTableAdminClientTest method testDeleteBackup.
@Test
public void testDeleteBackup() {
// Setup
Mockito.when(mockStub.deleteBackupCallable()).thenReturn(mockDeleteBackupCallable);
DeleteBackupRequest testRequest = DeleteBackupRequest.newBuilder().setName(NameUtil.formatBackupName(PROJECT_ID, INSTANCE_ID, CLUSTER_ID, BACKUP_ID)).build();
Mockito.when(mockDeleteBackupCallable.futureCall(testRequest)).thenReturn(ApiFutures.immediateFuture(Empty.getDefaultInstance()));
// Execute
adminClient.deleteBackup(CLUSTER_ID, BACKUP_ID);
// Verify
Mockito.verify(mockDeleteBackupCallable, Mockito.times(1)).futureCall(testRequest);
}
use of com.google.spanner.admin.database.v1.DeleteBackupRequest in project java-bigtable by googleapis.
the class BaseBigtableTableAdminClient method deleteBackup.
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a pending or completed Cloud Bigtable backup.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
* BaseBigtableTableAdminClient.create()) {
* BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]");
* baseBigtableTableAdminClient.deleteBackup(name);
* }
* }</pre>
*
* @param name Required. Name of the backup to delete. Values are of the form
* `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteBackup(BackupName name) {
DeleteBackupRequest request = DeleteBackupRequest.newBuilder().setName(name == null ? null : name.toString()).build();
deleteBackup(request);
}
use of com.google.spanner.admin.database.v1.DeleteBackupRequest in project java-bigtable by googleapis.
the class BaseBigtableTableAdminClient method deleteBackup.
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a pending or completed Cloud Bigtable backup.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
* BaseBigtableTableAdminClient.create()) {
* String name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]").toString();
* baseBigtableTableAdminClient.deleteBackup(name);
* }
* }</pre>
*
* @param name Required. Name of the backup to delete. Values are of the form
* `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteBackup(String name) {
DeleteBackupRequest request = DeleteBackupRequest.newBuilder().setName(name).build();
deleteBackup(request);
}
Aggregations