AutoCloseable
public class BigtableClusterUtilities extends Object implements AutoCloseable
Constructor | Description |
---|---|
BigtableClusterUtilities(BigtableOptions options) |
Constructor for the utility.
|
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
Shuts down the connection to the admin API.
|
static BigtableClusterUtilities |
forAllInstances(String projectId) |
Creates a
BigtableClusterUtilities for all instances in a projectId. |
static BigtableClusterUtilities |
forInstance(String projectId,
String instanceId) |
Creates a
BigtableClusterUtilities for a projectId and an instanceId. |
com.google.bigtable.admin.v2.Cluster |
getCluster(String clusterId,
String zoneId) |
Gets the current configuration of the cluster as encapsulated by a
Cluster object. |
int |
getClusterNodeCount(String clusterId,
String zoneId) |
Gets the current number of nodes allocated to the cluster.
|
com.google.bigtable.admin.v2.ListClustersResponse |
getClusters() |
Gets a
ListClustersResponse that contains all of the clusters for the
projectId/instanceId configuration. |
int |
getClusterSize() |
Gets the serve node count of an instance with a single cluster.
|
int |
getClusterSize(String clusterId,
String zoneId) |
Deprecated.
|
com.google.bigtable.admin.v2.Cluster |
getSingleCluster() |
|
static String |
getZoneId(com.google.bigtable.admin.v2.Cluster cluster) |
|
static com.google.bigtable.admin.v2.Cluster |
lookupCluster(String projectId,
String instanceId) |
|
static String |
lookupInstanceId(String projectId,
String clusterId,
String zoneId) |
|
void |
setClusterSize(int newSize) |
Sets a cluster size to a specific size in an instance with a single cluster
|
void |
setClusterSize(String clusterId,
String zoneId,
int newSize) |
Sets a cluster size to a specific size.
|
void |
waitForOperation(String operationName,
int maxSeconds) |
Waits for an operation like cluster resizing to complete.
|
public BigtableClusterUtilities(BigtableOptions options) throws IOException, GeneralSecurityException
forInstance(String, String)
or
forAllInstances(String)
rather than this method.options
- that specify projectId, instanceId, credentials and retry options.GeneralSecurityException
IOException
public static BigtableClusterUtilities forInstance(String projectId, String instanceId) throws IOException, GeneralSecurityException
BigtableClusterUtilities
for a projectId and an instanceId.projectId
- instanceId
- BigtableClusterUtilities
for a specific projectId/instanceId.GeneralSecurityException
- if ssl configuration failsIOException
- if some aspect of the connection fails.public static BigtableClusterUtilities forAllInstances(String projectId) throws IOException, GeneralSecurityException
BigtableClusterUtilities
for all instances in a projectId.projectId
- BigtableClusterUtilities
for a all instances in a projectId.GeneralSecurityException
- if ssl configuration failsIOException
- if some aspect of the connection fails.public static String lookupInstanceId(String projectId, String clusterId, String zoneId) throws IOException
IllegalStateException
- if the cluster is not foundIOException
public static com.google.bigtable.admin.v2.Cluster lookupCluster(String projectId, String instanceId) throws IOException
IllegalStateException
- if the cluster is not found or if there are many clusters in this
instance.IOException
public static String getZoneId(com.google.bigtable.admin.v2.Cluster cluster)
@Deprecated public int getClusterSize(String clusterId, String zoneId)
clusterId
- zoneId
- Cluster.getServeNodes()
of the clusterId.public int getClusterSize()
Cluster.getServeNodes()
of the clusterId.public com.google.bigtable.admin.v2.ListClustersResponse getClusters()
ListClustersResponse
that contains all of the clusters for the
projectId/instanceId configuration.public void setClusterSize(String clusterId, String zoneId, int newSize) throws InterruptedException
clusterId
- zoneId
- newSize
- InterruptedException
- if the cluster is in the middle of updating, and an interrupt was
receivedpublic void setClusterSize(int newSize) throws InterruptedException
InterruptedException
- if the cluster is in the middle of updating, and an interrupt was
receivedpublic com.google.bigtable.admin.v2.Cluster getSingleCluster()
IllegalStateException
- for any project / instance combination that does not return
exactly 1 cluster.public void waitForOperation(String operationName, int maxSeconds) throws InterruptedException
operationName
- The fully qualified name of the operationmaxSeconds
- The maximum amount of seconds to wait for the operation to complete.InterruptedException
- if a user interrupts the process, usually with a ^C.public int getClusterNodeCount(String clusterId, String zoneId)
clusterId
- zoneId
- public com.google.bigtable.admin.v2.Cluster getCluster(String clusterId, String zoneId)
Cluster
object.clusterId
- zoneId
- Cluster
if it was set. If the cluster is not found, throw a NullPointerException
.public void close()
close
in interface AutoCloseable