Skip to content

Commit

Permalink
fix: [Many APIs] simplify logic for HTTP/1.1 REST fallback option (#4589
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: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXZtd2FyZWVuZ2luZS8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXZwY2FjY2Vzcy8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXdlYnJpc2svLk93bEJvdC55YW1sIiwiaCI6IjU2YzE2NjU3ZTdhNTkxMjJiMWRhOTQ3NzFhOWVmNDA5ODljMjgyYzAifQ==
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXdlYnNlY3VyaXR5c2Nhbm5lci8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXdvcmtmbG93cy1leGVjdXRpb25zLy5Pd2xCb3QueWFtbCIsImgiOiI1NmMxNjY1N2U3YTU5MTIyYjFkYTk0NzcxYTllZjQwOTg5YzI4MmMwIn0=
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXdvcmtzdGF0aW9ucy8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YzI4MmMwIn0=

* 🦉 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] authored Aug 25, 2023
1 parent 14fffdf commit 07967ad
Show file tree
Hide file tree
Showing 44 changed files with 146 additions and 178 deletions.
5 changes: 3 additions & 2 deletions packages/google-cloud-vmwareengine/samples/quickstart.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ function main(parent) {
};

// Run request
const iterable =
await vmwareengineClient.listVmwareEngineNetworksAsync(request);
const iterable = await vmwareengineClient.listVmwareEngineNetworksAsync(
request
);
for await (const response of iterable) {
console.log(response);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,15 @@ export class VmwareEngineClient {
* 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 VmwareEngineClient({fallback: 'rest'}, gax);
* const client = new VmwareEngineClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -180,7 +179,7 @@ export class VmwareEngineClient {
}
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 @@ -284,7 +283,7 @@ export class VmwareEngineClient {
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 @@ -8221,8 +8221,9 @@ describe('v1.VmwareEngineClient', () => {
];
client.innerApiCalls.listPrivateConnectionPeeringRoutes =
stubSimpleCall(expectedResponse);
const [response] =
await client.listPrivateConnectionPeeringRoutes(request);
const [response] = await client.listPrivateConnectionPeeringRoutes(
request
);
assert.deepStrictEqual(response, expectedResponse);
const actualRequest = (
client.innerApiCalls.listPrivateConnectionPeeringRoutes as SinonStub
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,15 @@ export class VpcAccessServiceClient {
* 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 VpcAccessServiceClient({fallback: 'rest'}, gax);
* const client = new VpcAccessServiceClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -177,7 +176,7 @@ export class VpcAccessServiceClient {
}
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 @@ -217,7 +216,7 @@ export class VpcAccessServiceClient {
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 @@ -92,16 +92,15 @@ export class WebRiskServiceClient {
* 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 WebRiskServiceClient({fallback: 'rest'}, gax);
* const client = new WebRiskServiceClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -167,7 +166,7 @@ export class WebRiskServiceClient {
}
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 All @@ -193,7 +192,7 @@ export class WebRiskServiceClient {
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 WebRiskServiceV1Beta1Client {
* 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 WebRiskServiceV1Beta1Client({fallback: 'rest'}, gax);
* const client = new WebRiskServiceV1Beta1Client({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -164,7 +163,7 @@ export class WebRiskServiceV1Beta1Client {
}
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 @@ -92,16 +92,15 @@ export class WebSecurityScannerClient {
* 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 WebSecurityScannerClient({fallback: 'rest'}, gax);
* const client = new WebSecurityScannerClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -167,7 +166,7 @@ export class WebSecurityScannerClient {
}
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 @@ -92,16 +92,15 @@ export class WebSecurityScannerClient {
* 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 WebSecurityScannerClient({fallback: 'rest'}, gax);
* const client = new WebSecurityScannerClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -167,7 +166,7 @@ export class WebSecurityScannerClient {
}
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 @@ -92,16 +92,15 @@ export class WebSecurityScannerClient {
* 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 WebSecurityScannerClient({fallback: 'rest'}, gax);
* const client = new WebSecurityScannerClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -167,7 +166,7 @@ export class WebSecurityScannerClient {
}
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 ExecutionsClient {
* 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 ExecutionsClient({fallback: 'rest'}, gax);
* const client = new ExecutionsClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -163,7 +162,7 @@ export class ExecutionsClient {
}
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 @@ -98,16 +98,15 @@ export class WorkflowsClient {
* 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 WorkflowsClient({fallback: 'rest'}, gax);
* const client = new WorkflowsClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -177,7 +176,7 @@ export class WorkflowsClient {
}
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 @@ -220,7 +219,7 @@ export class WorkflowsClient {
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 @@ -91,16 +91,15 @@ export class ExecutionsClient {
* 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 ExecutionsClient({fallback: 'rest'}, gax);
* const client = new ExecutionsClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -163,7 +162,7 @@ export class ExecutionsClient {
}
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 @@ -95,16 +95,15 @@ export class WorkflowsClient {
* 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 WorkflowsClient({fallback: 'rest'}, gax);
* const client = new WorkflowsClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -170,7 +169,7 @@ export class WorkflowsClient {
}
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 WorkflowsClient {
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 07967ad

Please sign in to comment.