Skip to content

Commit

Permalink
fix: [Many APIs] simplify logic for HTTP/1.1 REST fallback option (#4583
Browse files Browse the repository at this point in the history
)

* fix: simplify logic for HTTP/1.1 REST fallback option

For the `fallback` parameter, all values considered as `true`
in Boolean context will enable HTTP/1.1 REST fallback,
since the other fallback transport, proto over HTTP, is
removed from `google-gax` v4.

PiperOrigin-RevId: 559812260

Source-Link: googleapis/googleapis@6a6fd29

Source-Link: googleapis/googleapis-gen@56c1665
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFpLWdlbmVyYXRpdmVsYW5ndWFnZS8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFuYWx5dGljcy1hZG1pbi8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFuYWx5dGljcy1kYXRhLy5Pd2xCb3QueWFtbCIsImgiOiI1NmMxNjY1N2U3YTU5MTIyYjFkYTk0NzcxYTllZjQwOTg5YzI4MmMwIn0=
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFwaS1hcGlrZXlzLy5Pd2xCb3QueWFtbCIsImgiOiI1NmMxNjY1N2U3YTU5MTIyYjFkYTk0NzcxYTllZjQwOTg5YzI4MmMwIn0=
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFwaS1zZXJ2aWNlY29udHJvbC8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFwaS1zZXJ2aWNlbWFuYWdlbWVudC8uT3dsQm90LnlhbWwiLCJo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hOWVmNDA5ODljMjgyYzAifQ==

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Aug 25, 2023
1 parent 13537fc commit c3ddba8
Show file tree
Hide file tree
Showing 84 changed files with 311 additions and 387 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,15 @@ export class DiscussServiceClient {
* API remote host.
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
* Follows the structure of {@link gapicConfig}.
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
* For more information, please check the
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
* need to avoid loading the default gRPC version and want to use the fallback
* HTTP implementation. Load only fallback version and pass it to the constructor:
* ```
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
* const client = new DiscussServiceClient({fallback: 'rest'}, gax);
* const client = new DiscussServiceClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -166,7 +165,7 @@ export class DiscussServiceClient {
}
if (!opts.fallback) {
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
} else if (opts.fallback === 'rest') {
} else {
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
}
if (opts.libName && opts.libVersion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,15 @@ export class ModelServiceClient {
* API remote host.
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
* Follows the structure of {@link gapicConfig}.
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
* For more information, please check the
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
* need to avoid loading the default gRPC version and want to use the fallback
* HTTP implementation. Load only fallback version and pass it to the constructor:
* ```
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
* const client = new ModelServiceClient({fallback: 'rest'}, gax);
* const client = new ModelServiceClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -165,7 +164,7 @@ export class ModelServiceClient {
}
if (!opts.fallback) {
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
} else if (opts.fallback === 'rest') {
} else {
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
}
if (opts.libName && opts.libVersion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,15 @@ export class TextServiceClient {
* API remote host.
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
* Follows the structure of {@link gapicConfig}.
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
* For more information, please check the
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
* need to avoid loading the default gRPC version and want to use the fallback
* HTTP implementation. Load only fallback version and pass it to the constructor:
* ```
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
* const client = new TextServiceClient({fallback: 'rest'}, gax);
* const client = new TextServiceClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -166,7 +165,7 @@ export class TextServiceClient {
}
if (!opts.fallback) {
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
} else if (opts.fallback === 'rest') {
} else {
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
}
if (opts.libName && opts.libVersion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,15 @@ export class AnalyticsAdminServiceClient {
* API remote host.
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
* Follows the structure of {@link gapicConfig}.
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
* For more information, please check the
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
* need to avoid loading the default gRPC version and want to use the fallback
* HTTP implementation. Load only fallback version and pass it to the constructor:
* ```
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
* const client = new AnalyticsAdminServiceClient({fallback: 'rest'}, gax);
* const client = new AnalyticsAdminServiceClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -166,7 +165,7 @@ export class AnalyticsAdminServiceClient {
}
if (!opts.fallback) {
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
} else if (opts.fallback === 'rest') {
} else {
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
}
if (opts.libName && opts.libVersion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,15 @@ export class AnalyticsAdminServiceClient {
* API remote host.
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
* Follows the structure of {@link gapicConfig}.
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
* For more information, please check the
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
* need to avoid loading the default gRPC version and want to use the fallback
* HTTP implementation. Load only fallback version and pass it to the constructor:
* ```
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
* const client = new AnalyticsAdminServiceClient({fallback: 'rest'}, gax);
* const client = new AnalyticsAdminServiceClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -166,7 +165,7 @@ export class AnalyticsAdminServiceClient {
}
if (!opts.fallback) {
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
} else if (opts.fallback === 'rest') {
} else {
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
}
if (opts.libName && opts.libVersion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,15 @@ export class AlphaAnalyticsDataClient {
* API remote host.
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
* Follows the structure of {@link gapicConfig}.
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
* For more information, please check the
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
* need to avoid loading the default gRPC version and want to use the fallback
* HTTP implementation. Load only fallback version and pass it to the constructor:
* ```
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
* const client = new AlphaAnalyticsDataClient({fallback: 'rest'}, gax);
* const client = new AlphaAnalyticsDataClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -168,7 +167,7 @@ export class AlphaAnalyticsDataClient {
}
if (!opts.fallback) {
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
} else if (opts.fallback === 'rest') {
} else {
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
}
if (opts.libName && opts.libVersion) {
Expand Down Expand Up @@ -208,7 +207,7 @@ export class AlphaAnalyticsDataClient {
auth: this.auth,
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
};
if (opts.fallback === 'rest') {
if (opts.fallback) {
lroOptions.protoJson = protoFilesRoot;
lroOptions.httpRules = [];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,15 @@ export class BetaAnalyticsDataClient {
* API remote host.
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
* Follows the structure of {@link gapicConfig}.
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
* For more information, please check the
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
* need to avoid loading the default gRPC version and want to use the fallback
* HTTP implementation. Load only fallback version and pass it to the constructor:
* ```
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
* const client = new BetaAnalyticsDataClient({fallback: 'rest'}, gax);
* const client = new BetaAnalyticsDataClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -163,7 +162,7 @@ export class BetaAnalyticsDataClient {
}
if (!opts.fallback) {
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
} else if (opts.fallback === 'rest') {
} else {
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
}
if (opts.libName && opts.libVersion) {
Expand Down
9 changes: 4 additions & 5 deletions packages/google-api-apikeys/src/v2/api_keys_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,15 @@ export class ApiKeysClient {
* API remote host.
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
* Follows the structure of {@link gapicConfig}.
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
* For more information, please check the
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
* need to avoid loading the default gRPC version and want to use the fallback
* HTTP implementation. Load only fallback version and pass it to the constructor:
* ```
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
* const client = new ApiKeysClient({fallback: 'rest'}, gax);
* const client = new ApiKeysClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -168,7 +167,7 @@ export class ApiKeysClient {
}
if (!opts.fallback) {
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
} else if (opts.fallback === 'rest') {
} else {
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
}
if (opts.libName && opts.libVersion) {
Expand Down Expand Up @@ -211,7 +210,7 @@ export class ApiKeysClient {
auth: this.auth,
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
};
if (opts.fallback === 'rest') {
if (opts.fallback) {
lroOptions.protoJson = protoFilesRoot;
lroOptions.httpRules = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,15 @@ export class QuotaControllerClient {
* API remote host.
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
* Follows the structure of {@link gapicConfig}.
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
* For more information, please check the
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
* need to avoid loading the default gRPC version and want to use the fallback
* HTTP implementation. Load only fallback version and pass it to the constructor:
* ```
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
* const client = new QuotaControllerClient({fallback: 'rest'}, gax);
* const client = new QuotaControllerClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -165,7 +164,7 @@ export class QuotaControllerClient {
}
if (!opts.fallback) {
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
} else if (opts.fallback === 'rest') {
} else {
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
}
if (opts.libName && opts.libVersion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,15 @@ export class ServiceControllerClient {
* API remote host.
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
* Follows the structure of {@link gapicConfig}.
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
* For more information, please check the
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
* need to avoid loading the default gRPC version and want to use the fallback
* HTTP implementation. Load only fallback version and pass it to the constructor:
* ```
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
* const client = new ServiceControllerClient({fallback: 'rest'}, gax);
* const client = new ServiceControllerClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -165,7 +164,7 @@ export class ServiceControllerClient {
}
if (!opts.fallback) {
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
} else if (opts.fallback === 'rest') {
} else {
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
}
if (opts.libName && opts.libVersion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,15 @@ export class ServiceControllerClient {
* API remote host.
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
* Follows the structure of {@link gapicConfig}.
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
* For more information, please check the
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
* need to avoid loading the default gRPC version and want to use the fallback
* HTTP implementation. Load only fallback version and pass it to the constructor:
* ```
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
* const client = new ServiceControllerClient({fallback: 'rest'}, gax);
* const client = new ServiceControllerClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -169,7 +168,7 @@ export class ServiceControllerClient {
}
if (!opts.fallback) {
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
} else if (opts.fallback === 'rest') {
} else {
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
}
if (opts.libName && opts.libVersion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,15 @@ export class ServiceManagerClient {
* API remote host.
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
* Follows the structure of {@link gapicConfig}.
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
* For more information, please check the
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
* need to avoid loading the default gRPC version and want to use the fallback
* HTTP implementation. Load only fallback version and pass it to the constructor:
* ```
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
* const client = new ServiceManagerClient({fallback: 'rest'}, gax);
* const client = new ServiceManagerClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -172,7 +171,7 @@ export class ServiceManagerClient {
}
if (!opts.fallback) {
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
} else if (opts.fallback === 'rest') {
} else {
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
}
if (opts.libName && opts.libVersion) {
Expand Down Expand Up @@ -210,7 +209,7 @@ export class ServiceManagerClient {
auth: this.auth,
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
};
if (opts.fallback === 'rest') {
if (opts.fallback) {
lroOptions.protoJson = protoFilesRoot;
lroOptions.httpRules = [
{
Expand Down
Loading

0 comments on commit c3ddba8

Please sign in to comment.