public final class CreateInstanceRequest extends Object
A Cloud Bigtable instance is mostly just a container for your clusters and nodes, which do all of the real work. Instances come in 2 flavors:
Examples:
// Small production instance:
CreateInstanceRequest smallProdInstanceRequest = CreateInstanceRequest.of("my-small-instance")
.addCluster("cluster1", "us-east1-c", 3, StorageType.SSD);
// Development instance:
CreateInstanceRequest smallProdInstanceRequest = CreateInstanceRequest.of("my-dev-instance")
.setType(Type.DEVELOPMENT)
.addDevelopmentCluster("cluster1", "us-east1-c", StorageType.SSD);
Modifier and Type | Method and Description |
---|---|
CreateInstanceRequest |
addCluster(String clusterId,
String zone,
int serveNodes,
StorageType storageType)
Adds a cluster to the instance request.
|
CreateInstanceRequest |
addDevelopmentCluster(String clusterId,
String zone,
StorageType storageType)
Adds a DEVELOPMENT cluster to the instance request.
|
CreateInstanceRequest |
addLabel(String key,
String value)
Adds an arbitrary label to the instance.
|
static CreateInstanceRequest |
of(String instanceId)
Builds a new request to create a new instance with the specified id.
|
CreateInstanceRequest |
setDisplayName(String displayName)
Sets the friendly display name of the instance.
|
CreateInstanceRequest |
setType(Instance.Type type)
Sets the type of instance.
|
CreateInstanceRequest |
toProto(String projectId)
Creates the request protobuf.
|
public static CreateInstanceRequest of(@Nonnull String instanceId)
public CreateInstanceRequest setDisplayName(@Nonnull String displayName)
public CreateInstanceRequest setType(@Nonnull Instance.Type type)
Can be either DEVELOPMENT or PRODUCTION. Defaults to PRODUCTION. Please see class javadoc for details.
public CreateInstanceRequest addLabel(@Nonnull String key, @Nonnull String value)
Labels are key-value pairs that you can use to group related instances and store metadata about an instance.
public CreateInstanceRequest addCluster(@Nonnull String clusterId, @Nonnull String zone, int serveNodes, @Nonnull StorageType storageType)
All new instances must have at least one cluster. DEVELOPMENT instances must have exactly one cluster.
clusterId
- the name of the cluster.zone
- the zone where the cluster will be created.serveNodes
- the number of nodes that cluster will contain. DEVELOPMENT instance clusters
must have exactly one node.storageType
- the type of storage used by this cluster to serve its parent instance's
tables.public CreateInstanceRequest addDevelopmentCluster(@Nonnull String clusterId, @Nonnull String zone, @Nonnull StorageType storageType)
This instance will have exactly one node cluster.
clusterId
- the name of the cluster.zone
- the zone where the cluster will be created.storageType
- the type of storage used by this cluster to serve its parent instance's
tables.@InternalApi public CreateInstanceRequest toProto(String projectId)
Copyright © 2019 Google LLC. All rights reserved.