@@ -23,6 +23,7 @@ import {
23
23
CallOptions ,
24
24
Descriptors ,
25
25
ClientOptions ,
26
+ GrpcClientOptions ,
26
27
LROperation ,
27
28
PaginationCallback ,
28
29
GaxCall ,
@@ -73,7 +74,7 @@ export class TagBindingsClient {
73
74
*
74
75
* @param {object } [options] - The configuration object.
75
76
* The options accepted by the constructor are described in detail
76
- * in [this document](https://github.com/googleapis/gax-nodejs/blob/master /client-libraries.md#creating-the-client-instance).
77
+ * in [this document](https://github.com/googleapis/gax-nodejs/blob/main /client-libraries.md#creating-the-client-instance).
77
78
* The common options are:
78
79
* @param {object } [options.credentials] - Credentials object.
79
80
* @param {string } [options.credentials.client_email]
@@ -96,11 +97,10 @@ export class TagBindingsClient {
96
97
* API remote host.
97
98
* @param {gax.ClientConfig } [options.clientConfig] - Client configuration override.
98
99
* Follows the structure of {@link gapicConfig}.
99
- * @param {boolean } [options.fallback] - Use HTTP fallback mode.
100
- * In fallback mode, a special browser-compatible transport implementation is used
101
- * instead of gRPC transport. In browser context (if the `window` object is defined)
102
- * the fallback mode is enabled automatically; set `options.fallback` to `false`
103
- * if you need to override this behavior.
100
+ * @param {boolean | "rest" } [options.fallback] - Use HTTP fallback mode.
101
+ * Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
102
+ * For more information, please check the
103
+ * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
104
104
*/
105
105
constructor ( opts ?: ClientOptions ) {
106
106
// Ensure that options include all the required fields.
@@ -195,16 +195,24 @@ export class TagBindingsClient {
195
195
} ;
196
196
197
197
const protoFilesRoot = this . _gaxModule . protobuf . Root . fromJSON ( jsonProtos ) ;
198
-
199
198
// This API contains "long-running operations", which return a
200
199
// an Operation object that allows for tracking of the operation,
201
200
// rather than holding a request open.
202
-
201
+ const lroOptions : GrpcClientOptions = {
202
+ auth : this . auth ,
203
+ grpc : 'grpc' in this . _gaxGrpc ? this . _gaxGrpc . grpc : undefined ,
204
+ } ;
205
+ if ( opts . fallback === 'rest' ) {
206
+ lroOptions . protoJson = protoFilesRoot ;
207
+ lroOptions . httpRules = [
208
+ {
209
+ selector : 'google.longrunning.Operations.GetOperation' ,
210
+ get : '/v3/{name=operations/**}' ,
211
+ } ,
212
+ ] ;
213
+ }
203
214
this . operationsClient = this . _gaxModule
204
- . lro ( {
205
- auth : this . auth ,
206
- grpc : 'grpc' in this . _gaxGrpc ? this . _gaxGrpc . grpc : undefined ,
207
- } )
215
+ . lro ( lroOptions )
208
216
. operationsClient ( opts ) ;
209
217
const createTagBindingResponse = protoFilesRoot . lookup (
210
218
'.google.cloud.resourcemanager.v3.TagBinding'
0 commit comments