public final class BigtableTableAdminClient extends Object implements AutoCloseable
Provides access to the table schemas only, not the data stored within the tables.
See the individual methods for example code.
Sample code to get started:
// One instance per application.
BigtableTableAdminClient client = BigtableTableAdminClient.create("[PROJECT]", "[INSTANCE]");
com.google.bigtable.admin.v2.CreateTableRequest request =
com.google.bigtable.admin.v2.CreateTableRequest.newBuilder()
.setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
.setTableId("my-table")
.setTable(
com.google.bigtable.admin.v2.Table.newBuilder()
.putColumnFamilies("cf1", com.google.bigtable.admin.v2.ColumnFamily.getDefaultInstance())
.putColumnFamilies(
"cf2",
com.google.bigtable.admin.v2.ColumnFamily.newBuilder()
.setGcRule(GcRuleBuilder.maxVersions(10))
.build())
.build())
.addInitialSplits(
com.google.bigtable.admin.v2.CreateTableRequest.Split.newBuilder()
.setKey(ByteString.copyFromUtf8("b"))
.build())
.addInitialSplits(
com.google.bigtable.admin.v2.CreateTableRequest.Split.newBuilder()
.setKey(ByteString.copyFromUtf8("q"))
.build())
.build();
client.getBaseClient().createTable(request);
// Cleanup during application shutdown.
client.close();
Creating a new client is a very expensive operation and should only be done once and shared in an application. However, close() needs to be called on the client object to clean up resources such as threads during application shutdown.
This class can be customized by passing in a custom instance of BigtableTableAdminSettings to create(). For example:
To customize credentials:
BigtableTableAdminSettings settings = BigtableTableAdminSettings.newBuilder()
.setProjectId("[PROJECT]")
.setInstanceId("[INSTANCE]")
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
BigtableTableAdminClient client = BigtableTableAdminClient.create(settings);
To customize the endpoint:
BigtableTableAdminSettings.Builder settingsBuilder = BigtableTableAdminSettings.newBuilder()
.setProjectId("[PROJECT]")
.setInstanceId("[INSTANCE]");
settingsBuilder.stubSettings()
.setEndpoint(myEndpoint).build();
BigtableTableAdminClient client = BigtableTableAdminClient.create(settingsBuilder.build());
| Modifier and Type | Method and Description |
|---|---|
void |
awaitConsistency(ConsistencyRequest consistencyRequest) |
com.google.api.core.ApiFuture<com.google.protobuf.Empty> |
awaitOptimizeRestoredTable(com.google.api.core.ApiFuture<RestoredTableResult> restoreFuture)
Awaits the completion of the "Optimize Restored Table" operation.
|
void |
awaitOptimizeRestoredTable(OptimizeRestoredTableOperationToken token)
Awaits a restored table is fully optimized.
|
com.google.api.core.ApiFuture<Void> |
awaitOptimizeRestoredTableAsync(OptimizeRestoredTableOperationToken token)
Awaits a restored table is fully optimized asynchronously.
|
void |
awaitReplication(String tableId)
Deprecated.
|
com.google.api.core.ApiFuture<Void> |
awaitReplicationAsync(String tableId)
Deprecated.
|
void |
close() |
Backup |
copyBackup(CopyBackupRequest request)
This method is obsolete.
|
com.google.api.core.ApiFuture<Backup> |
copyBackupAsync(CopyBackupRequest request)
This method is obsolete.
|
static BigtableTableAdminClient |
create(BigtableTableAdminSettings settings)
Constructs an instance of BigtableTableAdminClient with the given settings.
|
static BigtableTableAdminClient |
create(String projectId,
String instanceId)
Constructs an instance of BigtableTableAdminClient with the given project and instance IDs.
|
static BigtableTableAdminClient |
create(String projectId,
String instanceId,
com.google.cloud.bigtable.admin.v2.stub.EnhancedBigtableTableAdminStub stub)
Constructs an instance of BigtableTableAdminClient with the given instance name and stub.
|
AuthorizedView |
createAuthorizedView(CreateAuthorizedViewRequest request)
This method is obsolete.
|
com.google.api.core.ApiFuture<AuthorizedView> |
createAuthorizedViewAsync(CreateAuthorizedViewRequest request)
This method is obsolete.
|
Backup |
createBackup(CreateBackupRequest request)
This method is obsolete.
|
com.google.api.core.ApiFuture<Backup> |
createBackupAsync(CreateBackupRequest request)
This method is obsolete.
|
SchemaBundle |
createSchemaBundle(CreateSchemaBundleRequest request)
This method is obsolete.
|
com.google.api.core.ApiFuture<SchemaBundle> |
createSchemaBundleAsync(CreateSchemaBundleRequest request)
This method is obsolete.
|
Table |
createTable(CreateTableRequest request)
This method is obsolete.
|
com.google.api.core.ApiFuture<Table> |
createTableAsync(CreateTableRequest request)
This method is obsolete.
|
void |
deleteAuthorizedView(String tableId,
String authorizedViewId)
This method is obsolete.
|
com.google.api.core.ApiFuture<Void> |
deleteAuthorizedViewAsync(String tableId,
String authorizedViewId)
This method is obsolete.
|
void |
deleteBackup(String clusterId,
String backupId)
This method is obsolete.
|
com.google.api.core.ApiFuture<Void> |
deleteBackupAsync(String clusterId,
String backupId)
This method is obsolete.
|
void |
deleteSchemaBundle(String tableId,
String schemaBundleId)
This method is obsolete.
|
com.google.api.core.ApiFuture<Void> |
deleteSchemaBundleAsync(String tableId,
String schemaBundleId)
This method is obsolete.
|
void |
deleteTable(String tableId)
This method is obsolete.
|
com.google.api.core.ApiFuture<Void> |
deleteTableAsync(String tableId)
This method is obsolete.
|
void |
dropAllRows(String tableId)
This method is obsolete.
|
com.google.api.core.ApiFuture<Void> |
dropAllRowsAsync(String tableId)
This method is obsolete.
|
void |
dropRowRange(String tableId,
com.google.protobuf.ByteString rowKeyPrefix)
This method is obsolete.
|
void |
dropRowRange(String tableId,
String rowKeyPrefix)
This method is obsolete.
|
com.google.api.core.ApiFuture<Void> |
dropRowRangeAsync(String tableId,
com.google.protobuf.ByteString rowKeyPrefix)
This method is obsolete.
|
com.google.api.core.ApiFuture<Void> |
dropRowRangeAsync(String tableId,
String rowKeyPrefix)
This method is obsolete.
|
boolean |
exists(String tableId)
This method is obsolete.
|
com.google.api.core.ApiFuture<Boolean> |
existsAsync(String tableId)
This method is obsolete.
|
AuthorizedView |
getAuthorizedView(String tableId,
String authorizedViewId)
This method is obsolete.
|
com.google.api.core.ApiFuture<AuthorizedView> |
getAuthorizedViewAsync(String tableId,
String authorizedViewId)
This method is obsolete.
|
com.google.cloud.Policy |
getAuthorizedViewIamPolicy(String tableId,
String authorizedViewId)
This method is obsolete.
|
com.google.api.core.ApiFuture<com.google.cloud.Policy> |
getAuthorizedViewIamPolicyAsync(String tableId,
String authorizedViewId)
This method is obsolete.
|
Backup |
getBackup(String clusterId,
String backupId)
This method is obsolete.
|
com.google.api.core.ApiFuture<Backup> |
getBackupAsync(String clusterId,
String backupId)
This method is obsolete.
|
com.google.cloud.Policy |
getBackupIamPolicy(String clusterId,
String backupId)
This method is obsolete.
|
com.google.api.core.ApiFuture<com.google.cloud.Policy> |
getBackupIamPolicyAsync(String clusterId,
String backupId)
This method is obsolete.
|
BaseBigtableTableAdminClient |
getBaseClient()
Returns the modern autogenerated client.
|
Map<String,List<EncryptionInfo>> |
getEncryptionInfo(String tableId)
This method is obsolete.
|
com.google.api.core.ApiFuture<Map<String,List<EncryptionInfo>>> |
getEncryptionInfoAsync(String tableId)
This method is obsolete.
|
com.google.cloud.Policy |
getIamPolicy(String tableId)
This method is obsolete.
|
com.google.api.core.ApiFuture<com.google.cloud.Policy> |
getIamPolicyAsync(String tableId)
This method is obsolete.
|
String |
getInstanceId()
Gets the ID of the instance whose tables this client manages.
|
String |
getProjectId()
Gets the project ID of the instance whose tables this client manages.
|
SchemaBundle |
getSchemaBundle(String tableId,
String schemaBundleId)
This method is obsolete.
|
com.google.api.core.ApiFuture<SchemaBundle> |
getSchemaBundleAsync(String tableId,
String schemaBundleId)
This method is obsolete.
|
Table |
getTable(String tableId)
This method is obsolete.
|
com.google.api.core.ApiFuture<Table> |
getTableAsync(String tableId)
This method is obsolete.
|
List<String> |
listAuthorizedViews(String tableId)
This method is obsolete.
|
com.google.api.core.ApiFuture<List<String>> |
listAuthorizedViewsAsync(String tableId)
This method is obsolete.
|
List<String> |
listBackups(String clusterId)
This method is obsolete.
|
com.google.api.core.ApiFuture<List<String>> |
listBackupsAsync(String clusterId)
This method is obsolete.
|
List<String> |
listSchemaBundles(String tableId)
This method is obsolete.
|
com.google.api.core.ApiFuture<List<String>> |
listSchemaBundlesAsync(String tableId)
This method is obsolete.
|
List<String> |
listTables()
This method is obsolete.
|
com.google.api.core.ApiFuture<List<String>> |
listTablesAsync()
This method is obsolete.
|
Table |
modifyFamilies(ModifyColumnFamiliesRequest request)
This method is obsolete.
|
com.google.api.core.ApiFuture<Table> |
modifyFamiliesAsync(ModifyColumnFamiliesRequest request)
This method is obsolete.
|
RestoredTableResult |
restoreTable(RestoreTableRequest request)
This method is obsolete.
|
com.google.api.core.ApiFuture<RestoredTableResult> |
restoreTableAsync(RestoreTableRequest request)
This method is obsolete.
|
com.google.cloud.Policy |
setAuthorizedViewIamPolicy(String tableId,
String authorizedViewId,
com.google.cloud.Policy policy)
This method is obsolete.
|
com.google.api.core.ApiFuture<com.google.cloud.Policy> |
setAuthorizedViewIamPolicyAsync(String tableId,
String authorizedViewId,
com.google.cloud.Policy policy)
This method is obsolete.
|
com.google.cloud.Policy |
setBackupIamPolicy(String clusterId,
String backupId,
com.google.cloud.Policy policy)
This method is obsolete.
|
com.google.api.core.ApiFuture<com.google.cloud.Policy> |
setBackupIamPolicyAsync(String clusterId,
String backupId,
com.google.cloud.Policy policy)
This method is obsolete.
|
com.google.cloud.Policy |
setIamPolicy(String tableId,
com.google.cloud.Policy policy)
This method is obsolete.
|
com.google.api.core.ApiFuture<com.google.cloud.Policy> |
setIamPolicyAsync(String tableId,
com.google.cloud.Policy policy)
This method is obsolete.
|
List<String> |
testAuthorizedViewIamPermission(String tableId,
String authorizedViewId,
String... permissions)
This method is obsolete.
|
com.google.api.core.ApiFuture<List<String>> |
testAuthorizedViewIamPermissionAsync(String tableId,
String authorizedViewId,
String... permissions)
This method is obsolete.
|
List<String> |
testBackupIamPermission(String clusterId,
String backupId,
String... permissions)
This method is obsolete.
|
com.google.api.core.ApiFuture<List<String>> |
testBackupIamPermissionAsync(String clusterId,
String backupId,
String... permissions)
This method is obsolete.
|
List<String> |
testIamPermission(String tableId,
String... permissions)
This method is obsolete.
|
com.google.api.core.ApiFuture<List<String>> |
testIamPermissionAsync(String tableId,
String... permissions)
This method is obsolete.
|
AuthorizedView |
updateAuthorizedView(UpdateAuthorizedViewRequest request)
This method is obsolete.
|
com.google.api.core.ApiFuture<AuthorizedView> |
updateAuthorizedViewAsync(UpdateAuthorizedViewRequest request)
This method is obsolete.
|
Backup |
updateBackup(UpdateBackupRequest request)
This method is obsolete.
|
com.google.api.core.ApiFuture<Backup> |
updateBackupAsync(UpdateBackupRequest request)
This method is obsolete.
|
SchemaBundle |
updateSchemaBundle(UpdateSchemaBundleRequest request)
This method is obsolete.
|
com.google.api.core.ApiFuture<SchemaBundle> |
updateSchemaBundleAsync(UpdateSchemaBundleRequest request)
This method is obsolete.
|
Table |
updateTable(UpdateTableRequest request)
This method is obsolete.
|
com.google.api.core.ApiFuture<Table> |
updateTableAsync(UpdateTableRequest request)
This method is obsolete.
|
void |
waitForConsistency(String tableId,
String consistencyToken)
Polls an existing consistency token until table replication is consistent across all clusters.
|
com.google.api.core.ApiFuture<Void> |
waitForConsistencyAsync(String tableId,
String consistencyToken)
Asynchronously polls the consistency token.
|
public static BigtableTableAdminClient create(@Nonnull String projectId, @Nonnull String instanceId) throws IOException
IOExceptionpublic static BigtableTableAdminClient create(@Nonnull BigtableTableAdminSettings settings) throws IOException
IOExceptionpublic static BigtableTableAdminClient create(@Nonnull String projectId, @Nonnull String instanceId, @Nonnull com.google.cloud.bigtable.admin.v2.stub.EnhancedBigtableTableAdminStub stub)
public String getProjectId()
public String getInstanceId()
public BaseBigtableTableAdminClient getBaseClient()
public void close()
close in interface AutoCloseable@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public Table createTable(CreateTableRequest request)
BaseBigtableTableAdminClient.createTable(com.google.bigtable.admin.v2.CreateTableRequest).
Creates a new table with the specified configuration.
Sample code:
// A table with a single column family, which retains only the latest value.
Table table = client.createTable(
CreateTableRequest.of("my-table")
.addFamily("cf2", GCRULES.maxVersions(1))
);
// Another table with more complex garbage collection rules.
Table table = client.createTable(
CreateTableRequest.of("my-table")
.addFamily("cf2", GCRULES.union()
.rule(GCRULES.maxAge(Duration.ofDays(30)))
.rule(GCRULES.maxVersions(5))
)
);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<Table> createTableAsync(CreateTableRequest request)
BaseBigtableTableAdminClient.createTableCallable().
Asynchronously creates a new table with the specified configuration.
Sample code:
// A table with a single column family, which retains values up to 7 days.
ApiFuture<Table> tableFuture = client.createTableAsync(
CreateTableRequest.of("my-table")
.addFamily("cf", GCRULES.maxAge(Duration.ofDays(7)))
);
// Another table with more complex garbage collection rules.
ApiFuture<Table> tableFuture = client.createTableAsync(
CreateTableRequest.of("my-table")
.addFamily("cf", GCRULES.intersection()
.rule(GCRULES.maxAge(120, TimeUnit.HOURS))
.rule(GCRULES.maxVersions(10))
)
);
ApiFutures.addCallback(
tableFuture,
new ApiFutureCallback<Table>() {
public void onSuccess(Table table) {
System.out.println("Created table: " + table.getTableName());
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public Table updateTable(UpdateTableRequest request)
com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient#updateTable(com.google.bigtable.admin.v2.UpdateTableRequest).
Update a table with the specified configuration.
Sample code:
// Alter change stream retention period.
Table table = client.updateTable(
UpdateTableRequest.of("my-table")
.addChangeStreamRetention(Duration.ofHours(24))
);
// Disable change stream
Table table = client.updateTable(
UpdateTableRequest.of("my-table")
.disableChangeStream()
);
for available options.@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<Table> updateTableAsync(UpdateTableRequest request)
BaseBigtableTableAdminClient.updateTableOperationCallable().
Asynchronously update a table with the specified configuration.
Sample code:
// Update table to 1 day change stream retention.
ApiFuture<Table> tableFuture = client.createTableAsync(
UpdateTableRequest.of("my-table")
.addChangeStreamRetention(Duration.ofHours(24))
);
ApiFutures.addCallback(
tableFuture,
new ApiFutureCallback<Table>() {
public void onSuccess(Table table) {
System.out.println("Updated table: " + table.getTableName());
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
for available options.@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public Table modifyFamilies(ModifyColumnFamiliesRequest request)
BaseBigtableTableAdminClient.modifyColumnFamilies(com.google.bigtable.admin.v2.ModifyColumnFamiliesRequest).
Creates, updates and drops column families as specified in the request.
Sample code:
Table modifiedTable = client.modifyFamilies(
ModifyColumnFamiliesRequest.of(tableId)
.addFamily("cf1")
.addFamily("cf2", GCRULES.maxAge(Duration.ofSeconds(1000, 20000)))
.updateFamily(
"cf3",
GCRULES.union()
.rule(GCRULES.maxAge(Duration.ofSeconds(100)))
.rule(GCRULES.maxVersions(1))
)
.addFamily(
"cf4",
GCRULES.intersection()
.rule(GCRULES.maxAge(Duration.ofSeconds(2000)))
.rule(GCRULES.maxVersions(10))
)
.dropFamily("cf5")
);
System.out.println("Resulting families:");
for (ColumnFamily cf : modifiedTable.getColumnFamilies()) {
System.out.println(cf.getId());
}
for available options.@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<Table> modifyFamiliesAsync(ModifyColumnFamiliesRequest request)
BaseBigtableTableAdminClient.modifyColumnFamiliesCallable().
Asynchronously creates, updates, and drops column families as specified in the request.
Sample code:
ApiFuture<Table> modifiedTableFuture = client.modifyFamiliesAsync(
ModifyColumnFamiliesRequest.of(tableId)
.addFamily("cf1")
.addFamily("cf2", GCRULES.maxAge(Duration.ofSeconds(1000, 20000)))
.updateFamily(
"cf3",
GCRULES.union()
.rule(GCRULES.maxAge(Duration.ofSeconds(100)))
.rule(GCRULES.maxVersions(1))
)
.addFamily(
"cf4",
GCRULES.intersection()
.rule(GCRULES.maxAge(Duration.ofSeconds(2000)))
.rule(GCRULES.maxVersions(10))
)
.dropFamily("cf5")
);
ApiFutures.addCallback(
modifiedTableFuture,
new ApiFutureCallback<Table>() {
public void onSuccess(Table table) {
System.out.println("Modified table: " + table.getTableName());
System.out.println("Resulting families:");
for (ColumnFamily cf : modifiedTable.getColumnFamilies()) {
System.out.println(cf.getId());
}
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
for available options.@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public void deleteTable(String tableId)
BaseBigtableTableAdminClient.deleteTable(com.google.bigtable.admin.v2.DeleteTableRequest).
Deletes the table specified by the table ID.
Sample code:
client.deleteTable("my-table");
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<Void> deleteTableAsync(String tableId)
BaseBigtableTableAdminClient.deleteTableCallable().
Asynchronously deletes the table specified by the table ID.
Sample code:
ApiFuture<Void> future = client.deleteTableAsync("my-table");
ApiFutures.addCallback(
future,
new ApiFutureCallback<Void>() {
public void onSuccess(Void ignored) {
System.out.println("Successfully deleted the table");
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public boolean exists(String tableId)
BaseBigtableTableAdminClient.getTable(com.google.bigtable.admin.v2.GetTableRequest).
Checks if the table specified by the table ID exists.
Sample code:
if(client.exists("my-table")) {
System.out.println("Table exists");
}
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<Boolean> existsAsync(String tableId)
BaseBigtableTableAdminClient.getTableCallable().
Asynchronously checks if the table specified by the table ID exists.
Sample code:
ApiFuture<Boolean> found = client.existsAsync("my-table");
ApiFutures.addCallback(
found,
new ApiFutureCallback<Boolean>() {
public void onSuccess(Boolean found) {
if (found) {
System.out.println("Table exists");
} else {
System.out.println("Table not found");
}
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public Table getTable(String tableId)
BaseBigtableTableAdminClient.getTable(com.google.bigtable.admin.v2.GetTableRequest).
Gets the table metadata by table ID.
Sample code:
Table table = client.getTable("my-table");
System.out.println("Got metadata for table: " + table.getId());
System.out.println("Column families:");
for (ColumnFamily cf : table.getColumnFamilies()) {
System.out.println(cf.getId());
}
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<Table> getTableAsync(String tableId)
BaseBigtableTableAdminClient.getTableCallable().
Asynchronously gets the table metadata by table ID.
Sample code:
ApiFuture<Table> tableFuture = client.getTableAsync("my-table");
ApiFutures.addCallback(
tableFuture,
new ApiFutureCallback<Table>() {
public void onSuccess(Table table) {
System.out.println("Got metadata for table: " + table.getId());
System.out.println("Column families:");
for (ColumnFamily cf : table.getColumnFamilies()) {
System.out.println(cf.getId());
}
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public Map<String,List<EncryptionInfo>> getEncryptionInfo(String tableId)
BaseBigtableTableAdminClient.getTable(com.google.bigtable.admin.v2.GetTableRequest).
Gets the current encryption info for the table across all of the clusters.
The returned Map will be keyed by cluster id and contain a status for all of the keys in use.
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<Map<String,List<EncryptionInfo>>> getEncryptionInfoAsync(String tableId)
BaseBigtableTableAdminClient.getTableCallable().
Asynchronously gets the current encryption info for the table across all of the clusters.
The returned Map will be keyed by cluster id and contain a status for all of the keys in use.
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public List<String> listTables()
BaseBigtableTableAdminClient.listTables(com.google.bigtable.admin.v2.ListTablesRequest).
Lists all table IDs in the instance.
Sample code:
List<String> tableIds = client.listTables();
System.out.println("Got list of tables:");
for(String tableId: tableIds) {
System.out.println(tableId);
}
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<List<String>> listTablesAsync()
BaseBigtableTableAdminClient.listTablesPagedCallable().
Asynchronously lists all table IDs in the instance.
Sample code:
ApiFuture<List<String>> listFuture = client.listTables();
ApiFutures.addCallback(
listFuture,
new ApiFutureCallback<List<String>>() {
public void onSuccess(List<String> tableIds) {
System.out.println("Got list of tables:");
for (String tableId : tableIds) {
System.out.println(tableId);
}
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public void dropRowRange(String tableId, String rowKeyPrefix)
BaseBigtableTableAdminClient.dropRowRange(com.google.bigtable.admin.v2.DropRowRangeRequest).
Drops rows by the specified row key prefix and table ID.
Please note that this method is considered part of the admin API and is rate limited.
Sample code:
client.dropRowRange("my-table", "prefix");
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<Void> dropRowRangeAsync(String tableId, String rowKeyPrefix)
BaseBigtableTableAdminClient.dropRowRangeCallable().
Asynchronously drops rows by the specified row key prefix and table ID.
Please note that this method is considered part of the admin API and is rate limited.
Sample code:
ApiFuture<Void> dropFuture = client.dropRowRangeAsync("my-table", "prefix");
ApiFutures.addCallback(
dropFuture,
new ApiFutureCallback<Void>() {
public void onSuccess(Void tableNames) {
System.out.println("Successfully dropped row range.");
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public void dropRowRange(String tableId, com.google.protobuf.ByteString rowKeyPrefix)
BaseBigtableTableAdminClient.dropRowRange(com.google.bigtable.admin.v2.DropRowRangeRequest).
Drops rows by the specified row key prefix and table ID.
Please note that this method is considered part of the admin API and is rate limited.
Sample code:
client.dropRowRange("my-table", ByteString.copyFromUtf8("prefix"));
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<Void> dropRowRangeAsync(String tableId, com.google.protobuf.ByteString rowKeyPrefix)
BaseBigtableTableAdminClient.dropRowRangeCallable().
Asynchronously drops rows by the specified row key prefix and table ID.
Please note that this method is considered part of the admin API and is rate limited.
Sample code:
ApiFuture<Void> dropFuture = client.dropRowRangeAsync("my-table", ByteString.copyFromUtf8("prefix"));
ApiFutures.addCallback(
dropFuture,
new ApiFutureCallback<Void>() {
public void onSuccess(Void tableNames) {
System.out.println("Successfully dropped row range.");
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public void dropAllRows(String tableId)
BaseBigtableTableAdminClient.dropRowRange(com.google.bigtable.admin.v2.DropRowRangeRequest).
Drops all data in the table.
Sample code:
client.dropAllRows("my-table");
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<Void> dropAllRowsAsync(String tableId)
BaseBigtableTableAdminClient.dropRowRangeCallable().
Asynchronously drops all data in the table.
Sample code:
ApiFuture<Void> dropFuture = client.dropAllRowsAsync("my-table");
ApiFutures.addCallback(
dropFuture,
new ApiFutureCallback<Void>() {
public void onSuccess(Void tableNames) {
System.out.println("Successfully dropped all data");
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") @Deprecated public void awaitReplication(String tableId)
BaseBigtableTableAdminClient.checkConsistency(com.google.bigtable.admin.v2.CheckConsistencyRequest).
Blocks the current thread until replication has caught up to the point when this method was called. This allows callers to make sure that their mutations have been replicated across all of their clusters.
Sample code
client.awaitReplication("my-table");
com.google.api.gax.retrying.PollException - when polling exceeds the total timeoutpublic void awaitConsistency(ConsistencyRequest consistencyRequest)
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public Backup createBackup(CreateBackupRequest request)
com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient#createBackup(com.google.bigtable.admin.v2.CreateBackupRequest).
Creates a backup with the specified configuration.
Sample code
CreateBackupRequest request =
CreateBackupRequest.of(clusterId, backupId)
.setSourceTableId(tableId)
.setExpireTime(expireTime);
Backup response = client.createBackup(request);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<Backup> createBackupAsync(CreateBackupRequest request)
BaseBigtableTableAdminClient.createBackupOperationCallable().
Creates a backup with the specified configuration asynchronously.
Sample code
CreateBackupRequest request =
CreateBackupRequest.of(clusterId, backupId)
.setSourceTableId(tableId)
.setExpireTime(expireTime);
ApiFuture<Backup> future = client.createBackupAsync(request);
ApiFutures.addCallback(
future,
new ApiFutureCallback<Backup>() {
public void onSuccess(Backup backup) {
System.out.println("Successfully create the backup " + backup.getId());
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public Backup getBackup(String clusterId, String backupId)
BaseBigtableTableAdminClient.getBackup(com.google.bigtable.admin.v2.GetBackupRequest).
Gets a backup with the specified backup ID in the specified cluster.
Sample code
Backup backup = client.getBackup(clusterId, backupId);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<Backup> getBackupAsync(String clusterId, String backupId)
BaseBigtableTableAdminClient.getBackupCallable().
Gets a backup with the specified backup ID in the specified cluster asynchronously.
Sample code
ApiFuture<Backup> future = client.getBackupAsync(clusterId, backupId);
ApiFutures.addCallback(
future,
new ApiFutureCallback<Backup>() {
public void onSuccess(Backup backup) {
System.out.println("Successfully get the backup " + backup.getId());
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public List<String> listBackups(String clusterId)
BaseBigtableTableAdminClient.listBackups(com.google.bigtable.admin.v2.ListBackupsRequest).
Lists backups in the specified cluster.
Sample code
List<String> backups = client.listBackups(clusterId);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<List<String>> listBackupsAsync(String clusterId)
BaseBigtableTableAdminClient.listBackupsPagedCallable().
Lists backups in the specified cluster asynchronously.
Sample code:
ApiFuture<List<String>> listFuture = client.listBackupsAsync(clusterId);
ApiFutures.addCallback(
listFuture,
new ApiFutureCallback<List<String>>() {
public void onSuccess(List<String> backupIds) {
System.out.println("Got list of backups:");
for (String backupId : backupIds) {
System.out.println(backupId);
}
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public void deleteBackup(String clusterId, String backupId)
BaseBigtableTableAdminClient.deleteBackup(com.google.bigtable.admin.v2.DeleteBackupRequest).
Deletes a backup with the specified backup ID in the specified cluster.
Sample code
client.deleteBackup(clusterId, backupId);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<Void> deleteBackupAsync(String clusterId, String backupId)
BaseBigtableTableAdminClient.deleteBackupCallable().
Deletes a backup with the specified backup ID in the specified cluster asynchronously.
Sample code
ApiFuture<Void> future = client.deleteBackupAsync(clusterId, backupId);
ApiFutures.addCallback(
future,
new ApiFutureCallback<Backup>() {
public void onSuccess(Void unused) {
System.out.println("Successfully delete the backup.");
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public Backup updateBackup(UpdateBackupRequest request)
BaseBigtableTableAdminClient.updateBackup(com.google.bigtable.admin.v2.UpdateBackupRequest).
Updates a backup with the specified configuration.
Sample code
Backup backup = client.updateBackup(clusterId, backupId);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<Backup> updateBackupAsync(UpdateBackupRequest request)
BaseBigtableTableAdminClient.updateBackupCallable().
Updates a backup with the specified configuration asynchronously.
Sample code
ApiFuture<Backup> future = client.updateBackupAsync(clusterId, backupId);
ApiFutures.addCallback(
future,
new ApiFutureCallback<Backup>() {
public void onSuccess(Backup backup) {
System.out.println("Successfully update the backup " + backup.getId());
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public RestoredTableResult restoreTable(RestoreTableRequest request) throws ExecutionException, InterruptedException
com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient#restoreTable(com.google.bigtable.admin.v2.RestoreTableRequest).
Restores a backup to a new table with the specified configuration.
Sample code
RestoredTableResult result =
client.restoreTable(RestoreTableRequest.of(clusterId, backupId).setTableId(tableId));
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<RestoredTableResult> restoreTableAsync(RestoreTableRequest request)
BaseBigtableTableAdminClient.restoreTableAsync(com.google.bigtable.admin.v2.RestoreTableRequest).
Restores a backup to a new table with the specified configuration asynchronously.
Sample code
ApiFuture<RestoredTableResult> future = client.restoreTableAsync(
RestoreTableRequest.of(clusterId, backupId).setTableId(tableId));
ApiFutures.addCallback(
future,
new ApiFutureCallback<RestoredTableResult>() {
public void onSuccess(RestoredTableResult result) {
System.out.println("Successfully restore the table.");
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
public com.google.api.core.ApiFuture<com.google.protobuf.Empty> awaitOptimizeRestoredTable(com.google.api.core.ApiFuture<RestoredTableResult> restoreFuture)
This method blocks until the restore operation is complete, extracts the optimization token, and returns an ApiFuture for the optimization phase.
restoreFuture - The future returned by restoreTableAsync().public void awaitOptimizeRestoredTable(OptimizeRestoredTableOperationToken token) throws ExecutionException, InterruptedException
Sample code
RestoredTableResult result =
client.restoreTable(RestoreTableRequest.of(clusterId, backupId).setTableId(tableId));
client.awaitOptimizeRestoredTable(result.getOptimizeRestoredTableOperationToken());
public com.google.api.core.ApiFuture<Void> awaitOptimizeRestoredTableAsync(OptimizeRestoredTableOperationToken token)
Sample code
RestoredTableResult result =
client.restoreTable(RestoreTableRequest.of(clusterId, backupId).setTableId(tableId));
ApiFuture<Void> future = client.awaitOptimizeRestoredTableAsync(
result.getOptimizeRestoredTableOperationToken());
ApiFutures.addCallback(
future,
new ApiFutureCallback<Void>() {
public void onSuccess(Void unused) {
System.out.println("The optimization of the restored table is done.");
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public Backup copyBackup(CopyBackupRequest request)
com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient#copyBackup(com.google.bigtable.admin.v2.CopyBackupRequest).
Copy an existing backup to a new backup in a Cloud Bigtable cluster with the specified configuration.
Sample code Note: You want to create the client with project and instance where you want the new backup to be copied to.
BigtableTableAdminClient client = BigtableTableAdminClient.create("[PROJECT]", "[INSTANCE]");
CopyBackupRequest request =
CopyBackupRequest.of(sourceClusterId, sourceBackupId)
.setDestination(clusterId, backupId)
.setExpireTime(expireTime);
Backup response = client.copyBackup(request);
If the source backup is located in a different instance
CopyBackupRequest request =
CopyBackupRequest.of(sourceClusterId, sourceBackupId)
.setSourceInstance(sourceInstanceId)
.setDestination(clusterId, backupId)
.setExpireTime(expireTime);
Backup response = client.copyBackup(request);
If the source backup is located in a different project
CopyBackupRequest request =
CopyBackupRequest.of(sourceClusterId, sourceBackupId)
.setSourceInstance(sourceProjectId, sourceInstanceId)
.setDestination(clusterId, backupId)
.setExpireTime(expireTime);
Backup response = client.copyBackup(request);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<Backup> copyBackupAsync(CopyBackupRequest request)
BaseBigtableTableAdminClient.copyBackupOperationCallable().
Creates a copy of a backup from an existing backup in a Cloud Bigtable cluster with the specified configuration asynchronously.
Sample code
CopyBackupRequest request =
CopyBackupRequest.of(sourceClusterId, sourceBackupId)
.setDestination(clusterId, backupId)
.setExpireTime(expireTime);
ApiFuture<Backup> future = client.copyBackupAsync(request);
ApiFutures.addCallback(
future,
new ApiFutureCallback<Backup>() {
public void onSuccess(Backup backup) {
System.out.println("Successfully create the backup " + backup.getId());
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") @Deprecated public com.google.api.core.ApiFuture<Void> awaitReplicationAsync(String tableId)
BaseBigtableTableAdminClient.generateConsistencyTokenCallable().
Returns a future that is resolved when replication has caught up to the point when this method was called. This allows callers to make sure that their mutations have been replicated across all of their clusters.
Sample code:
ApiFuture<Void> replicationFuture = client.awaitReplicationAsync("my-table");
ApiFutures.addCallback(
replicationFuture,
new ApiFutureCallback<Void>() {
public void onSuccess(Table table) {
System.out.println("All clusters are now consistent");
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
public void waitForConsistency(String tableId, String consistencyToken)
tableId - The table to check.consistencyToken - The token to poll.public com.google.api.core.ApiFuture<Void> waitForConsistencyAsync(String tableId, String consistencyToken)
tableId - The table to check.consistencyToken - The token to poll.@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public AuthorizedView createAuthorizedView(CreateAuthorizedViewRequest request)
com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient#createAuthorizedView(com.google.bigtable.admin.v2.CreateAuthorizedViewRequest).
Creates a new authorized view with the specified configuration.
Sample code:
CreateAuthorizedViewRequest request =
CreateAuthorizedViewRequest.of("my-table", "my-new-authorized-view")
.setDeletionProtection(true)
.setAuthorizedViewType(
SubsetView.create()
.addRowPrefix("row#")
.addFamilySubsets(
"my-family", FamilySubsets.create().addQualifier("column")));
AuthorizedView response = client.createAuthorizedView(request);
for available options.@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<AuthorizedView> createAuthorizedViewAsync(CreateAuthorizedViewRequest request)
BaseBigtableTableAdminClient.createAuthorizedViewOperationCallable().
Asynchronously creates a new authorized view with the specified configuration.
Sample code:
CreateAuthorizedViewRequest request =
CreateAuthorizedViewRequest.of("my-table", "my-new-authorized-view")
.setDeletionProtection(true)
.setAuthorizedViewType(
SubsetView.create()
.addRowPrefix("row#")
.addFamilySubsets(
"my-family", FamilySubsets.create().addQualifier("column")));
ApiFuture<AuthorizedView> future = client.createAuthorizedViewAsync(request);
ApiFutures.addCallback(
future,
new ApiFutureCallback<AuthorizedView>() {
public void onSuccess(AuthorizedView authorizedView) {
System.out.println("Successfully created the authorized view: " + authorizedView.getId());
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
for available options.@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public AuthorizedView updateAuthorizedView(UpdateAuthorizedViewRequest request)
com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient#updateAuthorizedView(com.google.bigtable.admin.v2.UpdateAuthorizedViewRequest).
Updates an existing authorized view with the specified configuration.
Sample code:
AuthorizedView existingAuthorizedView = client.getAuthorizedView("my-table", "my-authorized-view");
UpdateAuthorizedViewRequest request =
UpdateAuthorizedViewRequest.of(existingAuthorizedView).setDeletionProtection(true);
AuthorizedView response = client.updateAuthorizedView(request);
for available options.@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<AuthorizedView> updateAuthorizedViewAsync(UpdateAuthorizedViewRequest request)
BaseBigtableTableAdminClient.updateAuthorizedViewOperationCallable().
Asynchronously updates an existing authorized view with the specified configuration.
Sample code:
AuthorizedView existingAuthorizedView = client.getAuthorizedView("my-table", "my-authorized-view");
UpdateAuthorizedViewRequest request =
UpdateAuthorizedViewRequest.of(existingAuthorizedView).setDeletionProtection(true);
ApiFuture<AuthorizedView> future = client.updateAuthorizedViewAsync(request);
ApiFutures.addCallback(
future,
new ApiFutureCallback<AuthorizedView>() {
public void onSuccess(AuthorizedView authorizedView) {
System.out.println("Successfully updated the authorized view: " + authorizedView.getId());
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
for available options.@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public AuthorizedView getAuthorizedView(String tableId, String authorizedViewId)
BaseBigtableTableAdminClient.getAuthorizedView(com.google.bigtable.admin.v2.GetAuthorizedViewRequest).
Gets an authorized view with the specified authorized view ID in the specified table.
Sample code:
AuthorizedView authorizedView = client.getAuthorizedView("my-table", "my-authorized-view");
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<AuthorizedView> getAuthorizedViewAsync(String tableId, String authorizedViewId)
BaseBigtableTableAdminClient.getAuthorizedViewCallable().
Asynchronously gets an authorized view with the specified authorized view ID in the specified table.
Sample code:
ApiFuture<AuthorizedView> future = client.getAuthorizedViewAsync("my-table", "my-authorized-view");
ApiFutures.addCallback(
future,
new ApiFutureCallback<AuthorizedView>() {
public void onSuccess(AuthorizedView authorizedView) {
System.out.println("Successfully get the authorized view: " + authorizedView.getId());
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public List<String> listAuthorizedViews(String tableId)
BaseBigtableTableAdminClient.listAuthorizedViews(com.google.bigtable.admin.v2.ListAuthorizedViewsRequest).
Lists all authorized view IDs in the specified table.
Sample code:
List<String> authorizedViews = client.listAuthorizedViews("my-table");
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<List<String>> listAuthorizedViewsAsync(String tableId)
BaseBigtableTableAdminClient.listAuthorizedViewsPagedCallable().
Asynchronously lists all authorized view IDs in the specified table.
Sample code:
ApiFuture<List<String>> future = client.listAuthorizedViewsAsync("my-table");
ApiFutures.addCallback(
future,
new ApiFutureCallback<List<String>>() {
public void onSuccess(List<String> authorizedViewIds) {
System.out.println("Successfully get list of authorized views:");
for (AuthorizedView authorizedViewId : authorizedViewIds) {
System.out.println(authorizedViewId);
}
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public void deleteAuthorizedView(String tableId, String authorizedViewId)
BaseBigtableTableAdminClient.deleteAuthorizedView(com.google.bigtable.admin.v2.DeleteAuthorizedViewRequest).
Deletes an authorized view with the specified authorized view ID in the specified table. Note that the deletion is prohibited if the authorized view has deletion_protection field set to true.
Sample code:
client.deleteAuthorizedView("my-table", "my-authorized-view");
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<Void> deleteAuthorizedViewAsync(String tableId, String authorizedViewId)
BaseBigtableTableAdminClient.deleteAuthorizedViewCallable().
Asynchronously deletes an authorized view with the specified authorized view ID in the specified table. Note that the deletion is prohibited if the authorized view has deletion_protection field set to true.
Sample code:
ApiFuture<void> future = client.deleteAuthorizedViewAsync("my-table", "my-authorized-view");
ApiFutures.addCallback(
future,
new ApiFutureCallback<void>() {
public void onSuccess(Void ignored) {
System.out.println("Successfully deleted the authorized view");
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public SchemaBundle createSchemaBundle(CreateSchemaBundleRequest request)
com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient#createSchemaBundle(com.google.bigtable.admin.v2.CreateSchemaBundleRequest).
Creates a new schema bundle with the specified configuration.
Sample code:
CreateSchemaBundleRequest request = CreateSchemaBundleRequest.of("my-table", "my-new-schema-bundle")
.setDeletionProtection(true)
.setSchemaBundleType(
SubsetView.create()
.addRowPrefix("row#")
.addFamilySubsets(
"my-family", FamilySubsets.create().addQualifier("column")));
SchemaBundle response = client.createSchemaBundle(request);
for available options.@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<SchemaBundle> createSchemaBundleAsync(CreateSchemaBundleRequest request)
BaseBigtableTableAdminClient.createSchemaBundleOperationCallable().
Asynchronously creates a new schema bundle with the specified configuration.
Sample code:
CreateSchemaBundleRequest request = CreateSchemaBundleRequest.of("my-table", "my-new-schema-bundle")
.setDeletionProtection(true)
.setSchemaBundleType(
SubsetView.create()
.addRowPrefix("row#")
.addFamilySubsets(
"my-family", FamilySubsets.create().addQualifier("column")));
ApiFuture<SchemaBundle> future = client.createSchemaBundleAsync(request);
ApiFutures.addCallback(
future,
new ApiFutureCallback<SchemaBundle>() {
public void onSuccess(SchemaBundle schemaBundle) {
System.out.println("Successfully created the schema bundle: " + schemaBundle.getId());
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor());
for available options.@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public SchemaBundle updateSchemaBundle(UpdateSchemaBundleRequest request)
com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient#updateSchemaBundle(com.google.bigtable.admin.v2.UpdateSchemaBundleRequest).
Updates an existing schema bundle with the specified configuration.
Sample code:
SchemaBundle existingSchemaBundle = client.getSchemaBundle("my-table", "my-schema-bundle");
UpdateSchemaBundleRequest request = UpdateSchemaBundleRequest.of(existingSchemaBundle).setDeletionProtection(true);
SchemaBundle response = client.updateSchemaBundle(request);
for available options.@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<SchemaBundle> updateSchemaBundleAsync(UpdateSchemaBundleRequest request)
BaseBigtableTableAdminClient.updateSchemaBundleOperationCallable().
Asynchronously updates an existing schema bundle with the specified configuration.
Sample code:
SchemaBundle existingSchemaBundle = client.getSchemaBundle("my-table", "my-schema-bundle");
UpdateSchemaBundleRequest request = UpdateSchemaBundleRequest.of(existingSchemaBundle).setDeletionProtection(true);
ApiFuture<SchemaBundle> future = client.updateSchemaBundleAsync(request);
ApiFutures.addCallback(
future,
new ApiFutureCallback<SchemaBundle>() {
public void onSuccess(SchemaBundle schemaBundle) {
System.out.println("Successfully updated the schema bundle: " + schemaBundle.getId());
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor());
for available options.@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public SchemaBundle getSchemaBundle(String tableId, String schemaBundleId)
BaseBigtableTableAdminClient.getSchemaBundle(com.google.bigtable.admin.v2.GetSchemaBundleRequest).
Gets an schema bundle with the specified schema bundle ID in the specified table.
Sample code:
SchemaBundle schemaBundle = client.getSchemaBundle("my-table", "my-schema-bundle");
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<SchemaBundle> getSchemaBundleAsync(String tableId, String schemaBundleId)
BaseBigtableTableAdminClient.getSchemaBundleCallable().
Asynchronously gets an schema bundle with the specified schema bundle ID in the specified table.
Sample code:
ApiFuture<SchemaBundle> future = client.getSchemaBundleAsync("my-table", "my-schema-bundle");
ApiFutures.addCallback(
future,
new ApiFutureCallback<SchemaBundle>() {
public void onSuccess(SchemaBundle schemaBundle) {
System.out.println("Successfully get the schema bundle: " + schemaBundle.getId());
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor());
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public List<String> listSchemaBundles(String tableId)
BaseBigtableTableAdminClient.listSchemaBundles(com.google.bigtable.admin.v2.ListSchemaBundlesRequest).
Lists all schema bundle IDs in the specified table.
Sample code:
List<String> schemaBundles = client.listSchemaBundles("my-table");
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<List<String>> listSchemaBundlesAsync(String tableId)
BaseBigtableTableAdminClient.listSchemaBundlesPagedCallable().
Asynchronously lists all schema bundle IDs in the specified table.
Sample code:
ApiFuture<List<String>> future = client.listSchemaBundlesAsync("my-table");
ApiFutures.addCallback(
future,
new ApiFutureCallback<List<String>>() {
public void onSuccess(List<String> schemaBundleIds) {
System.out.println("Successfully get list of schema bundles:");
for (SchemaBundle schemaBundleId : schemaBundleIds) {
System.out.println(schemaBundleId);
}
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor());
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public void deleteSchemaBundle(String tableId, String schemaBundleId)
BaseBigtableTableAdminClient.deleteSchemaBundle(com.google.bigtable.admin.v2.DeleteSchemaBundleRequest).
Deletes an schema bundle with the specified schema bundle ID in the specified table.
Sample code:
client.deleteSchemaBundle("my-table", "my-schema-bundle");
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<Void> deleteSchemaBundleAsync(String tableId, String schemaBundleId)
BaseBigtableTableAdminClient.deleteSchemaBundleCallable().
Asynchronously deletes an schema bundle with the specified schema bundle ID in the specified table.
Sample code:
ApiFuture<void> future = client.deleteSchemaBundleAsync("my-table", "my-schema-bundle");
ApiFutures.addCallback(
future,
new ApiFutureCallback<void>() {
public void onSuccess(Void ignored) {
System.out.println("Successfully deleted the schema bundle");
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor()
);
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.cloud.Policy getIamPolicy(String tableId)
BaseBigtableTableAdminClient.getIamPolicy(com.google.iam.v1.GetIamPolicyRequest).
Gets the IAM access control policy for the specified table.
Sample code:
Policy policy = client.getIamPolicy("my-table");
for(Map.Entry<Role, Set<Identity>> entry : policy.getBindings().entrySet()) {
System.out.printf("Role: %s Identities: %s\n", entry.getKey(), entry.getValue());
}
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<com.google.cloud.Policy> getIamPolicyAsync(String tableId)
BaseBigtableTableAdminClient.getIamPolicyCallable().
Asynchronously gets the IAM access control policy for the specified table.
Sample code:
ApiFuture<Policy> policyFuture = client.getIamPolicyAsync("my-table");
ApiFutures.addCallback(policyFuture,
new ApiFutureCallback<Policy>() {
public void onSuccess(Policy policy) {
for (Entry<Role, Set<Identity>> entry : policy.getBindings().entrySet()) {
System.out.printf("Role: %s Identities: %s\n", entry.getKey(), entry.getValue());
}
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor());
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.cloud.Policy setIamPolicy(String tableId, com.google.cloud.Policy policy)
BaseBigtableTableAdminClient.setIamPolicy(com.google.iam.v1.SetIamPolicyRequest).
Replaces the IAM policy associated with the specified table.
Sample code:
Policy newPolicy = client.setIamPolicy("my-table",
Policy.newBuilder()
.addIdentity(Role.of("bigtable.user"), Identity.user("someone@example.com"))
.addIdentity(Role.of("bigtable.admin"), Identity.group("admins@example.com"))
.build());
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<com.google.cloud.Policy> setIamPolicyAsync(String tableId, com.google.cloud.Policy policy)
BaseBigtableTableAdminClient.setIamPolicyCallable().
Asynchronously replaces the IAM policy associated with the specified table.
Sample code:
ApiFuture<Policy> newPolicyFuture = client.setIamPolicyAsync("my-table",
Policy.newBuilder()
.addIdentity(Role.of("bigtable.user"), Identity.user("someone@example.com"))
.addIdentity(Role.of("bigtable.admin"), Identity.group("admins@example.com"))
.build());
ApiFutures.addCallback(policyFuture,
new ApiFutureCallback<Policy>() {
public void onSuccess(Policy policy) {
for (Entry<Role, Set<Identity>> entry : policy.getBindings().entrySet()) {
System.out.printf("Role: %s Identities: %s\n", entry.getKey(), entry.getValue());
}
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor());
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public List<String> testIamPermission(String tableId, String... permissions)
BaseBigtableTableAdminClient.testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest).
Tests whether the caller has the given permissions for the specified table. Returns a subset of the specified permissions that the caller has.
Sample code:
List<String> grantedPermissions = client.testIamPermission("my-table",
"bigtable.tables.readRows", "bigtable.tables.mutateRows");
System.out.println("Has read access: " +
grantedPermissions.contains("bigtable.tables.readRows")); System.out.println("Has write access:
" + grantedPermissions.contains("bigtable.tables.mutateRows"));@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<List<String>> testIamPermissionAsync(String tableId, String... permissions)
BaseBigtableTableAdminClient.testIamPermissionsCallable().
Asynchronously tests whether the caller has the given permissions for the specified table. Returns a subset of the specified permissions that the caller has.
Sample code:
ApiFuture<List<String>> grantedPermissionsFuture = client.testIamPermissionAsync("my-table",
"bigtable.tables.readRows", "bigtable.tables.mutateRows");
ApiFutures.addCallback(grantedPermissionsFuture,
new ApiFutureCallback<List<String>>() {
public void onSuccess(List<String> grantedPermissions) {
System.out.println("Has read access: " + grantedPermissions.contains("bigtable.tables.readRows"));
System.out.println("Has write access: " + grantedPermissions.contains("bigtable.tables.mutateRows"));
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor());
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.cloud.Policy getBackupIamPolicy(String clusterId, String backupId)
BaseBigtableTableAdminClient.getIamPolicy(com.google.iam.v1.GetIamPolicyRequest).
Gets the IAM access control policy for the specified backup.
Sample code:
Policy policy = client.getBackupIamPolicy("my-cluster-id", "my-backup-id");
for(Map.Entry<Role, Set<Identity>> entry : policy.getBindings().entrySet()) {
System.out.printf("Role: %s Identities: %s\n", entry.getKey(), entry.getValue());
}
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<com.google.cloud.Policy> getBackupIamPolicyAsync(String clusterId, String backupId)
BaseBigtableTableAdminClient.getIamPolicyCallable().
Asynchronously gets the IAM access control policy for the specified backup.
Sample code:
ApiFuture<Policy> policyFuture = client.getBackupIamPolicyAsync("my-cluster-id", "my-backup-id");
ApiFutures.addCallback(policyFuture,
new ApiFutureCallback<Policy>() {
public void onSuccess(Policy policy) {
for (Entry<Role, Set<Identity>> entry : policy.getBindings().entrySet()) {
System.out.printf("Role: %s Identities: %s\n", entry.getKey(), entry.getValue());
}
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor());
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.cloud.Policy setBackupIamPolicy(String clusterId, String backupId, com.google.cloud.Policy policy)
BaseBigtableTableAdminClient.setIamPolicy(com.google.iam.v1.SetIamPolicyRequest).
Replaces the IAM policy associated with the specified backup.
Sample code:
Policy newPolicy = client.setBackupIamPolicy("my-cluster-id", "my-backup-id",
Policy.newBuilder()
.addIdentity(Role.of("bigtable.user"), Identity.user("someone@example.com"))
.addIdentity(Role.of("bigtable.admin"), Identity.group("admins@example.com"))
.build());
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<com.google.cloud.Policy> setBackupIamPolicyAsync(String clusterId, String backupId, com.google.cloud.Policy policy)
BaseBigtableTableAdminClient.setIamPolicyCallable().
Asynchronously replaces the IAM policy associated with the specified backup.
Sample code:
ApiFuture<Policy> newPolicyFuture = client.setBackupIamPolicyAsync("my-cluster-id", "my-backup-id",
Policy.newBuilder()
.addIdentity(Role.of("bigtable.user"), Identity.user("someone@example.com"))
.addIdentity(Role.of("bigtable.admin"), Identity.group("admins@example.com"))
.build());
ApiFutures.addCallback(newPolicyFuture,
new ApiFutureCallback<Policy>() {
public void onSuccess(Policy policy) {
for (Entry<Role, Set<Identity>> entry : policy.getBindings().entrySet()) {
System.out.printf("Role: %s Identities: %s\n", entry.getKey(), entry.getValue());
}
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor());
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public List<String> testBackupIamPermission(String clusterId, String backupId, String... permissions)
BaseBigtableTableAdminClient.testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest).
Tests whether the caller has the given permissions for the specified backup. Returns a subset of the specified permissions that the caller has.
Sample code:
List<String> grantedPermissions = client.testBackupIamPermission("my-cluster-id", "my-backup-id",
"bigtable.backups.restore", "bigtable.backups.delete");
System.out.println("Has restore access: " +
grantedPermissions.contains("bigtable.backups.restore"));
System.out.println("Has delete access: " + grantedPermissions.contains("bigtable.backups.delete"));
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<List<String>> testBackupIamPermissionAsync(String clusterId, String backupId, String... permissions)
BaseBigtableTableAdminClient.testIamPermissionsCallable().
Asynchronously tests whether the caller has the given permissions for the specified backup. Returns a subset of the specified permissions that the caller has.
Sample code:
ApiFuture<List<String>> grantedPermissionsFuture = client.testBackupIamPermissionAsync("my-cluster-id", "my-backup-id",
"bigtable.backups.restore", "bigtable.backups.delete");
ApiFutures.addCallback(grantedPermissionsFuture,
new ApiFutureCallback<List<String>>() {
public void onSuccess(List<String> grantedPermissions) {
System.out.println("Has restore access: " + grantedPermissions.contains("bigtable.backups.restore"));
System.out.println("Has delete access: " + grantedPermissions.contains("bigtable.backups.delete"));
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor());
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.cloud.Policy getAuthorizedViewIamPolicy(String tableId, String authorizedViewId)
BaseBigtableTableAdminClient.getIamPolicy(com.google.iam.v1.GetIamPolicyRequest).
Gets the IAM access control policy for the specified authorized view.
Sample code:
Policy policy = client.getAuthorizedViewIamPolicy("my-table-id", "my-authorized-view-id");
for(Map.Entry<Role, Set<Identity>> entry : policy.getBindings().entrySet()) {
System.out.printf("Role: %s Identities: %s\n", entry.getKey(), entry.getValue());
}
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<com.google.cloud.Policy> getAuthorizedViewIamPolicyAsync(String tableId, String authorizedViewId)
BaseBigtableTableAdminClient.getIamPolicyCallable().
Asynchronously gets the IAM access control policy for the specified authorized view.
Sample code:
ApiFuture<Policy> policyFuture = client.getAuthorizedViewIamPolicyAsync("my-table-id", "my-authorized-view-id");
ApiFutures.addCallback(policyFuture,
new ApiFutureCallback<Policy>() {
public void onSuccess(Policy policy) {
for (Entry<Role, Set<Identity>> entry : policy.getBindings().entrySet()) {
System.out.printf("Role: %s Identities: %s\n", entry.getKey(), entry.getValue());
}
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor());
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.cloud.Policy setAuthorizedViewIamPolicy(String tableId, String authorizedViewId, com.google.cloud.Policy policy)
BaseBigtableTableAdminClient.setIamPolicy(com.google.iam.v1.SetIamPolicyRequest).
Replaces the IAM policy associated with the specified authorized view.
Sample code:
Policy newPolicy = client.setAuthorizedViewIamPolicy("my-table-id", "my-authorized-view-id",
Policy.newBuilder()
.addIdentity(Role.of("bigtable.user"), Identity.user("someone@example.com"))
.addIdentity(Role.of("bigtable.admin"), Identity.group("admins@example.com"))
.build());
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<com.google.cloud.Policy> setAuthorizedViewIamPolicyAsync(String tableId, String authorizedViewId, com.google.cloud.Policy policy)
BaseBigtableTableAdminClient.setIamPolicyCallable().
Asynchronously replaces the IAM policy associated with the specified authorized view.
Sample code:
ApiFuture<Policy> newPolicyFuture = client.setAuthorizedViewIamPolicyAsync("my-table-id", "my-authorized-view-id",
Policy.newBuilder()
.addIdentity(Role.of("bigtable.user"), Identity.user("someone@example.com"))
.addIdentity(Role.of("bigtable.admin"), Identity.group("admins@example.com"))
.build());
ApiFutures.addCallback(newPolicyFuture,
new ApiFutureCallback<Policy>() {
public void onSuccess(Policy policy) {
for (Entry<Role, Set<Identity>> entry : policy.getBindings().entrySet()) {
System.out.printf("Role: %s Identities: %s\n", entry.getKey(), entry.getValue());
}
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor());
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public List<String> testAuthorizedViewIamPermission(String tableId, String authorizedViewId, String... permissions)
BaseBigtableTableAdminClient.testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest).
Tests whether the caller has the given permissions for the specified authorized view. Returns a subset of the specified permissions that the caller has.
Sample code:
List<String> grantedPermissions = client.testAuthorizedViewIamPermission("my-table-id", "my-authorized-view-id",
"bigtable.authorizedViews.get", "bigtable.authorizedViews.delete");
System.out.println("Has get access: " +
grantedPermissions.contains("bigtable.authorizedViews.get"));
System.out.println("Has delete access: " + grantedPermissions.contains("bigtable.authorizedViews.delete"));
@ObsoleteApi(value="Use getBaseClient() to access the auto-generated proto-based methods instead.") public com.google.api.core.ApiFuture<List<String>> testAuthorizedViewIamPermissionAsync(String tableId, String authorizedViewId, String... permissions)
BaseBigtableTableAdminClient.testIamPermissionsCallable().
Asynchronously tests whether the caller has the given permissions for the specified authorized view. Returns a subset of the specified permissions that the caller has.
Sample code:
ApiFuture<List<String>> grantedPermissionsFuture = client.testAuthorizedViewIamPermissionAsync("my-table-id",
"my-authorized-view-id", "bigtable.authorizedViews.get", "bigtable.authorizedViews.delete");
ApiFutures.addCallback(grantedPermissionsFuture,
new ApiFutureCallback<List<String>>() {
public void onSuccess(List<String> grantedPermissions) {
System.out.println("Has get access: " + grantedPermissions.contains("bigtable.authorizedViews.get"));
System.out.println("Has delete access: " + grantedPermissions.contains("bigtable.authorizedViews.delete"));
}
public void onFailure(Throwable t) {
t.printStackTrace();
}
},
MoreExecutors.directExecutor());
Copyright © 2026 Google LLC. All rights reserved.