Skip to content

Commit e3b1e7e

Browse files
fix: [Many APIs] simplify logic for HTTP/1.1 REST fallback option (#4587)
* 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: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW5ldHdvcmtzZWN1cml0eS8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW5vdGVib29rcy8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW9wdGltaXphdGlvbi8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW9yY2hlc3RyYXRpb24tYWlyZmxvdy1zZXJ2aWNlLy5Pd2xCb3QueWFtbCIsImgiOiI1NmMxNjY1N2U3YTU5MTIyYjFkYTk0NzcxYTllZjQwOTg5YzI4MmMwIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW9yZ3BvbGljeS8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW9zY29uZmlnLy5Pd2xCb3QueWFtb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yMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 * 🦉 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>
1 parent e5ad564 commit e3b1e7e

77 files changed

Lines changed: 286 additions & 354 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/google-cloud-networksecurity/samples/quickstart.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ function main(parent) {
5050
};
5151

5252
// Run request
53-
const iterable =
54-
await networksecurityClient.listClientTlsPoliciesAsync(request);
53+
const iterable = await networksecurityClient.listClientTlsPoliciesAsync(
54+
request
55+
);
5556
for await (const response of iterable) {
5657
console.log(response);
5758
}

packages/google-cloud-networksecurity/src/v1/network_security_client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,15 @@ export class NetworkSecurityClient {
101101
* API remote host.
102102
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
103103
* Follows the structure of {@link gapicConfig}.
104-
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
105-
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
104+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
106105
* For more information, please check the
107106
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
108107
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
109108
* need to avoid loading the default gRPC version and want to use the fallback
110109
* HTTP implementation. Load only fallback version and pass it to the constructor:
111110
* ```
112111
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
113-
* const client = new NetworkSecurityClient({fallback: 'rest'}, gax);
112+
* const client = new NetworkSecurityClient({fallback: true}, gax);
114113
* ```
115114
*/
116115
constructor(
@@ -182,7 +181,7 @@ export class NetworkSecurityClient {
182181
}
183182
if (!opts.fallback) {
184183
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
185-
} else if (opts.fallback === 'rest') {
184+
} else {
186185
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
187186
}
188187
if (opts.libName && opts.libVersion) {
@@ -235,7 +234,7 @@ export class NetworkSecurityClient {
235234
auth: this.auth,
236235
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
237236
};
238-
if (opts.fallback === 'rest') {
237+
if (opts.fallback) {
239238
lroOptions.protoJson = protoFilesRoot;
240239
lroOptions.httpRules = [
241240
{

packages/google-cloud-networksecurity/src/v1beta1/network_security_client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,15 @@ export class NetworkSecurityClient {
101101
* API remote host.
102102
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
103103
* Follows the structure of {@link gapicConfig}.
104-
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
105-
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
104+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
106105
* For more information, please check the
107106
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
108107
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
109108
* need to avoid loading the default gRPC version and want to use the fallback
110109
* HTTP implementation. Load only fallback version and pass it to the constructor:
111110
* ```
112111
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
113-
* const client = new NetworkSecurityClient({fallback: 'rest'}, gax);
112+
* const client = new NetworkSecurityClient({fallback: true}, gax);
114113
* ```
115114
*/
116115
constructor(
@@ -182,7 +181,7 @@ export class NetworkSecurityClient {
182181
}
183182
if (!opts.fallback) {
184183
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
185-
} else if (opts.fallback === 'rest') {
184+
} else {
186185
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
187186
}
188187
if (opts.libName && opts.libVersion) {
@@ -235,7 +234,7 @@ export class NetworkSecurityClient {
235234
auth: this.auth,
236235
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
237236
};
238-
if (opts.fallback === 'rest') {
237+
if (opts.fallback) {
239238
lroOptions.protoJson = protoFilesRoot;
240239
lroOptions.httpRules = [
241240
{

packages/google-cloud-notebooks/src/v1/managed_notebook_service_client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,15 @@ export class ManagedNotebookServiceClient {
9999
* API remote host.
100100
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
101101
* Follows the structure of {@link gapicConfig}.
102-
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
103-
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
102+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
104103
* For more information, please check the
105104
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
106105
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
107106
* need to avoid loading the default gRPC version and want to use the fallback
108107
* HTTP implementation. Load only fallback version and pass it to the constructor:
109108
* ```
110109
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
111-
* const client = new ManagedNotebookServiceClient({fallback: 'rest'}, gax);
110+
* const client = new ManagedNotebookServiceClient({fallback: true}, gax);
112111
* ```
113112
*/
114113
constructor(
@@ -181,7 +180,7 @@ export class ManagedNotebookServiceClient {
181180
}
182181
if (!opts.fallback) {
183182
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
184-
} else if (opts.fallback === 'rest') {
183+
} else {
185184
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
186185
}
187186
if (opts.libName && opts.libVersion) {
@@ -236,7 +235,7 @@ export class ManagedNotebookServiceClient {
236235
auth: this.auth,
237236
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
238237
};
239-
if (opts.fallback === 'rest') {
238+
if (opts.fallback) {
240239
lroOptions.protoJson = protoFilesRoot;
241240
lroOptions.httpRules = [
242241
{

packages/google-cloud-notebooks/src/v1/notebook_service_client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,15 @@ export class NotebookServiceClient {
9999
* API remote host.
100100
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
101101
* Follows the structure of {@link gapicConfig}.
102-
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
103-
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
102+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
104103
* For more information, please check the
105104
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
106105
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
107106
* need to avoid loading the default gRPC version and want to use the fallback
108107
* HTTP implementation. Load only fallback version and pass it to the constructor:
109108
* ```
110109
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
111-
* const client = new NotebookServiceClient({fallback: 'rest'}, gax);
110+
* const client = new NotebookServiceClient({fallback: true}, gax);
112111
* ```
113112
*/
114113
constructor(
@@ -180,7 +179,7 @@ export class NotebookServiceClient {
180179
}
181180
if (!opts.fallback) {
182181
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
183-
} else if (opts.fallback === 'rest') {
182+
} else {
184183
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
185184
}
186185
if (opts.libName && opts.libVersion) {
@@ -244,7 +243,7 @@ export class NotebookServiceClient {
244243
auth: this.auth,
245244
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
246245
};
247-
if (opts.fallback === 'rest') {
246+
if (opts.fallback) {
248247
lroOptions.protoJson = protoFilesRoot;
249248
lroOptions.httpRules = [
250249
{

packages/google-cloud-notebooks/src/v1beta1/notebook_service_client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,15 @@ export class NotebookServiceClient {
9999
* API remote host.
100100
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
101101
* Follows the structure of {@link gapicConfig}.
102-
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
103-
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
102+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
104103
* For more information, please check the
105104
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
106105
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
107106
* need to avoid loading the default gRPC version and want to use the fallback
108107
* HTTP implementation. Load only fallback version and pass it to the constructor:
109108
* ```
110109
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
111-
* const client = new NotebookServiceClient({fallback: 'rest'}, gax);
110+
* const client = new NotebookServiceClient({fallback: true}, gax);
112111
* ```
113112
*/
114113
constructor(
@@ -180,7 +179,7 @@ export class NotebookServiceClient {
180179
}
181180
if (!opts.fallback) {
182181
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
183-
} else if (opts.fallback === 'rest') {
182+
} else {
184183
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
185184
}
186185
if (opts.libName && opts.libVersion) {
@@ -225,7 +224,7 @@ export class NotebookServiceClient {
225224
auth: this.auth,
226225
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
227226
};
228-
if (opts.fallback === 'rest') {
227+
if (opts.fallback) {
229228
lroOptions.protoJson = protoFilesRoot;
230229
lroOptions.httpRules = [
231230
{

packages/google-cloud-notebooks/src/v2/notebook_service_client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,15 @@ export class NotebookServiceClient {
9999
* API remote host.
100100
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
101101
* Follows the structure of {@link gapicConfig}.
102-
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
103-
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
102+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
104103
* For more information, please check the
105104
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
106105
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
107106
* need to avoid loading the default gRPC version and want to use the fallback
108107
* HTTP implementation. Load only fallback version and pass it to the constructor:
109108
* ```
110109
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
111-
* const client = new NotebookServiceClient({fallback: 'rest'}, gax);
110+
* const client = new NotebookServiceClient({fallback: true}, gax);
112111
* ```
113112
*/
114113
constructor(
@@ -180,7 +179,7 @@ export class NotebookServiceClient {
180179
}
181180
if (!opts.fallback) {
182181
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
183-
} else if (opts.fallback === 'rest') {
182+
} else {
184183
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
185184
}
186185
if (opts.libName && opts.libVersion) {
@@ -223,7 +222,7 @@ export class NotebookServiceClient {
223222
auth: this.auth,
224223
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
225224
};
226-
if (opts.fallback === 'rest') {
225+
if (opts.fallback) {
227226
lroOptions.protoJson = protoFilesRoot;
228227
lroOptions.httpRules = [
229228
{

packages/google-cloud-optimization/src/v1/fleet_routing_client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,15 @@ export class FleetRoutingClient {
106106
* API remote host.
107107
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
108108
* Follows the structure of {@link gapicConfig}.
109-
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
110-
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
109+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
111110
* For more information, please check the
112111
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
113112
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
114113
* need to avoid loading the default gRPC version and want to use the fallback
115114
* HTTP implementation. Load only fallback version and pass it to the constructor:
116115
* ```
117116
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
118-
* const client = new FleetRoutingClient({fallback: 'rest'}, gax);
117+
* const client = new FleetRoutingClient({fallback: true}, gax);
119118
* ```
120119
*/
121120
constructor(
@@ -181,7 +180,7 @@ export class FleetRoutingClient {
181180
}
182181
if (!opts.fallback) {
183182
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
184-
} else if (opts.fallback === 'rest') {
183+
} else {
185184
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
186185
}
187186
if (opts.libName && opts.libVersion) {
@@ -198,7 +197,7 @@ export class FleetRoutingClient {
198197
auth: this.auth,
199198
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
200199
};
201-
if (opts.fallback === 'rest') {
200+
if (opts.fallback) {
202201
lroOptions.protoJson = protoFilesRoot;
203202
lroOptions.httpRules = [
204203
{

packages/google-cloud-orchestration-airflow-service/src/v1/environments_client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,15 @@ export class EnvironmentsClient {
9393
* API remote host.
9494
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
9595
* Follows the structure of {@link gapicConfig}.
96-
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
97-
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
96+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
9897
* For more information, please check the
9998
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
10099
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
101100
* need to avoid loading the default gRPC version and want to use the fallback
102101
* HTTP implementation. Load only fallback version and pass it to the constructor:
103102
* ```
104103
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
105-
* const client = new EnvironmentsClient({fallback: 'rest'}, gax);
104+
* const client = new EnvironmentsClient({fallback: true}, gax);
106105
* ```
107106
*/
108107
constructor(
@@ -168,7 +167,7 @@ export class EnvironmentsClient {
168167
}
169168
if (!opts.fallback) {
170169
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
171-
} else if (opts.fallback === 'rest') {
170+
} else {
172171
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
173172
}
174173
if (opts.libName && opts.libVersion) {
@@ -205,7 +204,7 @@ export class EnvironmentsClient {
205204
auth: this.auth,
206205
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
207206
};
208-
if (opts.fallback === 'rest') {
207+
if (opts.fallback) {
209208
lroOptions.protoJson = protoFilesRoot;
210209
lroOptions.httpRules = [
211210
{

packages/google-cloud-orchestration-airflow-service/src/v1/image_versions_client.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,15 @@ export class ImageVersionsClient {
9090
* API remote host.
9191
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
9292
* Follows the structure of {@link gapicConfig}.
93-
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
94-
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
93+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
9594
* For more information, please check the
9695
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
9796
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
9897
* need to avoid loading the default gRPC version and want to use the fallback
9998
* HTTP implementation. Load only fallback version and pass it to the constructor:
10099
* ```
101100
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
102-
* const client = new ImageVersionsClient({fallback: 'rest'}, gax);
101+
* const client = new ImageVersionsClient({fallback: true}, gax);
103102
* ```
104103
*/
105104
constructor(
@@ -165,7 +164,7 @@ export class ImageVersionsClient {
165164
}
166165
if (!opts.fallback) {
167166
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
168-
} else if (opts.fallback === 'rest') {
167+
} else {
169168
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
170169
}
171170
if (opts.libName && opts.libVersion) {

0 commit comments

Comments
 (0)