use of com.google.bigtable.admin.v2.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
* 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.bigtable.admin.v2.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
* 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);
}
use of com.google.bigtable.admin.v2.DeleteBackupRequest in project java-bigtable by googleapis.
the class BaseBigtableTableAdminClientTest method deleteBackupTest2.
@Test
public void deleteBackupTest2() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockBigtableTableAdmin.addResponse(expectedResponse);
String name = "name3373707";
client.deleteBackup(name);
List<AbstractMessage> actualRequests = mockBigtableTableAdmin.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteBackupRequest actualRequest = ((DeleteBackupRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.bigtable.admin.v2.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.bigtable.admin.v2.DeleteBackupRequest in project java-bigtable by googleapis.
the class BaseBigtableTableAdminClientTest method deleteBackupTest.
@Test
public void deleteBackupTest() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockBigtableTableAdmin.addResponse(expectedResponse);
BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]");
client.deleteBackup(name);
List<AbstractMessage> actualRequests = mockBigtableTableAdmin.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteBackupRequest actualRequest = ((DeleteBackupRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations