Skip to content

Commit 4b18686

Browse files
fix: [Many APIs] simplify logic for HTTP/1.1 REST fallback option (#4586)
* 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: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWZ1bmN0aW9ucy8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWdrZWJhY2t1cC8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWdrZWNvbm5lY3QtZ2F0ZXdheS8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWdrZWh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWdrZW11bHRpY2xvdWQvLk93bEJvdC55YW1sIiwiaCI6IjU2YzE2NjU3ZTdhNTkxMjJiMWRhOTQ3NzFhOWVmNDA5ODljMjgyYzAifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWdzdWl0ZWFkZG9ucy8uT3dsQm90LnlhbWwiLCJoIjoiNTZ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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 e3b1e7e commit 4b18686

46 files changed

Lines changed: 169 additions & 211 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-functions/src/v1/cloud_functions_service_client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,15 @@ export class CloudFunctionsServiceClient {
9696
* API remote host.
9797
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
9898
* Follows the structure of {@link gapicConfig}.
99-
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
100-
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
99+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
101100
* For more information, please check the
102101
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
103102
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
104103
* need to avoid loading the default gRPC version and want to use the fallback
105104
* HTTP implementation. Load only fallback version and pass it to the constructor:
106105
* ```
107106
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
108-
* const client = new CloudFunctionsServiceClient({fallback: 'rest'}, gax);
107+
* const client = new CloudFunctionsServiceClient({fallback: true}, gax);
109108
* ```
110109
*/
111110
constructor(
@@ -176,7 +175,7 @@ export class CloudFunctionsServiceClient {
176175
}
177176
if (!opts.fallback) {
178177
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
179-
} else if (opts.fallback === 'rest') {
178+
} else {
180179
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
181180
}
182181
if (opts.libName && opts.libVersion) {
@@ -222,7 +221,7 @@ export class CloudFunctionsServiceClient {
222221
auth: this.auth,
223222
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
224223
};
225-
if (opts.fallback === 'rest') {
224+
if (opts.fallback) {
226225
lroOptions.protoJson = protoFilesRoot;
227226
lroOptions.httpRules = [
228227
{

packages/google-cloud-functions/src/v2/function_service_client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,15 @@ export class FunctionServiceClient {
104104
* API remote host.
105105
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
106106
* Follows the structure of {@link gapicConfig}.
107-
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
108-
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
107+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
109108
* For more information, please check the
110109
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
111110
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
112111
* need to avoid loading the default gRPC version and want to use the fallback
113112
* HTTP implementation. Load only fallback version and pass it to the constructor:
114113
* ```
115114
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
116-
* const client = new FunctionServiceClient({fallback: 'rest'}, gax);
115+
* const client = new FunctionServiceClient({fallback: true}, gax);
117116
* ```
118117
*/
119118
constructor(
@@ -185,7 +184,7 @@ export class FunctionServiceClient {
185184
}
186185
if (!opts.fallback) {
187186
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
188-
} else if (opts.fallback === 'rest') {
187+
} else {
189188
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
190189
}
191190
if (opts.libName && opts.libVersion) {
@@ -255,7 +254,7 @@ export class FunctionServiceClient {
255254
auth: this.auth,
256255
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
257256
};
258-
if (opts.fallback === 'rest') {
257+
if (opts.fallback) {
259258
lroOptions.protoJson = protoFilesRoot;
260259
lroOptions.httpRules = [
261260
{

packages/google-cloud-functions/src/v2alpha/function_service_client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,15 @@ export class FunctionServiceClient {
104104
* API remote host.
105105
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
106106
* Follows the structure of {@link gapicConfig}.
107-
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
108-
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
107+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
109108
* For more information, please check the
110109
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
111110
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
112111
* need to avoid loading the default gRPC version and want to use the fallback
113112
* HTTP implementation. Load only fallback version and pass it to the constructor:
114113
* ```
115114
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
116-
* const client = new FunctionServiceClient({fallback: 'rest'}, gax);
115+
* const client = new FunctionServiceClient({fallback: true}, gax);
117116
* ```
118117
*/
119118
constructor(
@@ -185,7 +184,7 @@ export class FunctionServiceClient {
185184
}
186185
if (!opts.fallback) {
187186
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
188-
} else if (opts.fallback === 'rest') {
187+
} else {
189188
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
190189
}
191190
if (opts.libName && opts.libVersion) {
@@ -255,7 +254,7 @@ export class FunctionServiceClient {
255254
auth: this.auth,
256255
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
257256
};
258-
if (opts.fallback === 'rest') {
257+
if (opts.fallback) {
259258
lroOptions.protoJson = protoFilesRoot;
260259
lroOptions.httpRules = [
261260
{

packages/google-cloud-functions/src/v2beta/function_service_client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,15 @@ export class FunctionServiceClient {
104104
* API remote host.
105105
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
106106
* Follows the structure of {@link gapicConfig}.
107-
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
108-
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
107+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
109108
* For more information, please check the
110109
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
111110
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
112111
* need to avoid loading the default gRPC version and want to use the fallback
113112
* HTTP implementation. Load only fallback version and pass it to the constructor:
114113
* ```
115114
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
116-
* const client = new FunctionServiceClient({fallback: 'rest'}, gax);
115+
* const client = new FunctionServiceClient({fallback: true}, gax);
117116
* ```
118117
*/
119118
constructor(
@@ -185,7 +184,7 @@ export class FunctionServiceClient {
185184
}
186185
if (!opts.fallback) {
187186
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
188-
} else if (opts.fallback === 'rest') {
187+
} else {
189188
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
190189
}
191190
if (opts.libName && opts.libVersion) {
@@ -255,7 +254,7 @@ export class FunctionServiceClient {
255254
auth: this.auth,
256255
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
257256
};
258-
if (opts.fallback === 'rest') {
257+
if (opts.fallback) {
259258
lroOptions.protoJson = protoFilesRoot;
260259
lroOptions.httpRules = [
261260
{

packages/google-cloud-gkebackup/src/v1/backup_for_g_k_e_client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,15 @@ export class BackupForGKEClient {
100100
* API remote host.
101101
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
102102
* Follows the structure of {@link gapicConfig}.
103-
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
104-
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
103+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
105104
* For more information, please check the
106105
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
107106
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
108107
* need to avoid loading the default gRPC version and want to use the fallback
109108
* HTTP implementation. Load only fallback version and pass it to the constructor:
110109
* ```
111110
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
112-
* const client = new BackupForGKEClient({fallback: 'rest'}, gax);
111+
* const client = new BackupForGKEClient({fallback: true}, gax);
113112
* ```
114113
*/
115114
constructor(
@@ -181,7 +180,7 @@ export class BackupForGKEClient {
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) {
@@ -261,7 +260,7 @@ export class BackupForGKEClient {
261260
auth: this.auth,
262261
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
263262
};
264-
if (opts.fallback === 'rest') {
263+
if (opts.fallback) {
265264
lroOptions.protoJson = protoFilesRoot;
266265
lroOptions.httpRules = [
267266
{

packages/google-cloud-gkeconnect-gateway/src/v1beta1/gateway_service_client.ts

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

packages/google-cloud-gkehub/src/v1/gke_hub_client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,15 @@ export class GkeHubClient {
109109
* API remote host.
110110
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
111111
* Follows the structure of {@link gapicConfig}.
112-
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
113-
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
112+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
114113
* For more information, please check the
115114
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
116115
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
117116
* need to avoid loading the default gRPC version and want to use the fallback
118117
* HTTP implementation. Load only fallback version and pass it to the constructor:
119118
* ```
120119
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
121-
* const client = new GkeHubClient({fallback: 'rest'}, gax);
120+
* const client = new GkeHubClient({fallback: true}, gax);
122121
* ```
123122
*/
124123
constructor(
@@ -184,7 +183,7 @@ export class GkeHubClient {
184183
}
185184
if (!opts.fallback) {
186185
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
187-
} else if (opts.fallback === 'rest') {
186+
} else {
188187
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
189188
}
190189
if (opts.libName && opts.libVersion) {
@@ -235,7 +234,7 @@ export class GkeHubClient {
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-gkehub/src/v1alpha/gke_hub_client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,15 @@ export class GkeHubClient {
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 GkeHubClient({fallback: 'rest'}, gax);
117+
* const client = new GkeHubClient({fallback: true}, gax);
119118
* ```
120119
*/
121120
constructor(
@@ -181,7 +180,7 @@ export class GkeHubClient {
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) {
@@ -218,7 +217,7 @@ export class GkeHubClient {
218217
auth: this.auth,
219218
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
220219
};
221-
if (opts.fallback === 'rest') {
220+
if (opts.fallback) {
222221
lroOptions.protoJson = protoFilesRoot;
223222
lroOptions.httpRules = [
224223
{

packages/google-cloud-gkehub/src/v1alpha2/gke_hub_client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,15 @@ export class GkeHubClient {
100100
* API remote host.
101101
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
102102
* Follows the structure of {@link gapicConfig}.
103-
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
104-
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
103+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
105104
* For more information, please check the
106105
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
107106
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
108107
* need to avoid loading the default gRPC version and want to use the fallback
109108
* HTTP implementation. Load only fallback version and pass it to the constructor:
110109
* ```
111110
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
112-
* const client = new GkeHubClient({fallback: 'rest'}, gax);
111+
* const client = new GkeHubClient({fallback: true}, gax);
113112
* ```
114113
*/
115114
constructor(
@@ -175,7 +174,7 @@ export class GkeHubClient {
175174
}
176175
if (!opts.fallback) {
177176
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
178-
} else if (opts.fallback === 'rest') {
177+
} else {
179178
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
180179
}
181180
if (opts.libName && opts.libVersion) {
@@ -218,7 +217,7 @@ export class GkeHubClient {
218217
auth: this.auth,
219218
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
220219
};
221-
if (opts.fallback === 'rest') {
220+
if (opts.fallback) {
222221
lroOptions.protoJson = protoFilesRoot;
223222
lroOptions.httpRules = [
224223
{

packages/google-cloud-gkehub/src/v1beta/gke_hub_client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,15 @@ export class GkeHubClient {
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 GkeHubClient({fallback: 'rest'}, gax);
117+
* const client = new GkeHubClient({fallback: true}, gax);
119118
* ```
120119
*/
121120
constructor(
@@ -181,7 +180,7 @@ export class GkeHubClient {
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) {
@@ -218,7 +217,7 @@ export class GkeHubClient {
218217
auth: this.auth,
219218
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
220219
};
221-
if (opts.fallback === 'rest') {
220+
if (opts.fallback) {
222221
lroOptions.protoJson = protoFilesRoot;
223222
lroOptions.httpRules = [
224223
{

0 commit comments

Comments
 (0)