@@ -23,6 +23,7 @@ import {
2323 CallOptions ,
2424 Descriptors ,
2525 ClientOptions ,
26+ GrpcClientOptions ,
2627 LROperation ,
2728} from 'google-gax' ;
2829
@@ -68,7 +69,7 @@ export class WorkflowsServiceV2BetaClient {
6869 *
6970 * @param {object } [options] - The configuration object.
7071 * The options accepted by the constructor are described in detail
71- * in [this document](https://github.com/googleapis/gax-nodejs/blob/master /client-libraries.md#creating-the-client-instance).
72+ * in [this document](https://github.com/googleapis/gax-nodejs/blob/main /client-libraries.md#creating-the-client-instance).
7273 * The common options are:
7374 * @param {object } [options.credentials] - Credentials object.
7475 * @param {string } [options.credentials.client_email]
@@ -91,11 +92,10 @@ export class WorkflowsServiceV2BetaClient {
9192 * API remote host.
9293 * @param {gax.ClientConfig } [options.clientConfig] - Client configuration override.
9394 * Follows the structure of {@link gapicConfig}.
94- * @param {boolean } [options.fallback] - Use HTTP fallback mode.
95- * In fallback mode, a special browser-compatible transport implementation is used
96- * instead of gRPC transport. In browser context (if the `window` object is defined)
97- * the fallback mode is enabled automatically; set `options.fallback` to `false`
98- * if you need to override this behavior.
95+ * @param {boolean | "rest" } [options.fallback] - Use HTTP fallback mode.
96+ * Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
97+ * For more information, please check the
98+ * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
9999 */
100100 constructor ( opts ?: ClientOptions ) {
101101 // Ensure that options include all the required fields.
@@ -160,16 +160,41 @@ export class WorkflowsServiceV2BetaClient {
160160 this . _protos = this . _gaxGrpc . loadProtoJSON ( jsonProtos ) ;
161161
162162 const protoFilesRoot = this . _gaxModule . protobuf . Root . fromJSON ( jsonProtos ) ;
163-
164163 // This API contains "long-running operations", which return a
165164 // an Operation object that allows for tracking of the operation,
166165 // rather than holding a request open.
167-
166+ const lroOptions : GrpcClientOptions = {
167+ auth : this . auth ,
168+ grpc : 'grpc' in this . _gaxGrpc ? this . _gaxGrpc . grpc : undefined ,
169+ } ;
170+ if ( opts . fallback === 'rest' ) {
171+ lroOptions . protoJson = protoFilesRoot ;
172+ lroOptions . httpRules = [
173+ {
174+ selector : 'google.cloud.location.Locations.GetLocation' ,
175+ get : '/v2beta/{name=projects/*/locations/*}' ,
176+ } ,
177+ {
178+ selector : 'google.cloud.location.Locations.ListLocations' ,
179+ get : '/v2beta/{name=projects/*}/locations' ,
180+ } ,
181+ {
182+ selector : 'google.longrunning.Operations.CancelOperation' ,
183+ post : '/v2beta/{name=projects/*/locations/*/operations/*}:cancel' ,
184+ body : '*' ,
185+ } ,
186+ {
187+ selector : 'google.longrunning.Operations.GetOperation' ,
188+ get : '/v2beta/{name=projects/*/locations/*/operations/*}' ,
189+ } ,
190+ {
191+ selector : 'google.longrunning.Operations.ListOperations' ,
192+ get : '/v2beta/{name=projects/*/locations/*}/operations' ,
193+ } ,
194+ ] ;
195+ }
168196 this . operationsClient = this . _gaxModule
169- . lro ( {
170- auth : this . auth ,
171- grpc : 'grpc' in this . _gaxGrpc ? this . _gaxGrpc . grpc : undefined ,
172- } )
197+ . lro ( lroOptions )
173198 . operationsClient ( opts ) ;
174199 const runPipelineResponse = protoFilesRoot . lookup (
175200 '.google.cloud.lifesciences.v2beta.RunPipelineResponse'
0 commit comments