8000 Bigtable: Updated Javadoc of models/CreateInstanceRequest.java by rahulKQL · Pull Request #6201 · googleapis/google-cloud-java · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
* cluster. You cannot downgrade a production instance to a development instance.
* <dt>Development
* <dd>A low-cost instance for development and testing, with performance limited to the equivalent
* of a 1-node cluster. Development instances only support a single 1 node cluster.
* of a 1-node cluster. Development instances only support a single 1 node cluster. At any
* point this can be upgraded to a production instance.
* </dl>
*
* When creating an Instance, yo 8000 u must create at least one cluster in it.
Expand All @@ -50,7 +51,7 @@
* // Development instance:
* CreateInstanceRequest smallProdInstanceRequest = CreateInstanceRequest.of("my-dev-instance")
* .setType(Type.DEVELOPMENT)
* .addCluster("cluster1", "us-east1-c", 1, StorageType.SSD);
* .addDevelopmentCluster("cluster1", "us-east1-c", StorageType.SSD);
*
* }</pre>
*
Expand Down Expand Up @@ -123,11 +124,11 @@ public CreateInstanceRequest addLabel(@Nonnull String key, @Nonnull String value
* <p>All new instances must have at least one cluster. DEVELOPMENT instances must have exactly
* one cluster.
*
* @param clusterId The name of the cluster.
* @param zone The zone where the cluster will be created.
* @param serveNodes The number of nodes that cluster will contain. DEVELOPMENT instance clusters
* @param clusterId the name of the cluster.
* @param zone the zone where the cluster will be created.
* @param serveNodes the number of nodes that cluster will contain. DEVELOPMENT instance clusters
* must have exactly one node.
* @param storageType The type of storage used by this cluster to serve its parent instance's
* @param storageType the type of storage used by this cluster to serve its parent instance's
* tables.
*/
@SuppressWarnings("WeakerAccess")
Expand All @@ -146,6 +147,28 @@ public CreateInstanceRequest addCluster(
return this;
}

/**
* Adds a DEVELOPMENT cluster to the instance request.
*
* <p>This instance will have exactly one node cluster.
*
* @param clusterId the name of the cluster.
* @param zone the zone where the cluster will be created.
* @param storageType the type of storage used by this cluster to serve its parent instance's
* tables.
*/
@SuppressWarnings("WeakerAccess")
public CreateInstanceRequest addDevelopmentCluster(
@Nonnull String clusterId, @Nonnull String zone, @Nonnull StorageType storageType) {
CreateClusterRequest developmentCluster =
CreateClusterRequest.of("ignored-instance-id", clusterId)
.setZone(zone)
.setStorageType(storageType);
clusterRequests.add(developmentCluster);

return this;
}

/**
* Creates the request protobuf. This method is considered an internal implementation detail and
* not meant to be used by applications.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public void instanceCreationDeletionTest() {

client.createInstance(
CreateInstanceRequest.of(newInstanceId)
.addCluster(newClusterId, "us-central1-a", 0, StorageType.SSD)
.addDevelopmentCluster(newClusterId, "us-central1-a", StorageType.SSD)
.setDisplayName("Fresh-Instance-Name")
.addLabel("state", "readytodelete")
.setType(Instance.Type.DEVELOPMENT));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void testDevelopment() {
CreateInstanceRequest input =
CreateInstanceRequest.of("my-instance")
.setType(Instance.Type.DEVELOPMENT)
.addCluster("cluster1", "us-east1-c", 1, StorageType.SSD);
.addDevelopmentCluster("cluster1", "us-east1-c", StorageType.SSD);

com.google.bigtable.admin.v2.CreateInstanceRequest actual = input.toProto("my-project");

Expand All @@ -111,7 +111,6 @@ public void testDevelopment() {
"cluster1",
com.google.bigtable.admin.v2.Cluster.newBuilder()
.setLocation("projects/my-project/locations/us-east1-c")
.setServeNodes(1)
.setDefaultStorageType(com.google.bigtable.admin.v2.StorageType.SSD)
.build())
.build();
Expand Down
0