diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata index 2dea9f22..6a03cbf1 100644 --- a/.github/readme/synth.metadata/synth.metadata +++ b/.github/readme/synth.metadata/synth.metadata @@ -4,14 +4,14 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-notebooks.git", - "sha": "c6307cf4b1a521f93f62e4c1fcfe6492f81ba4f7" + "sha": "546898b39e7ee0787c20ca009193a18256bfbf05" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "ba9918cd22874245b55734f57470c719b577e591" + "sha": "996775eca5fd934edac3c2ae34b80ff0395b1717" } } ] diff --git a/.kokoro/release/publish_javadoc.sh b/.kokoro/release/publish_javadoc.sh index 9adfc5eb..966b7e90 100755 --- a/.kokoro/release/publish_javadoc.sh +++ b/.kokoro/release/publish_javadoc.sh @@ -38,8 +38,8 @@ python3 -m pip install gcp-docuploader # compile all packages mvn clean install -B -q -DskipTests=true -NAME=google-cloud-notebooks -VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) +export NAME=google-cloud-notebooks +export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) # build the docs mvn site -B -q @@ -59,7 +59,8 @@ python3 -m docuploader upload . \ popd -# V2 +# V2 due to problems w/ the released javadoc plugin doclava, Java 8 is required. Beware of accidental updates. + mvn clean site -B -q -Ddevsite.template="${KOKORO_GFILE_DIR}/java/" pushd target/devsite/reference diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ac29af8..e48651ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [0.2.2](https://www.github.com/googleapis/java-notebooks/compare/v0.2.1...v0.2.2) (2020-12-14) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.16.1 ([#97](https://www.github.com/googleapis/java-notebooks/issues/97)) ([0e3b090](https://www.github.com/googleapis/java-notebooks/commit/0e3b090ed65b80b6dcb8b87c8e8b4f58546c1935)) + ### [0.2.1](https://www.github.com/googleapis/java-notebooks/compare/v0.2.0...v0.2.1) (2020-12-02) diff --git a/README.md b/README.md index f36ad052..e64c871f 100644 --- a/README.md +++ b/README.md @@ -20,18 +20,18 @@ If you are using Maven, add this to your pom.xml file: com.google.cloud google-cloud-notebooks - 0.2.0 + 0.2.1 ``` If you are using Gradle, add this to your dependencies ```Groovy -compile 'com.google.cloud:google-cloud-notebooks:0.2.0' +compile 'com.google.cloud:google-cloud-notebooks:0.2.1' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-notebooks" % "0.2.0" +libraryDependencies += "com.google.cloud" % "google-cloud-notebooks" % "0.2.1" ``` ## Authentication @@ -112,6 +112,8 @@ Java 8 OSX | [![Kokoro CI][kokoro-badge-image-3]][kokoro-badge-link-3] Java 8 Windows | [![Kokoro CI][kokoro-badge-image-4]][kokoro-badge-link-4] Java 11 | [![Kokoro CI][kokoro-badge-image-5]][kokoro-badge-link-5] +Java is a registered trademark of Oracle and/or its affiliates. + [product-docs]: https://cloud.google.com/ai-platform-notebooks [javadocs]: https://googleapis.dev/java/google-cloud-notebooks/latest/index.html [kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-notebooks/java7.svg diff --git a/google-cloud-notebooks-bom/pom.xml b/google-cloud-notebooks-bom/pom.xml index ebda730b..d0b14e70 100644 --- a/google-cloud-notebooks-bom/pom.xml +++ b/google-cloud-notebooks-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-notebooks-bom - 0.2.1 + 0.2.2 pom com.google.cloud @@ -68,17 +68,17 @@ com.google.cloud google-cloud-notebooks - 0.2.1 + 0.2.2 com.google.api.grpc proto-google-cloud-notebooks-v1beta1 - 0.2.1 + 0.2.2 com.google.api.grpc grpc-google-cloud-notebooks-v1beta1 - 0.2.1 + 0.2.2 diff --git a/google-cloud-notebooks/pom.xml b/google-cloud-notebooks/pom.xml index 41f0024a..9f3f8980 100644 --- a/google-cloud-notebooks/pom.xml +++ b/google-cloud-notebooks/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-notebooks - 0.2.1 + 0.2.2 jar Google AI Platform Notebooks https://github.com/googleapis/java-notebooks @@ -11,7 +11,7 @@ com.google.cloud google-cloud-notebooks-parent - 0.2.1 + 0.2.2 google-cloud-notebooks diff --git a/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/NotebookServiceClient.java b/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/NotebookServiceClient.java index bdd5937b..1c89c4c1 100644 --- a/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/NotebookServiceClient.java +++ b/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/NotebookServiceClient.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.notebooks.v1beta1; import com.google.api.core.ApiFunction; @@ -38,26 +39,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND SERVICE +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Service Description: API v1beta1 service for Cloud AI Platform Notebooks. * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * - *

- * 
- * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
- *   String name = "";
- *   GetInstanceRequest request = GetInstanceRequest.newBuilder()
- *     .setName(name)
- *     .build();
- *   Instance response = notebookServiceClient.getInstance(request);
- * }
- * 
- * 
- * - *

Note: close() needs to be called on the notebookServiceClient object to clean up resources + *

Note: close() needs to be called on the NotebookServiceClient object to clean up resources * such as threads. In the example above, try-with-resources is used, which automatically calls * close(). * @@ -86,30 +75,28 @@ * *

To customize credentials: * - *

- * 
+ * 
{@code
  * NotebookServiceSettings notebookServiceSettings =
  *     NotebookServiceSettings.newBuilder()
  *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
  *         .build();
  * NotebookServiceClient notebookServiceClient =
  *     NotebookServiceClient.create(notebookServiceSettings);
- * 
- * 
+ * }
* - * To customize the endpoint: + *

To customize the endpoint: * - *

- * 
+ * 
{@code
  * NotebookServiceSettings notebookServiceSettings =
  *     NotebookServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
  * NotebookServiceClient notebookServiceClient =
  *     NotebookServiceClient.create(notebookServiceSettings);
- * 
- * 
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator") public class NotebookServiceClient implements BackgroundResource { private final NotebookServiceSettings settings; private final NotebookServiceStub stub; @@ -131,7 +118,7 @@ public static final NotebookServiceClient create(NotebookServiceSettings setting /** * Constructs an instance of NotebookServiceClient, using the given stub for making calls. This is - * for advanced usage - prefer to use NotebookServiceSettings}. + * for advanced usage - prefer using create(NotebookServiceSettings). */ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final NotebookServiceClient create(NotebookServiceStub stub) { @@ -169,30 +156,14 @@ public NotebookServiceStub 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. /** * Lists instances in a given project and location. * - *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String parent = "";
-   *   ListInstancesRequest request = ListInstancesRequest.newBuilder()
-   *     .setParent(parent)
-   *     .build();
-   *   for (Instance element : notebookServiceClient.listInstances(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 */ @@ -200,78 +171,31 @@ public final ListInstancesPagedResponse listInstances(ListInstancesRequest reque return listInstancesPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists instances in a given project and location. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String parent = "";
-   *   ListInstancesRequest request = ListInstancesRequest.newBuilder()
-   *     .setParent(parent)
-   *     .build();
-   *   ApiFuture<ListInstancesPagedResponse> future = notebookServiceClient.listInstancesPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Instance element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listInstancesPagedCallable() { return stub.listInstancesPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists instances in a given project and location. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String parent = "";
-   *   ListInstancesRequest request = ListInstancesRequest.newBuilder()
-   *     .setParent(parent)
-   *     .build();
-   *   while (true) {
-   *     ListInstancesResponse response = notebookServiceClient.listInstancesCallable().call(request);
-   *     for (Instance element : response.getInstancesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listInstancesCallable() { return stub.listInstancesCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets details of a single Instance. * - *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   GetInstanceRequest request = GetInstanceRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   Instance response = notebookServiceClient.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 */ @@ -279,820 +203,364 @@ public final Instance getInstance(GetInstanceRequest request) { return getInstanceCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets details of a single Instance. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   GetInstanceRequest request = GetInstanceRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   ApiFuture<Instance> future = notebookServiceClient.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. /** * Creates a new Instance in a given project and location. * - *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String parent = "";
-   *   String instanceId = "";
-   *   Instance instance = Instance.newBuilder().build();
-   *   CreateInstanceRequest request = CreateInstanceRequest.newBuilder()
-   *     .setParent(parent)
-   *     .setInstanceId(instanceId)
-   *     .setInstance(instance)
-   *     .build();
-   *   Instance response = notebookServiceClient.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. /** * Creates a new Instance in a given project and location. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String parent = "";
-   *   String instanceId = "";
-   *   Instance instance = Instance.newBuilder().build();
-   *   CreateInstanceRequest request = CreateInstanceRequest.newBuilder()
-   *     .setParent(parent)
-   *     .setInstanceId(instanceId)
-   *     .setInstance(instance)
-   *     .build();
-   *   OperationFuture<Instance, OperationMetadata> future = notebookServiceClient.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. /** * Creates a new Instance in a given project and location. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String parent = "";
-   *   String instanceId = "";
-   *   Instance instance = Instance.newBuilder().build();
-   *   CreateInstanceRequest request = CreateInstanceRequest.newBuilder()
-   *     .setParent(parent)
-   *     .setInstanceId(instanceId)
-   *     .setInstance(instance)
-   *     .build();
-   *   ApiFuture<Operation> future = notebookServiceClient.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. /** * Registers an existing legacy notebook instance to the Notebooks API server. Legacy instances * are instances created with the legacy Compute Engine calls. They are not manageable by the * Notebooks API out of the box. This call makes these instances manageable by the Notebooks API. * - *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String parent = "";
-   *   String instanceId = "";
-   *   RegisterInstanceRequest request = RegisterInstanceRequest.newBuilder()
-   *     .setParent(parent)
-   *     .setInstanceId(instanceId)
-   *     .build();
-   *   Instance response = notebookServiceClient.registerInstanceAsync(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 registerInstanceAsync( RegisterInstanceRequest request) { return registerInstanceOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Registers an existing legacy notebook instance to the Notebooks API server. Legacy instances * are instances created with the legacy Compute Engine calls. They are not manageable by the * Notebooks API out of the box. This call makes these instances manageable by the Notebooks API. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String parent = "";
-   *   String instanceId = "";
-   *   RegisterInstanceRequest request = RegisterInstanceRequest.newBuilder()
-   *     .setParent(parent)
-   *     .setInstanceId(instanceId)
-   *     .build();
-   *   OperationFuture<Instance, OperationMetadata> future = notebookServiceClient.registerInstanceOperationCallable().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 registerInstanceOperationCallable() { return stub.registerInstanceOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Registers an existing legacy notebook instance to the Notebooks API server. Legacy instances * are instances created with the legacy Compute Engine calls. They are not manageable by the * Notebooks API out of the box. This call makes these instances manageable by the Notebooks API. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String parent = "";
-   *   String instanceId = "";
-   *   RegisterInstanceRequest request = RegisterInstanceRequest.newBuilder()
-   *     .setParent(parent)
-   *     .setInstanceId(instanceId)
-   *     .build();
-   *   ApiFuture<Operation> future = notebookServiceClient.registerInstanceCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
*/ public final UnaryCallable registerInstanceCallable() { return stub.registerInstanceCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the guest accelerators of a single Instance. * - *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   Instance.AcceleratorType type = Instance.AcceleratorType.ACCELERATOR_TYPE_UNSPECIFIED;
-   *   long coreCount = 0L;
-   *   SetInstanceAcceleratorRequest request = SetInstanceAcceleratorRequest.newBuilder()
-   *     .setName(name)
-   *     .setType(type)
-   *     .setCoreCount(coreCount)
-   *     .build();
-   *   Instance response = notebookServiceClient.setInstanceAcceleratorAsync(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 setInstanceAcceleratorAsync( SetInstanceAcceleratorRequest request) { return setInstanceAcceleratorOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the guest accelerators of a single Instance. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   Instance.AcceleratorType type = Instance.AcceleratorType.ACCELERATOR_TYPE_UNSPECIFIED;
-   *   long coreCount = 0L;
-   *   SetInstanceAcceleratorRequest request = SetInstanceAcceleratorRequest.newBuilder()
-   *     .setName(name)
-   *     .setType(type)
-   *     .setCoreCount(coreCount)
-   *     .build();
-   *   OperationFuture<Instance, OperationMetadata> future = notebookServiceClient.setInstanceAcceleratorOperationCallable().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 setInstanceAcceleratorOperationCallable() { return stub.setInstanceAcceleratorOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the guest accelerators of a single Instance. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   Instance.AcceleratorType type = Instance.AcceleratorType.ACCELERATOR_TYPE_UNSPECIFIED;
-   *   long coreCount = 0L;
-   *   SetInstanceAcceleratorRequest request = SetInstanceAcceleratorRequest.newBuilder()
-   *     .setName(name)
-   *     .setType(type)
-   *     .setCoreCount(coreCount)
-   *     .build();
-   *   ApiFuture<Operation> future = notebookServiceClient.setInstanceAcceleratorCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
*/ public final UnaryCallable setInstanceAcceleratorCallable() { return stub.setInstanceAcceleratorCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the machine type of a single Instance. * - *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   String machineType = "";
-   *   SetInstanceMachineTypeRequest request = SetInstanceMachineTypeRequest.newBuilder()
-   *     .setName(name)
-   *     .setMachineType(machineType)
-   *     .build();
-   *   Instance response = notebookServiceClient.setInstanceMachineTypeAsync(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 setInstanceMachineTypeAsync( SetInstanceMachineTypeRequest request) { return setInstanceMachineTypeOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the machine type of a single Instance. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   String machineType = "";
-   *   SetInstanceMachineTypeRequest request = SetInstanceMachineTypeRequest.newBuilder()
-   *     .setName(name)
-   *     .setMachineType(machineType)
-   *     .build();
-   *   OperationFuture<Instance, OperationMetadata> future = notebookServiceClient.setInstanceMachineTypeOperationCallable().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 setInstanceMachineTypeOperationCallable() { return stub.setInstanceMachineTypeOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the machine type of a single Instance. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   String machineType = "";
-   *   SetInstanceMachineTypeRequest request = SetInstanceMachineTypeRequest.newBuilder()
-   *     .setName(name)
-   *     .setMachineType(machineType)
-   *     .build();
-   *   ApiFuture<Operation> future = notebookServiceClient.setInstanceMachineTypeCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
*/ public final UnaryCallable setInstanceMachineTypeCallable() { return stub.setInstanceMachineTypeCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the labels of an Instance. * - *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   SetInstanceLabelsRequest request = SetInstanceLabelsRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   Instance response = notebookServiceClient.setInstanceLabelsAsync(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 setInstanceLabelsAsync( SetInstanceLabelsRequest request) { return setInstanceLabelsOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the labels of an Instance. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   SetInstanceLabelsRequest request = SetInstanceLabelsRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   OperationFuture<Instance, OperationMetadata> future = notebookServiceClient.setInstanceLabelsOperationCallable().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 setInstanceLabelsOperationCallable() { return stub.setInstanceLabelsOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates the labels of an Instance. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   SetInstanceLabelsRequest request = SetInstanceLabelsRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   ApiFuture<Operation> future = notebookServiceClient.setInstanceLabelsCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
*/ public final UnaryCallable setInstanceLabelsCallable() { return stub.setInstanceLabelsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a single Instance. * - *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   notebookServiceClient.deleteInstanceAsync(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 deleteInstanceAsync( DeleteInstanceRequest request) { return deleteInstanceOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a single Instance. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   OperationFuture<Empty, OperationMetadata> future = notebookServiceClient.deleteInstanceOperationCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable deleteInstanceOperationCallable() { return stub.deleteInstanceOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a single Instance. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   ApiFuture<Operation> future = notebookServiceClient.deleteInstanceCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteInstanceCallable() { return stub.deleteInstanceCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Starts a notebook instance. * - *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   StartInstanceRequest request = StartInstanceRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   Instance response = notebookServiceClient.startInstanceAsync(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 startInstanceAsync( StartInstanceRequest request) { return startInstanceOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Starts a notebook instance. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   StartInstanceRequest request = StartInstanceRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   OperationFuture<Instance, OperationMetadata> future = notebookServiceClient.startInstanceOperationCallable().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 startInstanceOperationCallable() { return stub.startInstanceOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Starts a notebook instance. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   StartInstanceRequest request = StartInstanceRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   ApiFuture<Operation> future = notebookServiceClient.startInstanceCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
*/ public final UnaryCallable startInstanceCallable() { return stub.startInstanceCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Stops a notebook instance. * - *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   StopInstanceRequest request = StopInstanceRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   Instance response = notebookServiceClient.stopInstanceAsync(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 stopInstanceAsync( StopInstanceRequest request) { return stopInstanceOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Stops a notebook instance. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   StopInstanceRequest request = StopInstanceRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   OperationFuture<Instance, OperationMetadata> future = notebookServiceClient.stopInstanceOperationCallable().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 stopInstanceOperationCallable() { return stub.stopInstanceOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Stops a notebook instance. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   StopInstanceRequest request = StopInstanceRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   ApiFuture<Operation> future = notebookServiceClient.stopInstanceCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
*/ public final UnaryCallable stopInstanceCallable() { return stub.stopInstanceCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Resets a notebook instance. * - *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   ResetInstanceRequest request = ResetInstanceRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   Instance response = notebookServiceClient.resetInstanceAsync(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 resetInstanceAsync( ResetInstanceRequest request) { return resetInstanceOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Resets a notebook instance. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   ResetInstanceRequest request = ResetInstanceRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   OperationFuture<Instance, OperationMetadata> future = notebookServiceClient.resetInstanceOperationCallable().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 resetInstanceOperationCallable() { return stub.resetInstanceOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Resets a notebook instance. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   ResetInstanceRequest request = ResetInstanceRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   ApiFuture<Operation> future = notebookServiceClient.resetInstanceCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
*/ public final UnaryCallable resetInstanceCallable() { return stub.resetInstanceCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Allows notebook instances to report their latest instance information to the Notebooks API * server. The server will merge the reported information to the instance metadata store. Do not * use this method directly. * - *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   String vmId = "";
-   *   ReportInstanceInfoRequest request = ReportInstanceInfoRequest.newBuilder()
-   *     .setName(name)
-   *     .setVmId(vmId)
-   *     .build();
-   *   Instance response = notebookServiceClient.reportInstanceInfoAsync(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 reportInstanceInfoAsync( ReportInstanceInfoRequest request) { return reportInstanceInfoOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Allows notebook instances to report their latest instance information to the Notebooks API * server. The server will merge the reported information to the instance metadata store. Do not * use this method directly. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   String vmId = "";
-   *   ReportInstanceInfoRequest request = ReportInstanceInfoRequest.newBuilder()
-   *     .setName(name)
-   *     .setVmId(vmId)
-   *     .build();
-   *   OperationFuture<Instance, OperationMetadata> future = notebookServiceClient.reportInstanceInfoOperationCallable().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 reportInstanceInfoOperationCallable() { return stub.reportInstanceInfoOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Allows notebook instances to report their latest instance information to the Notebooks API * server. The server will merge the reported information to the instance metadata store. Do not * use this method directly. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   String vmId = "";
-   *   ReportInstanceInfoRequest request = ReportInstanceInfoRequest.newBuilder()
-   *     .setName(name)
-   *     .setVmId(vmId)
-   *     .build();
-   *   ApiFuture<Operation> future = notebookServiceClient.reportInstanceInfoCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
*/ public final UnaryCallable reportInstanceInfoCallable() { return stub.reportInstanceInfoCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Check if a notebook instance is upgradable. * - *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String notebookInstance = "";
-   *   IsInstanceUpgradeableRequest request = IsInstanceUpgradeableRequest.newBuilder()
-   *     .setNotebookInstance(notebookInstance)
-   *     .build();
-   *   IsInstanceUpgradeableResponse response = notebookServiceClient.isInstanceUpgradeable(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 */ @@ -1101,201 +569,91 @@ public final IsInstanceUpgradeableResponse isInstanceUpgradeable( return isInstanceUpgradeableCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Check if a notebook instance is upgradable. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String notebookInstance = "";
-   *   IsInstanceUpgradeableRequest request = IsInstanceUpgradeableRequest.newBuilder()
-   *     .setNotebookInstance(notebookInstance)
-   *     .build();
-   *   ApiFuture<IsInstanceUpgradeableResponse> future = notebookServiceClient.isInstanceUpgradeableCallable().futureCall(request);
-   *   // Do something
-   *   IsInstanceUpgradeableResponse response = future.get();
-   * }
-   * 
*/ public final UnaryCallable isInstanceUpgradeableCallable() { return stub.isInstanceUpgradeableCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Upgrades a notebook instance to the latest version. * - *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   UpgradeInstanceRequest request = UpgradeInstanceRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   Instance response = notebookServiceClient.upgradeInstanceAsync(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 upgradeInstanceAsync( UpgradeInstanceRequest request) { return upgradeInstanceOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Upgrades a notebook instance to the latest version. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   UpgradeInstanceRequest request = UpgradeInstanceRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   OperationFuture<Instance, OperationMetadata> future = notebookServiceClient.upgradeInstanceOperationCallable().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 upgradeInstanceOperationCallable() { return stub.upgradeInstanceOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Upgrades a notebook instance to the latest version. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   UpgradeInstanceRequest request = UpgradeInstanceRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   ApiFuture<Operation> future = notebookServiceClient.upgradeInstanceCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
*/ public final UnaryCallable upgradeInstanceCallable() { return stub.upgradeInstanceCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Allows notebook instances to call this endpoint to upgrade themselves. Do not use this method * directly. * - *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   String vmId = "";
-   *   UpgradeInstanceInternalRequest request = UpgradeInstanceInternalRequest.newBuilder()
-   *     .setName(name)
-   *     .setVmId(vmId)
-   *     .build();
-   *   Instance response = notebookServiceClient.upgradeInstanceInternalAsync(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 upgradeInstanceInternalAsync( UpgradeInstanceInternalRequest request) { return upgradeInstanceInternalOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Allows notebook instances to call this endpoint to upgrade themselves. Do not use this method * directly. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   String vmId = "";
-   *   UpgradeInstanceInternalRequest request = UpgradeInstanceInternalRequest.newBuilder()
-   *     .setName(name)
-   *     .setVmId(vmId)
-   *     .build();
-   *   OperationFuture<Instance, OperationMetadata> future = notebookServiceClient.upgradeInstanceInternalOperationCallable().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 upgradeInstanceInternalOperationCallable() { return stub.upgradeInstanceInternalOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Allows notebook instances to call this endpoint to upgrade themselves. Do not use this method * directly. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   String vmId = "";
-   *   UpgradeInstanceInternalRequest request = UpgradeInstanceInternalRequest.newBuilder()
-   *     .setName(name)
-   *     .setVmId(vmId)
-   *     .build();
-   *   ApiFuture<Operation> future = notebookServiceClient.upgradeInstanceInternalCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
*/ public final UnaryCallable upgradeInstanceInternalCallable() { return stub.upgradeInstanceInternalCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists environments in a project. * - *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String parent = "";
-   *   ListEnvironmentsRequest request = ListEnvironmentsRequest.newBuilder()
-   *     .setParent(parent)
-   *     .build();
-   *   for (Environment element : notebookServiceClient.listEnvironments(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 */ @@ -1303,79 +661,32 @@ public final ListEnvironmentsPagedResponse listEnvironments(ListEnvironmentsRequ return listEnvironmentsPagedCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists environments in a project. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String parent = "";
-   *   ListEnvironmentsRequest request = ListEnvironmentsRequest.newBuilder()
-   *     .setParent(parent)
-   *     .build();
-   *   ApiFuture<ListEnvironmentsPagedResponse> future = notebookServiceClient.listEnvironmentsPagedCallable().futureCall(request);
-   *   // Do something
-   *   for (Environment element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listEnvironmentsPagedCallable() { return stub.listEnvironmentsPagedCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists environments in a project. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String parent = "";
-   *   ListEnvironmentsRequest request = ListEnvironmentsRequest.newBuilder()
-   *     .setParent(parent)
-   *     .build();
-   *   while (true) {
-   *     ListEnvironmentsResponse response = notebookServiceClient.listEnvironmentsCallable().call(request);
-   *     for (Environment element : response.getEnvironmentsList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * 
*/ public final UnaryCallable listEnvironmentsCallable() { return stub.listEnvironmentsCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets details of a single Environment. * - *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   GetEnvironmentRequest request = GetEnvironmentRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   Environment response = notebookServiceClient.getEnvironment(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 */ @@ -1383,179 +694,77 @@ public final Environment getEnvironment(GetEnvironmentRequest request) { return getEnvironmentCallable().call(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets details of a single Environment. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   GetEnvironmentRequest request = GetEnvironmentRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   ApiFuture<Environment> future = notebookServiceClient.getEnvironmentCallable().futureCall(request);
-   *   // Do something
-   *   Environment response = future.get();
-   * }
-   * 
*/ public final UnaryCallable getEnvironmentCallable() { return stub.getEnvironmentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new Environment. * - *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String parent = "";
-   *   String environmentId = "";
-   *   Environment environment = Environment.newBuilder().build();
-   *   CreateEnvironmentRequest request = CreateEnvironmentRequest.newBuilder()
-   *     .setParent(parent)
-   *     .setEnvironmentId(environmentId)
-   *     .setEnvironment(environment)
-   *     .build();
-   *   Environment response = notebookServiceClient.createEnvironmentAsync(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 createEnvironmentAsync( CreateEnvironmentRequest request) { return createEnvironmentOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new Environment. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String parent = "";
-   *   String environmentId = "";
-   *   Environment environment = Environment.newBuilder().build();
-   *   CreateEnvironmentRequest request = CreateEnvironmentRequest.newBuilder()
-   *     .setParent(parent)
-   *     .setEnvironmentId(environmentId)
-   *     .setEnvironment(environment)
-   *     .build();
-   *   OperationFuture<Environment, OperationMetadata> future = notebookServiceClient.createEnvironmentOperationCallable().futureCall(request);
-   *   // Do something
-   *   Environment response = future.get();
-   * }
-   * 
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable createEnvironmentOperationCallable() { return stub.createEnvironmentOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new Environment. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String parent = "";
-   *   String environmentId = "";
-   *   Environment environment = Environment.newBuilder().build();
-   *   CreateEnvironmentRequest request = CreateEnvironmentRequest.newBuilder()
-   *     .setParent(parent)
-   *     .setEnvironmentId(environmentId)
-   *     .setEnvironment(environment)
-   *     .build();
-   *   ApiFuture<Operation> future = notebookServiceClient.createEnvironmentCallable().futureCall(request);
-   *   // Do something
-   *   Operation response = future.get();
-   * }
-   * 
*/ public final UnaryCallable createEnvironmentCallable() { return stub.createEnvironmentCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a single Environment. * - *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   DeleteEnvironmentRequest request = DeleteEnvironmentRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   notebookServiceClient.deleteEnvironmentAsync(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 deleteEnvironmentAsync( DeleteEnvironmentRequest request) { return deleteEnvironmentOperationCallable().futureCall(request); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a single Environment. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   DeleteEnvironmentRequest request = DeleteEnvironmentRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   OperationFuture<Empty, OperationMetadata> future = notebookServiceClient.deleteEnvironmentOperationCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public final OperationCallable deleteEnvironmentOperationCallable() { return stub.deleteEnvironmentOperationCallable(); } - // AUTO-GENERATED DOCUMENTATION AND METHOD + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a single Environment. * *

Sample code: - * - *


-   * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
-   *   String name = "";
-   *   DeleteEnvironmentRequest request = DeleteEnvironmentRequest.newBuilder()
-   *     .setName(name)
-   *     .build();
-   *   ApiFuture<Operation> future = notebookServiceClient.deleteEnvironmentCallable().futureCall(request);
-   *   // Do something
-   *   future.get();
-   * }
-   * 
*/ public final UnaryCallable deleteEnvironmentCallable() { return stub.deleteEnvironmentCallable(); diff --git a/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/NotebookServiceSettings.java b/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/NotebookServiceSettings.java index be791aaf..57d71055 100644 --- a/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/NotebookServiceSettings.java +++ b/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/NotebookServiceSettings.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.notebooks.v1beta1; import static com.google.cloud.notebooks.v1beta1.NotebookServiceClient.ListEnvironmentsPagedResponse; @@ -37,7 +38,7 @@ import java.util.List; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** * Settings class to configure an instance of {@link NotebookServiceClient}. * @@ -54,23 +55,24 @@ * *

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

- * 
+ * 
{@code
  * NotebookServiceSettings.Builder notebookServiceSettingsBuilder =
  *     NotebookServiceSettings.newBuilder();
  * notebookServiceSettingsBuilder
  *     .getInstanceSettings()
  *     .setRetrySettings(
- *         notebookServiceSettingsBuilder.getInstanceSettings().getRetrySettings().toBuilder()
+ *         notebookServiceSettingsBuilder
+ *             .getInstanceSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * NotebookServiceSettings notebookServiceSettings = notebookServiceSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") -@BetaApi +@Generated("by gapic-generator-java") public class NotebookServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listInstances. */ public PagedCallSettings listInstancesSettings() { @@ -88,8 +90,6 @@ public UnaryCallSettings createInstanceSetting } /** 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 ((NotebookServiceStubSettings) getStubSettings()).createInstanceOperationSettings(); @@ -101,8 +101,6 @@ public UnaryCallSettings registerInstanceSet } /** Returns the object with the settings used for calls to registerInstance. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings registerInstanceOperationSettings() { return ((NotebookServiceStubSettings) getStubSettings()).registerInstanceOperationSettings(); @@ -115,8 +113,6 @@ public UnaryCallSettings registerInstanceSet } /** Returns the object with the settings used for calls to setInstanceAccelerator. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings setInstanceAcceleratorOperationSettings() { return ((NotebookServiceStubSettings) getStubSettings()) @@ -130,8 +126,6 @@ public UnaryCallSettings registerInstanceSet } /** Returns the object with the settings used for calls to setInstanceMachineType. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings setInstanceMachineTypeOperationSettings() { return ((NotebookServiceStubSettings) getStubSettings()) @@ -144,8 +138,6 @@ public UnaryCallSettings setInstanceLabelsS } /** Returns the object with the settings used for calls to setInstanceLabels. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings setInstanceLabelsOperationSettings() { return ((NotebookServiceStubSettings) getStubSettings()).setInstanceLabelsOperationSettings(); @@ -157,8 +149,6 @@ public UnaryCallSettings deleteInstanceSetting } /** Returns the object with the settings used for calls to deleteInstance. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings deleteInstanceOperationSettings() { return ((NotebookServiceStubSettings) getStubSettings()).deleteInstanceOperationSettings(); @@ -170,8 +160,6 @@ public UnaryCallSettings startInstanceSettings( } /** Returns the object with the settings used for calls to startInstance. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings startInstanceOperationSettings() { return ((NotebookServiceStubSettings) getStubSettings()).startInstanceOperationSettings(); @@ -183,8 +171,6 @@ public UnaryCallSettings stopInstanceSettings() } /** Returns the object with the settings used for calls to stopInstance. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings stopInstanceOperationSettings() { return ((NotebookServiceStubSettings) getStubSettings()).stopInstanceOperationSettings(); @@ -196,8 +182,6 @@ public UnaryCallSettings resetInstanceSettings( } /** Returns the object with the settings used for calls to resetInstance. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings resetInstanceOperationSettings() { return ((NotebookServiceStubSettings) getStubSettings()).resetInstanceOperationSettings(); @@ -209,8 +193,6 @@ public UnaryCallSettings reportInstanceInf } /** Returns the object with the settings used for calls to reportInstanceInfo. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings reportInstanceInfoOperationSettings() { return ((NotebookServiceStubSettings) getStubSettings()).reportInstanceInfoOperationSettings(); @@ -228,8 +210,6 @@ public UnaryCallSettings upgradeInstanceSetti } /** Returns the object with the settings used for calls to upgradeInstance. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings upgradeInstanceOperationSettings() { return ((NotebookServiceStubSettings) getStubSettings()).upgradeInstanceOperationSettings(); @@ -242,8 +222,6 @@ public UnaryCallSettings upgradeInstanceSetti } /** Returns the object with the settings used for calls to upgradeInstanceInternal. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings upgradeInstanceInternalOperationSettings() { return ((NotebookServiceStubSettings) getStubSettings()) @@ -268,8 +246,6 @@ public UnaryCallSettings createEnvironmentS } /** Returns the object with the settings used for calls to createEnvironment. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings createEnvironmentOperationSettings() { return ((NotebookServiceStubSettings) getStubSettings()).createEnvironmentOperationSettings(); @@ -281,8 +257,6 @@ public UnaryCallSettings deleteEnvironmentS } /** Returns the object with the settings used for calls to deleteEnvironment. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings deleteEnvironmentOperationSettings() { return ((NotebookServiceStubSettings) getStubSettings()).deleteEnvironmentOperationSettings(); @@ -348,18 +322,15 @@ protected NotebookServiceSettings(Builder settingsBuilder) throws IOException { /** Builder for NotebookServiceSettings. */ public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { - this((ClientContext) null); + this(((ClientContext) null)); } protected Builder(ClientContext clientContext) { super(NotebookServiceStubSettings.newBuilder(clientContext)); } - private static Builder createDefault() { - return new Builder(NotebookServiceStubSettings.newBuilder()); - } - protected Builder(NotebookServiceSettings settings) { super(settings.getStubSettings().toBuilder()); } @@ -368,11 +339,15 @@ protected Builder(NotebookServiceStubSettings.Builder stubSettings) { super(stubSettings); } + private static Builder createDefault() { + return new Builder(NotebookServiceStubSettings.newBuilder()); + } + public NotebookServiceStubSettings.Builder getStubSettingsBuilder() { return ((NotebookServiceStubSettings.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. * @@ -403,8 +378,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(); @@ -417,8 +390,6 @@ public UnaryCallSettings.Builder createInstanc } /** Returns the builder for the settings used for calls to registerInstance. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder registerInstanceOperationSettings() { return getStubSettingsBuilder().registerInstanceOperationSettings(); @@ -431,8 +402,6 @@ public UnaryCallSettings.Builder createInstanc } /** Returns the builder for the settings used for calls to setInstanceAccelerator. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder setInstanceAcceleratorOperationSettings() { return getStubSettingsBuilder().setInstanceAcceleratorOperationSettings(); @@ -445,8 +414,6 @@ public UnaryCallSettings.Builder createInstanc } /** Returns the builder for the settings used for calls to setInstanceMachineType. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder setInstanceMachineTypeOperationSettings() { return getStubSettingsBuilder().setInstanceMachineTypeOperationSettings(); @@ -459,8 +426,6 @@ public UnaryCallSettings.Builder createInstanc } /** Returns the builder for the settings used for calls to setInstanceLabels. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder setInstanceLabelsOperationSettings() { return getStubSettingsBuilder().setInstanceLabelsOperationSettings(); @@ -472,8 +437,6 @@ public UnaryCallSettings.Builder deleteInstanc } /** Returns the builder for the settings used for calls to deleteInstance. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder deleteInstanceOperationSettings() { return getStubSettingsBuilder().deleteInstanceOperationSettings(); @@ -485,8 +448,6 @@ public UnaryCallSettings.Builder startInstanceS } /** Returns the builder for the settings used for calls to startInstance. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder startInstanceOperationSettings() { return getStubSettingsBuilder().startInstanceOperationSettings(); @@ -498,8 +459,6 @@ public UnaryCallSettings.Builder stopInstanceSet } /** Returns the builder for the settings used for calls to stopInstance. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder stopInstanceOperationSettings() { return getStubSettingsBuilder().stopInstanceOperationSettings(); @@ -511,8 +470,6 @@ public UnaryCallSettings.Builder resetInstanceS } /** Returns the builder for the settings used for calls to resetInstance. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder resetInstanceOperationSettings() { return getStubSettingsBuilder().resetInstanceOperationSettings(); @@ -525,8 +482,6 @@ public UnaryCallSettings.Builder resetInstanceS } /** Returns the builder for the settings used for calls to reportInstanceInfo. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder reportInstanceInfoOperationSettings() { return getStubSettingsBuilder().reportInstanceInfoOperationSettings(); @@ -544,8 +499,6 @@ public UnaryCallSettings.Builder upgradeInsta } /** Returns the builder for the settings used for calls to upgradeInstance. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder upgradeInstanceOperationSettings() { return getStubSettingsBuilder().upgradeInstanceOperationSettings(); @@ -558,8 +511,6 @@ public UnaryCallSettings.Builder upgradeInsta } /** Returns the builder for the settings used for calls to upgradeInstanceInternal. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder< UpgradeInstanceInternalRequest, Instance, OperationMetadata> upgradeInstanceInternalOperationSettings() { @@ -585,8 +536,6 @@ public UnaryCallSettings.Builder getEnvironm } /** Returns the builder for the settings used for calls to createEnvironment. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder createEnvironmentOperationSettings() { return getStubSettingsBuilder().createEnvironmentOperationSettings(); @@ -599,8 +548,6 @@ public UnaryCallSettings.Builder getEnvironm } /** Returns the builder for the settings used for calls to deleteEnvironment. */ - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") public OperationCallSettings.Builder deleteEnvironmentOperationSettings() { return getStubSettingsBuilder().deleteEnvironmentOperationSettings(); diff --git a/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/package-info.java b/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/package-info.java index 0aad784e..f1caed7d 100644 --- a/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/package-info.java +++ b/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/package-info.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, @@ -15,29 +15,15 @@ */ /** - * A client to Notebooks API. + * The interfaces provided are listed below, along with usage samples. * - *

The interfaces provided are listed below, along with usage samples. - * - *

===================== NotebookServiceClient ===================== + *

======================= NotebookServiceClient ======================= * *

Service Description: API v1beta1 service for Cloud AI Platform Notebooks. * *

Sample for NotebookServiceClient: - * - *

- * 
- * try (NotebookServiceClient notebookServiceClient = NotebookServiceClient.create()) {
- *   String name = "";
- *   GetInstanceRequest request = GetInstanceRequest.newBuilder()
- *     .setName(name)
- *     .build();
- *   Instance response = notebookServiceClient.getInstance(request);
- * }
- * 
- * 
*/ -@Generated("by gapic-generator") +@Generated("by gapic-generator-java") package com.google.cloud.notebooks.v1beta1; import javax.annotation.Generated; diff --git a/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/stub/GrpcNotebookServiceCallableFactory.java b/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/stub/GrpcNotebookServiceCallableFactory.java index a46f7bed..3cb8ec8d 100644 --- a/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/stub/GrpcNotebookServiceCallableFactory.java +++ b/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/stub/GrpcNotebookServiceCallableFactory.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.notebooks.v1beta1.stub; -import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; @@ -31,18 +31,19 @@ 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. /** - * gRPC callable factory implementation for Notebooks API. + * gRPC callable factory implementation for the NotebookService service API. * *

This class is for advanced usage. */ @Generated("by gapic-generator") -@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcNotebookServiceCallableFactory implements GrpcStubCallableFactory { + @Override public UnaryCallable createUnaryCallable( GrpcCallSettings grpcCallSettings, @@ -55,61 +56,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-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/stub/GrpcNotebookServiceStub.java b/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/stub/GrpcNotebookServiceStub.java index 453fe200..2e3bba66 100644 --- a/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/stub/GrpcNotebookServiceStub.java +++ b/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/stub/GrpcNotebookServiceStub.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,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.notebooks.v1beta1.stub; import static com.google.cloud.notebooks.v1beta1.NotebookServiceClient.ListEnvironmentsPagedResponse; import static com.google.cloud.notebooks.v1beta1.NotebookServiceClient.ListInstancesPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; @@ -63,16 +63,14 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * gRPC stub implementation for Notebooks API. + * gRPC stub implementation for the NotebookService service API. * *

This class is for advanced usage and reflects the underlying API directly. */ -@Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +@Generated("by gapic-generator-java") public class GrpcNotebookServiceStub extends NotebookServiceStub { - private static final MethodDescriptor listInstancesMethodDescriptor = MethodDescriptor.newBuilder() @@ -83,6 +81,7 @@ public class GrpcNotebookServiceStub extends NotebookServiceStub { .setResponseMarshaller( ProtoUtils.marshaller(ListInstancesResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getInstanceMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -90,6 +89,7 @@ public class GrpcNotebookServiceStub extends NotebookServiceStub { .setRequestMarshaller(ProtoUtils.marshaller(GetInstanceRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Instance.getDefaultInstance())) .build(); + private static final MethodDescriptor createInstanceMethodDescriptor = MethodDescriptor.newBuilder() @@ -99,6 +99,7 @@ public class GrpcNotebookServiceStub extends NotebookServiceStub { ProtoUtils.marshaller(CreateInstanceRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor registerInstanceMethodDescriptor = MethodDescriptor.newBuilder() @@ -108,6 +109,7 @@ public class GrpcNotebookServiceStub extends NotebookServiceStub { ProtoUtils.marshaller(RegisterInstanceRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor setInstanceAcceleratorMethodDescriptor = MethodDescriptor.newBuilder() @@ -118,6 +120,7 @@ public class GrpcNotebookServiceStub extends NotebookServiceStub { ProtoUtils.marshaller(SetInstanceAcceleratorRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor setInstanceMachineTypeMethodDescriptor = MethodDescriptor.newBuilder() @@ -128,6 +131,7 @@ public class GrpcNotebookServiceStub extends NotebookServiceStub { ProtoUtils.marshaller(SetInstanceMachineTypeRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor setInstanceLabelsMethodDescriptor = MethodDescriptor.newBuilder() @@ -137,6 +141,7 @@ public class GrpcNotebookServiceStub extends NotebookServiceStub { ProtoUtils.marshaller(SetInstanceLabelsRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteInstanceMethodDescriptor = MethodDescriptor.newBuilder() @@ -146,6 +151,7 @@ public class GrpcNotebookServiceStub extends NotebookServiceStub { ProtoUtils.marshaller(DeleteInstanceRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor startInstanceMethodDescriptor = MethodDescriptor.newBuilder() @@ -155,6 +161,7 @@ public class GrpcNotebookServiceStub extends NotebookServiceStub { ProtoUtils.marshaller(StartInstanceRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor stopInstanceMethodDescriptor = MethodDescriptor.newBuilder() @@ -163,6 +170,7 @@ public class GrpcNotebookServiceStub extends NotebookServiceStub { .setRequestMarshaller(ProtoUtils.marshaller(StopInstanceRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor resetInstanceMethodDescriptor = MethodDescriptor.newBuilder() @@ -172,6 +180,7 @@ public class GrpcNotebookServiceStub extends NotebookServiceStub { ProtoUtils.marshaller(ResetInstanceRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor reportInstanceInfoMethodDescriptor = MethodDescriptor.newBuilder() @@ -182,6 +191,7 @@ public class GrpcNotebookServiceStub extends NotebookServiceStub { ProtoUtils.marshaller(ReportInstanceInfoRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor isInstanceUpgradeableMethodDescriptor = MethodDescriptor.newBuilder() @@ -193,6 +203,7 @@ public class GrpcNotebookServiceStub extends NotebookServiceStub { .setResponseMarshaller( ProtoUtils.marshaller(IsInstanceUpgradeableResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor upgradeInstanceMethodDescriptor = MethodDescriptor.newBuilder() @@ -202,6 +213,7 @@ public class GrpcNotebookServiceStub extends NotebookServiceStub { ProtoUtils.marshaller(UpgradeInstanceRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor upgradeInstanceInternalMethodDescriptor = MethodDescriptor.newBuilder() @@ -212,6 +224,7 @@ public class GrpcNotebookServiceStub extends NotebookServiceStub { ProtoUtils.marshaller(UpgradeInstanceInternalRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor listEnvironmentsMethodDescriptor = MethodDescriptor.newBuilder() @@ -222,6 +235,7 @@ public class GrpcNotebookServiceStub extends NotebookServiceStub { .setResponseMarshaller( ProtoUtils.marshaller(ListEnvironmentsResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor getEnvironmentMethodDescriptor = MethodDescriptor.newBuilder() @@ -231,6 +245,7 @@ public class GrpcNotebookServiceStub extends NotebookServiceStub { ProtoUtils.marshaller(GetEnvironmentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Environment.getDefaultInstance())) .build(); + private static final MethodDescriptor createEnvironmentMethodDescriptor = MethodDescriptor.newBuilder() @@ -240,6 +255,7 @@ public class GrpcNotebookServiceStub extends NotebookServiceStub { ProtoUtils.marshaller(CreateEnvironmentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor deleteEnvironmentMethodDescriptor = MethodDescriptor.newBuilder() @@ -250,9 +266,6 @@ public class GrpcNotebookServiceStub extends NotebookServiceStub { .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; - private final UnaryCallable listInstancesCallable; private final UnaryCallable listInstancesPagedCallable; @@ -310,6 +323,8 @@ public class GrpcNotebookServiceStub extends NotebookServiceStub { private final OperationCallable deleteEnvironmentOperationCallable; + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcNotebookServiceStub create(NotebookServiceStubSettings settings) @@ -624,7 +639,7 @@ public Map extract(DeleteEnvironmentRequest request) { createInstanceTransportSettings, settings.createInstanceOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.registerInstanceCallable = callableFactory.createUnaryCallable( registerInstanceTransportSettings, settings.registerInstanceSettings(), clientContext); @@ -633,7 +648,7 @@ public Map extract(DeleteEnvironmentRequest request) { registerInstanceTransportSettings, settings.registerInstanceOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.setInstanceAcceleratorCallable = callableFactory.createUnaryCallable( setInstanceAcceleratorTransportSettings, @@ -644,7 +659,7 @@ public Map extract(DeleteEnvironmentRequest request) { setInstanceAcceleratorTransportSettings, settings.setInstanceAcceleratorOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.setInstanceMachineTypeCallable = callableFactory.createUnaryCallable( setInstanceMachineTypeTransportSettings, @@ -655,7 +670,7 @@ public Map extract(DeleteEnvironmentRequest request) { setInstanceMachineTypeTransportSettings, settings.setInstanceMachineTypeOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.setInstanceLabelsCallable = callableFactory.createUnaryCallable( setInstanceLabelsTransportSettings, @@ -666,7 +681,7 @@ public Map extract(DeleteEnvironmentRequest request) { setInstanceLabelsTransportSettings, settings.setInstanceLabelsOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.deleteInstanceCallable = callableFactory.createUnaryCallable( deleteInstanceTransportSettings, settings.deleteInstanceSettings(), clientContext); @@ -675,7 +690,7 @@ public Map extract(DeleteEnvironmentRequest request) { deleteInstanceTransportSettings, settings.deleteInstanceOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.startInstanceCallable = callableFactory.createUnaryCallable( startInstanceTransportSettings, settings.startInstanceSettings(), clientContext); @@ -684,7 +699,7 @@ public Map extract(DeleteEnvironmentRequest request) { startInstanceTransportSettings, settings.startInstanceOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.stopInstanceCallable = callableFactory.createUnaryCallable( stopInstanceTransportSettings, settings.stopInstanceSettings(), clientContext); @@ -693,7 +708,7 @@ public Map extract(DeleteEnvironmentRequest request) { stopInstanceTransportSettings, settings.stopInstanceOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.resetInstanceCallable = callableFactory.createUnaryCallable( resetInstanceTransportSettings, settings.resetInstanceSettings(), clientContext); @@ -702,7 +717,7 @@ public Map extract(DeleteEnvironmentRequest request) { resetInstanceTransportSettings, settings.resetInstanceOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.reportInstanceInfoCallable = callableFactory.createUnaryCallable( reportInstanceInfoTransportSettings, @@ -713,7 +728,7 @@ public Map extract(DeleteEnvironmentRequest request) { reportInstanceInfoTransportSettings, settings.reportInstanceInfoOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.isInstanceUpgradeableCallable = callableFactory.createUnaryCallable( isInstanceUpgradeableTransportSettings, @@ -727,7 +742,7 @@ public Map extract(DeleteEnvironmentRequest request) { upgradeInstanceTransportSettings, settings.upgradeInstanceOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.upgradeInstanceInternalCallable = callableFactory.createUnaryCallable( upgradeInstanceInternalTransportSettings, @@ -738,7 +753,7 @@ public Map extract(DeleteEnvironmentRequest request) { upgradeInstanceInternalTransportSettings, settings.upgradeInstanceInternalOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.listEnvironmentsCallable = callableFactory.createUnaryCallable( listEnvironmentsTransportSettings, settings.listEnvironmentsSettings(), clientContext); @@ -758,7 +773,7 @@ public Map extract(DeleteEnvironmentRequest request) { createEnvironmentTransportSettings, settings.createEnvironmentOperationSettings(), clientContext, - this.operationsStub); + operationsStub); this.deleteEnvironmentCallable = callableFactory.createUnaryCallable( deleteEnvironmentTransportSettings, @@ -769,153 +784,146 @@ public Map extract(DeleteEnvironmentRequest request) { deleteEnvironmentTransportSettings, settings.deleteEnvironmentOperationSettings(), clientContext, - this.operationsStub); + operationsStub); - 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; } + public UnaryCallable listInstancesCallable() { + return listInstancesCallable; + } + public UnaryCallable listInstancesPagedCallable() { return listInstancesPagedCallable; } - public UnaryCallable listInstancesCallable() { - return listInstancesCallable; - } - public UnaryCallable getInstanceCallable() { return getInstanceCallable; } - @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 registerInstanceCallable() { + return registerInstanceCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable registerInstanceOperationCallable() { return registerInstanceOperationCallable; } - public UnaryCallable registerInstanceCallable() { - return registerInstanceCallable; + public UnaryCallable setInstanceAcceleratorCallable() { + return setInstanceAcceleratorCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable setInstanceAcceleratorOperationCallable() { return setInstanceAcceleratorOperationCallable; } - public UnaryCallable setInstanceAcceleratorCallable() { - return setInstanceAcceleratorCallable; + public UnaryCallable setInstanceMachineTypeCallable() { + return setInstanceMachineTypeCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable setInstanceMachineTypeOperationCallable() { return setInstanceMachineTypeOperationCallable; } - public UnaryCallable setInstanceMachineTypeCallable() { - return setInstanceMachineTypeCallable; + public UnaryCallable setInstanceLabelsCallable() { + return setInstanceLabelsCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable setInstanceLabelsOperationCallable() { return setInstanceLabelsOperationCallable; } - public UnaryCallable setInstanceLabelsCallable() { - return setInstanceLabelsCallable; + public UnaryCallable deleteInstanceCallable() { + return deleteInstanceCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable deleteInstanceOperationCallable() { return deleteInstanceOperationCallable; } - public UnaryCallable deleteInstanceCallable() { - return deleteInstanceCallable; + public UnaryCallable startInstanceCallable() { + return startInstanceCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable startInstanceOperationCallable() { return startInstanceOperationCallable; } - public UnaryCallable startInstanceCallable() { - return startInstanceCallable; + public UnaryCallable stopInstanceCallable() { + return stopInstanceCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable stopInstanceOperationCallable() { return stopInstanceOperationCallable; } - public UnaryCallable stopInstanceCallable() { - return stopInstanceCallable; + public UnaryCallable resetInstanceCallable() { + return resetInstanceCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable resetInstanceOperationCallable() { return resetInstanceOperationCallable; } - public UnaryCallable resetInstanceCallable() { - return resetInstanceCallable; + public UnaryCallable reportInstanceInfoCallable() { + return reportInstanceInfoCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable reportInstanceInfoOperationCallable() { return reportInstanceInfoOperationCallable; } - public UnaryCallable reportInstanceInfoCallable() { - return reportInstanceInfoCallable; - } - public UnaryCallable isInstanceUpgradeableCallable() { return isInstanceUpgradeableCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public UnaryCallable upgradeInstanceCallable() { + return upgradeInstanceCallable; + } + public OperationCallable upgradeInstanceOperationCallable() { return upgradeInstanceOperationCallable; } - public UnaryCallable upgradeInstanceCallable() { - return upgradeInstanceCallable; + public UnaryCallable + upgradeInstanceInternalCallable() { + return upgradeInstanceInternalCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable upgradeInstanceInternalOperationCallable() { return upgradeInstanceInternalOperationCallable; } - public UnaryCallable - upgradeInstanceInternalCallable() { - return upgradeInstanceInternalCallable; + public UnaryCallable + listEnvironmentsCallable() { + return listEnvironmentsCallable; } public UnaryCallable @@ -923,35 +931,28 @@ public UnaryCallable upgradeInstanceCallable( return listEnvironmentsPagedCallable; } - public UnaryCallable - listEnvironmentsCallable() { - return listEnvironmentsCallable; - } - public UnaryCallable getEnvironmentCallable() { return getEnvironmentCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public UnaryCallable createEnvironmentCallable() { + return createEnvironmentCallable; + } + public OperationCallable createEnvironmentOperationCallable() { return createEnvironmentOperationCallable; } - public UnaryCallable createEnvironmentCallable() { - return createEnvironmentCallable; + public UnaryCallable deleteEnvironmentCallable() { + return deleteEnvironmentCallable; } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable deleteEnvironmentOperationCallable() { return deleteEnvironmentOperationCallable; } - public UnaryCallable deleteEnvironmentCallable() { - return deleteEnvironmentCallable; - } - @Override public final void close() { shutdown(); diff --git a/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/stub/NotebookServiceStub.java b/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/stub/NotebookServiceStub.java index b7d09d0b..abcec083 100644 --- a/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/stub/NotebookServiceStub.java +++ b/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/stub/NotebookServiceStub.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,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package com.google.cloud.notebooks.v1beta1.stub; import static com.google.cloud.notebooks.v1beta1.NotebookServiceClient.ListEnvironmentsPagedResponse; import static com.google.cloud.notebooks.v1beta1.NotebookServiceClient.ListInstancesPagedResponse; -import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.UnaryCallable; @@ -52,17 +52,15 @@ import com.google.protobuf.Empty; import javax.annotation.Generated; -// AUTO-GENERATED DOCUMENTATION AND CLASS +// AUTO-GENERATED DOCUMENTATION AND CLASS. /** - * Base stub class for Notebooks API. + * Base stub class for the NotebookService service API. * *

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator") -@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public abstract class NotebookServiceStub 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 +78,6 @@ public UnaryCallable getInstanceCallable() { throw new UnsupportedOperationException("Not implemented: getInstanceCallable()"); } - @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()"); @@ -90,7 +87,6 @@ public UnaryCallable createInstanceCallable() throw new UnsupportedOperationException("Not implemented: createInstanceCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable registerInstanceOperationCallable() { throw new UnsupportedOperationException("Not implemented: registerInstanceOperationCallable()"); @@ -100,7 +96,6 @@ public UnaryCallable registerInstanceCallabl throw new UnsupportedOperationException("Not implemented: registerInstanceCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable setInstanceAcceleratorOperationCallable() { throw new UnsupportedOperationException( @@ -111,7 +106,6 @@ public UnaryCallable setInstanceAccele throw new UnsupportedOperationException("Not implemented: setInstanceAcceleratorCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable setInstanceMachineTypeOperationCallable() { throw new UnsupportedOperationException( @@ -122,7 +116,6 @@ public UnaryCallable setInstanceMachin throw new UnsupportedOperationException("Not implemented: setInstanceMachineTypeCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable setInstanceLabelsOperationCallable() { throw new UnsupportedOperationException( @@ -133,7 +126,6 @@ public UnaryCallable setInstanceLabelsCalla throw new UnsupportedOperationException("Not implemented: setInstanceLabelsCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable deleteInstanceOperationCallable() { throw new UnsupportedOperationException("Not implemented: deleteInstanceOperationCallable()"); @@ -143,7 +135,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 startInstanceOperationCallable() { throw new UnsupportedOperationException("Not implemented: startInstanceOperationCallable()"); @@ -153,7 +144,6 @@ public UnaryCallable startInstanceCallable() { throw new UnsupportedOperationException("Not implemented: startInstanceCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable stopInstanceOperationCallable() { throw new UnsupportedOperationException("Not implemented: stopInstanceOperationCallable()"); @@ -163,7 +153,6 @@ public UnaryCallable stopInstanceCallable() { throw new UnsupportedOperationException("Not implemented: stopInstanceCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable resetInstanceOperationCallable() { throw new UnsupportedOperationException("Not implemented: resetInstanceOperationCallable()"); @@ -173,7 +162,6 @@ public UnaryCallable resetInstanceCallable() { throw new UnsupportedOperationException("Not implemented: resetInstanceCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable reportInstanceInfoOperationCallable() { throw new UnsupportedOperationException( @@ -189,7 +177,6 @@ public UnaryCallable reportInstanceInfoCal throw new UnsupportedOperationException("Not implemented: isInstanceUpgradeableCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable upgradeInstanceOperationCallable() { throw new UnsupportedOperationException("Not implemented: upgradeInstanceOperationCallable()"); @@ -199,7 +186,6 @@ public UnaryCallable upgradeInstanceCallable( throw new UnsupportedOperationException("Not implemented: upgradeInstanceCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable upgradeInstanceInternalOperationCallable() { throw new UnsupportedOperationException( @@ -225,7 +211,6 @@ public UnaryCallable getEnvironmentCallable( throw new UnsupportedOperationException("Not implemented: getEnvironmentCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable createEnvironmentOperationCallable() { throw new UnsupportedOperationException( @@ -236,7 +221,6 @@ public UnaryCallable createEnvironmentCalla throw new UnsupportedOperationException("Not implemented: createEnvironmentCallable()"); } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable deleteEnvironmentOperationCallable() { throw new UnsupportedOperationException( diff --git a/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/stub/NotebookServiceStubSettings.java b/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/stub/NotebookServiceStubSettings.java index 4f877019..6637f7e7 100644 --- a/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/stub/NotebookServiceStubSettings.java +++ b/google-cloud-notebooks/src/main/java/com/google/cloud/notebooks/v1beta1/stub/NotebookServiceStubSettings.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.notebooks.v1beta1.stub; import static com.google.cloud.notebooks.v1beta1.NotebookServiceClient.ListEnvironmentsPagedResponse; @@ -80,7 +81,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 NotebookServiceStub}. * @@ -97,22 +98,23 @@ * *

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

- * 
+ * 
{@code
  * NotebookServiceStubSettings.Builder notebookServiceSettingsBuilder =
  *     NotebookServiceStubSettings.newBuilder();
  * notebookServiceSettingsBuilder
  *     .getInstanceSettings()
  *     .setRetrySettings(
- *         notebookServiceSettingsBuilder.getInstanceSettings().getRetrySettings().toBuilder()
+ *         notebookServiceSettingsBuilder
+ *             .getInstanceSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
  *             .setTotalTimeout(Duration.ofSeconds(30))
  *             .build());
  * NotebookServiceStubSettings notebookServiceSettings = notebookServiceSettingsBuilder.build();
- * 
- * 
+ * }
*/ -@Generated("by gapic-generator") @BetaApi +@Generated("by gapic-generator-java") public class NotebookServiceStubSettings extends StubSettings { /** The default scopes of the service. */ private static final ImmutableList DEFAULT_SERVICE_SCOPES = @@ -174,6 +176,118 @@ public class NotebookServiceStubSettings extends StubSettings deleteEnvironmentOperationSettings; + private static final PagedListDescriptor + LIST_INSTANCES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListInstancesRequest injectToken(ListInstancesRequest payload, String token) { + return ListInstancesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListInstancesRequest injectPageSize(ListInstancesRequest payload, int pageSize) { + return ListInstancesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListInstancesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListInstancesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListInstancesResponse payload) { + return payload.getInstancesList() == null + ? ImmutableList.of() + : payload.getInstancesList(); + } + }; + + private static final PagedListDescriptor< + ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> + LIST_ENVIRONMENTS_PAGE_STR_DESC = + new PagedListDescriptor< + ListEnvironmentsRequest, ListEnvironmentsResponse, Environment>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListEnvironmentsRequest injectToken( + ListEnvironmentsRequest payload, String token) { + return ListEnvironmentsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListEnvironmentsRequest injectPageSize( + ListEnvironmentsRequest payload, int pageSize) { + return ListEnvironmentsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListEnvironmentsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListEnvironmentsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListEnvironmentsResponse payload) { + return payload.getEnvironmentsList() == null + ? ImmutableList.of() + : payload.getEnvironmentsList(); + } + }; + + private static final PagedListResponseFactory< + ListInstancesRequest, ListInstancesResponse, ListInstancesPagedResponse> + LIST_INSTANCES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListInstancesRequest, ListInstancesResponse, ListInstancesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListInstancesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_INSTANCES_PAGE_STR_DESC, request, context); + return ListInstancesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse> + LIST_ENVIRONMENTS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListEnvironmentsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_ENVIRONMENTS_PAGE_STR_DESC, request, context); + return ListEnvironmentsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + /** Returns the object with the settings used for calls to listInstances. */ public PagedCallSettings listInstancesSettings() { @@ -191,7 +305,6 @@ public UnaryCallSettings createInstanceSetting } /** 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; @@ -203,7 +316,6 @@ public UnaryCallSettings registerInstanceSet } /** Returns the object with the settings used for calls to registerInstance. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings registerInstanceOperationSettings() { return registerInstanceOperationSettings; @@ -216,7 +328,6 @@ public UnaryCallSettings registerInstanceSet } /** Returns the object with the settings used for calls to setInstanceAccelerator. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings setInstanceAcceleratorOperationSettings() { return setInstanceAcceleratorOperationSettings; @@ -229,7 +340,6 @@ public UnaryCallSettings registerInstanceSet } /** Returns the object with the settings used for calls to setInstanceMachineType. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings setInstanceMachineTypeOperationSettings() { return setInstanceMachineTypeOperationSettings; @@ -241,7 +351,6 @@ public UnaryCallSettings setInstanceLabelsS } /** Returns the object with the settings used for calls to setInstanceLabels. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings setInstanceLabelsOperationSettings() { return setInstanceLabelsOperationSettings; @@ -253,7 +362,6 @@ public UnaryCallSettings deleteInstanceSetting } /** Returns the object with the settings used for calls to deleteInstance. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings deleteInstanceOperationSettings() { return deleteInstanceOperationSettings; @@ -265,7 +373,6 @@ public UnaryCallSettings startInstanceSettings( } /** Returns the object with the settings used for calls to startInstance. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings startInstanceOperationSettings() { return startInstanceOperationSettings; @@ -277,7 +384,6 @@ public UnaryCallSettings stopInstanceSettings() } /** Returns the object with the settings used for calls to stopInstance. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings stopInstanceOperationSettings() { return stopInstanceOperationSettings; @@ -289,7 +395,6 @@ public UnaryCallSettings resetInstanceSettings( } /** Returns the object with the settings used for calls to resetInstance. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings resetInstanceOperationSettings() { return resetInstanceOperationSettings; @@ -301,7 +406,6 @@ public UnaryCallSettings reportInstanceInf } /** Returns the object with the settings used for calls to reportInstanceInfo. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings reportInstanceInfoOperationSettings() { return reportInstanceInfoOperationSettings; @@ -319,7 +423,6 @@ public UnaryCallSettings upgradeInstanceSetti } /** Returns the object with the settings used for calls to upgradeInstance. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings upgradeInstanceOperationSettings() { return upgradeInstanceOperationSettings; @@ -332,7 +435,6 @@ public UnaryCallSettings upgradeInstanceSetti } /** Returns the object with the settings used for calls to upgradeInstanceInternal. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings upgradeInstanceInternalOperationSettings() { return upgradeInstanceInternalOperationSettings; @@ -356,7 +458,6 @@ public UnaryCallSettings createEnvironmentS } /** Returns the object with the settings used for calls to createEnvironment. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings createEnvironmentOperationSettings() { return createEnvironmentOperationSettings; @@ -368,7 +469,6 @@ public UnaryCallSettings deleteEnvironmentS } /** Returns the object with the settings used for calls to deleteEnvironment. */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings deleteEnvironmentOperationSettings() { return deleteEnvironmentOperationSettings; @@ -380,10 +480,10 @@ public NotebookServiceStub createStub() throws IOException { .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcNotebookServiceStub.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. */ @@ -485,122 +585,9 @@ protected NotebookServiceStubSettings(Builder settingsBuilder) throws IOExceptio settingsBuilder.deleteEnvironmentOperationSettings().build(); } - private static final PagedListDescriptor - LIST_INSTANCES_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListInstancesRequest injectToken(ListInstancesRequest payload, String token) { - return ListInstancesRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListInstancesRequest injectPageSize(ListInstancesRequest payload, int pageSize) { - return ListInstancesRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListInstancesRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListInstancesResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListInstancesResponse payload) { - return payload.getInstancesList() != null - ? payload.getInstancesList() - : ImmutableList.of(); - } - }; - - private static final PagedListDescriptor< - ListEnvironmentsRequest, ListEnvironmentsResponse, Environment> - LIST_ENVIRONMENTS_PAGE_STR_DESC = - new PagedListDescriptor< - ListEnvironmentsRequest, ListEnvironmentsResponse, Environment>() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListEnvironmentsRequest injectToken( - ListEnvironmentsRequest payload, String token) { - return ListEnvironmentsRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListEnvironmentsRequest injectPageSize( - ListEnvironmentsRequest payload, int pageSize) { - return ListEnvironmentsRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListEnvironmentsRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListEnvironmentsResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListEnvironmentsResponse payload) { - return payload.getEnvironmentsList() != null - ? payload.getEnvironmentsList() - : ImmutableList.of(); - } - }; - - private static final PagedListResponseFactory< - ListInstancesRequest, ListInstancesResponse, ListInstancesPagedResponse> - LIST_INSTANCES_PAGE_STR_FACT = - new PagedListResponseFactory< - ListInstancesRequest, ListInstancesResponse, ListInstancesPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListInstancesRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_INSTANCES_PAGE_STR_DESC, request, context); - return ListInstancesPagedResponse.createAsync(pageContext, futureResponse); - } - }; - - private static final PagedListResponseFactory< - ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse> - LIST_ENVIRONMENTS_PAGE_STR_FACT = - new PagedListResponseFactory< - ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListEnvironmentsRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext - pageContext = - PageContext.create( - callable, LIST_ENVIRONMENTS_PAGE_STR_DESC, request, context); - return ListEnvironmentsPagedResponse.createAsync(pageContext, futureResponse); - } - }; - /** Builder for NotebookServiceStubSettings. */ public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final PagedCallSettings.Builder< ListInstancesRequest, ListInstancesResponse, ListInstancesPagedResponse> listInstancesSettings; @@ -673,14 +660,12 @@ public static class Builder extends StubSettings.Builder deleteEnvironmentOperationSettings; - private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; static { ImmutableMap.Builder> definitions = ImmutableMap.builder(); - definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); definitions.put( "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); @@ -691,8 +676,6 @@ public static class Builder extends StubSettings.Builder definitions = ImmutableMap.builder(); RetrySettings settings = null; - settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); - definitions.put("no_retry_params", settings); settings = RetrySettings.newBuilder() .setInitialRpcTimeout(Duration.ofMillis(60000L)) @@ -705,76 +688,44 @@ public static class Builder extends StubSettings.Builder>of( + listInstancesSettings, + getInstanceSettings, + createInstanceSettings, + registerInstanceSettings, + setInstanceAcceleratorSettings, + setInstanceMachineTypeSettings, + setInstanceLabelsSettings, + deleteInstanceSettings, + startInstanceSettings, + stopInstanceSettings, + resetInstanceSettings, + reportInstanceInfoSettings, + isInstanceUpgradeableSettings, + upgradeInstanceSettings, + upgradeInstanceInternalSettings, + listEnvironmentsSettings, + getEnvironmentSettings, + createEnvironmentSettings, + deleteEnvironmentSettings); + } + 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 .listInstancesSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) @@ -907,6 +922,7 @@ private static Builder initDefaults(Builder builder) { .deleteEnvironmentSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + builder .createInstanceOperationSettings() .setInitialCallSettings( @@ -922,14 +938,15 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); + builder .registerInstanceOperationSettings() .setInitialCallSettings( @@ -945,14 +962,15 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); + builder .setInstanceAcceleratorOperationSettings() .setInitialCallSettings( @@ -968,14 +986,15 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); + builder .setInstanceMachineTypeOperationSettings() .setInitialCallSettings( @@ -991,14 +1010,15 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); + builder .setInstanceLabelsOperationSettings() .setInitialCallSettings( @@ -1014,14 +1034,15 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); + builder .deleteInstanceOperationSettings() .setInitialCallSettings( @@ -1037,14 +1058,15 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); + builder .startInstanceOperationSettings() .setInitialCallSettings( @@ -1060,14 +1082,15 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); + builder .stopInstanceOperationSettings() .setInitialCallSettings( @@ -1083,14 +1106,15 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); + builder .resetInstanceOperationSettings() .setInitialCallSettings( @@ -1106,14 +1130,15 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); + builder .reportInstanceInfoOperationSettings() .setInitialCallSettings( @@ -1129,14 +1154,15 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); + builder .upgradeInstanceOperationSettings() .setInitialCallSettings( @@ -1152,14 +1178,15 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); + builder .upgradeInstanceInternalOperationSettings() .setInitialCallSettings( @@ -1175,14 +1202,15 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); + builder .createEnvironmentOperationSettings() .setInitialCallSettings( @@ -1198,14 +1226,15 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); + builder .deleteEnvironmentOperationSettings() .setInitialCallSettings( @@ -1221,83 +1250,19 @@ private static Builder initDefaults(Builder builder) { .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(500L)) + .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.5) - .setMaxRetryDelay(Duration.ofMillis(5000L)) - .setInitialRpcTimeout(Duration.ZERO) // ignored - .setRpcTimeoutMultiplier(1.0) // ignored - .setMaxRpcTimeout(Duration.ZERO) // ignored + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) .setTotalTimeout(Duration.ofMillis(300000L)) .build())); return builder; } - protected Builder(NotebookServiceStubSettings settings) { - super(settings); - - listInstancesSettings = settings.listInstancesSettings.toBuilder(); - getInstanceSettings = settings.getInstanceSettings.toBuilder(); - createInstanceSettings = settings.createInstanceSettings.toBuilder(); - createInstanceOperationSettings = settings.createInstanceOperationSettings.toBuilder(); - registerInstanceSettings = settings.registerInstanceSettings.toBuilder(); - registerInstanceOperationSettings = settings.registerInstanceOperationSettings.toBuilder(); - setInstanceAcceleratorSettings = settings.setInstanceAcceleratorSettings.toBuilder(); - setInstanceAcceleratorOperationSettings = - settings.setInstanceAcceleratorOperationSettings.toBuilder(); - setInstanceMachineTypeSettings = settings.setInstanceMachineTypeSettings.toBuilder(); - setInstanceMachineTypeOperationSettings = - settings.setInstanceMachineTypeOperationSettings.toBuilder(); - setInstanceLabelsSettings = settings.setInstanceLabelsSettings.toBuilder(); - setInstanceLabelsOperationSettings = settings.setInstanceLabelsOperationSettings.toBuilder(); - deleteInstanceSettings = settings.deleteInstanceSettings.toBuilder(); - deleteInstanceOperationSettings = settings.deleteInstanceOperationSettings.toBuilder(); - startInstanceSettings = settings.startInstanceSettings.toBuilder(); - startInstanceOperationSettings = settings.startInstanceOperationSettings.toBuilder(); - stopInstanceSettings = settings.stopInstanceSettings.toBuilder(); - stopInstanceOperationSettings = settings.stopInstanceOperationSettings.toBuilder(); - resetInstanceSettings = settings.resetInstanceSettings.toBuilder(); - resetInstanceOperationSettings = settings.resetInstanceOperationSettings.toBuilder(); - reportInstanceInfoSettings = settings.reportInstanceInfoSettings.toBuilder(); - reportInstanceInfoOperationSettings = - settings.reportInstanceInfoOperationSettings.toBuilder(); - isInstanceUpgradeableSettings = settings.isInstanceUpgradeableSettings.toBuilder(); - upgradeInstanceSettings = settings.upgradeInstanceSettings.toBuilder(); - upgradeInstanceOperationSettings = settings.upgradeInstanceOperationSettings.toBuilder(); - upgradeInstanceInternalSettings = settings.upgradeInstanceInternalSettings.toBuilder(); - upgradeInstanceInternalOperationSettings = - settings.upgradeInstanceInternalOperationSettings.toBuilder(); - listEnvironmentsSettings = settings.listEnvironmentsSettings.toBuilder(); - getEnvironmentSettings = settings.getEnvironmentSettings.toBuilder(); - createEnvironmentSettings = settings.createEnvironmentSettings.toBuilder(); - createEnvironmentOperationSettings = settings.createEnvironmentOperationSettings.toBuilder(); - deleteEnvironmentSettings = settings.deleteEnvironmentSettings.toBuilder(); - deleteEnvironmentOperationSettings = settings.deleteEnvironmentOperationSettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - listInstancesSettings, - getInstanceSettings, - createInstanceSettings, - registerInstanceSettings, - setInstanceAcceleratorSettings, - setInstanceMachineTypeSettings, - setInstanceLabelsSettings, - deleteInstanceSettings, - startInstanceSettings, - stopInstanceSettings, - resetInstanceSettings, - reportInstanceInfoSettings, - isInstanceUpgradeableSettings, - upgradeInstanceSettings, - upgradeInstanceInternalSettings, - listEnvironmentsSettings, - getEnvironmentSettings, - createEnvironmentSettings, - deleteEnvironmentSettings); - } - - // 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-notebooks/src/test/java/com/google/cloud/notebooks/v1beta1/MockNotebookService.java b/google-cloud-notebooks/src/test/java/com/google/cloud/notebooks/v1beta1/MockNotebookService.java index 886fbd0d..f05105a0 100644 --- a/google-cloud-notebooks/src/test/java/com/google/cloud/notebooks/v1beta1/MockNotebookService.java +++ b/google-cloud-notebooks/src/test/java/com/google/cloud/notebooks/v1beta1/MockNotebookService.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.notebooks.v1beta1; 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 MockNotebookService implements MockGrpcService { private final MockNotebookServiceImpl serviceImpl; diff --git a/google-cloud-notebooks/src/test/java/com/google/cloud/notebooks/v1beta1/MockNotebookServiceImpl.java b/google-cloud-notebooks/src/test/java/com/google/cloud/notebooks/v1beta1/MockNotebookServiceImpl.java index 4e15c817..6e03e97a 100644 --- a/google-cloud-notebooks/src/test/java/com/google/cloud/notebooks/v1beta1/MockNotebookServiceImpl.java +++ b/google-cloud-notebooks/src/test/java/com/google/cloud/notebooks/v1beta1/MockNotebookServiceImpl.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.notebooks.v1beta1; import com.google.api.core.BetaApi; @@ -24,9 +25,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 MockNotebookServiceImpl extends NotebookServiceImplBase { private List requests; private Queue responses; @@ -63,10 +65,10 @@ 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); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -77,10 +79,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")); } @@ -92,10 +94,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")); } @@ -107,10 +109,10 @@ public void registerInstance( 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")); } @@ -122,10 +124,10 @@ public void setInstanceAccelerator( 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")); } @@ -137,10 +139,10 @@ public void setInstanceMachineType( 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")); } @@ -152,10 +154,10 @@ public void setInstanceLabels( 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")); } @@ -167,10 +169,10 @@ public void deleteInstance( 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")); } @@ -182,10 +184,10 @@ public void startInstance( 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")); } @@ -197,10 +199,10 @@ public void stopInstance( 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")); } @@ -212,10 +214,10 @@ public void resetInstance( 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")); } @@ -227,10 +229,10 @@ public void reportInstanceInfo( 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")); } @@ -243,10 +245,10 @@ public void isInstanceUpgradeable( Object response = responses.remove(); if (response instanceof IsInstanceUpgradeableResponse) { requests.add(request); - responseObserver.onNext((IsInstanceUpgradeableResponse) response); + responseObserver.onNext(((IsInstanceUpgradeableResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -258,10 +260,10 @@ public void upgradeInstance( 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")); } @@ -273,10 +275,10 @@ public void upgradeInstanceInternal( 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")); } @@ -288,10 +290,10 @@ public void listEnvironments( Object response = responses.remove(); if (response instanceof ListEnvironmentsResponse) { requests.add(request); - responseObserver.onNext((ListEnvironmentsResponse) response); + responseObserver.onNext(((ListEnvironmentsResponse) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -303,10 +305,10 @@ public void getEnvironment( Object response = responses.remove(); if (response instanceof Environment) { requests.add(request); - responseObserver.onNext((Environment) response); + responseObserver.onNext(((Environment) response)); responseObserver.onCompleted(); } else if (response instanceof Exception) { - responseObserver.onError((Exception) response); + responseObserver.onError(((Exception) response)); } else { responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); } @@ -318,10 +320,10 @@ public void createEnvironment( 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")); } @@ -333,10 +335,10 @@ public void deleteEnvironment( 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")); } diff --git a/google-cloud-notebooks/src/test/java/com/google/cloud/notebooks/v1beta1/NotebookServiceClientTest.java b/google-cloud-notebooks/src/test/java/com/google/cloud/notebooks/v1beta1/NotebookServiceClientTest.java index 21f09069..be0cb1c7 100644 --- a/google-cloud-notebooks/src/test/java/com/google/cloud/notebooks/v1beta1/NotebookServiceClientTest.java +++ b/google-cloud-notebooks/src/test/java/com/google/cloud/notebooks/v1beta1/NotebookServiceClientTest.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.notebooks.v1beta1; import static com.google.cloud.notebooks.v1beta1.NotebookServiceClient.ListEnvironmentsPagedResponse; @@ -31,13 +32,16 @@ import com.google.protobuf.AbstractMessage; import com.google.protobuf.Any; import com.google.protobuf.Empty; -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.UUID; import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -45,31 +49,31 @@ import org.junit.BeforeClass; import org.junit.Test; -@javax.annotation.Generated("by GAPIC") +@Generated("by gapic-generator-java") public class NotebookServiceClientTest { + private static MockServiceHelper mockServiceHelper; private static MockNotebookService mockNotebookService; - private static MockServiceHelper serviceHelper; private NotebookServiceClient client; private LocalChannelProvider channelProvider; @BeforeClass public static void startStaticServer() { mockNotebookService = new MockNotebookService(); - serviceHelper = + mockServiceHelper = new MockServiceHelper( UUID.randomUUID().toString(), Arrays.asList(mockNotebookService)); - serviceHelper.start(); + 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(); NotebookServiceSettings settings = NotebookServiceSettings.newBuilder() .setTransportChannelProvider(channelProvider) @@ -84,32 +88,36 @@ public void tearDown() throws Exception { } @Test - @SuppressWarnings("all") - public void listInstancesTest() { - String nextPageToken = ""; - Instance instancesElement = Instance.newBuilder().build(); - List instances = Arrays.asList(instancesElement); + public void listInstancesTest() throws Exception { + Instance responsesElement = Instance.newBuilder().build(); ListInstancesResponse expectedResponse = ListInstancesResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllInstances(instances) + .setNextPageToken("") + .addAllInstances(Arrays.asList(responsesElement)) .build(); mockNotebookService.addResponse(expectedResponse); - String parent = "parent-995424086"; - ListInstancesRequest request = ListInstancesRequest.newBuilder().setParent(parent).build(); + ListInstancesRequest request = + ListInstancesRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); ListInstancesPagedResponse pagedListResponse = client.listInstances(request); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getInstancesList().get(0), resources.get(0)); List actualRequests = mockNotebookService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListInstancesRequest actualRequest = (ListInstancesRequest) actualRequests.get(0); + ListInstancesRequest actualRequest = ((ListInstancesRequest) actualRequests.get(0)); - Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -117,71 +125,61 @@ 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); mockNotebookService.addException(exception); try { - String parent = "parent-995424086"; - ListInstancesRequest request = ListInstancesRequest.newBuilder().setParent(parent).build(); - + ListInstancesRequest request = + ListInstancesRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); client.listInstances(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getInstanceTest() { - InstanceName name2 = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String postStartupScript = "postStartupScript355382860"; - String proxyUri = "proxyUri-475670501"; - String serviceAccount = "serviceAccount-1948028253"; - String machineType = "machineType1838323762"; - boolean installGpuDriver = false; - String customGpuDriverPath = "customGpuDriverPath1863223803"; - long bootDiskSizeGb = 1398920548L; - long dataDiskSizeGb = 1668379732L; - boolean noRemoveDataDisk = false; - String kmsKey = "kmsKey-591635343"; - boolean noPublicIp = false; - boolean noProxyAccess = false; - String network = "network1843485230"; - String subnet = "subnet-891534499"; + public void getInstanceTest() throws Exception { Instance expectedResponse = Instance.newBuilder() - .setName(name2.toString()) - .setPostStartupScript(postStartupScript) - .setProxyUri(proxyUri) - .setServiceAccount(serviceAccount) - .setMachineType(machineType) - .setInstallGpuDriver(installGpuDriver) - .setCustomGpuDriverPath(customGpuDriverPath) - .setBootDiskSizeGb(bootDiskSizeGb) - .setDataDiskSizeGb(dataDiskSizeGb) - .setNoRemoveDataDisk(noRemoveDataDisk) - .setKmsKey(kmsKey) - .setNoPublicIp(noPublicIp) - .setNoProxyAccess(noProxyAccess) - .setNetwork(network) - .setSubnet(subnet) + .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setPostStartupScript("postStartupScript870779112") + .setProxyUri("proxyUri-985185250") + .addAllInstanceOwners(new ArrayList()) + .setServiceAccount("serviceAccount1079137720") + .setMachineType("machineType-218117087") + .setInstallGpuDriver(true) + .setCustomGpuDriverPath("customGpuDriverPath509224520") + .setBootDiskSizeGb(1398920548) + .setDataDiskSizeGb(-1668379732) + .setNoRemoveDataDisk(true) + .setKmsKey("kmsKey-1127483058") + .setNoPublicIp(true) + .setNoProxyAccess(true) + .setNetwork("network1843485230") + .setSubnet("subnet-891534499") + .putAllLabels(new HashMap()) + .putAllMetadata(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) .build(); mockNotebookService.addResponse(expectedResponse); - String name = "name3373707"; - GetInstanceRequest request = GetInstanceRequest.newBuilder().setName(name).build(); + GetInstanceRequest request = GetInstanceRequest.newBuilder().setName("name3373707").build(); Instance actualResponse = client.getInstance(request); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockNotebookService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetInstanceRequest actualRequest = (GetInstanceRequest) actualRequests.get(0); + GetInstanceRequest actualRequest = ((GetInstanceRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(request.getName(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -189,57 +187,43 @@ 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); mockNotebookService.addException(exception); try { - String name = "name3373707"; - GetInstanceRequest request = GetInstanceRequest.newBuilder().setName(name).build(); - + GetInstanceRequest request = GetInstanceRequest.newBuilder().setName("name3373707").build(); client.getInstance(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") public void createInstanceTest() throws Exception { - InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String postStartupScript = "postStartupScript355382860"; - String proxyUri = "proxyUri-475670501"; - String serviceAccount = "serviceAccount-1948028253"; - String machineType = "machineType1838323762"; - boolean installGpuDriver = false; - String customGpuDriverPath = "customGpuDriverPath1863223803"; - long bootDiskSizeGb = 1398920548L; - long dataDiskSizeGb = 1668379732L; - boolean noRemoveDataDisk = false; - String kmsKey = "kmsKey-591635343"; - boolean noPublicIp = false; - boolean noProxyAccess = false; - String network = "network1843485230"; - String subnet = "subnet-891534499"; Instance expectedResponse = Instance.newBuilder() - .setName(name.toString()) - .setPostStartupScript(postStartupScript) - .setProxyUri(proxyUri) - .setServiceAccount(serviceAccount) - .setMachineType(machineType) - .setInstallGpuDriver(installGpuDriver) - .setCustomGpuDriverPath(customGpuDriverPath) - .setBootDiskSizeGb(bootDiskSizeGb) - .setDataDiskSizeGb(dataDiskSizeGb) - .setNoRemoveDataDisk(noRemoveDataDisk) - .setKmsKey(kmsKey) - .setNoPublicIp(noPublicIp) - .setNoProxyAccess(noProxyAccess) - .setNetwork(network) - .setSubnet(subnet) + .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setPostStartupScript("postStartupScript870779112") + .setProxyUri("proxyUri-985185250") + .addAllInstanceOwners(new ArrayList()) + .setServiceAccount("serviceAccount1079137720") + .setMachineType("machineType-218117087") + .setInstallGpuDriver(true) + .setCustomGpuDriverPath("customGpuDriverPath509224520") + .setBootDiskSizeGb(1398920548) + .setDataDiskSizeGb(-1668379732) + .setNoRemoveDataDisk(true) + .setKmsKey("kmsKey-1127483058") + .setNoPublicIp(true) + .setNoProxyAccess(true) + .setNetwork("network1843485230") + .setSubnet("subnet-891534499") + .putAllLabels(new HashMap()) + .putAllMetadata(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -249,14 +233,11 @@ public void createInstanceTest() throws Exception { .build(); mockNotebookService.addResponse(resultOperation); - String parent = "parent-995424086"; - String instanceId = "instanceId-2101995259"; - Instance instance = Instance.newBuilder().build(); CreateInstanceRequest request = CreateInstanceRequest.newBuilder() - .setParent(parent) - .setInstanceId(instanceId) - .setInstance(instance) + .setParent("parent-995424086") + .setInstanceId("instanceId902024336") + .setInstance(Instance.newBuilder().build()) .build(); Instance actualResponse = client.createInstanceAsync(request).get(); @@ -264,11 +245,11 @@ public void createInstanceTest() throws Exception { List actualRequests = mockNotebookService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateInstanceRequest actualRequest = (CreateInstanceRequest) actualRequests.get(0); + CreateInstanceRequest actualRequest = ((CreateInstanceRequest) actualRequests.get(0)); - Assert.assertEquals(parent, actualRequest.getParent()); - Assert.assertEquals(instanceId, actualRequest.getInstanceId()); - Assert.assertEquals(instance, actualRequest.getInstance()); + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getInstanceId(), actualRequest.getInstanceId()); + Assert.assertEquals(request.getInstance(), actualRequest.getInstance()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -276,66 +257,50 @@ 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); mockNotebookService.addException(exception); try { - String parent = "parent-995424086"; - String instanceId = "instanceId-2101995259"; - Instance instance = Instance.newBuilder().build(); CreateInstanceRequest request = CreateInstanceRequest.newBuilder() - .setParent(parent) - .setInstanceId(instanceId) - .setInstance(instance) + .setParent("parent-995424086") + .setInstanceId("instanceId902024336") + .setInstance(Instance.newBuilder().build()) .build(); - client.createInstanceAsync(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 registerInstanceTest() throws Exception { - InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String postStartupScript = "postStartupScript355382860"; - String proxyUri = "proxyUri-475670501"; - String serviceAccount = "serviceAccount-1948028253"; - String machineType = "machineType1838323762"; - boolean installGpuDriver = false; - String customGpuDriverPath = "customGpuDriverPath1863223803"; - long bootDiskSizeGb = 1398920548L; - long dataDiskSizeGb = 1668379732L; - boolean noRemoveDataDisk = false; - String kmsKey = "kmsKey-591635343"; - boolean noPublicIp = false; - boolean noProxyAccess = false; - String network = "network1843485230"; - String subnet = "subnet-891534499"; Instance expectedResponse = Instance.newBuilder() - .setName(name.toString()) - .setPostStartupScript(postStartupScript) - .setProxyUri(proxyUri) - .setServiceAccount(serviceAccount) - .setMachineType(machineType) - .setInstallGpuDriver(installGpuDriver) - .setCustomGpuDriverPath(customGpuDriverPath) - .setBootDiskSizeGb(bootDiskSizeGb) - .setDataDiskSizeGb(dataDiskSizeGb) - .setNoRemoveDataDisk(noRemoveDataDisk) - .setKmsKey(kmsKey) - .setNoPublicIp(noPublicIp) - .setNoProxyAccess(noProxyAccess) - .setNetwork(network) - .setSubnet(subnet) + .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setPostStartupScript("postStartupScript870779112") + .setProxyUri("proxyUri-985185250") + .addAllInstanceOwners(new ArrayList()) + .setServiceAccount("serviceAccount1079137720") + .setMachineType("machineType-218117087") + .setInstallGpuDriver(true) + .setCustomGpuDriverPath("customGpuDriverPath509224520") + .setBootDiskSizeGb(1398920548) + .setDataDiskSizeGb(-1668379732) + .setNoRemoveDataDisk(true) + .setKmsKey("kmsKey-1127483058") + .setNoPublicIp(true) + .setNoProxyAccess(true) + .setNetwork("network1843485230") + .setSubnet("subnet-891534499") + .putAllLabels(new HashMap()) + .putAllMetadata(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -345,20 +310,21 @@ public void registerInstanceTest() throws Exception { .build(); mockNotebookService.addResponse(resultOperation); - String parent = "parent-995424086"; - String instanceId = "instanceId-2101995259"; RegisterInstanceRequest request = - RegisterInstanceRequest.newBuilder().setParent(parent).setInstanceId(instanceId).build(); + RegisterInstanceRequest.newBuilder() + .setParent("parent-995424086") + .setInstanceId("instanceId902024336") + .build(); Instance actualResponse = client.registerInstanceAsync(request).get(); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockNotebookService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - RegisterInstanceRequest actualRequest = (RegisterInstanceRequest) actualRequests.get(0); + RegisterInstanceRequest actualRequest = ((RegisterInstanceRequest) actualRequests.get(0)); - Assert.assertEquals(parent, actualRequest.getParent()); - Assert.assertEquals(instanceId, actualRequest.getInstanceId()); + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getInstanceId(), actualRequest.getInstanceId()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -366,61 +332,49 @@ public void registerInstanceTest() throws Exception { } @Test - @SuppressWarnings("all") public void registerInstanceExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockNotebookService.addException(exception); try { - String parent = "parent-995424086"; - String instanceId = "instanceId-2101995259"; RegisterInstanceRequest request = - RegisterInstanceRequest.newBuilder().setParent(parent).setInstanceId(instanceId).build(); - + RegisterInstanceRequest.newBuilder() + .setParent("parent-995424086") + .setInstanceId("instanceId902024336") + .build(); client.registerInstanceAsync(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 setInstanceAcceleratorTest() throws Exception { - InstanceName name2 = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String postStartupScript = "postStartupScript355382860"; - String proxyUri = "proxyUri-475670501"; - String serviceAccount = "serviceAccount-1948028253"; - String machineType = "machineType1838323762"; - boolean installGpuDriver = false; - String customGpuDriverPath = "customGpuDriverPath1863223803"; - long bootDiskSizeGb = 1398920548L; - long dataDiskSizeGb = 1668379732L; - boolean noRemoveDataDisk = false; - String kmsKey = "kmsKey-591635343"; - boolean noPublicIp = false; - boolean noProxyAccess = false; - String network = "network1843485230"; - String subnet = "subnet-891534499"; Instance expectedResponse = Instance.newBuilder() - .setName(name2.toString()) - .setPostStartupScript(postStartupScript) - .setProxyUri(proxyUri) - .setServiceAccount(serviceAccount) - .setMachineType(machineType) - .setInstallGpuDriver(installGpuDriver) - .setCustomGpuDriverPath(customGpuDriverPath) - .setBootDiskSizeGb(bootDiskSizeGb) - .setDataDiskSizeGb(dataDiskSizeGb) - .setNoRemoveDataDisk(noRemoveDataDisk) - .setKmsKey(kmsKey) - .setNoPublicIp(noPublicIp) - .setNoProxyAccess(noProxyAccess) - .setNetwork(network) - .setSubnet(subnet) + .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setPostStartupScript("postStartupScript870779112") + .setProxyUri("proxyUri-985185250") + .addAllInstanceOwners(new ArrayList()) + .setServiceAccount("serviceAccount1079137720") + .setMachineType("machineType-218117087") + .setInstallGpuDriver(true) + .setCustomGpuDriverPath("customGpuDriverPath509224520") + .setBootDiskSizeGb(1398920548) + .setDataDiskSizeGb(-1668379732) + .setNoRemoveDataDisk(true) + .setKmsKey("kmsKey-1127483058") + .setNoPublicIp(true) + .setNoProxyAccess(true) + .setNetwork("network1843485230") + .setSubnet("subnet-891534499") + .putAllLabels(new HashMap()) + .putAllMetadata(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -430,14 +384,10 @@ public void setInstanceAcceleratorTest() throws Exception { .build(); mockNotebookService.addResponse(resultOperation); - String name = "name3373707"; - Instance.AcceleratorType type = Instance.AcceleratorType.ACCELERATOR_TYPE_UNSPECIFIED; - long coreCount = 1963855761L; SetInstanceAcceleratorRequest request = SetInstanceAcceleratorRequest.newBuilder() - .setName(name) - .setType(type) - .setCoreCount(coreCount) + .setName("name3373707") + .setCoreCount(-1963855761) .build(); Instance actualResponse = client.setInstanceAcceleratorAsync(request).get(); @@ -446,11 +396,11 @@ public void setInstanceAcceleratorTest() throws Exception { List actualRequests = mockNotebookService.getRequests(); Assert.assertEquals(1, actualRequests.size()); SetInstanceAcceleratorRequest actualRequest = - (SetInstanceAcceleratorRequest) actualRequests.get(0); + ((SetInstanceAcceleratorRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertEquals(type, actualRequest.getType()); - Assert.assertEquals(coreCount, actualRequest.getCoreCount()); + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getType(), actualRequest.getType()); + Assert.assertEquals(request.getCoreCount(), actualRequest.getCoreCount()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -458,66 +408,49 @@ public void setInstanceAcceleratorTest() throws Exception { } @Test - @SuppressWarnings("all") public void setInstanceAcceleratorExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockNotebookService.addException(exception); try { - String name = "name3373707"; - Instance.AcceleratorType type = Instance.AcceleratorType.ACCELERATOR_TYPE_UNSPECIFIED; - long coreCount = 1963855761L; SetInstanceAcceleratorRequest request = SetInstanceAcceleratorRequest.newBuilder() - .setName(name) - .setType(type) - .setCoreCount(coreCount) + .setName("name3373707") + .setCoreCount(-1963855761) .build(); - client.setInstanceAcceleratorAsync(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 setInstanceMachineTypeTest() throws Exception { - InstanceName name2 = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String postStartupScript = "postStartupScript355382860"; - String proxyUri = "proxyUri-475670501"; - String serviceAccount = "serviceAccount-1948028253"; - String machineType2 = "machineType21397579621"; - boolean installGpuDriver = false; - String customGpuDriverPath = "customGpuDriverPath1863223803"; - long bootDiskSizeGb = 1398920548L; - long dataDiskSizeGb = 1668379732L; - boolean noRemoveDataDisk = false; - String kmsKey = "kmsKey-591635343"; - boolean noPublicIp = false; - boolean noProxyAccess = false; - String network = "network1843485230"; - String subnet = "subnet-891534499"; Instance expectedResponse = Instance.newBuilder() - .setName(name2.toString()) - .setPostStartupScript(postStartupScript) - .setProxyUri(proxyUri) - .setServiceAccount(serviceAccount) - .setMachineType(machineType2) - .setInstallGpuDriver(installGpuDriver) - .setCustomGpuDriverPath(customGpuDriverPath) - .setBootDiskSizeGb(bootDiskSizeGb) - .setDataDiskSizeGb(dataDiskSizeGb) - .setNoRemoveDataDisk(noRemoveDataDisk) - .setKmsKey(kmsKey) - .setNoPublicIp(noPublicIp) - .setNoProxyAccess(noProxyAccess) - .setNetwork(network) - .setSubnet(subnet) + .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setPostStartupScript("postStartupScript870779112") + .setProxyUri("proxyUri-985185250") + .addAllInstanceOwners(new ArrayList()) + .setServiceAccount("serviceAccount1079137720") + .setMachineType("machineType-218117087") + .setInstallGpuDriver(true) + .setCustomGpuDriverPath("customGpuDriverPath509224520") + .setBootDiskSizeGb(1398920548) + .setDataDiskSizeGb(-1668379732) + .setNoRemoveDataDisk(true) + .setKmsKey("kmsKey-1127483058") + .setNoPublicIp(true) + .setNoProxyAccess(true) + .setNetwork("network1843485230") + .setSubnet("subnet-891534499") + .putAllLabels(new HashMap()) + .putAllMetadata(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -527,12 +460,10 @@ public void setInstanceMachineTypeTest() throws Exception { .build(); mockNotebookService.addResponse(resultOperation); - String name = "name3373707"; - String machineType = "machineType1838323762"; SetInstanceMachineTypeRequest request = SetInstanceMachineTypeRequest.newBuilder() - .setName(name) - .setMachineType(machineType) + .setName("name3373707") + .setMachineType("machineType-218117087") .build(); Instance actualResponse = client.setInstanceMachineTypeAsync(request).get(); @@ -541,10 +472,10 @@ public void setInstanceMachineTypeTest() throws Exception { List actualRequests = mockNotebookService.getRequests(); Assert.assertEquals(1, actualRequests.size()); SetInstanceMachineTypeRequest actualRequest = - (SetInstanceMachineTypeRequest) actualRequests.get(0); + ((SetInstanceMachineTypeRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertEquals(machineType, actualRequest.getMachineType()); + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getMachineType(), actualRequest.getMachineType()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -552,64 +483,49 @@ public void setInstanceMachineTypeTest() throws Exception { } @Test - @SuppressWarnings("all") public void setInstanceMachineTypeExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockNotebookService.addException(exception); try { - String name = "name3373707"; - String machineType = "machineType1838323762"; SetInstanceMachineTypeRequest request = SetInstanceMachineTypeRequest.newBuilder() - .setName(name) - .setMachineType(machineType) + .setName("name3373707") + .setMachineType("machineType-218117087") .build(); - client.setInstanceMachineTypeAsync(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 setInstanceLabelsTest() throws Exception { - InstanceName name2 = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String postStartupScript = "postStartupScript355382860"; - String proxyUri = "proxyUri-475670501"; - String serviceAccount = "serviceAccount-1948028253"; - String machineType = "machineType1838323762"; - boolean installGpuDriver = false; - String customGpuDriverPath = "customGpuDriverPath1863223803"; - long bootDiskSizeGb = 1398920548L; - long dataDiskSizeGb = 1668379732L; - boolean noRemoveDataDisk = false; - String kmsKey = "kmsKey-591635343"; - boolean noPublicIp = false; - boolean noProxyAccess = false; - String network = "network1843485230"; - String subnet = "subnet-891534499"; Instance expectedResponse = Instance.newBuilder() - .setName(name2.toString()) - .setPostStartupScript(postStartupScript) - .setProxyUri(proxyUri) - .setServiceAccount(serviceAccount) - .setMachineType(machineType) - .setInstallGpuDriver(installGpuDriver) - .setCustomGpuDriverPath(customGpuDriverPath) - .setBootDiskSizeGb(bootDiskSizeGb) - .setDataDiskSizeGb(dataDiskSizeGb) - .setNoRemoveDataDisk(noRemoveDataDisk) - .setKmsKey(kmsKey) - .setNoPublicIp(noPublicIp) - .setNoProxyAccess(noProxyAccess) - .setNetwork(network) - .setSubnet(subnet) + .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setPostStartupScript("postStartupScript870779112") + .setProxyUri("proxyUri-985185250") + .addAllInstanceOwners(new ArrayList()) + .setServiceAccount("serviceAccount1079137720") + .setMachineType("machineType-218117087") + .setInstallGpuDriver(true) + .setCustomGpuDriverPath("customGpuDriverPath509224520") + .setBootDiskSizeGb(1398920548) + .setDataDiskSizeGb(-1668379732) + .setNoRemoveDataDisk(true) + .setKmsKey("kmsKey-1127483058") + .setNoPublicIp(true) + .setNoProxyAccess(true) + .setNetwork("network1843485230") + .setSubnet("subnet-891534499") + .putAllLabels(new HashMap()) + .putAllMetadata(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -619,17 +535,21 @@ public void setInstanceLabelsTest() throws Exception { .build(); mockNotebookService.addResponse(resultOperation); - String name = "name3373707"; - SetInstanceLabelsRequest request = SetInstanceLabelsRequest.newBuilder().setName(name).build(); + SetInstanceLabelsRequest request = + SetInstanceLabelsRequest.newBuilder() + .setName("name3373707") + .putAllLabels(new HashMap()) + .build(); Instance actualResponse = client.setInstanceLabelsAsync(request).get(); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockNotebookService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - SetInstanceLabelsRequest actualRequest = (SetInstanceLabelsRequest) actualRequests.get(0); + SetInstanceLabelsRequest actualRequest = ((SetInstanceLabelsRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getLabelsMap(), actualRequest.getLabelsMap()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -637,27 +557,26 @@ public void setInstanceLabelsTest() throws Exception { } @Test - @SuppressWarnings("all") public void setInstanceLabelsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockNotebookService.addException(exception); try { - String name = "name3373707"; SetInstanceLabelsRequest request = - SetInstanceLabelsRequest.newBuilder().setName(name).build(); - + SetInstanceLabelsRequest.newBuilder() + .setName("name3373707") + .putAllLabels(new HashMap()) + .build(); client.setInstanceLabelsAsync(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 deleteInstanceTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); Operation resultOperation = @@ -668,17 +587,16 @@ public void deleteInstanceTest() throws Exception { .build(); mockNotebookService.addResponse(resultOperation); - String name = "name3373707"; - DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder().setName(name).build(); + DeleteInstanceRequest request = + DeleteInstanceRequest.newBuilder().setName("name3373707").build(); - Empty actualResponse = client.deleteInstanceAsync(request).get(); - Assert.assertEquals(expectedResponse, actualResponse); + client.deleteInstanceAsync(request).get(); List actualRequests = mockNotebookService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteInstanceRequest actualRequest = (DeleteInstanceRequest) actualRequests.get(0); + DeleteInstanceRequest actualRequest = ((DeleteInstanceRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(request.getName(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -686,59 +604,46 @@ public void deleteInstanceTest() throws Exception { } @Test - @SuppressWarnings("all") public void deleteInstanceExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockNotebookService.addException(exception); try { - String name = "name3373707"; - DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder().setName(name).build(); - + DeleteInstanceRequest request = + DeleteInstanceRequest.newBuilder().setName("name3373707").build(); client.deleteInstanceAsync(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 startInstanceTest() throws Exception { - InstanceName name2 = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String postStartupScript = "postStartupScript355382860"; - String proxyUri = "proxyUri-475670501"; - String serviceAccount = "serviceAccount-1948028253"; - String machineType = "machineType1838323762"; - boolean installGpuDriver = false; - String customGpuDriverPath = "customGpuDriverPath1863223803"; - long bootDiskSizeGb = 1398920548L; - long dataDiskSizeGb = 1668379732L; - boolean noRemoveDataDisk = false; - String kmsKey = "kmsKey-591635343"; - boolean noPublicIp = false; - boolean noProxyAccess = false; - String network = "network1843485230"; - String subnet = "subnet-891534499"; Instance expectedResponse = Instance.newBuilder() - .setName(name2.toString()) - .setPostStartupScript(postStartupScript) - .setProxyUri(proxyUri) - .setServiceAccount(serviceAccount) - .setMachineType(machineType) - .setInstallGpuDriver(installGpuDriver) - .setCustomGpuDriverPath(customGpuDriverPath) - .setBootDiskSizeGb(bootDiskSizeGb) - .setDataDiskSizeGb(dataDiskSizeGb) - .setNoRemoveDataDisk(noRemoveDataDisk) - .setKmsKey(kmsKey) - .setNoPublicIp(noPublicIp) - .setNoProxyAccess(noProxyAccess) - .setNetwork(network) - .setSubnet(subnet) + .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setPostStartupScript("postStartupScript870779112") + .setProxyUri("proxyUri-985185250") + .addAllInstanceOwners(new ArrayList()) + .setServiceAccount("serviceAccount1079137720") + .setMachineType("machineType-218117087") + .setInstallGpuDriver(true) + .setCustomGpuDriverPath("customGpuDriverPath509224520") + .setBootDiskSizeGb(1398920548) + .setDataDiskSizeGb(-1668379732) + .setNoRemoveDataDisk(true) + .setKmsKey("kmsKey-1127483058") + .setNoPublicIp(true) + .setNoProxyAccess(true) + .setNetwork("network1843485230") + .setSubnet("subnet-891534499") + .putAllLabels(new HashMap()) + .putAllMetadata(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -748,17 +653,16 @@ public void startInstanceTest() throws Exception { .build(); mockNotebookService.addResponse(resultOperation); - String name = "name3373707"; - StartInstanceRequest request = StartInstanceRequest.newBuilder().setName(name).build(); + StartInstanceRequest request = StartInstanceRequest.newBuilder().setName("name3373707").build(); Instance actualResponse = client.startInstanceAsync(request).get(); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockNotebookService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - StartInstanceRequest actualRequest = (StartInstanceRequest) actualRequests.get(0); + StartInstanceRequest actualRequest = ((StartInstanceRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(request.getName(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -766,59 +670,46 @@ public void startInstanceTest() throws Exception { } @Test - @SuppressWarnings("all") public void startInstanceExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockNotebookService.addException(exception); try { - String name = "name3373707"; - StartInstanceRequest request = StartInstanceRequest.newBuilder().setName(name).build(); - + StartInstanceRequest request = + StartInstanceRequest.newBuilder().setName("name3373707").build(); client.startInstanceAsync(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 stopInstanceTest() throws Exception { - InstanceName name2 = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String postStartupScript = "postStartupScript355382860"; - String proxyUri = "proxyUri-475670501"; - String serviceAccount = "serviceAccount-1948028253"; - String machineType = "machineType1838323762"; - boolean installGpuDriver = false; - String customGpuDriverPath = "customGpuDriverPath1863223803"; - long bootDiskSizeGb = 1398920548L; - long dataDiskSizeGb = 1668379732L; - boolean noRemoveDataDisk = false; - String kmsKey = "kmsKey-591635343"; - boolean noPublicIp = false; - boolean noProxyAccess = false; - String network = "network1843485230"; - String subnet = "subnet-891534499"; Instance expectedResponse = Instance.newBuilder() - .setName(name2.toString()) - .setPostStartupScript(postStartupScript) - .setProxyUri(proxyUri) - .setServiceAccount(serviceAccount) - .setMachineType(machineType) - .setInstallGpuDriver(installGpuDriver) - .setCustomGpuDriverPath(customGpuDriverPath) - .setBootDiskSizeGb(bootDiskSizeGb) - .setDataDiskSizeGb(dataDiskSizeGb) - .setNoRemoveDataDisk(noRemoveDataDisk) - .setKmsKey(kmsKey) - .setNoPublicIp(noPublicIp) - .setNoProxyAccess(noProxyAccess) - .setNetwork(network) - .setSubnet(subnet) + .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setPostStartupScript("postStartupScript870779112") + .setProxyUri("proxyUri-985185250") + .addAllInstanceOwners(new ArrayList()) + .setServiceAccount("serviceAccount1079137720") + .setMachineType("machineType-218117087") + .setInstallGpuDriver(true) + .setCustomGpuDriverPath("customGpuDriverPath509224520") + .setBootDiskSizeGb(1398920548) + .setDataDiskSizeGb(-1668379732) + .setNoRemoveDataDisk(true) + .setKmsKey("kmsKey-1127483058") + .setNoPublicIp(true) + .setNoProxyAccess(true) + .setNetwork("network1843485230") + .setSubnet("subnet-891534499") + .putAllLabels(new HashMap()) + .putAllMetadata(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -828,17 +719,16 @@ public void stopInstanceTest() throws Exception { .build(); mockNotebookService.addResponse(resultOperation); - String name = "name3373707"; - StopInstanceRequest request = StopInstanceRequest.newBuilder().setName(name).build(); + StopInstanceRequest request = StopInstanceRequest.newBuilder().setName("name3373707").build(); Instance actualResponse = client.stopInstanceAsync(request).get(); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockNotebookService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - StopInstanceRequest actualRequest = (StopInstanceRequest) actualRequests.get(0); + StopInstanceRequest actualRequest = ((StopInstanceRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(request.getName(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -846,59 +736,45 @@ public void stopInstanceTest() throws Exception { } @Test - @SuppressWarnings("all") public void stopInstanceExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockNotebookService.addException(exception); try { - String name = "name3373707"; - StopInstanceRequest request = StopInstanceRequest.newBuilder().setName(name).build(); - + StopInstanceRequest request = StopInstanceRequest.newBuilder().setName("name3373707").build(); client.stopInstanceAsync(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 resetInstanceTest() throws Exception { - InstanceName name2 = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String postStartupScript = "postStartupScript355382860"; - String proxyUri = "proxyUri-475670501"; - String serviceAccount = "serviceAccount-1948028253"; - String machineType = "machineType1838323762"; - boolean installGpuDriver = false; - String customGpuDriverPath = "customGpuDriverPath1863223803"; - long bootDiskSizeGb = 1398920548L; - long dataDiskSizeGb = 1668379732L; - boolean noRemoveDataDisk = false; - String kmsKey = "kmsKey-591635343"; - boolean noPublicIp = false; - boolean noProxyAccess = false; - String network = "network1843485230"; - String subnet = "subnet-891534499"; Instance expectedResponse = Instance.newBuilder() - .setName(name2.toString()) - .setPostStartupScript(postStartupScript) - .setProxyUri(proxyUri) - .setServiceAccount(serviceAccount) - .setMachineType(machineType) - .setInstallGpuDriver(installGpuDriver) - .setCustomGpuDriverPath(customGpuDriverPath) - .setBootDiskSizeGb(bootDiskSizeGb) - .setDataDiskSizeGb(dataDiskSizeGb) - .setNoRemoveDataDisk(noRemoveDataDisk) - .setKmsKey(kmsKey) - .setNoPublicIp(noPublicIp) - .setNoProxyAccess(noProxyAccess) - .setNetwork(network) - .setSubnet(subnet) + .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setPostStartupScript("postStartupScript870779112") + .setProxyUri("proxyUri-985185250") + .addAllInstanceOwners(new ArrayList()) + .setServiceAccount("serviceAccount1079137720") + .setMachineType("machineType-218117087") + .setInstallGpuDriver(true) + .setCustomGpuDriverPath("customGpuDriverPath509224520") + .setBootDiskSizeGb(1398920548) + .setDataDiskSizeGb(-1668379732) + .setNoRemoveDataDisk(true) + .setKmsKey("kmsKey-1127483058") + .setNoPublicIp(true) + .setNoProxyAccess(true) + .setNetwork("network1843485230") + .setSubnet("subnet-891534499") + .putAllLabels(new HashMap()) + .putAllMetadata(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -908,17 +784,16 @@ public void resetInstanceTest() throws Exception { .build(); mockNotebookService.addResponse(resultOperation); - String name = "name3373707"; - ResetInstanceRequest request = ResetInstanceRequest.newBuilder().setName(name).build(); + ResetInstanceRequest request = ResetInstanceRequest.newBuilder().setName("name3373707").build(); Instance actualResponse = client.resetInstanceAsync(request).get(); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockNotebookService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ResetInstanceRequest actualRequest = (ResetInstanceRequest) actualRequests.get(0); + ResetInstanceRequest actualRequest = ((ResetInstanceRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(request.getName(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -926,59 +801,46 @@ public void resetInstanceTest() throws Exception { } @Test - @SuppressWarnings("all") public void resetInstanceExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockNotebookService.addException(exception); try { - String name = "name3373707"; - ResetInstanceRequest request = ResetInstanceRequest.newBuilder().setName(name).build(); - + ResetInstanceRequest request = + ResetInstanceRequest.newBuilder().setName("name3373707").build(); client.resetInstanceAsync(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 reportInstanceInfoTest() throws Exception { - InstanceName name2 = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String postStartupScript = "postStartupScript355382860"; - String proxyUri = "proxyUri-475670501"; - String serviceAccount = "serviceAccount-1948028253"; - String machineType = "machineType1838323762"; - boolean installGpuDriver = false; - String customGpuDriverPath = "customGpuDriverPath1863223803"; - long bootDiskSizeGb = 1398920548L; - long dataDiskSizeGb = 1668379732L; - boolean noRemoveDataDisk = false; - String kmsKey = "kmsKey-591635343"; - boolean noPublicIp = false; - boolean noProxyAccess = false; - String network = "network1843485230"; - String subnet = "subnet-891534499"; Instance expectedResponse = Instance.newBuilder() - .setName(name2.toString()) - .setPostStartupScript(postStartupScript) - .setProxyUri(proxyUri) - .setServiceAccount(serviceAccount) - .setMachineType(machineType) - .setInstallGpuDriver(installGpuDriver) - .setCustomGpuDriverPath(customGpuDriverPath) - .setBootDiskSizeGb(bootDiskSizeGb) - .setDataDiskSizeGb(dataDiskSizeGb) - .setNoRemoveDataDisk(noRemoveDataDisk) - .setKmsKey(kmsKey) - .setNoPublicIp(noPublicIp) - .setNoProxyAccess(noProxyAccess) - .setNetwork(network) - .setSubnet(subnet) + .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setPostStartupScript("postStartupScript870779112") + .setProxyUri("proxyUri-985185250") + .addAllInstanceOwners(new ArrayList()) + .setServiceAccount("serviceAccount1079137720") + .setMachineType("machineType-218117087") + .setInstallGpuDriver(true) + .setCustomGpuDriverPath("customGpuDriverPath509224520") + .setBootDiskSizeGb(1398920548) + .setDataDiskSizeGb(-1668379732) + .setNoRemoveDataDisk(true) + .setKmsKey("kmsKey-1127483058") + .setNoPublicIp(true) + .setNoProxyAccess(true) + .setNetwork("network1843485230") + .setSubnet("subnet-891534499") + .putAllLabels(new HashMap()) + .putAllMetadata(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -988,20 +850,23 @@ public void reportInstanceInfoTest() throws Exception { .build(); mockNotebookService.addResponse(resultOperation); - String name = "name3373707"; - String vmId = "vmId112317347"; ReportInstanceInfoRequest request = - ReportInstanceInfoRequest.newBuilder().setName(name).setVmId(vmId).build(); + ReportInstanceInfoRequest.newBuilder() + .setName("name3373707") + .setVmId("vmId3622450") + .putAllMetadata(new HashMap()) + .build(); Instance actualResponse = client.reportInstanceInfoAsync(request).get(); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockNotebookService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ReportInstanceInfoRequest actualRequest = (ReportInstanceInfoRequest) actualRequests.get(0); + ReportInstanceInfoRequest actualRequest = ((ReportInstanceInfoRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertEquals(vmId, actualRequest.getVmId()); + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getVmId(), actualRequest.getVmId()); + Assert.assertEquals(request.getMetadataMap(), actualRequest.getMetadataMap()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1009,43 +874,40 @@ public void reportInstanceInfoTest() throws Exception { } @Test - @SuppressWarnings("all") public void reportInstanceInfoExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockNotebookService.addException(exception); try { - String name = "name3373707"; - String vmId = "vmId112317347"; ReportInstanceInfoRequest request = - ReportInstanceInfoRequest.newBuilder().setName(name).setVmId(vmId).build(); - + ReportInstanceInfoRequest.newBuilder() + .setName("name3373707") + .setVmId("vmId3622450") + .putAllMetadata(new HashMap()) + .build(); client.reportInstanceInfoAsync(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 isInstanceUpgradeableTest() { - boolean upgradeable = true; - String upgradeVersion = "upgradeVersion1040155061"; - String upgradeInfo = "upgradeInfo-1337232143"; + public void isInstanceUpgradeableTest() throws Exception { IsInstanceUpgradeableResponse expectedResponse = IsInstanceUpgradeableResponse.newBuilder() - .setUpgradeable(upgradeable) - .setUpgradeVersion(upgradeVersion) - .setUpgradeInfo(upgradeInfo) + .setUpgradeable(true) + .setUpgradeVersion("upgradeVersion-392903908") + .setUpgradeInfo("upgradeInfo-1844902678") .build(); mockNotebookService.addResponse(expectedResponse); - String notebookInstance = "notebookInstance-1078982023"; IsInstanceUpgradeableRequest request = - IsInstanceUpgradeableRequest.newBuilder().setNotebookInstance(notebookInstance).build(); + IsInstanceUpgradeableRequest.newBuilder() + .setNotebookInstance("notebookInstance-544239728") + .build(); IsInstanceUpgradeableResponse actualResponse = client.isInstanceUpgradeable(request); Assert.assertEquals(expectedResponse, actualResponse); @@ -1053,9 +915,9 @@ public void isInstanceUpgradeableTest() { List actualRequests = mockNotebookService.getRequests(); Assert.assertEquals(1, actualRequests.size()); IsInstanceUpgradeableRequest actualRequest = - (IsInstanceUpgradeableRequest) actualRequests.get(0); + ((IsInstanceUpgradeableRequest) actualRequests.get(0)); - Assert.assertEquals(notebookInstance, actualRequest.getNotebookInstance()); + Assert.assertEquals(request.getNotebookInstance(), actualRequest.getNotebookInstance()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1063,58 +925,46 @@ public void isInstanceUpgradeableTest() { } @Test - @SuppressWarnings("all") public void isInstanceUpgradeableExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockNotebookService.addException(exception); try { - String notebookInstance = "notebookInstance-1078982023"; IsInstanceUpgradeableRequest request = - IsInstanceUpgradeableRequest.newBuilder().setNotebookInstance(notebookInstance).build(); - + IsInstanceUpgradeableRequest.newBuilder() + .setNotebookInstance("notebookInstance-544239728") + .build(); client.isInstanceUpgradeable(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") public void upgradeInstanceTest() throws Exception { - InstanceName name2 = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String postStartupScript = "postStartupScript355382860"; - String proxyUri = "proxyUri-475670501"; - String serviceAccount = "serviceAccount-1948028253"; - String machineType = "machineType1838323762"; - boolean installGpuDriver = false; - String customGpuDriverPath = "customGpuDriverPath1863223803"; - long bootDiskSizeGb = 1398920548L; - long dataDiskSizeGb = 1668379732L; - boolean noRemoveDataDisk = false; - String kmsKey = "kmsKey-591635343"; - boolean noPublicIp = false; - boolean noProxyAccess = false; - String network = "network1843485230"; - String subnet = "subnet-891534499"; Instance expectedResponse = Instance.newBuilder() - .setName(name2.toString()) - .setPostStartupScript(postStartupScript) - .setProxyUri(proxyUri) - .setServiceAccount(serviceAccount) - .setMachineType(machineType) - .setInstallGpuDriver(installGpuDriver) - .setCustomGpuDriverPath(customGpuDriverPath) - .setBootDiskSizeGb(bootDiskSizeGb) - .setDataDiskSizeGb(dataDiskSizeGb) - .setNoRemoveDataDisk(noRemoveDataDisk) - .setKmsKey(kmsKey) - .setNoPublicIp(noPublicIp) - .setNoProxyAccess(noProxyAccess) - .setNetwork(network) - .setSubnet(subnet) + .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setPostStartupScript("postStartupScript870779112") + .setProxyUri("proxyUri-985185250") + .addAllInstanceOwners(new ArrayList()) + .setServiceAccount("serviceAccount1079137720") + .setMachineType("machineType-218117087") + .setInstallGpuDriver(true) + .setCustomGpuDriverPath("customGpuDriverPath509224520") + .setBootDiskSizeGb(1398920548) + .setDataDiskSizeGb(-1668379732) + .setNoRemoveDataDisk(true) + .setKmsKey("kmsKey-1127483058") + .setNoPublicIp(true) + .setNoProxyAccess(true) + .setNetwork("network1843485230") + .setSubnet("subnet-891534499") + .putAllLabels(new HashMap()) + .putAllMetadata(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -1124,17 +974,17 @@ public void upgradeInstanceTest() throws Exception { .build(); mockNotebookService.addResponse(resultOperation); - String name = "name3373707"; - UpgradeInstanceRequest request = UpgradeInstanceRequest.newBuilder().setName(name).build(); + UpgradeInstanceRequest request = + UpgradeInstanceRequest.newBuilder().setName("name3373707").build(); Instance actualResponse = client.upgradeInstanceAsync(request).get(); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockNotebookService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - UpgradeInstanceRequest actualRequest = (UpgradeInstanceRequest) actualRequests.get(0); + UpgradeInstanceRequest actualRequest = ((UpgradeInstanceRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(request.getName(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1142,59 +992,46 @@ public void upgradeInstanceTest() throws Exception { } @Test - @SuppressWarnings("all") public void upgradeInstanceExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockNotebookService.addException(exception); try { - String name = "name3373707"; - UpgradeInstanceRequest request = UpgradeInstanceRequest.newBuilder().setName(name).build(); - + UpgradeInstanceRequest request = + UpgradeInstanceRequest.newBuilder().setName("name3373707").build(); client.upgradeInstanceAsync(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 upgradeInstanceInternalTest() throws Exception { - InstanceName name2 = InstanceName.of("[PROJECT]", "[INSTANCE]"); - String postStartupScript = "postStartupScript355382860"; - String proxyUri = "proxyUri-475670501"; - String serviceAccount = "serviceAccount-1948028253"; - String machineType = "machineType1838323762"; - boolean installGpuDriver = false; - String customGpuDriverPath = "customGpuDriverPath1863223803"; - long bootDiskSizeGb = 1398920548L; - long dataDiskSizeGb = 1668379732L; - boolean noRemoveDataDisk = false; - String kmsKey = "kmsKey-591635343"; - boolean noPublicIp = false; - boolean noProxyAccess = false; - String network = "network1843485230"; - String subnet = "subnet-891534499"; Instance expectedResponse = Instance.newBuilder() - .setName(name2.toString()) - .setPostStartupScript(postStartupScript) - .setProxyUri(proxyUri) - .setServiceAccount(serviceAccount) - .setMachineType(machineType) - .setInstallGpuDriver(installGpuDriver) - .setCustomGpuDriverPath(customGpuDriverPath) - .setBootDiskSizeGb(bootDiskSizeGb) - .setDataDiskSizeGb(dataDiskSizeGb) - .setNoRemoveDataDisk(noRemoveDataDisk) - .setKmsKey(kmsKey) - .setNoPublicIp(noPublicIp) - .setNoProxyAccess(noProxyAccess) - .setNetwork(network) - .setSubnet(subnet) + .setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()) + .setPostStartupScript("postStartupScript870779112") + .setProxyUri("proxyUri-985185250") + .addAllInstanceOwners(new ArrayList()) + .setServiceAccount("serviceAccount1079137720") + .setMachineType("machineType-218117087") + .setInstallGpuDriver(true) + .setCustomGpuDriverPath("customGpuDriverPath509224520") + .setBootDiskSizeGb(1398920548) + .setDataDiskSizeGb(-1668379732) + .setNoRemoveDataDisk(true) + .setKmsKey("kmsKey-1127483058") + .setNoPublicIp(true) + .setNoProxyAccess(true) + .setNetwork("network1843485230") + .setSubnet("subnet-891534499") + .putAllLabels(new HashMap()) + .putAllMetadata(new HashMap()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -1204,10 +1041,11 @@ public void upgradeInstanceInternalTest() throws Exception { .build(); mockNotebookService.addResponse(resultOperation); - String name = "name3373707"; - String vmId = "vmId112317347"; UpgradeInstanceInternalRequest request = - UpgradeInstanceInternalRequest.newBuilder().setName(name).setVmId(vmId).build(); + UpgradeInstanceInternalRequest.newBuilder() + .setName("name3373707") + .setVmId("vmId3622450") + .build(); Instance actualResponse = client.upgradeInstanceInternalAsync(request).get(); Assert.assertEquals(expectedResponse, actualResponse); @@ -1215,10 +1053,10 @@ public void upgradeInstanceInternalTest() throws Exception { List actualRequests = mockNotebookService.getRequests(); Assert.assertEquals(1, actualRequests.size()); UpgradeInstanceInternalRequest actualRequest = - (UpgradeInstanceInternalRequest) actualRequests.get(0); + ((UpgradeInstanceInternalRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertEquals(vmId, actualRequest.getVmId()); + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertEquals(request.getVmId(), actualRequest.getVmId()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1226,54 +1064,56 @@ public void upgradeInstanceInternalTest() throws Exception { } @Test - @SuppressWarnings("all") public void upgradeInstanceInternalExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockNotebookService.addException(exception); try { - String name = "name3373707"; - String vmId = "vmId112317347"; UpgradeInstanceInternalRequest request = - UpgradeInstanceInternalRequest.newBuilder().setName(name).setVmId(vmId).build(); - + UpgradeInstanceInternalRequest.newBuilder() + .setName("name3373707") + .setVmId("vmId3622450") + .build(); client.upgradeInstanceInternalAsync(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 listEnvironmentsTest() { - String nextPageToken = ""; - Environment environmentsElement = Environment.newBuilder().build(); - List environments = Arrays.asList(environmentsElement); + public void listEnvironmentsTest() throws Exception { + Environment responsesElement = Environment.newBuilder().build(); ListEnvironmentsResponse expectedResponse = ListEnvironmentsResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllEnvironments(environments) + .setNextPageToken("") + .addAllEnvironments(Arrays.asList(responsesElement)) .build(); mockNotebookService.addResponse(expectedResponse); - String parent = "parent-995424086"; ListEnvironmentsRequest request = - ListEnvironmentsRequest.newBuilder().setParent(parent).build(); + ListEnvironmentsRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); ListEnvironmentsPagedResponse pagedListResponse = client.listEnvironments(request); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getEnvironmentsList().get(0), resources.get(0)); List actualRequests = mockNotebookService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - ListEnvironmentsRequest actualRequest = (ListEnvironmentsRequest) actualRequests.get(0); + ListEnvironmentsRequest actualRequest = ((ListEnvironmentsRequest) actualRequests.get(0)); - Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1281,50 +1121,47 @@ public void listEnvironmentsTest() { } @Test - @SuppressWarnings("all") public void listEnvironmentsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockNotebookService.addException(exception); try { - String parent = "parent-995424086"; ListEnvironmentsRequest request = - ListEnvironmentsRequest.newBuilder().setParent(parent).build(); - + ListEnvironmentsRequest.newBuilder() + .setParent("parent-995424086") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); client.listEnvironments(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") - public void getEnvironmentTest() { - EnvironmentName name2 = EnvironmentName.of("[PROJECT]", "[ENVIRONMENT]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; - String postStartupScript = "postStartupScript355382860"; + public void getEnvironmentTest() throws Exception { Environment expectedResponse = Environment.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setDescription(description) - .setPostStartupScript(postStartupScript) + .setName(EnvironmentName.of("[PROJECT]", "[ENVIRONMENT]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setPostStartupScript("postStartupScript870779112") + .setCreateTime(Timestamp.newBuilder().build()) .build(); mockNotebookService.addResponse(expectedResponse); - String name = "name3373707"; - GetEnvironmentRequest request = GetEnvironmentRequest.newBuilder().setName(name).build(); + GetEnvironmentRequest request = + GetEnvironmentRequest.newBuilder().setName("name3373707").build(); Environment actualResponse = client.getEnvironment(request); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockNotebookService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - GetEnvironmentRequest actualRequest = (GetEnvironmentRequest) actualRequests.get(0); + GetEnvironmentRequest actualRequest = ((GetEnvironmentRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(request.getName(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1332,35 +1169,29 @@ public void getEnvironmentTest() { } @Test - @SuppressWarnings("all") public void getEnvironmentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockNotebookService.addException(exception); try { - String name = "name3373707"; - GetEnvironmentRequest request = GetEnvironmentRequest.newBuilder().setName(name).build(); - + GetEnvironmentRequest request = + GetEnvironmentRequest.newBuilder().setName("name3373707").build(); client.getEnvironment(request); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { - // Expected exception + // Expected exception. } } @Test - @SuppressWarnings("all") public void createEnvironmentTest() throws Exception { - EnvironmentName name = EnvironmentName.of("[PROJECT]", "[ENVIRONMENT]"); - String displayName = "displayName1615086568"; - String description = "description-1724546052"; - String postStartupScript = "postStartupScript355382860"; Environment expectedResponse = Environment.newBuilder() - .setName(name.toString()) - .setDisplayName(displayName) - .setDescription(description) - .setPostStartupScript(postStartupScript) + .setName(EnvironmentName.of("[PROJECT]", "[ENVIRONMENT]").toString()) + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setPostStartupScript("postStartupScript870779112") + .setCreateTime(Timestamp.newBuilder().build()) .build(); Operation resultOperation = Operation.newBuilder() @@ -1370,14 +1201,11 @@ public void createEnvironmentTest() throws Exception { .build(); mockNotebookService.addResponse(resultOperation); - String parent = "parent-995424086"; - String environmentId = "environmentId608412359"; - Environment environment = Environment.newBuilder().build(); CreateEnvironmentRequest request = CreateEnvironmentRequest.newBuilder() - .setParent(parent) - .setEnvironmentId(environmentId) - .setEnvironment(environment) + .setParent("parent-995424086") + .setEnvironmentId("environmentId-950205810") + .setEnvironment(Environment.newBuilder().build()) .build(); Environment actualResponse = client.createEnvironmentAsync(request).get(); @@ -1385,11 +1213,11 @@ public void createEnvironmentTest() throws Exception { List actualRequests = mockNotebookService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - CreateEnvironmentRequest actualRequest = (CreateEnvironmentRequest) actualRequests.get(0); + CreateEnvironmentRequest actualRequest = ((CreateEnvironmentRequest) actualRequests.get(0)); - Assert.assertEquals(parent, actualRequest.getParent()); - Assert.assertEquals(environmentId, actualRequest.getEnvironmentId()); - Assert.assertEquals(environment, actualRequest.getEnvironment()); + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals(request.getEnvironmentId(), actualRequest.getEnvironmentId()); + Assert.assertEquals(request.getEnvironment(), actualRequest.getEnvironment()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1397,33 +1225,27 @@ public void createEnvironmentTest() throws Exception { } @Test - @SuppressWarnings("all") public void createEnvironmentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockNotebookService.addException(exception); try { - String parent = "parent-995424086"; - String environmentId = "environmentId608412359"; - Environment environment = Environment.newBuilder().build(); CreateEnvironmentRequest request = CreateEnvironmentRequest.newBuilder() - .setParent(parent) - .setEnvironmentId(environmentId) - .setEnvironment(environment) + .setParent("parent-995424086") + .setEnvironmentId("environmentId-950205810") + .setEnvironment(Environment.newBuilder().build()) .build(); - client.createEnvironmentAsync(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 deleteEnvironmentTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); Operation resultOperation = @@ -1434,17 +1256,16 @@ public void deleteEnvironmentTest() throws Exception { .build(); mockNotebookService.addResponse(resultOperation); - String name = "name3373707"; - DeleteEnvironmentRequest request = DeleteEnvironmentRequest.newBuilder().setName(name).build(); + DeleteEnvironmentRequest request = + DeleteEnvironmentRequest.newBuilder().setName("name3373707").build(); - Empty actualResponse = client.deleteEnvironmentAsync(request).get(); - Assert.assertEquals(expectedResponse, actualResponse); + client.deleteEnvironmentAsync(request).get(); List actualRequests = mockNotebookService.getRequests(); Assert.assertEquals(1, actualRequests.size()); - DeleteEnvironmentRequest actualRequest = (DeleteEnvironmentRequest) actualRequests.get(0); + DeleteEnvironmentRequest actualRequest = ((DeleteEnvironmentRequest) actualRequests.get(0)); - Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(request.getName(), actualRequest.getName()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -1452,21 +1273,18 @@ public void deleteEnvironmentTest() throws Exception { } @Test - @SuppressWarnings("all") public void deleteEnvironmentExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); mockNotebookService.addException(exception); try { - String name = "name3373707"; DeleteEnvironmentRequest request = - DeleteEnvironmentRequest.newBuilder().setName(name).build(); - + DeleteEnvironmentRequest.newBuilder().setName("name3373707").build(); client.deleteEnvironmentAsync(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()); } } diff --git a/grpc-google-cloud-notebooks-v1beta1/pom.xml b/grpc-google-cloud-notebooks-v1beta1/pom.xml index f335e269..b50b3d99 100644 --- a/grpc-google-cloud-notebooks-v1beta1/pom.xml +++ b/grpc-google-cloud-notebooks-v1beta1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-notebooks-v1beta1 - 0.2.1 + 0.2.2 grpc-google-cloud-notebooks-v1beta1 GRPC library for grpc-google-cloud-notebooks-v1beta1 com.google.cloud google-cloud-notebooks-parent - 0.2.1 + 0.2.2 diff --git a/pom.xml b/pom.xml index dcbb4feb..d1f5b3f0 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-notebooks-parent pom - 0.2.1 + 0.2.2 Google AI Platform Notebooks Parent https://github.com/googleapis/java-notebooks @@ -70,23 +70,23 @@ com.google.cloud google-cloud-notebooks - 0.2.1 + 0.2.2 com.google.api.grpc proto-google-cloud-notebooks-v1beta1 - 0.2.1 + 0.2.2 com.google.api.grpc grpc-google-cloud-notebooks-v1beta1 - 0.2.1 + 0.2.2 com.google.cloud google-cloud-shared-dependencies - 0.16.0 + 0.16.1 pom import diff --git a/proto-google-cloud-notebooks-v1beta1/pom.xml b/proto-google-cloud-notebooks-v1beta1/pom.xml index 9e75827c..a47e2d14 100644 --- a/proto-google-cloud-notebooks-v1beta1/pom.xml +++ b/proto-google-cloud-notebooks-v1beta1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-notebooks-v1beta1 - 0.2.1 + 0.2.2 proto-google-cloud-notebooks-v1beta1 PROTO library for proto-google-cloud-notebooks-v1beta1 com.google.cloud google-cloud-notebooks-parent - 0.2.1 + 0.2.2 diff --git a/proto-google-cloud-notebooks-v1beta1/src/main/java/com/google/cloud/notebooks/v1beta1/EnvironmentName.java b/proto-google-cloud-notebooks-v1beta1/src/main/java/com/google/cloud/notebooks/v1beta1/EnvironmentName.java index bd83b55f..71e25885 100644 --- a/proto-google-cloud-notebooks-v1beta1/src/main/java/com/google/cloud/notebooks/v1beta1/EnvironmentName.java +++ b/proto-google-cloud-notebooks-v1beta1/src/main/java/com/google/cloud/notebooks/v1beta1/EnvironmentName.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 EnvironmentName implements ResourceName { - - private static final PathTemplate PATH_TEMPLATE = + private static final PathTemplate PROJECT_ENVIRONMENT = PathTemplate.createWithoutUrlEncoding("projects/{project}/environments/{environment}"); - private volatile Map fieldValuesMap; - private final String project; private final String environment; + @Deprecated + protected EnvironmentName() { + project = null; + environment = null; + } + + private EnvironmentName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + environment = Preconditions.checkNotNull(builder.getEnvironment()); + } + public String getProject() { return project; } @@ -52,11 +62,6 @@ public Builder toBuilder() { return new Builder(this); } - private EnvironmentName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - environment = Preconditions.checkNotNull(builder.getEnvironment()); - } - public static EnvironmentName of(String project, String environment) { return newBuilder().setProject(project).setEnvironment(environment).build(); } @@ -70,7 +75,7 @@ public static EnvironmentName parse(String formattedString) { return null; } Map matchMap = - PATH_TEMPLATE.validatedMatch( + PROJECT_ENVIRONMENT.validatedMatch( formattedString, "EnvironmentName.parse: formattedString not in valid format"); return of(matchMap.get("project"), matchMap.get("environment")); } @@ -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 (EnvironmentName 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_ENVIRONMENT.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("environment", environment); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (environment != null) { + fieldMapBuilder.put("environment", environment); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -119,15 +129,39 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PATH_TEMPLATE.instantiate("project", project, "environment", environment); + return PROJECT_ENVIRONMENT.instantiate("project", project, "environment", environment); } - /** Builder for EnvironmentName. */ - public static class Builder { + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + EnvironmentName that = ((EnvironmentName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.environment, that.environment); + } + return false; + } + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(environment); + return h; + } + + /** Builder for projects/{project}/environments/{environment}. */ + public static class Builder { private String project; private String environment; + protected Builder() {} + public String getProject() { return project; } @@ -146,8 +180,6 @@ public Builder setEnvironment(String environment) { return this; } - private Builder() {} - private Builder(EnvironmentName environmentName) { project = environmentName.project; environment = environmentName.environment; @@ -157,26 +189,4 @@ public EnvironmentName build() { return new EnvironmentName(this); } } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o instanceof EnvironmentName) { - EnvironmentName that = (EnvironmentName) o; - return (this.project.equals(that.project)) && (this.environment.equals(that.environment)); - } - return false; - } - - @Override - public int hashCode() { - int h = 1; - h *= 1000003; - h ^= project.hashCode(); - h *= 1000003; - h ^= environment.hashCode(); - return h; - } } diff --git a/proto-google-cloud-notebooks-v1beta1/src/main/java/com/google/cloud/notebooks/v1beta1/InstanceName.java b/proto-google-cloud-notebooks-v1beta1/src/main/java/com/google/cloud/notebooks/v1beta1/InstanceName.java index 09a34b3b..a79df0b4 100644 --- a/proto-google-cloud-notebooks-v1beta1/src/main/java/com/google/cloud/notebooks/v1beta1/InstanceName.java +++ b/proto-google-cloud-notebooks-v1beta1/src/main/java/com/google/cloud/notebooks/v1beta1/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/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 6cb457be..5b6cbf0e 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -29,7 +29,7 @@ com.google.cloud google-cloud-notebooks - 0.2.0 + 0.2.1 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 57a484aa..eee23f35 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-notebooks - 0.2.1 + 0.2.2 diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index cede8600..68f419b5 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-notebooks - 0.2.0 + 0.2.1 diff --git a/synth.metadata b/synth.metadata index a81cc642..745afdfd 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,22 +4,22 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-notebooks.git", - "sha": "9d7b4a74d537e0792adf7d026b1b26e86f72b60e" + "sha": "08f88a59059c3e422d12bd0d185ae43c9c0f38fb" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "989670e868daaad6ce0306e6ec1b9ff40659c19e", - "internalRef": "333377977" + "sha": "6d65640b1fcbdf26ea76cb720de0ac138cae9bed", + "internalRef": "347036369" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "943bb78606d035001123030067dffcc34f4645f2" + "sha": "5d11bd2888c38ce1fb6fa6bf25494a4219a73928" } } ], diff --git a/versions.txt b/versions.txt index 8f634c95..2a226c91 100644 --- a/versions.txt +++ b/versions.txt @@ -1,6 +1,6 @@ # Format: # module:released-version:current-version -google-cloud-notebooks:0.2.1:0.2.1 -proto-google-cloud-notebooks-v1beta1:0.2.1:0.2.1 -grpc-google-cloud-notebooks-v1beta1:0.2.1:0.2.1 \ No newline at end of file +google-cloud-notebooks:0.2.2:0.2.2 +proto-google-cloud-notebooks-v1beta1:0.2.2:0.2.2 +grpc-google-cloud-notebooks-v1beta1:0.2.2:0.2.2 \ No newline at end of file