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

Commit

Permalink
fix: simplify logic for HTTP/1.1 REST fallback option (#55)
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: https://github.com/googleapis/googleapis-gen/commit/56c16657e7a59122b1da94771a9ef40989c282c0
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9

* 🦉 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] authored Sep 6, 2023
1 parent 9ce1e95 commit 12fa279
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
7 changes: 3 additions & 4 deletions src/v2/migration_service_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,15 @@ export class MigrationServiceClient {
* 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 MigrationServiceClient({fallback: 'rest'}, gax);
* const client = new MigrationServiceClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -162,7 +161,7 @@ export class MigrationServiceClient {
}
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
7 changes: 3 additions & 4 deletions src/v2alpha/migration_service_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,15 @@ export class MigrationServiceClient {
* 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 MigrationServiceClient({fallback: 'rest'}, gax);
* const client = new MigrationServiceClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -162,7 +161,7 @@ export class MigrationServiceClient {
}
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
7 changes: 3 additions & 4 deletions src/v2alpha/sql_translation_service_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,15 @@ export class SqlTranslationServiceClient {
* 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 SqlTranslationServiceClient({fallback: 'rest'}, gax);
* const client = new SqlTranslationServiceClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -161,7 +160,7 @@ export class SqlTranslationServiceClient {
}
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

0 comments on commit 12fa279

Please sign in to comment.