Skip to content

Commit 45c0a15

Browse files
fix: update gapic-generator-java with mock service generation fixes (#306)
* feat: Enable REST transport for most of Java and Go clients PiperOrigin-RevId: 456641589 Source-Link: googleapis/googleapis@8a251f5 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 * Update pom.xml * fix: update gapic-generator-java with mock service generation fixes PiperOrigin-RevId: 457524730 Source-Link: googleapis/googleapis@917e7f2 Source-Link: https://github.com/googleapis/googleapis-gen/commit/2497f9a069d3f6b2d6810d5a4e239cda1e7e5a39 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjQ5N2Y5YTA2OWQzZjZiMmQ2ODEwZDVhNGUyMzljZGExZTdlNWEzOSJ9 * 🦉 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 <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Neenu Shaji <[email protected]>
1 parent cd43cae commit 45c0a15

153 files changed

Lines changed: 12151 additions & 11 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

java-contact-center-insights/google-cloud-contact-center-insights/pom.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858
<groupId>com.google.api</groupId>
5959
<artifactId>gax-grpc</artifactId>
6060
</dependency>
61+
<dependency>
62+
<groupId>com.google.api</groupId>
63+
<artifactId>gax-httpjson</artifactId>
64+
</dependency>
6165
<dependency>
6266
<groupId>org.threeten</groupId>
6367
<artifactId>threetenbp</artifactId>
@@ -77,12 +81,24 @@
7781
<scope>test</scope>
7882
</dependency>
7983
<!-- Need testing utility classes for generated gRPC clients tests -->
84+
<dependency>
85+
<groupId>com.google.api</groupId>
86+
<artifactId>gax</artifactId>
87+
<classifier>testlib</classifier>
88+
<scope>test</scope>
89+
</dependency>
8090
<dependency>
8191
<groupId>com.google.api</groupId>
8292
<artifactId>gax-grpc</artifactId>
8393
<classifier>testlib</classifier>
8494
<scope>test</scope>
8595
</dependency>
96+
<dependency>
97+
<groupId>com.google.api</groupId>
98+
<artifactId>gax-httpjson</artifactId>
99+
<classifier>testlib</classifier>
100+
<scope>test</scope>
101+
</dependency>
86102
</dependencies>
87103

88104
<profiles>

java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/ContactCenterInsightsClient.java

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818

1919
import com.google.api.core.ApiFuture;
2020
import com.google.api.core.ApiFutures;
21+
import com.google.api.core.BetaApi;
2122
import com.google.api.gax.core.BackgroundResource;
23+
import com.google.api.gax.httpjson.longrunning.OperationsClient;
2224
import com.google.api.gax.longrunning.OperationFuture;
2325
import com.google.api.gax.paging.AbstractFixedSizeCollection;
2426
import com.google.api.gax.paging.AbstractPage;
@@ -30,7 +32,6 @@
3032
import com.google.cloud.contactcenterinsights.v1.stub.ContactCenterInsightsStubSettings;
3133
import com.google.common.util.concurrent.MoreExecutors;
3234
import com.google.longrunning.Operation;
33-
import com.google.longrunning.OperationsClient;
3435
import com.google.protobuf.Empty;
3536
import com.google.protobuf.FieldMask;
3637
import java.io.IOException;
@@ -109,13 +110,29 @@
109110
* ContactCenterInsightsClient.create(contactCenterInsightsSettings);
110111
* }</pre>
111112
*
113+
* <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
114+
* the wire:
115+
*
116+
* <pre>{@code
117+
* // This snippet has been automatically generated for illustrative purposes only.
118+
* // It may require modifications to work in your environment.
119+
* ContactCenterInsightsSettings contactCenterInsightsSettings =
120+
* ContactCenterInsightsSettings.newBuilder()
121+
* .setTransportChannelProvider(
122+
* ContactCenterInsightsSettings.defaultHttpJsonTransportProviderBuilder().build())
123+
* .build();
124+
* ContactCenterInsightsClient contactCenterInsightsClient =
125+
* ContactCenterInsightsClient.create(contactCenterInsightsSettings);
126+
* }</pre>
127+
*
112128
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
113129
*/
114130
@Generated("by gapic-generator-java")
115131
public class ContactCenterInsightsClient implements BackgroundResource {
116132
private final ContactCenterInsightsSettings settings;
117133
private final ContactCenterInsightsStub stub;
118-
private final OperationsClient operationsClient;
134+
private final OperationsClient httpJsonOperationsClient;
135+
private final com.google.longrunning.OperationsClient operationsClient;
119136

120137
/** Constructs an instance of ContactCenterInsightsClient with default settings. */
121138
public static final ContactCenterInsightsClient create() throws IOException {
@@ -147,13 +164,17 @@ public static final ContactCenterInsightsClient create(ContactCenterInsightsStub
147164
protected ContactCenterInsightsClient(ContactCenterInsightsSettings settings) throws IOException {
148165
this.settings = settings;
149166
this.stub = ((ContactCenterInsightsStubSettings) settings.getStubSettings()).createStub();
150-
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
167+
this.operationsClient =
168+
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
169+
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
151170
}
152171

153172
protected ContactCenterInsightsClient(ContactCenterInsightsStub stub) {
154173
this.settings = null;
155174
this.stub = stub;
156-
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
175+
this.operationsClient =
176+
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
177+
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
157178
}
158179

159180
public final ContactCenterInsightsSettings getSettings() {
@@ -168,10 +189,19 @@ public ContactCenterInsightsStub getStub() {
168189
* Returns the OperationsClient that can be used to query the status of a long-running operation
169190
* returned by another API method call.
170191
*/
171-
public final OperationsClient getOperationsClient() {
192+
public final com.google.longrunning.OperationsClient getOperationsClient() {
172193
return operationsClient;
173194
}
174195

196+
/**
197+
* Returns the OperationsClient that can be used to query the status of a long-running operation
198+
* returned by another API method call.
199+
*/
200+
@BetaApi
201+
public final OperationsClient getHttpJsonOperationsClient() {
202+
return httpJsonOperationsClient;
203+
}
204+
175205
// AUTO-GENERATED DOCUMENTATION AND METHOD.
176206
/**
177207
* Creates a conversation.

java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/ContactCenterInsightsSettings.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.google.api.gax.core.GoogleCredentialsProvider;
2727
import com.google.api.gax.core.InstantiatingExecutorProvider;
2828
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
29+
import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
2930
import com.google.api.gax.rpc.ApiClientHeaderProvider;
3031
import com.google.api.gax.rpc.ClientContext;
3132
import com.google.api.gax.rpc.ClientSettings;
@@ -330,11 +331,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
330331
return ContactCenterInsightsStubSettings.defaultCredentialsProviderBuilder();
331332
}
332333

333-
/** Returns a builder for the default ChannelProvider for this service. */
334+
/** Returns a builder for the default gRPC ChannelProvider for this service. */
334335
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
335336
return ContactCenterInsightsStubSettings.defaultGrpcTransportProviderBuilder();
336337
}
337338

339+
/** Returns a builder for the default REST ChannelProvider for this service. */
340+
@BetaApi
341+
public static InstantiatingHttpJsonChannelProvider.Builder
342+
defaultHttpJsonTransportProviderBuilder() {
343+
return ContactCenterInsightsStubSettings.defaultHttpJsonTransportProviderBuilder();
344+
}
345+
338346
public static TransportChannelProvider defaultTransportChannelProvider() {
339347
return ContactCenterInsightsStubSettings.defaultTransportChannelProvider();
340348
}
@@ -344,11 +352,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
344352
return ContactCenterInsightsStubSettings.defaultApiClientHeaderProviderBuilder();
345353
}
346354

347-
/** Returns a new builder for this class. */
355+
/** Returns a new gRPC builder for this class. */
348356
public static Builder newBuilder() {
349357
return Builder.createDefault();
350358
}
351359

360+
/** Returns a new REST builder for this class. */
361+
@BetaApi
362+
public static Builder newHttpJsonBuilder() {
363+
return Builder.createHttpJsonDefault();
364+
}
365+
352366
/** Returns a new builder for this class. */
353367
public static Builder newBuilder(ClientContext clientContext) {
354368
return new Builder(clientContext);
@@ -387,6 +401,11 @@ private static Builder createDefault() {
387401
return new Builder(ContactCenterInsightsStubSettings.newBuilder());
388402
}
389403

404+
@BetaApi
405+
private static Builder createHttpJsonDefault() {
406+
return new Builder(ContactCenterInsightsStubSettings.newHttpJsonBuilder());
407+
}
408+
390409
public ContactCenterInsightsStubSettings.Builder getStubSettingsBuilder() {
391410
return ((ContactCenterInsightsStubSettings.Builder) getStubSettings());
392411
}

java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/stub/ContactCenterInsightsStub.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,11 @@
9797
public abstract class ContactCenterInsightsStub implements BackgroundResource {
9898

9999
public OperationsStub getOperationsStub() {
100-
throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
100+
return null;
101+
}
102+
103+
public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() {
104+
return null;
101105
}
102106

103107
public UnaryCallable<CreateConversationRequest, Conversation> createConversationCallable() {

java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/stub/ContactCenterInsightsStubSettings.java

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
import com.google.api.gax.grpc.GrpcTransportChannel;
3232
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
3333
import com.google.api.gax.grpc.ProtoOperationTransformers;
34+
import com.google.api.gax.httpjson.GaxHttpJsonProperties;
35+
import com.google.api.gax.httpjson.HttpJsonTransportChannel;
36+
import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
3437
import com.google.api.gax.longrunning.OperationSnapshot;
3538
import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
3639
import com.google.api.gax.retrying.RetrySettings;
@@ -677,6 +680,11 @@ public ContactCenterInsightsStub createStub() throws IOException {
677680
.equals(GrpcTransportChannel.getGrpcTransportName())) {
678681
return GrpcContactCenterInsightsStub.create(this);
679682
}
683+
if (getTransportChannelProvider()
684+
.getTransportName()
685+
.equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
686+
return HttpJsonContactCenterInsightsStub.create(this);
687+
}
680688
throw new UnsupportedOperationException(
681689
String.format(
682690
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
@@ -709,30 +717,56 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
709717
.setUseJwtAccessWithScope(true);
710718
}
711719

712-
/** Returns a builder for the default ChannelProvider for this service. */
720+
/** Returns a builder for the default gRPC ChannelProvider for this service. */
713721
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
714722
return InstantiatingGrpcChannelProvider.newBuilder()
715723
.setMaxInboundMessageSize(Integer.MAX_VALUE);
716724
}
717725

726+
/** Returns a builder for the default REST ChannelProvider for this service. */
727+
@BetaApi
728+
public static InstantiatingHttpJsonChannelProvider.Builder
729+
defaultHttpJsonTransportProviderBuilder() {
730+
return InstantiatingHttpJsonChannelProvider.newBuilder();
731+
}
732+
718733
public static TransportChannelProvider defaultTransportChannelProvider() {
719734
return defaultGrpcTransportProviderBuilder().build();
720735
}
721736

722737
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
723-
public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
738+
public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() {
724739
return ApiClientHeaderProvider.newBuilder()
725740
.setGeneratedLibToken(
726741
"gapic", GaxProperties.getLibraryVersion(ContactCenterInsightsStubSettings.class))
727742
.setTransportToken(
728743
GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
729744
}
730745

731-
/** Returns a new builder for this class. */
746+
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
747+
public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() {
748+
return ApiClientHeaderProvider.newBuilder()
749+
.setGeneratedLibToken(
750+
"gapic", GaxProperties.getLibraryVersion(ContactCenterInsightsStubSettings.class))
751+
.setTransportToken(
752+
GaxHttpJsonProperties.getHttpJsonTokenName(),
753+
GaxHttpJsonProperties.getHttpJsonVersion());
754+
}
755+
756+
public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
757+
return ContactCenterInsightsStubSettings.defaultGrpcApiClientHeaderProviderBuilder();
758+
}
759+
760+
/** Returns a new gRPC builder for this class. */
732761
public static Builder newBuilder() {
733762
return Builder.createDefault();
734763
}
735764

765+
/** Returns a new REST builder for this class. */
766+
public static Builder newHttpJsonBuilder() {
767+
return Builder.createHttpJsonDefault();
768+
}
769+
736770
/** Returns a new builder for this class. */
737771
public static Builder newBuilder(ClientContext clientContext) {
738772
return new Builder(clientContext);
@@ -1089,6 +1123,19 @@ private static Builder createDefault() {
10891123
return initDefaults(builder);
10901124
}
10911125

1126+
private static Builder createHttpJsonDefault() {
1127+
Builder builder = new Builder(((ClientContext) null));
1128+
1129+
builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
1130+
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
1131+
builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
1132+
builder.setEndpoint(getDefaultEndpoint());
1133+
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
1134+
builder.setSwitchToMtlsEndpointAllowed(true);
1135+
1136+
return initDefaults(builder);
1137+
}
1138+
10921139
private static Builder initDefaults(Builder builder) {
10931140
builder
10941141
.createConversationSettings()

0 commit comments

Comments
 (0)