Skip to content
This repository was archived by the owner on Sep 16, 2023. It is now read-only.

Commit c5aa248

Browse files
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
1 parent 04856dd commit c5aa248

File tree

229 files changed

+22362
-22269
lines changed

Some content is hidden

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

229 files changed

+22362
-22269
lines changed

grpc-google-cloud-data-fusion-v1/src/main/java/com/google/cloud/datafusion/v1/DataFusionGrpc.java

Lines changed: 0 additions & 1062 deletions
This file was deleted.

grpc-google-cloud-data-fusion-v1beta1/src/main/java/com/google/cloud/datafusion/v1beta1/DataFusionGrpc.java

Lines changed: 0 additions & 1807 deletions
This file was deleted.

google-cloud-data-fusion/src/main/java/com/google/cloud/datafusion/v1/DataFusionClient.java renamed to owl-bot-staging/v1/google-cloud-data-fusion/src/main/java/com/google/cloud/datafusion/v1/DataFusionClient.java

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.google.api.core.ApiFuture;
2020
import com.google.api.core.ApiFutures;
2121
import com.google.api.gax.core.BackgroundResource;
22+
import com.google.api.gax.httpjson.longrunning.OperationsClient;
2223
import com.google.api.gax.longrunning.OperationFuture;
2324
import com.google.api.gax.paging.AbstractFixedSizeCollection;
2425
import com.google.api.gax.paging.AbstractPage;
@@ -30,7 +31,6 @@
3031
import com.google.cloud.datafusion.v1.stub.DataFusionStubSettings;
3132
import com.google.common.util.concurrent.MoreExecutors;
3233
import com.google.longrunning.Operation;
33-
import com.google.longrunning.OperationsClient;
3434
import com.google.protobuf.Empty;
3535
import com.google.protobuf.FieldMask;
3636
import java.io.IOException;
@@ -65,13 +65,13 @@
6565
* methods:
6666
*
6767
* <ol>
68-
* <li>A "flattened" method. With this type of method, the fields of the request type have been
68+
* <li> A "flattened" method. With this type of method, the fields of the request type have been
6969
* converted into function parameters. It may be the case that not all fields are available as
7070
* parameters, and not every API method will have a flattened method entry point.
71-
* <li>A "request object" method. This type of method only takes one parameter, a request object,
71+
* <li> A "request object" method. This type of method only takes one parameter, a request object,
7272
* which must be constructed before the call. Not every API method will have a request object
7373
* method.
74-
* <li>A "callable" method. This type of method takes no parameters and returns an immutable API
74+
* <li> A "callable" method. This type of method takes no parameters and returns an immutable API
7575
* callable object, which can be used to initiate calls to the service.
7676
* </ol>
7777
*
@@ -106,13 +106,28 @@
106106
* DataFusionClient dataFusionClient = DataFusionClient.create(dataFusionSettings);
107107
* }</pre>
108108
*
109+
* <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
110+
* the wire:
111+
*
112+
* <pre>{@code
113+
* // This snippet has been automatically generated for illustrative purposes only.
114+
* // It may require modifications to work in your environment.
115+
* DataFusionSettings dataFusionSettings =
116+
* DataFusionSettings.newBuilder()
117+
* .setTransportChannelProvider(
118+
* DataFusionSettings.defaultHttpJsonTransportProviderBuilder().build())
119+
* .build();
120+
* DataFusionClient dataFusionClient = DataFusionClient.create(dataFusionSettings);
121+
* }</pre>
122+
*
109123
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
110124
*/
111125
@Generated("by gapic-generator-java")
112126
public class DataFusionClient implements BackgroundResource {
113127
private final DataFusionSettings settings;
114128
private final DataFusionStub stub;
115-
private final OperationsClient operationsClient;
129+
private final OperationsClient httpJsonOperationsClient;
130+
private final com.google.longrunning.OperationsClient operationsClient;
116131

117132
/** Constructs an instance of DataFusionClient with default settings. */
118133
public static final DataFusionClient create() throws IOException {
@@ -142,13 +157,17 @@ public static final DataFusionClient create(DataFusionStub stub) {
142157
protected DataFusionClient(DataFusionSettings settings) throws IOException {
143158
this.settings = settings;
144159
this.stub = ((DataFusionStubSettings) settings.getStubSettings()).createStub();
145-
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
160+
this.operationsClient =
161+
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
162+
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
146163
}
147164

148165
protected DataFusionClient(DataFusionStub stub) {
149166
this.settings = null;
150167
this.stub = stub;
151-
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
168+
this.operationsClient =
169+
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
170+
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
152171
}
153172

154173
public final DataFusionSettings getSettings() {
@@ -163,10 +182,18 @@ public DataFusionStub getStub() {
163182
* Returns the OperationsClient that can be used to query the status of a long-running operation
164183
* returned by another API method call.
165184
*/
166-
public final OperationsClient getOperationsClient() {
185+
public final com.google.longrunning.OperationsClient getOperationsClient() {
167186
return operationsClient;
168187
}
169188

189+
/**
190+
* Returns the OperationsClient that can be used to query the status of a long-running operation
191+
* returned by another API method call.
192+
*/
193+
public final OperationsClient getHttpJsonOperationsClient() {
194+
return httpJsonOperationsClient;
195+
}
196+
170197
// AUTO-GENERATED DOCUMENTATION AND METHOD.
171198
/**
172199
* Lists possible versions for Data Fusion instances in the specified project and location.
@@ -967,11 +994,8 @@ public boolean awaitTermination(long duration, TimeUnit unit) throws Interrupted
967994

968995
public static class ListAvailableVersionsPagedResponse
969996
extends AbstractPagedListResponse<
970-
ListAvailableVersionsRequest,
971-
ListAvailableVersionsResponse,
972-
Version,
973-
ListAvailableVersionsPage,
974-
ListAvailableVersionsFixedSizeCollection> {
997+
ListAvailableVersionsRequest, ListAvailableVersionsResponse, Version,
998+
ListAvailableVersionsPage, ListAvailableVersionsFixedSizeCollection> {
975999

9761000
public static ApiFuture<ListAvailableVersionsPagedResponse> createAsync(
9771001
PageContext<ListAvailableVersionsRequest, ListAvailableVersionsResponse, Version> context,
@@ -991,9 +1015,7 @@ private ListAvailableVersionsPagedResponse(ListAvailableVersionsPage page) {
9911015

9921016
public static class ListAvailableVersionsPage
9931017
extends AbstractPage<
994-
ListAvailableVersionsRequest,
995-
ListAvailableVersionsResponse,
996-
Version,
1018+
ListAvailableVersionsRequest, ListAvailableVersionsResponse, Version,
9971019
ListAvailableVersionsPage> {
9981020

9991021
private ListAvailableVersionsPage(
@@ -1023,11 +1045,8 @@ public ApiFuture<ListAvailableVersionsPage> createPageAsync(
10231045

10241046
public static class ListAvailableVersionsFixedSizeCollection
10251047
extends AbstractFixedSizeCollection<
1026-
ListAvailableVersionsRequest,
1027-
ListAvailableVersionsResponse,
1028-
Version,
1029-
ListAvailableVersionsPage,
1030-
ListAvailableVersionsFixedSizeCollection> {
1048+
ListAvailableVersionsRequest, ListAvailableVersionsResponse, Version,
1049+
ListAvailableVersionsPage, ListAvailableVersionsFixedSizeCollection> {
10311050

10321051
private ListAvailableVersionsFixedSizeCollection(
10331052
List<ListAvailableVersionsPage> pages, int collectionSize) {
@@ -1047,10 +1066,7 @@ protected ListAvailableVersionsFixedSizeCollection createCollection(
10471066

10481067
public static class ListInstancesPagedResponse
10491068
extends AbstractPagedListResponse<
1050-
ListInstancesRequest,
1051-
ListInstancesResponse,
1052-
Instance,
1053-
ListInstancesPage,
1069+
ListInstancesRequest, ListInstancesResponse, Instance, ListInstancesPage,
10541070
ListInstancesFixedSizeCollection> {
10551071

10561072
public static ApiFuture<ListInstancesPagedResponse> createAsync(
@@ -1100,10 +1116,7 @@ public ApiFuture<ListInstancesPage> createPageAsync(
11001116

11011117
public static class ListInstancesFixedSizeCollection
11021118
extends AbstractFixedSizeCollection<
1103-
ListInstancesRequest,
1104-
ListInstancesResponse,
1105-
Instance,
1106-
ListInstancesPage,
1119+
ListInstancesRequest, ListInstancesResponse, Instance, ListInstancesPage,
11071120
ListInstancesFixedSizeCollection> {
11081121

11091122
private ListInstancesFixedSizeCollection(List<ListInstancesPage> pages, int collectionSize) {

google-cloud-data-fusion/src/main/java/com/google/cloud/datafusion/v1/DataFusionSettings.java renamed to owl-bot-staging/v1/google-cloud-data-fusion/src/main/java/com/google/cloud/datafusion/v1/DataFusionSettings.java

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@
2424
import com.google.api.gax.core.GoogleCredentialsProvider;
2525
import com.google.api.gax.core.InstantiatingExecutorProvider;
2626
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
27+
import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
2728
import com.google.api.gax.rpc.ApiClientHeaderProvider;
2829
import com.google.api.gax.rpc.ClientContext;
2930
import com.google.api.gax.rpc.ClientSettings;
3031
import com.google.api.gax.rpc.OperationCallSettings;
3132
import com.google.api.gax.rpc.PagedCallSettings;
33+
import com.google.api.gax.rpc.StubSettings;
3234
import com.google.api.gax.rpc.TransportChannelProvider;
3335
import com.google.api.gax.rpc.UnaryCallSettings;
3436
import com.google.cloud.datafusion.v1.stub.DataFusionStubSettings;
@@ -45,9 +47,9 @@
4547
* <p>The default instance has everything set to sensible defaults:
4648
*
4749
* <ul>
48-
* <li>The default service address (datafusion.googleapis.com) and default port (443) are used.
49-
* <li>Credentials are acquired automatically through Application Default Credentials.
50-
* <li>Retries are configured for idempotent methods but not for non-idempotent methods.
50+
* <li> The default service address (datafusion.googleapis.com) and default port (443) are used.
51+
* <li> Credentials are acquired automatically through Application Default Credentials.
52+
* <li> Retries are configured for idempotent methods but not for non-idempotent methods.
5153
* </ul>
5254
*
5355
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
@@ -76,8 +78,7 @@ public class DataFusionSettings extends ClientSettings<DataFusionSettings> {
7678

7779
/** Returns the object with the settings used for calls to listAvailableVersions. */
7880
public PagedCallSettings<
79-
ListAvailableVersionsRequest,
80-
ListAvailableVersionsResponse,
81+
ListAvailableVersionsRequest, ListAvailableVersionsResponse,
8182
ListAvailableVersionsPagedResponse>
8283
listAvailableVersionsSettings() {
8384
return ((DataFusionStubSettings) getStubSettings()).listAvailableVersionsSettings();
@@ -162,11 +163,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
162163
return DataFusionStubSettings.defaultCredentialsProviderBuilder();
163164
}
164165

165-
/** Returns a builder for the default ChannelProvider for this service. */
166+
/** Returns a builder for the default gRPC ChannelProvider for this service. */
166167
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
167168
return DataFusionStubSettings.defaultGrpcTransportProviderBuilder();
168169
}
169170

171+
/** Returns a builder for the default REST ChannelProvider for this service. */
172+
@BetaApi
173+
public static InstantiatingHttpJsonChannelProvider.Builder
174+
defaultHttpJsonTransportProviderBuilder() {
175+
return DataFusionStubSettings.defaultHttpJsonTransportProviderBuilder();
176+
}
177+
170178
public static TransportChannelProvider defaultTransportChannelProvider() {
171179
return DataFusionStubSettings.defaultTransportChannelProvider();
172180
}
@@ -176,11 +184,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
176184
return DataFusionStubSettings.defaultApiClientHeaderProviderBuilder();
177185
}
178186

179-
/** Returns a new builder for this class. */
187+
/** Returns a new gRPC builder for this class. */
180188
public static Builder newBuilder() {
181189
return Builder.createDefault();
182190
}
183191

192+
/** Returns a new REST builder for this class. */
193+
@BetaApi
194+
public static Builder newHttpJsonBuilder() {
195+
return Builder.createHttpJsonDefault();
196+
}
197+
184198
/** Returns a new builder for this class. */
185199
public static Builder newBuilder(ClientContext clientContext) {
186200
return new Builder(clientContext);
@@ -218,6 +232,11 @@ private static Builder createDefault() {
218232
return new Builder(DataFusionStubSettings.newBuilder());
219233
}
220234

235+
@BetaApi
236+
private static Builder createHttpJsonDefault() {
237+
return new Builder(DataFusionStubSettings.newHttpJsonBuilder());
238+
}
239+
221240
public DataFusionStubSettings.Builder getStubSettingsBuilder() {
222241
return ((DataFusionStubSettings.Builder) getStubSettings());
223242
}
@@ -236,8 +255,7 @@ public Builder applyToAllUnaryMethods(
236255

237256
/** Returns the builder for the settings used for calls to listAvailableVersions. */
238257
public PagedCallSettings.Builder<
239-
ListAvailableVersionsRequest,
240-
ListAvailableVersionsResponse,
258+
ListAvailableVersionsRequest, ListAvailableVersionsResponse,
241259
ListAvailableVersionsPagedResponse>
242260
listAvailableVersionsSettings() {
243261
return getStubSettingsBuilder().listAvailableVersionsSettings();

google-cloud-data-fusion/src/main/java/com/google/cloud/datafusion/v1/stub/DataFusionStub.java renamed to owl-bot-staging/v1/google-cloud-data-fusion/src/main/java/com/google/cloud/datafusion/v1/stub/DataFusionStub.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@
4848
public abstract class DataFusionStub implements BackgroundResource {
4949

5050
public OperationsStub getOperationsStub() {
51-
throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
51+
return null;
52+
}
53+
54+
public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() {
55+
return null;
5256
}
5357

5458
public UnaryCallable<ListAvailableVersionsRequest, ListAvailableVersionsPagedResponse>

0 commit comments

Comments
 (0)