Skip to content

Commit

Permalink
fix: [Many APIs] simplify logic for HTTP/1.1 REST fallback option (#4588
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: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXNlY3JldG1hbmFnZXIvLk93bEJvdC55YW1sIiwiaCI6IjU2YzE2NjU3ZTdhNTkxMjJiMWRhOTQ3NzFhOWVmNDA5ODljMjgyYzAifQ==
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXNlY3VyaXR5LXByaXZhdGVjYS8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXNlY3VyaXR5LXB1YmxpY2NhLy5Pd2xCb3QueWFtbCIsImgiOiI1NmMxNjY1N2U3YTU5MTIyYjFkYTk0NzcxYTllZjQwOTg5YzI4MmMwIn0=
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXNlY3VyaXR5Y2VudGVyLy5Pd2xCb3QueWFtbCIsImgiOiI1NmMxNjY1N2U3YTU5MTIyYjFkYTk0NzcxYTllZjQwOTg5YzI4MmMwIn0=
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXNlcnZpY2VkaXJlY3RvcnkvLk93bEJvdC55YW1sIiwiaCI6IjU2YzE2NjU3ZTdhNTkxMjJiMWRhOTQ3NzFhOWVmNDA5ODljMjgyYzAifQ==
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLX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llZjQwOTg5YzI4MmMwIn0=

* 🦉 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 07967ad commit e5ad564
Show file tree
Hide file tree
Showing 64 changed files with 244 additions and 297 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,15 @@ export class SecretManagerServiceClient {
* 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 SecretManagerServiceClient({fallback: 'rest'}, gax);
* const client = new SecretManagerServiceClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -171,7 +170,7 @@ export class SecretManagerServiceClient {
}
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 @@ -101,16 +101,15 @@ export class CertificateAuthorityServiceClient {
* 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 CertificateAuthorityServiceClient({fallback: 'rest'}, gax);
* const client = new CertificateAuthorityServiceClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -183,7 +182,7 @@ export class CertificateAuthorityServiceClient {
}
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 @@ -255,7 +254,7 @@ export class CertificateAuthorityServiceClient {
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 @@ -94,16 +94,15 @@ export class CertificateAuthorityServiceClient {
* 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 CertificateAuthorityServiceClient({fallback: 'rest'}, gax);
* const client = new CertificateAuthorityServiceClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -170,7 +169,7 @@ export class CertificateAuthorityServiceClient {
}
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 @@ -234,7 +233,7 @@ export class CertificateAuthorityServiceClient {
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 @@ -2547,8 +2547,9 @@ describe('v1beta1.CertificateAuthorityServiceClient', () => {
);
client.innerApiCalls.scheduleDeleteCertificateAuthority =
stubLongRunningCall(expectedResponse);
const [operation] =
await client.scheduleDeleteCertificateAuthority(request);
const [operation] = await client.scheduleDeleteCertificateAuthority(
request
);
const [response] = await operation.promise();
assert.deepStrictEqual(response, expectedResponse);
const actualRequest = (
Expand Down Expand Up @@ -2674,8 +2675,9 @@ describe('v1beta1.CertificateAuthorityServiceClient', () => {
const expectedError = new Error('expected');
client.innerApiCalls.scheduleDeleteCertificateAuthority =
stubLongRunningCall(undefined, undefined, expectedError);
const [operation] =
await client.scheduleDeleteCertificateAuthority(request);
const [operation] = await client.scheduleDeleteCertificateAuthority(
request
);
await assert.rejects(operation.promise(), expectedError);
const actualRequest = (
client.innerApiCalls.scheduleDeleteCertificateAuthority as SinonStub
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,15 @@ export class PublicCertificateAuthorityServiceClient {
* 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 PublicCertificateAuthorityServiceClient({fallback: 'rest'}, gax);
* const client = new PublicCertificateAuthorityServiceClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -166,7 +165,7 @@ export class PublicCertificateAuthorityServiceClient {
}
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 SecurityCenterClient {
* 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 SecurityCenterClient({fallback: 'rest'}, gax);
* const client = new SecurityCenterClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -168,7 +167,7 @@ export class SecurityCenterClient {
}
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 @@ -378,7 +377,7 @@ export class SecurityCenterClient {
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 @@ -93,16 +93,15 @@ export class SecurityCenterClient {
* 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 SecurityCenterClient({fallback: 'rest'}, gax);
* const client = new SecurityCenterClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -168,7 +167,7 @@ export class SecurityCenterClient {
}
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 @@ -245,7 +244,7 @@ export class SecurityCenterClient {
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 @@ -93,16 +93,15 @@ export class SecurityCenterClient {
* 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 SecurityCenterClient({fallback: 'rest'}, gax);
* const client = new SecurityCenterClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -168,7 +167,7 @@ export class SecurityCenterClient {
}
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 @@ -285,7 +284,7 @@ export class SecurityCenterClient {
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 @@ -280,8 +280,9 @@ describe('v1.SecurityCenterClient', () => {
);
client.innerApiCalls.createSecurityHealthAnalyticsCustomModule =
stubSimpleCall(expectedResponse);
const [response] =
await client.createSecurityHealthAnalyticsCustomModule(request);
const [response] = await client.createSecurityHealthAnalyticsCustomModule(
request
);
assert.deepStrictEqual(response, expectedResponse);
const actualRequest = (
client.innerApiCalls
Expand Down Expand Up @@ -1216,8 +1217,9 @@ describe('v1.SecurityCenterClient', () => {
);
client.innerApiCalls.deleteSecurityHealthAnalyticsCustomModule =
stubSimpleCall(expectedResponse);
const [response] =
await client.deleteSecurityHealthAnalyticsCustomModule(request);
const [response] = await client.deleteSecurityHealthAnalyticsCustomModule(
request
);
assert.deepStrictEqual(response, expectedResponse);
const actualRequest = (
client.innerApiCalls
Expand Down Expand Up @@ -2164,8 +2166,9 @@ describe('v1.SecurityCenterClient', () => {
);
client.innerApiCalls.getSecurityHealthAnalyticsCustomModule =
stubSimpleCall(expectedResponse);
const [response] =
await client.getSecurityHealthAnalyticsCustomModule(request);
const [response] = await client.getSecurityHealthAnalyticsCustomModule(
request
);
assert.deepStrictEqual(response, expectedResponse);
const actualRequest = (
client.innerApiCalls.getSecurityHealthAnalyticsCustomModule as SinonStub
Expand Down Expand Up @@ -3631,8 +3634,9 @@ describe('v1.SecurityCenterClient', () => {
);
client.innerApiCalls.updateSecurityHealthAnalyticsCustomModule =
stubSimpleCall(expectedResponse);
const [response] =
await client.updateSecurityHealthAnalyticsCustomModule(request);
const [response] = await client.updateSecurityHealthAnalyticsCustomModule(
request
);
assert.deepStrictEqual(response, expectedResponse);
const actualRequest = (
client.innerApiCalls
Expand Down Expand Up @@ -7677,8 +7681,9 @@ describe('v1.SecurityCenterClient', () => {
];
client.innerApiCalls.listSecurityHealthAnalyticsCustomModules =
stubSimpleCall(expectedResponse);
const [response] =
await client.listSecurityHealthAnalyticsCustomModules(request);
const [response] = await client.listSecurityHealthAnalyticsCustomModules(
request
);
assert.deepStrictEqual(response, expectedResponse);
const actualRequest = (
client.innerApiCalls
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,15 @@ export class LookupServiceClient {
* 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 LookupServiceClient({fallback: 'rest'}, gax);
* const client = new LookupServiceClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -170,7 +169,7 @@ export class LookupServiceClient {
}
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 @@ -107,16 +107,15 @@ export class RegistrationServiceClient {
* 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 RegistrationServiceClient({fallback: 'rest'}, gax);
* const client = new RegistrationServiceClient({fallback: true}, gax);
* ```
*/
constructor(
Expand Down Expand Up @@ -186,7 +185,7 @@ export class RegistrationServiceClient {
}
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
Loading

0 comments on commit e5ad564

Please sign in to comment.