Skip to content

Commit 37370b7

Browse files
chore: add Autoscaling API (#1090)
PiperOrigin-RevId: 410080804 Source-Author: Google APIs <[email protected]> Source-Date: Mon Nov 15 14:27:35 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 0fd6a324383fdd1220c9a937b2eef37f53764664 Source-Link: googleapis/googleapis@0fd6a32
1 parent 08207a8 commit 37370b7

26 files changed

+7354
-252
lines changed

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminClient.java

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
import com.google.bigtable.admin.v2.ListClustersResponse;
5353
import com.google.bigtable.admin.v2.ListInstancesRequest;
5454
import com.google.bigtable.admin.v2.ListInstancesResponse;
55+
import com.google.bigtable.admin.v2.PartialUpdateClusterMetadata;
56+
import com.google.bigtable.admin.v2.PartialUpdateClusterRequest;
5557
import com.google.bigtable.admin.v2.PartialUpdateInstanceRequest;
5658
import com.google.bigtable.admin.v2.ProjectName;
5759
import com.google.bigtable.admin.v2.UpdateAppProfileMetadata;
@@ -149,6 +151,11 @@ public final OperationsClient getOperationsClient() {
149151
/**
150152
* Create an instance within a project.
151153
*
154+
* <p>Note that exactly one of Cluster.serve_nodes and
155+
* Cluster.cluster_config.cluster_autoscaling_config can be set. If serve_nodes is set to
156+
* non-zero, then the cluster is manually scaled. If cluster_config.cluster_autoscaling_config is
157+
* non-empty, then autoscaling is enabled.
158+
*
152159
* <p>Sample code:
153160
*
154161
* <pre>{@code
@@ -193,6 +200,11 @@ public final OperationFuture<Instance, CreateInstanceMetadata> createInstanceAsy
193200
/**
194201
* Create an instance within a project.
195202
*
203+
* <p>Note that exactly one of Cluster.serve_nodes and
204+
* Cluster.cluster_config.cluster_autoscaling_config can be set. If serve_nodes is set to
205+
* non-zero, then the cluster is manually scaled. If cluster_config.cluster_autoscaling_config is
206+
* non-empty, then autoscaling is enabled.
207+
*
196208
* <p>Sample code:
197209
*
198210
* <pre>{@code
@@ -237,6 +249,11 @@ public final OperationFuture<Instance, CreateInstanceMetadata> createInstanceAsy
237249
/**
238250
* Create an instance within a project.
239251
*
252+
* <p>Note that exactly one of Cluster.serve_nodes and
253+
* Cluster.cluster_config.cluster_autoscaling_config can be set. If serve_nodes is set to
254+
* non-zero, then the cluster is manually scaled. If cluster_config.cluster_autoscaling_config is
255+
* non-empty, then autoscaling is enabled.
256+
*
240257
* <p>Sample code:
241258
*
242259
* <pre>{@code
@@ -265,6 +282,11 @@ public final OperationFuture<Instance, CreateInstanceMetadata> createInstanceAsy
265282
/**
266283
* Create an instance within a project.
267284
*
285+
* <p>Note that exactly one of Cluster.serve_nodes and
286+
* Cluster.cluster_config.cluster_autoscaling_config can be set. If serve_nodes is set to
287+
* non-zero, then the cluster is manually scaled. If cluster_config.cluster_autoscaling_config is
288+
* non-empty, then autoscaling is enabled.
289+
*
268290
* <p>Sample code:
269291
*
270292
* <pre>{@code
@@ -293,6 +315,11 @@ public final OperationFuture<Instance, CreateInstanceMetadata> createInstanceAsy
293315
/**
294316
* Create an instance within a project.
295317
*
318+
* <p>Note that exactly one of Cluster.serve_nodes and
319+
* Cluster.cluster_config.cluster_autoscaling_config can be set. If serve_nodes is set to
320+
* non-zero, then the cluster is manually scaled. If cluster_config.cluster_autoscaling_config is
321+
* non-empty, then autoscaling is enabled.
322+
*
296323
* <p>Sample code:
297324
*
298325
* <pre>{@code
@@ -780,6 +807,11 @@ public final UnaryCallable<DeleteInstanceRequest, Empty> deleteInstanceCallable(
780807
/**
781808
* Creates a cluster within an instance.
782809
*
810+
* <p>Note that exactly one of Cluster.serve_nodes and
811+
* Cluster.cluster_config.cluster_autoscaling_config can be set. If serve_nodes is set to
812+
* non-zero, then the cluster is manually scaled. If cluster_config.cluster_autoscaling_config is
813+
* non-empty, then autoscaling is enabled.
814+
*
783815
* <p>Sample code:
784816
*
785817
* <pre>{@code
@@ -817,6 +849,11 @@ public final OperationFuture<Cluster, CreateClusterMetadata> createClusterAsync(
817849
/**
818850
* Creates a cluster within an instance.
819851
*
852+
* <p>Note that exactly one of Cluster.serve_nodes and
853+
* Cluster.cluster_config.cluster_autoscaling_config can be set. If serve_nodes is set to
854+
* non-zero, then the cluster is manually scaled. If cluster_config.cluster_autoscaling_config is
855+
* non-empty, then autoscaling is enabled.
856+
*
820857
* <p>Sample code:
821858
*
822859
* <pre>{@code
@@ -854,6 +891,11 @@ public final OperationFuture<Cluster, CreateClusterMetadata> createClusterAsync(
854891
/**
855892
* Creates a cluster within an instance.
856893
*
894+
* <p>Note that exactly one of Cluster.serve_nodes and
895+
* Cluster.cluster_config.cluster_autoscaling_config can be set. If serve_nodes is set to
896+
* non-zero, then the cluster is manually scaled. If cluster_config.cluster_autoscaling_config is
897+
* non-empty, then autoscaling is enabled.
898+
*
857899
* <p>Sample code:
858900
*
859901
* <pre>{@code
@@ -881,6 +923,11 @@ public final OperationFuture<Cluster, CreateClusterMetadata> createClusterAsync(
881923
/**
882924
* Creates a cluster within an instance.
883925
*
926+
* <p>Note that exactly one of Cluster.serve_nodes and
927+
* Cluster.cluster_config.cluster_autoscaling_config can be set. If serve_nodes is set to
928+
* non-zero, then the cluster is manually scaled. If cluster_config.cluster_autoscaling_config is
929+
* non-empty, then autoscaling is enabled.
930+
*
884931
* <p>Sample code:
885932
*
886933
* <pre>{@code
@@ -908,6 +955,11 @@ public final OperationFuture<Cluster, CreateClusterMetadata> createClusterAsync(
908955
/**
909956
* Creates a cluster within an instance.
910957
*
958+
* <p>Note that exactly one of Cluster.serve_nodes and
959+
* Cluster.cluster_config.cluster_autoscaling_config can be set. If serve_nodes is set to
960+
* non-zero, then the cluster is manually scaled. If cluster_config.cluster_autoscaling_config is
961+
* non-empty, then autoscaling is enabled.
962+
*
911963
* <p>Sample code:
912964
*
913965
* <pre>{@code
@@ -1132,6 +1184,9 @@ public final UnaryCallable<ListClustersRequest, ListClustersResponse> listCluste
11321184
/**
11331185
* Updates a cluster within an instance.
11341186
*
1187+
* <p>Note that UpdateCluster does not support updating cluster_config.cluster_autoscaling_config.
1188+
* In order to update it, you must use PartialUpdateCluster.
1189+
*
11351190
* <p>Sample code:
11361191
*
11371192
* <pre>{@code
@@ -1160,6 +1215,9 @@ public final OperationFuture<Cluster, UpdateClusterMetadata> updateClusterAsync(
11601215
/**
11611216
* Updates a cluster within an instance.
11621217
*
1218+
* <p>Note that UpdateCluster does not support updating cluster_config.cluster_autoscaling_config.
1219+
* In order to update it, you must use PartialUpdateCluster.
1220+
*
11631221
* <p>Sample code:
11641222
*
11651223
* <pre>{@code
@@ -1189,6 +1247,9 @@ public final OperationFuture<Cluster, UpdateClusterMetadata> updateClusterAsync(
11891247
/**
11901248
* Updates a cluster within an instance.
11911249
*
1250+
* <p>Note that UpdateCluster does not support updating cluster_config.cluster_autoscaling_config.
1251+
* In order to update it, you must use PartialUpdateCluster.
1252+
*
11921253
* <p>Sample code:
11931254
*
11941255
* <pre>{@code
@@ -1213,6 +1274,157 @@ public final UnaryCallable<Cluster, Operation> updateClusterCallable() {
12131274
return stub.updateClusterCallable();
12141275
}
12151276

1277+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1278+
/**
1279+
* Partially updates a cluster within a project. This method is the preferred way to update a
1280+
* Cluster.
1281+
*
1282+
* <p>To enable and update autoscaling, set cluster_config.cluster_autoscaling_config. When
1283+
* autoscaling is enabled, serve_nodes is treated as an OUTPUT_ONLY field, meaning that updates to
1284+
* it are ignored. Note that an update cannot simultaneously set serve_nodes to non-zero and
1285+
* cluster_config.cluster_autoscaling_config to non-empty, and also specify both in the
1286+
* update_mask.
1287+
*
1288+
* <p>To disable autoscaling, clear cluster_config.cluster_autoscaling_config, and explicitly set
1289+
* a serve_node count via the update_mask.
1290+
*
1291+
* <p>Sample code:
1292+
*
1293+
* <pre>{@code
1294+
* try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
1295+
* BaseBigtableInstanceAdminClient.create()) {
1296+
* Cluster cluster = Cluster.newBuilder().build();
1297+
* FieldMask updateMask = FieldMask.newBuilder().build();
1298+
* Cluster response =
1299+
* baseBigtableInstanceAdminClient.partialUpdateClusterAsync(cluster, updateMask).get();
1300+
* }
1301+
* }</pre>
1302+
*
1303+
* @param cluster Required. The Cluster which contains the partial updates to be applied, subject
1304+
* to the update_mask.
1305+
* @param updateMask Required. The subset of Cluster fields which should be replaced.
1306+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
1307+
*/
1308+
public final OperationFuture<Cluster, PartialUpdateClusterMetadata> partialUpdateClusterAsync(
1309+
Cluster cluster, FieldMask updateMask) {
1310+
PartialUpdateClusterRequest request =
1311+
PartialUpdateClusterRequest.newBuilder()
1312+
.setCluster(cluster)
1313+
.setUpdateMask(updateMask)
1314+
.build();
1315+
return partialUpdateClusterAsync(request);
1316+
}
1317+
1318+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1319+
/**
1320+
* Partially updates a cluster within a project. This method is the preferred way to update a
1321+
* Cluster.
1322+
*
1323+
* <p>To enable and update autoscaling, set cluster_config.cluster_autoscaling_config. When
1324+
* autoscaling is enabled, serve_nodes is treated as an OUTPUT_ONLY field, meaning that updates to
1325+
* it are ignored. Note that an update cannot simultaneously set serve_nodes to non-zero and
1326+
* cluster_config.cluster_autoscaling_config to non-empty, and also specify both in the
1327+
* update_mask.
1328+
*
1329+
* <p>To disable autoscaling, clear cluster_config.cluster_autoscaling_config, and explicitly set
1330+
* a serve_node count via the update_mask.
1331+
*
1332+
* <p>Sample code:
1333+
*
1334+
* <pre>{@code
1335+
* try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
1336+
* BaseBigtableInstanceAdminClient.create()) {
1337+
* PartialUpdateClusterRequest request =
1338+
* PartialUpdateClusterRequest.newBuilder()
1339+
* .setCluster(Cluster.newBuilder().build())
1340+
* .setUpdateMask(FieldMask.newBuilder().build())
1341+
* .build();
1342+
* Cluster response = baseBigtableInstanceAdminClient.partialUpdateClusterAsync(request).get();
1343+
* }
1344+
* }</pre>
1345+
*
1346+
* @param request The request object containing all of the parameters for the API call.
1347+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
1348+
*/
1349+
public final OperationFuture<Cluster, PartialUpdateClusterMetadata> partialUpdateClusterAsync(
1350+
PartialUpdateClusterRequest request) {
1351+
return partialUpdateClusterOperationCallable().futureCall(request);
1352+
}
1353+
1354+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1355+
/**
1356+
* Partially updates a cluster within a project. This method is the preferred way to update a
1357+
* Cluster.
1358+
*
1359+
* <p>To enable and update autoscaling, set cluster_config.cluster_autoscaling_config. When
1360+
* autoscaling is enabled, serve_nodes is treated as an OUTPUT_ONLY field, meaning that updates to
1361+
* it are ignored. Note that an update cannot simultaneously set serve_nodes to non-zero and
1362+
* cluster_config.cluster_autoscaling_config to non-empty, and also specify both in the
1363+
* update_mask.
1364+
*
1365+
* <p>To disable autoscaling, clear cluster_config.cluster_autoscaling_config, and explicitly set
1366+
* a serve_node count via the update_mask.
1367+
*
1368+
* <p>Sample code:
1369+
*
1370+
* <pre>{@code
1371+
* try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
1372+
* BaseBigtableInstanceAdminClient.create()) {
1373+
* PartialUpdateClusterRequest request =
1374+
* PartialUpdateClusterRequest.newBuilder()
1375+
* .setCluster(Cluster.newBuilder().build())
1376+
* .setUpdateMask(FieldMask.newBuilder().build())
1377+
* .build();
1378+
* OperationFuture<Cluster, PartialUpdateClusterMetadata> future =
1379+
* baseBigtableInstanceAdminClient
1380+
* .partialUpdateClusterOperationCallable()
1381+
* .futureCall(request);
1382+
* // Do something.
1383+
* Cluster response = future.get();
1384+
* }
1385+
* }</pre>
1386+
*/
1387+
public final OperationCallable<PartialUpdateClusterRequest, Cluster, PartialUpdateClusterMetadata>
1388+
partialUpdateClusterOperationCallable() {
1389+
return stub.partialUpdateClusterOperationCallable();
1390+
}
1391+
1392+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1393+
/**
1394+
* Partially updates a cluster within a project. This method is the preferred way to update a
1395+
* Cluster.
1396+
*
1397+
* <p>To enable and update autoscaling, set cluster_config.cluster_autoscaling_config. When
1398+
* autoscaling is enabled, serve_nodes is treated as an OUTPUT_ONLY field, meaning that updates to
1399+
* it are ignored. Note that an update cannot simultaneously set serve_nodes to non-zero and
1400+
* cluster_config.cluster_autoscaling_config to non-empty, and also specify both in the
1401+
* update_mask.
1402+
*
1403+
* <p>To disable autoscaling, clear cluster_config.cluster_autoscaling_config, and explicitly set
1404+
* a serve_node count via the update_mask.
1405+
*
1406+
* <p>Sample code:
1407+
*
1408+
* <pre>{@code
1409+
* try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
1410+
* BaseBigtableInstanceAdminClient.create()) {
1411+
* PartialUpdateClusterRequest request =
1412+
* PartialUpdateClusterRequest.newBuilder()
1413+
* .setCluster(Cluster.newBuilder().build())
1414+
* .setUpdateMask(FieldMask.newBuilder().build())
1415+
* .build();
1416+
* ApiFuture<Operation> future =
1417+
* baseBigtableInstanceAdminClient.partialUpdateClusterCallable().futureCall(request);
1418+
* // Do something.
1419+
* Operation response = future.get();
1420+
* }
1421+
* }</pre>
1422+
*/
1423+
public final UnaryCallable<PartialUpdateClusterRequest, Operation>
1424+
partialUpdateClusterCallable() {
1425+
return stub.partialUpdateClusterCallable();
1426+
}
1427+
12161428
// AUTO-GENERATED DOCUMENTATION AND METHOD.
12171429
/**
12181430
* Deletes a cluster from an instance.

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminSettings.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
import com.google.bigtable.admin.v2.ListClustersResponse;
5252
import com.google.bigtable.admin.v2.ListInstancesRequest;
5353
import com.google.bigtable.admin.v2.ListInstancesResponse;
54+
import com.google.bigtable.admin.v2.PartialUpdateClusterMetadata;
55+
import com.google.bigtable.admin.v2.PartialUpdateClusterRequest;
5456
import com.google.bigtable.admin.v2.PartialUpdateInstanceRequest;
5557
import com.google.bigtable.admin.v2.UpdateAppProfileMetadata;
5658
import com.google.bigtable.admin.v2.UpdateAppProfileRequest;
@@ -147,6 +149,18 @@ public UnaryCallSettings<Cluster, Operation> updateClusterSettings() {
147149
return ((BigtableInstanceAdminStubSettings) getStubSettings()).updateClusterOperationSettings();
148150
}
149151

152+
/** Returns the object with the settings used for calls to partialUpdateCluster. */
153+
public UnaryCallSettings<PartialUpdateClusterRequest, Operation> partialUpdateClusterSettings() {
154+
return ((BigtableInstanceAdminStubSettings) getStubSettings()).partialUpdateClusterSettings();
155+
}
156+
157+
/** Returns the object with the settings used for calls to partialUpdateCluster. */
158+
public OperationCallSettings<PartialUpdateClusterRequest, Cluster, PartialUpdateClusterMetadata>
159+
partialUpdateClusterOperationSettings() {
160+
return ((BigtableInstanceAdminStubSettings) getStubSettings())
161+
.partialUpdateClusterOperationSettings();
162+
}
163+
150164
/** Returns the object with the settings used for calls to deleteCluster. */
151165
public UnaryCallSettings<DeleteClusterRequest, Empty> deleteClusterSettings() {
152166
return ((BigtableInstanceAdminStubSettings) getStubSettings()).deleteClusterSettings();
@@ -373,6 +387,19 @@ public UnaryCallSettings.Builder<Cluster, Operation> updateClusterSettings() {
373387
return getStubSettingsBuilder().updateClusterOperationSettings();
374388
}
375389

390+
/** Returns the builder for the settings used for calls to partialUpdateCluster. */
391+
public UnaryCallSettings.Builder<PartialUpdateClusterRequest, Operation>
392+
partialUpdateClusterSettings() {
393+
return getStubSettingsBuilder().partialUpdateClusterSettings();
394+
}
395+
396+
/** Returns the builder for the settings used for calls to partialUpdateCluster. */
397+
public OperationCallSettings.Builder<
398+
PartialUpdateClusterRequest, Cluster, PartialUpdateClusterMetadata>
399+
partialUpdateClusterOperationSettings() {
400+
return getStubSettingsBuilder().partialUpdateClusterOperationSettings();
401+
}
402+
376403
/** Returns the builder for the settings used for calls to deleteCluster. */
377404
public UnaryCallSettings.Builder<DeleteClusterRequest, Empty> deleteClusterSettings() {
378405
return getStubSettingsBuilder().deleteClusterSettings();

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/gapic_metadata.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@
4949
"ListInstances": {
5050
"methods": ["listInstances", "listInstances", "listInstances", "listInstancesCallable"]
5151
},
52+
"PartialUpdateCluster": {
53+
"methods": ["partialUpdateClusterAsync", "partialUpdateClusterAsync", "partialUpdateClusterOperationCallable", "partialUpdateClusterCallable"]
54+
},
5255
"PartialUpdateInstance": {
5356
"methods": ["partialUpdateInstanceAsync", "partialUpdateInstanceAsync", "partialUpdateInstanceOperationCallable", "partialUpdateInstanceCallable"]
5457
},

0 commit comments

Comments
 (0)