From 60d17dc1d0a0a568a8bdd3bcc1e7491c17142af3 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Tue, 23 Feb 2021 14:21:14 -0800 Subject: [PATCH] feat: migrate to java microgenerator (#629) * chore: migrate java-bigtable to the Java microgenerator Committer: @miraleung PiperOrigin-RevId: 346117305 Source-Author: Google APIs Source-Date: Mon Dec 7 10:01:05 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: 93519d59c61f0e45e00e8b6f76a7f588f4937183 Source-Link: https://github.com/googleapis/googleapis/commit/93519d59c61f0e45e00e8b6f76a7f588f4937183 * chore: update gapic-generator-java to 0.0.8 Committer: @miraleung PiperOrigin-RevId: 346126713 Source-Author: Google APIs Source-Date: Mon Dec 7 10:39:38 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: b8b2f8c288cec1f673bf10aa5008819c1576bf2e Source-Link: https://github.com/googleapis/googleapis/commit/b8b2f8c288cec1f673bf10aa5008819c1576bf2e * chore: update gapic-generator-java to 0.0.9 Committer: @miraleung PiperOrigin-RevId: 346372957 Source-Author: Google APIs Source-Date: Tue Dec 8 11:37:30 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: 857f70daef9f4c38f042fb3dfb7b8423ae18fd19 Source-Link: https://github.com/googleapis/googleapis/commit/857f70daef9f4c38f042fb3dfb7b8423ae18fd19 * feat: migrate bigtable retry/timeout settings to gRPC's service configs Committer: @miraleung PiperOrigin-RevId: 346894665 Source-Author: Google APIs Source-Date: Thu Dec 10 16:55:31 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: cbbd3170bcf217e36ae72f4ac522449bf861346f Source-Link: https://github.com/googleapis/googleapis/commit/cbbd3170bcf217e36ae72f4ac522449bf861346f * chore: update gapic-generator-java to 0.0.18 Committer: @miraleung PiperOrigin-RevId: 350949863 Source-Author: Google APIs Source-Date: Sat Jan 9 14:01:49 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 91e206bcfeaf8948ea03fe3cb1b7616108496cd3 Source-Link: https://github.com/googleapis/googleapis/commit/91e206bcfeaf8948ea03fe3cb1b7616108496cd3 * fix: add retryableStatusCodes back to bigtable Committer: @miraleung PiperOrigin-RevId: 351852297 Source-Author: Google APIs Source-Date: Thu Jan 14 12:19:44 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: df49bfe877fff8c37f60855a7e754b7a4369709e Source-Link: https://github.com/googleapis/googleapis/commit/df49bfe877fff8c37f60855a7e754b7a4369709e * feat: generate sample code in the Java microgenerator Committer: @miraleung PiperOrigin-RevId: 356341083 Source-Author: Google APIs Source-Date: Mon Feb 8 13:33:28 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 8d8c008e56f1af31d57f75561e0f1848ffb29eeb Source-Link: https://github.com/googleapis/googleapis/commit/8d8c008e56f1af31d57f75561e0f1848ffb29eeb Co-authored-by: kolea2 <45548808+kolea2@users.noreply.github.com> --- .../v2/BaseBigtableInstanceAdminClient.java | 1446 +++++----- .../v2/BaseBigtableInstanceAdminSettings.java | 39 +- .../v2/BaseBigtableTableAdminClient.java | 2553 +++++++++-------- .../v2/BaseBigtableTableAdminSettings.java | 125 +- .../v2/stub/BigtableInstanceAdminStub.java | 16 +- .../BigtableInstanceAdminStubSettings.java | 463 ++- .../admin/v2/stub/BigtableTableAdminStub.java | 53 +- .../stub/BigtableTableAdminStubSettings.java | 853 +++--- ...cBigtableInstanceAdminCallableFactory.java | 37 +- .../stub/GrpcBigtableInstanceAdminStub.java | 119 +- ...GrpcBigtableTableAdminCallableFactory.java | 37 +- .../v2/stub/GrpcBigtableTableAdminStub.java | 341 +-- .../bigtable/data/v2/stub/BigtableStub.java | 5 +- .../data/v2/stub/BigtableStubSettings.java | 136 +- .../v2/stub/GrpcBigtableCallableFactory.java | 37 +- .../data/v2/stub/GrpcBigtableStub.java | 24 +- .../BaseBigtableInstanceAdminClientTest.java | 1064 +++++-- .../v2/BaseBigtableTableAdminClientTest.java | 1958 ++++++++++--- .../admin/v2/MockBigtableInstanceAdmin.java | 6 +- .../v2/MockBigtableInstanceAdminImpl.java | 92 +- .../admin/v2/MockBigtableTableAdmin.java | 6 +- .../admin/v2/MockBigtableTableAdminImpl.java | 94 +- .../bigtable/admin/v2/AppProfileName.java | 112 +- .../google/bigtable/admin/v2/BackupName.java | 125 +- .../google/bigtable/admin/v2/ClusterName.java | 113 +- .../bigtable/admin/v2/InstanceName.java | 98 +- .../bigtable/admin/v2/LocationName.java | 98 +- .../google/bigtable/admin/v2/ProjectName.java | 86 +- .../bigtable/admin/v2/SnapshotName.java | 127 +- .../google/bigtable/admin/v2/TableName.java | 113 +- .../com/google/bigtable/v2/TableName.java | 113 +- synth.metadata | 4 +- 32 files changed, 6382 insertions(+), 4111 deletions(-) diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminClient.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminClient.java index 21d398cb0..aa9dc1668 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminClient.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminClient.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.admin.v2; import com.google.api.core.ApiFunction; @@ -76,7 +77,7 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** For internal use only. */ @Generated("by gapic-generator") @InternalApi @@ -102,7 +103,7 @@ public static final BaseBigtableInstanceAdminClient create( /** * Constructs an instance of BaseBigtableInstanceAdminClient, using the given stub for making - * calls. This is for advanced usage - prefer to use BaseBigtableInstanceAdminSettings}. + * calls. This is for advanced usage - prefer using create(BaseBigtableInstanceAdminSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final BaseBigtableInstanceAdminClient create(BigtableInstanceAdminStub stub) { @@ -141,27 +142,29 @@ public BigtableInstanceAdminStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationsClient getOperationsClient() { return operationsClient; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Create an instance within a project. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
    *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   String instanceId = "";
+   *   String instanceId = "instanceId902024336";
    *   Instance instance = Instance.newBuilder().build();
-   *   Map<String, Cluster> clusters = new HashMap<>();
-   *   Instance response = baseBigtableInstanceAdminClient.createInstanceAsync(parent, instanceId, instance, clusters).get();
+   *   Map clusters = new HashMap<>();
+   *   Instance response =
+   *       baseBigtableInstanceAdminClient
+   *           .createInstanceAsync(parent, instanceId, instance, clusters)
+   *           .get();
    * }
-   * 
+ * }
* * @param parent Required. The unique name of the project in which to create the new instance. * Values are of the form `projects/{project}`. @@ -175,8 +178,6 @@ public final OperationsClient getOperationsClient() { * must be left blank. Currently, at most four clusters can be specified. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createInstanceAsync( ProjectName parent, String instanceId, Instance instance, Map clusters) { CreateInstanceRequest request = @@ -189,21 +190,25 @@ public final OperationFuture createInstanceAsy return createInstanceAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Create an instance within a project. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   String instanceId = "";
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   String parent = ProjectName.of("[PROJECT]").toString();
+   *   String instanceId = "instanceId902024336";
    *   Instance instance = Instance.newBuilder().build();
-   *   Map<String, Cluster> clusters = new HashMap<>();
-   *   Instance response = baseBigtableInstanceAdminClient.createInstanceAsync(parent.toString(), instanceId, instance, clusters).get();
+   *   Map clusters = new HashMap<>();
+   *   Instance response =
+   *       baseBigtableInstanceAdminClient
+   *           .createInstanceAsync(parent, instanceId, instance, clusters)
+   *           .get();
    * }
-   * 
+ * }
* * @param parent Required. The unique name of the project in which to create the new instance. * Values are of the form `projects/{project}`. @@ -217,8 +222,6 @@ public final OperationFuture createInstanceAsy * must be left blank. Currently, at most four clusters can be specified. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createInstanceAsync( String parent, String instanceId, Instance instance, Map clusters) { CreateInstanceRequest request = @@ -231,108 +234,102 @@ public final OperationFuture createInstanceAsy return createInstanceAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Create an instance within a project. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   String instanceId = "";
-   *   Instance instance = Instance.newBuilder().build();
-   *   Map<String, Cluster> clusters = new HashMap<>();
-   *   CreateInstanceRequest request = CreateInstanceRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setInstanceId(instanceId)
-   *     .setInstance(instance)
-   *     .putAllClusters(clusters)
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   CreateInstanceRequest request =
+   *       CreateInstanceRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setInstanceId("instanceId902024336")
+   *           .setInstance(Instance.newBuilder().build())
+   *           .putAllClusters(new HashMap())
+   *           .build();
    *   Instance response = baseBigtableInstanceAdminClient.createInstanceAsync(request).get();
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createInstanceAsync( CreateInstanceRequest request) { return createInstanceOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Create an instance within a project. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   String instanceId = "";
-   *   Instance instance = Instance.newBuilder().build();
-   *   Map<String, Cluster> clusters = new HashMap<>();
-   *   CreateInstanceRequest request = CreateInstanceRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setInstanceId(instanceId)
-   *     .setInstance(instance)
-   *     .putAllClusters(clusters)
-   *     .build();
-   *   OperationFuture<Instance, CreateInstanceMetadata> future = baseBigtableInstanceAdminClient.createInstanceOperationCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   CreateInstanceRequest request =
+   *       CreateInstanceRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setInstanceId("instanceId902024336")
+   *           .setInstance(Instance.newBuilder().build())
+   *           .putAllClusters(new HashMap())
+   *           .build();
+   *   OperationFuture future =
+   *       baseBigtableInstanceAdminClient.createInstanceOperationCallable().futureCall(request);
+   *   // Do something.
    *   Instance response = future.get();
    * }
-   * 
+ * }
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable createInstanceOperationCallable() { return stub.createInstanceOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Create an instance within a project. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   String instanceId = "";
-   *   Instance instance = Instance.newBuilder().build();
-   *   Map<String, Cluster> clusters = new HashMap<>();
-   *   CreateInstanceRequest request = CreateInstanceRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setInstanceId(instanceId)
-   *     .setInstance(instance)
-   *     .putAllClusters(clusters)
-   *     .build();
-   *   ApiFuture<Operation> future = baseBigtableInstanceAdminClient.createInstanceCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   CreateInstanceRequest request =
+   *       CreateInstanceRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setInstanceId("instanceId902024336")
+   *           .setInstance(Instance.newBuilder().build())
+   *           .putAllClusters(new HashMap())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableInstanceAdminClient.createInstanceCallable().futureCall(request);
+   *   // Do something.
    *   Operation response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable createInstanceCallable() { return stub.createInstanceCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets information about an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
    *   InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
    *   Instance response = baseBigtableInstanceAdminClient.getInstance(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the requested instance. Values are of the form * `projects/{project}/instances/{instance}`. @@ -344,18 +341,19 @@ public final Instance getInstance(InstanceName name) { return getInstance(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets information about an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   Instance response = baseBigtableInstanceAdminClient.getInstance(name.toString());
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   String name = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
+   *   Instance response = baseBigtableInstanceAdminClient.getInstance(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the requested instance. Values are of the form * `projects/{project}/instances/{instance}`. @@ -366,21 +364,22 @@ public final Instance getInstance(String name) { return getInstance(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets information about an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   GetInstanceRequest request = GetInstanceRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   GetInstanceRequest request =
+   *       GetInstanceRequest.newBuilder()
+   *           .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .build();
    *   Instance response = baseBigtableInstanceAdminClient.getInstance(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -389,40 +388,43 @@ public final Instance getInstance(GetInstanceRequest request) { return getInstanceCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets information about an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   GetInstanceRequest request = GetInstanceRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Instance> future = baseBigtableInstanceAdminClient.getInstanceCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   GetInstanceRequest request =
+   *       GetInstanceRequest.newBuilder()
+   *           .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableInstanceAdminClient.getInstanceCallable().futureCall(request);
+   *   // Do something.
    *   Instance response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable getInstanceCallable() { return stub.getInstanceCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists information about instances in a project. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
    *   ProjectName parent = ProjectName.of("[PROJECT]");
    *   ListInstancesResponse response = baseBigtableInstanceAdminClient.listInstances(parent);
    * }
-   * 
+ * }
* * @param parent Required. The unique name of the project for which a list of instances is * requested. Values are of the form `projects/{project}`. @@ -436,18 +438,19 @@ public final ListInstancesResponse listInstances(ProjectName parent) { return listInstances(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists information about instances in a project. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ListInstancesResponse response = baseBigtableInstanceAdminClient.listInstances(parent.toString());
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   String parent = ProjectName.of("[PROJECT]").toString();
+   *   ListInstancesResponse response = baseBigtableInstanceAdminClient.listInstances(parent);
    * }
-   * 
+ * }
* * @param parent Required. The unique name of the project for which a list of instances is * requested. Values are of the form `projects/{project}`. @@ -458,21 +461,23 @@ public final ListInstancesResponse listInstances(String parent) { return listInstances(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists information about instances in a project. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ListInstancesRequest request = ListInstancesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   ListInstancesRequest request =
+   *       ListInstancesRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .build();
    *   ListInstancesResponse response = baseBigtableInstanceAdminClient.listInstances(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -481,50 +486,107 @@ public final ListInstancesResponse listInstances(ListInstancesRequest request) { return listInstancesCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists information about instances in a project. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ProjectName parent = ProjectName.of("[PROJECT]");
-   *   ListInstancesRequest request = ListInstancesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListInstancesResponse> future = baseBigtableInstanceAdminClient.listInstancesCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   ListInstancesRequest request =
+   *       ListInstancesRequest.newBuilder()
+   *           .setParent(ProjectName.of("[PROJECT]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableInstanceAdminClient.listInstancesCallable().futureCall(request);
+   *   // Do something.
    *   ListInstancesResponse response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable listInstancesCallable() { return stub.listInstancesCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates an instance within a project. This method updates only the display name and type for an + * Instance. To update other Instance properties, such as labels, use PartialUpdateInstance. + * + *

Sample code: + * + *

{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   Instance request =
+   *       Instance.newBuilder()
+   *           .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setDisplayName("displayName1714148973")
+   *           .putAllLabels(new HashMap())
+   *           .build();
+   *   Instance response = baseBigtableInstanceAdminClient.updateInstance(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Instance updateInstance(Instance request) { + return updateInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates an instance within a project. This method updates only the display name and type for an + * Instance. To update other Instance properties, such as labels, use PartialUpdateInstance. + * + *

Sample code: + * + *

{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   Instance request =
+   *       Instance.newBuilder()
+   *           .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setDisplayName("displayName1714148973")
+   *           .putAllLabels(new HashMap())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableInstanceAdminClient.updateInstanceCallable().futureCall(request);
+   *   // Do something.
+   *   Instance response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable updateInstanceCallable() { + return stub.updateInstanceCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Partially updates an instance within a project. This method can modify all fields of an * Instance and is the preferred way to update an Instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
    *   Instance instance = Instance.newBuilder().build();
    *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Instance response = baseBigtableInstanceAdminClient.partialUpdateInstanceAsync(instance, updateMask).get();
+   *   Instance response =
+   *       baseBigtableInstanceAdminClient.partialUpdateInstanceAsync(instance, updateMask).get();
    * }
-   * 
+ * }
* * @param instance Required. The Instance which will (partially) replace the current value. * @param updateMask Required. The subset of Instance fields which should be replaced. Must be * explicitly set. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture partialUpdateInstanceAsync( Instance instance, FieldMask updateMask) { PartialUpdateInstanceRequest request = @@ -535,100 +597,102 @@ public final OperationFuture partialUpdateInst return partialUpdateInstanceAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Partially updates an instance within a project. This method can modify all fields of an * Instance and is the preferred way to update an Instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   Instance instance = Instance.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   PartialUpdateInstanceRequest request = PartialUpdateInstanceRequest.newBuilder()
-   *     .setInstance(instance)
-   *     .setUpdateMask(updateMask)
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   PartialUpdateInstanceRequest request =
+   *       PartialUpdateInstanceRequest.newBuilder()
+   *           .setInstance(Instance.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
    *   Instance response = baseBigtableInstanceAdminClient.partialUpdateInstanceAsync(request).get();
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture partialUpdateInstanceAsync( PartialUpdateInstanceRequest request) { return partialUpdateInstanceOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Partially updates an instance within a project. This method can modify all fields of an * Instance and is the preferred way to update an Instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   Instance instance = Instance.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   PartialUpdateInstanceRequest request = PartialUpdateInstanceRequest.newBuilder()
-   *     .setInstance(instance)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   OperationFuture<Instance, UpdateInstanceMetadata> future = baseBigtableInstanceAdminClient.partialUpdateInstanceOperationCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   PartialUpdateInstanceRequest request =
+   *       PartialUpdateInstanceRequest.newBuilder()
+   *           .setInstance(Instance.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   OperationFuture future =
+   *       baseBigtableInstanceAdminClient
+   *           .partialUpdateInstanceOperationCallable()
+   *           .futureCall(request);
+   *   // Do something.
    *   Instance response = future.get();
    * }
-   * 
+ * }
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable partialUpdateInstanceOperationCallable() { return stub.partialUpdateInstanceOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Partially updates an instance within a project. This method can modify all fields of an * Instance and is the preferred way to update an Instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   Instance instance = Instance.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   PartialUpdateInstanceRequest request = PartialUpdateInstanceRequest.newBuilder()
-   *     .setInstance(instance)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   ApiFuture<Operation> future = baseBigtableInstanceAdminClient.partialUpdateInstanceCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   PartialUpdateInstanceRequest request =
+   *       PartialUpdateInstanceRequest.newBuilder()
+   *           .setInstance(Instance.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableInstanceAdminClient.partialUpdateInstanceCallable().futureCall(request);
+   *   // Do something.
    *   Operation response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable partialUpdateInstanceCallable() { return stub.partialUpdateInstanceCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Delete an instance from a project. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
    *   InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
    *   baseBigtableInstanceAdminClient.deleteInstance(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the instance to be deleted. Values are of the form * `projects/{project}/instances/{instance}`. @@ -640,18 +704,19 @@ public final void deleteInstance(InstanceName name) { deleteInstance(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Delete an instance from a project. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   baseBigtableInstanceAdminClient.deleteInstance(name.toString());
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   String name = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
+   *   baseBigtableInstanceAdminClient.deleteInstance(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the instance to be deleted. Values are of the form * `projects/{project}/instances/{instance}`. @@ -662,21 +727,22 @@ public final void deleteInstance(String name) { deleteInstance(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Delete an instance from a project. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   DeleteInstanceRequest request =
+   *       DeleteInstanceRequest.newBuilder()
+   *           .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .build();
    *   baseBigtableInstanceAdminClient.deleteInstance(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -685,42 +751,46 @@ public final void deleteInstance(DeleteInstanceRequest request) { deleteInstanceCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Delete an instance from a project. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = baseBigtableInstanceAdminClient.deleteInstanceCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   DeleteInstanceRequest request =
+   *       DeleteInstanceRequest.newBuilder()
+   *           .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableInstanceAdminClient.deleteInstanceCallable().futureCall(request);
+   *   // Do something.
    *   future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable deleteInstanceCallable() { return stub.deleteInstanceCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a cluster within an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
    *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String clusterId = "";
+   *   String clusterId = "clusterId561939637";
    *   Cluster cluster = Cluster.newBuilder().build();
-   *   Cluster response = baseBigtableInstanceAdminClient.createClusterAsync(parent, clusterId, cluster).get();
+   *   Cluster response =
+   *       baseBigtableInstanceAdminClient.createClusterAsync(parent, clusterId, cluster).get();
    * }
-   * 
+ * }
* * @param parent Required. The unique name of the instance in which to create the new cluster. * Values are of the form `projects/{project}/instances/{instance}`. @@ -731,8 +801,6 @@ public final UnaryCallable deleteInstanceCallable( * blank. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createClusterAsync( InstanceName parent, String clusterId, Cluster cluster) { CreateClusterRequest request = @@ -744,20 +812,22 @@ public final OperationFuture createClusterAsync( return createClusterAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a cluster within an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String clusterId = "";
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
+   *   String clusterId = "clusterId561939637";
    *   Cluster cluster = Cluster.newBuilder().build();
-   *   Cluster response = baseBigtableInstanceAdminClient.createClusterAsync(parent.toString(), clusterId, cluster).get();
+   *   Cluster response =
+   *       baseBigtableInstanceAdminClient.createClusterAsync(parent, clusterId, cluster).get();
    * }
-   * 
+ * }
* * @param parent Required. The unique name of the instance in which to create the new cluster. * Values are of the form `projects/{project}/instances/{instance}`. @@ -768,8 +838,6 @@ public final OperationFuture createClusterAsync( * blank. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createClusterAsync( String parent, String clusterId, Cluster cluster) { CreateClusterRequest request = @@ -781,102 +849,99 @@ public final OperationFuture createClusterAsync( return createClusterAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a cluster within an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String clusterId = "";
-   *   Cluster cluster = Cluster.newBuilder().build();
-   *   CreateClusterRequest request = CreateClusterRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setClusterId(clusterId)
-   *     .setCluster(cluster)
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   CreateClusterRequest request =
+   *       CreateClusterRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setClusterId("clusterId561939637")
+   *           .setCluster(Cluster.newBuilder().build())
+   *           .build();
    *   Cluster response = baseBigtableInstanceAdminClient.createClusterAsync(request).get();
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createClusterAsync( CreateClusterRequest request) { return createClusterOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a cluster within an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String clusterId = "";
-   *   Cluster cluster = Cluster.newBuilder().build();
-   *   CreateClusterRequest request = CreateClusterRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setClusterId(clusterId)
-   *     .setCluster(cluster)
-   *     .build();
-   *   OperationFuture<Cluster, CreateClusterMetadata> future = baseBigtableInstanceAdminClient.createClusterOperationCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   CreateClusterRequest request =
+   *       CreateClusterRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setClusterId("clusterId561939637")
+   *           .setCluster(Cluster.newBuilder().build())
+   *           .build();
+   *   OperationFuture future =
+   *       baseBigtableInstanceAdminClient.createClusterOperationCallable().futureCall(request);
+   *   // Do something.
    *   Cluster response = future.get();
    * }
-   * 
+ * }
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable createClusterOperationCallable() { return stub.createClusterOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a cluster within an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String clusterId = "";
-   *   Cluster cluster = Cluster.newBuilder().build();
-   *   CreateClusterRequest request = CreateClusterRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setClusterId(clusterId)
-   *     .setCluster(cluster)
-   *     .build();
-   *   ApiFuture<Operation> future = baseBigtableInstanceAdminClient.createClusterCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   CreateClusterRequest request =
+   *       CreateClusterRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setClusterId("clusterId561939637")
+   *           .setCluster(Cluster.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableInstanceAdminClient.createClusterCallable().futureCall(request);
+   *   // Do something.
    *   Operation response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable createClusterCallable() { return stub.createClusterCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets information about a cluster. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
    *   ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
    *   Cluster response = baseBigtableInstanceAdminClient.getCluster(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the requested cluster. Values are of the form * `projects/{project}/instances/{instance}/clusters/{cluster}`. @@ -888,18 +953,19 @@ public final Cluster getCluster(ClusterName name) { return getCluster(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets information about a cluster. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   Cluster response = baseBigtableInstanceAdminClient.getCluster(name.toString());
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   String name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString();
+   *   Cluster response = baseBigtableInstanceAdminClient.getCluster(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the requested cluster. Values are of the form * `projects/{project}/instances/{instance}/clusters/{cluster}`. @@ -910,21 +976,22 @@ public final Cluster getCluster(String name) { return getCluster(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets information about a cluster. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   GetClusterRequest request = GetClusterRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   GetClusterRequest request =
+   *       GetClusterRequest.newBuilder()
+   *           .setName(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString())
+   *           .build();
    *   Cluster response = baseBigtableInstanceAdminClient.getCluster(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -933,40 +1000,43 @@ public final Cluster getCluster(GetClusterRequest request) { return getClusterCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets information about a cluster. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   GetClusterRequest request = GetClusterRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Cluster> future = baseBigtableInstanceAdminClient.getClusterCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   GetClusterRequest request =
+   *       GetClusterRequest.newBuilder()
+   *           .setName(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableInstanceAdminClient.getClusterCallable().futureCall(request);
+   *   // Do something.
    *   Cluster response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable getClusterCallable() { return stub.getClusterCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists information about clusters in an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
    *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
    *   ListClustersResponse response = baseBigtableInstanceAdminClient.listClusters(parent);
    * }
-   * 
+ * }
* * @param parent Required. The unique name of the instance for which a list of clusters is * requested. Values are of the form `projects/{project}/instances/{instance}`. Use @@ -982,18 +1052,19 @@ public final ListClustersResponse listClusters(InstanceName parent) { return listClusters(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists information about clusters in an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   ListClustersResponse response = baseBigtableInstanceAdminClient.listClusters(parent.toString());
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
+   *   ListClustersResponse response = baseBigtableInstanceAdminClient.listClusters(parent);
    * }
-   * 
+ * }
* * @param parent Required. The unique name of the instance for which a list of clusters is * requested. Values are of the form `projects/{project}/instances/{instance}`. Use @@ -1006,21 +1077,23 @@ public final ListClustersResponse listClusters(String parent) { return listClusters(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists information about clusters in an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   ListClustersRequest request = ListClustersRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   ListClustersRequest request =
+   *       ListClustersRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .build();
    *   ListClustersResponse response = baseBigtableInstanceAdminClient.listClusters(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1029,111 +1102,123 @@ public final ListClustersResponse listClusters(ListClustersRequest request) { return listClustersCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists information about clusters in an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   ListClustersRequest request = ListClustersRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListClustersResponse> future = baseBigtableInstanceAdminClient.listClustersCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   ListClustersRequest request =
+   *       ListClustersRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableInstanceAdminClient.listClustersCallable().futureCall(request);
+   *   // Do something.
    *   ListClustersResponse response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable listClustersCallable() { return stub.listClustersCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a cluster within an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   int serveNodes = 0;
-   *   Cluster request = Cluster.newBuilder()
-   *     .setServeNodes(serveNodes)
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   Cluster request =
+   *       Cluster.newBuilder()
+   *           .setName(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString())
+   *           .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setServeNodes(-1288838783)
+   *           .build();
    *   Cluster response = baseBigtableInstanceAdminClient.updateClusterAsync(request).get();
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture updateClusterAsync(Cluster request) { return updateClusterOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a cluster within an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   int serveNodes = 0;
-   *   Cluster request = Cluster.newBuilder()
-   *     .setServeNodes(serveNodes)
-   *     .build();
-   *   OperationFuture<Cluster, UpdateClusterMetadata> future = baseBigtableInstanceAdminClient.updateClusterOperationCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   Cluster request =
+   *       Cluster.newBuilder()
+   *           .setName(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString())
+   *           .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setServeNodes(-1288838783)
+   *           .build();
+   *   OperationFuture future =
+   *       baseBigtableInstanceAdminClient.updateClusterOperationCallable().futureCall(request);
+   *   // Do something.
    *   Cluster response = future.get();
    * }
-   * 
+ * }
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable updateClusterOperationCallable() { return stub.updateClusterOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a cluster within an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   int serveNodes = 0;
-   *   Cluster request = Cluster.newBuilder()
-   *     .setServeNodes(serveNodes)
-   *     .build();
-   *   ApiFuture<Operation> future = baseBigtableInstanceAdminClient.updateClusterCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   Cluster request =
+   *       Cluster.newBuilder()
+   *           .setName(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString())
+   *           .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setServeNodes(-1288838783)
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableInstanceAdminClient.updateClusterCallable().futureCall(request);
+   *   // Do something.
    *   Operation response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable updateClusterCallable() { return stub.updateClusterCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a cluster from an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
    *   ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
    *   baseBigtableInstanceAdminClient.deleteCluster(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the cluster to be deleted. Values are of the form * `projects/{project}/instances/{instance}/clusters/{cluster}`. @@ -1145,18 +1230,19 @@ public final void deleteCluster(ClusterName name) { deleteCluster(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a cluster from an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   baseBigtableInstanceAdminClient.deleteCluster(name.toString());
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   String name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString();
+   *   baseBigtableInstanceAdminClient.deleteCluster(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the cluster to be deleted. Values are of the form * `projects/{project}/instances/{instance}/clusters/{cluster}`. @@ -1167,21 +1253,22 @@ public final void deleteCluster(String name) { deleteCluster(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a cluster from an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   DeleteClusterRequest request = DeleteClusterRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   DeleteClusterRequest request =
+   *       DeleteClusterRequest.newBuilder()
+   *           .setName(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString())
+   *           .build();
    *   baseBigtableInstanceAdminClient.deleteCluster(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1190,42 +1277,46 @@ public final void deleteCluster(DeleteClusterRequest request) { deleteClusterCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a cluster from an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   DeleteClusterRequest request = DeleteClusterRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = baseBigtableInstanceAdminClient.deleteClusterCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   DeleteClusterRequest request =
+   *       DeleteClusterRequest.newBuilder()
+   *           .setName(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableInstanceAdminClient.deleteClusterCallable().futureCall(request);
+   *   // Do something.
    *   future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable deleteClusterCallable() { return stub.deleteClusterCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an app profile within an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
    *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String appProfileId = "";
+   *   String appProfileId = "appProfileId704923523";
    *   AppProfile appProfile = AppProfile.newBuilder().build();
-   *   AppProfile response = baseBigtableInstanceAdminClient.createAppProfile(parent, appProfileId, appProfile);
+   *   AppProfile response =
+   *       baseBigtableInstanceAdminClient.createAppProfile(parent, appProfileId, appProfile);
    * }
-   * 
+ * }
* * @param parent Required. The unique name of the instance in which to create the new app profile. * Values are of the form `projects/{project}/instances/{instance}`. @@ -1247,20 +1338,22 @@ public final AppProfile createAppProfile( return createAppProfile(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an app profile within an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String appProfileId = "";
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
+   *   String appProfileId = "appProfileId704923523";
    *   AppProfile appProfile = AppProfile.newBuilder().build();
-   *   AppProfile response = baseBigtableInstanceAdminClient.createAppProfile(parent.toString(), appProfileId, appProfile);
+   *   AppProfile response =
+   *       baseBigtableInstanceAdminClient.createAppProfile(parent, appProfileId, appProfile);
    * }
-   * 
+ * }
* * @param parent Required. The unique name of the instance in which to create the new app profile. * Values are of the form `projects/{project}/instances/{instance}`. @@ -1282,25 +1375,25 @@ public final AppProfile createAppProfile( return createAppProfile(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an app profile within an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String appProfileId = "";
-   *   AppProfile appProfile = AppProfile.newBuilder().build();
-   *   CreateAppProfileRequest request = CreateAppProfileRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setAppProfileId(appProfileId)
-   *     .setAppProfile(appProfile)
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   CreateAppProfileRequest request =
+   *       CreateAppProfileRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setAppProfileId("appProfileId704923523")
+   *           .setAppProfile(AppProfile.newBuilder().build())
+   *           .setIgnoreWarnings(true)
+   *           .build();
    *   AppProfile response = baseBigtableInstanceAdminClient.createAppProfile(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1309,44 +1402,46 @@ public final AppProfile createAppProfile(CreateAppProfileRequest request) { return createAppProfileCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an app profile within an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String appProfileId = "";
-   *   AppProfile appProfile = AppProfile.newBuilder().build();
-   *   CreateAppProfileRequest request = CreateAppProfileRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setAppProfileId(appProfileId)
-   *     .setAppProfile(appProfile)
-   *     .build();
-   *   ApiFuture<AppProfile> future = baseBigtableInstanceAdminClient.createAppProfileCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   CreateAppProfileRequest request =
+   *       CreateAppProfileRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setAppProfileId("appProfileId704923523")
+   *           .setAppProfile(AppProfile.newBuilder().build())
+   *           .setIgnoreWarnings(true)
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableInstanceAdminClient.createAppProfileCallable().futureCall(request);
+   *   // Do something.
    *   AppProfile response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable createAppProfileCallable() { return stub.createAppProfileCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets information about an app profile. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
    *   AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
    *   AppProfile response = baseBigtableInstanceAdminClient.getAppProfile(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the requested app profile. Values are of the form * `projects/{project}/instances/{instance}/appProfiles/{app_profile}`. @@ -1358,18 +1453,19 @@ public final AppProfile getAppProfile(AppProfileName name) { return getAppProfile(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets information about an app profile. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   AppProfile response = baseBigtableInstanceAdminClient.getAppProfile(name.toString());
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   String name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]").toString();
+   *   AppProfile response = baseBigtableInstanceAdminClient.getAppProfile(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the requested app profile. Values are of the form * `projects/{project}/instances/{instance}/appProfiles/{app_profile}`. @@ -1380,21 +1476,22 @@ public final AppProfile getAppProfile(String name) { return getAppProfile(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets information about an app profile. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   GetAppProfileRequest request = GetAppProfileRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   GetAppProfileRequest request =
+   *       GetAppProfileRequest.newBuilder()
+   *           .setName(AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]").toString())
+   *           .build();
    *   AppProfile response = baseBigtableInstanceAdminClient.getAppProfile(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1403,42 +1500,46 @@ public final AppProfile getAppProfile(GetAppProfileRequest request) { return getAppProfileCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets information about an app profile. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   GetAppProfileRequest request = GetAppProfileRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<AppProfile> future = baseBigtableInstanceAdminClient.getAppProfileCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   GetAppProfileRequest request =
+   *       GetAppProfileRequest.newBuilder()
+   *           .setName(AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableInstanceAdminClient.getAppProfileCallable().futureCall(request);
+   *   // Do something.
    *   AppProfile response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable getAppProfileCallable() { return stub.getAppProfileCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists information about app profiles in an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
    *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   for (AppProfile element : baseBigtableInstanceAdminClient.listAppProfiles(parent).iterateAll()) {
+   *   for (AppProfile element :
+   *       baseBigtableInstanceAdminClient.listAppProfiles(parent).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param parent Required. The unique name of the instance for which a list of app profiles is * requested. Values are of the form `projects/{project}/instances/{instance}`. Use @@ -1454,20 +1555,22 @@ public final ListAppProfilesPagedResponse listAppProfiles(InstanceName parent) { return listAppProfiles(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists information about app profiles in an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   for (AppProfile element : baseBigtableInstanceAdminClient.listAppProfiles(parent.toString()).iterateAll()) {
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
+   *   for (AppProfile element :
+   *       baseBigtableInstanceAdminClient.listAppProfiles(parent).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param parent Required. The unique name of the instance for which a list of app profiles is * requested. Values are of the form `projects/{project}/instances/{instance}`. Use @@ -1480,23 +1583,27 @@ public final ListAppProfilesPagedResponse listAppProfiles(String parent) { return listAppProfiles(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists information about app profiles in an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   ListAppProfilesRequest request = ListAppProfilesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   for (AppProfile element : baseBigtableInstanceAdminClient.listAppProfiles(request).iterateAll()) {
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   ListAppProfilesRequest request =
+   *       ListAppProfilesRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (AppProfile element :
+   *       baseBigtableInstanceAdminClient.listAppProfiles(request).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1505,46 +1612,48 @@ public final ListAppProfilesPagedResponse listAppProfiles(ListAppProfilesRequest return listAppProfilesPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists information about app profiles in an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   ListAppProfilesRequest request = ListAppProfilesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListAppProfilesPagedResponse> future = baseBigtableInstanceAdminClient.listAppProfilesPagedCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   ListAppProfilesRequest request =
+   *       ListAppProfilesRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableInstanceAdminClient.listAppProfilesPagedCallable().futureCall(request);
+   *   // Do something.
    *   for (AppProfile element : future.get().iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
*/ public final UnaryCallable listAppProfilesPagedCallable() { return stub.listAppProfilesPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists information about app profiles in an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   ListAppProfilesRequest request = ListAppProfilesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
    *   while (true) {
-   *     ListAppProfilesResponse response = baseBigtableInstanceAdminClient.listAppProfilesCallable().call(request);
-   *     for (AppProfile element : response.getAppProfilesList()) {
+   *     ListAppProfilesResponse response =
+   *         baseBigtableInstanceAdminClient.listAppProfilesCallable().call(request);
+   *     for (AppProfile element : response.getResponsesList()) {
    *       // doThingsWith(element);
    *     }
    *     String nextPageToken = response.getNextPageToken();
@@ -1555,34 +1664,34 @@ public final ListAppProfilesPagedResponse listAppProfiles(ListAppProfilesRequest
    *     }
    *   }
    * }
-   * 
+ * }
*/ public final UnaryCallable listAppProfilesCallable() { return stub.listAppProfilesCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates an app profile within an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
    *   AppProfile appProfile = AppProfile.newBuilder().build();
    *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   AppProfile response = baseBigtableInstanceAdminClient.updateAppProfileAsync(appProfile, updateMask).get();
+   *   AppProfile response =
+   *       baseBigtableInstanceAdminClient.updateAppProfileAsync(appProfile, updateMask).get();
    * }
-   * 
+ * }
* * @param appProfile Required. The app profile which will (partially) replace the current value. * @param updateMask Required. The subset of app profile fields which should be replaced. If * unset, all fields will be replaced. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture updateAppProfileAsync( AppProfile appProfile, FieldMask updateMask) { UpdateAppProfileRequest request = @@ -1593,96 +1702,99 @@ public final OperationFuture updateAppProf return updateAppProfileAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates an app profile within an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   AppProfile appProfile = AppProfile.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateAppProfileRequest request = UpdateAppProfileRequest.newBuilder()
-   *     .setAppProfile(appProfile)
-   *     .setUpdateMask(updateMask)
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   UpdateAppProfileRequest request =
+   *       UpdateAppProfileRequest.newBuilder()
+   *           .setAppProfile(AppProfile.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .setIgnoreWarnings(true)
+   *           .build();
    *   AppProfile response = baseBigtableInstanceAdminClient.updateAppProfileAsync(request).get();
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture updateAppProfileAsync( UpdateAppProfileRequest request) { return updateAppProfileOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates an app profile within an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   AppProfile appProfile = AppProfile.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateAppProfileRequest request = UpdateAppProfileRequest.newBuilder()
-   *     .setAppProfile(appProfile)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   OperationFuture<AppProfile, UpdateAppProfileMetadata> future = baseBigtableInstanceAdminClient.updateAppProfileOperationCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   UpdateAppProfileRequest request =
+   *       UpdateAppProfileRequest.newBuilder()
+   *           .setAppProfile(AppProfile.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .setIgnoreWarnings(true)
+   *           .build();
+   *   OperationFuture future =
+   *       baseBigtableInstanceAdminClient.updateAppProfileOperationCallable().futureCall(request);
+   *   // Do something.
    *   AppProfile response = future.get();
    * }
-   * 
+ * }
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable updateAppProfileOperationCallable() { return stub.updateAppProfileOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates an app profile within an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   AppProfile appProfile = AppProfile.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateAppProfileRequest request = UpdateAppProfileRequest.newBuilder()
-   *     .setAppProfile(appProfile)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   ApiFuture<Operation> future = baseBigtableInstanceAdminClient.updateAppProfileCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   UpdateAppProfileRequest request =
+   *       UpdateAppProfileRequest.newBuilder()
+   *           .setAppProfile(AppProfile.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .setIgnoreWarnings(true)
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableInstanceAdminClient.updateAppProfileCallable().futureCall(request);
+   *   // Do something.
    *   Operation response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable updateAppProfileCallable() { return stub.updateAppProfileCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes an app profile from an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
    *   AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
    *   baseBigtableInstanceAdminClient.deleteAppProfile(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the app profile to be deleted. Values are of the form * `projects/{project}/instances/{instance}/appProfiles/{app_profile}`. @@ -1694,18 +1806,19 @@ public final void deleteAppProfile(AppProfileName name) { deleteAppProfile(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes an app profile from an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   baseBigtableInstanceAdminClient.deleteAppProfile(name.toString());
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   String name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]").toString();
+   *   baseBigtableInstanceAdminClient.deleteAppProfile(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the app profile to be deleted. Values are of the form * `projects/{project}/instances/{instance}/appProfiles/{app_profile}`. @@ -1716,23 +1829,23 @@ public final void deleteAppProfile(String name) { deleteAppProfile(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes an app profile from an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   boolean ignoreWarnings = false;
-   *   DeleteAppProfileRequest request = DeleteAppProfileRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .setIgnoreWarnings(ignoreWarnings)
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   DeleteAppProfileRequest request =
+   *       DeleteAppProfileRequest.newBuilder()
+   *           .setName(AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]").toString())
+   *           .setIgnoreWarnings(true)
+   *           .build();
    *   baseBigtableInstanceAdminClient.deleteAppProfile(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1741,43 +1854,45 @@ public final void deleteAppProfile(DeleteAppProfileRequest request) { deleteAppProfileCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes an app profile from an instance. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   boolean ignoreWarnings = false;
-   *   DeleteAppProfileRequest request = DeleteAppProfileRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .setIgnoreWarnings(ignoreWarnings)
-   *     .build();
-   *   ApiFuture<Void> future = baseBigtableInstanceAdminClient.deleteAppProfileCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   DeleteAppProfileRequest request =
+   *       DeleteAppProfileRequest.newBuilder()
+   *           .setName(AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]").toString())
+   *           .setIgnoreWarnings(true)
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableInstanceAdminClient.deleteAppProfileCallable().futureCall(request);
+   *   // Do something.
    *   future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable deleteAppProfileCallable() { return stub.deleteAppProfileCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for an instance resource. Returns an empty policy if an instance * exists but does not have a policy set. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   ResourceName resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
    *   Policy response = baseBigtableInstanceAdminClient.getIamPolicy(resource);
    * }
-   * 
+ * }
* * @param resource REQUIRED: The resource for which the policy is being requested. See the * operation documentation for the appropriate value for this field. @@ -1791,19 +1906,20 @@ public final Policy getIamPolicy(ResourceName resource) { return getIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for an instance resource. Returns an empty policy if an instance * exists but does not have a policy set. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   Policy response = baseBigtableInstanceAdminClient.getIamPolicy(resource.toString());
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   String resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
+   *   Policy response = baseBigtableInstanceAdminClient.getIamPolicy(resource);
    * }
-   * 
+ * }
* * @param resource REQUIRED: The resource for which the policy is being requested. See the * operation documentation for the appropriate value for this field. @@ -1814,22 +1930,24 @@ public final Policy getIamPolicy(String resource) { return getIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for an instance resource. Returns an empty policy if an instance * exists but does not have a policy set. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .build();
    *   Policy response = baseBigtableInstanceAdminClient.getIamPolicy(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1838,42 +1956,46 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) { return getIamPolicyCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for an instance resource. Returns an empty policy if an instance * exists but does not have a policy set. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .build();
-   *   ApiFuture<Policy> future = baseBigtableInstanceAdminClient.getIamPolicyCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableInstanceAdminClient.getIamPolicyCallable().futureCall(request);
+   *   // Do something.
    *   Policy response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable getIamPolicyCallable() { return stub.getIamPolicyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on an instance resource. Replaces any existing policy. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   ResourceName resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
    *   Policy policy = Policy.newBuilder().build();
    *   Policy response = baseBigtableInstanceAdminClient.setIamPolicy(resource, policy);
    * }
-   * 
+ * }
* * @param resource REQUIRED: The resource for which the policy is being specified. See the * operation documentation for the appropriate value for this field. @@ -1891,19 +2013,20 @@ public final Policy setIamPolicy(ResourceName resource, Policy policy) { return setIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on an instance resource. Replaces any existing policy. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   String resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
    *   Policy policy = Policy.newBuilder().build();
-   *   Policy response = baseBigtableInstanceAdminClient.setIamPolicy(resource.toString(), policy);
+   *   Policy response = baseBigtableInstanceAdminClient.setIamPolicy(resource, policy);
    * }
-   * 
+ * }
* * @param resource REQUIRED: The resource for which the policy is being specified. See the * operation documentation for the appropriate value for this field. @@ -1918,23 +2041,23 @@ public final Policy setIamPolicy(String resource, Policy policy) { return setIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on an instance resource. Replaces any existing policy. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .setPolicy(policy)
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .build();
    *   Policy response = baseBigtableInstanceAdminClient.setIamPolicy(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1943,43 +2066,46 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) { return setIamPolicyCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on an instance resource. Replaces any existing policy. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .setPolicy(policy)
-   *     .build();
-   *   ApiFuture<Policy> future = baseBigtableInstanceAdminClient.setIamPolicyCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableInstanceAdminClient.setIamPolicyCallable().futureCall(request);
+   *   // Do something.
    *   Policy response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable setIamPolicyCallable() { return stub.setIamPolicyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns permissions that the caller has on the specified instance resource. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsResponse response = baseBigtableInstanceAdminClient.testIamPermissions(resource, permissions);
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   ResourceName resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
+   *   List permissions = new ArrayList<>();
+   *   TestIamPermissionsResponse response =
+   *       baseBigtableInstanceAdminClient.testIamPermissions(resource, permissions);
    * }
-   * 
+ * }
* * @param resource REQUIRED: The resource for which the policy detail is being requested. See the * operation documentation for the appropriate value for this field. @@ -1998,19 +2124,21 @@ public final TestIamPermissionsResponse testIamPermissions( return testIamPermissions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns permissions that the caller has on the specified instance resource. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsResponse response = baseBigtableInstanceAdminClient.testIamPermissions(resource.toString(), permissions);
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   String resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
+   *   List permissions = new ArrayList<>();
+   *   TestIamPermissionsResponse response =
+   *       baseBigtableInstanceAdminClient.testIamPermissions(resource, permissions);
    * }
-   * 
+ * }
* * @param resource REQUIRED: The resource for which the policy detail is being requested. See the * operation documentation for the appropriate value for this field. @@ -2029,23 +2157,24 @@ public final TestIamPermissionsResponse testIamPermissions( return testIamPermissions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns permissions that the caller has on the specified instance resource. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .addAllPermissions(permissions)
-   *     .build();
-   *   TestIamPermissionsResponse response = baseBigtableInstanceAdminClient.testIamPermissions(request);
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .build();
+   *   TestIamPermissionsResponse response =
+   *       baseBigtableInstanceAdminClient.testIamPermissions(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -2054,25 +2183,26 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq return testIamPermissionsCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns permissions that the caller has on the specified instance resource. * *

Sample code: * - *


-   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .addAllPermissions(permissions)
-   *     .build();
-   *   ApiFuture<TestIamPermissionsResponse> future = baseBigtableInstanceAdminClient.testIamPermissionsCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+   *     BaseBigtableInstanceAdminClient.create()) {
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableInstanceAdminClient.testIamPermissionsCallable().futureCall(request);
+   *   // Do something.
    *   TestIamPermissionsResponse response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable testIamPermissionsCallable() { diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminSettings.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminSettings.java index e76bebbfd..0b5fb183e 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminSettings.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminSettings.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.admin.v2; import static com.google.cloud.bigtable.admin.v2.BaseBigtableInstanceAdminClient.ListAppProfilesPagedResponse; @@ -67,20 +68,19 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** For internal use only. */ @Generated("by gapic-generator") @InternalApi public class BaseBigtableInstanceAdminSettings extends ClientSettings { + /** Returns the object with the settings used for calls to createInstance. */ public UnaryCallSettings createInstanceSettings() { return ((BigtableInstanceAdminStubSettings) getStubSettings()).createInstanceSettings(); } /** Returns the object with the settings used for calls to createInstance. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings createInstanceOperationSettings() { return ((BigtableInstanceAdminStubSettings) getStubSettings()) @@ -104,8 +104,6 @@ public UnaryCallSettings listInstan } /** Returns the object with the settings used for calls to partialUpdateInstance. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings partialUpdateInstanceOperationSettings() { return ((BigtableInstanceAdminStubSettings) getStubSettings()) @@ -123,8 +121,6 @@ public UnaryCallSettings createClusterSettings( } /** Returns the object with the settings used for calls to createCluster. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings createClusterOperationSettings() { return ((BigtableInstanceAdminStubSettings) getStubSettings()).createClusterOperationSettings(); @@ -146,8 +142,6 @@ public UnaryCallSettings updateClusterSettings() { } /** Returns the object with the settings used for calls to updateCluster. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings updateClusterOperationSettings() { return ((BigtableInstanceAdminStubSettings) getStubSettings()).updateClusterOperationSettings(); @@ -181,8 +175,6 @@ public UnaryCallSettings updateAppProfileSet } /** Returns the object with the settings used for calls to updateAppProfile. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings updateAppProfileOperationSettings() { return ((BigtableInstanceAdminStubSettings) getStubSettings()) @@ -271,18 +263,15 @@ protected BaseBigtableInstanceAdminSettings(Builder settingsBuilder) throws IOEx /** Builder for BaseBigtableInstanceAdminSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(BigtableInstanceAdminStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(BigtableInstanceAdminStubSettings.newBuilder()); - } - protected Builder(BaseBigtableInstanceAdminSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -291,11 +280,15 @@ protected Builder(BigtableInstanceAdminStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(BigtableInstanceAdminStubSettings.newBuilder()); + } + public BigtableInstanceAdminStubSettings.Builder getStubSettingsBuilder() { return ((BigtableInstanceAdminStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * @@ -314,8 +307,6 @@ public UnaryCallSettings.Builder createInstanc } /** Returns the builder for the settings used for calls to createInstance. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder createInstanceOperationSettings() { return getStubSettingsBuilder().createInstanceOperationSettings(); @@ -339,8 +330,6 @@ public UnaryCallSettings.Builder getInstanceSettin } /** Returns the builder for the settings used for calls to partialUpdateInstance. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder< PartialUpdateInstanceRequest, Instance, UpdateInstanceMetadata> partialUpdateInstanceOperationSettings() { @@ -358,8 +347,6 @@ public UnaryCallSettings.Builder createClusterS } /** Returns the builder for the settings used for calls to createCluster. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder createClusterOperationSettings() { return getStubSettingsBuilder().createClusterOperationSettings(); @@ -382,8 +369,6 @@ public UnaryCallSettings.Builder updateClusterSettings() { } /** Returns the builder for the settings used for calls to updateCluster. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder updateClusterOperationSettings() { return getStubSettingsBuilder().updateClusterOperationSettings(); @@ -419,8 +404,6 @@ public UnaryCallSettings.Builder getAppProfile } /** Returns the builder for the settings used for calls to updateAppProfile. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder< UpdateAppProfileRequest, AppProfile, UpdateAppProfileMetadata> updateAppProfileOperationSettings() { diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminClient.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminClient.java index 58730fafa..b47b9156f 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminClient.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminClient.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.admin.v2; import com.google.api.core.ApiFunction; @@ -82,7 +83,7 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** For internal use only. */ @Generated("by gapic-generator") @InternalApi @@ -107,7 +108,7 @@ public static final BaseBigtableTableAdminClient create(BaseBigtableTableAdminSe /** * Constructs an instance of BaseBigtableTableAdminClient, using the given stub for making calls. - * This is for advanced usage - prefer to use BaseBigtableTableAdminSettings}. + * This is for advanced usage - prefer using create(BaseBigtableTableAdminSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final BaseBigtableTableAdminClient create(BigtableTableAdminStub stub) { @@ -146,27 +147,26 @@ public BigtableTableAdminStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationsClient getOperationsClient() { return operationsClient; } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new table in the specified instance. The table can be created with a full set of * initial column families, specified in the request. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
    *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String tableId = "";
+   *   String tableId = "tableId-1552905847";
    *   Table table = Table.newBuilder().build();
    *   Table response = baseBigtableTableAdminClient.createTable(parent, tableId, table);
    * }
-   * 
+ * }
* * @param parent Required. The unique name of the instance in which to create the table. Values * are of the form `projects/{project}/instances/{instance}`. @@ -186,21 +186,22 @@ public final Table createTable(InstanceName parent, String tableId, Table table) return createTable(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new table in the specified instance. The table can be created with a full set of * initial column families, specified in the request. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String tableId = "";
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
+   *   String tableId = "tableId-1552905847";
    *   Table table = Table.newBuilder().build();
-   *   Table response = baseBigtableTableAdminClient.createTable(parent.toString(), tableId, table);
+   *   Table response = baseBigtableTableAdminClient.createTable(parent, tableId, table);
    * }
-   * 
+ * }
* * @param parent Required. The unique name of the instance in which to create the table. Values * are of the form `projects/{project}/instances/{instance}`. @@ -220,26 +221,26 @@ public final Table createTable(String parent, String tableId, Table table) { return createTable(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new table in the specified instance. The table can be created with a full set of * initial column families, specified in the request. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String tableId = "";
-   *   Table table = Table.newBuilder().build();
-   *   CreateTableRequest request = CreateTableRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setTableId(tableId)
-   *     .setTable(table)
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   CreateTableRequest request =
+   *       CreateTableRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setTableId("tableId-1552905847")
+   *           .setTable(Table.newBuilder().build())
+   *           .addAllInitialSplits(new ArrayList())
+   *           .build();
    *   Table response = baseBigtableTableAdminClient.createTable(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -248,34 +249,35 @@ public final Table createTable(CreateTableRequest request) { return createTableCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new table in the specified instance. The table can be created with a full set of * initial column families, specified in the request. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String tableId = "";
-   *   Table table = Table.newBuilder().build();
-   *   CreateTableRequest request = CreateTableRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setTableId(tableId)
-   *     .setTable(table)
-   *     .build();
-   *   ApiFuture<Table> future = baseBigtableTableAdminClient.createTableCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   CreateTableRequest request =
+   *       CreateTableRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setTableId("tableId-1552905847")
+   *           .setTable(Table.newBuilder().build())
+   *           .addAllInitialSplits(new ArrayList())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableTableAdminClient.createTableCallable().futureCall(request);
+   *   // Do something.
    *   Table response = future.get();
    * }
-   * 
+   * }
    */
   public final UnaryCallable createTableCallable() {
     return stub.createTableCallable();
   }
 
-  // AUTO-GENERATED DOCUMENTATION AND METHOD
+  // AUTO-GENERATED DOCUMENTATION AND METHOD.
   /**
    * Creates a new table from the specified snapshot. The target table must not exist. The snapshot
    * and the table must be in the same instance.
@@ -287,14 +289,19 @@ public final UnaryCallable createTableCallable() {
    *
    * 

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
    *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String tableId = "";
-   *   SnapshotName sourceSnapshot = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
-   *   Table response = baseBigtableTableAdminClient.createTableFromSnapshotAsync(parent, tableId, sourceSnapshot).get();
+   *   String tableId = "tableId-1552905847";
+   *   SnapshotName sourceSnapshot =
+   *       SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
+   *   Table response =
+   *       baseBigtableTableAdminClient
+   *           .createTableFromSnapshotAsync(parent, tableId, sourceSnapshot)
+   *           .get();
    * }
-   * 
+ * }
* * @param parent Required. The unique name of the instance in which to create the table. Values * are of the form `projects/{project}/instances/{instance}`. @@ -305,8 +312,6 @@ public final UnaryCallable createTableCallable() { * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createTableFromSnapshotAsync( InstanceName parent, String tableId, SnapshotName sourceSnapshot) { CreateTableFromSnapshotRequest request = @@ -318,7 +323,7 @@ public final OperationFuture createTable return createTableFromSnapshotAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new table from the specified snapshot. The target table must not exist. The snapshot * and the table must be in the same instance. @@ -330,14 +335,111 @@ public final OperationFuture createTable * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
    *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String tableId = "";
-   *   SnapshotName sourceSnapshot = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
-   *   Table response = baseBigtableTableAdminClient.createTableFromSnapshotAsync(parent.toString(), tableId, sourceSnapshot.toString()).get();
+   *   String tableId = "tableId-1552905847";
+   *   String sourceSnapshot =
+   *       SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]").toString();
+   *   Table response =
+   *       baseBigtableTableAdminClient
+   *           .createTableFromSnapshotAsync(parent, tableId, sourceSnapshot)
+   *           .get();
+   * }
+   * }
+ * + * @param parent Required. The unique name of the instance in which to create the table. Values + * are of the form `projects/{project}/instances/{instance}`. + * @param tableId Required. The name by which the new table should be referred to within the + * parent instance, e.g., `foobar` rather than `{parent}/tables/foobar`. + * @param sourceSnapshot Required. The unique name of the snapshot from which to restore the + * table. The snapshot and the table must be in the same instance. Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createTableFromSnapshotAsync( + InstanceName parent, String tableId, String sourceSnapshot) { + CreateTableFromSnapshotRequest request = + CreateTableFromSnapshotRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setTableId(tableId) + .setSourceSnapshot(sourceSnapshot) + .build(); + return createTableFromSnapshotAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new table from the specified snapshot. The target table must not exist. The snapshot + * and the table must be in the same instance. + * + *

Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not + * currently available to most Cloud Bigtable customers. This feature might be changed in + * backward-incompatible ways and is not recommended for production use. It is not subject to any + * SLA or deprecation policy. + * + *

Sample code: + * + *

{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
+   *   String tableId = "tableId-1552905847";
+   *   SnapshotName sourceSnapshot =
+   *       SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
+   *   Table response =
+   *       baseBigtableTableAdminClient
+   *           .createTableFromSnapshotAsync(parent, tableId, sourceSnapshot)
+   *           .get();
+   * }
+   * }
+ * + * @param parent Required. The unique name of the instance in which to create the table. Values + * are of the form `projects/{project}/instances/{instance}`. + * @param tableId Required. The name by which the new table should be referred to within the + * parent instance, e.g., `foobar` rather than `{parent}/tables/foobar`. + * @param sourceSnapshot Required. The unique name of the snapshot from which to restore the + * table. The snapshot and the table must be in the same instance. Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createTableFromSnapshotAsync( + String parent, String tableId, SnapshotName sourceSnapshot) { + CreateTableFromSnapshotRequest request = + CreateTableFromSnapshotRequest.newBuilder() + .setParent(parent) + .setTableId(tableId) + .setSourceSnapshot(sourceSnapshot == null ? null : sourceSnapshot.toString()) + .build(); + return createTableFromSnapshotAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new table from the specified snapshot. The target table must not exist. The snapshot + * and the table must be in the same instance. + * + *

Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not + * currently available to most Cloud Bigtable customers. This feature might be changed in + * backward-incompatible ways and is not recommended for production use. It is not subject to any + * SLA or deprecation policy. + * + *

Sample code: + * + *

{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
+   *   String tableId = "tableId-1552905847";
+   *   String sourceSnapshot =
+   *       SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]").toString();
+   *   Table response =
+   *       baseBigtableTableAdminClient
+   *           .createTableFromSnapshotAsync(parent, tableId, sourceSnapshot)
+   *           .get();
    * }
-   * 
+ * }
* * @param parent Required. The unique name of the instance in which to create the table. Values * are of the form `projects/{project}/instances/{instance}`. @@ -348,8 +450,6 @@ public final OperationFuture createTable * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createTableFromSnapshotAsync( String parent, String tableId, String sourceSnapshot) { CreateTableFromSnapshotRequest request = @@ -361,7 +461,7 @@ public final OperationFuture createTable return createTableFromSnapshotAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new table from the specified snapshot. The target table must not exist. The snapshot * and the table must be in the same instance. @@ -373,31 +473,29 @@ public final OperationFuture createTable * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String tableId = "";
-   *   SnapshotName sourceSnapshot = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
-   *   CreateTableFromSnapshotRequest request = CreateTableFromSnapshotRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setTableId(tableId)
-   *     .setSourceSnapshot(sourceSnapshot.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   CreateTableFromSnapshotRequest request =
+   *       CreateTableFromSnapshotRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setTableId("tableId-1552905847")
+   *           .setSourceSnapshot(
+   *               SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]").toString())
+   *           .build();
    *   Table response = baseBigtableTableAdminClient.createTableFromSnapshotAsync(request).get();
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createTableFromSnapshotAsync( CreateTableFromSnapshotRequest request) { return createTableFromSnapshotOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new table from the specified snapshot. The target table must not exist. The snapshot * and the table must be in the same instance. @@ -409,30 +507,32 @@ public final OperationFuture createTable * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String tableId = "";
-   *   SnapshotName sourceSnapshot = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
-   *   CreateTableFromSnapshotRequest request = CreateTableFromSnapshotRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setTableId(tableId)
-   *     .setSourceSnapshot(sourceSnapshot.toString())
-   *     .build();
-   *   OperationFuture<Table, CreateTableFromSnapshotMetadata> future = baseBigtableTableAdminClient.createTableFromSnapshotOperationCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   CreateTableFromSnapshotRequest request =
+   *       CreateTableFromSnapshotRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setTableId("tableId-1552905847")
+   *           .setSourceSnapshot(
+   *               SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]").toString())
+   *           .build();
+   *   OperationFuture future =
+   *       baseBigtableTableAdminClient
+   *           .createTableFromSnapshotOperationCallable()
+   *           .futureCall(request);
+   *   // Do something.
    *   Table response = future.get();
    * }
-   * 
+ * }
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable< CreateTableFromSnapshotRequest, Table, CreateTableFromSnapshotMetadata> createTableFromSnapshotOperationCallable() { return stub.createTableFromSnapshotOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new table from the specified snapshot. The target table must not exist. The snapshot * and the table must be in the same instance. @@ -444,41 +544,43 @@ public final OperationFuture createTable * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String tableId = "";
-   *   SnapshotName sourceSnapshot = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
-   *   CreateTableFromSnapshotRequest request = CreateTableFromSnapshotRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setTableId(tableId)
-   *     .setSourceSnapshot(sourceSnapshot.toString())
-   *     .build();
-   *   ApiFuture<Operation> future = baseBigtableTableAdminClient.createTableFromSnapshotCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   CreateTableFromSnapshotRequest request =
+   *       CreateTableFromSnapshotRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setTableId("tableId-1552905847")
+   *           .setSourceSnapshot(
+   *               SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableTableAdminClient.createTableFromSnapshotCallable().futureCall(request);
+   *   // Do something.
    *   Operation response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable createTableFromSnapshotCallable() { return stub.createTableFromSnapshotCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all tables served from a specified instance. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
    *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
    *   for (Table element : baseBigtableTableAdminClient.listTables(parent).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param parent Required. The unique name of the instance for which tables should be listed. * Values are of the form `projects/{project}/instances/{instance}`. @@ -490,20 +592,21 @@ public final ListTablesPagedResponse listTables(InstanceName parent) { return listTables(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all tables served from a specified instance. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   for (Table element : baseBigtableTableAdminClient.listTables(parent.toString()).iterateAll()) {
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
+   *   for (Table element : baseBigtableTableAdminClient.listTables(parent).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param parent Required. The unique name of the instance for which tables should be listed. * Values are of the form `projects/{project}/instances/{instance}`. @@ -514,23 +617,26 @@ public final ListTablesPagedResponse listTables(String parent) { return listTables(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all tables served from a specified instance. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   ListTablesRequest request = ListTablesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   ListTablesRequest request =
+   *       ListTablesRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
    *   for (Table element : baseBigtableTableAdminClient.listTables(request).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -539,45 +645,47 @@ public final ListTablesPagedResponse listTables(ListTablesRequest request) { return listTablesPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all tables served from a specified instance. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   ListTablesRequest request = ListTablesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListTablesPagedResponse> future = baseBigtableTableAdminClient.listTablesPagedCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   ListTablesRequest request =
+   *       ListTablesRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture
future = + * baseBigtableTableAdminClient.listTablesPagedCallable().futureCall(request); + * // Do something. * for (Table element : future.get().iterateAll()) { * // doThingsWith(element); * } * } - * + * } */ public final UnaryCallable listTablesPagedCallable() { return stub.listTablesPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all tables served from a specified instance. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   ListTablesRequest request = ListTablesRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
    *   while (true) {
-   *     ListTablesResponse response = baseBigtableTableAdminClient.listTablesCallable().call(request);
-   *     for (Table element : response.getTablesList()) {
+   *     ListTablesResponse response =
+   *         baseBigtableTableAdminClient.listTablesCallable().call(request);
+   *     for (Table element : response.getResponsesList()) {
    *       // doThingsWith(element);
    *     }
    *     String nextPageToken = response.getNextPageToken();
@@ -588,24 +696,25 @@ public final UnaryCallable listTable
    *     }
    *   }
    * }
-   * 
+ * }
*/ public final UnaryCallable listTablesCallable() { return stub.listTablesCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets metadata information about the specified table. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
    *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
    *   Table response = baseBigtableTableAdminClient.getTable(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the requested table. Values are of the form * `projects/{project}/instances/{instance}/tables/{table}`. @@ -617,18 +726,19 @@ public final Table getTable(TableName name) { return getTable(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets metadata information about the specified table. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   Table response = baseBigtableTableAdminClient.getTable(name.toString());
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
+   *   Table response = baseBigtableTableAdminClient.getTable(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the requested table. Values are of the form * `projects/{project}/instances/{instance}/tables/{table}`. @@ -639,21 +749,22 @@ public final Table getTable(String name) { return getTable(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets metadata information about the specified table. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   GetTableRequest request = GetTableRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   GetTableRequest request =
+   *       GetTableRequest.newBuilder()
+   *           .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .build();
    *   Table response = baseBigtableTableAdminClient.getTable(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -662,40 +773,42 @@ public final Table getTable(GetTableRequest request) { return getTableCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets metadata information about the specified table. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   GetTableRequest request = GetTableRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Table> future = baseBigtableTableAdminClient.getTableCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   GetTableRequest request =
+   *       GetTableRequest.newBuilder()
+   *           .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .build();
+   *   ApiFuture
future = baseBigtableTableAdminClient.getTableCallable().futureCall(request); + * // Do something. * Table response = future.get(); * } - * + * } */ public final UnaryCallable getTableCallable() { return stub.getTableCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Permanently deletes a specified table and all of its data. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
    *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
    *   baseBigtableTableAdminClient.deleteTable(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the table to be deleted. Values are of the form * `projects/{project}/instances/{instance}/tables/{table}`. @@ -707,18 +820,19 @@ public final void deleteTable(TableName name) { deleteTable(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Permanently deletes a specified table and all of its data. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   baseBigtableTableAdminClient.deleteTable(name.toString());
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
+   *   baseBigtableTableAdminClient.deleteTable(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the table to be deleted. Values are of the form * `projects/{project}/instances/{instance}/tables/{table}`. @@ -729,21 +843,22 @@ public final void deleteTable(String name) { deleteTable(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Permanently deletes a specified table and all of its data. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   DeleteTableRequest request = DeleteTableRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   DeleteTableRequest request =
+   *       DeleteTableRequest.newBuilder()
+   *           .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .build();
    *   baseBigtableTableAdminClient.deleteTable(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -752,29 +867,31 @@ public final void deleteTable(DeleteTableRequest request) { deleteTableCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Permanently deletes a specified table and all of its data. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   DeleteTableRequest request = DeleteTableRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = baseBigtableTableAdminClient.deleteTableCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   DeleteTableRequest request =
+   *       DeleteTableRequest.newBuilder()
+   *           .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableTableAdminClient.deleteTableCallable().futureCall(request);
+   *   // Do something.
    *   future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable deleteTableCallable() { return stub.deleteTableCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Performs a series of column family modifications on the specified table. Either all or none of * the modifications will occur before this method returns, but data requests received prior to @@ -782,13 +899,14 @@ public final UnaryCallable deleteTableCallable() { * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
    *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   List<ModifyColumnFamiliesRequest.Modification> modifications = new ArrayList<>();
+   *   List modifications = new ArrayList<>();
    *   Table response = baseBigtableTableAdminClient.modifyColumnFamilies(name, modifications);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the table whose families should be modified. Values * are of the form `projects/{project}/instances/{instance}/tables/{table}`. @@ -807,7 +925,7 @@ public final Table modifyColumnFamilies( return modifyColumnFamilies(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Performs a series of column family modifications on the specified table. Either all or none of * the modifications will occur before this method returns, but data requests received prior to @@ -815,13 +933,14 @@ public final Table modifyColumnFamilies( * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   List<ModifyColumnFamiliesRequest.Modification> modifications = new ArrayList<>();
-   *   Table response = baseBigtableTableAdminClient.modifyColumnFamilies(name.toString(), modifications);
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
+   *   List modifications = new ArrayList<>();
+   *   Table response = baseBigtableTableAdminClient.modifyColumnFamilies(name, modifications);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the table whose families should be modified. Values * are of the form `projects/{project}/instances/{instance}/tables/{table}`. @@ -840,7 +959,7 @@ public final Table modifyColumnFamilies( return modifyColumnFamilies(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Performs a series of column family modifications on the specified table. Either all or none of * the modifications will occur before this method returns, but data requests received prior to @@ -848,17 +967,17 @@ public final Table modifyColumnFamilies( * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   List<ModifyColumnFamiliesRequest.Modification> modifications = new ArrayList<>();
-   *   ModifyColumnFamiliesRequest request = ModifyColumnFamiliesRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .addAllModifications(modifications)
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   ModifyColumnFamiliesRequest request =
+   *       ModifyColumnFamiliesRequest.newBuilder()
+   *           .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .addAllModifications(new ArrayList())
+   *           .build();
    *   Table response = baseBigtableTableAdminClient.modifyColumnFamilies(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -867,7 +986,7 @@ public final Table modifyColumnFamilies(ModifyColumnFamiliesRequest request) { return modifyColumnFamiliesCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Performs a series of column family modifications on the specified table. Either all or none of * the modifications will occur before this method returns, but data requests received prior to @@ -875,40 +994,42 @@ public final Table modifyColumnFamilies(ModifyColumnFamiliesRequest request) { * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   List<ModifyColumnFamiliesRequest.Modification> modifications = new ArrayList<>();
-   *   ModifyColumnFamiliesRequest request = ModifyColumnFamiliesRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .addAllModifications(modifications)
-   *     .build();
-   *   ApiFuture<Table> future = baseBigtableTableAdminClient.modifyColumnFamiliesCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   ModifyColumnFamiliesRequest request =
+   *       ModifyColumnFamiliesRequest.newBuilder()
+   *           .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .addAllModifications(new ArrayList())
+   *           .build();
+   *   ApiFuture
future = + * baseBigtableTableAdminClient.modifyColumnFamiliesCallable().futureCall(request); + * // Do something. * Table response = future.get(); * } - * + * } */ public final UnaryCallable modifyColumnFamiliesCallable() { return stub.modifyColumnFamiliesCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Permanently drop/delete a row range from a specified table. The request can specify whether to * delete all rows in a table, or only those that match a particular prefix. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   DropRowRangeRequest request = DropRowRangeRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   DropRowRangeRequest request =
+   *       DropRowRangeRequest.newBuilder()
+   *           .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .build();
    *   baseBigtableTableAdminClient.dropRowRange(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -917,30 +1038,32 @@ public final void dropRowRange(DropRowRangeRequest request) { dropRowRangeCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Permanently drop/delete a row range from a specified table. The request can specify whether to * delete all rows in a table, or only those that match a particular prefix. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   DropRowRangeRequest request = DropRowRangeRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = baseBigtableTableAdminClient.dropRowRangeCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   DropRowRangeRequest request =
+   *       DropRowRangeRequest.newBuilder()
+   *           .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableTableAdminClient.dropRowRangeCallable().futureCall(request);
+   *   // Do something.
    *   future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable dropRowRangeCallable() { return stub.dropRowRangeCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Generates a consistency token for a Table, which can be used in CheckConsistency to check * whether mutations to the table that finished before this call started have been replicated. The @@ -948,12 +1071,14 @@ public final UnaryCallable dropRowRangeCallable() { * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
    *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   GenerateConsistencyTokenResponse response = baseBigtableTableAdminClient.generateConsistencyToken(name);
+   *   GenerateConsistencyTokenResponse response =
+   *       baseBigtableTableAdminClient.generateConsistencyToken(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the Table for which to create a consistency token. * Values are of the form `projects/{project}/instances/{instance}/tables/{table}`. @@ -967,7 +1092,7 @@ public final GenerateConsistencyTokenResponse generateConsistencyToken(TableName return generateConsistencyToken(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Generates a consistency token for a Table, which can be used in CheckConsistency to check * whether mutations to the table that finished before this call started have been replicated. The @@ -975,12 +1100,14 @@ public final GenerateConsistencyTokenResponse generateConsistencyToken(TableName * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   GenerateConsistencyTokenResponse response = baseBigtableTableAdminClient.generateConsistencyToken(name.toString());
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
+   *   GenerateConsistencyTokenResponse response =
+   *       baseBigtableTableAdminClient.generateConsistencyToken(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the Table for which to create a consistency token. * Values are of the form `projects/{project}/instances/{instance}/tables/{table}`. @@ -992,7 +1119,7 @@ public final GenerateConsistencyTokenResponse generateConsistencyToken(String na return generateConsistencyToken(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Generates a consistency token for a Table, which can be used in CheckConsistency to check * whether mutations to the table that finished before this call started have been replicated. The @@ -1000,15 +1127,17 @@ public final GenerateConsistencyTokenResponse generateConsistencyToken(String na * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   GenerateConsistencyTokenRequest request = GenerateConsistencyTokenRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   GenerateConsistencyTokenResponse response = baseBigtableTableAdminClient.generateConsistencyToken(request);
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   GenerateConsistencyTokenRequest request =
+   *       GenerateConsistencyTokenRequest.newBuilder()
+   *           .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .build();
+   *   GenerateConsistencyTokenResponse response =
+   *       baseBigtableTableAdminClient.generateConsistencyToken(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1018,7 +1147,7 @@ public final GenerateConsistencyTokenResponse generateConsistencyToken( return generateConsistencyTokenCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Generates a consistency token for a Table, which can be used in CheckConsistency to check * whether mutations to the table that finished before this call started have been replicated. The @@ -1026,37 +1155,41 @@ public final GenerateConsistencyTokenResponse generateConsistencyToken( * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   GenerateConsistencyTokenRequest request = GenerateConsistencyTokenRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<GenerateConsistencyTokenResponse> future = baseBigtableTableAdminClient.generateConsistencyTokenCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   GenerateConsistencyTokenRequest request =
+   *       GenerateConsistencyTokenRequest.newBuilder()
+   *           .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableTableAdminClient.generateConsistencyTokenCallable().futureCall(request);
+   *   // Do something.
    *   GenerateConsistencyTokenResponse response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable generateConsistencyTokenCallable() { return stub.generateConsistencyTokenCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Checks replication consistency based on a consistency token, that is, if replication has caught * up based on the conditions specified in the token and the check request. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
    *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   String consistencyToken = "";
-   *   CheckConsistencyResponse response = baseBigtableTableAdminClient.checkConsistency(name, consistencyToken);
+   *   String consistencyToken = "consistencyToken-1985152319";
+   *   CheckConsistencyResponse response =
+   *       baseBigtableTableAdminClient.checkConsistency(name, consistencyToken);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the Table for which to check replication consistency. * Values are of the form `projects/{project}/instances/{instance}/tables/{table}`. @@ -1073,20 +1206,22 @@ public final CheckConsistencyResponse checkConsistency(TableName name, String co return checkConsistency(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Checks replication consistency based on a consistency token, that is, if replication has caught * up based on the conditions specified in the token and the check request. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   String consistencyToken = "";
-   *   CheckConsistencyResponse response = baseBigtableTableAdminClient.checkConsistency(name.toString(), consistencyToken);
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
+   *   String consistencyToken = "consistencyToken-1985152319";
+   *   CheckConsistencyResponse response =
+   *       baseBigtableTableAdminClient.checkConsistency(name, consistencyToken);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the Table for which to check replication consistency. * Values are of the form `projects/{project}/instances/{instance}/tables/{table}`. @@ -1103,24 +1238,24 @@ public final CheckConsistencyResponse checkConsistency(String name, String consi return checkConsistency(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Checks replication consistency based on a consistency token, that is, if replication has caught * up based on the conditions specified in the token and the check request. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   String consistencyToken = "";
-   *   CheckConsistencyRequest request = CheckConsistencyRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .setConsistencyToken(consistencyToken)
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   CheckConsistencyRequest request =
+   *       CheckConsistencyRequest.newBuilder()
+   *           .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .setConsistencyToken("consistencyToken-1985152319")
+   *           .build();
    *   CheckConsistencyResponse response = baseBigtableTableAdminClient.checkConsistency(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1129,475 +1264,261 @@ public final CheckConsistencyResponse checkConsistency(CheckConsistencyRequest r return checkConsistencyCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Checks replication consistency based on a consistency token, that is, if replication has caught * up based on the conditions specified in the token and the check request. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   String consistencyToken = "";
-   *   CheckConsistencyRequest request = CheckConsistencyRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .setConsistencyToken(consistencyToken)
-   *     .build();
-   *   ApiFuture<CheckConsistencyResponse> future = baseBigtableTableAdminClient.checkConsistencyCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   CheckConsistencyRequest request =
+   *       CheckConsistencyRequest.newBuilder()
+   *           .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .setConsistencyToken("consistencyToken-1985152319")
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableTableAdminClient.checkConsistencyCallable().futureCall(request);
+   *   // Do something.
    *   CheckConsistencyResponse response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable checkConsistencyCallable() { return stub.checkConsistencyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Gets the access control policy for a Table or Backup resource. Returns an empty policy if the - * resource exists but does not have a policy set. + * Creates a new snapshot in the specified cluster from the specified source table. The cluster + * and the table must be in the same instance. + * + *

Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not + * currently available to most Cloud Bigtable customers. This feature might be changed in + * backward-incompatible ways and is not recommended for production use. It is not subject to any + * SLA or deprecation policy. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   Policy response = baseBigtableTableAdminClient.getIamPolicy(resource);
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
+   *   ClusterName cluster = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
+   *   String snapshotId = "snapshotId-1113817601";
+   *   String description = "description-1724546052";
+   *   Snapshot response =
+   *       baseBigtableTableAdminClient
+   *           .snapshotTableAsync(name, cluster, snapshotId, description)
+   *           .get();
    * }
-   * 
+ * }
* - * @param resource REQUIRED: The resource for which the policy is being requested. See the - * operation documentation for the appropriate value for this field. + * @param name Required. The unique name of the table to have the snapshot taken. Values are of + * the form `projects/{project}/instances/{instance}/tables/{table}`. + * @param cluster Required. The name of the cluster where the snapshot will be created in. Values + * are of the form `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param snapshotId Required. The ID by which the new snapshot should be referred to within the + * parent cluster, e.g., `mysnapshot` of the form: `[_a-zA-Z0-9][-_.a-zA-Z0-9]*` rather + * than `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot`. + * @param description Description of the snapshot. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final Policy getIamPolicy(ResourceName resource) { - GetIamPolicyRequest request = - GetIamPolicyRequest.newBuilder() - .setResource(resource == null ? null : resource.toString()) + public final OperationFuture snapshotTableAsync( + TableName name, ClusterName cluster, String snapshotId, String description) { + SnapshotTableRequest request = + SnapshotTableRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setCluster(cluster == null ? null : cluster.toString()) + .setSnapshotId(snapshotId) + .setDescription(description) .build(); - return getIamPolicy(request); + return snapshotTableAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Gets the access control policy for a Table or Backup resource. Returns an empty policy if the - * resource exists but does not have a policy set. + * Creates a new snapshot in the specified cluster from the specified source table. The cluster + * and the table must be in the same instance. + * + *

Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not + * currently available to most Cloud Bigtable customers. This feature might be changed in + * backward-incompatible ways and is not recommended for production use. It is not subject to any + * SLA or deprecation policy. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   Policy response = baseBigtableTableAdminClient.getIamPolicy(resource.toString());
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
+   *   String cluster = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString();
+   *   String snapshotId = "snapshotId-1113817601";
+   *   String description = "description-1724546052";
+   *   Snapshot response =
+   *       baseBigtableTableAdminClient
+   *           .snapshotTableAsync(name, cluster, snapshotId, description)
+   *           .get();
    * }
-   * 
+ * }
* - * @param resource REQUIRED: The resource for which the policy is being requested. See the - * operation documentation for the appropriate value for this field. + * @param name Required. The unique name of the table to have the snapshot taken. Values are of + * the form `projects/{project}/instances/{instance}/tables/{table}`. + * @param cluster Required. The name of the cluster where the snapshot will be created in. Values + * are of the form `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param snapshotId Required. The ID by which the new snapshot should be referred to within the + * parent cluster, e.g., `mysnapshot` of the form: `[_a-zA-Z0-9][-_.a-zA-Z0-9]*` rather + * than `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot`. + * @param description Description of the snapshot. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final Policy getIamPolicy(String resource) { - GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build(); - return getIamPolicy(request); + public final OperationFuture snapshotTableAsync( + TableName name, String cluster, String snapshotId, String description) { + SnapshotTableRequest request = + SnapshotTableRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setCluster(cluster) + .setSnapshotId(snapshotId) + .setDescription(description) + .build(); + return snapshotTableAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Gets the access control policy for a Table or Backup resource. Returns an empty policy if the - * resource exists but does not have a policy set. + * Creates a new snapshot in the specified cluster from the specified source table. The cluster + * and the table must be in the same instance. + * + *

Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not + * currently available to most Cloud Bigtable customers. This feature might be changed in + * backward-incompatible ways and is not recommended for production use. It is not subject to any + * SLA or deprecation policy. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .build();
-   *   Policy response = baseBigtableTableAdminClient.getIamPolicy(request);
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
+   *   ClusterName cluster = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
+   *   String snapshotId = "snapshotId-1113817601";
+   *   String description = "description-1724546052";
+   *   Snapshot response =
+   *       baseBigtableTableAdminClient
+   *           .snapshotTableAsync(name, cluster, snapshotId, description)
+   *           .get();
    * }
-   * 
+ * }
* - * @param request The request object containing all of the parameters for the API call. + * @param name Required. The unique name of the table to have the snapshot taken. Values are of + * the form `projects/{project}/instances/{instance}/tables/{table}`. + * @param cluster Required. The name of the cluster where the snapshot will be created in. Values + * are of the form `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param snapshotId Required. The ID by which the new snapshot should be referred to within the + * parent cluster, e.g., `mysnapshot` of the form: `[_a-zA-Z0-9][-_.a-zA-Z0-9]*` rather + * than `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot`. + * @param description Description of the snapshot. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final Policy getIamPolicy(GetIamPolicyRequest request) { - return getIamPolicyCallable().call(request); + public final OperationFuture snapshotTableAsync( + String name, ClusterName cluster, String snapshotId, String description) { + SnapshotTableRequest request = + SnapshotTableRequest.newBuilder() + .setName(name) + .setCluster(cluster == null ? null : cluster.toString()) + .setSnapshotId(snapshotId) + .setDescription(description) + .build(); + return snapshotTableAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Gets the access control policy for a Table or Backup resource. Returns an empty policy if the - * resource exists but does not have a policy set. - * - *

Sample code: + * Creates a new snapshot in the specified cluster from the specified source table. The cluster + * and the table must be in the same instance. * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .build();
-   *   ApiFuture<Policy> future = baseBigtableTableAdminClient.getIamPolicyCallable().futureCall(request);
-   *   // Do something
-   *   Policy response = future.get();
-   * }
-   * 
- */ - public final UnaryCallable getIamPolicyCallable() { - return stub.getIamPolicyCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Sets the access control policy on a Table or Backup resource. Replaces any existing policy. + *

Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not + * currently available to most Cloud Bigtable customers. This feature might be changed in + * backward-incompatible ways and is not recommended for production use. It is not subject to any + * SLA or deprecation policy. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   Policy response = baseBigtableTableAdminClient.setIamPolicy(resource, policy);
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
+   *   String cluster = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString();
+   *   String snapshotId = "snapshotId-1113817601";
+   *   String description = "description-1724546052";
+   *   Snapshot response =
+   *       baseBigtableTableAdminClient
+   *           .snapshotTableAsync(name, cluster, snapshotId, description)
+   *           .get();
    * }
-   * 
+ * }
* - * @param resource REQUIRED: The resource for which the policy is being specified. See the - * operation documentation for the appropriate value for this field. - * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the - * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud - * Platform services (such as Projects) might reject them. + * @param name Required. The unique name of the table to have the snapshot taken. Values are of + * the form `projects/{project}/instances/{instance}/tables/{table}`. + * @param cluster Required. The name of the cluster where the snapshot will be created in. Values + * are of the form `projects/{project}/instances/{instance}/clusters/{cluster}`. + * @param snapshotId Required. The ID by which the new snapshot should be referred to within the + * parent cluster, e.g., `mysnapshot` of the form: `[_a-zA-Z0-9][-_.a-zA-Z0-9]*` rather + * than `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot`. + * @param description Description of the snapshot. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final Policy setIamPolicy(ResourceName resource, Policy policy) { - SetIamPolicyRequest request = - SetIamPolicyRequest.newBuilder() - .setResource(resource == null ? null : resource.toString()) - .setPolicy(policy) + public final OperationFuture snapshotTableAsync( + String name, String cluster, String snapshotId, String description) { + SnapshotTableRequest request = + SnapshotTableRequest.newBuilder() + .setName(name) + .setCluster(cluster) + .setSnapshotId(snapshotId) + .setDescription(description) .build(); - return setIamPolicy(request); + return snapshotTableAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Sets the access control policy on a Table or Backup resource. Replaces any existing policy. + * Creates a new snapshot in the specified cluster from the specified source table. The cluster + * and the table must be in the same instance. + * + *

Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not + * currently available to most Cloud Bigtable customers. This feature might be changed in + * backward-incompatible ways and is not recommended for production use. It is not subject to any + * SLA or deprecation policy. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   Policy response = baseBigtableTableAdminClient.setIamPolicy(resource.toString(), policy);
-   * }
-   * 
- * - * @param resource REQUIRED: The resource for which the policy is being specified. See the - * operation documentation for the appropriate value for this field. - * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the - * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud - * Platform services (such as Projects) might reject them. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Policy setIamPolicy(String resource, Policy policy) { - SetIamPolicyRequest request = - SetIamPolicyRequest.newBuilder().setResource(resource).setPolicy(policy).build(); - return setIamPolicy(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Sets the access control policy on a Table or Backup resource. Replaces any existing policy. - * - *

Sample code: - * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .setPolicy(policy)
-   *     .build();
-   *   Policy response = baseBigtableTableAdminClient.setIamPolicy(request);
-   * }
-   * 
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Policy setIamPolicy(SetIamPolicyRequest request) { - return setIamPolicyCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Sets the access control policy on a Table or Backup resource. Replaces any existing policy. - * - *

Sample code: - * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   Policy policy = Policy.newBuilder().build();
-   *   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .setPolicy(policy)
-   *     .build();
-   *   ApiFuture<Policy> future = baseBigtableTableAdminClient.setIamPolicyCallable().futureCall(request);
-   *   // Do something
-   *   Policy response = future.get();
-   * }
-   * 
- */ - public final UnaryCallable setIamPolicyCallable() { - return stub.setIamPolicyCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Returns permissions that the caller has on the specified Table or Backup resource. - * - *

Sample code: - * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsResponse response = baseBigtableTableAdminClient.testIamPermissions(resource, permissions);
-   * }
-   * 
- * - * @param resource REQUIRED: The resource for which the policy detail is being requested. See the - * operation documentation for the appropriate value for this field. - * @param permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final TestIamPermissionsResponse testIamPermissions( - ResourceName resource, List permissions) { - TestIamPermissionsRequest request = - TestIamPermissionsRequest.newBuilder() - .setResource(resource == null ? null : resource.toString()) - .addAllPermissions(permissions) - .build(); - return testIamPermissions(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Returns permissions that the caller has on the specified Table or Backup resource. - * - *

Sample code: - * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsResponse response = baseBigtableTableAdminClient.testIamPermissions(resource.toString(), permissions);
-   * }
-   * 
- * - * @param resource REQUIRED: The resource for which the policy detail is being requested. See the - * operation documentation for the appropriate value for this field. - * @param permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final TestIamPermissionsResponse testIamPermissions( - String resource, List permissions) { - TestIamPermissionsRequest request = - TestIamPermissionsRequest.newBuilder() - .setResource(resource) - .addAllPermissions(permissions) - .build(); - return testIamPermissions(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Returns permissions that the caller has on the specified Table or Backup resource. - * - *

Sample code: - * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .addAllPermissions(permissions)
-   *     .build();
-   *   TestIamPermissionsResponse response = baseBigtableTableAdminClient.testIamPermissions(request);
-   * }
-   * 
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) { - return testIamPermissionsCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Returns permissions that the caller has on the specified Table or Backup resource. - * - *

Sample code: - * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
-   *   List<String> permissions = new ArrayList<>();
-   *   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
-   *     .setResource(resource.toString())
-   *     .addAllPermissions(permissions)
-   *     .build();
-   *   ApiFuture<TestIamPermissionsResponse> future = baseBigtableTableAdminClient.testIamPermissionsCallable().futureCall(request);
-   *   // Do something
-   *   TestIamPermissionsResponse response = future.get();
-   * }
-   * 
- */ - public final UnaryCallable - testIamPermissionsCallable() { - return stub.testIamPermissionsCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Creates a new snapshot in the specified cluster from the specified source table. The cluster - * and the table must be in the same instance. - * - *

Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not - * currently available to most Cloud Bigtable customers. This feature might be changed in - * backward-incompatible ways and is not recommended for production use. It is not subject to any - * SLA or deprecation policy. - * - *

Sample code: - * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   ClusterName cluster = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   String snapshotId = "";
-   *   String description = "";
-   *   Snapshot response = baseBigtableTableAdminClient.snapshotTableAsync(name, cluster, snapshotId, description).get();
-   * }
-   * 
- * - * @param name Required. The unique name of the table to have the snapshot taken. Values are of - * the form `projects/{project}/instances/{instance}/tables/{table}`. - * @param cluster Required. The name of the cluster where the snapshot will be created in. Values - * are of the form `projects/{project}/instances/{instance}/clusters/{cluster}`. - * @param snapshotId Required. The ID by which the new snapshot should be referred to within the - * parent cluster, e.g., `mysnapshot` of the form: `[_a-zA-Z0-9][-_.a-zA-Z0-9]*` rather - * than `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot`. - * @param description Description of the snapshot. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") - public final OperationFuture snapshotTableAsync( - TableName name, ClusterName cluster, String snapshotId, String description) { - SnapshotTableRequest request = - SnapshotTableRequest.newBuilder() - .setName(name == null ? null : name.toString()) - .setCluster(cluster == null ? null : cluster.toString()) - .setSnapshotId(snapshotId) - .setDescription(description) - .build(); - return snapshotTableAsync(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Creates a new snapshot in the specified cluster from the specified source table. The cluster - * and the table must be in the same instance. - * - *

Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not - * currently available to most Cloud Bigtable customers. This feature might be changed in - * backward-incompatible ways and is not recommended for production use. It is not subject to any - * SLA or deprecation policy. - * - *

Sample code: - * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   ClusterName cluster = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   String snapshotId = "";
-   *   String description = "";
-   *   Snapshot response = baseBigtableTableAdminClient.snapshotTableAsync(name.toString(), cluster.toString(), snapshotId, description).get();
-   * }
-   * 
- * - * @param name Required. The unique name of the table to have the snapshot taken. Values are of - * the form `projects/{project}/instances/{instance}/tables/{table}`. - * @param cluster Required. The name of the cluster where the snapshot will be created in. Values - * are of the form `projects/{project}/instances/{instance}/clusters/{cluster}`. - * @param snapshotId Required. The ID by which the new snapshot should be referred to within the - * parent cluster, e.g., `mysnapshot` of the form: `[_a-zA-Z0-9][-_.a-zA-Z0-9]*` rather - * than `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot`. - * @param description Description of the snapshot. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") - public final OperationFuture snapshotTableAsync( - String name, String cluster, String snapshotId, String description) { - SnapshotTableRequest request = - SnapshotTableRequest.newBuilder() - .setName(name) - .setCluster(cluster) - .setSnapshotId(snapshotId) - .setDescription(description) - .build(); - return snapshotTableAsync(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Creates a new snapshot in the specified cluster from the specified source table. The cluster - * and the table must be in the same instance. - * - *

Note: This is a private alpha release of Cloud Bigtable snapshots. This feature is not - * currently available to most Cloud Bigtable customers. This feature might be changed in - * backward-incompatible ways and is not recommended for production use. It is not subject to any - * SLA or deprecation policy. - * - *

Sample code: - * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   ClusterName cluster = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   String snapshotId = "";
-   *   SnapshotTableRequest request = SnapshotTableRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .setCluster(cluster.toString())
-   *     .setSnapshotId(snapshotId)
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   SnapshotTableRequest request =
+   *       SnapshotTableRequest.newBuilder()
+   *           .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .setCluster(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString())
+   *           .setSnapshotId("snapshotId-1113817601")
+   *           .setTtl(Duration.newBuilder().build())
+   *           .setDescription("description-1724546052")
+   *           .build();
    *   Snapshot response = baseBigtableTableAdminClient.snapshotTableAsync(request).get();
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture snapshotTableAsync( SnapshotTableRequest request) { return snapshotTableOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new snapshot in the specified cluster from the specified source table. The cluster * and the table must be in the same instance. @@ -1609,29 +1530,30 @@ public final OperationFuture snapshotTableAsync * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   ClusterName cluster = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   String snapshotId = "";
-   *   SnapshotTableRequest request = SnapshotTableRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .setCluster(cluster.toString())
-   *     .setSnapshotId(snapshotId)
-   *     .build();
-   *   OperationFuture<Snapshot, SnapshotTableMetadata> future = baseBigtableTableAdminClient.snapshotTableOperationCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   SnapshotTableRequest request =
+   *       SnapshotTableRequest.newBuilder()
+   *           .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .setCluster(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString())
+   *           .setSnapshotId("snapshotId-1113817601")
+   *           .setTtl(Duration.newBuilder().build())
+   *           .setDescription("description-1724546052")
+   *           .build();
+   *   OperationFuture future =
+   *       baseBigtableTableAdminClient.snapshotTableOperationCallable().futureCall(request);
+   *   // Do something.
    *   Snapshot response = future.get();
    * }
-   * 
+ * }
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable snapshotTableOperationCallable() { return stub.snapshotTableOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new snapshot in the specified cluster from the specified source table. The cluster * and the table must be in the same instance. @@ -1643,27 +1565,29 @@ public final OperationFuture snapshotTableAsync * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
-   *   ClusterName cluster = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   String snapshotId = "";
-   *   SnapshotTableRequest request = SnapshotTableRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .setCluster(cluster.toString())
-   *     .setSnapshotId(snapshotId)
-   *     .build();
-   *   ApiFuture<Operation> future = baseBigtableTableAdminClient.snapshotTableCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   SnapshotTableRequest request =
+   *       SnapshotTableRequest.newBuilder()
+   *           .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .setCluster(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString())
+   *           .setSnapshotId("snapshotId-1113817601")
+   *           .setTtl(Duration.newBuilder().build())
+   *           .setDescription("description-1724546052")
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableTableAdminClient.snapshotTableCallable().futureCall(request);
+   *   // Do something.
    *   Operation response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable snapshotTableCallable() { return stub.snapshotTableCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets metadata information about the specified snapshot. * @@ -1674,12 +1598,13 @@ public final UnaryCallable snapshotTableCallabl * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
    *   SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
    *   Snapshot response = baseBigtableTableAdminClient.getSnapshot(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the requested snapshot. Values are of the form * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. @@ -1691,7 +1616,7 @@ public final Snapshot getSnapshot(SnapshotName name) { return getSnapshot(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets metadata information about the specified snapshot. * @@ -1702,12 +1627,14 @@ public final Snapshot getSnapshot(SnapshotName name) { * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
-   *   Snapshot response = baseBigtableTableAdminClient.getSnapshot(name.toString());
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String name =
+   *       SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]").toString();
+   *   Snapshot response = baseBigtableTableAdminClient.getSnapshot(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the requested snapshot. Values are of the form * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. @@ -1718,7 +1645,7 @@ public final Snapshot getSnapshot(String name) { return getSnapshot(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets metadata information about the specified snapshot. * @@ -1729,15 +1656,17 @@ public final Snapshot getSnapshot(String name) { * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
-   *   GetSnapshotRequest request = GetSnapshotRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   GetSnapshotRequest request =
+   *       GetSnapshotRequest.newBuilder()
+   *           .setName(
+   *               SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]").toString())
+   *           .build();
    *   Snapshot response = baseBigtableTableAdminClient.getSnapshot(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1746,7 +1675,7 @@ public final Snapshot getSnapshot(GetSnapshotRequest request) { return getSnapshotCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets metadata information about the specified snapshot. * @@ -1757,23 +1686,26 @@ public final Snapshot getSnapshot(GetSnapshotRequest request) { * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
-   *   GetSnapshotRequest request = GetSnapshotRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Snapshot> future = baseBigtableTableAdminClient.getSnapshotCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   GetSnapshotRequest request =
+   *       GetSnapshotRequest.newBuilder()
+   *           .setName(
+   *               SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableTableAdminClient.getSnapshotCallable().futureCall(request);
+   *   // Do something.
    *   Snapshot response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable getSnapshotCallable() { return stub.getSnapshotCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all snapshots associated with the specified cluster. * @@ -1784,14 +1716,15 @@ public final UnaryCallable getSnapshotCallable() { * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
    *   ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
    *   for (Snapshot element : baseBigtableTableAdminClient.listSnapshots(parent).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param parent Required. The unique name of the cluster for which snapshots should be listed. * Values are of the form `projects/{project}/instances/{instance}/clusters/{cluster}`. Use @@ -1807,7 +1740,7 @@ public final ListSnapshotsPagedResponse listSnapshots(ClusterName parent) { return listSnapshots(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all snapshots associated with the specified cluster. * @@ -1818,14 +1751,15 @@ public final ListSnapshotsPagedResponse listSnapshots(ClusterName parent) { * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   for (Snapshot element : baseBigtableTableAdminClient.listSnapshots(parent.toString()).iterateAll()) {
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString();
+   *   for (Snapshot element : baseBigtableTableAdminClient.listSnapshots(parent).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param parent Required. The unique name of the cluster for which snapshots should be listed. * Values are of the form `projects/{project}/instances/{instance}/clusters/{cluster}`. Use @@ -1838,7 +1772,7 @@ public final ListSnapshotsPagedResponse listSnapshots(String parent) { return listSnapshots(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all snapshots associated with the specified cluster. * @@ -1849,17 +1783,20 @@ public final ListSnapshotsPagedResponse listSnapshots(String parent) { * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   ListSnapshotsRequest request = ListSnapshotsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   ListSnapshotsRequest request =
+   *       ListSnapshotsRequest.newBuilder()
+   *           .setParent(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
    *   for (Snapshot element : baseBigtableTableAdminClient.listSnapshots(request).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1868,7 +1805,7 @@ public final ListSnapshotsPagedResponse listSnapshots(ListSnapshotsRequest reque return listSnapshotsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all snapshots associated with the specified cluster. * @@ -1879,26 +1816,30 @@ public final ListSnapshotsPagedResponse listSnapshots(ListSnapshotsRequest reque * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   ListSnapshotsRequest request = ListSnapshotsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListSnapshotsPagedResponse> future = baseBigtableTableAdminClient.listSnapshotsPagedCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   ListSnapshotsRequest request =
+   *       ListSnapshotsRequest.newBuilder()
+   *           .setParent(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableTableAdminClient.listSnapshotsPagedCallable().futureCall(request);
+   *   // Do something.
    *   for (Snapshot element : future.get().iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
*/ public final UnaryCallable listSnapshotsPagedCallable() { return stub.listSnapshotsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all snapshots associated with the specified cluster. * @@ -1909,15 +1850,13 @@ public final ListSnapshotsPagedResponse listSnapshots(ListSnapshotsRequest reque * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   ListSnapshotsRequest request = ListSnapshotsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
    *   while (true) {
-   *     ListSnapshotsResponse response = baseBigtableTableAdminClient.listSnapshotsCallable().call(request);
-   *     for (Snapshot element : response.getSnapshotsList()) {
+   *     ListSnapshotsResponse response =
+   *         baseBigtableTableAdminClient.listSnapshotsCallable().call(request);
+   *     for (Snapshot element : response.getResponsesList()) {
    *       // doThingsWith(element);
    *     }
    *     String nextPageToken = response.getNextPageToken();
@@ -1928,13 +1867,13 @@ public final ListSnapshotsPagedResponse listSnapshots(ListSnapshotsRequest reque
    *     }
    *   }
    * }
-   * 
+ * }
*/ public final UnaryCallable listSnapshotsCallable() { return stub.listSnapshotsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Permanently deletes the specified snapshot. * @@ -1945,12 +1884,13 @@ public final UnaryCallable listSnap * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
    *   SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
    *   baseBigtableTableAdminClient.deleteSnapshot(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the snapshot to be deleted. Values are of the form * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. @@ -1962,7 +1902,7 @@ public final void deleteSnapshot(SnapshotName name) { deleteSnapshot(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Permanently deletes the specified snapshot. * @@ -1973,12 +1913,14 @@ public final void deleteSnapshot(SnapshotName name) { * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
-   *   baseBigtableTableAdminClient.deleteSnapshot(name.toString());
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String name =
+   *       SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]").toString();
+   *   baseBigtableTableAdminClient.deleteSnapshot(name);
    * }
-   * 
+ * }
* * @param name Required. The unique name of the snapshot to be deleted. Values are of the form * `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`. @@ -1989,7 +1931,7 @@ public final void deleteSnapshot(String name) { deleteSnapshot(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Permanently deletes the specified snapshot. * @@ -2000,15 +1942,17 @@ public final void deleteSnapshot(String name) { * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
-   *   DeleteSnapshotRequest request = DeleteSnapshotRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   DeleteSnapshotRequest request =
+   *       DeleteSnapshotRequest.newBuilder()
+   *           .setName(
+   *               SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]").toString())
+   *           .build();
    *   baseBigtableTableAdminClient.deleteSnapshot(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -2017,7 +1961,7 @@ public final void deleteSnapshot(DeleteSnapshotRequest request) { deleteSnapshotCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Permanently deletes the specified snapshot. * @@ -2028,23 +1972,26 @@ public final void deleteSnapshot(DeleteSnapshotRequest request) { * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]");
-   *   DeleteSnapshotRequest request = DeleteSnapshotRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = baseBigtableTableAdminClient.deleteSnapshotCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   DeleteSnapshotRequest request =
+   *       DeleteSnapshotRequest.newBuilder()
+   *           .setName(
+   *               SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableTableAdminClient.deleteSnapshotCallable().futureCall(request);
+   *   // Do something.
    *   future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable deleteSnapshotCallable() { return stub.deleteSnapshotCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Starts creating a new Cloud Bigtable Backup. The returned backup [long-running * operation][google.longrunning.Operation] can be used to track creation of the backup. The @@ -2056,14 +2003,16 @@ public final UnaryCallable deleteSnapshotCallable( * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
    *   ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   String backupId = "";
+   *   String backupId = "backupId2121930365";
    *   Backup backup = Backup.newBuilder().build();
-   *   Backup response = baseBigtableTableAdminClient.createBackupAsync(parent, backupId, backup).get();
+   *   Backup response =
+   *       baseBigtableTableAdminClient.createBackupAsync(parent, backupId, backup).get();
    * }
-   * 
+ * }
* * @param parent Required. This must be one of the clusters in the instance in which this table is * located. The backup will be stored in this cluster. Values are of the form @@ -2077,8 +2026,6 @@ public final UnaryCallable deleteSnapshotCallable( * @param backup Required. The backup to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createBackupAsync( ClusterName parent, String backupId, Backup backup) { CreateBackupRequest request = @@ -2090,7 +2037,7 @@ public final OperationFuture createBackupAsync( return createBackupAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Starts creating a new Cloud Bigtable Backup. The returned backup [long-running * operation][google.longrunning.Operation] can be used to track creation of the backup. The @@ -2102,14 +2049,16 @@ public final OperationFuture createBackupAsync( * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   String backupId = "";
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString();
+   *   String backupId = "backupId2121930365";
    *   Backup backup = Backup.newBuilder().build();
-   *   Backup response = baseBigtableTableAdminClient.createBackupAsync(parent.toString(), backupId, backup).get();
+   *   Backup response =
+   *       baseBigtableTableAdminClient.createBackupAsync(parent, backupId, backup).get();
    * }
-   * 
+ * }
* * @param parent Required. This must be one of the clusters in the instance in which this table is * located. The backup will be stored in this cluster. Values are of the form @@ -2123,8 +2072,6 @@ public final OperationFuture createBackupAsync( * @param backup Required. The backup to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createBackupAsync( String parent, String backupId, Backup backup) { CreateBackupRequest request = @@ -2136,7 +2083,7 @@ public final OperationFuture createBackupAsync( return createBackupAsync(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Starts creating a new Cloud Bigtable Backup. The returned backup [long-running * operation][google.longrunning.Operation] can be used to track creation of the backup. The @@ -2148,31 +2095,28 @@ public final OperationFuture createBackupAsync( * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   String backupId = "";
-   *   Backup backup = Backup.newBuilder().build();
-   *   CreateBackupRequest request = CreateBackupRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setBackupId(backupId)
-   *     .setBackup(backup)
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   CreateBackupRequest request =
+   *       CreateBackupRequest.newBuilder()
+   *           .setParent(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString())
+   *           .setBackupId("backupId2121930365")
+   *           .setBackup(Backup.newBuilder().build())
+   *           .build();
    *   Backup response = baseBigtableTableAdminClient.createBackupAsync(request).get();
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture createBackupAsync( CreateBackupRequest request) { return createBackupOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Starts creating a new Cloud Bigtable Backup. The returned backup [long-running * operation][google.longrunning.Operation] can be used to track creation of the backup. The @@ -2184,29 +2128,28 @@ public final OperationFuture createBackupAsync( * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   String backupId = "";
-   *   Backup backup = Backup.newBuilder().build();
-   *   CreateBackupRequest request = CreateBackupRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setBackupId(backupId)
-   *     .setBackup(backup)
-   *     .build();
-   *   OperationFuture<Backup, CreateBackupMetadata> future = baseBigtableTableAdminClient.createBackupOperationCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   CreateBackupRequest request =
+   *       CreateBackupRequest.newBuilder()
+   *           .setParent(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString())
+   *           .setBackupId("backupId2121930365")
+   *           .setBackup(Backup.newBuilder().build())
+   *           .build();
+   *   OperationFuture future =
+   *       baseBigtableTableAdminClient.createBackupOperationCallable().futureCall(request);
+   *   // Do something.
    *   Backup response = future.get();
    * }
-   * 
+ * }
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable createBackupOperationCallable() { return stub.createBackupOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Starts creating a new Cloud Bigtable Backup. The returned backup [long-running * operation][google.longrunning.Operation] can be used to track creation of the backup. The @@ -2218,38 +2161,39 @@ public final OperationFuture createBackupAsync( * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   String backupId = "";
-   *   Backup backup = Backup.newBuilder().build();
-   *   CreateBackupRequest request = CreateBackupRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setBackupId(backupId)
-   *     .setBackup(backup)
-   *     .build();
-   *   ApiFuture<Operation> future = baseBigtableTableAdminClient.createBackupCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   CreateBackupRequest request =
+   *       CreateBackupRequest.newBuilder()
+   *           .setParent(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString())
+   *           .setBackupId("backupId2121930365")
+   *           .setBackup(Backup.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableTableAdminClient.createBackupCallable().futureCall(request);
+   *   // Do something.
    *   Operation response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable createBackupCallable() { return stub.createBackupCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets metadata on a pending or completed Cloud Bigtable Backup. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
    *   BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]");
    *   Backup response = baseBigtableTableAdminClient.getBackup(name);
    * }
-   * 
+ * }
* * @param name Required. Name of the backup. Values are of the form * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. @@ -2261,18 +2205,19 @@ public final Backup getBackup(BackupName name) { return getBackup(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets metadata on a pending or completed Cloud Bigtable Backup. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]");
-   *   Backup response = baseBigtableTableAdminClient.getBackup(name.toString());
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]").toString();
+   *   Backup response = baseBigtableTableAdminClient.getBackup(name);
    * }
-   * 
+ * }
* * @param name Required. Name of the backup. Values are of the form * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. @@ -2283,21 +2228,22 @@ public final Backup getBackup(String name) { return getBackup(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets metadata on a pending or completed Cloud Bigtable Backup. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]");
-   *   GetBackupRequest request = GetBackupRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   GetBackupRequest request =
+   *       GetBackupRequest.newBuilder()
+   *           .setName(BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]").toString())
+   *           .build();
    *   Backup response = baseBigtableTableAdminClient.getBackup(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -2306,71 +2252,250 @@ public final Backup getBackup(GetBackupRequest request) { return getBackupCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets metadata on a pending or completed Cloud Bigtable Backup. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]");
-   *   GetBackupRequest request = GetBackupRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Backup> future = baseBigtableTableAdminClient.getBackupCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   GetBackupRequest request =
+   *       GetBackupRequest.newBuilder()
+   *           .setName(BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableTableAdminClient.getBackupCallable().futureCall(request);
+   *   // Do something.
    *   Backup response = future.get();
    * }
-   * 
+ * }
*/ public final UnaryCallable getBackupCallable() { return stub.getBackupCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Lists Cloud Bigtable backups. Returns both completed and pending backups. + * Updates a pending or completed Cloud Bigtable Backup. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   for (Backup element : baseBigtableTableAdminClient.listBackups(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   Backup backup = Backup.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   Backup response = baseBigtableTableAdminClient.updateBackup(backup, updateMask);
    * }
-   * 
+ * }
* - * @param parent Required. The cluster to list backups from. Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}`. Use `{cluster} = '-'` to list - * backups for all clusters in an instance, e.g., - * `projects/{project}/instances/{instance}/clusters/-`. + * @param backup Required. The backup to update. `backup.name`, and the fields to be updated as + * specified by `update_mask` are required. Other fields are ignored. Update is only supported + * for the following fields: * `backup.expire_time`. + * @param updateMask Required. A mask specifying which fields (e.g. `expire_time`) in the Backup + * resource should be updated. This mask is relative to the Backup resource, not to the + * request message. The field mask must always be specified; this prevents any future fields + * from being erased accidentally by clients that do not know about them. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final ListBackupsPagedResponse listBackups(ClusterName parent) { - ListBackupsRequest request = + public final Backup updateBackup(Backup backup, FieldMask updateMask) { + UpdateBackupRequest request = + UpdateBackupRequest.newBuilder().setBackup(backup).setUpdateMask(updateMask).build(); + return updateBackup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates a pending or completed Cloud Bigtable Backup. + * + *

Sample code: + * + *

{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   UpdateBackupRequest request =
+   *       UpdateBackupRequest.newBuilder()
+   *           .setBackup(Backup.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   Backup response = baseBigtableTableAdminClient.updateBackup(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Backup updateBackup(UpdateBackupRequest request) { + return updateBackupCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates a pending or completed Cloud Bigtable Backup. + * + *

Sample code: + * + *

{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   UpdateBackupRequest request =
+   *       UpdateBackupRequest.newBuilder()
+   *           .setBackup(Backup.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableTableAdminClient.updateBackupCallable().futureCall(request);
+   *   // Do something.
+   *   Backup response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable updateBackupCallable() { + return stub.updateBackupCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a pending or completed Cloud Bigtable backup. + * + *

Sample code: + * + *

{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]");
+   *   baseBigtableTableAdminClient.deleteBackup(name);
+   * }
+   * }
+ * + * @param name Required. Name of the backup to delete. Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteBackup(BackupName name) { + DeleteBackupRequest request = + DeleteBackupRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + deleteBackup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a pending or completed Cloud Bigtable backup. + * + *

Sample code: + * + *

{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]").toString();
+   *   baseBigtableTableAdminClient.deleteBackup(name);
+   * }
+   * }
+ * + * @param name Required. Name of the backup to delete. Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteBackup(String name) { + DeleteBackupRequest request = DeleteBackupRequest.newBuilder().setName(name).build(); + deleteBackup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a pending or completed Cloud Bigtable backup. + * + *

Sample code: + * + *

{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   DeleteBackupRequest request =
+   *       DeleteBackupRequest.newBuilder()
+   *           .setName(BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]").toString())
+   *           .build();
+   *   baseBigtableTableAdminClient.deleteBackup(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteBackup(DeleteBackupRequest request) { + deleteBackupCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a pending or completed Cloud Bigtable backup. + * + *

Sample code: + * + *

{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   DeleteBackupRequest request =
+   *       DeleteBackupRequest.newBuilder()
+   *           .setName(BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableTableAdminClient.deleteBackupCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
+ */ + public final UnaryCallable deleteBackupCallable() { + return stub.deleteBackupCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Cloud Bigtable backups. Returns both completed and pending backups. + * + *

Sample code: + * + *

{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
+   *   for (Backup element : baseBigtableTableAdminClient.listBackups(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The cluster to list backups from. Values are of the form + * `projects/{project}/instances/{instance}/clusters/{cluster}`. Use `{cluster} = '-'` to list + * backups for all clusters in an instance, e.g., + * `projects/{project}/instances/{instance}/clusters/-`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListBackupsPagedResponse listBackups(ClusterName parent) { + ListBackupsRequest request = ListBackupsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return listBackups(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists Cloud Bigtable backups. Returns both completed and pending backups. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   for (Backup element : baseBigtableTableAdminClient.listBackups(parent.toString()).iterateAll()) {
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString();
+   *   for (Backup element : baseBigtableTableAdminClient.listBackups(parent).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param parent Required. The cluster to list backups from. Values are of the form * `projects/{project}/instances/{instance}/clusters/{cluster}`. Use `{cluster} = '-'` to list @@ -2383,23 +2508,28 @@ public final ListBackupsPagedResponse listBackups(String parent) { return listBackups(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists Cloud Bigtable backups. Returns both completed and pending backups. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   ListBackupsRequest request = ListBackupsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   ListBackupsRequest request =
+   *       ListBackupsRequest.newBuilder()
+   *           .setParent(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString())
+   *           .setFilter("filter-1274492040")
+   *           .setOrderBy("orderBy-1207110587")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
    *   for (Backup element : baseBigtableTableAdminClient.listBackups(request).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -2408,46 +2538,50 @@ public final ListBackupsPagedResponse listBackups(ListBackupsRequest request) { return listBackupsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists Cloud Bigtable backups. Returns both completed and pending backups. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   ListBackupsRequest request = ListBackupsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
-   *   ApiFuture<ListBackupsPagedResponse> future = baseBigtableTableAdminClient.listBackupsPagedCallable().futureCall(request);
-   *   // Do something
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   ListBackupsRequest request =
+   *       ListBackupsRequest.newBuilder()
+   *           .setParent(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString())
+   *           .setFilter("filter-1274492040")
+   *           .setOrderBy("orderBy-1207110587")
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableTableAdminClient.listBackupsPagedCallable().futureCall(request);
+   *   // Do something.
    *   for (Backup element : future.get().iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
-   * 
+ * }
*/ public final UnaryCallable listBackupsPagedCallable() { return stub.listBackupsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists Cloud Bigtable backups. Returns both completed and pending backups. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
-   *   ListBackupsRequest request = ListBackupsRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .build();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
    *   while (true) {
-   *     ListBackupsResponse response = baseBigtableTableAdminClient.listBackupsCallable().call(request);
-   *     for (Backup element : response.getBackupsList()) {
+   *     ListBackupsResponse response =
+   *         baseBigtableTableAdminClient.listBackupsCallable().call(request);
+   *     for (Backup element : response.getResponsesList()) {
    *       // doThingsWith(element);
    *     }
    *     String nextPageToken = response.getNextPageToken();
@@ -2458,274 +2592,435 @@ public final ListBackupsPagedResponse listBackups(ListBackupsRequest request) {
    *     }
    *   }
    * }
-   * 
+ * }
*/ public final UnaryCallable listBackupsCallable() { return stub.listBackupsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Updates a pending or completed Cloud Bigtable Backup. + * Create a new table by restoring from a completed backup. The new table must be in the same + * instance as the instance containing the backup. The returned table [long-running + * operation][google.longrunning.Operation] can be used to track the progress of the operation, + * and to cancel it. The [metadata][google.longrunning.Operation.metadata] field type is + * [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The + * [response][google.longrunning.Operation.response] type is + * [Table][google.bigtable.admin.v2.Table], if successful. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   Backup backup = Backup.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Backup response = baseBigtableTableAdminClient.updateBackup(backup, updateMask);
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   RestoreTableRequest request =
+   *       RestoreTableRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setTableId("tableId-1552905847")
+   *           .build();
+   *   Table response = baseBigtableTableAdminClient.restoreTableAsync(request).get();
    * }
-   * 
+ * }
* - * @param backup Required. The backup to update. `backup.name`, and the fields to be updated as - * specified by `update_mask` are required. Other fields are ignored. Update is only supported - * for the following fields: * `backup.expire_time`. - * @param updateMask Required. A mask specifying which fields (e.g. `expire_time`) in the Backup - * resource should be updated. This mask is relative to the Backup resource, not to the - * request message. The field mask must always be specified; this prevents any future fields - * from being erased accidentally by clients that do not know about them. + * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final Backup updateBackup(Backup backup, FieldMask updateMask) { - UpdateBackupRequest request = - UpdateBackupRequest.newBuilder().setBackup(backup).setUpdateMask(updateMask).build(); - return updateBackup(request); + public final OperationFuture restoreTableAsync( + RestoreTableRequest request) { + return restoreTableOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Updates a pending or completed Cloud Bigtable Backup. + * Create a new table by restoring from a completed backup. The new table must be in the same + * instance as the instance containing the backup. The returned table [long-running + * operation][google.longrunning.Operation] can be used to track the progress of the operation, + * and to cancel it. The [metadata][google.longrunning.Operation.metadata] field type is + * [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The + * [response][google.longrunning.Operation.response] type is + * [Table][google.bigtable.admin.v2.Table], if successful. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   Backup backup = Backup.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateBackupRequest request = UpdateBackupRequest.newBuilder()
-   *     .setBackup(backup)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   Backup response = baseBigtableTableAdminClient.updateBackup(request);
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   RestoreTableRequest request =
+   *       RestoreTableRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setTableId("tableId-1552905847")
+   *           .build();
+   *   OperationFuture future =
+   *       baseBigtableTableAdminClient.restoreTableOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Table response = future.get();
    * }
-   * 
+ * }
+ */ + public final OperationCallable + restoreTableOperationCallable() { + return stub.restoreTableOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Create a new table by restoring from a completed backup. The new table must be in the same + * instance as the instance containing the backup. The returned table [long-running + * operation][google.longrunning.Operation] can be used to track the progress of the operation, + * and to cancel it. The [metadata][google.longrunning.Operation.metadata] field type is + * [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The + * [response][google.longrunning.Operation.response] type is + * [Table][google.bigtable.admin.v2.Table], if successful. + * + *

Sample code: + * + *

{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   RestoreTableRequest request =
+   *       RestoreTableRequest.newBuilder()
+   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+   *           .setTableId("tableId-1552905847")
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableTableAdminClient.restoreTableCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable restoreTableCallable() { + return stub.restoreTableCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the access control policy for a Table or Backup resource. Returns an empty policy if the + * resource exists but does not have a policy set. + * + *

Sample code: + * + *

{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   ResourceName resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
+   *   Policy response = baseBigtableTableAdminClient.getIamPolicy(resource);
+   * }
+   * }
+ * + * @param resource REQUIRED: The resource for which the policy is being requested. See the + * operation documentation for the appropriate value for this field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy getIamPolicy(ResourceName resource) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .build(); + return getIamPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the access control policy for a Table or Backup resource. Returns an empty policy if the + * resource exists but does not have a policy set. + * + *

Sample code: + * + *

{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
+   *   Policy response = baseBigtableTableAdminClient.getIamPolicy(resource);
+   * }
+   * }
+ * + * @param resource REQUIRED: The resource for which the policy is being requested. See the + * operation documentation for the appropriate value for this field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy getIamPolicy(String resource) { + GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build(); + return getIamPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the access control policy for a Table or Backup resource. Returns an empty policy if the + * resource exists but does not have a policy set. + * + *

Sample code: + * + *

{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .build();
+   *   Policy response = baseBigtableTableAdminClient.getIamPolicy(request);
+   * }
+   * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final Backup updateBackup(UpdateBackupRequest request) { - return updateBackupCallable().call(request); + public final Policy getIamPolicy(GetIamPolicyRequest request) { + return getIamPolicyCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Updates a pending or completed Cloud Bigtable Backup. + * Gets the access control policy for a Table or Backup resource. Returns an empty policy if the + * resource exists but does not have a policy set. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   Backup backup = Backup.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   UpdateBackupRequest request = UpdateBackupRequest.newBuilder()
-   *     .setBackup(backup)
-   *     .setUpdateMask(updateMask)
-   *     .build();
-   *   ApiFuture<Backup> future = baseBigtableTableAdminClient.updateBackupCallable().futureCall(request);
-   *   // Do something
-   *   Backup response = future.get();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableTableAdminClient.getIamPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Policy response = future.get();
    * }
-   * 
+ * }
*/ - public final UnaryCallable updateBackupCallable() { - return stub.updateBackupCallable(); + public final UnaryCallable getIamPolicyCallable() { + return stub.getIamPolicyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Deletes a pending or completed Cloud Bigtable backup. + * Sets the access control policy on a Table or Backup resource. Replaces any existing policy. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]");
-   *   baseBigtableTableAdminClient.deleteBackup(name);
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   ResourceName resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
+   *   Policy policy = Policy.newBuilder().build();
+   *   Policy response = baseBigtableTableAdminClient.setIamPolicy(resource, policy);
    * }
-   * 
+ * }
* - * @param name Required. Name of the backup to delete. Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. + * @param resource REQUIRED: The resource for which the policy is being specified. See the + * operation documentation for the appropriate value for this field. + * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the + * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud + * Platform services (such as Projects) might reject them. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final void deleteBackup(BackupName name) { - DeleteBackupRequest request = - DeleteBackupRequest.newBuilder().setName(name == null ? null : name.toString()).build(); - deleteBackup(request); + public final Policy setIamPolicy(ResourceName resource, Policy policy) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .setPolicy(policy) + .build(); + return setIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Deletes a pending or completed Cloud Bigtable backup. + * Sets the access control policy on a Table or Backup resource. Replaces any existing policy. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]");
-   *   baseBigtableTableAdminClient.deleteBackup(name.toString());
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
+   *   Policy policy = Policy.newBuilder().build();
+   *   Policy response = baseBigtableTableAdminClient.setIamPolicy(resource, policy);
    * }
-   * 
+ * }
* - * @param name Required. Name of the backup to delete. Values are of the form - * `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`. + * @param resource REQUIRED: The resource for which the policy is being specified. See the + * operation documentation for the appropriate value for this field. + * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the + * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud + * Platform services (such as Projects) might reject them. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final void deleteBackup(String name) { - DeleteBackupRequest request = DeleteBackupRequest.newBuilder().setName(name).build(); - deleteBackup(request); + public final Policy setIamPolicy(String resource, Policy policy) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder().setResource(resource).setPolicy(policy).build(); + return setIamPolicy(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Deletes a pending or completed Cloud Bigtable backup. + * Sets the access control policy on a Table or Backup resource. Replaces any existing policy. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]");
-   *   DeleteBackupRequest request = DeleteBackupRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   baseBigtableTableAdminClient.deleteBackup(request);
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .build();
+   *   Policy response = baseBigtableTableAdminClient.setIamPolicy(request);
    * }
-   * 
+ * }
* * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final void deleteBackup(DeleteBackupRequest request) { - deleteBackupCallable().call(request); + public final Policy setIamPolicy(SetIamPolicyRequest request) { + return setIamPolicyCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Deletes a pending or completed Cloud Bigtable backup. + * Sets the access control policy on a Table or Backup resource. Replaces any existing policy. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]");
-   *   DeleteBackupRequest request = DeleteBackupRequest.newBuilder()
-   *     .setName(name.toString())
-   *     .build();
-   *   ApiFuture<Void> future = baseBigtableTableAdminClient.deleteBackupCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableTableAdminClient.setIamPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Policy response = future.get();
    * }
-   * 
+ * }
*/ - public final UnaryCallable deleteBackupCallable() { - return stub.deleteBackupCallable(); + public final UnaryCallable setIamPolicyCallable() { + return stub.setIamPolicyCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Create a new table by restoring from a completed backup. The new table must be in the same - * instance as the instance containing the backup. The returned table [long-running - * operation][google.longrunning.Operation] can be used to track the progress of the operation, - * and to cancel it. The [metadata][google.longrunning.Operation.metadata] field type is - * [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The - * [response][google.longrunning.Operation.response] type is - * [Table][google.bigtable.admin.v2.Table], if successful. + * Returns permissions that the caller has on the specified Table or Backup resource. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String tableId = "";
-   *   RestoreTableRequest request = RestoreTableRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setTableId(tableId)
-   *     .build();
-   *   Table response = baseBigtableTableAdminClient.restoreTableAsync(request).get();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   ResourceName resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
+   *   List permissions = new ArrayList<>();
+   *   TestIamPermissionsResponse response =
+   *       baseBigtableTableAdminClient.testIamPermissions(resource, permissions);
    * }
-   * 
+ * }
* - * @param request The request object containing all of the parameters for the API call. + * @param resource REQUIRED: The resource for which the policy detail is being requested. See the + * operation documentation for the appropriate value for this field. + * @param permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") - public final OperationFuture restoreTableAsync( - RestoreTableRequest request) { - return restoreTableOperationCallable().futureCall(request); + public final TestIamPermissionsResponse testIamPermissions( + ResourceName resource, List permissions) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .addAllPermissions(permissions) + .build(); + return testIamPermissions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Create a new table by restoring from a completed backup. The new table must be in the same - * instance as the instance containing the backup. The returned table [long-running - * operation][google.longrunning.Operation] can be used to track the progress of the operation, - * and to cancel it. The [metadata][google.longrunning.Operation.metadata] field type is - * [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The - * [response][google.longrunning.Operation.response] type is - * [Table][google.bigtable.admin.v2.Table], if successful. + * Returns permissions that the caller has on the specified Table or Backup resource. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String tableId = "";
-   *   RestoreTableRequest request = RestoreTableRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setTableId(tableId)
-   *     .build();
-   *   OperationFuture<Table, RestoreTableMetadata> future = baseBigtableTableAdminClient.restoreTableOperationCallable().futureCall(request);
-   *   // Do something
-   *   Table response = future.get();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   String resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
+   *   List permissions = new ArrayList<>();
+   *   TestIamPermissionsResponse response =
+   *       baseBigtableTableAdminClient.testIamPermissions(resource, permissions);
    * }
-   * 
+ * }
+ * + * @param resource REQUIRED: The resource for which the policy detail is being requested. See the + * operation documentation for the appropriate value for this field. + * @param permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public final OperationCallable - restoreTableOperationCallable() { - return stub.restoreTableOperationCallable(); + public final TestIamPermissionsResponse testIamPermissions( + String resource, List permissions) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(resource) + .addAllPermissions(permissions) + .build(); + return testIamPermissions(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** - * Create a new table by restoring from a completed backup. The new table must be in the same - * instance as the instance containing the backup. The returned table [long-running - * operation][google.longrunning.Operation] can be used to track the progress of the operation, - * and to cancel it. The [metadata][google.longrunning.Operation.metadata] field type is - * [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The - * [response][google.longrunning.Operation.response] type is - * [Table][google.bigtable.admin.v2.Table], if successful. + * Returns permissions that the caller has on the specified Table or Backup resource. * *

Sample code: * - *


-   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
-   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
-   *   String tableId = "";
-   *   RestoreTableRequest request = RestoreTableRequest.newBuilder()
-   *     .setParent(parent.toString())
-   *     .setTableId(tableId)
-   *     .build();
-   *   ApiFuture<Operation> future = baseBigtableTableAdminClient.restoreTableCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
+   * 
{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .build();
+   *   TestIamPermissionsResponse response =
+   *       baseBigtableTableAdminClient.testIamPermissions(request);
    * }
-   * 
+ * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ - public final UnaryCallable restoreTableCallable() { - return stub.restoreTableCallable(); + public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) { + return testIamPermissionsCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns permissions that the caller has on the specified Table or Backup resource. + * + *

Sample code: + * + *

{@code
+   * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+   *     BaseBigtableTableAdminClient.create()) {
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .build();
+   *   ApiFuture future =
+   *       baseBigtableTableAdminClient.testIamPermissionsCallable().futureCall(request);
+   *   // Do something.
+   *   TestIamPermissionsResponse response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + testIamPermissionsCallable() { + return stub.testIamPermissionsCallable(); } @Override diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminSettings.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminSettings.java index 69e05571f..9aa3add05 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminSettings.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminSettings.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.admin.v2; import static com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient.ListBackupsPagedResponse; @@ -75,11 +76,12 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** For internal use only. */ @Generated("by gapic-generator") @InternalApi public class BaseBigtableTableAdminSettings extends ClientSettings { + /** Returns the object with the settings used for calls to createTable. */ public UnaryCallSettings createTableSettings() { return ((BigtableTableAdminStubSettings) getStubSettings()).createTableSettings(); @@ -92,8 +94,6 @@ public UnaryCallSettings createTableSettings() { } /** Returns the object with the settings used for calls to createTableFromSnapshot. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings< CreateTableFromSnapshotRequest, Table, CreateTableFromSnapshotMetadata> createTableFromSnapshotOperationSettings() { @@ -139,30 +139,12 @@ public UnaryCallSettings dropRowRangeSettings() { return ((BigtableTableAdminStubSettings) getStubSettings()).checkConsistencySettings(); } - /** Returns the object with the settings used for calls to getIamPolicy. */ - public UnaryCallSettings getIamPolicySettings() { - return ((BigtableTableAdminStubSettings) getStubSettings()).getIamPolicySettings(); - } - - /** Returns the object with the settings used for calls to setIamPolicy. */ - public UnaryCallSettings setIamPolicySettings() { - return ((BigtableTableAdminStubSettings) getStubSettings()).setIamPolicySettings(); - } - - /** Returns the object with the settings used for calls to testIamPermissions. */ - public UnaryCallSettings - testIamPermissionsSettings() { - return ((BigtableTableAdminStubSettings) getStubSettings()).testIamPermissionsSettings(); - } - /** Returns the object with the settings used for calls to snapshotTable. */ public UnaryCallSettings snapshotTableSettings() { return ((BigtableTableAdminStubSettings) getStubSettings()).snapshotTableSettings(); } /** Returns the object with the settings used for calls to snapshotTable. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings snapshotTableOperationSettings() { return ((BigtableTableAdminStubSettings) getStubSettings()).snapshotTableOperationSettings(); @@ -190,8 +172,6 @@ public UnaryCallSettings createBackupSettings() } /** Returns the object with the settings used for calls to createBackup. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings createBackupOperationSettings() { return ((BigtableTableAdminStubSettings) getStubSettings()).createBackupOperationSettings(); @@ -202,12 +182,6 @@ public UnaryCallSettings getBackupSettings() { return ((BigtableTableAdminStubSettings) getStubSettings()).getBackupSettings(); } - /** Returns the object with the settings used for calls to listBackups. */ - public PagedCallSettings - listBackupsSettings() { - return ((BigtableTableAdminStubSettings) getStubSettings()).listBackupsSettings(); - } - /** Returns the object with the settings used for calls to updateBackup. */ public UnaryCallSettings updateBackupSettings() { return ((BigtableTableAdminStubSettings) getStubSettings()).updateBackupSettings(); @@ -218,19 +192,39 @@ public UnaryCallSettings deleteBackupSettings() { return ((BigtableTableAdminStubSettings) getStubSettings()).deleteBackupSettings(); } + /** Returns the object with the settings used for calls to listBackups. */ + public PagedCallSettings + listBackupsSettings() { + return ((BigtableTableAdminStubSettings) getStubSettings()).listBackupsSettings(); + } + /** Returns the object with the settings used for calls to restoreTable. */ public UnaryCallSettings restoreTableSettings() { return ((BigtableTableAdminStubSettings) getStubSettings()).restoreTableSettings(); } /** Returns the object with the settings used for calls to restoreTable. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings restoreTableOperationSettings() { return ((BigtableTableAdminStubSettings) getStubSettings()).restoreTableOperationSettings(); } + /** Returns the object with the settings used for calls to getIamPolicy. */ + public UnaryCallSettings getIamPolicySettings() { + return ((BigtableTableAdminStubSettings) getStubSettings()).getIamPolicySettings(); + } + + /** Returns the object with the settings used for calls to setIamPolicy. */ + public UnaryCallSettings setIamPolicySettings() { + return ((BigtableTableAdminStubSettings) getStubSettings()).setIamPolicySettings(); + } + + /** Returns the object with the settings used for calls to testIamPermissions. */ + public UnaryCallSettings + testIamPermissionsSettings() { + return ((BigtableTableAdminStubSettings) getStubSettings()).testIamPermissionsSettings(); + } + public static final BaseBigtableTableAdminSettings create(BigtableTableAdminStubSettings stub) throws IOException { return new BaseBigtableTableAdminSettings.Builder(stub.toBuilder()).build(); @@ -292,18 +286,15 @@ protected BaseBigtableTableAdminSettings(Builder settingsBuilder) throws IOExcep /** Builder for BaseBigtableTableAdminSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(BigtableTableAdminStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(BigtableTableAdminStubSettings.newBuilder()); - } - protected Builder(BaseBigtableTableAdminSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -312,11 +303,15 @@ protected Builder(BigtableTableAdminStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(BigtableTableAdminStubSettings.newBuilder()); + } + public BigtableTableAdminStubSettings.Builder getStubSettingsBuilder() { return ((BigtableTableAdminStubSettings.Builder) getStubSettings()); } - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * @@ -341,8 +336,6 @@ public UnaryCallSettings.Builder createTableSettings( } /** Returns the builder for the settings used for calls to createTableFromSnapshot. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder< CreateTableFromSnapshotRequest, Table, CreateTableFromSnapshotMetadata> createTableFromSnapshotOperationSettings() { @@ -389,30 +382,12 @@ public UnaryCallSettings.Builder dropRowRangeSetting return getStubSettingsBuilder().checkConsistencySettings(); } - /** Returns the builder for the settings used for calls to getIamPolicy. */ - public UnaryCallSettings.Builder getIamPolicySettings() { - return getStubSettingsBuilder().getIamPolicySettings(); - } - - /** Returns the builder for the settings used for calls to setIamPolicy. */ - public UnaryCallSettings.Builder setIamPolicySettings() { - return getStubSettingsBuilder().setIamPolicySettings(); - } - - /** Returns the builder for the settings used for calls to testIamPermissions. */ - public UnaryCallSettings.Builder - testIamPermissionsSettings() { - return getStubSettingsBuilder().testIamPermissionsSettings(); - } - /** Returns the builder for the settings used for calls to snapshotTable. */ public UnaryCallSettings.Builder snapshotTableSettings() { return getStubSettingsBuilder().snapshotTableSettings(); } /** Returns the builder for the settings used for calls to snapshotTable. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder snapshotTableOperationSettings() { return getStubSettingsBuilder().snapshotTableOperationSettings(); @@ -441,8 +416,6 @@ public UnaryCallSettings.Builder createBackupSet } /** Returns the builder for the settings used for calls to createBackup. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder createBackupOperationSettings() { return getStubSettingsBuilder().createBackupOperationSettings(); @@ -453,13 +426,6 @@ public UnaryCallSettings.Builder getBackupSettings() { return getStubSettingsBuilder().getBackupSettings(); } - /** Returns the builder for the settings used for calls to listBackups. */ - public PagedCallSettings.Builder< - ListBackupsRequest, ListBackupsResponse, ListBackupsPagedResponse> - listBackupsSettings() { - return getStubSettingsBuilder().listBackupsSettings(); - } - /** Returns the builder for the settings used for calls to updateBackup. */ public UnaryCallSettings.Builder updateBackupSettings() { return getStubSettingsBuilder().updateBackupSettings(); @@ -470,19 +436,40 @@ public UnaryCallSettings.Builder deleteBackupSetting return getStubSettingsBuilder().deleteBackupSettings(); } + /** Returns the builder for the settings used for calls to listBackups. */ + public PagedCallSettings.Builder< + ListBackupsRequest, ListBackupsResponse, ListBackupsPagedResponse> + listBackupsSettings() { + return getStubSettingsBuilder().listBackupsSettings(); + } + /** Returns the builder for the settings used for calls to restoreTable. */ public UnaryCallSettings.Builder restoreTableSettings() { return getStubSettingsBuilder().restoreTableSettings(); } /** Returns the builder for the settings used for calls to restoreTable. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder restoreTableOperationSettings() { return getStubSettingsBuilder().restoreTableOperationSettings(); } + /** Returns the builder for the settings used for calls to getIamPolicy. */ + public UnaryCallSettings.Builder getIamPolicySettings() { + return getStubSettingsBuilder().getIamPolicySettings(); + } + + /** Returns the builder for the settings used for calls to setIamPolicy. */ + public UnaryCallSettings.Builder setIamPolicySettings() { + return getStubSettingsBuilder().setIamPolicySettings(); + } + + /** Returns the builder for the settings used for calls to testIamPermissions. */ + public UnaryCallSettings.Builder + testIamPermissionsSettings() { + return getStubSettingsBuilder().testIamPermissionsSettings(); + } + @Override public BaseBigtableTableAdminSettings build() throws IOException { return new BaseBigtableTableAdminSettings(this); diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStub.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStub.java index 0b33e1550..2ab20acd6 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStub.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStub.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.admin.v2.stub; import static com.google.cloud.bigtable.admin.v2.BaseBigtableInstanceAdminClient.ListAppProfilesPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.OperationCallable; @@ -57,18 +57,16 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** For internal use only. */ @Generated("by gapic-generator") @InternalApi public abstract class BigtableInstanceAdminStub implements BackgroundResource { - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationsStub getOperationsStub() { throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable createInstanceOperationCallable() { throw new UnsupportedOperationException("Not implemented: createInstanceOperationCallable()"); @@ -86,7 +84,10 @@ public UnaryCallable listInstancesC throw new UnsupportedOperationException("Not implemented: listInstancesCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public UnaryCallable updateInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: updateInstanceCallable()"); + } + public OperationCallable partialUpdateInstanceOperationCallable() { throw new UnsupportedOperationException( @@ -101,7 +102,6 @@ public UnaryCallable deleteInstanceCallable() { throw new UnsupportedOperationException("Not implemented: deleteInstanceCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable createClusterOperationCallable() { throw new UnsupportedOperationException("Not implemented: createClusterOperationCallable()"); @@ -119,7 +119,6 @@ public UnaryCallable listClustersCall throw new UnsupportedOperationException("Not implemented: listClustersCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable updateClusterOperationCallable() { throw new UnsupportedOperationException("Not implemented: updateClusterOperationCallable()"); @@ -150,7 +149,6 @@ public UnaryCallable listAppPro throw new UnsupportedOperationException("Not implemented: listAppProfilesCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable updateAppProfileOperationCallable() { throw new UnsupportedOperationException("Not implemented: updateAppProfileOperationCallable()"); diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStubSettings.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStubSettings.java index ee6a361cb..d178602d6 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStubSettings.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStubSettings.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.admin.v2.stub; import static com.google.cloud.bigtable.admin.v2.BaseBigtableInstanceAdminClient.ListAppProfilesPagedResponse; @@ -84,7 +85,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link BigtableInstanceAdminStub}. * @@ -101,22 +102,23 @@ * *

For example, to set the total timeout of getInstance to 30 seconds: * - *

- * 
+ * 
{@code
  * BigtableInstanceAdminStubSettings.Builder baseBigtableInstanceAdminSettingsBuilder =
  *     BigtableInstanceAdminStubSettings.newBuilder();
  * baseBigtableInstanceAdminSettingsBuilder
  *     .getInstanceSettings()
  *     .setRetrySettings(
- *         baseBigtableInstanceAdminSettingsBuilder.getInstanceSettings().getRetrySettings().toBuilder()
+ *         baseBigtableInstanceAdminSettingsBuilder
+ *             .getInstanceSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * BigtableInstanceAdminStubSettings baseBigtableInstanceAdminSettings = baseBigtableInstanceAdminSettingsBuilder.build();
- * 
- * 
+ * BigtableInstanceAdminStubSettings baseBigtableInstanceAdminSettings = + * baseBigtableInstanceAdminSettingsBuilder.build(); + * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class BigtableInstanceAdminStubSettings extends StubSettings { /** The default scopes of the service. */ @@ -125,10 +127,8 @@ public class BigtableInstanceAdminStubSettings .add("https://www.googleapis.com/auth/bigtable.admin") .add("https://www.googleapis.com/auth/bigtable.admin.cluster") .add("https://www.googleapis.com/auth/bigtable.admin.instance") - .add("https://www.googleapis.com/auth/bigtable.admin.table") .add("https://www.googleapis.com/auth/cloud-bigtable.admin") .add("https://www.googleapis.com/auth/cloud-bigtable.admin.cluster") - .add("https://www.googleapis.com/auth/cloud-bigtable.admin.table") .add("https://www.googleapis.com/auth/cloud-platform") .add("https://www.googleapis.com/auth/cloud-platform.read-only") .build(); @@ -139,6 +139,7 @@ public class BigtableInstanceAdminStubSettings private final UnaryCallSettings getInstanceSettings; private final UnaryCallSettings listInstancesSettings; + private final UnaryCallSettings updateInstanceSettings; private final UnaryCallSettings partialUpdateInstanceSettings; private final OperationCallSettings< @@ -168,13 +169,68 @@ public class BigtableInstanceAdminStubSettings private final UnaryCallSettings testIamPermissionsSettings; + private static final PagedListDescriptor< + ListAppProfilesRequest, ListAppProfilesResponse, AppProfile> + LIST_APP_PROFILES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListAppProfilesRequest injectToken( + ListAppProfilesRequest payload, String token) { + return ListAppProfilesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListAppProfilesRequest injectPageSize( + ListAppProfilesRequest payload, int pageSize) { + return ListAppProfilesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListAppProfilesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListAppProfilesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListAppProfilesResponse payload) { + return payload.getAppProfilesList() == null + ? ImmutableList.of() + : payload.getAppProfilesList(); + } + }; + + private static final PagedListResponseFactory< + ListAppProfilesRequest, ListAppProfilesResponse, ListAppProfilesPagedResponse> + LIST_APP_PROFILES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListAppProfilesRequest, ListAppProfilesResponse, ListAppProfilesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListAppProfilesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_APP_PROFILES_PAGE_STR_DESC, request, context); + return ListAppProfilesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to createInstance. */ public UnaryCallSettings createInstanceSettings() { return createInstanceSettings; } /** Returns the object with the settings used for calls to createInstance. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings createInstanceOperationSettings() { return createInstanceOperationSettings; @@ -190,6 +246,11 @@ public UnaryCallSettings listInstan return listInstancesSettings; } + /** Returns the object with the settings used for calls to updateInstance. */ + public UnaryCallSettings updateInstanceSettings() { + return updateInstanceSettings; + } + /** Returns the object with the settings used for calls to partialUpdateInstance. */ public UnaryCallSettings partialUpdateInstanceSettings() { @@ -197,7 +258,6 @@ public UnaryCallSettings listInstan } /** Returns the object with the settings used for calls to partialUpdateInstance. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings partialUpdateInstanceOperationSettings() { return partialUpdateInstanceOperationSettings; @@ -214,7 +274,6 @@ public UnaryCallSettings createClusterSettings( } /** Returns the object with the settings used for calls to createCluster. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings createClusterOperationSettings() { return createClusterOperationSettings; @@ -236,7 +295,6 @@ public UnaryCallSettings updateClusterSettings() { } /** Returns the object with the settings used for calls to updateCluster. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings updateClusterOperationSettings() { return updateClusterOperationSettings; @@ -270,7 +328,6 @@ public UnaryCallSettings updateAppProfileSet } /** Returns the object with the settings used for calls to updateAppProfile. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings updateAppProfileOperationSettings() { return updateAppProfileOperationSettings; @@ -303,10 +360,10 @@ public BigtableInstanceAdminStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcBigtableInstanceAdminStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -370,6 +427,7 @@ protected BigtableInstanceAdminStubSettings(Builder settingsBuilder) throws IOEx createInstanceOperationSettings = settingsBuilder.createInstanceOperationSettings().build(); getInstanceSettings = settingsBuilder.getInstanceSettings().build(); listInstancesSettings = settingsBuilder.listInstancesSettings().build(); + updateInstanceSettings = settingsBuilder.updateInstanceSettings().build(); partialUpdateInstanceSettings = settingsBuilder.partialUpdateInstanceSettings().build(); partialUpdateInstanceOperationSettings = settingsBuilder.partialUpdateInstanceOperationSettings().build(); @@ -392,67 +450,10 @@ protected BigtableInstanceAdminStubSettings(Builder settingsBuilder) throws IOEx testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build(); } - private static final PagedListDescriptor< - ListAppProfilesRequest, ListAppProfilesResponse, AppProfile> - LIST_APP_PROFILES_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListAppProfilesRequest injectToken( - ListAppProfilesRequest payload, String token) { - return ListAppProfilesRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListAppProfilesRequest injectPageSize( - ListAppProfilesRequest payload, int pageSize) { - return ListAppProfilesRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListAppProfilesRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListAppProfilesResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListAppProfilesResponse payload) { - return payload.getAppProfilesList() != null - ? payload.getAppProfilesList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListAppProfilesRequest, ListAppProfilesResponse, ListAppProfilesPagedResponse> - LIST_APP_PROFILES_PAGE_STR_FACT = - new PagedListResponseFactory< - ListAppProfilesRequest, ListAppProfilesResponse, ListAppProfilesPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListAppProfilesRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_APP_PROFILES_PAGE_STR_DESC, request, context); - return ListAppProfilesPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for BigtableInstanceAdminStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder createInstanceSettings; private final OperationCallSettings.Builder< @@ -461,6 +462,7 @@ public static class Builder private final UnaryCallSettings.Builder getInstanceSettings; private final UnaryCallSettings.Builder listInstancesSettings; + private final UnaryCallSettings.Builder updateInstanceSettings; private final UnaryCallSettings.Builder partialUpdateInstanceSettings; private final OperationCallSettings.Builder< @@ -495,7 +497,6 @@ public static class Builder private final UnaryCallSettings.Builder setIamPolicySettings; private final UnaryCallSettings.Builder testIamPermissionsSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -503,11 +504,14 @@ public static class Builder ImmutableMap.Builder> definitions = ImmutableMap.builder(); definitions.put( - "idempotent", + "no_retry_5_codes", ImmutableSet.copyOf(Lists.newArrayList())); + definitions.put( + "retry_policy_6_codes", ImmutableSet.copyOf( Lists.newArrayList( - StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); - definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED))); + definitions.put( + "no_retry_7_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -516,6 +520,14 @@ public static class Builder static { ImmutableMap.Builder definitions = ImmutableMap.builder(); RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRpcTimeout(Duration.ofMillis(300000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(300000L)) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build(); + definitions.put("no_retry_5_params", settings); settings = RetrySettings.newBuilder() .setInitialRetryDelay(Duration.ofMillis(1000L)) @@ -524,81 +536,50 @@ public static class Builder .setInitialRpcTimeout(Duration.ofMillis(60000L)) .setRpcTimeoutMultiplier(1.0) .setMaxRpcTimeout(Duration.ofMillis(60000L)) - .setTotalTimeout(Duration.ofMillis(600000L)) + .setTotalTimeout(Duration.ofMillis(60000L)) .build(); - definitions.put("idempotent_params", settings); + definitions.put("retry_policy_6_params", settings); settings = RetrySettings.newBuilder() - .setRetryDelayMultiplier(1.0) .setInitialRpcTimeout(Duration.ofMillis(60000L)) .setRpcTimeoutMultiplier(1.0) .setMaxRpcTimeout(Duration.ofMillis(60000L)) .setTotalTimeout(Duration.ofMillis(60000L)) .build(); - definitions.put("non_idempotent_params", settings); - settings = - RetrySettings.newBuilder() - .setRetryDelayMultiplier(1.0) - .setInitialRpcTimeout(Duration.ofMillis(300000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(300000L)) - .setTotalTimeout(Duration.ofMillis(300000L)) - .build(); - definitions.put("non_idempotent_heavy_params", settings); + definitions.put("no_retry_7_params", settings); RETRY_PARAM_DEFINITIONS = definitions.build(); } protected Builder() { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(clientContext); createInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - createInstanceOperationSettings = OperationCallSettings.newBuilder(); - getInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - listInstancesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - + updateInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); partialUpdateInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - partialUpdateInstanceOperationSettings = OperationCallSettings.newBuilder(); - deleteInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - createClusterSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - createClusterOperationSettings = OperationCallSettings.newBuilder(); - getClusterSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - listClustersSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - updateClusterSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - updateClusterOperationSettings = OperationCallSettings.newBuilder(); - deleteClusterSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - createAppProfileSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - getAppProfileSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - listAppProfilesSettings = PagedCallSettings.newBuilder(LIST_APP_PROFILES_PAGE_STR_FACT); - updateAppProfileSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - updateAppProfileOperationSettings = OperationCallSettings.newBuilder(); - deleteAppProfileSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - getIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - testIamPermissionsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = @@ -606,6 +587,7 @@ protected Builder(ClientContext clientContext) { createInstanceSettings, getInstanceSettings, listInstancesSettings, + updateInstanceSettings, partialUpdateInstanceSettings, deleteInstanceSettings, createClusterSettings, @@ -621,117 +603,175 @@ protected Builder(ClientContext clientContext) { getIamPolicySettings, setIamPolicySettings, testIamPermissionsSettings); - initDefaults(this); } + protected Builder(BigtableInstanceAdminStubSettings settings) { + super(settings); + + createInstanceSettings = settings.createInstanceSettings.toBuilder(); + createInstanceOperationSettings = settings.createInstanceOperationSettings.toBuilder(); + getInstanceSettings = settings.getInstanceSettings.toBuilder(); + listInstancesSettings = settings.listInstancesSettings.toBuilder(); + updateInstanceSettings = settings.updateInstanceSettings.toBuilder(); + partialUpdateInstanceSettings = settings.partialUpdateInstanceSettings.toBuilder(); + partialUpdateInstanceOperationSettings = + settings.partialUpdateInstanceOperationSettings.toBuilder(); + deleteInstanceSettings = settings.deleteInstanceSettings.toBuilder(); + createClusterSettings = settings.createClusterSettings.toBuilder(); + createClusterOperationSettings = settings.createClusterOperationSettings.toBuilder(); + getClusterSettings = settings.getClusterSettings.toBuilder(); + listClustersSettings = settings.listClustersSettings.toBuilder(); + updateClusterSettings = settings.updateClusterSettings.toBuilder(); + updateClusterOperationSettings = settings.updateClusterOperationSettings.toBuilder(); + deleteClusterSettings = settings.deleteClusterSettings.toBuilder(); + createAppProfileSettings = settings.createAppProfileSettings.toBuilder(); + getAppProfileSettings = settings.getAppProfileSettings.toBuilder(); + listAppProfilesSettings = settings.listAppProfilesSettings.toBuilder(); + updateAppProfileSettings = settings.updateAppProfileSettings.toBuilder(); + updateAppProfileOperationSettings = settings.updateAppProfileOperationSettings.toBuilder(); + deleteAppProfileSettings = settings.deleteAppProfileSettings.toBuilder(); + getIamPolicySettings = settings.getIamPolicySettings.toBuilder(); + setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); + testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createInstanceSettings, + getInstanceSettings, + listInstancesSettings, + updateInstanceSettings, + partialUpdateInstanceSettings, + deleteInstanceSettings, + createClusterSettings, + getClusterSettings, + listClustersSettings, + updateClusterSettings, + deleteClusterSettings, + createAppProfileSettings, + getAppProfileSettings, + listAppProfilesSettings, + updateAppProfileSettings, + deleteAppProfileSettings, + getIamPolicySettings, + setIamPolicySettings, + testIamPermissionsSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .createInstanceSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_heavy_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_5_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_5_params")); builder .getInstanceSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_6_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_6_params")); builder .listInstancesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_6_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_6_params")); + + builder + .updateInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_6_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_6_params")); builder .partialUpdateInstanceSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_6_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_6_params")); builder .deleteInstanceSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_7_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_7_params")); builder .createClusterSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_7_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_7_params")); builder .getClusterSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_6_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_6_params")); builder .listClustersSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_6_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_6_params")); builder .updateClusterSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_6_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_6_params")); builder .deleteClusterSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_7_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_7_params")); builder .createAppProfileSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_7_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_7_params")); builder .getAppProfileSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_6_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_6_params")); builder .listAppProfilesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_6_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_6_params")); builder .updateAppProfileSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_6_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_6_params")); builder .deleteAppProfileSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_7_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_7_params")); builder .getIamPolicySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_6_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_6_params")); builder .setIamPolicySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_7_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_7_params")); builder .testIamPermissionsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_6_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_6_params")); + builder .createInstanceOperationSettings() .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_heavy_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_5_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_5_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Instance.class)) @@ -743,18 +783,19 @@ private static Builder initDefaults(Builder builder) { .setInitialRetryDelay(Duration.ofMillis(500L)) .setRetryDelayMultiplier(1.5) .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(600000L)) .build())); + builder .partialUpdateInstanceOperationSettings() .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_6_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_6_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Instance.class)) @@ -766,18 +807,19 @@ private static Builder initDefaults(Builder builder) { .setInitialRetryDelay(Duration.ofMillis(500L)) .setRetryDelayMultiplier(1.5) .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(600000L)) .build())); + builder .createClusterOperationSettings() .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_7_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_7_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Cluster.class)) @@ -789,17 +831,18 @@ private static Builder initDefaults(Builder builder) { .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) .setMaxRetryDelay(Duration.ofMillis(60000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(21600000L)) .build())); + builder .updateClusterOperationSettings() .setInitialCallSettings( UnaryCallSettings.newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_6_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_6_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Cluster.class)) @@ -811,18 +854,19 @@ private static Builder initDefaults(Builder builder) { .setInitialRetryDelay(Duration.ofMillis(500L)) .setRetryDelayMultiplier(1.5) .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(600000L)) .build())); + builder .updateAppProfileOperationSettings() .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_6_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_6_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(AppProfile.class)) @@ -834,66 +878,16 @@ private static Builder initDefaults(Builder builder) { .setInitialRetryDelay(Duration.ofMillis(500L)) .setRetryDelayMultiplier(1.5) .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(600000L)) .build())); return builder; } - protected Builder(BigtableInstanceAdminStubSettings settings) { - super(settings); - - createInstanceSettings = settings.createInstanceSettings.toBuilder(); - createInstanceOperationSettings = settings.createInstanceOperationSettings.toBuilder(); - getInstanceSettings = settings.getInstanceSettings.toBuilder(); - listInstancesSettings = settings.listInstancesSettings.toBuilder(); - partialUpdateInstanceSettings = settings.partialUpdateInstanceSettings.toBuilder(); - partialUpdateInstanceOperationSettings = - settings.partialUpdateInstanceOperationSettings.toBuilder(); - deleteInstanceSettings = settings.deleteInstanceSettings.toBuilder(); - createClusterSettings = settings.createClusterSettings.toBuilder(); - createClusterOperationSettings = settings.createClusterOperationSettings.toBuilder(); - getClusterSettings = settings.getClusterSettings.toBuilder(); - listClustersSettings = settings.listClustersSettings.toBuilder(); - updateClusterSettings = settings.updateClusterSettings.toBuilder(); - updateClusterOperationSettings = settings.updateClusterOperationSettings.toBuilder(); - deleteClusterSettings = settings.deleteClusterSettings.toBuilder(); - createAppProfileSettings = settings.createAppProfileSettings.toBuilder(); - getAppProfileSettings = settings.getAppProfileSettings.toBuilder(); - listAppProfilesSettings = settings.listAppProfilesSettings.toBuilder(); - updateAppProfileSettings = settings.updateAppProfileSettings.toBuilder(); - updateAppProfileOperationSettings = settings.updateAppProfileOperationSettings.toBuilder(); - deleteAppProfileSettings = settings.deleteAppProfileSettings.toBuilder(); - getIamPolicySettings = settings.getIamPolicySettings.toBuilder(); - setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); - testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - createInstanceSettings, - getInstanceSettings, - listInstancesSettings, - partialUpdateInstanceSettings, - deleteInstanceSettings, - createClusterSettings, - getClusterSettings, - listClustersSettings, - updateClusterSettings, - deleteClusterSettings, - createAppProfileSettings, - getAppProfileSettings, - listAppProfilesSettings, - updateAppProfileSettings, - deleteAppProfileSettings, - getIamPolicySettings, - setIamPolicySettings, - testIamPermissionsSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * @@ -933,6 +927,11 @@ public UnaryCallSettings.Builder getInstanceSettin return listInstancesSettings; } + /** Returns the builder for the settings used for calls to updateInstance. */ + public UnaryCallSettings.Builder updateInstanceSettings() { + return updateInstanceSettings; + } + /** Returns the builder for the settings used for calls to partialUpdateInstance. */ public UnaryCallSettings.Builder partialUpdateInstanceSettings() { diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStub.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStub.java index c5fd778fb..4dc95ce04 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStub.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStub.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.admin.v2.stub; import static com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient.ListBackupsPagedResponse; import static com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient.ListSnapshotsPagedResponse; import static com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient.ListTablesPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.OperationCallable; @@ -65,13 +65,12 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** For internal use only. */ @Generated("by gapic-generator") @InternalApi public abstract class BigtableTableAdminStub implements BackgroundResource { - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationsStub getOperationsStub() { throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); } @@ -80,7 +79,6 @@ public UnaryCallable createTableCallable() { throw new UnsupportedOperationException("Not implemented: createTableCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable createTableFromSnapshotOperationCallable() { throw new UnsupportedOperationException( @@ -126,20 +124,6 @@ public UnaryCallable dropRowRangeCallable() { throw new UnsupportedOperationException("Not implemented: checkConsistencyCallable()"); } - public UnaryCallable getIamPolicyCallable() { - throw new UnsupportedOperationException("Not implemented: getIamPolicyCallable()"); - } - - public UnaryCallable setIamPolicyCallable() { - throw new UnsupportedOperationException("Not implemented: setIamPolicyCallable()"); - } - - public UnaryCallable - testIamPermissionsCallable() { - throw new UnsupportedOperationException("Not implemented: testIamPermissionsCallable()"); - } - - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable snapshotTableOperationCallable() { throw new UnsupportedOperationException("Not implemented: snapshotTableOperationCallable()"); @@ -166,7 +150,6 @@ public UnaryCallable deleteSnapshotCallable() { throw new UnsupportedOperationException("Not implemented: deleteSnapshotCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable createBackupOperationCallable() { throw new UnsupportedOperationException("Not implemented: createBackupOperationCallable()"); @@ -180,14 +163,6 @@ public UnaryCallable getBackupCallable() { throw new UnsupportedOperationException("Not implemented: getBackupCallable()"); } - public UnaryCallable listBackupsPagedCallable() { - throw new UnsupportedOperationException("Not implemented: listBackupsPagedCallable()"); - } - - public UnaryCallable listBackupsCallable() { - throw new UnsupportedOperationException("Not implemented: listBackupsCallable()"); - } - public UnaryCallable updateBackupCallable() { throw new UnsupportedOperationException("Not implemented: updateBackupCallable()"); } @@ -196,7 +171,14 @@ public UnaryCallable deleteBackupCallable() { throw new UnsupportedOperationException("Not implemented: deleteBackupCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public UnaryCallable listBackupsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listBackupsPagedCallable()"); + } + + public UnaryCallable listBackupsCallable() { + throw new UnsupportedOperationException("Not implemented: listBackupsCallable()"); + } + public OperationCallable restoreTableOperationCallable() { throw new UnsupportedOperationException("Not implemented: restoreTableOperationCallable()"); @@ -206,6 +188,19 @@ public UnaryCallable restoreTableCallable() { throw new UnsupportedOperationException("Not implemented: restoreTableCallable()"); } + public UnaryCallable getIamPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: getIamPolicyCallable()"); + } + + public UnaryCallable setIamPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: setIamPolicyCallable()"); + } + + public UnaryCallable + testIamPermissionsCallable() { + throw new UnsupportedOperationException("Not implemented: testIamPermissionsCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStubSettings.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStubSettings.java index dafc8effe..8d785624e 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStubSettings.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStubSettings.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.admin.v2.stub; import static com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient.ListBackupsPagedResponse; @@ -92,7 +93,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link BigtableTableAdminStub}. * @@ -109,32 +110,30 @@ * *

For example, to set the total timeout of createTable to 30 seconds: * - *

- * 
+ * 
{@code
  * BigtableTableAdminStubSettings.Builder baseBigtableTableAdminSettingsBuilder =
  *     BigtableTableAdminStubSettings.newBuilder();
  * baseBigtableTableAdminSettingsBuilder
  *     .createTableSettings()
  *     .setRetrySettings(
- *         baseBigtableTableAdminSettingsBuilder.createTableSettings().getRetrySettings().toBuilder()
+ *         baseBigtableTableAdminSettingsBuilder
+ *             .createTableSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
- * BigtableTableAdminStubSettings baseBigtableTableAdminSettings = baseBigtableTableAdminSettingsBuilder.build();
- * 
- * 
+ * BigtableTableAdminStubSettings baseBigtableTableAdminSettings = + * baseBigtableTableAdminSettingsBuilder.build(); + * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class BigtableTableAdminStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = ImmutableList.builder() .add("https://www.googleapis.com/auth/bigtable.admin") - .add("https://www.googleapis.com/auth/bigtable.admin.cluster") - .add("https://www.googleapis.com/auth/bigtable.admin.instance") .add("https://www.googleapis.com/auth/bigtable.admin.table") .add("https://www.googleapis.com/auth/cloud-bigtable.admin") - .add("https://www.googleapis.com/auth/cloud-bigtable.admin.cluster") .add("https://www.googleapis.com/auth/cloud-bigtable.admin.table") .add("https://www.googleapis.com/auth/cloud-platform") .add("https://www.googleapis.com/auth/cloud-platform.read-only") @@ -156,10 +155,6 @@ public class BigtableTableAdminStubSettings extends StubSettings checkConsistencySettings; - private final UnaryCallSettings getIamPolicySettings; - private final UnaryCallSettings setIamPolicySettings; - private final UnaryCallSettings - testIamPermissionsSettings; private final UnaryCallSettings snapshotTableSettings; private final OperationCallSettings snapshotTableOperationSettings; @@ -172,13 +167,176 @@ public class BigtableTableAdminStubSettings extends StubSettings createBackupOperationSettings; private final UnaryCallSettings getBackupSettings; - private final PagedCallSettings - listBackupsSettings; private final UnaryCallSettings updateBackupSettings; private final UnaryCallSettings deleteBackupSettings; + private final PagedCallSettings + listBackupsSettings; private final UnaryCallSettings restoreTableSettings; private final OperationCallSettings restoreTableOperationSettings; + private final UnaryCallSettings getIamPolicySettings; + private final UnaryCallSettings setIamPolicySettings; + private final UnaryCallSettings + testIamPermissionsSettings; + + private static final PagedListDescriptor + LIST_TABLES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListTablesRequest injectToken(ListTablesRequest payload, String token) { + return ListTablesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListTablesRequest injectPageSize(ListTablesRequest payload, int pageSize) { + return ListTablesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListTablesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListTablesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable
extractResources(ListTablesResponse payload) { + return payload.getTablesList() == null + ? ImmutableList.
of() + : payload.getTablesList(); + } + }; + + private static final PagedListDescriptor + LIST_SNAPSHOTS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListSnapshotsRequest injectToken(ListSnapshotsRequest payload, String token) { + return ListSnapshotsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListSnapshotsRequest injectPageSize(ListSnapshotsRequest payload, int pageSize) { + return ListSnapshotsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListSnapshotsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListSnapshotsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListSnapshotsResponse payload) { + return payload.getSnapshotsList() == null + ? ImmutableList.of() + : payload.getSnapshotsList(); + } + }; + + private static final PagedListDescriptor + LIST_BACKUPS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListBackupsRequest injectToken(ListBackupsRequest payload, String token) { + return ListBackupsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListBackupsRequest injectPageSize(ListBackupsRequest payload, int pageSize) { + return ListBackupsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListBackupsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListBackupsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListBackupsResponse payload) { + return payload.getBackupsList() == null + ? ImmutableList.of() + : payload.getBackupsList(); + } + }; + + private static final PagedListResponseFactory< + ListTablesRequest, ListTablesResponse, ListTablesPagedResponse> + LIST_TABLES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListTablesRequest, ListTablesResponse, ListTablesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListTablesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_TABLES_PAGE_STR_DESC, request, context); + return ListTablesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListSnapshotsRequest, ListSnapshotsResponse, ListSnapshotsPagedResponse> + LIST_SNAPSHOTS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListSnapshotsRequest, ListSnapshotsResponse, ListSnapshotsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListSnapshotsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_SNAPSHOTS_PAGE_STR_DESC, request, context); + return ListSnapshotsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListBackupsRequest, ListBackupsResponse, ListBackupsPagedResponse> + LIST_BACKUPS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListBackupsRequest, ListBackupsResponse, ListBackupsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListBackupsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_BACKUPS_PAGE_STR_DESC, request, context); + return ListBackupsPagedResponse.createAsync(pageContext, futureResponse); + } + }; /** Returns the object with the settings used for calls to createTable. */ public UnaryCallSettings createTableSettings() { @@ -192,7 +350,6 @@ public UnaryCallSettings createTableSettings() { } /** Returns the object with the settings used for calls to createTableFromSnapshot. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings< CreateTableFromSnapshotRequest, Table, CreateTableFromSnapshotMetadata> createTableFromSnapshotOperationSettings() { @@ -237,29 +394,12 @@ public UnaryCallSettings dropRowRangeSettings() { return checkConsistencySettings; } - /** Returns the object with the settings used for calls to getIamPolicy. */ - public UnaryCallSettings getIamPolicySettings() { - return getIamPolicySettings; - } - - /** Returns the object with the settings used for calls to setIamPolicy. */ - public UnaryCallSettings setIamPolicySettings() { - return setIamPolicySettings; - } - - /** Returns the object with the settings used for calls to testIamPermissions. */ - public UnaryCallSettings - testIamPermissionsSettings() { - return testIamPermissionsSettings; - } - /** Returns the object with the settings used for calls to snapshotTable. */ public UnaryCallSettings snapshotTableSettings() { return snapshotTableSettings; } /** Returns the object with the settings used for calls to snapshotTable. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings snapshotTableOperationSettings() { return snapshotTableOperationSettings; @@ -287,7 +427,6 @@ public UnaryCallSettings createBackupSettings() } /** Returns the object with the settings used for calls to createBackup. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings createBackupOperationSettings() { return createBackupOperationSettings; @@ -298,12 +437,6 @@ public UnaryCallSettings getBackupSettings() { return getBackupSettings; } - /** Returns the object with the settings used for calls to listBackups. */ - public PagedCallSettings - listBackupsSettings() { - return listBackupsSettings; - } - /** Returns the object with the settings used for calls to updateBackup. */ public UnaryCallSettings updateBackupSettings() { return updateBackupSettings; @@ -314,28 +447,49 @@ public UnaryCallSettings deleteBackupSettings() { return deleteBackupSettings; } + /** Returns the object with the settings used for calls to listBackups. */ + public PagedCallSettings + listBackupsSettings() { + return listBackupsSettings; + } + /** Returns the object with the settings used for calls to restoreTable. */ public UnaryCallSettings restoreTableSettings() { return restoreTableSettings; } /** Returns the object with the settings used for calls to restoreTable. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings restoreTableOperationSettings() { return restoreTableOperationSettings; } + /** Returns the object with the settings used for calls to getIamPolicy. */ + public UnaryCallSettings getIamPolicySettings() { + return getIamPolicySettings; + } + + /** Returns the object with the settings used for calls to setIamPolicy. */ + public UnaryCallSettings setIamPolicySettings() { + return setIamPolicySettings; + } + + /** Returns the object with the settings used for calls to testIamPermissions. */ + public UnaryCallSettings + testIamPermissionsSettings() { + return testIamPermissionsSettings; + } + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public BigtableTableAdminStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcBigtableTableAdminStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -406,9 +560,6 @@ protected BigtableTableAdminStubSettings(Builder settingsBuilder) throws IOExcep dropRowRangeSettings = settingsBuilder.dropRowRangeSettings().build(); generateConsistencyTokenSettings = settingsBuilder.generateConsistencyTokenSettings().build(); checkConsistencySettings = settingsBuilder.checkConsistencySettings().build(); - getIamPolicySettings = settingsBuilder.getIamPolicySettings().build(); - setIamPolicySettings = settingsBuilder.setIamPolicySettings().build(); - testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build(); snapshotTableSettings = settingsBuilder.snapshotTableSettings().build(); snapshotTableOperationSettings = settingsBuilder.snapshotTableOperationSettings().build(); getSnapshotSettings = settingsBuilder.getSnapshotSettings().build(); @@ -417,177 +568,20 @@ protected BigtableTableAdminStubSettings(Builder settingsBuilder) throws IOExcep createBackupSettings = settingsBuilder.createBackupSettings().build(); createBackupOperationSettings = settingsBuilder.createBackupOperationSettings().build(); getBackupSettings = settingsBuilder.getBackupSettings().build(); - listBackupsSettings = settingsBuilder.listBackupsSettings().build(); updateBackupSettings = settingsBuilder.updateBackupSettings().build(); deleteBackupSettings = settingsBuilder.deleteBackupSettings().build(); + listBackupsSettings = settingsBuilder.listBackupsSettings().build(); restoreTableSettings = settingsBuilder.restoreTableSettings().build(); restoreTableOperationSettings = settingsBuilder.restoreTableOperationSettings().build(); + getIamPolicySettings = settingsBuilder.getIamPolicySettings().build(); + setIamPolicySettings = settingsBuilder.setIamPolicySettings().build(); + testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build(); } - private static final PagedListDescriptor - LIST_TABLES_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListTablesRequest injectToken(ListTablesRequest payload, String token) { - return ListTablesRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListTablesRequest injectPageSize(ListTablesRequest payload, int pageSize) { - return ListTablesRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListTablesRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListTablesResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable
extractResources(ListTablesResponse payload) { - return payload.getTablesList() != null - ? payload.getTablesList() - : ImmutableList.
of(); - } - }; - - private static final PagedListDescriptor - LIST_SNAPSHOTS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListSnapshotsRequest injectToken(ListSnapshotsRequest payload, String token) { - return ListSnapshotsRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListSnapshotsRequest injectPageSize(ListSnapshotsRequest payload, int pageSize) { - return ListSnapshotsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListSnapshotsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListSnapshotsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListSnapshotsResponse payload) { - return payload.getSnapshotsList() != null - ? payload.getSnapshotsList() - : ImmutableList.of(); - } - }; - - private static final PagedListDescriptor - LIST_BACKUPS_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListBackupsRequest injectToken(ListBackupsRequest payload, String token) { - return ListBackupsRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListBackupsRequest injectPageSize(ListBackupsRequest payload, int pageSize) { - return ListBackupsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListBackupsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListBackupsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListBackupsResponse payload) { - return payload.getBackupsList() != null - ? payload.getBackupsList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListTablesRequest, ListTablesResponse, ListTablesPagedResponse> - LIST_TABLES_PAGE_STR_FACT = - new PagedListResponseFactory< - ListTablesRequest, ListTablesResponse, ListTablesPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListTablesRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_TABLES_PAGE_STR_DESC, request, context); - return ListTablesPagedResponse.createAsync(pageContext, futureResponse); - } - }; - - private static final PagedListResponseFactory< - ListSnapshotsRequest, ListSnapshotsResponse, ListSnapshotsPagedResponse> - LIST_SNAPSHOTS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListSnapshotsRequest, ListSnapshotsResponse, ListSnapshotsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListSnapshotsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_SNAPSHOTS_PAGE_STR_DESC, request, context); - return ListSnapshotsPagedResponse.createAsync(pageContext, futureResponse); - } - }; - - private static final PagedListResponseFactory< - ListBackupsRequest, ListBackupsResponse, ListBackupsPagedResponse> - LIST_BACKUPS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListBackupsRequest, ListBackupsResponse, ListBackupsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListBackupsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_BACKUPS_PAGE_STR_DESC, request, context); - return ListBackupsPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for BigtableTableAdminStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder createTableSettings; private final UnaryCallSettings.Builder createTableFromSnapshotSettings; @@ -607,10 +601,6 @@ public static class Builder generateConsistencyTokenSettings; private final UnaryCallSettings.Builder checkConsistencySettings; - private final UnaryCallSettings.Builder getIamPolicySettings; - private final UnaryCallSettings.Builder setIamPolicySettings; - private final UnaryCallSettings.Builder - testIamPermissionsSettings; private final UnaryCallSettings.Builder snapshotTableSettings; private final OperationCallSettings.Builder< SnapshotTableRequest, Snapshot, SnapshotTableMetadata> @@ -624,15 +614,18 @@ public static class Builder private final OperationCallSettings.Builder createBackupOperationSettings; private final UnaryCallSettings.Builder getBackupSettings; + private final UnaryCallSettings.Builder updateBackupSettings; + private final UnaryCallSettings.Builder deleteBackupSettings; private final PagedCallSettings.Builder< ListBackupsRequest, ListBackupsResponse, ListBackupsPagedResponse> listBackupsSettings; - private final UnaryCallSettings.Builder updateBackupSettings; - private final UnaryCallSettings.Builder deleteBackupSettings; private final UnaryCallSettings.Builder restoreTableSettings; private final OperationCallSettings.Builder restoreTableOperationSettings; - + private final UnaryCallSettings.Builder getIamPolicySettings; + private final UnaryCallSettings.Builder setIamPolicySettings; + private final UnaryCallSettings.Builder + testIamPermissionsSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -640,11 +633,22 @@ public static class Builder ImmutableMap.Builder> definitions = ImmutableMap.builder(); definitions.put( - "idempotent", + "no_retry_0_codes", ImmutableSet.copyOf(Lists.newArrayList())); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); + definitions.put( + "retry_policy_2_codes", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED))); + definitions.put( + "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); + definitions.put( + "no_retry_4_codes", ImmutableSet.copyOf(Lists.newArrayList())); + definitions.put( + "retry_policy_3_codes", ImmutableSet.copyOf( Lists.newArrayList( - StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); - definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED))); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -653,6 +657,16 @@ public static class Builder static { ImmutableMap.Builder definitions = ImmutableMap.builder(); RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRpcTimeout(Duration.ofMillis(300000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(300000L)) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build(); + definitions.put("no_retry_0_params", settings); + settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); + definitions.put("no_retry_params", settings); settings = RetrySettings.newBuilder() .setInitialRetryDelay(Duration.ofMillis(1000L)) @@ -661,97 +675,72 @@ public static class Builder .setInitialRpcTimeout(Duration.ofMillis(60000L)) .setRpcTimeoutMultiplier(1.0) .setMaxRpcTimeout(Duration.ofMillis(60000L)) - .setTotalTimeout(Duration.ofMillis(600000L)) + .setTotalTimeout(Duration.ofMillis(60000L)) .build(); - definitions.put("idempotent_params", settings); + definitions.put("retry_policy_2_params", settings); settings = RetrySettings.newBuilder() - .setRetryDelayMultiplier(1.0) .setInitialRpcTimeout(Duration.ofMillis(60000L)) .setRpcTimeoutMultiplier(1.0) .setMaxRpcTimeout(Duration.ofMillis(60000L)) .setTotalTimeout(Duration.ofMillis(60000L)) .build(); - definitions.put("non_idempotent_params", settings); + definitions.put("no_retry_1_params", settings); settings = RetrySettings.newBuilder() - .setRetryDelayMultiplier(1.0) - .setInitialRpcTimeout(Duration.ofMillis(300000L)) + .setInitialRpcTimeout(Duration.ofMillis(3600000L)) .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(300000L)) - .setTotalTimeout(Duration.ofMillis(300000L)) + .setMaxRpcTimeout(Duration.ofMillis(3600000L)) + .setTotalTimeout(Duration.ofMillis(3600000L)) .build(); - definitions.put("non_idempotent_heavy_params", settings); + definitions.put("no_retry_4_params", settings); settings = RetrySettings.newBuilder() - .setRetryDelayMultiplier(1.0) - .setInitialRpcTimeout(Duration.ofMillis(3600000L)) + .setInitialRetryDelay(Duration.ofMillis(1000L)) + .setRetryDelayMultiplier(2.0) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(60000L)) .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(3600000L)) - .setTotalTimeout(Duration.ofMillis(3600000L)) + .setMaxRpcTimeout(Duration.ofMillis(60000L)) + .setTotalTimeout(Duration.ofMillis(60000L)) .build(); - definitions.put("drop_row_range_params", settings); + definitions.put("retry_policy_3_params", settings); RETRY_PARAM_DEFINITIONS = definitions.build(); } protected Builder() { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(clientContext); createTableSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - createTableFromSnapshotSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - createTableFromSnapshotOperationSettings = OperationCallSettings.newBuilder(); - listTablesSettings = PagedCallSettings.newBuilder(LIST_TABLES_PAGE_STR_FACT); - getTableSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - deleteTableSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - modifyColumnFamiliesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - dropRowRangeSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - generateConsistencyTokenSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - checkConsistencySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - - getIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - - setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - - testIamPermissionsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - snapshotTableSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - snapshotTableOperationSettings = OperationCallSettings.newBuilder(); - getSnapshotSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - listSnapshotsSettings = PagedCallSettings.newBuilder(LIST_SNAPSHOTS_PAGE_STR_FACT); - deleteSnapshotSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - createBackupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - createBackupOperationSettings = OperationCallSettings.newBuilder(); - getBackupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - - listBackupsSettings = PagedCallSettings.newBuilder(LIST_BACKUPS_PAGE_STR_FACT); - updateBackupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - deleteBackupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - + listBackupsSettings = PagedCallSettings.newBuilder(LIST_BACKUPS_PAGE_STR_FACT); restoreTableSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - restoreTableOperationSettings = OperationCallSettings.newBuilder(); + getIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + testIamPermissionsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -764,150 +753,208 @@ protected Builder(ClientContext clientContext) { dropRowRangeSettings, generateConsistencyTokenSettings, checkConsistencySettings, + snapshotTableSettings, + getSnapshotSettings, + listSnapshotsSettings, + deleteSnapshotSettings, + createBackupSettings, + getBackupSettings, + updateBackupSettings, + deleteBackupSettings, + listBackupsSettings, + restoreTableSettings, getIamPolicySettings, setIamPolicySettings, - testIamPermissionsSettings, + testIamPermissionsSettings); + initDefaults(this); + } + + protected Builder(BigtableTableAdminStubSettings settings) { + super(settings); + + createTableSettings = settings.createTableSettings.toBuilder(); + createTableFromSnapshotSettings = settings.createTableFromSnapshotSettings.toBuilder(); + createTableFromSnapshotOperationSettings = + settings.createTableFromSnapshotOperationSettings.toBuilder(); + listTablesSettings = settings.listTablesSettings.toBuilder(); + getTableSettings = settings.getTableSettings.toBuilder(); + deleteTableSettings = settings.deleteTableSettings.toBuilder(); + modifyColumnFamiliesSettings = settings.modifyColumnFamiliesSettings.toBuilder(); + dropRowRangeSettings = settings.dropRowRangeSettings.toBuilder(); + generateConsistencyTokenSettings = settings.generateConsistencyTokenSettings.toBuilder(); + checkConsistencySettings = settings.checkConsistencySettings.toBuilder(); + snapshotTableSettings = settings.snapshotTableSettings.toBuilder(); + snapshotTableOperationSettings = settings.snapshotTableOperationSettings.toBuilder(); + getSnapshotSettings = settings.getSnapshotSettings.toBuilder(); + listSnapshotsSettings = settings.listSnapshotsSettings.toBuilder(); + deleteSnapshotSettings = settings.deleteSnapshotSettings.toBuilder(); + createBackupSettings = settings.createBackupSettings.toBuilder(); + createBackupOperationSettings = settings.createBackupOperationSettings.toBuilder(); + getBackupSettings = settings.getBackupSettings.toBuilder(); + updateBackupSettings = settings.updateBackupSettings.toBuilder(); + deleteBackupSettings = settings.deleteBackupSettings.toBuilder(); + listBackupsSettings = settings.listBackupsSettings.toBuilder(); + restoreTableSettings = settings.restoreTableSettings.toBuilder(); + restoreTableOperationSettings = settings.restoreTableOperationSettings.toBuilder(); + getIamPolicySettings = settings.getIamPolicySettings.toBuilder(); + setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); + testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createTableSettings, + createTableFromSnapshotSettings, + listTablesSettings, + getTableSettings, + deleteTableSettings, + modifyColumnFamiliesSettings, + dropRowRangeSettings, + generateConsistencyTokenSettings, + checkConsistencySettings, snapshotTableSettings, getSnapshotSettings, listSnapshotsSettings, deleteSnapshotSettings, createBackupSettings, getBackupSettings, - listBackupsSettings, updateBackupSettings, deleteBackupSettings, - restoreTableSettings); - - initDefaults(this); + listBackupsSettings, + restoreTableSettings, + getIamPolicySettings, + setIamPolicySettings, + testIamPermissionsSettings); } private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .createTableSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_heavy_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .createTableFromSnapshotSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); builder .listTablesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params")); builder .getTableSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params")); builder .deleteTableSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); builder .modifyColumnFamiliesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_heavy_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); builder .dropRowRangeSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("drop_row_range_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_4_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_4_params")); builder .generateConsistencyTokenSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params")); builder .checkConsistencySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); - - builder - .getIamPolicySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); - - builder - .setIamPolicySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")); - - builder - .testIamPermissionsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params")); builder .snapshotTableSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); builder .getSnapshotSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params")); builder .listSnapshotsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params")); builder .deleteSnapshotSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); builder .createBackupSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); builder .getBackupSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); - - builder - .listBackupsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params")); builder .updateBackupSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); builder .deleteBackupSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + + builder + .listBackupsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params")); builder .restoreTableSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .getIamPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params")); + + builder + .setIamPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + + builder + .testIamPermissionsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params")); + builder .createTableFromSnapshotOperationSettings() .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Table.class)) @@ -920,18 +967,19 @@ private static Builder initDefaults(Builder builder) { .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) .setMaxRetryDelay(Duration.ofMillis(60000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(3600000L)) .build())); + builder .snapshotTableOperationSettings() .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Snapshot.class)) @@ -943,18 +991,19 @@ private static Builder initDefaults(Builder builder) { .setInitialRetryDelay(Duration.ofMillis(500L)) .setRetryDelayMultiplier(1.5) .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(600000L)) .build())); + builder .createBackupOperationSettings() .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Backup.class)) @@ -966,18 +1015,19 @@ private static Builder initDefaults(Builder builder) { .setInitialRetryDelay(Duration.ofMillis(500L)) .setRetryDelayMultiplier(1.5) .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(600000L)) .build())); + builder .restoreTableOperationSettings() .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Table.class)) @@ -989,73 +1039,16 @@ private static Builder initDefaults(Builder builder) { .setInitialRetryDelay(Duration.ofMillis(500L)) .setRetryDelayMultiplier(1.5) .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(600000L)) .build())); return builder; } - protected Builder(BigtableTableAdminStubSettings settings) { - super(settings); - - createTableSettings = settings.createTableSettings.toBuilder(); - createTableFromSnapshotSettings = settings.createTableFromSnapshotSettings.toBuilder(); - createTableFromSnapshotOperationSettings = - settings.createTableFromSnapshotOperationSettings.toBuilder(); - listTablesSettings = settings.listTablesSettings.toBuilder(); - getTableSettings = settings.getTableSettings.toBuilder(); - deleteTableSettings = settings.deleteTableSettings.toBuilder(); - modifyColumnFamiliesSettings = settings.modifyColumnFamiliesSettings.toBuilder(); - dropRowRangeSettings = settings.dropRowRangeSettings.toBuilder(); - generateConsistencyTokenSettings = settings.generateConsistencyTokenSettings.toBuilder(); - checkConsistencySettings = settings.checkConsistencySettings.toBuilder(); - getIamPolicySettings = settings.getIamPolicySettings.toBuilder(); - setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); - testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder(); - snapshotTableSettings = settings.snapshotTableSettings.toBuilder(); - snapshotTableOperationSettings = settings.snapshotTableOperationSettings.toBuilder(); - getSnapshotSettings = settings.getSnapshotSettings.toBuilder(); - listSnapshotsSettings = settings.listSnapshotsSettings.toBuilder(); - deleteSnapshotSettings = settings.deleteSnapshotSettings.toBuilder(); - createBackupSettings = settings.createBackupSettings.toBuilder(); - createBackupOperationSettings = settings.createBackupOperationSettings.toBuilder(); - getBackupSettings = settings.getBackupSettings.toBuilder(); - listBackupsSettings = settings.listBackupsSettings.toBuilder(); - updateBackupSettings = settings.updateBackupSettings.toBuilder(); - deleteBackupSettings = settings.deleteBackupSettings.toBuilder(); - restoreTableSettings = settings.restoreTableSettings.toBuilder(); - restoreTableOperationSettings = settings.restoreTableOperationSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - createTableSettings, - createTableFromSnapshotSettings, - listTablesSettings, - getTableSettings, - deleteTableSettings, - modifyColumnFamiliesSettings, - dropRowRangeSettings, - generateConsistencyTokenSettings, - checkConsistencySettings, - getIamPolicySettings, - setIamPolicySettings, - testIamPermissionsSettings, - snapshotTableSettings, - getSnapshotSettings, - listSnapshotsSettings, - deleteSnapshotSettings, - createBackupSettings, - getBackupSettings, - listBackupsSettings, - updateBackupSettings, - deleteBackupSettings, - restoreTableSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * @@ -1131,22 +1124,6 @@ public UnaryCallSettings.Builder dropRowRangeSetting return checkConsistencySettings; } - /** Returns the builder for the settings used for calls to getIamPolicy. */ - public UnaryCallSettings.Builder getIamPolicySettings() { - return getIamPolicySettings; - } - - /** Returns the builder for the settings used for calls to setIamPolicy. */ - public UnaryCallSettings.Builder setIamPolicySettings() { - return setIamPolicySettings; - } - - /** Returns the builder for the settings used for calls to testIamPermissions. */ - public UnaryCallSettings.Builder - testIamPermissionsSettings() { - return testIamPermissionsSettings; - } - /** Returns the builder for the settings used for calls to snapshotTable. */ public UnaryCallSettings.Builder snapshotTableSettings() { return snapshotTableSettings; @@ -1195,13 +1172,6 @@ public UnaryCallSettings.Builder getBackupSettings() { return getBackupSettings; } - /** Returns the builder for the settings used for calls to listBackups. */ - public PagedCallSettings.Builder< - ListBackupsRequest, ListBackupsResponse, ListBackupsPagedResponse> - listBackupsSettings() { - return listBackupsSettings; - } - /** Returns the builder for the settings used for calls to updateBackup. */ public UnaryCallSettings.Builder updateBackupSettings() { return updateBackupSettings; @@ -1212,6 +1182,13 @@ public UnaryCallSettings.Builder deleteBackupSetting return deleteBackupSettings; } + /** Returns the builder for the settings used for calls to listBackups. */ + public PagedCallSettings.Builder< + ListBackupsRequest, ListBackupsResponse, ListBackupsPagedResponse> + listBackupsSettings() { + return listBackupsSettings; + } + /** Returns the builder for the settings used for calls to restoreTable. */ public UnaryCallSettings.Builder restoreTableSettings() { return restoreTableSettings; @@ -1225,6 +1202,22 @@ public UnaryCallSettings.Builder restoreTableSet return restoreTableOperationSettings; } + /** Returns the builder for the settings used for calls to getIamPolicy. */ + public UnaryCallSettings.Builder getIamPolicySettings() { + return getIamPolicySettings; + } + + /** Returns the builder for the settings used for calls to setIamPolicy. */ + public UnaryCallSettings.Builder setIamPolicySettings() { + return setIamPolicySettings; + } + + /** Returns the builder for the settings used for calls to testIamPermissions. */ + public UnaryCallSettings.Builder + testIamPermissionsSettings() { + return testIamPermissionsSettings; + } + @Override public BigtableTableAdminStubSettings build() throws IOException { return new BigtableTableAdminStubSettings(this); diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminCallableFactory.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminCallableFactory.java index 25b6608e2..ba2d95013 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminCallableFactory.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminCallableFactory.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.admin.v2.stub; -import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; @@ -32,14 +32,16 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** For internal use only. */ @Generated("by gapic-generator") @InternalApi public class GrpcBigtableInstanceAdminCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -52,61 +54,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminStub.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminStub.java index d4dea7195..b927f60fc 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminStub.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableInstanceAdminStub.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.admin.v2.stub; import static com.google.cloud.bigtable.admin.v2.BaseBigtableInstanceAdminClient.ListAppProfilesPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; @@ -68,12 +68,11 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** For internal use only. */ @Generated("by gapic-generator") @InternalApi public class GrpcBigtableInstanceAdminStub extends BigtableInstanceAdminStub { - private static final MethodDescriptor createInstanceMethodDescriptor = MethodDescriptor.newBuilder() @@ -83,6 +82,7 @@ public class GrpcBigtableInstanceAdminStub extends BigtableInstanceAdminStub { ProtoUtils.marshaller(CreateInstanceRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor getInstanceMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -90,6 +90,7 @@ public class GrpcBigtableInstanceAdminStub extends BigtableInstanceAdminStub { .setRequestMarshaller(ProtoUtils.marshaller(GetInstanceRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Instance.getDefaultInstance())) .build(); + private static final MethodDescriptor listInstancesMethodDescriptor = MethodDescriptor.newBuilder() @@ -100,6 +101,15 @@ public class GrpcBigtableInstanceAdminStub extends BigtableInstanceAdminStub { .setResponseMarshaller( ProtoUtils.marshaller(ListInstancesResponse.getDefaultInstance())) .build(); + + private static final MethodDescriptor updateInstanceMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.bigtable.admin.v2.BigtableInstanceAdmin/UpdateInstance") + .setRequestMarshaller(ProtoUtils.marshaller(Instance.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Instance.getDefaultInstance())) + .build(); + private static final MethodDescriptor partialUpdateInstanceMethodDescriptor = MethodDescriptor.newBuilder() @@ -110,6 +120,7 @@ public class GrpcBigtableInstanceAdminStub extends BigtableInstanceAdminStub { ProtoUtils.marshaller(PartialUpdateInstanceRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteInstanceMethodDescriptor = MethodDescriptor.newBuilder() @@ -119,6 +130,7 @@ public class GrpcBigtableInstanceAdminStub extends BigtableInstanceAdminStub { ProtoUtils.marshaller(DeleteInstanceRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor createClusterMethodDescriptor = MethodDescriptor.newBuilder() @@ -128,6 +140,7 @@ public class GrpcBigtableInstanceAdminStub extends BigtableInstanceAdminStub { ProtoUtils.marshaller(CreateClusterRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor getClusterMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -135,6 +148,7 @@ public class GrpcBigtableInstanceAdminStub extends BigtableInstanceAdminStub { .setRequestMarshaller(ProtoUtils.marshaller(GetClusterRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Cluster.getDefaultInstance())) .build(); + private static final MethodDescriptor listClustersMethodDescriptor = MethodDescriptor.newBuilder() @@ -144,6 +158,7 @@ public class GrpcBigtableInstanceAdminStub extends BigtableInstanceAdminStub { .setResponseMarshaller( ProtoUtils.marshaller(ListClustersResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor updateClusterMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -151,6 +166,7 @@ public class GrpcBigtableInstanceAdminStub extends BigtableInstanceAdminStub { .setRequestMarshaller(ProtoUtils.marshaller(Cluster.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteClusterMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -158,6 +174,7 @@ public class GrpcBigtableInstanceAdminStub extends BigtableInstanceAdminStub { .setRequestMarshaller(ProtoUtils.marshaller(DeleteClusterRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor createAppProfileMethodDescriptor = MethodDescriptor.newBuilder() @@ -167,6 +184,7 @@ public class GrpcBigtableInstanceAdminStub extends BigtableInstanceAdminStub { ProtoUtils.marshaller(CreateAppProfileRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(AppProfile.getDefaultInstance())) .build(); + private static final MethodDescriptor getAppProfileMethodDescriptor = MethodDescriptor.newBuilder() @@ -176,6 +194,7 @@ public class GrpcBigtableInstanceAdminStub extends BigtableInstanceAdminStub { ProtoUtils.marshaller(GetAppProfileRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(AppProfile.getDefaultInstance())) .build(); + private static final MethodDescriptor listAppProfilesMethodDescriptor = MethodDescriptor.newBuilder() @@ -186,6 +205,7 @@ public class GrpcBigtableInstanceAdminStub extends BigtableInstanceAdminStub { .setResponseMarshaller( ProtoUtils.marshaller(ListAppProfilesResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor updateAppProfileMethodDescriptor = MethodDescriptor.newBuilder() @@ -195,6 +215,7 @@ public class GrpcBigtableInstanceAdminStub extends BigtableInstanceAdminStub { ProtoUtils.marshaller(UpdateAppProfileRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteAppProfileMethodDescriptor = MethodDescriptor.newBuilder() @@ -204,6 +225,7 @@ public class GrpcBigtableInstanceAdminStub extends BigtableInstanceAdminStub { ProtoUtils.marshaller(DeleteAppProfileRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor getIamPolicyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -211,6 +233,7 @@ public class GrpcBigtableInstanceAdminStub extends BigtableInstanceAdminStub { .setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) .build(); + private static final MethodDescriptor setIamPolicyMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -218,6 +241,7 @@ public class GrpcBigtableInstanceAdminStub extends BigtableInstanceAdminStub { .setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) .build(); + private static final MethodDescriptor testIamPermissionsMethodDescriptor = MethodDescriptor.newBuilder() @@ -230,14 +254,12 @@ public class GrpcBigtableInstanceAdminStub extends BigtableInstanceAdminStub { ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; - private final UnaryCallable createInstanceCallable; private final OperationCallable createInstanceOperationCallable; private final UnaryCallable getInstanceCallable; private final UnaryCallable listInstancesCallable; + private final UnaryCallable updateInstanceCallable; private final UnaryCallable partialUpdateInstanceCallable; private final OperationCallable @@ -267,6 +289,8 @@ public class GrpcBigtableInstanceAdminStub extends BigtableInstanceAdminStub { private final UnaryCallable testIamPermissionsCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcBigtableInstanceAdminStub create( @@ -348,6 +372,19 @@ public Map extract(ListInstancesRequest request) { } }) .build(); + GrpcCallSettings updateInstanceTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateInstanceMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(Instance request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); GrpcCallSettings partialUpdateInstanceTransportSettings = GrpcCallSettings.newBuilder() @@ -557,13 +594,16 @@ public Map extract(TestIamPermissionsRequest request) { createInstanceTransportSettings, settings.createInstanceOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.getInstanceCallable = callableFactory.createUnaryCallable( getInstanceTransportSettings, settings.getInstanceSettings(), clientContext); this.listInstancesCallable = callableFactory.createUnaryCallable( listInstancesTransportSettings, settings.listInstancesSettings(), clientContext); + this.updateInstanceCallable = + callableFactory.createUnaryCallable( + updateInstanceTransportSettings, settings.updateInstanceSettings(), clientContext); this.partialUpdateInstanceCallable = callableFactory.createUnaryCallable( partialUpdateInstanceTransportSettings, @@ -574,7 +614,7 @@ public Map extract(TestIamPermissionsRequest request) { partialUpdateInstanceTransportSettings, settings.partialUpdateInstanceOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.deleteInstanceCallable = callableFactory.createUnaryCallable( deleteInstanceTransportSettings, settings.deleteInstanceSettings(), clientContext); @@ -586,7 +626,7 @@ public Map extract(TestIamPermissionsRequest request) { createClusterTransportSettings, settings.createClusterOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.getClusterCallable = callableFactory.createUnaryCallable( getClusterTransportSettings, settings.getClusterSettings(), clientContext); @@ -601,7 +641,7 @@ public Map extract(TestIamPermissionsRequest request) { updateClusterTransportSettings, settings.updateClusterOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.deleteClusterCallable = callableFactory.createUnaryCallable( deleteClusterTransportSettings, settings.deleteClusterSettings(), clientContext); @@ -625,7 +665,7 @@ public Map extract(TestIamPermissionsRequest request) { updateAppProfileTransportSettings, settings.updateAppProfileOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.deleteAppProfileCallable = callableFactory.createUnaryCallable( deleteAppProfileTransportSettings, settings.deleteAppProfileSettings(), clientContext); @@ -641,24 +681,23 @@ public Map extract(TestIamPermissionsRequest request) { settings.testIamPermissionsSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public GrpcOperationsStub getOperationsStub() { return operationsStub; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public UnaryCallable createInstanceCallable() { + return createInstanceCallable; + } + public OperationCallable createInstanceOperationCallable() { return createInstanceOperationCallable; } - public UnaryCallable createInstanceCallable() { - return createInstanceCallable; - } - public UnaryCallable getInstanceCallable() { return getInstanceCallable; } @@ -667,30 +706,32 @@ public UnaryCallable listInstancesC return listInstancesCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallable - partialUpdateInstanceOperationCallable() { - return partialUpdateInstanceOperationCallable; + public UnaryCallable updateInstanceCallable() { + return updateInstanceCallable; } public UnaryCallable partialUpdateInstanceCallable() { return partialUpdateInstanceCallable; } + public OperationCallable + partialUpdateInstanceOperationCallable() { + return partialUpdateInstanceOperationCallable; + } + public UnaryCallable deleteInstanceCallable() { return deleteInstanceCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public UnaryCallable createClusterCallable() { + return createClusterCallable; + } + public OperationCallable createClusterOperationCallable() { return createClusterOperationCallable; } - public UnaryCallable createClusterCallable() { - return createClusterCallable; - } - public UnaryCallable getClusterCallable() { return getClusterCallable; } @@ -699,16 +740,15 @@ public UnaryCallable listClustersCall return listClustersCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public UnaryCallable updateClusterCallable() { + return updateClusterCallable; + } + public OperationCallable updateClusterOperationCallable() { return updateClusterOperationCallable; } - public UnaryCallable updateClusterCallable() { - return updateClusterCallable; - } - public UnaryCallable deleteClusterCallable() { return deleteClusterCallable; } @@ -721,25 +761,24 @@ public UnaryCallable getAppProfileCallable() { return getAppProfileCallable; } + public UnaryCallable listAppProfilesCallable() { + return listAppProfilesCallable; + } + public UnaryCallable listAppProfilesPagedCallable() { return listAppProfilesPagedCallable; } - public UnaryCallable listAppProfilesCallable() { - return listAppProfilesCallable; + public UnaryCallable updateAppProfileCallable() { + return updateAppProfileCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable updateAppProfileOperationCallable() { return updateAppProfileOperationCallable; } - public UnaryCallable updateAppProfileCallable() { - return updateAppProfileCallable; - } - public UnaryCallable deleteAppProfileCallable() { return deleteAppProfileCallable; } diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminCallableFactory.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminCallableFactory.java index 7e285ca66..456418c0f 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminCallableFactory.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminCallableFactory.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.admin.v2.stub; -import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; @@ -32,14 +32,16 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** For internal use only. */ @Generated("by gapic-generator") @InternalApi public class GrpcBigtableTableAdminCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -52,61 +54,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminStub.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminStub.java index 81d1c032a..c8d299a46 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminStub.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminStub.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.admin.v2.stub; import static com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient.ListBackupsPagedResponse; import static com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient.ListSnapshotsPagedResponse; import static com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient.ListTablesPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; @@ -76,12 +76,11 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** For internal use only. */ @Generated("by gapic-generator") @InternalApi public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { - private static final MethodDescriptor createTableMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -89,6 +88,7 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { .setRequestMarshaller(ProtoUtils.marshaller(CreateTableRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Table.getDefaultInstance())) .build(); + private static final MethodDescriptor createTableFromSnapshotMethodDescriptor = MethodDescriptor.newBuilder() @@ -99,6 +99,7 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { ProtoUtils.marshaller(CreateTableFromSnapshotRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor listTablesMethodDescriptor = MethodDescriptor.newBuilder() @@ -107,6 +108,7 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { .setRequestMarshaller(ProtoUtils.marshaller(ListTablesRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(ListTablesResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getTableMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -114,6 +116,7 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { .setRequestMarshaller(ProtoUtils.marshaller(GetTableRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Table.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteTableMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -121,6 +124,7 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { .setRequestMarshaller(ProtoUtils.marshaller(DeleteTableRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor modifyColumnFamiliesMethodDescriptor = MethodDescriptor.newBuilder() @@ -130,6 +134,7 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { ProtoUtils.marshaller(ModifyColumnFamiliesRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Table.getDefaultInstance())) .build(); + private static final MethodDescriptor dropRowRangeMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -137,6 +142,7 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { .setRequestMarshaller(ProtoUtils.marshaller(DropRowRangeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor< GenerateConsistencyTokenRequest, GenerateConsistencyTokenResponse> generateConsistencyTokenMethodDescriptor = @@ -150,6 +156,7 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { .setResponseMarshaller( ProtoUtils.marshaller(GenerateConsistencyTokenResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor checkConsistencyMethodDescriptor = MethodDescriptor.newBuilder() @@ -160,30 +167,7 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { .setResponseMarshaller( ProtoUtils.marshaller(CheckConsistencyResponse.getDefaultInstance())) .build(); - private static final MethodDescriptor getIamPolicyMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.bigtable.admin.v2.BigtableTableAdmin/GetIamPolicy") - .setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) - .build(); - private static final MethodDescriptor setIamPolicyMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.bigtable.admin.v2.BigtableTableAdmin/SetIamPolicy") - .setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) - .build(); - private static final MethodDescriptor - testIamPermissionsMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.bigtable.admin.v2.BigtableTableAdmin/TestIamPermissions") - .setRequestMarshaller( - ProtoUtils.marshaller(TestIamPermissionsRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) - .build(); + private static final MethodDescriptor snapshotTableMethodDescriptor = MethodDescriptor.newBuilder() @@ -193,6 +177,7 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { ProtoUtils.marshaller(SnapshotTableRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor getSnapshotMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -200,6 +185,7 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { .setRequestMarshaller(ProtoUtils.marshaller(GetSnapshotRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Snapshot.getDefaultInstance())) .build(); + private static final MethodDescriptor listSnapshotsMethodDescriptor = MethodDescriptor.newBuilder() @@ -210,6 +196,7 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { .setResponseMarshaller( ProtoUtils.marshaller(ListSnapshotsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteSnapshotMethodDescriptor = MethodDescriptor.newBuilder() @@ -219,6 +206,7 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { ProtoUtils.marshaller(DeleteSnapshotRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + private static final MethodDescriptor createBackupMethodDescriptor = MethodDescriptor.newBuilder() @@ -227,6 +215,7 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { .setRequestMarshaller(ProtoUtils.marshaller(CreateBackupRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor getBackupMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -234,15 +223,7 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { .setRequestMarshaller(ProtoUtils.marshaller(GetBackupRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Backup.getDefaultInstance())) .build(); - private static final MethodDescriptor - listBackupsMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.bigtable.admin.v2.BigtableTableAdmin/ListBackups") - .setRequestMarshaller(ProtoUtils.marshaller(ListBackupsRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(ListBackupsResponse.getDefaultInstance())) - .build(); + private static final MethodDescriptor updateBackupMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -250,6 +231,7 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { .setRequestMarshaller(ProtoUtils.marshaller(UpdateBackupRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Backup.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteBackupMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -257,6 +239,17 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { .setRequestMarshaller(ProtoUtils.marshaller(DeleteBackupRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); + + private static final MethodDescriptor + listBackupsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.bigtable.admin.v2.BigtableTableAdmin/ListBackups") + .setRequestMarshaller(ProtoUtils.marshaller(ListBackupsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListBackupsResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor restoreTableMethodDescriptor = MethodDescriptor.newBuilder() @@ -266,8 +259,32 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; + private static final MethodDescriptor getIamPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.bigtable.admin.v2.BigtableTableAdmin/GetIamPolicy") + .setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .build(); + + private static final MethodDescriptor setIamPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.bigtable.admin.v2.BigtableTableAdmin/SetIamPolicy") + .setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + testIamPermissionsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.bigtable.admin.v2.BigtableTableAdmin/TestIamPermissions") + .setRequestMarshaller( + ProtoUtils.marshaller(TestIamPermissionsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) + .build(); private final UnaryCallable createTableCallable; private final UnaryCallable @@ -285,10 +302,6 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { generateConsistencyTokenCallable; private final UnaryCallable checkConsistencyCallable; - private final UnaryCallable getIamPolicyCallable; - private final UnaryCallable setIamPolicyCallable; - private final UnaryCallable - testIamPermissionsCallable; private final UnaryCallable snapshotTableCallable; private final OperationCallable snapshotTableOperationCallable; @@ -301,15 +314,21 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub { private final OperationCallable createBackupOperationCallable; private final UnaryCallable getBackupCallable; + private final UnaryCallable updateBackupCallable; + private final UnaryCallable deleteBackupCallable; private final UnaryCallable listBackupsCallable; private final UnaryCallable listBackupsPagedCallable; - private final UnaryCallable updateBackupCallable; - private final UnaryCallable deleteBackupCallable; private final UnaryCallable restoreTableCallable; private final OperationCallable restoreTableOperationCallable; + private final UnaryCallable getIamPolicyCallable; + private final UnaryCallable setIamPolicyCallable; + private final UnaryCallable + testIamPermissionsCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcBigtableTableAdminStub create(BigtableTableAdminStubSettings settings) @@ -473,46 +492,6 @@ public Map extract(CheckConsistencyRequest request) { } }) .build(); - GrpcCallSettings getIamPolicyTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(getIamPolicyMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetIamPolicyRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("resource", String.valueOf(request.getResource())); - return params.build(); - } - }) - .build(); - GrpcCallSettings setIamPolicyTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(setIamPolicyMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(SetIamPolicyRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("resource", String.valueOf(request.getResource())); - return params.build(); - } - }) - .build(); - GrpcCallSettings - testIamPermissionsTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(testIamPermissionsMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(TestIamPermissionsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("resource", String.valueOf(request.getResource())); - return params.build(); - } - }) - .build(); GrpcCallSettings snapshotTableTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(snapshotTableMethodDescriptor) @@ -591,19 +570,6 @@ public Map extract(GetBackupRequest request) { } }) .build(); - GrpcCallSettings listBackupsTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(listBackupsMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListBackupsRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } - }) - .build(); GrpcCallSettings updateBackupTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateBackupMethodDescriptor) @@ -630,6 +596,19 @@ public Map extract(DeleteBackupRequest request) { } }) .build(); + GrpcCallSettings listBackupsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listBackupsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListBackupsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); GrpcCallSettings restoreTableTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(restoreTableMethodDescriptor) @@ -643,6 +622,46 @@ public Map extract(RestoreTableRequest request) { } }) .build(); + GrpcCallSettings getIamPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getIamPolicyMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetIamPolicyRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("resource", String.valueOf(request.getResource())); + return params.build(); + } + }) + .build(); + GrpcCallSettings setIamPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(setIamPolicyMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(SetIamPolicyRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("resource", String.valueOf(request.getResource())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + testIamPermissionsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(testIamPermissionsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(TestIamPermissionsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("resource", String.valueOf(request.getResource())); + return params.build(); + } + }) + .build(); this.createTableCallable = callableFactory.createUnaryCallable( @@ -657,7 +676,7 @@ public Map extract(RestoreTableRequest request) { createTableFromSnapshotTransportSettings, settings.createTableFromSnapshotOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.listTablesCallable = callableFactory.createUnaryCallable( listTablesTransportSettings, settings.listTablesSettings(), clientContext); @@ -686,17 +705,6 @@ public Map extract(RestoreTableRequest request) { this.checkConsistencyCallable = callableFactory.createUnaryCallable( checkConsistencyTransportSettings, settings.checkConsistencySettings(), clientContext); - this.getIamPolicyCallable = - callableFactory.createUnaryCallable( - getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); - this.setIamPolicyCallable = - callableFactory.createUnaryCallable( - setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); - this.testIamPermissionsCallable = - callableFactory.createUnaryCallable( - testIamPermissionsTransportSettings, - settings.testIamPermissionsSettings(), - clientContext); this.snapshotTableCallable = callableFactory.createUnaryCallable( snapshotTableTransportSettings, settings.snapshotTableSettings(), clientContext); @@ -705,7 +713,7 @@ public Map extract(RestoreTableRequest request) { snapshotTableTransportSettings, settings.snapshotTableOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.getSnapshotCallable = callableFactory.createUnaryCallable( getSnapshotTransportSettings, settings.getSnapshotSettings(), clientContext); @@ -726,22 +734,22 @@ public Map extract(RestoreTableRequest request) { createBackupTransportSettings, settings.createBackupOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.getBackupCallable = callableFactory.createUnaryCallable( getBackupTransportSettings, settings.getBackupSettings(), clientContext); - this.listBackupsCallable = - callableFactory.createUnaryCallable( - listBackupsTransportSettings, settings.listBackupsSettings(), clientContext); - this.listBackupsPagedCallable = - callableFactory.createPagedCallable( - listBackupsTransportSettings, settings.listBackupsSettings(), clientContext); this.updateBackupCallable = callableFactory.createUnaryCallable( updateBackupTransportSettings, settings.updateBackupSettings(), clientContext); this.deleteBackupCallable = callableFactory.createUnaryCallable( deleteBackupTransportSettings, settings.deleteBackupSettings(), clientContext); + this.listBackupsCallable = + callableFactory.createUnaryCallable( + listBackupsTransportSettings, settings.listBackupsSettings(), clientContext); + this.listBackupsPagedCallable = + callableFactory.createPagedCallable( + listBackupsTransportSettings, settings.listBackupsSettings(), clientContext); this.restoreTableCallable = callableFactory.createUnaryCallable( restoreTableTransportSettings, settings.restoreTableSettings(), clientContext); @@ -750,12 +758,23 @@ public Map extract(RestoreTableRequest request) { restoreTableTransportSettings, settings.restoreTableOperationSettings(), clientContext, - this.operationsStub); + operationsStub); + this.getIamPolicyCallable = + callableFactory.createUnaryCallable( + getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); + this.setIamPolicyCallable = + callableFactory.createUnaryCallable( + setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); + this.testIamPermissionsCallable = + callableFactory.createUnaryCallable( + testIamPermissionsTransportSettings, + settings.testIamPermissionsSettings(), + clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public GrpcOperationsStub getOperationsStub() { return operationsStub; } @@ -764,25 +783,24 @@ public UnaryCallable createTableCallable() { return createTableCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public OperationCallable - createTableFromSnapshotOperationCallable() { - return createTableFromSnapshotOperationCallable; - } - public UnaryCallable createTableFromSnapshotCallable() { return createTableFromSnapshotCallable; } - public UnaryCallable listTablesPagedCallable() { - return listTablesPagedCallable; + public OperationCallable + createTableFromSnapshotOperationCallable() { + return createTableFromSnapshotOperationCallable; } public UnaryCallable listTablesCallable() { return listTablesCallable; } + public UnaryCallable listTablesPagedCallable() { + return listTablesPagedCallable; + } + public UnaryCallable getTableCallable() { return getTableCallable; } @@ -809,84 +827,81 @@ public UnaryCallable dropRowRangeCallable() { return checkConsistencyCallable; } - public UnaryCallable getIamPolicyCallable() { - return getIamPolicyCallable; - } - - public UnaryCallable setIamPolicyCallable() { - return setIamPolicyCallable; - } - - public UnaryCallable - testIamPermissionsCallable() { - return testIamPermissionsCallable; + public UnaryCallable snapshotTableCallable() { + return snapshotTableCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable snapshotTableOperationCallable() { return snapshotTableOperationCallable; } - public UnaryCallable snapshotTableCallable() { - return snapshotTableCallable; - } - public UnaryCallable getSnapshotCallable() { return getSnapshotCallable; } + public UnaryCallable listSnapshotsCallable() { + return listSnapshotsCallable; + } + public UnaryCallable listSnapshotsPagedCallable() { return listSnapshotsPagedCallable; } - public UnaryCallable listSnapshotsCallable() { - return listSnapshotsCallable; - } - public UnaryCallable deleteSnapshotCallable() { return deleteSnapshotCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public UnaryCallable createBackupCallable() { + return createBackupCallable; + } + public OperationCallable createBackupOperationCallable() { return createBackupOperationCallable; } - public UnaryCallable createBackupCallable() { - return createBackupCallable; - } - public UnaryCallable getBackupCallable() { return getBackupCallable; } - public UnaryCallable listBackupsPagedCallable() { - return listBackupsPagedCallable; + public UnaryCallable updateBackupCallable() { + return updateBackupCallable; + } + + public UnaryCallable deleteBackupCallable() { + return deleteBackupCallable; } public UnaryCallable listBackupsCallable() { return listBackupsCallable; } - public UnaryCallable updateBackupCallable() { - return updateBackupCallable; + public UnaryCallable listBackupsPagedCallable() { + return listBackupsPagedCallable; } - public UnaryCallable deleteBackupCallable() { - return deleteBackupCallable; + public UnaryCallable restoreTableCallable() { + return restoreTableCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable restoreTableOperationCallable() { return restoreTableOperationCallable; } - public UnaryCallable restoreTableCallable() { - return restoreTableCallable; + public UnaryCallable getIamPolicyCallable() { + return getIamPolicyCallable; + } + + public UnaryCallable setIamPolicyCallable() { + return setIamPolicyCallable; + } + + public UnaryCallable + testIamPermissionsCallable() { + return testIamPermissionsCallable; } @Override diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableStub.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableStub.java index 08253c577..c6f188598 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableStub.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableStub.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.data.v2.stub; import com.google.api.core.InternalApi; @@ -33,7 +34,7 @@ import com.google.bigtable.v2.SampleRowKeysResponse; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** For internal use only. */ @Generated("by gapic-generator") @InternalApi diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableStubSettings.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableStubSettings.java index f7660e952..dfe0c0773 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableStubSettings.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/BigtableStubSettings.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.data.v2.stub; import com.google.api.core.ApiFunction; @@ -53,7 +54,7 @@ import javax.annotation.Generated; import org.threeten.bp.Duration; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** For internal use only. */ @Generated("by gapic-generator") @InternalApi @@ -119,10 +120,10 @@ public BigtableStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcBigtableStub.create(this); - } else { - throw new UnsupportedOperationException( - "Transport not supported: " + getTransportChannelProvider().getTransportName()); } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); } /** Returns a builder for the default ExecutorProvider for this service. */ @@ -192,7 +193,6 @@ protected BigtableStubSettings(Builder settingsBuilder) throws IOException { /** Builder for BigtableStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final ServerStreamingCallSettings.Builder readRowsSettings; private final ServerStreamingCallSettings.Builder @@ -204,7 +204,6 @@ public static class Builder extends StubSettings.Builder readModifyWriteRowSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -212,11 +211,18 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); definitions.put( - "idempotent", + "retry_policy_3_codes", ImmutableSet.copyOf(Lists.newArrayList())); + definitions.put( + "retry_policy_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); + definitions.put( + "retry_policy_4_codes", ImmutableSet.copyOf( Lists.newArrayList( - StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); - definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED))); + definitions.put( + "retry_policy_2_codes", ImmutableSet.copyOf(Lists.newArrayList())); + definitions.put( + "retry_policy_0_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -230,134 +236,140 @@ public static class Builder extends StubSettings.Builder>of( mutateRowSettings, checkAndMutateRowSettings, readModifyWriteRowSettings); - initDefaults(this); } + protected Builder(BigtableStubSettings settings) { + super(settings); + + readRowsSettings = settings.readRowsSettings.toBuilder(); + sampleRowKeysSettings = settings.sampleRowKeysSettings.toBuilder(); + mutateRowSettings = settings.mutateRowSettings.toBuilder(); + mutateRowsSettings = settings.mutateRowsSettings.toBuilder(); + checkAndMutateRowSettings = settings.checkAndMutateRowSettings.toBuilder(); + readModifyWriteRowSettings = settings.readModifyWriteRowSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + mutateRowSettings, checkAndMutateRowSettings, readModifyWriteRowSettings); + } + private static Builder createDefault() { - Builder builder = new Builder((ClientContext) null); + Builder builder = new Builder(((ClientContext) null)); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); } private static Builder initDefaults(Builder builder) { - builder .readRowsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("read_rows_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params")); builder .sampleRowKeysSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); builder .mutateRowSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_4_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_4_params")); builder .mutateRowsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("mutate_rows_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params")); builder .checkAndMutateRowSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); builder .readModifyWriteRowSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("non_idempotent_params")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); return builder; } - protected Builder(BigtableStubSettings settings) { - super(settings); - - readRowsSettings = settings.readRowsSettings.toBuilder(); - sampleRowKeysSettings = settings.sampleRowKeysSettings.toBuilder(); - mutateRowSettings = settings.mutateRowSettings.toBuilder(); - mutateRowsSettings = settings.mutateRowsSettings.toBuilder(); - checkAndMutateRowSettings = settings.checkAndMutateRowSettings.toBuilder(); - readModifyWriteRowSettings = settings.readModifyWriteRowSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - mutateRowSettings, checkAndMutateRowSettings, readModifyWriteRowSettings); - } - - // NEXT_MAJOR_VER: remove 'throws Exception' + // NEXT_MAJOR_VER: remove 'throws Exception'. /** * Applies the given settings updater function to all of the unary API methods in this service. * diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/GrpcBigtableCallableFactory.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/GrpcBigtableCallableFactory.java index 34f06aed9..336518dd0 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/GrpcBigtableCallableFactory.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/GrpcBigtableCallableFactory.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.data.v2.stub; -import com.google.api.core.BetaApi; import com.google.api.core.InternalApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; @@ -32,14 +32,16 @@ import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** For internal use only. */ @Generated("by gapic-generator") @InternalApi public class GrpcBigtableCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -52,61 +54,58 @@ public UnaryCallable createUnaryCalla public UnaryCallable createPagedCallable( GrpcCallSettings grpcCallSettings, - PagedCallSettings pagedCallSettings, + PagedCallSettings callSettings, ClientContext clientContext) { - return GrpcCallableFactory.createPagedCallable( - grpcCallSettings, pagedCallSettings, clientContext); + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); } @Override public UnaryCallable createBatchingCallable( GrpcCallSettings grpcCallSettings, - BatchingCallSettings batchingCallSettings, + BatchingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( - grpcCallSettings, batchingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") @Override public OperationCallable createOperationCallable( - GrpcCallSettings grpcCallSettings, - OperationCallSettings operationCallSettings, + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( - grpcCallSettings, operationCallSettings, clientContext, operationsStub); + grpcCallSettings, callSettings, clientContext, operationsStub); } @Override public BidiStreamingCallable createBidiStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ServerStreamingCallable createServerStreamingCallable( GrpcCallSettings grpcCallSettings, - ServerStreamingCallSettings streamingCallSettings, + ServerStreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } @Override public ClientStreamingCallable createClientStreamingCallable( GrpcCallSettings grpcCallSettings, - StreamingCallSettings streamingCallSettings, + StreamingCallSettings callSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( - grpcCallSettings, streamingCallSettings, clientContext); + grpcCallSettings, callSettings, clientContext); } } diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/GrpcBigtableStub.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/GrpcBigtableStub.java index 155be0595..5fffb87ca 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/GrpcBigtableStub.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/GrpcBigtableStub.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.data.v2.stub; import com.google.api.core.InternalApi; @@ -37,6 +38,7 @@ import com.google.bigtable.v2.SampleRowKeysRequest; import com.google.bigtable.v2.SampleRowKeysResponse; import com.google.common.collect.ImmutableMap; +import com.google.longrunning.stub.GrpcOperationsStub; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; import java.io.IOException; @@ -44,12 +46,11 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** For internal use only. */ @Generated("by gapic-generator") @InternalApi public class GrpcBigtableStub extends BigtableStub { - private static final MethodDescriptor readRowsMethodDescriptor = MethodDescriptor.newBuilder() @@ -58,6 +59,7 @@ public class GrpcBigtableStub extends BigtableStub { .setRequestMarshaller(ProtoUtils.marshaller(ReadRowsRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(ReadRowsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor sampleRowKeysMethodDescriptor = MethodDescriptor.newBuilder() @@ -68,6 +70,7 @@ public class GrpcBigtableStub extends BigtableStub { .setResponseMarshaller( ProtoUtils.marshaller(SampleRowKeysResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor mutateRowMethodDescriptor = MethodDescriptor.newBuilder() @@ -76,6 +79,7 @@ public class GrpcBigtableStub extends BigtableStub { .setRequestMarshaller(ProtoUtils.marshaller(MutateRowRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(MutateRowResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor mutateRowsMethodDescriptor = MethodDescriptor.newBuilder() @@ -84,6 +88,7 @@ public class GrpcBigtableStub extends BigtableStub { .setRequestMarshaller(ProtoUtils.marshaller(MutateRowsRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(MutateRowsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor checkAndMutateRowMethodDescriptor = MethodDescriptor.newBuilder() @@ -94,6 +99,7 @@ public class GrpcBigtableStub extends BigtableStub { .setResponseMarshaller( ProtoUtils.marshaller(CheckAndMutateRowResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor readModifyWriteRowMethodDescriptor = MethodDescriptor.newBuilder() @@ -105,8 +111,6 @@ public class GrpcBigtableStub extends BigtableStub { ProtoUtils.marshaller(ReadModifyWriteRowResponse.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final ServerStreamingCallable readRowsCallable; private final ServerStreamingCallable sampleRowKeysCallable; @@ -117,6 +121,8 @@ public class GrpcBigtableStub extends BigtableStub { private final UnaryCallable readModifyWriteRowCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcBigtableStub create(BigtableStubSettings settings) throws IOException { @@ -152,6 +158,7 @@ protected GrpcBigtableStub( GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings readRowsTransportSettings = GrpcCallSettings.newBuilder() @@ -257,7 +264,12 @@ public Map extract(ReadModifyWriteRowRequest request) { settings.readModifyWriteRowSettings(), clientContext); - backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; } public ServerStreamingCallable readRowsCallable() { diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminClientTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminClientTest.java index f86e71896..35f45fee3 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminClientTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminClientTest.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.admin.v2; import static com.google.cloud.bigtable.admin.v2.BaseBigtableInstanceAdminClient.ListAppProfilesPagedResponse; @@ -50,8 +51,10 @@ import com.google.bigtable.admin.v2.LocationName; import com.google.bigtable.admin.v2.PartialUpdateInstanceRequest; import com.google.bigtable.admin.v2.ProjectName; +import com.google.bigtable.admin.v2.TableName; import com.google.bigtable.admin.v2.UpdateAppProfileRequest; import com.google.common.collect.Lists; +import com.google.iam.v1.Binding; import com.google.iam.v1.GetIamPolicyRequest; import com.google.iam.v1.Policy; import com.google.iam.v1.SetIamPolicyRequest; @@ -63,7 +66,6 @@ import com.google.protobuf.ByteString; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.ArrayList; @@ -71,9 +73,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.UUID; import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -81,34 +83,32 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class BaseBigtableInstanceAdminClientTest { - private static MockBigtableInstanceAdmin mockBigtableInstanceAdmin; - private static MockBigtableTableAdmin mockBigtableTableAdmin; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private BaseBigtableInstanceAdminClient client; + private static MockBigtableInstanceAdmin mockBigtableInstanceAdmin; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { mockBigtableInstanceAdmin = new MockBigtableInstanceAdmin(); - mockBigtableTableAdmin = new MockBigtableTableAdmin(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( UUID.randomUUID().toString(), - Arrays.asList(mockBigtableInstanceAdmin, mockBigtableTableAdmin)); - serviceHelper.start(); + Arrays.asList(mockBigtableInstanceAdmin)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); BaseBigtableInstanceAdminSettings settings = BaseBigtableInstanceAdminSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -123,12 +123,13 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") public void createInstanceTest() throws Exception { - InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String displayName = "displayName1615086568"; Instance expectedResponse = - Instance.newBuilder().setName(name.toString()).setDisplayName(displayName).build(); + Instance.newBuilder() + .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .build(); Operation resultOperation = Operation.newBuilder() .setName("createInstanceTest") @@ -138,7 +139,7 @@ public void createInstanceTest() throws Exception { mockBigtableInstanceAdmin.addResponse(resultOperation); ProjectName parent = ProjectName.of("[PROJECT]"); - String instanceId = "instanceId-2101995259"; + String instanceId = "instanceId902024336"; Instance instance = Instance.newBuilder().build(); Map clusters = new HashMap<>(); @@ -148,9 +149,9 @@ public void createInstanceTest() throws Exception { List actualRequests = mockBigtableInstanceAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateInstanceRequest actualRequest = (CreateInstanceRequest) actualRequests.get(0); + CreateInstanceRequest actualRequest = ((CreateInstanceRequest) actualRequests.get(0)); - Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(instanceId, actualRequest.getInstanceId()); Assert.assertEquals(instance, actualRequest.getInstance()); Assert.assertEquals(clusters, actualRequest.getClustersMap()); @@ -161,33 +162,90 @@ public void createInstanceTest() throws Exception { } @Test - @SuppressWarnings("all") public void createInstanceExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableInstanceAdmin.addException(exception); try { ProjectName parent = ProjectName.of("[PROJECT]"); - String instanceId = "instanceId-2101995259"; + String instanceId = "instanceId902024336"; Instance instance = Instance.newBuilder().build(); Map clusters = new HashMap<>(); + client.createInstanceAsync(parent, instanceId, instance, clusters).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void createInstanceTest2() throws Exception { + Instance expectedResponse = + Instance.newBuilder() + .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createInstanceTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockBigtableInstanceAdmin.addResponse(resultOperation); + + String parent = "parent-995424086"; + String instanceId = "instanceId902024336"; + Instance instance = Instance.newBuilder().build(); + Map clusters = new HashMap<>(); + + Instance actualResponse = + client.createInstanceAsync(parent, instanceId, instance, clusters).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateInstanceRequest actualRequest = ((CreateInstanceRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(instanceId, actualRequest.getInstanceId()); + Assert.assertEquals(instance, actualRequest.getInstance()); + Assert.assertEquals(clusters, actualRequest.getClustersMap()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createInstanceExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableInstanceAdmin.addException(exception); + try { + String parent = "parent-995424086"; + String instanceId = "instanceId902024336"; + Instance instance = Instance.newBuilder().build(); + Map clusters = new HashMap<>(); client.createInstanceAsync(parent, instanceId, instance, clusters).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - @SuppressWarnings("all") - public void getInstanceTest() { - InstanceName name2 = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String displayName = "displayName1615086568"; + public void getInstanceTest() throws Exception { Instance expectedResponse = - Instance.newBuilder().setName(name2.toString()).setDisplayName(displayName).build(); + Instance.newBuilder() + .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .build(); mockBigtableInstanceAdmin.addResponse(expectedResponse); InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]"); @@ -197,9 +255,9 @@ public void getInstanceTest() { List actualRequests = mockBigtableInstanceAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetInstanceRequest actualRequest = (GetInstanceRequest) actualRequests.get(0); + GetInstanceRequest actualRequest = ((GetInstanceRequest) actualRequests.get(0)); - Assert.assertEquals(name, InstanceName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -207,27 +265,67 @@ public void getInstanceTest() { } @Test - @SuppressWarnings("all") public void getInstanceExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableInstanceAdmin.addException(exception); try { InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]"); + client.getInstance(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void getInstanceTest2() throws Exception { + Instance expectedResponse = + Instance.newBuilder() + .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .build(); + mockBigtableInstanceAdmin.addResponse(expectedResponse); + + String name = "name3373707"; + + Instance actualResponse = client.getInstance(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetInstanceRequest actualRequest = ((GetInstanceRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getInstanceExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableInstanceAdmin.addException(exception); + + try { + String name = "name3373707"; client.getInstance(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listInstancesTest() { - String nextPageToken = "nextPageToken-1530815211"; + public void listInstancesTest() throws Exception { ListInstancesResponse expectedResponse = - ListInstancesResponse.newBuilder().setNextPageToken(nextPageToken).build(); + ListInstancesResponse.newBuilder() + .addAllInstances(new ArrayList()) + .addAllFailedLocations(new ArrayList()) + .setNextPageToken("nextPageToken-1386094857") + .build(); mockBigtableInstanceAdmin.addResponse(expectedResponse); ProjectName parent = ProjectName.of("[PROJECT]"); @@ -237,9 +335,9 @@ public void listInstancesTest() { List actualRequests = mockBigtableInstanceAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListInstancesRequest actualRequest = (ListInstancesRequest) actualRequests.get(0); + ListInstancesRequest actualRequest = ((ListInstancesRequest) actualRequests.get(0)); - Assert.assertEquals(parent, ProjectName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -247,28 +345,121 @@ public void listInstancesTest() { } @Test - @SuppressWarnings("all") public void listInstancesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableInstanceAdmin.addException(exception); try { ProjectName parent = ProjectName.of("[PROJECT]"); + client.listInstances(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void listInstancesTest2() throws Exception { + ListInstancesResponse expectedResponse = + ListInstancesResponse.newBuilder() + .addAllInstances(new ArrayList()) + .addAllFailedLocations(new ArrayList()) + .setNextPageToken("nextPageToken-1386094857") + .build(); + mockBigtableInstanceAdmin.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListInstancesResponse actualResponse = client.listInstances(parent); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListInstancesRequest actualRequest = ((ListInstancesRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listInstancesExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableInstanceAdmin.addException(exception); + + try { + String parent = "parent-995424086"; client.listInstances(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. + } + } + + @Test + public void updateInstanceTest() throws Exception { + Instance expectedResponse = + Instance.newBuilder() + .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .build(); + mockBigtableInstanceAdmin.addResponse(expectedResponse); + + Instance request = + Instance.newBuilder() + .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .build(); + + Instance actualResponse = client.updateInstance(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + Instance actualRequest = ((Instance) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getDisplayName(), actualRequest.getDisplayName()); + Assert.assertEquals(request.getState(), actualRequest.getState()); + Assert.assertEquals(request.getType(), actualRequest.getType()); + Assert.assertEquals(request.getLabelsMap(), actualRequest.getLabelsMap()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateInstanceExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableInstanceAdmin.addException(exception); + + try { + Instance request = + Instance.newBuilder() + .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .build(); + client.updateInstance(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. } } @Test - @SuppressWarnings("all") public void partialUpdateInstanceTest() throws Exception { - InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String displayName = "displayName1615086568"; Instance expectedResponse = - Instance.newBuilder().setName(name.toString()).setDisplayName(displayName).build(); + Instance.newBuilder() + .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setDisplayName("displayName1714148973") + .putAllLabels(new HashMap()) + .build(); Operation resultOperation = Operation.newBuilder() .setName("partialUpdateInstanceTest") @@ -286,7 +477,7 @@ public void partialUpdateInstanceTest() throws Exception { List actualRequests = mockBigtableInstanceAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); PartialUpdateInstanceRequest actualRequest = - (PartialUpdateInstanceRequest) actualRequests.get(0); + ((PartialUpdateInstanceRequest) actualRequests.get(0)); Assert.assertEquals(instance, actualRequest.getInstance()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -297,27 +488,24 @@ public void partialUpdateInstanceTest() throws Exception { } @Test - @SuppressWarnings("all") public void partialUpdateInstanceExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableInstanceAdmin.addException(exception); try { Instance instance = Instance.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.partialUpdateInstanceAsync(instance, updateMask).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - @SuppressWarnings("all") - public void deleteInstanceTest() { + public void deleteInstanceTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockBigtableInstanceAdmin.addResponse(expectedResponse); @@ -327,9 +515,9 @@ public void deleteInstanceTest() { List actualRequests = mockBigtableInstanceAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteInstanceRequest actualRequest = (DeleteInstanceRequest) actualRequests.get(0); + DeleteInstanceRequest actualRequest = ((DeleteInstanceRequest) actualRequests.get(0)); - Assert.assertEquals(name, InstanceName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -337,32 +525,60 @@ public void deleteInstanceTest() { } @Test - @SuppressWarnings("all") public void deleteInstanceExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableInstanceAdmin.addException(exception); try { InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]"); + client.deleteInstance(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteInstanceTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockBigtableInstanceAdmin.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteInstance(name); + + List actualRequests = mockBigtableInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteInstanceRequest actualRequest = ((DeleteInstanceRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteInstanceExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableInstanceAdmin.addException(exception); + try { + String name = "name3373707"; client.deleteInstance(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") public void createClusterTest() throws Exception { - ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); - LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); - int serveNodes = 1288838783; Cluster expectedResponse = Cluster.newBuilder() - .setName(name.toString()) - .setLocation(location.toString()) - .setServeNodes(serveNodes) + .setName(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString()) + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setServeNodes(-1288838783) .build(); Operation resultOperation = Operation.newBuilder() @@ -373,7 +589,7 @@ public void createClusterTest() throws Exception { mockBigtableInstanceAdmin.addResponse(resultOperation); InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String clusterId = "clusterId240280960"; + String clusterId = "clusterId561939637"; Cluster cluster = Cluster.newBuilder().build(); Cluster actualResponse = client.createClusterAsync(parent, clusterId, cluster).get(); @@ -381,9 +597,9 @@ public void createClusterTest() throws Exception { List actualRequests = mockBigtableInstanceAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateClusterRequest actualRequest = (CreateClusterRequest) actualRequests.get(0); + CreateClusterRequest actualRequest = ((CreateClusterRequest) actualRequests.get(0)); - Assert.assertEquals(parent, InstanceName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(clusterId, actualRequest.getClusterId()); Assert.assertEquals(cluster, actualRequest.getCluster()); Assert.assertTrue( @@ -393,36 +609,84 @@ public void createClusterTest() throws Exception { } @Test - @SuppressWarnings("all") public void createClusterExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableInstanceAdmin.addException(exception); try { InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String clusterId = "clusterId240280960"; + String clusterId = "clusterId561939637"; Cluster cluster = Cluster.newBuilder().build(); + client.createClusterAsync(parent, clusterId, cluster).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + @Test + public void createClusterTest2() throws Exception { + Cluster expectedResponse = + Cluster.newBuilder() + .setName(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString()) + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setServeNodes(-1288838783) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createClusterTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockBigtableInstanceAdmin.addResponse(resultOperation); + + String parent = "parent-995424086"; + String clusterId = "clusterId561939637"; + Cluster cluster = Cluster.newBuilder().build(); + + Cluster actualResponse = client.createClusterAsync(parent, clusterId, cluster).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateClusterRequest actualRequest = ((CreateClusterRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(clusterId, actualRequest.getClusterId()); + Assert.assertEquals(cluster, actualRequest.getCluster()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createClusterExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableInstanceAdmin.addException(exception); + + try { + String parent = "parent-995424086"; + String clusterId = "clusterId561939637"; + Cluster cluster = Cluster.newBuilder().build(); client.createClusterAsync(parent, clusterId, cluster).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - @SuppressWarnings("all") - public void getClusterTest() { - ClusterName name2 = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); - LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); - int serveNodes = 1288838783; + public void getClusterTest() throws Exception { Cluster expectedResponse = Cluster.newBuilder() - .setName(name2.toString()) - .setLocation(location.toString()) - .setServeNodes(serveNodes) + .setName(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString()) + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setServeNodes(-1288838783) .build(); mockBigtableInstanceAdmin.addResponse(expectedResponse); @@ -433,9 +697,9 @@ public void getClusterTest() { List actualRequests = mockBigtableInstanceAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetClusterRequest actualRequest = (GetClusterRequest) actualRequests.get(0); + GetClusterRequest actualRequest = ((GetClusterRequest) actualRequests.get(0)); - Assert.assertEquals(name, ClusterName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -443,27 +707,67 @@ public void getClusterTest() { } @Test - @SuppressWarnings("all") public void getClusterExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableInstanceAdmin.addException(exception); try { ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); + client.getCluster(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void getClusterTest2() throws Exception { + Cluster expectedResponse = + Cluster.newBuilder() + .setName(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString()) + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setServeNodes(-1288838783) + .build(); + mockBigtableInstanceAdmin.addResponse(expectedResponse); + + String name = "name3373707"; + + Cluster actualResponse = client.getCluster(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetClusterRequest actualRequest = ((GetClusterRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getClusterExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableInstanceAdmin.addException(exception); + + try { + String name = "name3373707"; client.getCluster(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listClustersTest() { - String nextPageToken = "nextPageToken-1530815211"; + public void listClustersTest() throws Exception { ListClustersResponse expectedResponse = - ListClustersResponse.newBuilder().setNextPageToken(nextPageToken).build(); + ListClustersResponse.newBuilder() + .addAllClusters(new ArrayList()) + .addAllFailedLocations(new ArrayList()) + .setNextPageToken("nextPageToken-1386094857") + .build(); mockBigtableInstanceAdmin.addResponse(expectedResponse); InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); @@ -473,9 +777,9 @@ public void listClustersTest() { List actualRequests = mockBigtableInstanceAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListClustersRequest actualRequest = (ListClustersRequest) actualRequests.get(0); + ListClustersRequest actualRequest = ((ListClustersRequest) actualRequests.get(0)); - Assert.assertEquals(parent, InstanceName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -483,32 +787,66 @@ public void listClustersTest() { } @Test - @SuppressWarnings("all") public void listClustersExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableInstanceAdmin.addException(exception); try { InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); + client.listClusters(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listClustersTest2() throws Exception { + ListClustersResponse expectedResponse = + ListClustersResponse.newBuilder() + .addAllClusters(new ArrayList()) + .addAllFailedLocations(new ArrayList()) + .setNextPageToken("nextPageToken-1386094857") + .build(); + mockBigtableInstanceAdmin.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListClustersResponse actualResponse = client.listClusters(parent); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListClustersRequest actualRequest = ((ListClustersRequest) actualRequests.get(0)); + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listClustersExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableInstanceAdmin.addException(exception); + + try { + String parent = "parent-995424086"; client.listClusters(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") public void updateClusterTest() throws Exception { - ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); - LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); - int serveNodes2 = 1623486220; Cluster expectedResponse = Cluster.newBuilder() - .setName(name.toString()) - .setLocation(location.toString()) - .setServeNodes(serveNodes2) + .setName(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString()) + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setServeNodes(-1288838783) .build(); Operation resultOperation = Operation.newBuilder() @@ -518,17 +856,25 @@ public void updateClusterTest() throws Exception { .build(); mockBigtableInstanceAdmin.addResponse(resultOperation); - int serveNodes = 1288838783; - Cluster request = Cluster.newBuilder().setServeNodes(serveNodes).build(); + Cluster request = + Cluster.newBuilder() + .setName(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString()) + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setServeNodes(-1288838783) + .build(); Cluster actualResponse = client.updateClusterAsync(request).get(); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockBigtableInstanceAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - Cluster actualRequest = (Cluster) actualRequests.get(0); + Cluster actualRequest = ((Cluster) actualRequests.get(0)); - Assert.assertEquals(serveNodes, actualRequest.getServeNodes()); + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getLocation(), actualRequest.getLocation()); + Assert.assertEquals(request.getState(), actualRequest.getState()); + Assert.assertEquals(request.getServeNodes(), actualRequest.getServeNodes()); + Assert.assertEquals(request.getDefaultStorageType(), actualRequest.getDefaultStorageType()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -536,27 +882,28 @@ public void updateClusterTest() throws Exception { } @Test - @SuppressWarnings("all") public void updateClusterExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableInstanceAdmin.addException(exception); try { - int serveNodes = 1288838783; - Cluster request = Cluster.newBuilder().setServeNodes(serveNodes).build(); - + Cluster request = + Cluster.newBuilder() + .setName(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString()) + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setServeNodes(-1288838783) + .build(); client.updateClusterAsync(request).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - @SuppressWarnings("all") - public void deleteClusterTest() { + public void deleteClusterTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockBigtableInstanceAdmin.addResponse(expectedResponse); @@ -566,9 +913,9 @@ public void deleteClusterTest() { List actualRequests = mockBigtableInstanceAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteClusterRequest actualRequest = (DeleteClusterRequest) actualRequests.get(0); + DeleteClusterRequest actualRequest = ((DeleteClusterRequest) actualRequests.get(0)); - Assert.assertEquals(name, ClusterName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -576,37 +923,65 @@ public void deleteClusterTest() { } @Test - @SuppressWarnings("all") public void deleteClusterExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableInstanceAdmin.addException(exception); try { ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); + client.deleteCluster(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteClusterTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockBigtableInstanceAdmin.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteCluster(name); + + List actualRequests = mockBigtableInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteClusterRequest actualRequest = ((DeleteClusterRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + @Test + public void deleteClusterExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableInstanceAdmin.addException(exception); + + try { + String name = "name3373707"; client.deleteCluster(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createAppProfileTest() { - AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]"); - String etag = "etag3123477"; - String description = "description-1724546052"; + public void createAppProfileTest() throws Exception { AppProfile expectedResponse = AppProfile.newBuilder() - .setName(name.toString()) - .setEtag(etag) - .setDescription(description) + .setName(AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]").toString()) + .setEtag("etag3123477") + .setDescription("description-1724546052") .build(); mockBigtableInstanceAdmin.addResponse(expectedResponse); InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String appProfileId = "appProfileId1262094415"; + String appProfileId = "appProfileId704923523"; AppProfile appProfile = AppProfile.newBuilder().build(); AppProfile actualResponse = client.createAppProfile(parent, appProfileId, appProfile); @@ -614,9 +989,9 @@ public void createAppProfileTest() { List actualRequests = mockBigtableInstanceAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateAppProfileRequest actualRequest = (CreateAppProfileRequest) actualRequests.get(0); + CreateAppProfileRequest actualRequest = ((CreateAppProfileRequest) actualRequests.get(0)); - Assert.assertEquals(parent, InstanceName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(appProfileId, actualRequest.getAppProfileId()); Assert.assertEquals(appProfile, actualRequest.getAppProfile()); Assert.assertTrue( @@ -626,34 +1001,74 @@ public void createAppProfileTest() { } @Test - @SuppressWarnings("all") public void createAppProfileExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableInstanceAdmin.addException(exception); try { InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String appProfileId = "appProfileId1262094415"; + String appProfileId = "appProfileId704923523"; AppProfile appProfile = AppProfile.newBuilder().build(); + client.createAppProfile(parent, appProfileId, appProfile); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void createAppProfileTest2() throws Exception { + AppProfile expectedResponse = + AppProfile.newBuilder() + .setName(AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]").toString()) + .setEtag("etag3123477") + .setDescription("description-1724546052") + .build(); + mockBigtableInstanceAdmin.addResponse(expectedResponse); + + String parent = "parent-995424086"; + String appProfileId = "appProfileId704923523"; + AppProfile appProfile = AppProfile.newBuilder().build(); + + AppProfile actualResponse = client.createAppProfile(parent, appProfileId, appProfile); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateAppProfileRequest actualRequest = ((CreateAppProfileRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(appProfileId, actualRequest.getAppProfileId()); + Assert.assertEquals(appProfile, actualRequest.getAppProfile()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createAppProfileExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableInstanceAdmin.addException(exception); + + try { + String parent = "parent-995424086"; + String appProfileId = "appProfileId704923523"; + AppProfile appProfile = AppProfile.newBuilder().build(); client.createAppProfile(parent, appProfileId, appProfile); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getAppProfileTest() { - AppProfileName name2 = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]"); - String etag = "etag3123477"; - String description = "description-1724546052"; + public void getAppProfileTest() throws Exception { AppProfile expectedResponse = AppProfile.newBuilder() - .setName(name2.toString()) - .setEtag(etag) - .setDescription(description) + .setName(AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]").toString()) + .setEtag("etag3123477") + .setDescription("description-1724546052") .build(); mockBigtableInstanceAdmin.addResponse(expectedResponse); @@ -664,9 +1079,9 @@ public void getAppProfileTest() { List actualRequests = mockBigtableInstanceAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetAppProfileRequest actualRequest = (GetAppProfileRequest) actualRequests.get(0); + GetAppProfileRequest actualRequest = ((GetAppProfileRequest) actualRequests.get(0)); - Assert.assertEquals(name, AppProfileName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -674,31 +1089,66 @@ public void getAppProfileTest() { } @Test - @SuppressWarnings("all") public void getAppProfileExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableInstanceAdmin.addException(exception); try { AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]"); + client.getAppProfile(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + @Test + public void getAppProfileTest2() throws Exception { + AppProfile expectedResponse = + AppProfile.newBuilder() + .setName(AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]").toString()) + .setEtag("etag3123477") + .setDescription("description-1724546052") + .build(); + mockBigtableInstanceAdmin.addResponse(expectedResponse); + + String name = "name3373707"; + + AppProfile actualResponse = client.getAppProfile(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetAppProfileRequest actualRequest = ((GetAppProfileRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getAppProfileExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableInstanceAdmin.addException(exception); + + try { + String name = "name3373707"; client.getAppProfile(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listAppProfilesTest() { - String nextPageToken = ""; - AppProfile appProfilesElement = AppProfile.newBuilder().build(); - List appProfiles = Arrays.asList(appProfilesElement); + public void listAppProfilesTest() throws Exception { + AppProfile responsesElement = AppProfile.newBuilder().build(); ListAppProfilesResponse expectedResponse = ListAppProfilesResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllAppProfiles(appProfiles) + .setNextPageToken("") + .addAllAppProfiles(Arrays.asList(responsesElement)) .build(); mockBigtableInstanceAdmin.addResponse(expectedResponse); @@ -707,14 +1157,15 @@ public void listAppProfilesTest() { ListAppProfilesPagedResponse pagedListResponse = client.listAppProfiles(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getAppProfilesList().get(0), resources.get(0)); List actualRequests = mockBigtableInstanceAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListAppProfilesRequest actualRequest = (ListAppProfilesRequest) actualRequests.get(0); + ListAppProfilesRequest actualRequest = ((ListAppProfilesRequest) actualRequests.get(0)); - Assert.assertEquals(parent, InstanceName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -722,32 +1173,70 @@ public void listAppProfilesTest() { } @Test - @SuppressWarnings("all") public void listAppProfilesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableInstanceAdmin.addException(exception); try { InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); + client.listAppProfiles(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAppProfilesTest2() throws Exception { + AppProfile responsesElement = AppProfile.newBuilder().build(); + ListAppProfilesResponse expectedResponse = + ListAppProfilesResponse.newBuilder() + .setNextPageToken("") + .addAllAppProfiles(Arrays.asList(responsesElement)) + .build(); + mockBigtableInstanceAdmin.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListAppProfilesPagedResponse pagedListResponse = client.listAppProfiles(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAppProfilesList().get(0), resources.get(0)); + + List actualRequests = mockBigtableInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListAppProfilesRequest actualRequest = ((ListAppProfilesRequest) actualRequests.get(0)); + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listAppProfilesExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableInstanceAdmin.addException(exception); + + try { + String parent = "parent-995424086"; client.listAppProfiles(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") public void updateAppProfileTest() throws Exception { - AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]"); - String etag = "etag3123477"; - String description = "description-1724546052"; AppProfile expectedResponse = AppProfile.newBuilder() - .setName(name.toString()) - .setEtag(etag) - .setDescription(description) + .setName(AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]").toString()) + .setEtag("etag3123477") + .setDescription("description-1724546052") .build(); Operation resultOperation = Operation.newBuilder() @@ -765,7 +1254,7 @@ public void updateAppProfileTest() throws Exception { List actualRequests = mockBigtableInstanceAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateAppProfileRequest actualRequest = (UpdateAppProfileRequest) actualRequests.get(0); + UpdateAppProfileRequest actualRequest = ((UpdateAppProfileRequest) actualRequests.get(0)); Assert.assertEquals(appProfile, actualRequest.getAppProfile()); Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); @@ -776,27 +1265,24 @@ public void updateAppProfileTest() throws Exception { } @Test - @SuppressWarnings("all") public void updateAppProfileExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableInstanceAdmin.addException(exception); try { AppProfile appProfile = AppProfile.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateAppProfileAsync(appProfile, updateMask).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - @SuppressWarnings("all") - public void deleteAppProfileTest() { + public void deleteAppProfileTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockBigtableInstanceAdmin.addResponse(expectedResponse); @@ -806,9 +1292,9 @@ public void deleteAppProfileTest() { List actualRequests = mockBigtableInstanceAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteAppProfileRequest actualRequest = (DeleteAppProfileRequest) actualRequests.get(0); + DeleteAppProfileRequest actualRequest = ((DeleteAppProfileRequest) actualRequests.get(0)); - Assert.assertEquals(name, AppProfileName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -816,39 +1302,73 @@ public void deleteAppProfileTest() { } @Test - @SuppressWarnings("all") public void deleteAppProfileExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableInstanceAdmin.addException(exception); try { AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]"); + client.deleteAppProfile(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteAppProfileTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockBigtableInstanceAdmin.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteAppProfile(name); + List actualRequests = mockBigtableInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteAppProfileRequest actualRequest = ((DeleteAppProfileRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteAppProfileExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableInstanceAdmin.addException(exception); + + try { + String name = "name3373707"; client.deleteAppProfile(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getIamPolicyTest() { - int version = 351608024; - ByteString etag = ByteString.copyFromUtf8("21"); - Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); + public void getIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); mockBigtableInstanceAdmin.addResponse(expectedResponse); - ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]"); + ResourceName resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); Policy actualResponse = client.getIamPolicy(resource); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockBigtableInstanceAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetIamPolicyRequest actualRequest = (GetIamPolicyRequest) actualRequests.get(0); + GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertEquals(resource.toString(), actualRequest.getResource()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -856,30 +1376,70 @@ public void getIamPolicyTest() { } @Test - @SuppressWarnings("all") public void getIamPolicyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableInstanceAdmin.addException(exception); try { - ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]"); + ResourceName resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + client.getIamPolicy(resource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getIamPolicyTest2() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockBigtableInstanceAdmin.addResponse(expectedResponse); + + String resource = "resource-341064690"; + + Policy actualResponse = client.getIamPolicy(resource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(resource, actualRequest.getResource()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getIamPolicyExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableInstanceAdmin.addException(exception); + try { + String resource = "resource-341064690"; client.getIamPolicy(resource); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void setIamPolicyTest() { - int version = 351608024; - ByteString etag = ByteString.copyFromUtf8("21"); - Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); + public void setIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); mockBigtableInstanceAdmin.addResponse(expectedResponse); - ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]"); + ResourceName resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); Policy policy = Policy.newBuilder().build(); Policy actualResponse = client.setIamPolicy(resource, policy); @@ -887,9 +1447,9 @@ public void setIamPolicyTest() { List actualRequests = mockBigtableInstanceAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - SetIamPolicyRequest actualRequest = (SetIamPolicyRequest) actualRequests.get(0); + SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertEquals(resource.toString(), actualRequest.getResource()); Assert.assertEquals(policy, actualRequest.getPolicy()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -898,29 +1458,70 @@ public void setIamPolicyTest() { } @Test - @SuppressWarnings("all") public void setIamPolicyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableInstanceAdmin.addException(exception); try { - ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]"); + ResourceName resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); Policy policy = Policy.newBuilder().build(); + client.setIamPolicy(resource, policy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void setIamPolicyTest2() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockBigtableInstanceAdmin.addResponse(expectedResponse); + + String resource = "resource-341064690"; + Policy policy = Policy.newBuilder().build(); + + Policy actualResponse = client.setIamPolicy(resource, policy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(resource, actualRequest.getResource()); + Assert.assertEquals(policy, actualRequest.getPolicy()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void setIamPolicyExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableInstanceAdmin.addException(exception); + try { + String resource = "resource-341064690"; + Policy policy = Policy.newBuilder().build(); client.setIamPolicy(resource, policy); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void testIamPermissionsTest() { - TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().build(); + public void testIamPermissionsTest() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); mockBigtableInstanceAdmin.addResponse(expectedResponse); - ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]"); + ResourceName resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); List permissions = new ArrayList<>(); TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions); @@ -928,9 +1529,9 @@ public void testIamPermissionsTest() { List actualRequests = mockBigtableInstanceAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - TestIamPermissionsRequest actualRequest = (TestIamPermissionsRequest) actualRequests.get(0); + TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertEquals(resource.toString(), actualRequest.getResource()); Assert.assertEquals(permissions, actualRequest.getPermissionsList()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -939,19 +1540,56 @@ public void testIamPermissionsTest() { } @Test - @SuppressWarnings("all") public void testIamPermissionsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableInstanceAdmin.addException(exception); try { - ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]"); + ResourceName resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); List permissions = new ArrayList<>(); + client.testIamPermissions(resource, permissions); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void testIamPermissionsTest2() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); + mockBigtableInstanceAdmin.addResponse(expectedResponse); + + String resource = "resource-341064690"; + List permissions = new ArrayList<>(); + + TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions); + Assert.assertEquals(expectedResponse, actualResponse); + List actualRequests = mockBigtableInstanceAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); + + Assert.assertEquals(resource, actualRequest.getResource()); + Assert.assertEquals(permissions, actualRequest.getPermissionsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void testIamPermissionsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableInstanceAdmin.addException(exception); + + try { + String resource = "resource-341064690"; + List permissions = new ArrayList<>(); client.testIamPermissions(resource, permissions); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } } diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminClientTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminClientTest.java index 33da842b5..ab78fe077 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminClientTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminClientTest.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.admin.v2; import static com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClient.ListBackupsPagedResponse; @@ -28,12 +29,12 @@ import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.StatusCode; import com.google.api.resourcenames.ResourceName; -import com.google.bigtable.admin.v2.AppProfileName; import com.google.bigtable.admin.v2.Backup; import com.google.bigtable.admin.v2.BackupName; import com.google.bigtable.admin.v2.CheckConsistencyRequest; import com.google.bigtable.admin.v2.CheckConsistencyResponse; import com.google.bigtable.admin.v2.ClusterName; +import com.google.bigtable.admin.v2.ColumnFamily; import com.google.bigtable.admin.v2.CreateBackupRequest; import com.google.bigtable.admin.v2.CreateTableFromSnapshotRequest; import com.google.bigtable.admin.v2.CreateTableRequest; @@ -54,6 +55,7 @@ import com.google.bigtable.admin.v2.ListTablesRequest; import com.google.bigtable.admin.v2.ListTablesResponse; import com.google.bigtable.admin.v2.ModifyColumnFamiliesRequest; +import com.google.bigtable.admin.v2.RestoreInfo; import com.google.bigtable.admin.v2.RestoreTableRequest; import com.google.bigtable.admin.v2.Snapshot; import com.google.bigtable.admin.v2.SnapshotName; @@ -62,6 +64,7 @@ import com.google.bigtable.admin.v2.TableName; import com.google.bigtable.admin.v2.UpdateBackupRequest; import com.google.common.collect.Lists; +import com.google.iam.v1.Binding; import com.google.iam.v1.GetIamPolicyRequest; import com.google.iam.v1.Policy; import com.google.iam.v1.SetIamPolicyRequest; @@ -73,15 +76,16 @@ import com.google.protobuf.ByteString; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; -import io.grpc.Status; +import com.google.protobuf.Timestamp; import io.grpc.StatusRuntimeException; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; -import java.util.Objects; import java.util.UUID; import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -89,34 +93,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class BaseBigtableTableAdminClientTest { - private static MockBigtableInstanceAdmin mockBigtableInstanceAdmin; private static MockBigtableTableAdmin mockBigtableTableAdmin; - private static MockServiceHelper serviceHelper; + private static MockServiceHelper mockServiceHelper; private BaseBigtableTableAdminClient client; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { - mockBigtableInstanceAdmin = new MockBigtableInstanceAdmin(); mockBigtableTableAdmin = new MockBigtableTableAdmin(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( - UUID.randomUUID().toString(), - Arrays.asList(mockBigtableInstanceAdmin, mockBigtableTableAdmin)); - serviceHelper.start(); + UUID.randomUUID().toString(), Arrays.asList(mockBigtableTableAdmin)); + mockServiceHelper.start(); } @AfterClass public static void stopServer() { - serviceHelper.stop(); + mockServiceHelper.stop(); } @Before public void setUp() throws IOException { - serviceHelper.reset(); - channelProvider = serviceHelper.createChannelProvider(); + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); BaseBigtableTableAdminSettings settings = BaseBigtableTableAdminSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -131,14 +132,18 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void createTableTest() { - TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); - Table expectedResponse = Table.newBuilder().setName(name.toString()).build(); + public void createTableTest() throws Exception { + Table expectedResponse = + Table.newBuilder() + .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString()) + .putAllClusterStates(new HashMap()) + .putAllColumnFamilies(new HashMap()) + .setRestoreInfo(RestoreInfo.newBuilder().build()) + .build(); mockBigtableTableAdmin.addResponse(expectedResponse); InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String tableId = "tableId-895419604"; + String tableId = "tableId-1552905847"; Table table = Table.newBuilder().build(); Table actualResponse = client.createTable(parent, tableId, table); @@ -146,9 +151,9 @@ public void createTableTest() { List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateTableRequest actualRequest = (CreateTableRequest) actualRequests.get(0); + CreateTableRequest actualRequest = ((CreateTableRequest) actualRequests.get(0)); - Assert.assertEquals(parent, InstanceName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(tableId, actualRequest.getTableId()); Assert.assertEquals(table, actualRequest.getTable()); Assert.assertTrue( @@ -158,28 +163,77 @@ public void createTableTest() { } @Test - @SuppressWarnings("all") public void createTableExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String tableId = "tableId-895419604"; + String tableId = "tableId-1552905847"; Table table = Table.newBuilder().build(); + client.createTable(parent, tableId, table); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createTableTest2() throws Exception { + Table expectedResponse = + Table.newBuilder() + .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString()) + .putAllClusterStates(new HashMap()) + .putAllColumnFamilies(new HashMap()) + .setRestoreInfo(RestoreInfo.newBuilder().build()) + .build(); + mockBigtableTableAdmin.addResponse(expectedResponse); + + String parent = "parent-995424086"; + String tableId = "tableId-1552905847"; + Table table = Table.newBuilder().build(); + + Table actualResponse = client.createTable(parent, tableId, table); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateTableRequest actualRequest = ((CreateTableRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(tableId, actualRequest.getTableId()); + Assert.assertEquals(table, actualRequest.getTable()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + @Test + public void createTableExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + String parent = "parent-995424086"; + String tableId = "tableId-1552905847"; + Table table = Table.newBuilder().build(); client.createTable(parent, tableId, table); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") public void createTableFromSnapshotTest() throws Exception { - TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); - Table expectedResponse = Table.newBuilder().setName(name.toString()).build(); + Table expectedResponse = + Table.newBuilder() + .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString()) + .putAllClusterStates(new HashMap()) + .putAllColumnFamilies(new HashMap()) + .setRestoreInfo(RestoreInfo.newBuilder().build()) + .build(); Operation resultOperation = Operation.newBuilder() .setName("createTableFromSnapshotTest") @@ -189,7 +243,7 @@ public void createTableFromSnapshotTest() throws Exception { mockBigtableTableAdmin.addResponse(resultOperation); InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String tableId = "tableId-895419604"; + String tableId = "tableId-1552905847"; SnapshotName sourceSnapshot = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"); @@ -200,11 +254,11 @@ public void createTableFromSnapshotTest() throws Exception { List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); CreateTableFromSnapshotRequest actualRequest = - (CreateTableFromSnapshotRequest) actualRequests.get(0); + ((CreateTableFromSnapshotRequest) actualRequests.get(0)); - Assert.assertEquals(parent, InstanceName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertEquals(tableId, actualRequest.getTableId()); - Assert.assertEquals(sourceSnapshot, SnapshotName.parse(actualRequest.getSourceSnapshot())); + Assert.assertEquals(sourceSnapshot.toString(), actualRequest.getSourceSnapshot()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -212,52 +266,57 @@ public void createTableFromSnapshotTest() throws Exception { } @Test - @SuppressWarnings("all") public void createTableFromSnapshotExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String tableId = "tableId-895419604"; + String tableId = "tableId-1552905847"; SnapshotName sourceSnapshot = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"); - client.createTableFromSnapshotAsync(parent, tableId, sourceSnapshot).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - @SuppressWarnings("all") - public void listTablesTest() { - String nextPageToken = ""; - Table tablesElement = Table.newBuilder().build(); - List
tables = Arrays.asList(tablesElement); - ListTablesResponse expectedResponse = - ListTablesResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllTables(tables) + public void createTableFromSnapshotTest2() throws Exception { + Table expectedResponse = + Table.newBuilder() + .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString()) + .putAllClusterStates(new HashMap()) + .putAllColumnFamilies(new HashMap()) + .setRestoreInfo(RestoreInfo.newBuilder().build()) .build(); - mockBigtableTableAdmin.addResponse(expectedResponse); + Operation resultOperation = + Operation.newBuilder() + .setName("createTableFromSnapshotTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockBigtableTableAdmin.addResponse(resultOperation); InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); + String tableId = "tableId-1552905847"; + String sourceSnapshot = "sourceSnapshot-1078634753"; - ListTablesPagedResponse pagedListResponse = client.listTables(parent); - - List
resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getTablesList().get(0), resources.get(0)); + Table actualResponse = + client.createTableFromSnapshotAsync(parent, tableId, sourceSnapshot).get(); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListTablesRequest actualRequest = (ListTablesRequest) actualRequests.get(0); + CreateTableFromSnapshotRequest actualRequest = + ((CreateTableFromSnapshotRequest) actualRequests.get(0)); - Assert.assertEquals(parent, InstanceName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(tableId, actualRequest.getTableId()); + Assert.assertEquals(sourceSnapshot, actualRequest.getSourceSnapshot()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -265,38 +324,57 @@ public void listTablesTest() { } @Test - @SuppressWarnings("all") - public void listTablesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void createTableFromSnapshotExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); - - client.listTables(parent); + String tableId = "tableId-1552905847"; + String sourceSnapshot = "sourceSnapshot-1078634753"; + client.createTableFromSnapshotAsync(parent, tableId, sourceSnapshot).get(); Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - @SuppressWarnings("all") - public void getTableTest() { - TableName name2 = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); - Table expectedResponse = Table.newBuilder().setName(name2.toString()).build(); - mockBigtableTableAdmin.addResponse(expectedResponse); + public void createTableFromSnapshotTest3() throws Exception { + Table expectedResponse = + Table.newBuilder() + .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString()) + .putAllClusterStates(new HashMap()) + .putAllColumnFamilies(new HashMap()) + .setRestoreInfo(RestoreInfo.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createTableFromSnapshotTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockBigtableTableAdmin.addResponse(resultOperation); - TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + String parent = "parent-995424086"; + String tableId = "tableId-1552905847"; + SnapshotName sourceSnapshot = + SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"); - Table actualResponse = client.getTable(name); + Table actualResponse = + client.createTableFromSnapshotAsync(parent, tableId, sourceSnapshot).get(); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetTableRequest actualRequest = (GetTableRequest) actualRequests.get(0); + CreateTableFromSnapshotRequest actualRequest = + ((CreateTableFromSnapshotRequest) actualRequests.get(0)); - Assert.assertEquals(name, TableName.parse(actualRequest.getName())); + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(tableId, actualRequest.getTableId()); + Assert.assertEquals(sourceSnapshot.toString(), actualRequest.getSourceSnapshot()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -304,36 +382,57 @@ public void getTableTest() { } @Test - @SuppressWarnings("all") - public void getTableExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void createTableFromSnapshotExceptionTest3() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { - TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); - - client.getTable(name); + String parent = "parent-995424086"; + String tableId = "tableId-1552905847"; + SnapshotName sourceSnapshot = + SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"); + client.createTableFromSnapshotAsync(parent, tableId, sourceSnapshot).get(); Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - @SuppressWarnings("all") - public void deleteTableTest() { - Empty expectedResponse = Empty.newBuilder().build(); - mockBigtableTableAdmin.addResponse(expectedResponse); + public void createTableFromSnapshotTest4() throws Exception { + Table expectedResponse = + Table.newBuilder() + .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString()) + .putAllClusterStates(new HashMap()) + .putAllColumnFamilies(new HashMap()) + .setRestoreInfo(RestoreInfo.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createTableFromSnapshotTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockBigtableTableAdmin.addResponse(resultOperation); - TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + String parent = "parent-995424086"; + String tableId = "tableId-1552905847"; + String sourceSnapshot = "sourceSnapshot-1078634753"; - client.deleteTable(name); + Table actualResponse = + client.createTableFromSnapshotAsync(parent, tableId, sourceSnapshot).get(); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteTableRequest actualRequest = (DeleteTableRequest) actualRequests.get(0); + CreateTableFromSnapshotRequest actualRequest = + ((CreateTableFromSnapshotRequest) actualRequests.get(0)); - Assert.assertEquals(name, TableName.parse(actualRequest.getName())); + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(tableId, actualRequest.getTableId()); + Assert.assertEquals(sourceSnapshot, actualRequest.getSourceSnapshot()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -341,40 +440,47 @@ public void deleteTableTest() { } @Test - @SuppressWarnings("all") - public void deleteTableExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void createTableFromSnapshotExceptionTest4() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { - TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); - - client.deleteTable(name); + String parent = "parent-995424086"; + String tableId = "tableId-1552905847"; + String sourceSnapshot = "sourceSnapshot-1078634753"; + client.createTableFromSnapshotAsync(parent, tableId, sourceSnapshot).get(); Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - @SuppressWarnings("all") - public void modifyColumnFamiliesTest() { - TableName name2 = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); - Table expectedResponse = Table.newBuilder().setName(name2.toString()).build(); + public void listTablesTest() throws Exception { + Table responsesElement = Table.newBuilder().build(); + ListTablesResponse expectedResponse = + ListTablesResponse.newBuilder() + .setNextPageToken("") + .addAllTables(Arrays.asList(responsesElement)) + .build(); mockBigtableTableAdmin.addResponse(expectedResponse); - TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); - List modifications = new ArrayList<>(); + InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); - Table actualResponse = client.modifyColumnFamilies(name, modifications); - Assert.assertEquals(expectedResponse, actualResponse); + ListTablesPagedResponse pagedListResponse = client.listTables(parent); + + List
resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getTablesList().get(0), resources.get(0)); List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ModifyColumnFamiliesRequest actualRequest = (ModifyColumnFamiliesRequest) actualRequests.get(0); + ListTablesRequest actualRequest = ((ListTablesRequest) actualRequests.get(0)); - Assert.assertEquals(name, TableName.parse(actualRequest.getName())); - Assert.assertEquals(modifications, actualRequest.getModificationsList()); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -382,38 +488,43 @@ public void modifyColumnFamiliesTest() { } @Test - @SuppressWarnings("all") - public void modifyColumnFamiliesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void listTablesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { - TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); - List modifications = new ArrayList<>(); - - client.modifyColumnFamilies(name, modifications); + InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); + client.listTables(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void dropRowRangeTest() { - Empty expectedResponse = Empty.newBuilder().build(); + public void listTablesTest2() throws Exception { + Table responsesElement = Table.newBuilder().build(); + ListTablesResponse expectedResponse = + ListTablesResponse.newBuilder() + .setNextPageToken("") + .addAllTables(Arrays.asList(responsesElement)) + .build(); mockBigtableTableAdmin.addResponse(expectedResponse); - TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); - DropRowRangeRequest request = DropRowRangeRequest.newBuilder().setName(name.toString()).build(); + String parent = "parent-995424086"; - client.dropRowRange(request); + ListTablesPagedResponse pagedListResponse = client.listTables(parent); + + List
resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getTablesList().get(0), resources.get(0)); List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DropRowRangeRequest actualRequest = (DropRowRangeRequest) actualRequests.get(0); + ListTablesRequest actualRequest = ((ListTablesRequest) actualRequests.get(0)); - Assert.assertEquals(name, TableName.parse(actualRequest.getName())); + Assert.assertEquals(parent, actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -421,42 +532,40 @@ public void dropRowRangeTest() { } @Test - @SuppressWarnings("all") - public void dropRowRangeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void listTablesExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { - TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); - DropRowRangeRequest request = - DropRowRangeRequest.newBuilder().setName(name.toString()).build(); - - client.dropRowRange(request); + String parent = "parent-995424086"; + client.listTables(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void generateConsistencyTokenTest() { - String consistencyToken = "consistencyToken-1090516718"; - GenerateConsistencyTokenResponse expectedResponse = - GenerateConsistencyTokenResponse.newBuilder().setConsistencyToken(consistencyToken).build(); + public void getTableTest() throws Exception { + Table expectedResponse = + Table.newBuilder() + .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString()) + .putAllClusterStates(new HashMap()) + .putAllColumnFamilies(new HashMap()) + .setRestoreInfo(RestoreInfo.newBuilder().build()) + .build(); mockBigtableTableAdmin.addResponse(expectedResponse); TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); - GenerateConsistencyTokenResponse actualResponse = client.generateConsistencyToken(name); + Table actualResponse = client.getTable(name); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GenerateConsistencyTokenRequest actualRequest = - (GenerateConsistencyTokenRequest) actualRequests.get(0); + GetTableRequest actualRequest = ((GetTableRequest) actualRequests.get(0)); - Assert.assertEquals(name, TableName.parse(actualRequest.getName())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -464,41 +573,40 @@ public void generateConsistencyTokenTest() { } @Test - @SuppressWarnings("all") - public void generateConsistencyTokenExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void getTableExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); - - client.generateConsistencyToken(name); + client.getTable(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void checkConsistencyTest() { - boolean consistent = true; - CheckConsistencyResponse expectedResponse = - CheckConsistencyResponse.newBuilder().setConsistent(consistent).build(); + public void getTableTest2() throws Exception { + Table expectedResponse = + Table.newBuilder() + .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString()) + .putAllClusterStates(new HashMap()) + .putAllColumnFamilies(new HashMap()) + .setRestoreInfo(RestoreInfo.newBuilder().build()) + .build(); mockBigtableTableAdmin.addResponse(expectedResponse); - TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); - String consistencyToken = "consistencyToken-1090516718"; + String name = "name3373707"; - CheckConsistencyResponse actualResponse = client.checkConsistency(name, consistencyToken); + Table actualResponse = client.getTable(name); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CheckConsistencyRequest actualRequest = (CheckConsistencyRequest) actualRequests.get(0); + GetTableRequest actualRequest = ((GetTableRequest) actualRequests.get(0)); - Assert.assertEquals(name, TableName.parse(actualRequest.getName())); - Assert.assertEquals(consistencyToken, actualRequest.getConsistencyToken()); + Assert.assertEquals(name, actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -506,40 +614,33 @@ public void checkConsistencyTest() { } @Test - @SuppressWarnings("all") - public void checkConsistencyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void getTableExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { - TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); - String consistencyToken = "consistencyToken-1090516718"; - - client.checkConsistency(name, consistencyToken); + String name = "name3373707"; + client.getTable(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getIamPolicyTest() { - int version = 351608024; - ByteString etag = ByteString.copyFromUtf8("21"); - Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); + public void deleteTableTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); mockBigtableTableAdmin.addResponse(expectedResponse); - ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]"); + TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); - Policy actualResponse = client.getIamPolicy(resource); - Assert.assertEquals(expectedResponse, actualResponse); + client.deleteTable(name); List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetIamPolicyRequest actualRequest = (GetIamPolicyRequest) actualRequests.get(0); + DeleteTableRequest actualRequest = ((DeleteTableRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertEquals(name.toString(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -547,41 +648,33 @@ public void getIamPolicyTest() { } @Test - @SuppressWarnings("all") - public void getIamPolicyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void deleteTableExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { - ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]"); - - client.getIamPolicy(resource); + TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + client.deleteTable(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void setIamPolicyTest() { - int version = 351608024; - ByteString etag = ByteString.copyFromUtf8("21"); - Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); + public void deleteTableTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); mockBigtableTableAdmin.addResponse(expectedResponse); - ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]"); - Policy policy = Policy.newBuilder().build(); + String name = "name3373707"; - Policy actualResponse = client.setIamPolicy(resource, policy); - Assert.assertEquals(expectedResponse, actualResponse); + client.deleteTable(name); List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - SetIamPolicyRequest actualRequest = (SetIamPolicyRequest) actualRequests.get(0); + DeleteTableRequest actualRequest = ((DeleteTableRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); - Assert.assertEquals(policy, actualRequest.getPolicy()); + Assert.assertEquals(name, actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -589,40 +682,43 @@ public void setIamPolicyTest() { } @Test - @SuppressWarnings("all") - public void setIamPolicyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void deleteTableExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { - ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]"); - Policy policy = Policy.newBuilder().build(); - - client.setIamPolicy(resource, policy); + String name = "name3373707"; + client.deleteTable(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void testIamPermissionsTest() { - TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().build(); + public void modifyColumnFamiliesTest() throws Exception { + Table expectedResponse = + Table.newBuilder() + .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString()) + .putAllClusterStates(new HashMap()) + .putAllColumnFamilies(new HashMap()) + .setRestoreInfo(RestoreInfo.newBuilder().build()) + .build(); mockBigtableTableAdmin.addResponse(expectedResponse); - ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]"); - List permissions = new ArrayList<>(); + TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + List modifications = new ArrayList<>(); - TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions); + Table actualResponse = client.modifyColumnFamilies(name, modifications); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - TestIamPermissionsRequest actualRequest = (TestIamPermissionsRequest) actualRequests.get(0); + ModifyColumnFamiliesRequest actualRequest = + ((ModifyColumnFamiliesRequest) actualRequests.get(0)); - Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); - Assert.assertEquals(permissions, actualRequest.getPermissionsList()); + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertEquals(modifications, actualRequest.getModificationsList()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -630,59 +726,44 @@ public void testIamPermissionsTest() { } @Test - @SuppressWarnings("all") - public void testIamPermissionsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void modifyColumnFamiliesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { - ResourceName resource = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]"); - List permissions = new ArrayList<>(); - - client.testIamPermissions(resource, permissions); + TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + List modifications = new ArrayList<>(); + client.modifyColumnFamilies(name, modifications); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void snapshotTableTest() throws Exception { - SnapshotName name2 = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"); - long dataSizeBytes = 2110122398L; - String description2 = "description2568623279"; - Snapshot expectedResponse = - Snapshot.newBuilder() - .setName(name2.toString()) - .setDataSizeBytes(dataSizeBytes) - .setDescription(description2) - .build(); - Operation resultOperation = - Operation.newBuilder() - .setName("snapshotTableTest") - .setDone(true) - .setResponse(Any.pack(expectedResponse)) + public void modifyColumnFamiliesTest2() throws Exception { + Table expectedResponse = + Table.newBuilder() + .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString()) + .putAllClusterStates(new HashMap()) + .putAllColumnFamilies(new HashMap()) + .setRestoreInfo(RestoreInfo.newBuilder().build()) .build(); - mockBigtableTableAdmin.addResponse(resultOperation); + mockBigtableTableAdmin.addResponse(expectedResponse); - TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); - ClusterName cluster = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); - String snapshotId = "snapshotId-168585866"; - String description = "description-1724546052"; + String name = "name3373707"; + List modifications = new ArrayList<>(); - Snapshot actualResponse = - client.snapshotTableAsync(name, cluster, snapshotId, description).get(); + Table actualResponse = client.modifyColumnFamilies(name, modifications); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - SnapshotTableRequest actualRequest = (SnapshotTableRequest) actualRequests.get(0); + ModifyColumnFamiliesRequest actualRequest = + ((ModifyColumnFamiliesRequest) actualRequests.get(0)); - Assert.assertEquals(name, TableName.parse(actualRequest.getName())); - Assert.assertEquals(cluster, ClusterName.parse(actualRequest.getCluster())); - Assert.assertEquals(snapshotId, actualRequest.getSnapshotId()); - Assert.assertEquals(description, actualRequest.getDescription()); + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(modifications, actualRequest.getModificationsList()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -690,50 +771,936 @@ public void snapshotTableTest() throws Exception { } @Test - @SuppressWarnings("all") - public void snapshotTableExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void modifyColumnFamiliesExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { - TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); - ClusterName cluster = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); - String snapshotId = "snapshotId-168585866"; - String description = "description-1724546052"; - - client.snapshotTableAsync(name, cluster, snapshotId, description).get(); + String name = "name3373707"; + List modifications = new ArrayList<>(); + client.modifyColumnFamilies(name, modifications); Assert.fail("No exception raised"); - } catch (ExecutionException e) { - Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } catch (InvalidArgumentException e) { + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getSnapshotTest() { - SnapshotName name2 = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"); - long dataSizeBytes = 2110122398L; - String description = "description-1724546052"; - Snapshot expectedResponse = - Snapshot.newBuilder() - .setName(name2.toString()) - .setDataSizeBytes(dataSizeBytes) - .setDescription(description) - .build(); + public void dropRowRangeTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockBigtableTableAdmin.addResponse(expectedResponse); + + DropRowRangeRequest request = + DropRowRangeRequest.newBuilder() + .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString()) + .build(); + + client.dropRowRange(request); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DropRowRangeRequest actualRequest = ((DropRowRangeRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getRowKeyPrefix(), actualRequest.getRowKeyPrefix()); + Assert.assertEquals( + request.getDeleteAllDataFromTable(), actualRequest.getDeleteAllDataFromTable()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void dropRowRangeExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + DropRowRangeRequest request = + DropRowRangeRequest.newBuilder() + .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString()) + .build(); + client.dropRowRange(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void generateConsistencyTokenTest() throws Exception { + GenerateConsistencyTokenResponse expectedResponse = + GenerateConsistencyTokenResponse.newBuilder() + .setConsistencyToken("consistencyToken-1985152319") + .build(); + mockBigtableTableAdmin.addResponse(expectedResponse); + + TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + + GenerateConsistencyTokenResponse actualResponse = client.generateConsistencyToken(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GenerateConsistencyTokenRequest actualRequest = + ((GenerateConsistencyTokenRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void generateConsistencyTokenExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + client.generateConsistencyToken(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void generateConsistencyTokenTest2() throws Exception { + GenerateConsistencyTokenResponse expectedResponse = + GenerateConsistencyTokenResponse.newBuilder() + .setConsistencyToken("consistencyToken-1985152319") + .build(); + mockBigtableTableAdmin.addResponse(expectedResponse); + + String name = "name3373707"; + + GenerateConsistencyTokenResponse actualResponse = client.generateConsistencyToken(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GenerateConsistencyTokenRequest actualRequest = + ((GenerateConsistencyTokenRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void generateConsistencyTokenExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + String name = "name3373707"; + client.generateConsistencyToken(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void checkConsistencyTest() throws Exception { + CheckConsistencyResponse expectedResponse = + CheckConsistencyResponse.newBuilder().setConsistent(true).build(); + mockBigtableTableAdmin.addResponse(expectedResponse); + + TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + String consistencyToken = "consistencyToken-1985152319"; + + CheckConsistencyResponse actualResponse = client.checkConsistency(name, consistencyToken); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CheckConsistencyRequest actualRequest = ((CheckConsistencyRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertEquals(consistencyToken, actualRequest.getConsistencyToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void checkConsistencyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + String consistencyToken = "consistencyToken-1985152319"; + client.checkConsistency(name, consistencyToken); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void checkConsistencyTest2() throws Exception { + CheckConsistencyResponse expectedResponse = + CheckConsistencyResponse.newBuilder().setConsistent(true).build(); + mockBigtableTableAdmin.addResponse(expectedResponse); + + String name = "name3373707"; + String consistencyToken = "consistencyToken-1985152319"; + + CheckConsistencyResponse actualResponse = client.checkConsistency(name, consistencyToken); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CheckConsistencyRequest actualRequest = ((CheckConsistencyRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(consistencyToken, actualRequest.getConsistencyToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void checkConsistencyExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + String name = "name3373707"; + String consistencyToken = "consistencyToken-1985152319"; + client.checkConsistency(name, consistencyToken); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void snapshotTableTest() throws Exception { + Snapshot expectedResponse = + Snapshot.newBuilder() + .setName( + SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]").toString()) + .setSourceTable(Table.newBuilder().build()) + .setDataSizeBytes(-2110122398) + .setCreateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setDescription("description-1724546052") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("snapshotTableTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockBigtableTableAdmin.addResponse(resultOperation); + + TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + ClusterName cluster = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); + String snapshotId = "snapshotId-1113817601"; + String description = "description-1724546052"; + + Snapshot actualResponse = + client.snapshotTableAsync(name, cluster, snapshotId, description).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SnapshotTableRequest actualRequest = ((SnapshotTableRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertEquals(cluster.toString(), actualRequest.getCluster()); + Assert.assertEquals(snapshotId, actualRequest.getSnapshotId()); + Assert.assertEquals(description, actualRequest.getDescription()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void snapshotTableExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + ClusterName cluster = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); + String snapshotId = "snapshotId-1113817601"; + String description = "description-1724546052"; + client.snapshotTableAsync(name, cluster, snapshotId, description).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void snapshotTableTest2() throws Exception { + Snapshot expectedResponse = + Snapshot.newBuilder() + .setName( + SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]").toString()) + .setSourceTable(Table.newBuilder().build()) + .setDataSizeBytes(-2110122398) + .setCreateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setDescription("description-1724546052") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("snapshotTableTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockBigtableTableAdmin.addResponse(resultOperation); + + TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + String cluster = "cluster872092154"; + String snapshotId = "snapshotId-1113817601"; + String description = "description-1724546052"; + + Snapshot actualResponse = + client.snapshotTableAsync(name, cluster, snapshotId, description).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SnapshotTableRequest actualRequest = ((SnapshotTableRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertEquals(cluster, actualRequest.getCluster()); + Assert.assertEquals(snapshotId, actualRequest.getSnapshotId()); + Assert.assertEquals(description, actualRequest.getDescription()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void snapshotTableExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + String cluster = "cluster872092154"; + String snapshotId = "snapshotId-1113817601"; + String description = "description-1724546052"; + client.snapshotTableAsync(name, cluster, snapshotId, description).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void snapshotTableTest3() throws Exception { + Snapshot expectedResponse = + Snapshot.newBuilder() + .setName( + SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]").toString()) + .setSourceTable(Table.newBuilder().build()) + .setDataSizeBytes(-2110122398) + .setCreateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setDescription("description-1724546052") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("snapshotTableTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockBigtableTableAdmin.addResponse(resultOperation); + + String name = "name3373707"; + ClusterName cluster = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); + String snapshotId = "snapshotId-1113817601"; + String description = "description-1724546052"; + + Snapshot actualResponse = + client.snapshotTableAsync(name, cluster, snapshotId, description).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SnapshotTableRequest actualRequest = ((SnapshotTableRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(cluster.toString(), actualRequest.getCluster()); + Assert.assertEquals(snapshotId, actualRequest.getSnapshotId()); + Assert.assertEquals(description, actualRequest.getDescription()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void snapshotTableExceptionTest3() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + String name = "name3373707"; + ClusterName cluster = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); + String snapshotId = "snapshotId-1113817601"; + String description = "description-1724546052"; + client.snapshotTableAsync(name, cluster, snapshotId, description).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void snapshotTableTest4() throws Exception { + Snapshot expectedResponse = + Snapshot.newBuilder() + .setName( + SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]").toString()) + .setSourceTable(Table.newBuilder().build()) + .setDataSizeBytes(-2110122398) + .setCreateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setDescription("description-1724546052") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("snapshotTableTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockBigtableTableAdmin.addResponse(resultOperation); + + String name = "name3373707"; + String cluster = "cluster872092154"; + String snapshotId = "snapshotId-1113817601"; + String description = "description-1724546052"; + + Snapshot actualResponse = + client.snapshotTableAsync(name, cluster, snapshotId, description).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SnapshotTableRequest actualRequest = ((SnapshotTableRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(cluster, actualRequest.getCluster()); + Assert.assertEquals(snapshotId, actualRequest.getSnapshotId()); + Assert.assertEquals(description, actualRequest.getDescription()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void snapshotTableExceptionTest4() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + String name = "name3373707"; + String cluster = "cluster872092154"; + String snapshotId = "snapshotId-1113817601"; + String description = "description-1724546052"; + client.snapshotTableAsync(name, cluster, snapshotId, description).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void getSnapshotTest() throws Exception { + Snapshot expectedResponse = + Snapshot.newBuilder() + .setName( + SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]").toString()) + .setSourceTable(Table.newBuilder().build()) + .setDataSizeBytes(-2110122398) + .setCreateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setDescription("description-1724546052") + .build(); + mockBigtableTableAdmin.addResponse(expectedResponse); + + SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"); + + Snapshot actualResponse = client.getSnapshot(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetSnapshotRequest actualRequest = ((GetSnapshotRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getSnapshotExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"); + client.getSnapshot(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getSnapshotTest2() throws Exception { + Snapshot expectedResponse = + Snapshot.newBuilder() + .setName( + SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]").toString()) + .setSourceTable(Table.newBuilder().build()) + .setDataSizeBytes(-2110122398) + .setCreateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .setDescription("description-1724546052") + .build(); + mockBigtableTableAdmin.addResponse(expectedResponse); + + String name = "name3373707"; + + Snapshot actualResponse = client.getSnapshot(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetSnapshotRequest actualRequest = ((GetSnapshotRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getSnapshotExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + String name = "name3373707"; + client.getSnapshot(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSnapshotsTest() throws Exception { + Snapshot responsesElement = Snapshot.newBuilder().build(); + ListSnapshotsResponse expectedResponse = + ListSnapshotsResponse.newBuilder() + .setNextPageToken("") + .addAllSnapshots(Arrays.asList(responsesElement)) + .build(); + mockBigtableTableAdmin.addResponse(expectedResponse); + + ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); + + ListSnapshotsPagedResponse pagedListResponse = client.listSnapshots(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSnapshotsList().get(0), resources.get(0)); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListSnapshotsRequest actualRequest = ((ListSnapshotsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listSnapshotsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); + client.listSnapshots(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listSnapshotsTest2() throws Exception { + Snapshot responsesElement = Snapshot.newBuilder().build(); + ListSnapshotsResponse expectedResponse = + ListSnapshotsResponse.newBuilder() + .setNextPageToken("") + .addAllSnapshots(Arrays.asList(responsesElement)) + .build(); + mockBigtableTableAdmin.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListSnapshotsPagedResponse pagedListResponse = client.listSnapshots(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSnapshotsList().get(0), resources.get(0)); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListSnapshotsRequest actualRequest = ((ListSnapshotsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listSnapshotsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + String parent = "parent-995424086"; + client.listSnapshots(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteSnapshotTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); mockBigtableTableAdmin.addResponse(expectedResponse); SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"); - Snapshot actualResponse = client.getSnapshot(name); + client.deleteSnapshot(name); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteSnapshotRequest actualRequest = ((DeleteSnapshotRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteSnapshotExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"); + client.deleteSnapshot(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteSnapshotTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockBigtableTableAdmin.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteSnapshot(name); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteSnapshotRequest actualRequest = ((DeleteSnapshotRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteSnapshotExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + String name = "name3373707"; + client.deleteSnapshot(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createBackupTest() throws Exception { + Backup expectedResponse = + Backup.newBuilder() + .setName(BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]").toString()) + .setSourceTable("sourceTable-95372173") + .setExpireTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setSizeBytes(-1796325715) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createBackupTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockBigtableTableAdmin.addResponse(resultOperation); + + ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); + String backupId = "backupId2121930365"; + Backup backup = Backup.newBuilder().build(); + + Backup actualResponse = client.createBackupAsync(parent, backupId, backup).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateBackupRequest actualRequest = ((CreateBackupRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(backupId, actualRequest.getBackupId()); + Assert.assertEquals(backup, actualRequest.getBackup()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createBackupExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); + String backupId = "backupId2121930365"; + Backup backup = Backup.newBuilder().build(); + client.createBackupAsync(parent, backupId, backup).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void createBackupTest2() throws Exception { + Backup expectedResponse = + Backup.newBuilder() + .setName(BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]").toString()) + .setSourceTable("sourceTable-95372173") + .setExpireTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setSizeBytes(-1796325715) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createBackupTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockBigtableTableAdmin.addResponse(resultOperation); + + String parent = "parent-995424086"; + String backupId = "backupId2121930365"; + Backup backup = Backup.newBuilder().build(); + + Backup actualResponse = client.createBackupAsync(parent, backupId, backup).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateBackupRequest actualRequest = ((CreateBackupRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(backupId, actualRequest.getBackupId()); + Assert.assertEquals(backup, actualRequest.getBackup()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createBackupExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + String parent = "parent-995424086"; + String backupId = "backupId2121930365"; + Backup backup = Backup.newBuilder().build(); + client.createBackupAsync(parent, backupId, backup).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void getBackupTest() throws Exception { + Backup expectedResponse = + Backup.newBuilder() + .setName(BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]").toString()) + .setSourceTable("sourceTable-95372173") + .setExpireTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setSizeBytes(-1796325715) + .build(); + mockBigtableTableAdmin.addResponse(expectedResponse); + + BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]"); + + Backup actualResponse = client.getBackup(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetBackupRequest actualRequest = ((GetBackupRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getBackupExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]"); + client.getBackup(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getBackupTest2() throws Exception { + Backup expectedResponse = + Backup.newBuilder() + .setName(BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]").toString()) + .setSourceTable("sourceTable-95372173") + .setExpireTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setSizeBytes(-1796325715) + .build(); + mockBigtableTableAdmin.addResponse(expectedResponse); + + String name = "name3373707"; + + Backup actualResponse = client.getBackup(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetBackupRequest actualRequest = ((GetBackupRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getBackupExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + String name = "name3373707"; + client.getBackup(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateBackupTest() throws Exception { + Backup expectedResponse = + Backup.newBuilder() + .setName(BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]").toString()) + .setSourceTable("sourceTable-95372173") + .setExpireTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setEndTime(Timestamp.newBuilder().build()) + .setSizeBytes(-1796325715) + .build(); + mockBigtableTableAdmin.addResponse(expectedResponse); + + Backup backup = Backup.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Backup actualResponse = client.updateBackup(backup, updateMask); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetSnapshotRequest actualRequest = (GetSnapshotRequest) actualRequests.get(0); + UpdateBackupRequest actualRequest = ((UpdateBackupRequest) actualRequests.get(0)); - Assert.assertEquals(name, SnapshotName.parse(actualRequest.getName())); + Assert.assertEquals(backup, actualRequest.getBackup()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -741,47 +1708,112 @@ public void getSnapshotTest() { } @Test - @SuppressWarnings("all") - public void getSnapshotExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void updateBackupExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { - SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"); + Backup backup = Backup.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateBackup(backup, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } - client.getSnapshot(name); + @Test + public void deleteBackupTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockBigtableTableAdmin.addResponse(expectedResponse); + + BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]"); + + client.deleteBackup(name); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteBackupRequest actualRequest = ((DeleteBackupRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteBackupExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]"); + client.deleteBackup(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listSnapshotsTest() { - String nextPageToken = ""; - Snapshot snapshotsElement = Snapshot.newBuilder().build(); - List snapshots = Arrays.asList(snapshotsElement); - ListSnapshotsResponse expectedResponse = - ListSnapshotsResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllSnapshots(snapshots) + public void deleteBackupTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockBigtableTableAdmin.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteBackup(name); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteBackupRequest actualRequest = ((DeleteBackupRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteBackupExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + String name = "name3373707"; + client.deleteBackup(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listBackupsTest() throws Exception { + Backup responsesElement = Backup.newBuilder().build(); + ListBackupsResponse expectedResponse = + ListBackupsResponse.newBuilder() + .setNextPageToken("") + .addAllBackups(Arrays.asList(responsesElement)) .build(); mockBigtableTableAdmin.addResponse(expectedResponse); ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); - ListSnapshotsPagedResponse pagedListResponse = client.listSnapshots(parent); + ListBackupsPagedResponse pagedListResponse = client.listBackups(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getSnapshotsList().get(0), resources.get(0)); + Assert.assertEquals(expectedResponse.getBackupsList().get(0), resources.get(0)); List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListSnapshotsRequest actualRequest = (ListSnapshotsRequest) actualRequests.get(0); + ListBackupsRequest actualRequest = ((ListBackupsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, ClusterName.parse(actualRequest.getParent())); + Assert.assertEquals(parent.toString(), actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -789,36 +1821,43 @@ public void listSnapshotsTest() { } @Test - @SuppressWarnings("all") - public void listSnapshotsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void listBackupsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); - - client.listSnapshots(parent); + client.listBackups(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteSnapshotTest() { - Empty expectedResponse = Empty.newBuilder().build(); + public void listBackupsTest2() throws Exception { + Backup responsesElement = Backup.newBuilder().build(); + ListBackupsResponse expectedResponse = + ListBackupsResponse.newBuilder() + .setNextPageToken("") + .addAllBackups(Arrays.asList(responsesElement)) + .build(); mockBigtableTableAdmin.addResponse(expectedResponse); - SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"); + String parent = "parent-995424086"; - client.deleteSnapshot(name); + ListBackupsPagedResponse pagedListResponse = client.listBackups(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getBackupsList().get(0), resources.get(0)); List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteSnapshotRequest actualRequest = (DeleteSnapshotRequest) actualRequests.get(0); + ListBackupsRequest actualRequest = ((ListBackupsRequest) actualRequests.get(0)); - Assert.assertEquals(name, SnapshotName.parse(actualRequest.getName())); + Assert.assertEquals(parent, actualRequest.getParent()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -826,55 +1865,52 @@ public void deleteSnapshotTest() { } @Test - @SuppressWarnings("all") - public void deleteSnapshotExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void listBackupsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { - SnapshotName name = SnapshotName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[SNAPSHOT]"); - - client.deleteSnapshot(name); + String parent = "parent-995424086"; + client.listBackups(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void createBackupTest() throws Exception { - BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]"); - String sourceTable = "sourceTable1670858410"; - long sizeBytes = 1796325715L; - Backup expectedResponse = - Backup.newBuilder() - .setName(name.toString()) - .setSourceTable(sourceTable) - .setSizeBytes(sizeBytes) + public void restoreTableTest() throws Exception { + Table expectedResponse = + Table.newBuilder() + .setName(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString()) + .putAllClusterStates(new HashMap()) + .putAllColumnFamilies(new HashMap()) + .setRestoreInfo(RestoreInfo.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() - .setName("createBackupTest") + .setName("restoreTableTest") .setDone(true) .setResponse(Any.pack(expectedResponse)) .build(); mockBigtableTableAdmin.addResponse(resultOperation); - ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); - String backupId = "backupId1355353272"; - Backup backup = Backup.newBuilder().build(); + RestoreTableRequest request = + RestoreTableRequest.newBuilder() + .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setTableId("tableId-1552905847") + .build(); - Backup actualResponse = client.createBackupAsync(parent, backupId, backup).get(); + Table actualResponse = client.restoreTableAsync(request).get(); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateBackupRequest actualRequest = (CreateBackupRequest) actualRequests.get(0); + RestoreTableRequest actualRequest = ((RestoreTableRequest) actualRequests.get(0)); - Assert.assertEquals(parent, ClusterName.parse(actualRequest.getParent())); - Assert.assertEquals(backupId, actualRequest.getBackupId()); - Assert.assertEquals(backup, actualRequest.getBackup()); + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getTableId(), actualRequest.getTableId()); + Assert.assertEquals(request.getBackup(), actualRequest.getBackup()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -882,49 +1918,45 @@ public void createBackupTest() throws Exception { } @Test - @SuppressWarnings("all") - public void createBackupExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void restoreTableExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { - ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); - String backupId = "backupId1355353272"; - Backup backup = Backup.newBuilder().build(); - - client.createBackupAsync(parent, backupId, backup).get(); + RestoreTableRequest request = + RestoreTableRequest.newBuilder() + .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setTableId("tableId-1552905847") + .build(); + client.restoreTableAsync(request).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); } } @Test - @SuppressWarnings("all") - public void getBackupTest() { - BackupName name2 = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]"); - String sourceTable = "sourceTable1670858410"; - long sizeBytes = 1796325715L; - Backup expectedResponse = - Backup.newBuilder() - .setName(name2.toString()) - .setSourceTable(sourceTable) - .setSizeBytes(sizeBytes) + public void getIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .setEtag(ByteString.EMPTY) .build(); mockBigtableTableAdmin.addResponse(expectedResponse); - BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]"); + ResourceName resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); - Backup actualResponse = client.getBackup(name); + Policy actualResponse = client.getIamPolicy(resource); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetBackupRequest actualRequest = (GetBackupRequest) actualRequests.get(0); + GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(name, BackupName.parse(actualRequest.getName())); + Assert.assertEquals(resource.toString(), actualRequest.getResource()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -932,47 +1964,39 @@ public void getBackupTest() { } @Test - @SuppressWarnings("all") - public void getBackupExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void getIamPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { - BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]"); - - client.getBackup(name); + ResourceName resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + client.getIamPolicy(resource); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void listBackupsTest() { - String nextPageToken = ""; - Backup backupsElement = Backup.newBuilder().build(); - List backups = Arrays.asList(backupsElement); - ListBackupsResponse expectedResponse = - ListBackupsResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllBackups(backups) + public void getIamPolicyTest2() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .setEtag(ByteString.EMPTY) .build(); mockBigtableTableAdmin.addResponse(expectedResponse); - ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); - - ListBackupsPagedResponse pagedListResponse = client.listBackups(parent); + String resource = "resource-341064690"; - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getBackupsList().get(0), resources.get(0)); + Policy actualResponse = client.getIamPolicy(resource); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListBackupsRequest actualRequest = (ListBackupsRequest) actualRequests.get(0); + GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(parent, ClusterName.parse(actualRequest.getParent())); + Assert.assertEquals(resource, actualRequest.getResource()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -980,47 +2004,41 @@ public void listBackupsTest() { } @Test - @SuppressWarnings("all") - public void listBackupsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void getIamPolicyExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { - ClusterName parent = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]"); - - client.listBackups(parent); + String resource = "resource-341064690"; + client.getIamPolicy(resource); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void updateBackupTest() { - BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]"); - String sourceTable = "sourceTable1670858410"; - long sizeBytes = 1796325715L; - Backup expectedResponse = - Backup.newBuilder() - .setName(name.toString()) - .setSourceTable(sourceTable) - .setSizeBytes(sizeBytes) + public void setIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .setEtag(ByteString.EMPTY) .build(); mockBigtableTableAdmin.addResponse(expectedResponse); - Backup backup = Backup.newBuilder().build(); - FieldMask updateMask = FieldMask.newBuilder().build(); + ResourceName resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + Policy policy = Policy.newBuilder().build(); - Backup actualResponse = client.updateBackup(backup, updateMask); + Policy actualResponse = client.setIamPolicy(resource, policy); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpdateBackupRequest actualRequest = (UpdateBackupRequest) actualRequests.get(0); + SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(backup, actualRequest.getBackup()); - Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertEquals(resource.toString(), actualRequest.getResource()); + Assert.assertEquals(policy, actualRequest.getPolicy()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1028,37 +2046,42 @@ public void updateBackupTest() { } @Test - @SuppressWarnings("all") - public void updateBackupExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void setIamPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { - Backup backup = Backup.newBuilder().build(); - FieldMask updateMask = FieldMask.newBuilder().build(); - - client.updateBackup(backup, updateMask); + ResourceName resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + Policy policy = Policy.newBuilder().build(); + client.setIamPolicy(resource, policy); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void deleteBackupTest() { - Empty expectedResponse = Empty.newBuilder().build(); + public void setIamPolicyTest2() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); mockBigtableTableAdmin.addResponse(expectedResponse); - BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]"); + String resource = "resource-341064690"; + Policy policy = Policy.newBuilder().build(); - client.deleteBackup(name); + Policy actualResponse = client.setIamPolicy(resource, policy); + Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteBackupRequest actualRequest = (DeleteBackupRequest) actualRequests.get(0); + SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - Assert.assertEquals(name, BackupName.parse(actualRequest.getName())); + Assert.assertEquals(resource, actualRequest.getResource()); + Assert.assertEquals(policy, actualRequest.getPolicy()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1066,48 +2089,38 @@ public void deleteBackupTest() { } @Test - @SuppressWarnings("all") - public void deleteBackupExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void setIamPolicyExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { - BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]"); - - client.deleteBackup(name); + String resource = "resource-341064690"; + Policy policy = Policy.newBuilder().build(); + client.setIamPolicy(resource, policy); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void restoreTableTest() throws Exception { - TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); - Table expectedResponse = Table.newBuilder().setName(name.toString()).build(); - Operation resultOperation = - Operation.newBuilder() - .setName("restoreTableTest") - .setDone(true) - .setResponse(Any.pack(expectedResponse)) - .build(); - mockBigtableTableAdmin.addResponse(resultOperation); + public void testIamPermissionsTest() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); + mockBigtableTableAdmin.addResponse(expectedResponse); - InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String tableId = "tableId-895419604"; - RestoreTableRequest request = - RestoreTableRequest.newBuilder().setParent(parent.toString()).setTableId(tableId).build(); + ResourceName resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + List permissions = new ArrayList<>(); - Table actualResponse = client.restoreTableAsync(request).get(); + TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockBigtableTableAdmin.getRequests(); Assert.assertEquals(1, actualRequests.size()); - RestoreTableRequest actualRequest = (RestoreTableRequest) actualRequests.get(0); + TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, InstanceName.parse(actualRequest.getParent())); - Assert.assertEquals(tableId, actualRequest.getTableId()); + Assert.assertEquals(resource.toString(), actualRequest.getResource()); + Assert.assertEquals(permissions, actualRequest.getPermissionsList()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1115,23 +2128,56 @@ public void restoreTableTest() throws Exception { } @Test - @SuppressWarnings("all") - public void restoreTableExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + public void testIamPermissionsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockBigtableTableAdmin.addException(exception); try { - InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String tableId = "tableId-895419604"; - RestoreTableRequest request = - RestoreTableRequest.newBuilder().setParent(parent.toString()).setTableId(tableId).build(); + ResourceName resource = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]"); + List permissions = new ArrayList<>(); + client.testIamPermissions(resource, permissions); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } - client.restoreTableAsync(request).get(); + @Test + public void testIamPermissionsTest2() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); + mockBigtableTableAdmin.addResponse(expectedResponse); + + String resource = "resource-341064690"; + List permissions = new ArrayList<>(); + + TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBigtableTableAdmin.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); + + Assert.assertEquals(resource, actualRequest.getResource()); + Assert.assertEquals(permissions, actualRequest.getPermissionsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void testIamPermissionsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBigtableTableAdmin.addException(exception); + + try { + String resource = "resource-341064690"; + List permissions = new ArrayList<>(); + client.testIamPermissions(resource, permissions); Assert.fail("No exception raised"); - } catch (ExecutionException e) { - Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); - InvalidArgumentException apiException = (InvalidArgumentException) e.getCause(); - Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } catch (InvalidArgumentException e) { + // Expected exception. } } } diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableInstanceAdmin.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableInstanceAdmin.java index 360d6c0d5..40b544556 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableInstanceAdmin.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableInstanceAdmin.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.admin.v2; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockBigtableInstanceAdmin implements MockGrpcService { private final MockBigtableInstanceAdminImpl serviceImpl; diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableInstanceAdminImpl.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableInstanceAdminImpl.java index 92f4b541e..37dd07da9 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableInstanceAdminImpl.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableInstanceAdminImpl.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.admin.v2; import com.google.api.core.BetaApi; @@ -50,9 +51,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockBigtableInstanceAdminImpl extends BigtableInstanceAdminImplBase { private List requests; private Queue responses; @@ -89,10 +91,10 @@ public void createInstance( Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -103,10 +105,10 @@ public void getInstance(GetInstanceRequest request, StreamObserver res Object response = responses.remove(); if (response instanceof Instance) { requests.add(request); - responseObserver.onNext((Instance) response); + responseObserver.onNext(((Instance) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -118,10 +120,24 @@ public void listInstances( Object response = responses.remove(); if (response instanceof ListInstancesResponse) { requests.add(request); - responseObserver.onNext((ListInstancesResponse) response); + responseObserver.onNext(((ListInstancesResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void updateInstance(Instance request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Instance) { + requests.add(request); + responseObserver.onNext(((Instance) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -133,10 +149,10 @@ public void partialUpdateInstance( Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -148,10 +164,10 @@ public void deleteInstance( Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -163,10 +179,10 @@ public void createCluster( Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -177,10 +193,10 @@ public void getCluster(GetClusterRequest request, StreamObserver respon Object response = responses.remove(); if (response instanceof Cluster) { requests.add(request); - responseObserver.onNext((Cluster) response); + responseObserver.onNext(((Cluster) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -192,10 +208,10 @@ public void listClusters( Object response = responses.remove(); if (response instanceof ListClustersResponse) { requests.add(request); - responseObserver.onNext((ListClustersResponse) response); + responseObserver.onNext(((ListClustersResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -206,10 +222,10 @@ public void updateCluster(Cluster request, StreamObserver responseObs Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -220,10 +236,10 @@ public void deleteCluster(DeleteClusterRequest request, StreamObserver re Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -235,10 +251,10 @@ public void createAppProfile( Object response = responses.remove(); if (response instanceof AppProfile) { requests.add(request); - responseObserver.onNext((AppProfile) response); + responseObserver.onNext(((AppProfile) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -250,10 +266,10 @@ public void getAppProfile( Object response = responses.remove(); if (response instanceof AppProfile) { requests.add(request); - responseObserver.onNext((AppProfile) response); + responseObserver.onNext(((AppProfile) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -265,10 +281,10 @@ public void listAppProfiles( Object response = responses.remove(); if (response instanceof ListAppProfilesResponse) { requests.add(request); - responseObserver.onNext((ListAppProfilesResponse) response); + responseObserver.onNext(((ListAppProfilesResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -280,10 +296,10 @@ public void updateAppProfile( Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -295,10 +311,10 @@ public void deleteAppProfile( Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -309,10 +325,10 @@ public void getIamPolicy(GetIamPolicyRequest request, StreamObserver res Object response = responses.remove(); if (response instanceof Policy) { requests.add(request); - responseObserver.onNext((Policy) response); + responseObserver.onNext(((Policy) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -323,10 +339,10 @@ public void setIamPolicy(SetIamPolicyRequest request, StreamObserver res Object response = responses.remove(); if (response instanceof Policy) { requests.add(request); - responseObserver.onNext((Policy) response); + responseObserver.onNext(((Policy) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -339,10 +355,10 @@ public void testIamPermissions( Object response = responses.remove(); if (response instanceof TestIamPermissionsResponse) { requests.add(request); - responseObserver.onNext((TestIamPermissionsResponse) response); + responseObserver.onNext(((TestIamPermissionsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableTableAdmin.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableTableAdmin.java index a4c1c228f..83f3bfff2 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableTableAdmin.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableTableAdmin.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.admin.v2; import com.google.api.core.BetaApi; @@ -20,9 +21,10 @@ import com.google.protobuf.AbstractMessage; import io.grpc.ServerServiceDefinition; import java.util.List; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockBigtableTableAdmin implements MockGrpcService { private final MockBigtableTableAdminImpl serviceImpl; diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableTableAdminImpl.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableTableAdminImpl.java index a4108c362..69a7671a8 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableTableAdminImpl.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/MockBigtableTableAdminImpl.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.bigtable.admin.v2; import com.google.api.core.BetaApi; @@ -57,9 +58,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Queue; +import javax.annotation.Generated; -@javax.annotation.Generated("by GAPIC") @BetaApi +@Generated("by gapic-generator-java") public class MockBigtableTableAdminImpl extends BigtableTableAdminImplBase { private List requests; private Queue responses; @@ -95,10 +97,10 @@ public void createTable(CreateTableRequest request, StreamObserver
respon Object response = responses.remove(); if (response instanceof Table) { requests.add(request); - responseObserver.onNext((Table) response); + responseObserver.onNext(((Table) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -110,10 +112,10 @@ public void createTableFromSnapshot( Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -125,10 +127,10 @@ public void listTables( Object response = responses.remove(); if (response instanceof ListTablesResponse) { requests.add(request); - responseObserver.onNext((ListTablesResponse) response); + responseObserver.onNext(((ListTablesResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -139,10 +141,10 @@ public void getTable(GetTableRequest request, StreamObserver
responseObse Object response = responses.remove(); if (response instanceof Table) { requests.add(request); - responseObserver.onNext((Table) response); + responseObserver.onNext(((Table) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -153,10 +155,10 @@ public void deleteTable(DeleteTableRequest request, StreamObserver respon Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -168,10 +170,10 @@ public void modifyColumnFamilies( Object response = responses.remove(); if (response instanceof Table) { requests.add(request); - responseObserver.onNext((Table) response); + responseObserver.onNext(((Table) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -182,10 +184,10 @@ public void dropRowRange(DropRowRangeRequest request, StreamObserver resp Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -198,10 +200,10 @@ public void generateConsistencyToken( Object response = responses.remove(); if (response instanceof GenerateConsistencyTokenResponse) { requests.add(request); - responseObserver.onNext((GenerateConsistencyTokenResponse) response); + responseObserver.onNext(((GenerateConsistencyTokenResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -213,10 +215,10 @@ public void checkConsistency( Object response = responses.remove(); if (response instanceof CheckConsistencyResponse) { requests.add(request); - responseObserver.onNext((CheckConsistencyResponse) response); + responseObserver.onNext(((CheckConsistencyResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -228,10 +230,10 @@ public void snapshotTable( Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -242,10 +244,10 @@ public void getSnapshot(GetSnapshotRequest request, StreamObserver res Object response = responses.remove(); if (response instanceof Snapshot) { requests.add(request); - responseObserver.onNext((Snapshot) response); + responseObserver.onNext(((Snapshot) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -257,10 +259,10 @@ public void listSnapshots( Object response = responses.remove(); if (response instanceof ListSnapshotsResponse) { requests.add(request); - responseObserver.onNext((ListSnapshotsResponse) response); + responseObserver.onNext(((ListSnapshotsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -272,10 +274,10 @@ public void deleteSnapshot( Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -287,10 +289,10 @@ public void createBackup( Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -301,10 +303,10 @@ public void getBackup(GetBackupRequest request, StreamObserver responseO Object response = responses.remove(); if (response instanceof Backup) { requests.add(request); - responseObserver.onNext((Backup) response); + responseObserver.onNext(((Backup) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -315,10 +317,10 @@ public void updateBackup(UpdateBackupRequest request, StreamObserver res Object response = responses.remove(); if (response instanceof Backup) { requests.add(request); - responseObserver.onNext((Backup) response); + responseObserver.onNext(((Backup) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -329,10 +331,10 @@ public void deleteBackup(DeleteBackupRequest request, StreamObserver resp Object response = responses.remove(); if (response instanceof Empty) { requests.add(request); - responseObserver.onNext((Empty) response); + responseObserver.onNext(((Empty) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -344,10 +346,10 @@ public void listBackups( Object response = responses.remove(); if (response instanceof ListBackupsResponse) { requests.add(request); - responseObserver.onNext((ListBackupsResponse) response); + responseObserver.onNext(((ListBackupsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -359,10 +361,10 @@ public void restoreTable( Object response = responses.remove(); if (response instanceof Operation) { requests.add(request); - responseObserver.onNext((Operation) response); + responseObserver.onNext(((Operation) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -373,10 +375,10 @@ public void getIamPolicy(GetIamPolicyRequest request, StreamObserver res Object response = responses.remove(); if (response instanceof Policy) { requests.add(request); - responseObserver.onNext((Policy) response); + responseObserver.onNext(((Policy) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -387,10 +389,10 @@ public void setIamPolicy(SetIamPolicyRequest request, StreamObserver res Object response = responses.remove(); if (response instanceof Policy) { requests.add(request); - responseObserver.onNext((Policy) response); + responseObserver.onNext(((Policy) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -403,10 +405,10 @@ public void testIamPermissions( Object response = responses.remove(); if (response instanceof TestIamPermissionsResponse) { requests.add(request); - responseObserver.onNext((TestIamPermissionsResponse) response); + responseObserver.onNext(((TestIamPermissionsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } diff --git a/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/AppProfileName.java b/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/AppProfileName.java index 2ed927dbe..f4a4955f7 100644 --- a/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/AppProfileName.java +++ b/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/AppProfileName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -23,21 +23,33 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class AppProfileName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_INSTANCE_APP_PROFILE = PathTemplate.createWithoutUrlEncoding( "projects/{project}/instances/{instance}/appProfiles/{app_profile}"); - private volatile Map fieldValuesMap; - private final String project; private final String instance; private final String appProfile; + @Deprecated + protected AppProfileName() { + project = null; + instance = null; + appProfile = null; + } + + private AppProfileName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + instance = Preconditions.checkNotNull(builder.getInstance()); + appProfile = Preconditions.checkNotNull(builder.getAppProfile()); + } + public String getProject() { return project; } @@ -58,12 +70,6 @@ public Builder toBuilder() { return new Builder(this); } - private AppProfileName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - instance = Preconditions.checkNotNull(builder.getInstance()); - appProfile = Preconditions.checkNotNull(builder.getAppProfile()); - } - public static AppProfileName of(String project, String instance, String appProfile) { return newBuilder().setProject(project).setInstance(instance).setAppProfile(appProfile).build(); } @@ -82,7 +88,7 @@ public static AppProfileName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_INSTANCE_APP_PROFILE.validatedMatch( formattedString, "AppProfileName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("instance"), matchMap.get("app_profile")); } @@ -96,7 +102,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (AppProfileName value : values) { if (value == null) { list.add(""); @@ -108,17 +114,24 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_INSTANCE_APP_PROFILE.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("instance", instance); - fieldMapBuilder.put("appProfile", appProfile); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (instance != null) { + fieldMapBuilder.put("instance", instance); + } + if (appProfile != null) { + fieldMapBuilder.put("app_profile", appProfile); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -132,17 +145,44 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_INSTANCE_APP_PROFILE.instantiate( "project", project, "instance", instance, "app_profile", appProfile); } - /** Builder for AppProfileName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + AppProfileName that = ((AppProfileName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.instance, that.instance) + && Objects.equals(this.appProfile, that.appProfile); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(instance); + h *= 1000003; + h ^= Objects.hashCode(appProfile); + return h; + } + + /** Builder for projects/{project}/instances/{instance}/appProfiles/{app_profile}. */ + public static class Builder { private String project; private String instance; private String appProfile; + protected Builder() {} + public String getProject() { return project; } @@ -170,8 +210,6 @@ public Builder setAppProfile(String appProfile) { return this; } - private Builder() {} - private Builder(AppProfileName appProfileName) { project = appProfileName.project; instance = appProfileName.instance; @@ -182,30 +220,4 @@ public AppProfileName build() { return new AppProfileName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof AppProfileName) { - AppProfileName that = (AppProfileName) o; - return (this.project.equals(that.project)) - && (this.instance.equals(that.instance)) - && (this.appProfile.equals(that.appProfile)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= instance.hashCode(); - h *= 1000003; - h ^= appProfile.hashCode(); - return h; - } } diff --git a/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/BackupName.java b/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/BackupName.java index bdd3c9edf..25c72d046 100644 --- a/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/BackupName.java +++ b/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/BackupName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -23,22 +23,36 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class BackupName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_INSTANCE_CLUSTER_BACKUP = PathTemplate.createWithoutUrlEncoding( "projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}"); - private volatile Map fieldValuesMap; - private final String project; private final String instance; private final String cluster; private final String backup; + @Deprecated + protected BackupName() { + project = null; + instance = null; + cluster = null; + backup = null; + } + + private BackupName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + instance = Preconditions.checkNotNull(builder.getInstance()); + cluster = Preconditions.checkNotNull(builder.getCluster()); + backup = Preconditions.checkNotNull(builder.getBackup()); + } + public String getProject() { return project; } @@ -63,13 +77,6 @@ public Builder toBuilder() { return new Builder(this); } - private BackupName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - instance = Preconditions.checkNotNull(builder.getInstance()); - cluster = Preconditions.checkNotNull(builder.getCluster()); - backup = Preconditions.checkNotNull(builder.getBackup()); - } - public static BackupName of(String project, String instance, String cluster, String backup) { return newBuilder() .setProject(project) @@ -94,7 +101,7 @@ public static BackupName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_INSTANCE_CLUSTER_BACKUP.validatedMatch( formattedString, "BackupName.parse: formattedString not in valid format"); return of( matchMap.get("project"), @@ -112,7 +119,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (BackupName value : values) { if (value == null) { list.add(""); @@ -124,18 +131,27 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_INSTANCE_CLUSTER_BACKUP.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("instance", instance); - fieldMapBuilder.put("cluster", cluster); - fieldMapBuilder.put("backup", backup); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (instance != null) { + fieldMapBuilder.put("instance", instance); + } + if (cluster != null) { + fieldMapBuilder.put("cluster", cluster); + } + if (backup != null) { + fieldMapBuilder.put("backup", backup); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -149,18 +165,48 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_INSTANCE_CLUSTER_BACKUP.instantiate( "project", project, "instance", instance, "cluster", cluster, "backup", backup); } - /** Builder for BackupName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + BackupName that = ((BackupName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.instance, that.instance) + && Objects.equals(this.cluster, that.cluster) + && Objects.equals(this.backup, that.backup); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(instance); + h *= 1000003; + h ^= Objects.hashCode(cluster); + h *= 1000003; + h ^= Objects.hashCode(backup); + return h; + } + + /** Builder for projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}. */ + public static class Builder { private String project; private String instance; private String cluster; private String backup; + protected Builder() {} + public String getProject() { return project; } @@ -197,8 +243,6 @@ public Builder setBackup(String backup) { return this; } - private Builder() {} - private Builder(BackupName backupName) { project = backupName.project; instance = backupName.instance; @@ -210,33 +254,4 @@ public BackupName build() { return new BackupName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof BackupName) { - BackupName that = (BackupName) o; - return (this.project.equals(that.project)) - && (this.instance.equals(that.instance)) - && (this.cluster.equals(that.cluster)) - && (this.backup.equals(that.backup)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= instance.hashCode(); - h *= 1000003; - h ^= cluster.hashCode(); - h *= 1000003; - h ^= backup.hashCode(); - return h; - } } diff --git a/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/ClusterName.java b/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/ClusterName.java index 4e9517778..cb1ad093b 100644 --- a/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/ClusterName.java +++ b/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/ClusterName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -23,21 +23,33 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class ClusterName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_INSTANCE_CLUSTER = PathTemplate.createWithoutUrlEncoding( "projects/{project}/instances/{instance}/clusters/{cluster}"); - private volatile Map fieldValuesMap; - private final String project; private final String instance; private final String cluster; + @Deprecated + protected ClusterName() { + project = null; + instance = null; + cluster = null; + } + + private ClusterName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + instance = Preconditions.checkNotNull(builder.getInstance()); + cluster = Preconditions.checkNotNull(builder.getCluster()); + } + public String getProject() { return project; } @@ -58,12 +70,6 @@ public Builder toBuilder() { return new Builder(this); } - private ClusterName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - instance = Preconditions.checkNotNull(builder.getInstance()); - cluster = Preconditions.checkNotNull(builder.getCluster()); - } - public static ClusterName of(String project, String instance, String cluster) { return newBuilder().setProject(project).setInstance(instance).setCluster(cluster).build(); } @@ -82,7 +88,7 @@ public static ClusterName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_INSTANCE_CLUSTER.validatedMatch( formattedString, "ClusterName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("instance"), matchMap.get("cluster")); } @@ -96,7 +102,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (ClusterName value : values) { if (value == null) { list.add(""); @@ -108,17 +114,24 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_INSTANCE_CLUSTER.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("instance", instance); - fieldMapBuilder.put("cluster", cluster); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (instance != null) { + fieldMapBuilder.put("instance", instance); + } + if (cluster != null) { + fieldMapBuilder.put("cluster", cluster); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -132,16 +145,44 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project, "instance", instance, "cluster", cluster); + return PROJECT_INSTANCE_CLUSTER.instantiate( + "project", project, "instance", instance, "cluster", cluster); } - /** Builder for ClusterName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + ClusterName that = ((ClusterName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.instance, that.instance) + && Objects.equals(this.cluster, that.cluster); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(instance); + h *= 1000003; + h ^= Objects.hashCode(cluster); + return h; + } + + /** Builder for projects/{project}/instances/{instance}/clusters/{cluster}. */ + public static class Builder { private String project; private String instance; private String cluster; + protected Builder() {} + public String getProject() { return project; } @@ -169,8 +210,6 @@ public Builder setCluster(String cluster) { return this; } - private Builder() {} - private Builder(ClusterName clusterName) { project = clusterName.project; instance = clusterName.instance; @@ -181,30 +220,4 @@ public ClusterName build() { return new ClusterName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof ClusterName) { - ClusterName that = (ClusterName) o; - return (this.project.equals(that.project)) - && (this.instance.equals(that.instance)) - && (this.cluster.equals(that.cluster)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= instance.hashCode(); - h *= 1000003; - h ^= cluster.hashCode(); - return h; - } } diff --git a/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/InstanceName.java b/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/InstanceName.java index 91172a510..be111f92f 100644 --- a/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/InstanceName.java +++ b/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/InstanceName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -23,19 +23,29 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class InstanceName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_INSTANCE = PathTemplate.createWithoutUrlEncoding("projects/{project}/instances/{instance}"); - private volatile Map fieldValuesMap; - private final String project; private final String instance; + @Deprecated + protected InstanceName() { + project = null; + instance = null; + } + + private InstanceName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + instance = Preconditions.checkNotNull(builder.getInstance()); + } + public String getProject() { return project; } @@ -52,11 +62,6 @@ public Builder toBuilder() { return new Builder(this); } - private InstanceName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - instance = Preconditions.checkNotNull(builder.getInstance()); - } - public static InstanceName of(String project, String instance) { return newBuilder().setProject(project).setInstance(instance).build(); } @@ -70,7 +75,7 @@ public static InstanceName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_INSTANCE.validatedMatch( formattedString, "InstanceName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("instance")); } @@ -84,7 +89,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (InstanceName value : values) { if (value == null) { list.add(""); @@ -96,16 +101,21 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_INSTANCE.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("instance", instance); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (instance != null) { + fieldMapBuilder.put("instance", instance); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -119,15 +129,39 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project, "instance", instance); + return PROJECT_INSTANCE.instantiate("project", project, "instance", instance); } - /** Builder for InstanceName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + InstanceName that = ((InstanceName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.instance, that.instance); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(instance); + return h; + } + + /** Builder for projects/{project}/instances/{instance}. */ + public static class Builder { private String project; private String instance; + protected Builder() {} + public String getProject() { return project; } @@ -146,8 +180,6 @@ public Builder setInstance(String instance) { return this; } - private Builder() {} - private Builder(InstanceName instanceName) { project = instanceName.project; instance = instanceName.instance; @@ -157,26 +189,4 @@ public InstanceName build() { return new InstanceName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof InstanceName) { - InstanceName that = (InstanceName) o; - return (this.project.equals(that.project)) && (this.instance.equals(that.instance)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= instance.hashCode(); - return h; - } } diff --git a/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/LocationName.java b/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/LocationName.java index 7cdbc7e44..cbb076aed 100644 --- a/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/LocationName.java +++ b/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/LocationName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -23,19 +23,29 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class LocationName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_LOCATION = PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}"); - private volatile Map fieldValuesMap; - private final String project; private final String location; + @Deprecated + protected LocationName() { + project = null; + location = null; + } + + private LocationName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + } + public String getProject() { return project; } @@ -52,11 +62,6 @@ public Builder toBuilder() { return new Builder(this); } - private LocationName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - } - public static LocationName of(String project, String location) { return newBuilder().setProject(project).setLocation(location).build(); } @@ -70,7 +75,7 @@ public static LocationName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_LOCATION.validatedMatch( formattedString, "LocationName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("location")); } @@ -84,7 +89,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (LocationName value : values) { if (value == null) { list.add(""); @@ -96,16 +101,21 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_LOCATION.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("location", location); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -119,15 +129,39 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project, "location", location); + return PROJECT_LOCATION.instantiate("project", project, "location", location); } - /** Builder for LocationName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + LocationName that = ((LocationName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + return h; + } + + /** Builder for projects/{project}/locations/{location}. */ + public static class Builder { private String project; private String location; + protected Builder() {} + public String getProject() { return project; } @@ -146,8 +180,6 @@ public Builder setLocation(String location) { return this; } - private Builder() {} - private Builder(LocationName locationName) { project = locationName.project; location = locationName.location; @@ -157,26 +189,4 @@ public LocationName build() { return new LocationName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof LocationName) { - LocationName that = (LocationName) o; - return (this.project.equals(that.project)) && (this.location.equals(that.location)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= location.hashCode(); - return h; - } } diff --git a/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/ProjectName.java b/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/ProjectName.java index c159b3efd..51b646e7e 100644 --- a/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/ProjectName.java +++ b/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/ProjectName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -23,18 +23,26 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class ProjectName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT = PathTemplate.createWithoutUrlEncoding("projects/{project}"); - private volatile Map fieldValuesMap; - private final String project; + @Deprecated + protected ProjectName() { + project = null; + } + + private ProjectName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + } + public String getProject() { return project; } @@ -47,10 +55,6 @@ public Builder toBuilder() { return new Builder(this); } - private ProjectName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - } - public static ProjectName of(String project) { return newBuilder().setProject(project).build(); } @@ -64,7 +68,7 @@ public static ProjectName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT.validatedMatch( formattedString, "ProjectName.parse: formattedString not in valid format"); return of(matchMap.get("project")); } @@ -78,7 +82,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (ProjectName value : values) { if (value == null) { list.add(""); @@ -90,15 +94,18 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); + if (project != null) { + fieldMapBuilder.put("project", project); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -112,14 +119,35 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project); + return PROJECT.instantiate("project", project); } - /** Builder for ProjectName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + ProjectName that = ((ProjectName) o); + return Objects.equals(this.project, that.project); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + return h; + } + + /** Builder for projects/{project}. */ + public static class Builder { private String project; + protected Builder() {} + public String getProject() { return project; } @@ -129,8 +157,6 @@ public Builder setProject(String project) { return this; } - private Builder() {} - private Builder(ProjectName projectName) { project = projectName.project; } @@ -139,24 +165,4 @@ public ProjectName build() { return new ProjectName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof ProjectName) { - ProjectName that = (ProjectName) o; - return (this.project.equals(that.project)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - return h; - } } diff --git a/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/SnapshotName.java b/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/SnapshotName.java index f0159dc33..65dcf87b5 100644 --- a/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/SnapshotName.java +++ b/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/SnapshotName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -23,22 +23,36 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class SnapshotName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_INSTANCE_CLUSTER_SNAPSHOT = PathTemplate.createWithoutUrlEncoding( "projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}"); - private volatile Map fieldValuesMap; - private final String project; private final String instance; private final String cluster; private final String snapshot; + @Deprecated + protected SnapshotName() { + project = null; + instance = null; + cluster = null; + snapshot = null; + } + + private SnapshotName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + instance = Preconditions.checkNotNull(builder.getInstance()); + cluster = Preconditions.checkNotNull(builder.getCluster()); + snapshot = Preconditions.checkNotNull(builder.getSnapshot()); + } + public String getProject() { return project; } @@ -63,13 +77,6 @@ public Builder toBuilder() { return new Builder(this); } - private SnapshotName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - instance = Preconditions.checkNotNull(builder.getInstance()); - cluster = Preconditions.checkNotNull(builder.getCluster()); - snapshot = Preconditions.checkNotNull(builder.getSnapshot()); - } - public static SnapshotName of(String project, String instance, String cluster, String snapshot) { return newBuilder() .setProject(project) @@ -94,7 +101,7 @@ public static SnapshotName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_INSTANCE_CLUSTER_SNAPSHOT.validatedMatch( formattedString, "SnapshotName.parse: formattedString not in valid format"); return of( matchMap.get("project"), @@ -112,7 +119,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (SnapshotName value : values) { if (value == null) { list.add(""); @@ -124,18 +131,27 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_INSTANCE_CLUSTER_SNAPSHOT.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("instance", instance); - fieldMapBuilder.put("cluster", cluster); - fieldMapBuilder.put("snapshot", snapshot); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (instance != null) { + fieldMapBuilder.put("instance", instance); + } + if (cluster != null) { + fieldMapBuilder.put("cluster", cluster); + } + if (snapshot != null) { + fieldMapBuilder.put("snapshot", snapshot); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -149,18 +165,50 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate( + return PROJECT_INSTANCE_CLUSTER_SNAPSHOT.instantiate( "project", project, "instance", instance, "cluster", cluster, "snapshot", snapshot); } - /** Builder for SnapshotName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + SnapshotName that = ((SnapshotName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.instance, that.instance) + && Objects.equals(this.cluster, that.cluster) + && Objects.equals(this.snapshot, that.snapshot); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(instance); + h *= 1000003; + h ^= Objects.hashCode(cluster); + h *= 1000003; + h ^= Objects.hashCode(snapshot); + return h; + } + + /** + * Builder for projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}. + */ + public static class Builder { private String project; private String instance; private String cluster; private String snapshot; + protected Builder() {} + public String getProject() { return project; } @@ -197,8 +245,6 @@ public Builder setSnapshot(String snapshot) { return this; } - private Builder() {} - private Builder(SnapshotName snapshotName) { project = snapshotName.project; instance = snapshotName.instance; @@ -210,33 +256,4 @@ public SnapshotName build() { return new SnapshotName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof SnapshotName) { - SnapshotName that = (SnapshotName) o; - return (this.project.equals(that.project)) - && (this.instance.equals(that.instance)) - && (this.cluster.equals(that.cluster)) - && (this.snapshot.equals(that.snapshot)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= instance.hashCode(); - h *= 1000003; - h ^= cluster.hashCode(); - h *= 1000003; - h ^= snapshot.hashCode(); - return h; - } } diff --git a/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/TableName.java b/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/TableName.java index eacdf9f6e..45ac6098c 100644 --- a/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/TableName.java +++ b/proto-google-cloud-bigtable-admin-v2/src/main/java/com/google/bigtable/admin/v2/TableName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -23,21 +23,33 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class TableName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_INSTANCE_TABLE = PathTemplate.createWithoutUrlEncoding( "projects/{project}/instances/{instance}/tables/{table}"); - private volatile Map fieldValuesMap; - private final String project; private final String instance; private final String table; + @Deprecated + protected TableName() { + project = null; + instance = null; + table = null; + } + + private TableName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + instance = Preconditions.checkNotNull(builder.getInstance()); + table = Preconditions.checkNotNull(builder.getTable()); + } + public String getProject() { return project; } @@ -58,12 +70,6 @@ public Builder toBuilder() { return new Builder(this); } - private TableName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - instance = Preconditions.checkNotNull(builder.getInstance()); - table = Preconditions.checkNotNull(builder.getTable()); - } - public static TableName of(String project, String instance, String table) { return newBuilder().setProject(project).setInstance(instance).setTable(table).build(); } @@ -82,7 +88,7 @@ public static TableName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_INSTANCE_TABLE.validatedMatch( formattedString, "TableName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("instance"), matchMap.get("table")); } @@ -96,7 +102,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (TableName value : values) { if (value == null) { list.add(""); @@ -108,17 +114,24 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_INSTANCE_TABLE.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("instance", instance); - fieldMapBuilder.put("table", table); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (instance != null) { + fieldMapBuilder.put("instance", instance); + } + if (table != null) { + fieldMapBuilder.put("table", table); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -132,16 +145,44 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project, "instance", instance, "table", table); + return PROJECT_INSTANCE_TABLE.instantiate( + "project", project, "instance", instance, "table", table); } - /** Builder for TableName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + TableName that = ((TableName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.instance, that.instance) + && Objects.equals(this.table, that.table); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(instance); + h *= 1000003; + h ^= Objects.hashCode(table); + return h; + } + + /** Builder for projects/{project}/instances/{instance}/tables/{table}. */ + public static class Builder { private String project; private String instance; private String table; + protected Builder() {} + public String getProject() { return project; } @@ -169,8 +210,6 @@ public Builder setTable(String table) { return this; } - private Builder() {} - private Builder(TableName tableName) { project = tableName.project; instance = tableName.instance; @@ -181,30 +220,4 @@ public TableName build() { return new TableName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof TableName) { - TableName that = (TableName) o; - return (this.project.equals(that.project)) - && (this.instance.equals(that.instance)) - && (this.table.equals(that.table)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= instance.hashCode(); - h *= 1000003; - h ^= table.hashCode(); - return h; - } } diff --git a/proto-google-cloud-bigtable-v2/src/main/java/com/google/bigtable/v2/TableName.java b/proto-google-cloud-bigtable-v2/src/main/java/com/google/bigtable/v2/TableName.java index 013bdf8ea..fa94994e4 100644 --- a/proto-google-cloud-bigtable-v2/src/main/java/com/google/bigtable/v2/TableName.java +++ b/proto-google-cloud-bigtable-v2/src/main/java/com/google/bigtable/v2/TableName.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -23,21 +23,33 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; -/** AUTO-GENERATED DOCUMENTATION AND CLASS */ -@javax.annotation.Generated("by GAPIC protoc plugin") +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") public class TableName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_INSTANCE_TABLE = PathTemplate.createWithoutUrlEncoding( "projects/{project}/instances/{instance}/tables/{table}"); - private volatile Map fieldValuesMap; - private final String project; private final String instance; private final String table; + @Deprecated + protected TableName() { + project = null; + instance = null; + table = null; + } + + private TableName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + instance = Preconditions.checkNotNull(builder.getInstance()); + table = Preconditions.checkNotNull(builder.getTable()); + } + public String getProject() { return project; } @@ -58,12 +70,6 @@ public Builder toBuilder() { return new Builder(this); } - private TableName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - instance = Preconditions.checkNotNull(builder.getInstance()); - table = Preconditions.checkNotNull(builder.getTable()); - } - public static TableName of(String project, String instance, String table) { return newBuilder().setProject(project).setInstance(instance).setTable(table).build(); } @@ -82,7 +88,7 @@ public static TableName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_INSTANCE_TABLE.validatedMatch( formattedString, "TableName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("instance"), matchMap.get("table")); } @@ -96,7 +102,7 @@ public static List parseList(List formattedStrings) { } public static List toStringList(List values) { - List list = new ArrayList(values.size()); + List list = new ArrayList<>(values.size()); for (TableName value : values) { if (value == null) { list.add(""); @@ -108,17 +114,24 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PATH_TEMPLATE.matches(formattedString); + return PROJECT_INSTANCE_TABLE.matches(formattedString); } + @Override public Map getFieldValuesMap() { if (fieldValuesMap == null) { synchronized (this) { if (fieldValuesMap == null) { ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); - fieldMapBuilder.put("project", project); - fieldMapBuilder.put("instance", instance); - fieldMapBuilder.put("table", table); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (instance != null) { + fieldMapBuilder.put("instance", instance); + } + if (table != null) { + fieldMapBuilder.put("table", table); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -132,16 +145,44 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project, "instance", instance, "table", table); + return PROJECT_INSTANCE_TABLE.instantiate( + "project", project, "instance", instance, "table", table); } - /** Builder for TableName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + TableName that = ((TableName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.instance, that.instance) + && Objects.equals(this.table, that.table); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(instance); + h *= 1000003; + h ^= Objects.hashCode(table); + return h; + } + + /** Builder for projects/{project}/instances/{instance}/tables/{table}. */ + public static class Builder { private String project; private String instance; private String table; + protected Builder() {} + public String getProject() { return project; } @@ -169,8 +210,6 @@ public Builder setTable(String table) { return this; } - private Builder() {} - private Builder(TableName tableName) { project = tableName.project; instance = tableName.instance; @@ -181,30 +220,4 @@ public TableName build() { return new TableName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof TableName) { - TableName that = (TableName) o; - return (this.project.equals(that.project)) - && (this.instance.equals(that.instance)) - && (this.table.equals(that.table)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= instance.hashCode(); - h *= 1000003; - h ^= table.hashCode(); - return h; - } } diff --git a/synth.metadata b/synth.metadata index 84f6dc41a..4713ed187 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "ccd6462d31e6422fd188b6590aa8d0ad03e7d9a3", - "internalRef": "339464550" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, {