@Generated(value="by GAPIC v0.0.5") @BetaApi public class BigtableInstanceAdminClient extends Object implements com.google.api.gax.core.BackgroundResource
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
Instance response = bigtableInstanceAdminClient.getInstance(name);
}
Note: close() needs to be called on the bigtableInstanceAdminClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of BigtableInstanceAdminSettings to create(). For example:
To customize credentials:
BigtableInstanceAdminSettings bigtableInstanceAdminSettings =
BigtableInstanceAdminSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
BigtableInstanceAdminClient bigtableInstanceAdminClient =
BigtableInstanceAdminClient.create(bigtableInstanceAdminSettings);
To customize the endpoint:
BigtableInstanceAdminSettings bigtableInstanceAdminSettings =
BigtableInstanceAdminSettings.newBuilder().setEndpoint(myEndpoint).build();
BigtableInstanceAdminClient bigtableInstanceAdminClient =
BigtableInstanceAdminClient.create(bigtableInstanceAdminSettings);
| Modifier | Constructor and Description |
|---|---|
protected |
BigtableInstanceAdminClient(BigtableInstanceAdminSettings settings)
Constructs an instance of BigtableInstanceAdminClient, using the given settings.
|
protected |
BigtableInstanceAdminClient(BigtableInstanceAdminStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static BigtableInstanceAdminClient |
create()
Constructs an instance of BigtableInstanceAdminClient with default settings.
|
static BigtableInstanceAdminClient |
create(BigtableInstanceAdminSettings settings)
Constructs an instance of BigtableInstanceAdminClient, using the given settings.
|
static BigtableInstanceAdminClient |
create(BigtableInstanceAdminStub stub)
Constructs an instance of BigtableInstanceAdminClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<com.google.bigtable.admin.v2.Cluster,com.google.bigtable.admin.v2.CreateClusterMetadata> |
createClusterAsync(com.google.bigtable.admin.v2.CreateClusterRequest request)
Creates a cluster within an instance.
|
com.google.api.gax.longrunning.OperationFuture<com.google.bigtable.admin.v2.Cluster,com.google.bigtable.admin.v2.CreateClusterMetadata> |
createClusterAsync(com.google.bigtable.admin.v2.InstanceName parent,
String clusterId,
com.google.bigtable.admin.v2.Cluster cluster)
Creates a cluster within an instance.
|
com.google.api.gax.rpc.UnaryCallable<com.google.bigtable.admin.v2.CreateClusterRequest,com.google.longrunning.Operation> |
createClusterCallable()
Creates a cluster within an instance.
|
com.google.api.gax.rpc.OperationCallable<com.google.bigtable.admin.v2.CreateClusterRequest,com.google.bigtable.admin.v2.Cluster,com.google.bigtable.admin.v2.CreateClusterMetadata> |
createClusterOperationCallable()
Creates a cluster within an instance.
|
com.google.api.gax.longrunning.OperationFuture<com.google.bigtable.admin.v2.Instance,com.google.bigtable.admin.v2.CreateInstanceMetadata> |
createInstanceAsync(com.google.bigtable.admin.v2.CreateInstanceRequest request)
Create an instance within a project.
|
com.google.api.gax.longrunning.OperationFuture<com.google.bigtable.admin.v2.Instance,com.google.bigtable.admin.v2.CreateInstanceMetadata> |
createInstanceAsync(com.google.bigtable.admin.v2.ProjectName parent,
String instanceId,
com.google.bigtable.admin.v2.Instance instance,
Map<String,com.google.bigtable.admin.v2.Cluster> clusters)
Create an instance within a project.
|
com.google.api.gax.rpc.UnaryCallable<com.google.bigtable.admin.v2.CreateInstanceRequest,com.google.longrunning.Operation> |
createInstanceCallable()
Create an instance within a project.
|
com.google.api.gax.rpc.OperationCallable<com.google.bigtable.admin.v2.CreateInstanceRequest,com.google.bigtable.admin.v2.Instance,com.google.bigtable.admin.v2.CreateInstanceMetadata> |
createInstanceOperationCallable()
Create an instance within a project.
|
void |
deleteCluster(com.google.bigtable.admin.v2.ClusterName name)
Deletes a cluster from an instance.
|
com.google.api.gax.rpc.UnaryCallable<com.google.bigtable.admin.v2.DeleteClusterRequest,com.google.protobuf.Empty> |
deleteClusterCallable()
Deletes a cluster from an instance.
|
void |
deleteInstance(com.google.bigtable.admin.v2.InstanceName name)
Delete an instance from a project.
|
com.google.api.gax.rpc.UnaryCallable<com.google.bigtable.admin.v2.DeleteInstanceRequest,com.google.protobuf.Empty> |
deleteInstanceCallable()
Delete an instance from a project.
|
com.google.bigtable.admin.v2.Cluster |
getCluster(com.google.bigtable.admin.v2.ClusterName name)
Gets information about a cluster.
|
com.google.api.gax.rpc.UnaryCallable<com.google.bigtable.admin.v2.GetClusterRequest,com.google.bigtable.admin.v2.Cluster> |
getClusterCallable()
Gets information about a cluster.
|
com.google.bigtable.admin.v2.Instance |
getInstance(com.google.bigtable.admin.v2.InstanceName name)
Gets information about an instance.
|
com.google.api.gax.rpc.UnaryCallable<com.google.bigtable.admin.v2.GetInstanceRequest,com.google.bigtable.admin.v2.Instance> |
getInstanceCallable()
Gets information about an instance.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
BigtableInstanceAdminSettings |
getSettings() |
BigtableInstanceAdminStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
com.google.bigtable.admin.v2.ListClustersResponse |
listClusters(com.google.bigtable.admin.v2.InstanceName parent)
Lists information about clusters in an instance.
|
com.google.bigtable.admin.v2.ListClustersResponse |
listClusters(com.google.bigtable.admin.v2.ListClustersRequest request)
Lists information about clusters in an instance.
|
com.google.api.gax.rpc.UnaryCallable<com.google.bigtable.admin.v2.ListClustersRequest,com.google.bigtable.admin.v2.ListClustersResponse> |
listClustersCallable()
Lists information about clusters in an instance.
|
com.google.bigtable.admin.v2.ListInstancesResponse |
listInstances(com.google.bigtable.admin.v2.ListInstancesRequest request)
Lists information about instances in a project.
|
com.google.bigtable.admin.v2.ListInstancesResponse |
listInstances(com.google.bigtable.admin.v2.ProjectName parent)
Lists information about instances in a project.
|
com.google.api.gax.rpc.UnaryCallable<com.google.bigtable.admin.v2.ListInstancesRequest,com.google.bigtable.admin.v2.ListInstancesResponse> |
listInstancesCallable()
Lists information about instances in a project.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.api.gax.longrunning.OperationFuture<com.google.bigtable.admin.v2.Cluster,com.google.bigtable.admin.v2.UpdateClusterMetadata> |
updateClusterAsync(com.google.bigtable.admin.v2.Cluster request)
Updates a cluster within an instance.
|
com.google.api.gax.longrunning.OperationFuture<com.google.bigtable.admin.v2.Cluster,com.google.bigtable.admin.v2.UpdateClusterMetadata> |
updateClusterAsync(com.google.bigtable.admin.v2.ClusterName name,
com.google.bigtable.admin.v2.LocationName location,
int serveNodes,
com.google.bigtable.admin.v2.StorageType defaultStorageType)
Updates a cluster within an instance.
|
com.google.api.gax.rpc.UnaryCallable<com.google.bigtable.admin.v2.Cluster,com.google.longrunning.Operation> |
updateClusterCallable()
Updates a cluster within an instance.
|
com.google.api.gax.rpc.OperationCallable<com.google.bigtable.admin.v2.Cluster,com.google.bigtable.admin.v2.Cluster,com.google.bigtable.admin.v2.UpdateClusterMetadata> |
updateClusterOperationCallable()
Updates a cluster within an instance.
|
com.google.bigtable.admin.v2.Instance |
updateInstance(com.google.bigtable.admin.v2.Instance request)
Updates an instance within a project.
|
com.google.bigtable.admin.v2.Instance |
updateInstance(com.google.bigtable.admin.v2.InstanceName name,
String displayName,
com.google.bigtable.admin.v2.Instance.Type type)
Updates an instance within a project.
|
com.google.api.gax.rpc.UnaryCallable<com.google.bigtable.admin.v2.Instance,com.google.bigtable.admin.v2.Instance> |
updateInstanceCallable()
Updates an instance within a project.
|
protected BigtableInstanceAdminClient(BigtableInstanceAdminSettings settings) throws IOException
IOException@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected BigtableInstanceAdminClient(BigtableInstanceAdminStub stub)
public static final BigtableInstanceAdminClient create() throws IOException
IOExceptionpublic static final BigtableInstanceAdminClient create(BigtableInstanceAdminSettings settings) throws IOException
IOException@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final BigtableInstanceAdminClient create(BigtableInstanceAdminStub stub)
public final BigtableInstanceAdminSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public BigtableInstanceAdminStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
public final com.google.api.gax.longrunning.OperationFuture<com.google.bigtable.admin.v2.Instance,com.google.bigtable.admin.v2.CreateInstanceMetadata> createInstanceAsync(com.google.bigtable.admin.v2.ProjectName parent,
String instanceId,
com.google.bigtable.admin.v2.Instance instance,
Map<String,com.google.bigtable.admin.v2.Cluster> clusters)
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
String instanceId = "";
Instance instance = Instance.newBuilder().build();
Map<String, Cluster> clusters = new HashMap<>();
Instance response = bigtableInstanceAdminClient.createInstanceAsync(parent, instanceId, instance, clusters).get();
}
parent - The unique name of the project in which to create the new instance. Values are of
the form `projects/<project>`.instanceId - The ID to be used when referring to the new instance within its project,
e.g., just `myinstance` rather than `projects/myproject/instances/myinstance`.instance - The instance to create. Fields marked `OutputOnly` must be left blank.clusters - The clusters to be created within the instance, mapped by desired cluster ID,
e.g., just `mycluster` rather than
`projects/myproject/instances/myinstance/clusters/mycluster`. Fields marked `OutputOnly`
must be left blank. Currently exactly one cluster must be specified.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.bigtable.admin.v2.Instance,com.google.bigtable.admin.v2.CreateInstanceMetadata> createInstanceAsync(com.google.bigtable.admin.v2.CreateInstanceRequest request)
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
String instanceId = "";
Instance instance = Instance.newBuilder().build();
Map<String, Cluster> clusters = new HashMap<>();
CreateInstanceRequest request = CreateInstanceRequest.newBuilder()
.setParentWithProjectName(parent)
.setInstanceId(instanceId)
.setInstance(instance)
.putAllClusters(clusters)
.build();
Instance response = bigtableInstanceAdminClient.createInstanceAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<com.google.bigtable.admin.v2.CreateInstanceRequest,com.google.bigtable.admin.v2.Instance,com.google.bigtable.admin.v2.CreateInstanceMetadata> createInstanceOperationCallable()
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
String instanceId = "";
Instance instance = Instance.newBuilder().build();
Map<String, Cluster> clusters = new HashMap<>();
CreateInstanceRequest request = CreateInstanceRequest.newBuilder()
.setParentWithProjectName(parent)
.setInstanceId(instanceId)
.setInstance(instance)
.putAllClusters(clusters)
.build();
OperationFuture<Operation> future = bigtableInstanceAdminClient.createInstanceOperationCallable().futureCall(request);
// Do something
Instance response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.bigtable.admin.v2.CreateInstanceRequest,com.google.longrunning.Operation> createInstanceCallable()
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
String instanceId = "";
Instance instance = Instance.newBuilder().build();
Map<String, Cluster> clusters = new HashMap<>();
CreateInstanceRequest request = CreateInstanceRequest.newBuilder()
.setParentWithProjectName(parent)
.setInstanceId(instanceId)
.setInstance(instance)
.putAllClusters(clusters)
.build();
ApiFuture<Operation> future = bigtableInstanceAdminClient.createInstanceCallable().futureCall(request);
// Do something
Operation response = future.get();
}
public final com.google.bigtable.admin.v2.Instance getInstance(com.google.bigtable.admin.v2.InstanceName name)
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
Instance response = bigtableInstanceAdminClient.getInstance(name);
}
name - The unique name of the requested instance. Values are of the form
`projects/<project>/instances/<instance>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.bigtable.admin.v2.GetInstanceRequest,com.google.bigtable.admin.v2.Instance> getInstanceCallable()
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
GetInstanceRequest request = GetInstanceRequest.newBuilder()
.setNameWithInstanceName(name)
.build();
ApiFuture<Instance> future = bigtableInstanceAdminClient.getInstanceCallable().futureCall(request);
// Do something
Instance response = future.get();
}
public final com.google.bigtable.admin.v2.ListInstancesResponse listInstances(com.google.bigtable.admin.v2.ProjectName parent)
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
ListInstancesResponse response = bigtableInstanceAdminClient.listInstances(parent);
}
parent - The unique name of the project for which a list of instances is requested. Values
are of the form `projects/<project>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.bigtable.admin.v2.ListInstancesResponse listInstances(com.google.bigtable.admin.v2.ListInstancesRequest request)
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
ListInstancesRequest request = ListInstancesRequest.newBuilder()
.setParentWithProjectName(parent)
.build();
ListInstancesResponse response = bigtableInstanceAdminClient.listInstances(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.bigtable.admin.v2.ListInstancesRequest,com.google.bigtable.admin.v2.ListInstancesResponse> listInstancesCallable()
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
ListInstancesRequest request = ListInstancesRequest.newBuilder()
.setParentWithProjectName(parent)
.build();
ApiFuture<ListInstancesResponse> future = bigtableInstanceAdminClient.listInstancesCallable().futureCall(request);
// Do something
ListInstancesResponse response = future.get();
}
public final com.google.bigtable.admin.v2.Instance updateInstance(com.google.bigtable.admin.v2.InstanceName name,
String displayName,
com.google.bigtable.admin.v2.Instance.Type type)
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
String displayName = "";
Instance.Type type = Instance.Type.TYPE_UNSPECIFIED;
Instance response = bigtableInstanceAdminClient.updateInstance(name, displayName, type);
}
name - (`OutputOnly`) The unique name of the instance. Values are of the form
`projects/<project>/instances/[a-z][a-z0-9\\-]+[a-z0-9]`.displayName - The descriptive name for this instance as it appears in UIs. Can be changed
at any time, but should be kept globally unique to avoid confusion.type - The type of the instance. Defaults to `PRODUCTION`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.bigtable.admin.v2.Instance updateInstance(com.google.bigtable.admin.v2.Instance request)
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
String displayName = "";
Instance.Type type = Instance.Type.TYPE_UNSPECIFIED;
Instance request = Instance.newBuilder()
.setNameWithInstanceName(name)
.setDisplayName(displayName)
.setType(type)
.build();
Instance response = bigtableInstanceAdminClient.updateInstance(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.bigtable.admin.v2.Instance,com.google.bigtable.admin.v2.Instance> updateInstanceCallable()
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
String displayName = "";
Instance.Type type = Instance.Type.TYPE_UNSPECIFIED;
Instance request = Instance.newBuilder()
.setNameWithInstanceName(name)
.setDisplayName(displayName)
.setType(type)
.build();
ApiFuture<Instance> future = bigtableInstanceAdminClient.updateInstanceCallable().futureCall(request);
// Do something
Instance response = future.get();
}
public final void deleteInstance(com.google.bigtable.admin.v2.InstanceName name)
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
bigtableInstanceAdminClient.deleteInstance(name);
}
name - The unique name of the instance to be deleted. Values are of the form
`projects/<project>/instances/<instance>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.bigtable.admin.v2.DeleteInstanceRequest,com.google.protobuf.Empty> deleteInstanceCallable()
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder()
.setNameWithInstanceName(name)
.build();
ApiFuture<Void> future = bigtableInstanceAdminClient.deleteInstanceCallable().futureCall(request);
// Do something
future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<com.google.bigtable.admin.v2.Cluster,com.google.bigtable.admin.v2.CreateClusterMetadata> createClusterAsync(com.google.bigtable.admin.v2.InstanceName parent,
String clusterId,
com.google.bigtable.admin.v2.Cluster cluster)
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
String clusterId = "";
Cluster cluster = Cluster.newBuilder().build();
Cluster response = bigtableInstanceAdminClient.createClusterAsync(parent, clusterId, cluster).get();
}
parent - The unique name of the instance in which to create the new cluster. Values are of
the form `projects/<project>/instances/<instance>`.clusterId - The ID to be used when referring to the new cluster within its instance, e.g.,
just `mycluster` rather than `projects/myproject/instances/myinstance/clusters/mycluster`.cluster - The cluster to be created. Fields marked `OutputOnly` must be left blank.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.bigtable.admin.v2.Cluster,com.google.bigtable.admin.v2.CreateClusterMetadata> createClusterAsync(com.google.bigtable.admin.v2.CreateClusterRequest request)
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
String clusterId = "";
Cluster cluster = Cluster.newBuilder().build();
CreateClusterRequest request = CreateClusterRequest.newBuilder()
.setParentWithInstanceName(parent)
.setClusterId(clusterId)
.setCluster(cluster)
.build();
Cluster response = bigtableInstanceAdminClient.createClusterAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<com.google.bigtable.admin.v2.CreateClusterRequest,com.google.bigtable.admin.v2.Cluster,com.google.bigtable.admin.v2.CreateClusterMetadata> createClusterOperationCallable()
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
String clusterId = "";
Cluster cluster = Cluster.newBuilder().build();
CreateClusterRequest request = CreateClusterRequest.newBuilder()
.setParentWithInstanceName(parent)
.setClusterId(clusterId)
.setCluster(cluster)
.build();
OperationFuture<Operation> future = bigtableInstanceAdminClient.createClusterOperationCallable().futureCall(request);
// Do something
Cluster response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.bigtable.admin.v2.CreateClusterRequest,com.google.longrunning.Operation> createClusterCallable()
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
String clusterId = "";
Cluster cluster = Cluster.newBuilder().build();
CreateClusterRequest request = CreateClusterRequest.newBuilder()
.setParentWithInstanceName(parent)
.setClusterId(clusterId)
.setCluster(cluster)
.build();
ApiFuture<Operation> future = bigtableInstanceAdminClient.createClusterCallable().futureCall(request);
// Do something
Operation response = future.get();
}
public final com.google.bigtable.admin.v2.Cluster getCluster(com.google.bigtable.admin.v2.ClusterName name)
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
Cluster response = bigtableInstanceAdminClient.getCluster(name);
}
name - The unique name of the requested cluster. Values are of the form
`projects/<project>/instances/<instance>/clusters/<cluster>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.bigtable.admin.v2.GetClusterRequest,com.google.bigtable.admin.v2.Cluster> getClusterCallable()
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
GetClusterRequest request = GetClusterRequest.newBuilder()
.setNameWithClusterName(name)
.build();
ApiFuture<Cluster> future = bigtableInstanceAdminClient.getClusterCallable().futureCall(request);
// Do something
Cluster response = future.get();
}
public final com.google.bigtable.admin.v2.ListClustersResponse listClusters(com.google.bigtable.admin.v2.InstanceName parent)
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
ListClustersResponse response = bigtableInstanceAdminClient.listClusters(parent);
}
parent - The unique name of the instance for which a list of clusters is requested. Values
are of the form `projects/<project>/instances/<instance>`. Use
`<instance> = '-'` to list Clusters for all Instances in a project, e.g.,
`projects/myproject/instances/-`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.bigtable.admin.v2.ListClustersResponse listClusters(com.google.bigtable.admin.v2.ListClustersRequest request)
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
ListClustersRequest request = ListClustersRequest.newBuilder()
.setParentWithInstanceName(parent)
.build();
ListClustersResponse response = bigtableInstanceAdminClient.listClusters(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.bigtable.admin.v2.ListClustersRequest,com.google.bigtable.admin.v2.ListClustersResponse> listClustersCallable()
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
ListClustersRequest request = ListClustersRequest.newBuilder()
.setParentWithInstanceName(parent)
.build();
ApiFuture<ListClustersResponse> future = bigtableInstanceAdminClient.listClustersCallable().futureCall(request);
// Do something
ListClustersResponse response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<com.google.bigtable.admin.v2.Cluster,com.google.bigtable.admin.v2.UpdateClusterMetadata> updateClusterAsync(com.google.bigtable.admin.v2.ClusterName name,
com.google.bigtable.admin.v2.LocationName location,
int serveNodes,
com.google.bigtable.admin.v2.StorageType defaultStorageType)
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
LocationName location = LocationName.of("[PROJECT]", "[LOCATION]");
int serveNodes = 0;
StorageType defaultStorageType = StorageType.STORAGE_TYPE_UNSPECIFIED;
Cluster response = bigtableInstanceAdminClient.updateClusterAsync(name, location, serveNodes, defaultStorageType).get();
}
name - (`OutputOnly`) The unique name of the cluster. Values are of the form
`projects/<project>/instances/<instance>/clusters/[a-z][-a-z0-9]*`.location - (`CreationOnly`) The location where this cluster's nodes and storage reside.
For best performance, clients should be located as close as possible to this cluster.
Currently only zones are supported, so values should be of the form
`projects/<project>/locations/<zone>`.serveNodes - The number of nodes allocated to this cluster. More nodes enable higher
throughput and more consistent performance.defaultStorageType - (`CreationOnly`) The type of storage used by this cluster to serve
its parent instance's tables, unless explicitly overridden.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.bigtable.admin.v2.Cluster,com.google.bigtable.admin.v2.UpdateClusterMetadata> updateClusterAsync(com.google.bigtable.admin.v2.Cluster request)
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
LocationName location = LocationName.of("[PROJECT]", "[LOCATION]");
int serveNodes = 0;
StorageType defaultStorageType = StorageType.STORAGE_TYPE_UNSPECIFIED;
Cluster request = Cluster.newBuilder()
.setNameWithClusterName(name)
.setLocationWithLocationName(location)
.setServeNodes(serveNodes)
.setDefaultStorageType(defaultStorageType)
.build();
Cluster response = bigtableInstanceAdminClient.updateClusterAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<com.google.bigtable.admin.v2.Cluster,com.google.bigtable.admin.v2.Cluster,com.google.bigtable.admin.v2.UpdateClusterMetadata> updateClusterOperationCallable()
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
LocationName location = LocationName.of("[PROJECT]", "[LOCATION]");
int serveNodes = 0;
StorageType defaultStorageType = StorageType.STORAGE_TYPE_UNSPECIFIED;
Cluster request = Cluster.newBuilder()
.setNameWithClusterName(name)
.setLocationWithLocationName(location)
.setServeNodes(serveNodes)
.setDefaultStorageType(defaultStorageType)
.build();
OperationFuture<Operation> future = bigtableInstanceAdminClient.updateClusterOperationCallable().futureCall(request);
// Do something
Cluster response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.bigtable.admin.v2.Cluster,com.google.longrunning.Operation> updateClusterCallable()
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
LocationName location = LocationName.of("[PROJECT]", "[LOCATION]");
int serveNodes = 0;
StorageType defaultStorageType = StorageType.STORAGE_TYPE_UNSPECIFIED;
Cluster request = Cluster.newBuilder()
.setNameWithClusterName(name)
.setLocationWithLocationName(location)
.setServeNodes(serveNodes)
.setDefaultStorageType(defaultStorageType)
.build();
ApiFuture<Operation> future = bigtableInstanceAdminClient.updateClusterCallable().futureCall(request);
// Do something
Operation response = future.get();
}
public final void deleteCluster(com.google.bigtable.admin.v2.ClusterName name)
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
bigtableInstanceAdminClient.deleteCluster(name);
}
name - The unique name of the cluster to be deleted. Values are of the form
`projects/<project>/instances/<instance>/clusters/<cluster>`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.bigtable.admin.v2.DeleteClusterRequest,com.google.protobuf.Empty> deleteClusterCallable()
Sample code:
try (BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.create()) {
ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
DeleteClusterRequest request = DeleteClusterRequest.newBuilder()
.setNameWithClusterName(name)
.build();
ApiFuture<Void> future = bigtableInstanceAdminClient.deleteClusterCallable().futureCall(request);
// Do something
future.get();
}
public final void close()
throws Exception
close in interface AutoCloseableExceptionpublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2017 Google. All rights reserved.