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

Commit

Permalink
feat: Enable REST transport for most of Java and Go clients
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 456641589

Source-Link: googleapis/googleapis@8a251f5

Source-Link: googleapis/googleapis-gen@4ca52a5
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGNhNTJhNTI5Y2YwMTMwOGQ5NzE0OTUwZWRmZmJlYTM1NjBjZmJkYiJ9
  • Loading branch information
gcf-owl-bot[bot] committed Jun 23, 2022
1 parent 04856dd commit 70a4e35
Show file tree
Hide file tree
Showing 229 changed files with 22,362 additions and 22,269 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.httpjson.longrunning.OperationsClient;
import com.google.api.gax.longrunning.OperationFuture;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
Expand All @@ -30,7 +31,6 @@
import com.google.cloud.datafusion.v1.stub.DataFusionStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.longrunning.Operation;
import com.google.longrunning.OperationsClient;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import java.io.IOException;
Expand Down Expand Up @@ -65,13 +65,13 @@
* methods:
*
* <ol>
* <li>A "flattened" method. With this type of method, the fields of the request type have been
* <li> A "flattened" method. With this type of method, the fields of the request type have been
* converted into function parameters. It may be the case that not all fields are available as
* parameters, and not every API method will have a flattened method entry point.
* <li>A "request object" method. This type of method only takes one parameter, a request object,
* <li> A "request object" method. This type of method only takes one parameter, a request object,
* which must be constructed before the call. Not every API method will have a request object
* method.
* <li>A "callable" method. This type of method takes no parameters and returns an immutable API
* <li> A "callable" method. This type of method takes no parameters and returns an immutable API
* callable object, which can be used to initiate calls to the service.
* </ol>
*
Expand Down Expand Up @@ -106,13 +106,28 @@
* DataFusionClient dataFusionClient = DataFusionClient.create(dataFusionSettings);
* }</pre>
*
* <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
* the wire:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* DataFusionSettings dataFusionSettings =
* DataFusionSettings.newBuilder()
* .setTransportChannelProvider(
* DataFusionSettings.defaultHttpJsonTransportProviderBuilder().build())
* .build();
* DataFusionClient dataFusionClient = DataFusionClient.create(dataFusionSettings);
* }</pre>
*
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
public class DataFusionClient implements BackgroundResource {
private final DataFusionSettings settings;
private final DataFusionStub stub;
private final OperationsClient operationsClient;
private final OperationsClient httpJsonOperationsClient;
private final com.google.longrunning.OperationsClient operationsClient;

/** Constructs an instance of DataFusionClient with default settings. */
public static final DataFusionClient create() throws IOException {
Expand Down Expand Up @@ -142,13 +157,17 @@ public static final DataFusionClient create(DataFusionStub stub) {
protected DataFusionClient(DataFusionSettings settings) throws IOException {
this.settings = settings;
this.stub = ((DataFusionStubSettings) settings.getStubSettings()).createStub();
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
this.operationsClient =
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}

protected DataFusionClient(DataFusionStub stub) {
this.settings = null;
this.stub = stub;
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
this.operationsClient =
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}

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

/**
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
public final OperationsClient getHttpJsonOperationsClient() {
return httpJsonOperationsClient;
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists possible versions for Data Fusion instances in the specified project and location.
Expand Down Expand Up @@ -967,11 +994,8 @@ public boolean awaitTermination(long duration, TimeUnit unit) throws Interrupted

public static class ListAvailableVersionsPagedResponse
extends AbstractPagedListResponse<
ListAvailableVersionsRequest,
ListAvailableVersionsResponse,
Version,
ListAvailableVersionsPage,
ListAvailableVersionsFixedSizeCollection> {
ListAvailableVersionsRequest, ListAvailableVersionsResponse, Version,
ListAvailableVersionsPage, ListAvailableVersionsFixedSizeCollection> {

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

public static class ListAvailableVersionsPage
extends AbstractPage<
ListAvailableVersionsRequest,
ListAvailableVersionsResponse,
Version,
ListAvailableVersionsRequest, ListAvailableVersionsResponse, Version,
ListAvailableVersionsPage> {

private ListAvailableVersionsPage(
Expand Down Expand Up @@ -1023,11 +1045,8 @@ public ApiFuture<ListAvailableVersionsPage> createPageAsync(

public static class ListAvailableVersionsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListAvailableVersionsRequest,
ListAvailableVersionsResponse,
Version,
ListAvailableVersionsPage,
ListAvailableVersionsFixedSizeCollection> {
ListAvailableVersionsRequest, ListAvailableVersionsResponse, Version,
ListAvailableVersionsPage, ListAvailableVersionsFixedSizeCollection> {

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

public static class ListInstancesPagedResponse
extends AbstractPagedListResponse<
ListInstancesRequest,
ListInstancesResponse,
Instance,
ListInstancesPage,
ListInstancesRequest, ListInstancesResponse, Instance, ListInstancesPage,
ListInstancesFixedSizeCollection> {

public static ApiFuture<ListInstancesPagedResponse> createAsync(
Expand Down Expand Up @@ -1100,10 +1116,7 @@ public ApiFuture<ListInstancesPage> createPageAsync(

public static class ListInstancesFixedSizeCollection
extends AbstractFixedSizeCollection<
ListInstancesRequest,
ListInstancesResponse,
Instance,
ListInstancesPage,
ListInstancesRequest, ListInstancesResponse, Instance, ListInstancesPage,
ListInstancesFixedSizeCollection> {

private ListInstancesFixedSizeCollection(List<ListInstancesPage> pages, int collectionSize) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@
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;
import com.google.api.gax.rpc.OperationCallSettings;
import com.google.api.gax.rpc.PagedCallSettings;
import com.google.api.gax.rpc.StubSettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.cloud.datafusion.v1.stub.DataFusionStubSettings;
Expand All @@ -45,9 +47,9 @@
* <p>The default instance has everything set to sensible defaults:
*
* <ul>
* <li>The default service address (datafusion.googleapis.com) and default port (443) are used.
* <li>Credentials are acquired automatically through Application Default Credentials.
* <li>Retries are configured for idempotent methods but not for non-idempotent methods.
* <li> The default service address (datafusion.googleapis.com) and default port (443) are used.
* <li> Credentials are acquired automatically through Application Default Credentials.
* <li> Retries are configured for idempotent methods but not for non-idempotent methods.
* </ul>
*
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
Expand Down Expand Up @@ -76,8 +78,7 @@ public class DataFusionSettings extends ClientSettings<DataFusionSettings> {

/** Returns the object with the settings used for calls to listAvailableVersions. */
public PagedCallSettings<
ListAvailableVersionsRequest,
ListAvailableVersionsResponse,
ListAvailableVersionsRequest, ListAvailableVersionsResponse,
ListAvailableVersionsPagedResponse>
listAvailableVersionsSettings() {
return ((DataFusionStubSettings) getStubSettings()).listAvailableVersionsSettings();
Expand Down Expand Up @@ -162,11 +163,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return DataFusionStubSettings.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 DataFusionStubSettings.defaultGrpcTransportProviderBuilder();
}

/** Returns a builder for the default REST ChannelProvider for this service. */
@BetaApi
public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder() {
return DataFusionStubSettings.defaultHttpJsonTransportProviderBuilder();
}

public static TransportChannelProvider defaultTransportChannelProvider() {
return DataFusionStubSettings.defaultTransportChannelProvider();
}
Expand All @@ -176,11 +184,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return DataFusionStubSettings.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);
Expand Down Expand Up @@ -218,6 +232,11 @@ private static Builder createDefault() {
return new Builder(DataFusionStubSettings.newBuilder());
}

@BetaApi
private static Builder createHttpJsonDefault() {
return new Builder(DataFusionStubSettings.newHttpJsonBuilder());
}

public DataFusionStubSettings.Builder getStubSettingsBuilder() {
return ((DataFusionStubSettings.Builder) getStubSettings());
}
Expand All @@ -236,8 +255,7 @@ public Builder applyToAllUnaryMethods(

/** Returns the builder for the settings used for calls to listAvailableVersions. */
public PagedCallSettings.Builder<
ListAvailableVersionsRequest,
ListAvailableVersionsResponse,
ListAvailableVersionsRequest, ListAvailableVersionsResponse,
ListAvailableVersionsPagedResponse>
listAvailableVersionsSettings() {
return getStubSettingsBuilder().listAvailableVersionsSettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@
public abstract class DataFusionStub implements BackgroundResource {

public OperationsStub getOperationsStub() {
throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
return null;
}

public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() {
return null;
}

public UnaryCallable<ListAvailableVersionsRequest, ListAvailableVersionsPagedResponse>
Expand Down
Loading

0 comments on commit 70a4e35

Please sign in to comment.