Skip to content

Commit

Permalink
feat: Enable REST transport for most of Java and Go clients (googleap…
Browse files Browse the repository at this point in the history
…is#471)

- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 456641589

Source-Link: googleapis/googleapis@8a251f5

Source-Link: https://github.com/googleapis/googleapis-gen/commit/4ca52a529cf01308d9714950edffbea3560cfbdb
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGNhNTJhNTI5Y2YwMTMwOGQ5NzE0OTUwZWRmZmJlYTM1NjBjZmJkYiJ9
  • Loading branch information
gcf-owl-bot[bot] authored Jun 24, 2022
1 parent 3f78a99 commit 11c00f7
Show file tree
Hide file tree
Showing 650 changed files with 49,661 additions and 166 deletions.
4 changes: 2 additions & 2 deletions java-retail/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ If you are using Maven, add this to your pom.xml file:
If you are using Gradle without BOM, add this to your dependencies

```Groovy
implementation 'com.google.cloud:google-cloud-retail:2.2.3'
implementation 'com.google.cloud:google-cloud-retail:2.2.4'
```

If you are using SBT, add this to your dependencies

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-retail" % "2.2.3"
libraryDependencies += "com.google.cloud" % "google-cloud-retail" % "2.2.4"
```

## Authentication
Expand Down
16 changes: 16 additions & 0 deletions java-retail/google-cloud-retail/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-grpc</artifactId>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-httpjson</artifactId>
</dependency>
<dependency>
<groupId>org.threeten</groupId>
Expand Down Expand Up @@ -95,12 +99,24 @@
<scope>test</scope>
</dependency>
<!-- Need testing utility classes for generated gRPC clients tests -->
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax</artifactId>
<classifier>testlib</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-grpc</artifactId>
<classifier>testlib</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-httpjson</artifactId>
<classifier>testlib</classifier>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,20 @@
* CatalogServiceClient catalogServiceClient = CatalogServiceClient.create(catalogServiceSettings);
* }</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.
* CatalogServiceSettings catalogServiceSettings =
* CatalogServiceSettings.newBuilder()
* .setTransportChannelProvider(
* CatalogServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
* .build();
* CatalogServiceClient catalogServiceClient = CatalogServiceClient.create(catalogServiceSettings);
* }</pre>
*
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,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;
Expand Down Expand Up @@ -119,11 +120,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return CatalogServiceStubSettings.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 CatalogServiceStubSettings.defaultGrpcTransportProviderBuilder();
}

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

public static TransportChannelProvider defaultTransportChannelProvider() {
return CatalogServiceStubSettings.defaultTransportChannelProvider();
}
Expand All @@ -133,11 +141,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return CatalogServiceStubSettings.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 @@ -175,6 +189,11 @@ private static Builder createDefault() {
return new Builder(CatalogServiceStubSettings.newBuilder());
}

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

public CatalogServiceStubSettings.Builder getStubSettingsBuilder() {
return ((CatalogServiceStubSettings.Builder) getStubSettings());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
package com.google.cloud.retail.v2;

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.rpc.OperationCallable;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.retail.v2.stub.CompletionServiceStub;
import com.google.cloud.retail.v2.stub.CompletionServiceStubSettings;
import com.google.longrunning.Operation;
import com.google.longrunning.OperationsClient;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
Expand Down Expand Up @@ -107,13 +107,29 @@
* CompletionServiceClient.create(completionServiceSettings);
* }</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.
* CompletionServiceSettings completionServiceSettings =
* CompletionServiceSettings.newBuilder()
* .setTransportChannelProvider(
* CompletionServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
* .build();
* CompletionServiceClient completionServiceClient =
* CompletionServiceClient.create(completionServiceSettings);
* }</pre>
*
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
public class CompletionServiceClient implements BackgroundResource {
private final CompletionServiceSettings settings;
private final CompletionServiceStub stub;
private final OperationsClient operationsClient;
private final OperationsClient httpJsonOperationsClient;
private final com.google.longrunning.OperationsClient operationsClient;

/** Constructs an instance of CompletionServiceClient with default settings. */
public static final CompletionServiceClient create() throws IOException {
Expand Down Expand Up @@ -145,13 +161,17 @@ public static final CompletionServiceClient create(CompletionServiceStub stub) {
protected CompletionServiceClient(CompletionServiceSettings settings) throws IOException {
this.settings = settings;
this.stub = ((CompletionServiceStubSettings) 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 CompletionServiceClient(CompletionServiceStub 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 CompletionServiceSettings getSettings() {
Expand All @@ -166,10 +186,18 @@ public CompletionServiceStub 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.
/**
* Completes the specified prefix with keyword suggestions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,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;
Expand Down Expand Up @@ -113,11 +114,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return CompletionServiceStubSettings.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 CompletionServiceStubSettings.defaultGrpcTransportProviderBuilder();
}

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

public static TransportChannelProvider defaultTransportChannelProvider() {
return CompletionServiceStubSettings.defaultTransportChannelProvider();
}
Expand All @@ -127,11 +135,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return CompletionServiceStubSettings.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 @@ -169,6 +183,11 @@ private static Builder createDefault() {
return new Builder(CompletionServiceStubSettings.newBuilder());
}

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

public CompletionServiceStubSettings.Builder getStubSettingsBuilder() {
return ((CompletionServiceStubSettings.Builder) getStubSettings());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,21 @@
* PredictionServiceClient.create(predictionServiceSettings);
* }</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.
* PredictionServiceSettings predictionServiceSettings =
* PredictionServiceSettings.newBuilder()
* .setTransportChannelProvider(
* PredictionServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
* .build();
* PredictionServiceClient predictionServiceClient =
* PredictionServiceClient.create(predictionServiceSettings);
* }</pre>
*
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,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;
Expand Down Expand Up @@ -98,11 +99,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return PredictionServiceStubSettings.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 PredictionServiceStubSettings.defaultGrpcTransportProviderBuilder();
}

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

public static TransportChannelProvider defaultTransportChannelProvider() {
return PredictionServiceStubSettings.defaultTransportChannelProvider();
}
Expand All @@ -112,11 +120,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return PredictionServiceStubSettings.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 @@ -154,6 +168,11 @@ private static Builder createDefault() {
return new Builder(PredictionServiceStubSettings.newBuilder());
}

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

public PredictionServiceStubSettings.Builder getStubSettingsBuilder() {
return ((PredictionServiceStubSettings.Builder) getStubSettings());
}
Expand Down
Loading

0 comments on commit 11c00f7

Please sign in to comment.