Search in sources :

Example 1 with DeleteBackupRequest

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;
    });
}
Also used : GrpcCallContext(com.google.api.gax.grpc.GrpcCallContext) DeleteBackupRequest(com.google.spanner.admin.database.v1.DeleteBackupRequest)

Example 2 with DeleteBackupRequest

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/&lt;project&gt;/instances/&lt;instance&gt;/backups/&lt;backup&gt;`.
 * @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);
}
Also used : DeleteBackupRequest(com.google.spanner.admin.database.v1.DeleteBackupRequest)

Example 3 with DeleteBackupRequest

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);
}
Also used : DeleteBackupRequest(com.google.bigtable.admin.v2.DeleteBackupRequest) Test(org.junit.Test)

Example 4 with DeleteBackupRequest

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);
}
Also used : DeleteBackupRequest(com.google.bigtable.admin.v2.DeleteBackupRequest)

Example 5 with DeleteBackupRequest

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);
}
Also used : DeleteBackupRequest(com.google.bigtable.admin.v2.DeleteBackupRequest)

Aggregations

DeleteBackupRequest (com.google.bigtable.admin.v2.DeleteBackupRequest)6 Test (org.junit.Test)6 DeleteBackupRequest (com.google.spanner.admin.database.v1.DeleteBackupRequest)5 AbstractMessage (com.google.protobuf.AbstractMessage)4 Empty (com.google.protobuf.Empty)4 ByteString (com.google.protobuf.ByteString)2 GrpcCallContext (com.google.api.gax.grpc.GrpcCallContext)1 BackupName (com.google.bigtable.admin.v2.BackupName)1 BackupName (com.google.spanner.admin.database.v1.BackupName)1