Skip to content

Commit 627df71

Browse files
chore: update gapic-generator-java (googleapis#183)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 454939894 Source-Link: googleapis/googleapis@519ca44 Source-Link: https://github.com/googleapis/googleapis-gen/commit/fc639d21a7cbc30aa0a9b862586942a0fb46c5c8 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZmM2MzlkMjFhN2NiYzMwYWEwYTliODYyNTg2OTQyYTBmYjQ2YzVjOCJ9 feat: Add Java REST transport to analytics, servicecontrol, servicemanagement, serviceusage and langauge APIs PiperOrigin-RevId: 454254635 Source-Link: googleapis/googleapis@84fb822 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4ffb61264d6fb634c430829dd2da75c5bed08304 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGZmYjYxMjY0ZDZmYjYzNGM0MzA4MjlkZDJkYTc1YzViZWQwODMwNCJ9
1 parent a93799a commit 627df71

19 files changed

Lines changed: 1777 additions & 15 deletions

java-service-control/google-cloud-service-control/pom.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@
6262
<groupId>com.google.api</groupId>
6363
<artifactId>gax-grpc</artifactId>
6464
</dependency>
65+
<dependency>
66+
<groupId>com.google.api</groupId>
67+
<artifactId>gax-httpjson</artifactId>
68+
</dependency>
6569
<dependency>
6670
<groupId>org.threeten</groupId>
6771
<artifactId>threetenbp</artifactId>
@@ -86,12 +90,24 @@
8690
<scope>test</scope>
8791
</dependency>
8892
<!-- Need testing utility classes for generated gRPC clients tests -->
93+
<dependency>
94+
<groupId>com.google.api</groupId>
95+
<artifactId>gax</artifactId>
96+
<classifier>testlib</classifier>
97+
<scope>test</scope>
98+
</dependency>
8999
<dependency>
90100
<groupId>com.google.api</groupId>
91101
<artifactId>gax-grpc</artifactId>
92102
<classifier>testlib</classifier>
93103
<scope>test</scope>
94104
</dependency>
105+
<dependency>
106+
<groupId>com.google.api</groupId>
107+
<artifactId>gax-httpjson</artifactId>
108+
<classifier>testlib</classifier>
109+
<scope>test</scope>
110+
</dependency>
95111
</dependencies>
96112

97113
<profiles>

java-service-control/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v1/QuotaControllerClient.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,21 @@
9999
* QuotaControllerClient.create(quotaControllerSettings);
100100
* }</pre>
101101
*
102+
* <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
103+
* the wire:
104+
*
105+
* <pre>{@code
106+
* // This snippet has been automatically generated for illustrative purposes only.
107+
* // It may require modifications to work in your environment.
108+
* QuotaControllerSettings quotaControllerSettings =
109+
* QuotaControllerSettings.newBuilder()
110+
* .setTransportChannelProvider(
111+
* QuotaControllerSettings.defaultHttpJsonTransportProviderBuilder().build())
112+
* .build();
113+
* QuotaControllerClient quotaControllerClient =
114+
* QuotaControllerClient.create(quotaControllerSettings);
115+
* }</pre>
116+
*
102117
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
103118
*/
104119
@Generated("by gapic-generator-java")

java-service-control/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v1/QuotaControllerSettings.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.google.api.gax.core.GoogleCredentialsProvider;
2222
import com.google.api.gax.core.InstantiatingExecutorProvider;
2323
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
24+
import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
2425
import com.google.api.gax.rpc.ApiClientHeaderProvider;
2526
import com.google.api.gax.rpc.ClientContext;
2627
import com.google.api.gax.rpc.ClientSettings;
@@ -99,11 +100,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
99100
return QuotaControllerStubSettings.defaultCredentialsProviderBuilder();
100101
}
101102

102-
/** Returns a builder for the default ChannelProvider for this service. */
103+
/** Returns a builder for the default gRPC ChannelProvider for this service. */
103104
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
104105
return QuotaControllerStubSettings.defaultGrpcTransportProviderBuilder();
105106
}
106107

108+
/** Returns a builder for the default REST ChannelProvider for this service. */
109+
@BetaApi
110+
public static InstantiatingHttpJsonChannelProvider.Builder
111+
defaultHttpJsonTransportProviderBuilder() {
112+
return QuotaControllerStubSettings.defaultHttpJsonTransportProviderBuilder();
113+
}
114+
107115
public static TransportChannelProvider defaultTransportChannelProvider() {
108116
return QuotaControllerStubSettings.defaultTransportChannelProvider();
109117
}
@@ -113,11 +121,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
113121
return QuotaControllerStubSettings.defaultApiClientHeaderProviderBuilder();
114122
}
115123

116-
/** Returns a new builder for this class. */
124+
/** Returns a new gRPC builder for this class. */
117125
public static Builder newBuilder() {
118126
return Builder.createDefault();
119127
}
120128

129+
/** Returns a new REST builder for this class. */
130+
@BetaApi
131+
public static Builder newHttpJsonBuilder() {
132+
return Builder.createHttpJsonDefault();
133+
}
134+
121135
/** Returns a new builder for this class. */
122136
public static Builder newBuilder(ClientContext clientContext) {
123137
return new Builder(clientContext);
@@ -155,6 +169,11 @@ private static Builder createDefault() {
155169
return new Builder(QuotaControllerStubSettings.newBuilder());
156170
}
157171

172+
@BetaApi
173+
private static Builder createHttpJsonDefault() {
174+
return new Builder(QuotaControllerStubSettings.newHttpJsonBuilder());
175+
}
176+
158177
public QuotaControllerStubSettings.Builder getStubSettingsBuilder() {
159178
return ((QuotaControllerStubSettings.Builder) getStubSettings());
160179
}

java-service-control/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v1/ServiceControllerClient.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,21 @@
9999
* ServiceControllerClient.create(serviceControllerSettings);
100100
* }</pre>
101101
*
102+
* <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
103+
* the wire:
104+
*
105+
* <pre>{@code
106+
* // This snippet has been automatically generated for illustrative purposes only.
107+
* // It may require modifications to work in your environment.
108+
* ServiceControllerSettings serviceControllerSettings =
109+
* ServiceControllerSettings.newBuilder()
110+
* .setTransportChannelProvider(
111+
* ServiceControllerSettings.defaultHttpJsonTransportProviderBuilder().build())
112+
* .build();
113+
* ServiceControllerClient serviceControllerClient =
114+
* ServiceControllerClient.create(serviceControllerSettings);
115+
* }</pre>
116+
*
102117
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
103118
*/
104119
@Generated("by gapic-generator-java")

java-service-control/google-cloud-service-control/src/main/java/com/google/api/servicecontrol/v1/ServiceControllerSettings.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.google.api.gax.core.GoogleCredentialsProvider;
2222
import com.google.api.gax.core.InstantiatingExecutorProvider;
2323
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
24+
import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
2425
import com.google.api.gax.rpc.ApiClientHeaderProvider;
2526
import com.google.api.gax.rpc.ClientContext;
2627
import com.google.api.gax.rpc.ClientSettings;
@@ -104,11 +105,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
104105
return ServiceControllerStubSettings.defaultCredentialsProviderBuilder();
105106
}
106107

107-
/** Returns a builder for the default ChannelProvider for this service. */
108+
/** Returns a builder for the default gRPC ChannelProvider for this service. */
108109
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
109110
return ServiceControllerStubSettings.defaultGrpcTransportProviderBuilder();
110111
}
111112

113+
/** Returns a builder for the default REST ChannelProvider for this service. */
114+
@BetaApi
115+
public static InstantiatingHttpJsonChannelProvider.Builder
116+
defaultHttpJsonTransportProviderBuilder() {
117+
return ServiceControllerStubSettings.defaultHttpJsonTransportProviderBuilder();
118+
}
119+
112120
public static TransportChannelProvider defaultTransportChannelProvider() {
113121
return ServiceControllerStubSettings.defaultTransportChannelProvider();
114122
}
@@ -118,11 +126,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
118126
return ServiceControllerStubSettings.defaultApiClientHeaderProviderBuilder();
119127
}
120128

121-
/** Returns a new builder for this class. */
129+
/** Returns a new gRPC builder for this class. */
122130
public static Builder newBuilder() {
123131
return Builder.createDefault();
124132
}
125133

134+
/** Returns a new REST builder for this class. */
135+
@BetaApi
136+
public static Builder newHttpJsonBuilder() {
137+
return Builder.createHttpJsonDefault();
138+
}
139+
126140
/** Returns a new builder for this class. */
127141
public static Builder newBuilder(ClientContext clientContext) {
128142
return new Builder(clientContext);
@@ -160,6 +174,11 @@ private static Builder createDefault() {
160174
return new Builder(ServiceControllerStubSettings.newBuilder());
161175
}
162176

177+
@BetaApi
178+
private static Builder createHttpJsonDefault() {
179+
return new Builder(ServiceControllerStubSettings.newHttpJsonBuilder());
180+
}
181+
163182
public ServiceControllerStubSettings.Builder getStubSettingsBuilder() {
164183
return ((ServiceControllerStubSettings.Builder) getStubSettings());
165184
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.api.servicecontrol.v1.stub;
18+
19+
import com.google.api.core.BetaApi;
20+
import com.google.api.gax.httpjson.HttpJsonCallSettings;
21+
import com.google.api.gax.httpjson.HttpJsonCallableFactory;
22+
import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
23+
import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
24+
import com.google.api.gax.httpjson.longrunning.stub.OperationsStub;
25+
import com.google.api.gax.rpc.BatchingCallSettings;
26+
import com.google.api.gax.rpc.ClientContext;
27+
import com.google.api.gax.rpc.OperationCallSettings;
28+
import com.google.api.gax.rpc.OperationCallable;
29+
import com.google.api.gax.rpc.PagedCallSettings;
30+
import com.google.api.gax.rpc.ServerStreamingCallSettings;
31+
import com.google.api.gax.rpc.ServerStreamingCallable;
32+
import com.google.api.gax.rpc.UnaryCallSettings;
33+
import com.google.api.gax.rpc.UnaryCallable;
34+
import com.google.longrunning.Operation;
35+
import javax.annotation.Generated;
36+
37+
// AUTO-GENERATED DOCUMENTATION AND CLASS.
38+
/**
39+
* REST callable factory implementation for the QuotaController service API.
40+
*
41+
* <p>This class is for advanced usage.
42+
*/
43+
@Generated("by gapic-generator-java")
44+
@BetaApi
45+
public class HttpJsonQuotaControllerCallableFactory
46+
implements HttpJsonStubCallableFactory<Operation, OperationsStub> {
47+
48+
@Override
49+
public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createUnaryCallable(
50+
HttpJsonCallSettings<RequestT, ResponseT> httpJsonCallSettings,
51+
UnaryCallSettings<RequestT, ResponseT> callSettings,
52+
ClientContext clientContext) {
53+
return HttpJsonCallableFactory.createUnaryCallable(
54+
httpJsonCallSettings, callSettings, clientContext);
55+
}
56+
57+
@Override
58+
public <RequestT, ResponseT, PagedListResponseT>
59+
UnaryCallable<RequestT, PagedListResponseT> createPagedCallable(
60+
HttpJsonCallSettings<RequestT, ResponseT> httpJsonCallSettings,
61+
PagedCallSettings<RequestT, ResponseT, PagedListResponseT> callSettings,
62+
ClientContext clientContext) {
63+
return HttpJsonCallableFactory.createPagedCallable(
64+
httpJsonCallSettings, callSettings, clientContext);
65+
}
66+
67+
@Override
68+
public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCallable(
69+
HttpJsonCallSettings<RequestT, ResponseT> httpJsonCallSettings,
70+
BatchingCallSettings<RequestT, ResponseT> callSettings,
71+
ClientContext clientContext) {
72+
return HttpJsonCallableFactory.createBatchingCallable(
73+
httpJsonCallSettings, callSettings, clientContext);
74+
}
75+
76+
@BetaApi(
77+
"The surface for long-running operations is not stable yet and may change in the future.")
78+
@Override
79+
public <RequestT, ResponseT, MetadataT>
80+
OperationCallable<RequestT, ResponseT, MetadataT> createOperationCallable(
81+
HttpJsonCallSettings<RequestT, Operation> httpJsonCallSettings,
82+
OperationCallSettings<RequestT, ResponseT, MetadataT> callSettings,
83+
ClientContext clientContext,
84+
OperationsStub operationsStub) {
85+
UnaryCallable<RequestT, Operation> innerCallable =
86+
HttpJsonCallableFactory.createBaseUnaryCallable(
87+
httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext);
88+
HttpJsonOperationSnapshotCallable<RequestT, Operation> initialCallable =
89+
new HttpJsonOperationSnapshotCallable<RequestT, Operation>(
90+
innerCallable,
91+
httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory());
92+
return HttpJsonCallableFactory.createOperationCallable(
93+
callSettings, clientContext, operationsStub.longRunningClient(), initialCallable);
94+
}
95+
96+
@Override
97+
public <RequestT, ResponseT>
98+
ServerStreamingCallable<RequestT, ResponseT> createServerStreamingCallable(
99+
HttpJsonCallSettings<RequestT, ResponseT> httpJsonCallSettings,
100+
ServerStreamingCallSettings<RequestT, ResponseT> callSettings,
101+
ClientContext clientContext) {
102+
return HttpJsonCallableFactory.createServerStreamingCallable(
103+
httpJsonCallSettings, callSettings, clientContext);
104+
}
105+
}

0 commit comments

Comments
 (0)