From 44e44e08dd45ef31059763748f3d9311ea5c46f5 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 23 Jun 2022 16:06:33 +0000 Subject: [PATCH 1/7] chore(main): release 0.3.2-SNAPSHOT (#192) :robot: I have created a release *beep* *boop* --- ### Updating meta-information for bleeding-edge SNAPSHOT release. --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- google-cloud-private-catalog-bom/pom.xml | 8 ++++---- google-cloud-private-catalog/pom.xml | 4 ++-- grpc-google-cloud-private-catalog-v1beta1/pom.xml | 4 ++-- pom.xml | 8 ++++---- proto-google-cloud-private-catalog-v1beta1/pom.xml | 4 ++-- versions.txt | 6 +++--- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/google-cloud-private-catalog-bom/pom.xml b/google-cloud-private-catalog-bom/pom.xml index f1cd31da..c1025337 100644 --- a/google-cloud-private-catalog-bom/pom.xml +++ b/google-cloud-private-catalog-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-private-catalog-bom - 0.4.1 + 0.4.2-SNAPSHOT pom com.google.cloud @@ -56,17 +56,17 @@ com.google.cloud google-cloud-private-catalog - 0.4.1 + 0.4.2-SNAPSHOT com.google.api.grpc grpc-google-cloud-private-catalog-v1beta1 - 0.4.1 + 0.4.2-SNAPSHOT com.google.api.grpc proto-google-cloud-private-catalog-v1beta1 - 0.4.1 + 0.4.2-SNAPSHOT diff --git a/google-cloud-private-catalog/pom.xml b/google-cloud-private-catalog/pom.xml index e0493cc4..41b2d61b 100644 --- a/google-cloud-private-catalog/pom.xml +++ b/google-cloud-private-catalog/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-private-catalog - 0.4.1 + 0.4.2-SNAPSHOT jar Google Private Catalog https://github.com/googleapis/java-private-catalog @@ -11,7 +11,7 @@ com.google.cloud google-cloud-private-catalog-parent - 0.4.1 + 0.4.2-SNAPSHOT google-cloud-private-catalog diff --git a/grpc-google-cloud-private-catalog-v1beta1/pom.xml b/grpc-google-cloud-private-catalog-v1beta1/pom.xml index 8c47a641..671d0bc6 100644 --- a/grpc-google-cloud-private-catalog-v1beta1/pom.xml +++ b/grpc-google-cloud-private-catalog-v1beta1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-private-catalog-v1beta1 - 0.4.1 + 0.4.2-SNAPSHOT grpc-google-cloud-private-catalog-v1beta1 GRPC library for google-cloud-private-catalog com.google.cloud google-cloud-private-catalog-parent - 0.4.1 + 0.4.2-SNAPSHOT diff --git a/pom.xml b/pom.xml index 78d5e043..7afe1fa1 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-private-catalog-parent pom - 0.4.1 + 0.4.2-SNAPSHOT Google Private Catalog Parent https://github.com/googleapis/java-private-catalog @@ -60,17 +60,17 @@ com.google.cloud google-cloud-private-catalog - 0.4.1 + 0.4.2-SNAPSHOT com.google.api.grpc grpc-google-cloud-private-catalog-v1beta1 - 0.4.1 + 0.4.2-SNAPSHOT com.google.api.grpc proto-google-cloud-private-catalog-v1beta1 - 0.4.1 + 0.4.2-SNAPSHOT diff --git a/proto-google-cloud-private-catalog-v1beta1/pom.xml b/proto-google-cloud-private-catalog-v1beta1/pom.xml index b8f371bc..107fc025 100644 --- a/proto-google-cloud-private-catalog-v1beta1/pom.xml +++ b/proto-google-cloud-private-catalog-v1beta1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-private-catalog-v1beta1 - 0.4.1 + 0.4.2-SNAPSHOT proto-google-cloud-private-catalog-v1beta1 Proto library for google-cloud-private-catalog com.google.cloud google-cloud-private-catalog-parent - 0.4.1 + 0.4.2-SNAPSHOT diff --git a/versions.txt b/versions.txt index 7831ceab..d5b74e66 100644 --- a/versions.txt +++ b/versions.txt @@ -1,6 +1,6 @@ # Format: # module:released-version:current-version -google-cloud-private-catalog:0.4.1:0.4.1 -grpc-google-cloud-private-catalog-v1beta1:0.4.1:0.4.1 -proto-google-cloud-private-catalog-v1beta1:0.4.1:0.4.1 +google-cloud-private-catalog:0.4.1:0.4.2-SNAPSHOT +grpc-google-cloud-private-catalog-v1beta1:0.4.1:0.4.2-SNAPSHOT +proto-google-cloud-private-catalog-v1beta1:0.4.1:0.4.2-SNAPSHOT From ec64ba7ff7ddce705204090f8df2060eee24955e Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 23 Jun 2022 17:28:05 -0400 Subject: [PATCH 2/7] feat: Enable REST transport for most of Java and Go clients (#190) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Enable REST transport for most of Java and Go clients PiperOrigin-RevId: 456641589 Source-Link: https://github.com/googleapis/googleapis/commit/8a251f5225b789b2383207ffd978f6aa3d77fcf7 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4ca52a529cf01308d9714950edffbea3560cfbdb Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGNhNTJhNTI5Y2YwMTMwOGQ5NzE0OTUwZWRmZmJlYTM1NjBjZmJkYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * deps: adding gax-httpjson * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: Tomo Suzuki --- README.md | 6 +- google-cloud-private-catalog/pom.xml | 16 + .../v1beta1/PrivateCatalogClient.java | 14 + .../v1beta1/PrivateCatalogSettings.java | 23 +- ...HttpJsonPrivateCatalogCallableFactory.java | 105 ++++++ .../stub/HttpJsonPrivateCatalogStub.java | 352 ++++++++++++++++++ .../stub/PrivateCatalogStubSettings.java | 53 ++- .../PrivateCatalogClientHttpJsonTest.java | 265 +++++++++++++ .../SyncCreateSetCredentialsProvider.java | 41 ++ .../SyncCreateSetCredentialsProvider1.java | 40 ++ .../create/SyncCreateSetEndpoint.java | 38 ++ .../searchcatalogs/AsyncSearchCatalogs.java | 51 +++ .../AsyncSearchCatalogsPaged.java | 59 +++ .../searchcatalogs/SyncSearchCatalogs.java | 47 +++ .../searchproducts/AsyncSearchProducts.java | 51 +++ .../AsyncSearchProductsPaged.java | 59 +++ .../searchproducts/SyncSearchProducts.java | 47 +++ .../searchversions/AsyncSearchVersions.java | 51 +++ .../AsyncSearchVersionsPaged.java | 59 +++ .../searchversions/SyncSearchVersions.java | 47 +++ .../searchcatalogs/SyncSearchCatalogs.java | 46 +++ .../searchcatalogs/SyncSearchCatalogs.java | 46 +++ 22 files changed, 1508 insertions(+), 8 deletions(-) create mode 100644 google-cloud-private-catalog/src/main/java/com/google/cloud/privatecatalog/v1beta1/stub/HttpJsonPrivateCatalogCallableFactory.java create mode 100644 google-cloud-private-catalog/src/main/java/com/google/cloud/privatecatalog/v1beta1/stub/HttpJsonPrivateCatalogStub.java create mode 100644 google-cloud-private-catalog/src/test/java/com/google/cloud/privatecatalog/v1beta1/PrivateCatalogClientHttpJsonTest.java create mode 100644 samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/create/SyncCreateSetCredentialsProvider.java create mode 100644 samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/create/SyncCreateSetCredentialsProvider1.java create mode 100644 samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/create/SyncCreateSetEndpoint.java create mode 100644 samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchcatalogs/AsyncSearchCatalogs.java create mode 100644 samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchcatalogs/AsyncSearchCatalogsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchcatalogs/SyncSearchCatalogs.java create mode 100644 samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchproducts/AsyncSearchProducts.java create mode 100644 samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchproducts/AsyncSearchProductsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchproducts/SyncSearchProducts.java create mode 100644 samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchversions/AsyncSearchVersions.java create mode 100644 samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchversions/AsyncSearchVersionsPaged.java create mode 100644 samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchversions/SyncSearchVersions.java create mode 100644 samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogsettings/searchcatalogs/SyncSearchCatalogs.java create mode 100644 samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/stub/privatecatalogstubsettings/searchcatalogs/SyncSearchCatalogs.java diff --git a/README.md b/README.md index a9ae7ca7..109be5a3 100644 --- a/README.md +++ b/README.md @@ -22,20 +22,20 @@ If you are using Maven, add this to your pom.xml file: com.google.cloud google-cloud-private-catalog - 0.4.0 + 0.4.1 ``` If you are using Gradle without BOM, add this to your dependencies ```Groovy -implementation 'com.google.cloud:google-cloud-private-catalog:0.4.0' +implementation 'com.google.cloud:google-cloud-private-catalog:0.4.1' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-private-catalog" % "0.4.0" +libraryDependencies += "com.google.cloud" % "google-cloud-private-catalog" % "0.4.1" ``` ## Authentication diff --git a/google-cloud-private-catalog/pom.xml b/google-cloud-private-catalog/pom.xml index 41b2d61b..96043fd6 100644 --- a/google-cloud-private-catalog/pom.xml +++ b/google-cloud-private-catalog/pom.xml @@ -58,6 +58,10 @@ com.google.api gax-grpc + + com.google.api + gax-httpjson + @@ -73,12 +77,24 @@ test + + com.google.api + gax + testlib + test + com.google.api gax-grpc testlib test + + com.google.api + gax-httpjson + testlib + test + diff --git a/google-cloud-private-catalog/src/main/java/com/google/cloud/privatecatalog/v1beta1/PrivateCatalogClient.java b/google-cloud-private-catalog/src/main/java/com/google/cloud/privatecatalog/v1beta1/PrivateCatalogClient.java index d432b2a7..d3347847 100644 --- a/google-cloud-private-catalog/src/main/java/com/google/cloud/privatecatalog/v1beta1/PrivateCatalogClient.java +++ b/google-cloud-private-catalog/src/main/java/com/google/cloud/privatecatalog/v1beta1/PrivateCatalogClient.java @@ -120,6 +120,20 @@ * PrivateCatalogClient privateCatalogClient = PrivateCatalogClient.create(privateCatalogSettings); * } * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * PrivateCatalogSettings privateCatalogSettings =
+ *     PrivateCatalogSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             PrivateCatalogSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * PrivateCatalogClient privateCatalogClient = PrivateCatalogClient.create(privateCatalogSettings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @BetaApi diff --git a/google-cloud-private-catalog/src/main/java/com/google/cloud/privatecatalog/v1beta1/PrivateCatalogSettings.java b/google-cloud-private-catalog/src/main/java/com/google/cloud/privatecatalog/v1beta1/PrivateCatalogSettings.java index e4ceb0f4..09549b53 100644 --- a/google-cloud-private-catalog/src/main/java/com/google/cloud/privatecatalog/v1beta1/PrivateCatalogSettings.java +++ b/google-cloud-private-catalog/src/main/java/com/google/cloud/privatecatalog/v1beta1/PrivateCatalogSettings.java @@ -25,6 +25,7 @@ import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; @@ -121,11 +122,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return PrivateCatalogStubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return PrivateCatalogStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return PrivateCatalogStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return PrivateCatalogStubSettings.defaultTransportChannelProvider(); } @@ -135,11 +143,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return PrivateCatalogStubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -177,6 +191,11 @@ private static Builder createDefault() { return new Builder(PrivateCatalogStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(PrivateCatalogStubSettings.newHttpJsonBuilder()); + } + public PrivateCatalogStubSettings.Builder getStubSettingsBuilder() { return ((PrivateCatalogStubSettings.Builder) getStubSettings()); } diff --git a/google-cloud-private-catalog/src/main/java/com/google/cloud/privatecatalog/v1beta1/stub/HttpJsonPrivateCatalogCallableFactory.java b/google-cloud-private-catalog/src/main/java/com/google/cloud/privatecatalog/v1beta1/stub/HttpJsonPrivateCatalogCallableFactory.java new file mode 100644 index 00000000..ece8c7f7 --- /dev/null +++ b/google-cloud-private-catalog/src/main/java/com/google/cloud/privatecatalog/v1beta1/stub/HttpJsonPrivateCatalogCallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 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.privatecatalog.v1beta1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the PrivateCatalog service API. + * + *

This class is for advanced usage. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonPrivateCatalogCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-private-catalog/src/main/java/com/google/cloud/privatecatalog/v1beta1/stub/HttpJsonPrivateCatalogStub.java b/google-cloud-private-catalog/src/main/java/com/google/cloud/privatecatalog/v1beta1/stub/HttpJsonPrivateCatalogStub.java new file mode 100644 index 00000000..05a7e51a --- /dev/null +++ b/google-cloud-private-catalog/src/main/java/com/google/cloud/privatecatalog/v1beta1/stub/HttpJsonPrivateCatalogStub.java @@ -0,0 +1,352 @@ +/* + * Copyright 2022 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.privatecatalog.v1beta1.stub; + +import static com.google.cloud.privatecatalog.v1beta1.PrivateCatalogClient.SearchCatalogsPagedResponse; +import static com.google.cloud.privatecatalog.v1beta1.PrivateCatalogClient.SearchProductsPagedResponse; +import static com.google.cloud.privatecatalog.v1beta1.PrivateCatalogClient.SearchVersionsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.privatecatalog.v1beta1.SearchCatalogsRequest; +import com.google.cloud.privatecatalog.v1beta1.SearchCatalogsResponse; +import com.google.cloud.privatecatalog.v1beta1.SearchProductsRequest; +import com.google.cloud.privatecatalog.v1beta1.SearchProductsResponse; +import com.google.cloud.privatecatalog.v1beta1.SearchVersionsRequest; +import com.google.cloud.privatecatalog.v1beta1.SearchVersionsResponse; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the PrivateCatalog service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonPrivateCatalogStub extends PrivateCatalogStub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor + searchCatalogsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.privatecatalog.v1beta1.PrivateCatalog/SearchCatalogs") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{resource=projects/*}/catalogs:search", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setAdditionalPaths( + "/v1beta1/{resource=organizations/*}/catalogs:search", + "/v1beta1/{resource=folders/*}/catalogs:search") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam(fields, "query", request.getQuery()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(SearchCatalogsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + searchProductsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.privatecatalog.v1beta1.PrivateCatalog/SearchProducts") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{resource=projects/*}/products:search", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setAdditionalPaths( + "/v1beta1/{resource=organizations/*}/products:search", + "/v1beta1/{resource=folders/*}/products:search") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam(fields, "query", request.getQuery()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(SearchProductsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + searchVersionsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.privatecatalog.v1beta1.PrivateCatalog/SearchVersions") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1beta1/{resource=projects/*}/versions:search", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "resource", request.getResource()); + return fields; + }) + .setAdditionalPaths( + "/v1beta1/{resource=organizations/*}/versions:search", + "/v1beta1/{resource=folders/*}/versions:search") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam(fields, "query", request.getQuery()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(SearchVersionsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable searchCatalogsCallable; + private final UnaryCallable + searchCatalogsPagedCallable; + private final UnaryCallable searchProductsCallable; + private final UnaryCallable + searchProductsPagedCallable; + private final UnaryCallable searchVersionsCallable; + private final UnaryCallable + searchVersionsPagedCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonPrivateCatalogStub create(PrivateCatalogStubSettings settings) + throws IOException { + return new HttpJsonPrivateCatalogStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonPrivateCatalogStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonPrivateCatalogStub( + PrivateCatalogStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonPrivateCatalogStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonPrivateCatalogStub( + PrivateCatalogStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonPrivateCatalogStub, 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 HttpJsonPrivateCatalogStub( + PrivateCatalogStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonPrivateCatalogCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonPrivateCatalogStub, 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 HttpJsonPrivateCatalogStub( + PrivateCatalogStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings + searchCatalogsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(searchCatalogsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + searchProductsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(searchProductsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + searchVersionsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(searchVersionsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.searchCatalogsCallable = + callableFactory.createUnaryCallable( + searchCatalogsTransportSettings, settings.searchCatalogsSettings(), clientContext); + this.searchCatalogsPagedCallable = + callableFactory.createPagedCallable( + searchCatalogsTransportSettings, settings.searchCatalogsSettings(), clientContext); + this.searchProductsCallable = + callableFactory.createUnaryCallable( + searchProductsTransportSettings, settings.searchProductsSettings(), clientContext); + this.searchProductsPagedCallable = + callableFactory.createPagedCallable( + searchProductsTransportSettings, settings.searchProductsSettings(), clientContext); + this.searchVersionsCallable = + callableFactory.createUnaryCallable( + searchVersionsTransportSettings, settings.searchVersionsSettings(), clientContext); + this.searchVersionsPagedCallable = + callableFactory.createPagedCallable( + searchVersionsTransportSettings, settings.searchVersionsSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(searchCatalogsMethodDescriptor); + methodDescriptors.add(searchProductsMethodDescriptor); + methodDescriptors.add(searchVersionsMethodDescriptor); + return methodDescriptors; + } + + @Override + public UnaryCallable searchCatalogsCallable() { + return searchCatalogsCallable; + } + + @Override + public UnaryCallable + searchCatalogsPagedCallable() { + return searchCatalogsPagedCallable; + } + + @Override + public UnaryCallable searchProductsCallable() { + return searchProductsCallable; + } + + @Override + public UnaryCallable + searchProductsPagedCallable() { + return searchProductsPagedCallable; + } + + @Override + public UnaryCallable searchVersionsCallable() { + return searchVersionsCallable; + } + + @Override + public UnaryCallable + searchVersionsPagedCallable() { + return searchVersionsPagedCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-private-catalog/src/main/java/com/google/cloud/privatecatalog/v1beta1/stub/PrivateCatalogStubSettings.java b/google-cloud-private-catalog/src/main/java/com/google/cloud/privatecatalog/v1beta1/stub/PrivateCatalogStubSettings.java index 37c3e9b7..de958696 100644 --- a/google-cloud-private-catalog/src/main/java/com/google/cloud/privatecatalog/v1beta1/stub/PrivateCatalogStubSettings.java +++ b/google-cloud-private-catalog/src/main/java/com/google/cloud/privatecatalog/v1beta1/stub/PrivateCatalogStubSettings.java @@ -29,6 +29,9 @@ import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.retrying.RetrySettings; import com.google.api.gax.rpc.ApiCallContext; import com.google.api.gax.rpc.ApiClientHeaderProvider; @@ -300,6 +303,11 @@ public PrivateCatalogStub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcPrivateCatalogStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonPrivateCatalogStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -332,18 +340,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return InstantiatingGrpcChannelProvider.newBuilder() .setMaxInboundMessageSize(Integer.MAX_VALUE); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return defaultGrpcTransportProviderBuilder().build(); } @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken( "gapic", GaxProperties.getLibraryVersion(PrivateCatalogStubSettings.class)) @@ -351,11 +366,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(PrivateCatalogStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return PrivateCatalogStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -448,6 +482,19 @@ private static Builder createDefault() { return initDefaults(builder); } + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + private static Builder initDefaults(Builder builder) { builder .searchCatalogsSettings() diff --git a/google-cloud-private-catalog/src/test/java/com/google/cloud/privatecatalog/v1beta1/PrivateCatalogClientHttpJsonTest.java b/google-cloud-private-catalog/src/test/java/com/google/cloud/privatecatalog/v1beta1/PrivateCatalogClientHttpJsonTest.java new file mode 100644 index 00000000..5f39faa2 --- /dev/null +++ b/google-cloud-private-catalog/src/test/java/com/google/cloud/privatecatalog/v1beta1/PrivateCatalogClientHttpJsonTest.java @@ -0,0 +1,265 @@ +/* + * Copyright 2022 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.privatecatalog.v1beta1; + +import static com.google.cloud.privatecatalog.v1beta1.PrivateCatalogClient.SearchCatalogsPagedResponse; +import static com.google.cloud.privatecatalog.v1beta1.PrivateCatalogClient.SearchProductsPagedResponse; +import static com.google.cloud.privatecatalog.v1beta1.PrivateCatalogClient.SearchVersionsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.privatecatalog.v1beta1.stub.HttpJsonPrivateCatalogStub; +import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class PrivateCatalogClientHttpJsonTest { + private static MockHttpService mockService; + private static PrivateCatalogClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonPrivateCatalogStub.getMethodDescriptors(), + PrivateCatalogSettings.getDefaultEndpoint()); + PrivateCatalogSettings settings = + PrivateCatalogSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + PrivateCatalogSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = PrivateCatalogClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void searchCatalogsTest() throws Exception { + Catalog responsesElement = Catalog.newBuilder().build(); + SearchCatalogsResponse expectedResponse = + SearchCatalogsResponse.newBuilder() + .setNextPageToken("") + .addAllCatalogs(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + SearchCatalogsRequest request = + SearchCatalogsRequest.newBuilder() + .setResource("projects/project-4963") + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + SearchCatalogsPagedResponse pagedListResponse = client.searchCatalogs(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCatalogsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void searchCatalogsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SearchCatalogsRequest request = + SearchCatalogsRequest.newBuilder() + .setResource("projects/project-4963") + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.searchCatalogs(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void searchProductsTest() throws Exception { + Product responsesElement = Product.newBuilder().build(); + SearchProductsResponse expectedResponse = + SearchProductsResponse.newBuilder() + .setNextPageToken("") + .addAllProducts(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + SearchProductsRequest request = + SearchProductsRequest.newBuilder() + .setResource("projects/project-4963") + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + SearchProductsPagedResponse pagedListResponse = client.searchProducts(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getProductsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void searchProductsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SearchProductsRequest request = + SearchProductsRequest.newBuilder() + .setResource("projects/project-4963") + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.searchProducts(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void searchVersionsTest() throws Exception { + Version responsesElement = Version.newBuilder().build(); + SearchVersionsResponse expectedResponse = + SearchVersionsResponse.newBuilder() + .setNextPageToken("") + .addAllVersions(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + SearchVersionsRequest request = + SearchVersionsRequest.newBuilder() + .setResource("projects/project-4963") + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + SearchVersionsPagedResponse pagedListResponse = client.searchVersions(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getVersionsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void searchVersionsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SearchVersionsRequest request = + SearchVersionsRequest.newBuilder() + .setResource("projects/project-4963") + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.searchVersions(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 00000000..bae32f18 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 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.privatecatalog.v1beta1.samples; + +// [START privatecatalog_v1beta1_generated_privatecatalogclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.privatecatalog.v1beta1.PrivateCatalogClient; +import com.google.cloud.privatecatalog.v1beta1.PrivateCatalogSettings; +import com.google.cloud.privatecatalog.v1beta1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + PrivateCatalogSettings privateCatalogSettings = + PrivateCatalogSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + PrivateCatalogClient privateCatalogClient = PrivateCatalogClient.create(privateCatalogSettings); + } +} +// [END privatecatalog_v1beta1_generated_privatecatalogclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 00000000..eea1dea4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 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.privatecatalog.v1beta1.samples; + +// [START privatecatalog_v1beta1_generated_privatecatalogclient_create_setcredentialsprovider1_sync] +import com.google.cloud.privatecatalog.v1beta1.PrivateCatalogClient; +import com.google.cloud.privatecatalog.v1beta1.PrivateCatalogSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + PrivateCatalogSettings privateCatalogSettings = + PrivateCatalogSettings.newBuilder() + .setTransportChannelProvider( + PrivateCatalogSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + PrivateCatalogClient privateCatalogClient = PrivateCatalogClient.create(privateCatalogSettings); + } +} +// [END privatecatalog_v1beta1_generated_privatecatalogclient_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 00000000..4c3ab290 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,38 @@ +/* + * Copyright 2022 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.privatecatalog.v1beta1.samples; + +// [START privatecatalog_v1beta1_generated_privatecatalogclient_create_setendpoint_sync] +import com.google.cloud.privatecatalog.v1beta1.PrivateCatalogClient; +import com.google.cloud.privatecatalog.v1beta1.PrivateCatalogSettings; +import com.google.cloud.privatecatalog.v1beta1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + PrivateCatalogSettings privateCatalogSettings = + PrivateCatalogSettings.newBuilder().setEndpoint(myEndpoint).build(); + PrivateCatalogClient privateCatalogClient = PrivateCatalogClient.create(privateCatalogSettings); + } +} +// [END privatecatalog_v1beta1_generated_privatecatalogclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchcatalogs/AsyncSearchCatalogs.java b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchcatalogs/AsyncSearchCatalogs.java new file mode 100644 index 00000000..2d31d6d4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchcatalogs/AsyncSearchCatalogs.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 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.privatecatalog.v1beta1.samples; + +// [START privatecatalog_v1beta1_generated_privatecatalogclient_searchcatalogs_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.privatecatalog.v1beta1.Catalog; +import com.google.cloud.privatecatalog.v1beta1.PrivateCatalogClient; +import com.google.cloud.privatecatalog.v1beta1.SearchCatalogsRequest; + +public class AsyncSearchCatalogs { + + public static void main(String[] args) throws Exception { + asyncSearchCatalogs(); + } + + public static void asyncSearchCatalogs() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (PrivateCatalogClient privateCatalogClient = PrivateCatalogClient.create()) { + SearchCatalogsRequest request = + SearchCatalogsRequest.newBuilder() + .setResource("resource-341064690") + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + privateCatalogClient.searchCatalogsPagedCallable().futureCall(request); + // Do something. + for (Catalog element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privatecatalog_v1beta1_generated_privatecatalogclient_searchcatalogs_async] diff --git a/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchcatalogs/AsyncSearchCatalogsPaged.java b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchcatalogs/AsyncSearchCatalogsPaged.java new file mode 100644 index 00000000..83ef240b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchcatalogs/AsyncSearchCatalogsPaged.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 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.privatecatalog.v1beta1.samples; + +// [START privatecatalog_v1beta1_generated_privatecatalogclient_searchcatalogs_paged_async] +import com.google.cloud.privatecatalog.v1beta1.Catalog; +import com.google.cloud.privatecatalog.v1beta1.PrivateCatalogClient; +import com.google.cloud.privatecatalog.v1beta1.SearchCatalogsRequest; +import com.google.cloud.privatecatalog.v1beta1.SearchCatalogsResponse; +import com.google.common.base.Strings; + +public class AsyncSearchCatalogsPaged { + + public static void main(String[] args) throws Exception { + asyncSearchCatalogsPaged(); + } + + public static void asyncSearchCatalogsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (PrivateCatalogClient privateCatalogClient = PrivateCatalogClient.create()) { + SearchCatalogsRequest request = + SearchCatalogsRequest.newBuilder() + .setResource("resource-341064690") + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + SearchCatalogsResponse response = + privateCatalogClient.searchCatalogsCallable().call(request); + for (Catalog element : response.getCatalogsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END privatecatalog_v1beta1_generated_privatecatalogclient_searchcatalogs_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchcatalogs/SyncSearchCatalogs.java b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchcatalogs/SyncSearchCatalogs.java new file mode 100644 index 00000000..48bb573d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchcatalogs/SyncSearchCatalogs.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 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.privatecatalog.v1beta1.samples; + +// [START privatecatalog_v1beta1_generated_privatecatalogclient_searchcatalogs_sync] +import com.google.cloud.privatecatalog.v1beta1.Catalog; +import com.google.cloud.privatecatalog.v1beta1.PrivateCatalogClient; +import com.google.cloud.privatecatalog.v1beta1.SearchCatalogsRequest; + +public class SyncSearchCatalogs { + + public static void main(String[] args) throws Exception { + syncSearchCatalogs(); + } + + public static void syncSearchCatalogs() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (PrivateCatalogClient privateCatalogClient = PrivateCatalogClient.create()) { + SearchCatalogsRequest request = + SearchCatalogsRequest.newBuilder() + .setResource("resource-341064690") + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Catalog element : privateCatalogClient.searchCatalogs(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privatecatalog_v1beta1_generated_privatecatalogclient_searchcatalogs_sync] diff --git a/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchproducts/AsyncSearchProducts.java b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchproducts/AsyncSearchProducts.java new file mode 100644 index 00000000..81e38b71 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchproducts/AsyncSearchProducts.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 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.privatecatalog.v1beta1.samples; + +// [START privatecatalog_v1beta1_generated_privatecatalogclient_searchproducts_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.privatecatalog.v1beta1.PrivateCatalogClient; +import com.google.cloud.privatecatalog.v1beta1.Product; +import com.google.cloud.privatecatalog.v1beta1.SearchProductsRequest; + +public class AsyncSearchProducts { + + public static void main(String[] args) throws Exception { + asyncSearchProducts(); + } + + public static void asyncSearchProducts() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (PrivateCatalogClient privateCatalogClient = PrivateCatalogClient.create()) { + SearchProductsRequest request = + SearchProductsRequest.newBuilder() + .setResource("resource-341064690") + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + privateCatalogClient.searchProductsPagedCallable().futureCall(request); + // Do something. + for (Product element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privatecatalog_v1beta1_generated_privatecatalogclient_searchproducts_async] diff --git a/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchproducts/AsyncSearchProductsPaged.java b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchproducts/AsyncSearchProductsPaged.java new file mode 100644 index 00000000..518887e4 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchproducts/AsyncSearchProductsPaged.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 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.privatecatalog.v1beta1.samples; + +// [START privatecatalog_v1beta1_generated_privatecatalogclient_searchproducts_paged_async] +import com.google.cloud.privatecatalog.v1beta1.PrivateCatalogClient; +import com.google.cloud.privatecatalog.v1beta1.Product; +import com.google.cloud.privatecatalog.v1beta1.SearchProductsRequest; +import com.google.cloud.privatecatalog.v1beta1.SearchProductsResponse; +import com.google.common.base.Strings; + +public class AsyncSearchProductsPaged { + + public static void main(String[] args) throws Exception { + asyncSearchProductsPaged(); + } + + public static void asyncSearchProductsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (PrivateCatalogClient privateCatalogClient = PrivateCatalogClient.create()) { + SearchProductsRequest request = + SearchProductsRequest.newBuilder() + .setResource("resource-341064690") + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + SearchProductsResponse response = + privateCatalogClient.searchProductsCallable().call(request); + for (Product element : response.getProductsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END privatecatalog_v1beta1_generated_privatecatalogclient_searchproducts_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchproducts/SyncSearchProducts.java b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchproducts/SyncSearchProducts.java new file mode 100644 index 00000000..dd4b2a6d --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchproducts/SyncSearchProducts.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 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.privatecatalog.v1beta1.samples; + +// [START privatecatalog_v1beta1_generated_privatecatalogclient_searchproducts_sync] +import com.google.cloud.privatecatalog.v1beta1.PrivateCatalogClient; +import com.google.cloud.privatecatalog.v1beta1.Product; +import com.google.cloud.privatecatalog.v1beta1.SearchProductsRequest; + +public class SyncSearchProducts { + + public static void main(String[] args) throws Exception { + syncSearchProducts(); + } + + public static void syncSearchProducts() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (PrivateCatalogClient privateCatalogClient = PrivateCatalogClient.create()) { + SearchProductsRequest request = + SearchProductsRequest.newBuilder() + .setResource("resource-341064690") + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Product element : privateCatalogClient.searchProducts(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privatecatalog_v1beta1_generated_privatecatalogclient_searchproducts_sync] diff --git a/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchversions/AsyncSearchVersions.java b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchversions/AsyncSearchVersions.java new file mode 100644 index 00000000..81c7ab1b --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchversions/AsyncSearchVersions.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 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.privatecatalog.v1beta1.samples; + +// [START privatecatalog_v1beta1_generated_privatecatalogclient_searchversions_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.privatecatalog.v1beta1.PrivateCatalogClient; +import com.google.cloud.privatecatalog.v1beta1.SearchVersionsRequest; +import com.google.cloud.privatecatalog.v1beta1.Version; + +public class AsyncSearchVersions { + + public static void main(String[] args) throws Exception { + asyncSearchVersions(); + } + + public static void asyncSearchVersions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (PrivateCatalogClient privateCatalogClient = PrivateCatalogClient.create()) { + SearchVersionsRequest request = + SearchVersionsRequest.newBuilder() + .setResource("resource-341064690") + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + privateCatalogClient.searchVersionsPagedCallable().futureCall(request); + // Do something. + for (Version element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privatecatalog_v1beta1_generated_privatecatalogclient_searchversions_async] diff --git a/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchversions/AsyncSearchVersionsPaged.java b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchversions/AsyncSearchVersionsPaged.java new file mode 100644 index 00000000..8ce7cb4f --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchversions/AsyncSearchVersionsPaged.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 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.privatecatalog.v1beta1.samples; + +// [START privatecatalog_v1beta1_generated_privatecatalogclient_searchversions_paged_async] +import com.google.cloud.privatecatalog.v1beta1.PrivateCatalogClient; +import com.google.cloud.privatecatalog.v1beta1.SearchVersionsRequest; +import com.google.cloud.privatecatalog.v1beta1.SearchVersionsResponse; +import com.google.cloud.privatecatalog.v1beta1.Version; +import com.google.common.base.Strings; + +public class AsyncSearchVersionsPaged { + + public static void main(String[] args) throws Exception { + asyncSearchVersionsPaged(); + } + + public static void asyncSearchVersionsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (PrivateCatalogClient privateCatalogClient = PrivateCatalogClient.create()) { + SearchVersionsRequest request = + SearchVersionsRequest.newBuilder() + .setResource("resource-341064690") + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + SearchVersionsResponse response = + privateCatalogClient.searchVersionsCallable().call(request); + for (Version element : response.getVersionsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END privatecatalog_v1beta1_generated_privatecatalogclient_searchversions_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchversions/SyncSearchVersions.java b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchversions/SyncSearchVersions.java new file mode 100644 index 00000000..dd294622 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogclient/searchversions/SyncSearchVersions.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 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.privatecatalog.v1beta1.samples; + +// [START privatecatalog_v1beta1_generated_privatecatalogclient_searchversions_sync] +import com.google.cloud.privatecatalog.v1beta1.PrivateCatalogClient; +import com.google.cloud.privatecatalog.v1beta1.SearchVersionsRequest; +import com.google.cloud.privatecatalog.v1beta1.Version; + +public class SyncSearchVersions { + + public static void main(String[] args) throws Exception { + syncSearchVersions(); + } + + public static void syncSearchVersions() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (PrivateCatalogClient privateCatalogClient = PrivateCatalogClient.create()) { + SearchVersionsRequest request = + SearchVersionsRequest.newBuilder() + .setResource("resource-341064690") + .setQuery("query107944136") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (Version element : privateCatalogClient.searchVersions(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END privatecatalog_v1beta1_generated_privatecatalogclient_searchversions_sync] diff --git a/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogsettings/searchcatalogs/SyncSearchCatalogs.java b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogsettings/searchcatalogs/SyncSearchCatalogs.java new file mode 100644 index 00000000..56f9b77e --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/privatecatalogsettings/searchcatalogs/SyncSearchCatalogs.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 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.privatecatalog.v1beta1.samples; + +// [START privatecatalog_v1beta1_generated_privatecatalogsettings_searchcatalogs_sync] +import com.google.cloud.privatecatalog.v1beta1.PrivateCatalogSettings; +import java.time.Duration; + +public class SyncSearchCatalogs { + + public static void main(String[] args) throws Exception { + syncSearchCatalogs(); + } + + public static void syncSearchCatalogs() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + PrivateCatalogSettings.Builder privateCatalogSettingsBuilder = + PrivateCatalogSettings.newBuilder(); + privateCatalogSettingsBuilder + .searchCatalogsSettings() + .setRetrySettings( + privateCatalogSettingsBuilder + .searchCatalogsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + PrivateCatalogSettings privateCatalogSettings = privateCatalogSettingsBuilder.build(); + } +} +// [END privatecatalog_v1beta1_generated_privatecatalogsettings_searchcatalogs_sync] diff --git a/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/stub/privatecatalogstubsettings/searchcatalogs/SyncSearchCatalogs.java b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/stub/privatecatalogstubsettings/searchcatalogs/SyncSearchCatalogs.java new file mode 100644 index 00000000..ab4f94c0 --- /dev/null +++ b/samples/snippets/generated/com/google/cloud/privatecatalog/v1beta1/stub/privatecatalogstubsettings/searchcatalogs/SyncSearchCatalogs.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 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.privatecatalog.v1beta1.stub.samples; + +// [START privatecatalog_v1beta1_generated_privatecatalogstubsettings_searchcatalogs_sync] +import com.google.cloud.privatecatalog.v1beta1.stub.PrivateCatalogStubSettings; +import java.time.Duration; + +public class SyncSearchCatalogs { + + public static void main(String[] args) throws Exception { + syncSearchCatalogs(); + } + + public static void syncSearchCatalogs() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + PrivateCatalogStubSettings.Builder privateCatalogSettingsBuilder = + PrivateCatalogStubSettings.newBuilder(); + privateCatalogSettingsBuilder + .searchCatalogsSettings() + .setRetrySettings( + privateCatalogSettingsBuilder + .searchCatalogsSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + PrivateCatalogStubSettings privateCatalogSettings = privateCatalogSettingsBuilder.build(); + } +} +// [END privatecatalog_v1beta1_generated_privatecatalogstubsettings_searchcatalogs_sync] From 85fd5457473de82b9342752b3e32be53f09ff8b9 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 24 Jun 2022 23:00:17 +0200 Subject: [PATCH 3/7] chore(deps): update dependency com.google.cloud:google-cloud-private-catalog to v0.4.1 (#194) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-private-catalog](https://togithub.com/googleapis/java-private-catalog) | `0.4.0` -> `0.4.1` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-private-catalog/0.4.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-private-catalog/0.4.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-private-catalog/0.4.1/compatibility-slim/0.4.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-private-catalog/0.4.1/confidence-slim/0.4.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-private-catalog). --- samples/install-without-bom/pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- samples/snippets/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 4aa16c96..2ac53d36 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -29,7 +29,7 @@ com.google.cloud google-cloud-private-catalog - 0.4.0 + 0.4.1 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 55c85702..bcbf6f2f 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-private-catalog - 0.4.0 + 0.4.1 diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 9e92dfd6..46188bd7 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-private-catalog - 0.4.0 + 0.4.1 From 3fb75259ae4db95a3acae701a5487e4cd6404e1d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 27 Jun 2022 19:20:57 +0000 Subject: [PATCH 4/7] chore: update dependencies for regapic (#1467) (#195) * chore: update dependencies for regapic * add more dependencies and trigger comment * update goldens * fix indentation * remove duplicate gax-httpjson dependency * remove duplicated dependencies Source-Link: https://github.com/googleapis/synthtool/commit/fa54eb2a78c6ee48613fd33152e2130e949dcbd9 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:1ec28a46062b19135b11178ceee60231e5f5a92dab454e23ae0aab72cd875906 --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/common.sh | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index a79f0627..f0625e4d 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest - digest: sha256:2567a120ce90fadb6201999b87d649d9f67459de28815ad239bce9ebfaa18a74 -# created: 2022-05-19T15:12:45.278246753Z + digest: sha256:1ec28a46062b19135b11178ceee60231e5f5a92dab454e23ae0aab72cd875906 +# created: 2022-06-27T15:01:06.405564326Z diff --git a/.kokoro/common.sh b/.kokoro/common.sh index ace89f45..f8f957af 100644 --- a/.kokoro/common.sh +++ b/.kokoro/common.sh @@ -55,4 +55,6 @@ function retry_with_backoff { ## Helper functionss function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; } function msg() { println "$*" >&2; } -function println() { printf '%s\n' "$(now) $*"; } \ No newline at end of file +function println() { printf '%s\n' "$(now) $*"; } + +## Helper comment to trigger updated repo dependency release \ No newline at end of file From 2bc1826c05ecc7efe8c5ed0613aaf2718c26be97 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 30 Jun 2022 02:14:30 +0000 Subject: [PATCH 5/7] chore: Disable CLIRR checks on releas (#1474) (#198) Source-Link: https://github.com/googleapis/synthtool/commit/7a220e27993a25ab3cda26510d5619d97b6952a9 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:6d4e3a15c62cfdcb823d60e16da7521e7c6fc00eba07c8ff12e4de9924a57d28 --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/release/stage.sh | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index f0625e4d..a454a61e 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest - digest: sha256:1ec28a46062b19135b11178ceee60231e5f5a92dab454e23ae0aab72cd875906 -# created: 2022-06-27T15:01:06.405564326Z + digest: sha256:6d4e3a15c62cfdcb823d60e16da7521e7c6fc00eba07c8ff12e4de9924a57d28 +# created: 2022-06-29T23:17:33.110417661Z diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh index 77dc4e8f..1dba8de1 100755 --- a/.kokoro/release/stage.sh +++ b/.kokoro/release/stage.sh @@ -32,6 +32,7 @@ retry_with_backoff 3 10 \ mvn clean deploy -B \ --settings ${MAVEN_SETTINGS_FILE} \ -DskipTests=true \ + -Dclirr.skip=true \ -DperformRelease=true \ -Dgpg.executable=gpg \ -Dgpg.passphrase=${GPG_PASSPHRASE} \ @@ -42,4 +43,4 @@ then mvn nexus-staging:release -B \ -DperformRelease=true \ --settings=settings.xml -fi \ No newline at end of file +fi From 40b0a9d3afcd49cc449983806453d01d6f2b5d2a Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Fri, 1 Jul 2022 11:54:11 -0400 Subject: [PATCH 6/7] ci: removing clirr from required checks (#196) Making CLIRR not required. The version bumps are now controlled by the Release Please and OwlBot. The CL authors create appropriate change description to control major version bumps. --- .github/sync-repo-settings.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index 6f09d695..dd5626f3 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -11,7 +11,6 @@ branchProtectionRules: - dependencies (8) - dependencies (11) - lint - - clirr - units (8) - units (11) - 'Kokoro - Test: Integration' @@ -26,7 +25,6 @@ branchProtectionRules: - dependencies (8) - dependencies (11) - lint - - clirr - units (7) - units (8) - units (11) From 051ba235c96a7bf9505271da9808c0a3fd1b0e51 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 1 Jul 2022 17:38:14 +0000 Subject: [PATCH 7/7] chore(main): release 0.4.0 (#193) :robot: I have created a release *beep* *boop* --- ## [0.4.0](https://github.com/googleapis/java-private-catalog/compare/v0.3.1...v0.4.0) (2022-07-01) ### Features * Enable REST transport for most of Java and Go clients ([#190](https://github.com/googleapis/java-private-catalog/issues/190)) ([ec64ba7](https://github.com/googleapis/java-private-catalog/commit/ec64ba7ff7ddce705204090f8df2060eee24955e)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- CHANGELOG.md | 7 +++++++ google-cloud-private-catalog-bom/pom.xml | 8 ++++---- google-cloud-private-catalog/pom.xml | 4 ++-- grpc-google-cloud-private-catalog-v1beta1/pom.xml | 4 ++-- pom.xml | 8 ++++---- proto-google-cloud-private-catalog-v1beta1/pom.xml | 4 ++-- versions.txt | 6 +++--- 7 files changed, 24 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d790ac07..bc9594ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.4.0](https://github.com/googleapis/java-private-catalog/compare/v0.3.1...v0.4.0) (2022-07-01) + + +### Features + +* Enable REST transport for most of Java and Go clients ([#190](https://github.com/googleapis/java-private-catalog/issues/190)) ([ec64ba7](https://github.com/googleapis/java-private-catalog/commit/ec64ba7ff7ddce705204090f8df2060eee24955e)) + ## [0.3.1](https://github.com/googleapis/java-private-catalog/compare/v0.3.0...v0.3.1) (2022-06-23) diff --git a/google-cloud-private-catalog-bom/pom.xml b/google-cloud-private-catalog-bom/pom.xml index c1025337..73f77891 100644 --- a/google-cloud-private-catalog-bom/pom.xml +++ b/google-cloud-private-catalog-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-private-catalog-bom - 0.4.2-SNAPSHOT + 0.5.0 pom com.google.cloud @@ -56,17 +56,17 @@ com.google.cloud google-cloud-private-catalog - 0.4.2-SNAPSHOT + 0.5.0 com.google.api.grpc grpc-google-cloud-private-catalog-v1beta1 - 0.4.2-SNAPSHOT + 0.5.0 com.google.api.grpc proto-google-cloud-private-catalog-v1beta1 - 0.4.2-SNAPSHOT + 0.5.0 diff --git a/google-cloud-private-catalog/pom.xml b/google-cloud-private-catalog/pom.xml index 96043fd6..e0de941c 100644 --- a/google-cloud-private-catalog/pom.xml +++ b/google-cloud-private-catalog/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-private-catalog - 0.4.2-SNAPSHOT + 0.5.0 jar Google Private Catalog https://github.com/googleapis/java-private-catalog @@ -11,7 +11,7 @@ com.google.cloud google-cloud-private-catalog-parent - 0.4.2-SNAPSHOT + 0.5.0 google-cloud-private-catalog diff --git a/grpc-google-cloud-private-catalog-v1beta1/pom.xml b/grpc-google-cloud-private-catalog-v1beta1/pom.xml index 671d0bc6..d9a499d1 100644 --- a/grpc-google-cloud-private-catalog-v1beta1/pom.xml +++ b/grpc-google-cloud-private-catalog-v1beta1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-private-catalog-v1beta1 - 0.4.2-SNAPSHOT + 0.5.0 grpc-google-cloud-private-catalog-v1beta1 GRPC library for google-cloud-private-catalog com.google.cloud google-cloud-private-catalog-parent - 0.4.2-SNAPSHOT + 0.5.0 diff --git a/pom.xml b/pom.xml index 7afe1fa1..ef387b06 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-private-catalog-parent pom - 0.4.2-SNAPSHOT + 0.5.0 Google Private Catalog Parent https://github.com/googleapis/java-private-catalog @@ -60,17 +60,17 @@ com.google.cloud google-cloud-private-catalog - 0.4.2-SNAPSHOT + 0.5.0 com.google.api.grpc grpc-google-cloud-private-catalog-v1beta1 - 0.4.2-SNAPSHOT + 0.5.0 com.google.api.grpc proto-google-cloud-private-catalog-v1beta1 - 0.4.2-SNAPSHOT + 0.5.0 diff --git a/proto-google-cloud-private-catalog-v1beta1/pom.xml b/proto-google-cloud-private-catalog-v1beta1/pom.xml index 107fc025..07c54b7e 100644 --- a/proto-google-cloud-private-catalog-v1beta1/pom.xml +++ b/proto-google-cloud-private-catalog-v1beta1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-private-catalog-v1beta1 - 0.4.2-SNAPSHOT + 0.5.0 proto-google-cloud-private-catalog-v1beta1 Proto library for google-cloud-private-catalog com.google.cloud google-cloud-private-catalog-parent - 0.4.2-SNAPSHOT + 0.5.0 diff --git a/versions.txt b/versions.txt index d5b74e66..4a8c9b53 100644 --- a/versions.txt +++ b/versions.txt @@ -1,6 +1,6 @@ # Format: # module:released-version:current-version -google-cloud-private-catalog:0.4.1:0.4.2-SNAPSHOT -grpc-google-cloud-private-catalog-v1beta1:0.4.1:0.4.2-SNAPSHOT -proto-google-cloud-private-catalog-v1beta1:0.4.1:0.4.2-SNAPSHOT +google-cloud-private-catalog:0.5.0:0.5.0 +grpc-google-cloud-private-catalog-v1beta1:0.5.0:0.5.0 +proto-google-cloud-private-catalog-v1beta1:0.5.0:0.5.0