diff --git a/dependencies.properties b/dependencies.properties index fbdc353a59..7a8357ca63 100644 --- a/dependencies.properties +++ b/dependencies.properties @@ -7,7 +7,7 @@ # Target workspace name: com_google_api_codegen # Versions only, for dependencies which actual artifacts differ between Bazel and Gradle -version.com_google_protobuf=3.15.2 +version.com_google_protobuf=3.15.8 # Version of google-java-format is downgraded from 1.8 to 1.7, because 1.8 supports java 11 minimum, while our JRE is java 8. version.google_java_format=1.7 version.com_google_api_common_java=1.9.3 diff --git a/repositories.bzl b/repositories.bzl index e246cef5cc..6d37762dfa 100644 --- a/repositories.bzl +++ b/repositories.bzl @@ -59,9 +59,18 @@ def gapic_generator_java_repositories(): _maybe( http_archive, name = "com_google_googleapis", - strip_prefix = "googleapis-2bea43cdc7a4443876380732980d83cd8d560582", + strip_prefix = "googleapis-f5ce261910c373fdd96bdaa47173f5604562876f", urls = [ - "https://github.com/googleapis/googleapis/archive/2bea43cdc7a4443876380732980d83cd8d560582.zip", + "https://github.com/googleapis/googleapis/archive/f5ce261910c373fdd96bdaa47173f5604562876f.zip", + ], + ) + + _maybe( + http_archive, + name = "com_google_googleapis_discovery", + strip_prefix = "googleapis-discovery-4f5d0604132e93e63330e65e2e6648c75012780c", + urls = [ + "https://github.com/googleapis/googleapis-discovery/archive/4f5d0604132e93e63330e65e2e6648c75012780c.zip", ], ) diff --git a/test/integration/BUILD.bazel b/test/integration/BUILD.bazel index 23360e672b..db8a0bf839 100644 --- a/test/integration/BUILD.bazel +++ b/test/integration/BUILD.bazel @@ -29,6 +29,7 @@ INTEGRATION_TEST_LIBRARIES = [ "logging", # Java package remapping in gapic.yaml. "redis", # Has a gapic.yaml. "library", # No gRPC service config. + "compute", # REGAPIC test. ] # Keys must match the values in INTEGRATION_TEST_LIBRARIES above. @@ -41,6 +42,7 @@ API_GAPIC_TARGETS = { "logging": "@com_google_googleapis//google/logging/v2:logging_java_gapic", "redis": "@com_google_googleapis//google/cloud/redis/v1beta1:redis_java_gapic", "library": "@com_google_googleapis//google/example/library/v1:library_java_gapic", + "compute": "@com_google_googleapis_discovery//google/cloud/compute/v1:compute_small_java_gapic", } [integration_test( diff --git a/test/integration/goldens/compute/BUILD.bazel b/test/integration/goldens/compute/BUILD.bazel new file mode 100644 index 0000000000..2822013159 --- /dev/null +++ b/test/integration/goldens/compute/BUILD.bazel @@ -0,0 +1,12 @@ +package(default_visibility = ["//visibility:public"]) + +filegroup( + name = "goldens_files", + srcs = glob( + ["**/*"], + exclude = [ + "BUILD.bazel", + ".*.sw*", + ], + ), +) diff --git a/test/integration/goldens/compute/com/google/cloud/compute/v1/AddressesClient.java b/test/integration/goldens/compute/com/google/cloud/compute/v1/AddressesClient.java new file mode 100644 index 0000000000..8323bbbbcd --- /dev/null +++ b/test/integration/goldens/compute/com/google/cloud/compute/v1/AddressesClient.java @@ -0,0 +1,502 @@ +/* + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.compute.v1.stub.AddressesStub; +import com.google.cloud.compute.v1.stub.AddressesStubSettings; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: Services + * + *
The Addresses API. + * + *
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: + * + *
{@code + * try (AddressesClient addressesClient = AddressesClient.create()) { + * String project = "project-309310695"; + * AddressAggregatedList response = addressesClient.aggregatedList(project); + * } + * }+ * + *
Note: close() needs to be called on the AddressesClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *
The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *
See the individual methods for example code. + * + *
Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *
This class can be customized by passing in a custom instance of AddressesSettings to create(). + * For example: + * + *
To customize credentials: + * + *
{@code + * AddressesSettings addressesSettings = + * AddressesSettings.newBuilder() + * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + * .build(); + * AddressesClient addressesClient = AddressesClient.create(addressesSettings); + * }+ * + *
To customize the endpoint: + * + *
{@code + * AddressesSettings addressesSettings = + * AddressesSettings.newBuilder().setEndpoint(myEndpoint).build(); + * AddressesClient addressesClient = AddressesClient.create(addressesSettings); + * }+ * + *
Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class AddressesClient implements BackgroundResource { + private final AddressesSettings settings; + private final AddressesStub stub; + + /** Constructs an instance of AddressesClient with default settings. */ + public static final AddressesClient create() throws IOException { + return create(AddressesSettings.newBuilder().build()); + } + + /** + * Constructs an instance of AddressesClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final AddressesClient create(AddressesSettings settings) throws IOException { + return new AddressesClient(settings); + } + + /** + * Constructs an instance of AddressesClient, using the given stub for making calls. This is for + * advanced usage - prefer using create(AddressesSettings). + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final AddressesClient create(AddressesStub stub) { + return new AddressesClient(stub); + } + + /** + * Constructs an instance of AddressesClient, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected AddressesClient(AddressesSettings settings) throws IOException { + this.settings = settings; + this.stub = ((AddressesStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected AddressesClient(AddressesStub stub) { + this.settings = null; + this.stub = stub; + } + + public final AddressesSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public AddressesStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Retrieves an aggregated list of addresses. + * + *
Sample code: + * + *
{@code + * try (AddressesClient addressesClient = AddressesClient.create()) { + * String project = "project-309310695"; + * AddressAggregatedList response = addressesClient.aggregatedList(project); + * } + * }+ * + * @param project Project ID for this request. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final AddressAggregatedList aggregatedList(String project) { + AggregatedListAddressesRequest request = + AggregatedListAddressesRequest.newBuilder().setProject(project).build(); + return aggregatedList(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Retrieves an aggregated list of addresses. + * + *
Sample code: + * + *
{@code + * try (AddressesClient addressesClient = AddressesClient.create()) { + * AggregatedListAddressesRequest request = + * AggregatedListAddressesRequest.newBuilder() + * .setFilter("filter-1274492040") + * .setIncludeAllScopes(true) + * .setMaxResults(1128457243) + * .setOrderBy("orderBy-1207110587") + * .setPageToken("pageToken873572522") + * .setProject("project-309310695") + * .build(); + * AddressAggregatedList response = addressesClient.aggregatedList(request); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final AddressAggregatedList aggregatedList(AggregatedListAddressesRequest request) { + return aggregatedListCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Retrieves an aggregated list of addresses. + * + *
Sample code: + * + *
{@code + * try (AddressesClient addressesClient = AddressesClient.create()) { + * AggregatedListAddressesRequest request = + * AggregatedListAddressesRequest.newBuilder() + * .setFilter("filter-1274492040") + * .setIncludeAllScopes(true) + * .setMaxResults(1128457243) + * .setOrderBy("orderBy-1207110587") + * .setPageToken("pageToken873572522") + * .setProject("project-309310695") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * addressesClient.aggregatedListCallable().futureCall(request); + * // Do something. + * AddressAggregatedList response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (AddressesClient addressesClient = AddressesClient.create()) { + * String project = "project-309310695"; + * String region = "region-934795532"; + * String address = "address-1147692044"; + * Operation response = addressesClient.delete(project, region, address); + * } + * }+ * + * @param project Project ID for this request. + * @param region Name of the region for this request. + * @param address Name of the address resource to delete. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Operation delete(String project, String region, String address) { + DeleteAddressRequest request = + DeleteAddressRequest.newBuilder() + .setProject(project) + .setRegion(region) + .setAddress(address) + .build(); + return delete(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the specified address resource. + * + *
Sample code: + * + *
{@code + * try (AddressesClient addressesClient = AddressesClient.create()) { + * DeleteAddressRequest request = + * DeleteAddressRequest.newBuilder() + * .setAddress("address-1147692044") + * .setProject("project-309310695") + * .setRegion("region-934795532") + * .setRequestId("requestId693933066") + * .build(); + * Operation response = addressesClient.delete(request); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Operation delete(DeleteAddressRequest request) { + return deleteCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the specified address resource. + * + *
Sample code: + * + *
{@code + * try (AddressesClient addressesClient = AddressesClient.create()) { + * DeleteAddressRequest request = + * DeleteAddressRequest.newBuilder() + * .setAddress("address-1147692044") + * .setProject("project-309310695") + * .setRegion("region-934795532") + * .setRequestId("requestId693933066") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = addressesClient.deleteCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (AddressesClient addressesClient = AddressesClient.create()) { + * String project = "project-309310695"; + * String region = "region-934795532"; + * Address addressResource = Address.newBuilder().build(); + * Operation response = addressesClient.insert(project, region, addressResource); + * } + * }+ * + * @param project Project ID for this request. + * @param region Name of the region for this request. + * @param addressResource The body resource for this request + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Operation insert(String project, String region, Address addressResource) { + InsertAddressRequest request = + InsertAddressRequest.newBuilder() + .setProject(project) + .setRegion(region) + .setAddressResource(addressResource) + .build(); + return insert(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates an address resource in the specified project by using the data included in the request. + * + *
Sample code: + * + *
{@code + * try (AddressesClient addressesClient = AddressesClient.create()) { + * InsertAddressRequest request = + * InsertAddressRequest.newBuilder() + * .setAddressResource(Address.newBuilder().build()) + * .setProject("project-309310695") + * .setRegion("region-934795532") + * .setRequestId("requestId693933066") + * .build(); + * Operation response = addressesClient.insert(request); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Operation insert(InsertAddressRequest request) { + return insertCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates an address resource in the specified project by using the data included in the request. + * + *
Sample code: + * + *
{@code + * try (AddressesClient addressesClient = AddressesClient.create()) { + * InsertAddressRequest request = + * InsertAddressRequest.newBuilder() + * .setAddressResource(Address.newBuilder().build()) + * .setProject("project-309310695") + * .setRegion("region-934795532") + * .setRequestId("requestId693933066") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = addressesClient.insertCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (AddressesClient addressesClient = AddressesClient.create()) { + * String project = "project-309310695"; + * String region = "region-934795532"; + * String orderBy = "orderBy-1207110587"; + * AddressList response = addressesClient.list(project, region, orderBy); + * } + * }+ * + * @param project Project ID for this request. + * @param region Name of the region for this request. + * @param orderBy Sorts list results by a certain order. By default, results are returned in + * alphanumerical order based on the resource name. + *
You can also sort results in descending order based on the creation timestamp using + * orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field + * in reverse chronological order (newest result first). Use this to sort resources like + * operations so that the newest operation is returned first. + *
Currently, only sorting by name or creationTimestamp desc is supported. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final AddressList list(String project, String region, String orderBy) { + ListAddressesRequest request = + ListAddressesRequest.newBuilder() + .setProject(project) + .setRegion(region) + .setOrderBy(orderBy) + .build(); + return list(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Retrieves a list of addresses contained within the specified region. + * + *
Sample code: + * + *
{@code + * try (AddressesClient addressesClient = AddressesClient.create()) { + * ListAddressesRequest request = + * ListAddressesRequest.newBuilder() + * .setFilter("filter-1274492040") + * .setMaxResults(1128457243) + * .setOrderBy("orderBy-1207110587") + * .setPageToken("pageToken873572522") + * .setProject("project-309310695") + * .setRegion("region-934795532") + * .build(); + * AddressList response = addressesClient.list(request); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final AddressList list(ListAddressesRequest request) { + return listCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Retrieves a list of addresses contained within the specified region. + * + *
Sample code: + * + *
{@code + * try (AddressesClient addressesClient = AddressesClient.create()) { + * ListAddressesRequest request = + * ListAddressesRequest.newBuilder() + * .setFilter("filter-1274492040") + * .setMaxResults(1128457243) + * .setOrderBy("orderBy-1207110587") + * .setPageToken("pageToken873572522") + * .setProject("project-309310695") + * .setRegion("region-934795532") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = addressesClient.listCallable().futureCall(request); + * // Do something. + * AddressList response = future.get(); + * } + * }
The default instance has everything set to sensible defaults: + * + *
The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *
For example, to set the total timeout of aggregatedList to 30 seconds: + * + *
{@code + * AddressesSettings.Builder addressesSettingsBuilder = AddressesSettings.newBuilder(); + * addressesSettingsBuilder + * .aggregatedListSettings() + * .setRetrySettings( + * addressesSettingsBuilder + * .aggregatedListSettings() + * .getRetrySettings() + * .toBuilder() + * .setTotalTimeout(Duration.ofSeconds(30)) + * .build()); + * AddressesSettings addressesSettings = addressesSettingsBuilder.build(); + * }+ */ +@Generated("by gapic-generator-java") +public class AddressesSettings extends ClientSettings
Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction 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:
+ *
+ * Note: close() needs to be called on the RegionOperationsClient object to clean up resources
+ * such as threads. In the example above, try-with-resources is used, which automatically calls
+ * close().
+ *
+ * The surface of this class includes several types of Java methods for each of the API's
+ * methods:
+ *
+ * See the individual methods for example code.
+ *
+ * Many parameters require resource names to be formatted in a particular way. To assist with
+ * these names, this class includes a format method for each type of name, and additionally a parse
+ * method to extract the individual identifiers contained within names that are returned.
+ *
+ * This class can be customized by passing in a custom instance of RegionOperationsSettings to
+ * create(). For example:
+ *
+ * To customize credentials:
+ *
+ * To customize the endpoint:
+ *
+ * Please refer to the GitHub repository's samples for more quickstart code snippets.
+ */
+@Generated("by gapic-generator-java")
+public class RegionOperationsClient implements BackgroundResource {
+ private final RegionOperationsSettings settings;
+ private final RegionOperationsStub stub;
+
+ /** Constructs an instance of RegionOperationsClient with default settings. */
+ public static final RegionOperationsClient create() throws IOException {
+ return create(RegionOperationsSettings.newBuilder().build());
+ }
+
+ /**
+ * Constructs an instance of RegionOperationsClient, using the given settings. The channels are
+ * created based on the settings passed in, or defaults for any settings that are not set.
+ */
+ public static final RegionOperationsClient create(RegionOperationsSettings settings)
+ throws IOException {
+ return new RegionOperationsClient(settings);
+ }
+
+ /**
+ * Constructs an instance of RegionOperationsClient, using the given stub for making calls. This
+ * is for advanced usage - prefer using create(RegionOperationsSettings).
+ */
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public static final RegionOperationsClient create(RegionOperationsStub stub) {
+ return new RegionOperationsClient(stub);
+ }
+
+ /**
+ * Constructs an instance of RegionOperationsClient, using the given settings. This is protected
+ * so that it is easy to make a subclass, but otherwise, the static factory methods should be
+ * preferred.
+ */
+ protected RegionOperationsClient(RegionOperationsSettings settings) throws IOException {
+ this.settings = settings;
+ this.stub = ((RegionOperationsStubSettings) settings.getStubSettings()).createStub();
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ protected RegionOperationsClient(RegionOperationsStub stub) {
+ this.settings = null;
+ this.stub = stub;
+ }
+
+ public final RegionOperationsSettings getSettings() {
+ return settings;
+ }
+
+ @BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+ public RegionOperationsStub getStub() {
+ return stub;
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves the specified region-specific Operations resource.
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * The default instance has everything set to sensible defaults:
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ * For example, to set the total timeout of get to 30 seconds:
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction ======================= AddressesClient =======================
+ *
+ * Service Description: Services
+ *
+ * The Addresses API.
+ *
+ * Sample for AddressesClient:
+ *
+ * ======================= RegionOperationsClient =======================
+ *
+ * Service Description: The RegionOperations API.
+ *
+ * Sample for RegionOperationsClient:
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public abstract class AddressesStub implements BackgroundResource {
+
+ public UnaryCallable The default instance has everything set to sensible defaults:
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ * For example, to set the total timeout of aggregatedList to 30 seconds:
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+public class HttpJsonAddressesCallableFactory
+ implements HttpJsonStubCallableFactory This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+public class HttpJsonAddressesStub extends AddressesStub {
+ private static final ApiMethodDescriptor This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+public class HttpJsonRegionOperationsCallableFactory
+ implements HttpJsonStubCallableFactory This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
+public class HttpJsonRegionOperationsStub extends RegionOperationsStub {
+ private static final ApiMethodDescriptor This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public abstract class RegionOperationsStub implements BackgroundResource {
+
+ public UnaryCallable The default instance has everything set to sensible defaults:
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ * For example, to set the total timeout of get to 30 seconds:
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction Sample code:
+ *
+ * Sample code:
+ *
+ * {@code
+ * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
+ * String project = "project-309310695";
+ * String region = "region-934795532";
+ * String operation = "operation1662702951";
+ * Operation response = regionOperationsClient.get(project, region, operation);
+ * }
+ * }
+ *
+ *
+ *
+ *
+ * {@code
+ * RegionOperationsSettings regionOperationsSettings =
+ * RegionOperationsSettings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * RegionOperationsClient regionOperationsClient =
+ * RegionOperationsClient.create(regionOperationsSettings);
+ * }
+ *
+ * {@code
+ * RegionOperationsSettings regionOperationsSettings =
+ * RegionOperationsSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * RegionOperationsClient regionOperationsClient =
+ * RegionOperationsClient.create(regionOperationsSettings);
+ * }
+ *
+ * {@code
+ * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
+ * String project = "project-309310695";
+ * String region = "region-934795532";
+ * String operation = "operation1662702951";
+ * Operation response = regionOperationsClient.get(project, region, operation);
+ * }
+ * }
+ *
+ * @param project Project ID for this request.
+ * @param region Name of the region for this request.
+ * @param operation Name of the Operations resource to return.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Operation get(String project, String region, String operation) {
+ GetRegionOperationRequest request =
+ GetRegionOperationRequest.newBuilder()
+ .setProject(project)
+ .setRegion(region)
+ .setOperation(operation)
+ .build();
+ return get(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves the specified region-specific Operations resource.
+ *
+ * {@code
+ * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
+ * GetRegionOperationRequest request =
+ * GetRegionOperationRequest.newBuilder()
+ * .setOperation("operation1662702951")
+ * .setProject("project-309310695")
+ * .setRegion("region-934795532")
+ * .build();
+ * Operation response = regionOperationsClient.get(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Operation get(GetRegionOperationRequest request) {
+ return getCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves the specified region-specific Operations resource.
+ *
+ * {@code
+ * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
+ * GetRegionOperationRequest request =
+ * GetRegionOperationRequest.newBuilder()
+ * .setOperation("operation1662702951")
+ * .setProject("project-309310695")
+ * .setRegion("region-934795532")
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable
+ *
+ *
+ * {@code
+ * RegionOperationsSettings.Builder regionOperationsSettingsBuilder =
+ * RegionOperationsSettings.newBuilder();
+ * regionOperationsSettingsBuilder
+ * .getSettings()
+ * .setRetrySettings(
+ * regionOperationsSettingsBuilder
+ * .getSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * RegionOperationsSettings regionOperationsSettings = regionOperationsSettingsBuilder.build();
+ * }
+ */
+@Generated("by gapic-generator-java")
+public class RegionOperationsSettings extends ClientSettings{@code
+ * try (AddressesClient addressesClient = AddressesClient.create()) {
+ * String project = "project-309310695";
+ * AddressAggregatedList response = addressesClient.aggregatedList(project);
+ * }
+ * }
+ *
+ * {@code
+ * try (RegionOperationsClient regionOperationsClient = RegionOperationsClient.create()) {
+ * String project = "project-309310695";
+ * String region = "region-934795532";
+ * String operation = "operation1662702951";
+ * Operation response = regionOperationsClient.get(project, region, operation);
+ * }
+ * }
+ */
+@Generated("by gapic-generator-java")
+package com.google.cloud.compute.v1;
+
+import javax.annotation.Generated;
diff --git a/test/integration/goldens/compute/com/google/cloud/compute/v1/stub/AddressesStub.java b/test/integration/goldens/compute/com/google/cloud/compute/v1/stub/AddressesStub.java
new file mode 100644
index 0000000000..d192131a5b
--- /dev/null
+++ b/test/integration/goldens/compute/com/google/cloud/compute/v1/stub/AddressesStub.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2021 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.compute.v1.stub;
+
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.compute.v1.AddressAggregatedList;
+import com.google.cloud.compute.v1.AddressList;
+import com.google.cloud.compute.v1.AggregatedListAddressesRequest;
+import com.google.cloud.compute.v1.DeleteAddressRequest;
+import com.google.cloud.compute.v1.InsertAddressRequest;
+import com.google.cloud.compute.v1.ListAddressesRequest;
+import com.google.cloud.compute.v1.Operation;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Base stub class for the Addresses service API.
+ *
+ *
+ *
+ *
+ * {@code
+ * AddressesStubSettings.Builder addressesSettingsBuilder = AddressesStubSettings.newBuilder();
+ * addressesSettingsBuilder
+ * .aggregatedListSettings()
+ * .setRetrySettings(
+ * addressesSettingsBuilder
+ * .aggregatedListSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * AddressesStubSettings addressesSettings = addressesSettingsBuilder.build();
+ * }
+ */
+@Generated("by gapic-generator-java")
+public class AddressesStubSettings extends StubSettings
+ *
+ *
+ * {@code
+ * RegionOperationsStubSettings.Builder regionOperationsSettingsBuilder =
+ * RegionOperationsStubSettings.newBuilder();
+ * regionOperationsSettingsBuilder
+ * .getSettings()
+ * .setRetrySettings(
+ * regionOperationsSettingsBuilder
+ * .getSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * RegionOperationsStubSettings regionOperationsSettings = regionOperationsSettingsBuilder.build();
+ * }
+ */
+@Generated("by gapic-generator-java")
+public class RegionOperationsStubSettings extends StubSettings{@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * String name = "name3373707";
+ * String name = ShelfName.of("[SHELF_ID]").toString();
* Shelf response = libraryServiceClient.getShelf(name);
* }
* }
@@ -285,7 +286,8 @@ public final Shelf getShelf(String name) {
*
* {@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * GetShelfRequest request = GetShelfRequest.newBuilder().setName("name3373707").build();
+ * GetShelfRequest request =
+ * GetShelfRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).build();
* Shelf response = libraryServiceClient.getShelf(request);
* }
* }
@@ -305,7 +307,8 @@ public final Shelf getShelf(GetShelfRequest request) {
*
* {@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * GetShelfRequest request = GetShelfRequest.newBuilder().setName("name3373707").build();
+ * GetShelfRequest request =
+ * GetShelfRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).build();
* ApiFuture
{@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * String name = "name3373707";
+ * String name = ShelfName.of("[SHELF_ID]").toString();
* libraryServiceClient.deleteShelf(name);
* }
* }
@@ -454,7 +457,8 @@ public final void deleteShelf(String name) {
*
* {@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * DeleteShelfRequest request = DeleteShelfRequest.newBuilder().setName("name3373707").build();
+ * DeleteShelfRequest request =
+ * DeleteShelfRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).build();
* libraryServiceClient.deleteShelf(request);
* }
* }
@@ -474,7 +478,8 @@ public final void deleteShelf(DeleteShelfRequest request) {
*
* {@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * DeleteShelfRequest request = DeleteShelfRequest.newBuilder().setName("name3373707").build();
+ * DeleteShelfRequest request =
+ * DeleteShelfRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).build();
* ApiFuture
{@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
* ShelfName name = ShelfName.of("[SHELF_ID]");
- * ShelfName otherShelfName = ShelfName.of("[SHELF_ID]");
- * Shelf response = libraryServiceClient.mergeShelves(name, otherShelfName);
+ * ShelfName otherShelf = ShelfName.of("[SHELF_ID]");
+ * Shelf response = libraryServiceClient.mergeShelves(name, otherShelf);
* }
* }
*
* @param name The name of the shelf we're adding books to.
- * @param otherShelfName The name of the shelf we're removing books from and deleting.
+ * @param otherShelf The name of the shelf we're removing books from and deleting.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final Shelf mergeShelves(ShelfName name, ShelfName otherShelfName) {
+ public final Shelf mergeShelves(ShelfName name, ShelfName otherShelf) {
MergeShelvesRequest request =
MergeShelvesRequest.newBuilder()
.setName(name == null ? null : name.toString())
- .setOtherShelfName(otherShelfName == null ? null : otherShelfName.toString())
+ .setOtherShelf(otherShelf == null ? null : otherShelf.toString())
.build();
return mergeShelves(request);
}
@@ -531,20 +536,20 @@ public final Shelf mergeShelves(ShelfName name, ShelfName otherShelfName) {
* {@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
* ShelfName name = ShelfName.of("[SHELF_ID]");
- * String otherShelfName = "otherShelfName-1942963547";
- * Shelf response = libraryServiceClient.mergeShelves(name, otherShelfName);
+ * String otherShelf = ShelfName.of("[SHELF_ID]").toString();
+ * Shelf response = libraryServiceClient.mergeShelves(name, otherShelf);
* }
* }
*
* @param name The name of the shelf we're adding books to.
- * @param otherShelfName The name of the shelf we're removing books from and deleting.
+ * @param otherShelf The name of the shelf we're removing books from and deleting.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final Shelf mergeShelves(ShelfName name, String otherShelfName) {
+ public final Shelf mergeShelves(ShelfName name, String otherShelf) {
MergeShelvesRequest request =
MergeShelvesRequest.newBuilder()
.setName(name == null ? null : name.toString())
- .setOtherShelfName(otherShelfName)
+ .setOtherShelf(otherShelf)
.build();
return mergeShelves(request);
}
@@ -562,21 +567,21 @@ public final Shelf mergeShelves(ShelfName name, String otherShelfName) {
*
* {@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * String name = "name3373707";
- * ShelfName otherShelfName = ShelfName.of("[SHELF_ID]");
- * Shelf response = libraryServiceClient.mergeShelves(name, otherShelfName);
+ * String name = ShelfName.of("[SHELF_ID]").toString();
+ * ShelfName otherShelf = ShelfName.of("[SHELF_ID]");
+ * Shelf response = libraryServiceClient.mergeShelves(name, otherShelf);
* }
* }
*
* @param name The name of the shelf we're adding books to.
- * @param otherShelfName The name of the shelf we're removing books from and deleting.
+ * @param otherShelf The name of the shelf we're removing books from and deleting.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final Shelf mergeShelves(String name, ShelfName otherShelfName) {
+ public final Shelf mergeShelves(String name, ShelfName otherShelf) {
MergeShelvesRequest request =
MergeShelvesRequest.newBuilder()
.setName(name)
- .setOtherShelfName(otherShelfName == null ? null : otherShelfName.toString())
+ .setOtherShelf(otherShelf == null ? null : otherShelf.toString())
.build();
return mergeShelves(request);
}
@@ -594,19 +599,19 @@ public final Shelf mergeShelves(String name, ShelfName otherShelfName) {
*
* {@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * String name = "name3373707";
- * String otherShelfName = "otherShelfName-1942963547";
- * Shelf response = libraryServiceClient.mergeShelves(name, otherShelfName);
+ * String name = ShelfName.of("[SHELF_ID]").toString();
+ * String otherShelf = ShelfName.of("[SHELF_ID]").toString();
+ * Shelf response = libraryServiceClient.mergeShelves(name, otherShelf);
* }
* }
*
* @param name The name of the shelf we're adding books to.
- * @param otherShelfName The name of the shelf we're removing books from and deleting.
+ * @param otherShelf The name of the shelf we're removing books from and deleting.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final Shelf mergeShelves(String name, String otherShelfName) {
+ public final Shelf mergeShelves(String name, String otherShelf) {
MergeShelvesRequest request =
- MergeShelvesRequest.newBuilder().setName(name).setOtherShelfName(otherShelfName).build();
+ MergeShelvesRequest.newBuilder().setName(name).setOtherShelf(otherShelf).build();
return mergeShelves(request);
}
@@ -625,8 +630,8 @@ public final Shelf mergeShelves(String name, String otherShelfName) {
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
* MergeShelvesRequest request =
* MergeShelvesRequest.newBuilder()
- * .setName("name3373707")
- * .setOtherShelfName("otherShelfName-1942963547")
+ * .setName(ShelfName.of("[SHELF_ID]").toString())
+ * .setOtherShelf(ShelfName.of("[SHELF_ID]").toString())
* .build();
* Shelf response = libraryServiceClient.mergeShelves(request);
* }
@@ -654,8 +659,8 @@ public final Shelf mergeShelves(MergeShelvesRequest request) {
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
* MergeShelvesRequest request =
* MergeShelvesRequest.newBuilder()
- * .setName("name3373707")
- * .setOtherShelfName("otherShelfName-1942963547")
+ * .setName(ShelfName.of("[SHELF_ID]").toString())
+ * .setOtherShelf(ShelfName.of("[SHELF_ID]").toString())
* .build();
* ApiFuture{@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * ShelfName name = ShelfName.of("[SHELF_ID]");
+ * ShelfName parent = ShelfName.of("[SHELF_ID]");
* Book book = Book.newBuilder().build();
- * Book response = libraryServiceClient.createBook(name, book);
+ * Book response = libraryServiceClient.createBook(parent, book);
* }
* }
*
- * @param name The name of the shelf in which the book is created.
+ * @param parent The name of the shelf in which the book is created.
* @param book The book to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final Book createBook(ShelfName name, Book book) {
+ public final Book createBook(ShelfName parent, Book book) {
CreateBookRequest request =
CreateBookRequest.newBuilder()
- .setName(name == null ? null : name.toString())
+ .setParent(parent == null ? null : parent.toString())
.setBook(book)
.build();
return createBook(request);
@@ -702,18 +707,19 @@ public final Book createBook(ShelfName name, Book book) {
*
* {@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * String name = "name3373707";
+ * String parent = ShelfName.of("[SHELF_ID]").toString();
* Book book = Book.newBuilder().build();
- * Book response = libraryServiceClient.createBook(name, book);
+ * Book response = libraryServiceClient.createBook(parent, book);
* }
* }
*
- * @param name The name of the shelf in which the book is created.
+ * @param parent The name of the shelf in which the book is created.
* @param book The book to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final Book createBook(String name, Book book) {
- CreateBookRequest request = CreateBookRequest.newBuilder().setName(name).setBook(book).build();
+ public final Book createBook(String parent, Book book) {
+ CreateBookRequest request =
+ CreateBookRequest.newBuilder().setParent(parent).setBook(book).build();
return createBook(request);
}
@@ -727,7 +733,7 @@ public final Book createBook(String name, Book book) {
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
* CreateBookRequest request =
* CreateBookRequest.newBuilder()
- * .setName("name3373707")
+ * .setParent(ShelfName.of("[SHELF_ID]").toString())
* .setBook(Book.newBuilder().build())
* .build();
* Book response = libraryServiceClient.createBook(request);
@@ -751,7 +757,7 @@ public final Book createBook(CreateBookRequest request) {
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
* CreateBookRequest request =
* CreateBookRequest.newBuilder()
- * .setName("name3373707")
+ * .setParent(ShelfName.of("[SHELF_ID]").toString())
* .setBook(Book.newBuilder().build())
* .build();
* ApiFuture{@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * BookName name = BookName.of("[SHELF_ID]", "[BOOK_ID]");
+ * BookName name = BookName.of("[SHELF]", "[BOOK]");
* Book response = libraryServiceClient.getBook(name);
* }
* }
@@ -794,7 +800,7 @@ public final Book getBook(BookName name) {
*
* {@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * String name = "name3373707";
+ * String name = BookName.of("[SHELF]", "[BOOK]").toString();
* Book response = libraryServiceClient.getBook(name);
* }
* }
@@ -815,7 +821,8 @@ public final Book getBook(String name) {
*
* {@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * GetBookRequest request = GetBookRequest.newBuilder().setName("name3373707").build();
+ * GetBookRequest request =
+ * GetBookRequest.newBuilder().setName(BookName.of("[SHELF]", "[BOOK]").toString()).build();
* Book response = libraryServiceClient.getBook(request);
* }
* }
@@ -835,7 +842,8 @@ public final Book getBook(GetBookRequest request) {
*
* {@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * GetBookRequest request = GetBookRequest.newBuilder().setName("name3373707").build();
+ * GetBookRequest request =
+ * GetBookRequest.newBuilder().setName(BookName.of("[SHELF]", "[BOOK]").toString()).build();
* ApiFuture
{@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * ShelfName name = ShelfName.of("[SHELF_ID]");
- * for (Book element : libraryServiceClient.listBooks(name).iterateAll()) {
+ * ShelfName parent = ShelfName.of("[SHELF_ID]");
+ * for (Book element : libraryServiceClient.listBooks(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
- * @param name The name of the shelf whose books we'd like to list.
+ * @param parent The name of the shelf whose books we'd like to list.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final ListBooksPagedResponse listBooks(ShelfName name) {
+ public final ListBooksPagedResponse listBooks(ShelfName parent) {
ListBooksRequest request =
- ListBooksRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ ListBooksRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build();
return listBooks(request);
}
@@ -882,18 +890,18 @@ public final ListBooksPagedResponse listBooks(ShelfName name) {
*
* {@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * String name = "name3373707";
- * for (Book element : libraryServiceClient.listBooks(name).iterateAll()) {
+ * String parent = ShelfName.of("[SHELF_ID]").toString();
+ * for (Book element : libraryServiceClient.listBooks(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
- * @param name The name of the shelf whose books we'd like to list.
+ * @param parent The name of the shelf whose books we'd like to list.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final ListBooksPagedResponse listBooks(String name) {
- ListBooksRequest request = ListBooksRequest.newBuilder().setName(name).build();
+ public final ListBooksPagedResponse listBooks(String parent) {
+ ListBooksRequest request = ListBooksRequest.newBuilder().setParent(parent).build();
return listBooks(request);
}
@@ -909,7 +917,7 @@ public final ListBooksPagedResponse listBooks(String name) {
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
* ListBooksRequest request =
* ListBooksRequest.newBuilder()
- * .setName("name3373707")
+ * .setParent(ShelfName.of("[SHELF_ID]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
@@ -938,7 +946,7 @@ public final ListBooksPagedResponse listBooks(ListBooksRequest request) {
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
* ListBooksRequest request =
* ListBooksRequest.newBuilder()
- * .setName("name3373707")
+ * .setParent(ShelfName.of("[SHELF_ID]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
@@ -966,7 +974,7 @@ public final UnaryCallable{@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * DeleteBookRequest request = DeleteBookRequest.newBuilder().setName("name3373707").build();
+ * BookName name = BookName.of("[SHELF]", "[BOOK]");
+ * libraryServiceClient.deleteBook(name);
+ * }
+ * }
+ *
+ * @param name The name of the book to delete.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteBook(BookName name) {
+ DeleteBookRequest request =
+ DeleteBookRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ deleteBook(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a book. Returns NOT_FOUND if the book does not exist.
+ *
+ * {@code
+ * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+ * String name = BookName.of("[SHELF]", "[BOOK]").toString();
+ * libraryServiceClient.deleteBook(name);
+ * }
+ * }
+ *
+ * @param name The name of the book to delete.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteBook(String name) {
+ DeleteBookRequest request = DeleteBookRequest.newBuilder().setName(name).build();
+ deleteBook(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a book. Returns NOT_FOUND if the book does not exist.
+ *
+ * {@code
+ * try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
+ * DeleteBookRequest request =
+ * DeleteBookRequest.newBuilder()
+ * .setName(BookName.of("[SHELF]", "[BOOK]").toString())
+ * .build();
* libraryServiceClient.deleteBook(request);
* }
* }
@@ -1017,7 +1071,10 @@ public final void deleteBook(DeleteBookRequest request) {
*
* {@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * DeleteBookRequest request = DeleteBookRequest.newBuilder().setName("name3373707").build();
+ * DeleteBookRequest request =
+ * DeleteBookRequest.newBuilder()
+ * .setName(BookName.of("[SHELF]", "[BOOK]").toString())
+ * .build();
* ApiFuture
{@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
* Book book = Book.newBuilder().build();
- * Book response = libraryServiceClient.updateBook(book);
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * Book response = libraryServiceClient.updateBook(book, updateMask);
* }
* }
*
- * @param book The book to update with. The name must match or be empty.
+ * @param book The name of the book to update.
+ * @param updateMask Required. Mask of fields to update.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final Book updateBook(Book book) {
- UpdateBookRequest request = UpdateBookRequest.newBuilder().setBook(book).build();
+ public final Book updateBook(Book book, FieldMask updateMask) {
+ UpdateBookRequest request =
+ UpdateBookRequest.newBuilder().setBook(book).setUpdateMask(updateMask).build();
return updateBook(request);
}
@@ -1061,8 +1121,8 @@ public final Book updateBook(Book book) {
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
* UpdateBookRequest request =
* UpdateBookRequest.newBuilder()
- * .setName("name3373707")
* .setBook(Book.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* Book response = libraryServiceClient.updateBook(request);
* }
@@ -1086,8 +1146,8 @@ public final Book updateBook(UpdateBookRequest request) {
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
* UpdateBookRequest request =
* UpdateBookRequest.newBuilder()
- * .setName("name3373707")
* .setBook(Book.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* ApiFuture{@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * BookName name = BookName.of("[SHELF_ID]", "[BOOK_ID]");
+ * BookName name = BookName.of("[SHELF]", "[BOOK]");
* ShelfName otherShelfName = ShelfName.of("[SHELF_ID]");
* Book response = libraryServiceClient.moveBook(name, otherShelfName);
* }
@@ -1136,8 +1196,8 @@ public final Book moveBook(BookName name, ShelfName otherShelfName) {
*
*
{@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * BookName name = BookName.of("[SHELF_ID]", "[BOOK_ID]");
- * String otherShelfName = "otherShelfName-1942963547";
+ * BookName name = BookName.of("[SHELF]", "[BOOK]");
+ * String otherShelfName = ShelfName.of("[SHELF_ID]").toString();
* Book response = libraryServiceClient.moveBook(name, otherShelfName);
* }
* }
@@ -1164,7 +1224,7 @@ public final Book moveBook(BookName name, String otherShelfName) {
*
* {@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * String name = "name3373707";
+ * String name = BookName.of("[SHELF]", "[BOOK]").toString();
* ShelfName otherShelfName = ShelfName.of("[SHELF_ID]");
* Book response = libraryServiceClient.moveBook(name, otherShelfName);
* }
@@ -1192,8 +1252,8 @@ public final Book moveBook(String name, ShelfName otherShelfName) {
*
*
{@code
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
- * String name = "name3373707";
- * String otherShelfName = "otherShelfName-1942963547";
+ * String name = BookName.of("[SHELF]", "[BOOK]").toString();
+ * String otherShelfName = ShelfName.of("[SHELF_ID]").toString();
* Book response = libraryServiceClient.moveBook(name, otherShelfName);
* }
* }
@@ -1219,8 +1279,8 @@ public final Book moveBook(String name, String otherShelfName) {
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
* MoveBookRequest request =
* MoveBookRequest.newBuilder()
- * .setName("name3373707")
- * .setOtherShelfName("otherShelfName-1942963547")
+ * .setName(BookName.of("[SHELF]", "[BOOK]").toString())
+ * .setOtherShelfName(ShelfName.of("[SHELF_ID]").toString())
* .build();
* Book response = libraryServiceClient.moveBook(request);
* }
@@ -1244,8 +1304,8 @@ public final Book moveBook(MoveBookRequest request) {
* try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
* MoveBookRequest request =
* MoveBookRequest.newBuilder()
- * .setName("name3373707")
- * .setOtherShelfName("otherShelfName-1942963547")
+ * .setName(BookName.of("[SHELF]", "[BOOK]").toString())
+ * .setOtherShelfName(ShelfName.of("[SHELF_ID]").toString())
* .build();
* ApiFuture