Package com.google.cloud.bigtable.admin.v2 (2.32.0)

Clients for the Cloud Bigtable admin API.

These APIs allow callers to create and manage Cloud Bigtable resources. See Also: com.google.cloud.bigtable.admin.v2.BigtableInstanceAdminClientfor instance level API., com.google.cloud.bigtable.admin.v2.BigtableTableAdminClientfor table level API.

Classes

BigtableInstanceAdminClient

Client for creating, configuring and deleting Cloud Bigtable instances, app profiles, and clusters.

See the individual methods for example code.


 // One instance per application.
 BigtableInstanceAdminClient client =  BigtableInstanceAdminClient.create("my-project");
 CreateInstanceRequest request = CreateInstanceRequest.of("my-instance")
   .addCluster("my-cluster", "us-east1-c", 3, StorageType.SSD);

 Instance instance = client.createInstance(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 BigtableInstanceAdminSettings to create(). For example:

To customize credentials:


 BigtableInstanceAdminSettings settings = BigtableInstanceAdminSettings.newBuilder()
   .setProjectId("my-project")
   .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
   .build();

 BigtableInstanceAdminClient client = BigtableInstanceAdminClient.create(settings);
 

To customize the endpoint:


 BigtableInstanceAdminSettings.Builder settingsBuilder = BigtableInstanceAdminSettings.newBuilder()
   .setProjectId("my-project");

 settingsBuilder.stubSettings()
   .setEndpoint(myEndpoint);

 BigtableInstanceAdminClient client = BigtableInstanceAdminClient.create(settingsBuilder.build());
 

BigtableInstanceAdminSettings

Settings class to configure an instance of BigtableInstanceAdminClient.

It must be configured with a project ID and can be used to change default RPC settings.

Example usage:


 BigtableInstanceAdminSettings.Builder settingsBuilder = BigtableInstanceAdminSettings.newBuilder()
  .setProjectId("my-project");

 settingsBuilder.stubSettings().createInstanceSettings()
   .setRetrySettings(
     RetrySettings.newBuilder()
       .setTotalTimeout(Duration.ofMinutes(15))
       .build());

 BigtableInstanceAdminSettings settings = settingsBuilder.build();
 

BigtableInstanceAdminSettings.Builder

Builder for BigtableInstanceAdminSettings.

BigtableTableAdminClient

Client for creating, configuring, and deleting Cloud Bigtable tables

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]");

 CreateTableRequest request =
   CreateTableRequest.of("my-table")
     .addFamily("cf1")
     .addFamily("cf2", GCRULES.maxVersions(10))
     .addSplit(ByteString.copyFromUtf8("b"))
     .addSplit(ByteString.copyFromUtf8("q"));
 client.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());
 

BigtableTableAdminSettings

Settings class to configure an instance of BigtableTableAdminClient.

It must be configured with a project ID and instance ID.

Example usage:


 BigtableTableAdminSettings.Builder tableAdminSettingsBuilder = BigtableTableAdminSettings.newBuilder()
   .setProjectId("my-project")
   .setInstanceId("my-instance");

 tableAdminSettingsBuilder.stubSettings().createTableSettings()
   .setRetrySettings(
     RetrySettings.newBuilder()
       .setTotalTimeout(Duration.ofMinutes(15))
       .build());

 BigtableTableAdminSettings tableAdminSettings = tableAdminSettingsBuilder.build();
 

BigtableTableAdminSettings.Builder

Builder for BigtableTableAdminSettings.