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