@@ -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 ClusterControllerClient {
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 ClusterControllerClient {
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.
@@ -203,16 +203,129 @@ export class ClusterControllerClient {
203
203
} ;
204
204
205
205
const protoFilesRoot = this . _gaxModule . protobuf . Root . fromJSON ( jsonProtos ) ;
206
-
207
206
// This API contains "long-running operations", which return a
208
207
// an Operation object that allows for tracking of the operation,
209
208
// rather than holding a request open.
210
-
209
+ const lroOptions : GrpcClientOptions = {
210
+ auth : this . auth ,
211
+ grpc : 'grpc' in this . _gaxGrpc ? this . _gaxGrpc . grpc : undefined ,
212
+ } ;
213
+ if ( opts . fallback === 'rest' ) {
214
+ lroOptions . protoJson = protoFilesRoot ;
215
+ lroOptions . httpRules = [
216
+ {
217
+ selector : 'google.iam.v1.IAMPolicy.GetIamPolicy' ,
218
+ post : '/v1/{resource=projects/*/regions/*/clusters/*}:getIamPolicy' ,
219
+ body : '*' ,
220
+ additional_bindings : [
221
+ {
222
+ post : '/v1/{resource=projects/*/regions/*/jobs/*}:getIamPolicy' ,
223
+ body : '*' ,
224
+ } ,
225
+ {
226
+ post : '/v1/{resource=projects/*/regions/*/operations/*}:getIamPolicy' ,
227
+ body : '*' ,
228
+ } ,
229
+ {
230
+ post : '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:getIamPolicy' ,
231
+ body : '*' ,
232
+ } ,
233
+ {
234
+ post : '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:getIamPolicy' ,
235
+ body : '*' ,
236
+ } ,
237
+ {
238
+ post : '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:getIamPolicy' ,
239
+ body : '*' ,
240
+ } ,
241
+ {
242
+ post : '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:getIamPolicy' ,
243
+ body : '*' ,
244
+ } ,
245
+ ] ,
246
+ } ,
247
+ {
248
+ selector : 'google.iam.v1.IAMPolicy.SetIamPolicy' ,
249
+ post : '/v1/{resource=projects/*/regions/*/clusters/*}:setIamPolicy' ,
250
+ body : '*' ,
251
+ additional_bindings : [
252
+ {
253
+ post : '/v1/{resource=projects/*/regions/*/jobs/*}:setIamPolicy' ,
254
+ body : '*' ,
255
+ } ,
256
+ {
257
+ post : '/v1/{resource=projects/*/regions/*/operations/*}:setIamPolicy' ,
258
+ body : '*' ,
259
+ } ,
260
+ {
261
+ post : '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:setIamPolicy' ,
262
+ body : '*' ,
263
+ } ,
264
+ {
265
+ post : '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:setIamPolicy' ,
266
+ body : '*' ,
267
+ } ,
268
+ {
269
+ post : '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:setIamPolicy' ,
270
+ body : '*' ,
271
+ } ,
272
+ {
273
+ post : '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:setIamPolicy' ,
274
+ body : '*' ,
275
+ } ,
276
+ ] ,
277
+ } ,
278
+ {
279
+ selector : 'google.iam.v1.IAMPolicy.TestIamPermissions' ,
280
+ post : '/v1/{resource=projects/*/regions/*/clusters/*}:testIamPermissions' ,
281
+ body : '*' ,
282
+ additional_bindings : [
283
+ {
284
+ post : '/v1/{resource=projects/*/regions/*/jobs/*}:testIamPermissions' ,
285
+ body : '*' ,
286
+ } ,
287
+ {
288
+ post : '/v1/{resource=projects/*/regions/*/operations/*}:testIamPermissions' ,
289
+ body : '*' ,
290
+ } ,
291
+ {
292
+ post : '/v1/{resource=projects/*/regions/*/workflowTemplates/*}:testIamPermissions' ,
293
+ body : '*' ,
294
+ } ,
295
+ {
296
+ post : '/v1/{resource=projects/*/locations/*/workflowTemplates/*}:testIamPermissions' ,
297
+ body : '*' ,
298
+ } ,
299
+ {
300
+ post : '/v1/{resource=projects/*/regions/*/autoscalingPolicies/*}:testIamPermissions' ,
301
+ body : '*' ,
302
+ } ,
303
+ {
304
+ post : '/v1/{resource=projects/*/locations/*/autoscalingPolicies/*}:testIamPermissions' ,
305
+ body : '*' ,
306
+ } ,
307
+ ] ,
308
+ } ,
309
+ {
310
+ selector : 'google.longrunning.Operations.CancelOperation' ,
311
+ post : '/v1/{name=projects/*/regions/*/operations/*}:cancel' ,
312
+ } ,
313
+ {
314
+ selector : 'google.longrunning.Operations.DeleteOperation' ,
315
+ delete : '/v1/{name=projects/*/regions/*/operations/*}' ,
316
+ } ,
317
+ {
318
+ selector : 'google.longrunning.Operations.GetOperation' ,
319
+ get : '/v1/{name=projects/*/regions/*/operations/*}' ,
320
+ } ,
321
+ {
322
+ selector : 'google.longrunning.Operations.ListOperations' ,
323
+ get : '/v1/{name=projects/*/regions/*/operations}' ,
324
+ } ,
325
+ ] ;
326
+ }
211
327
this . operationsClient = this . _gaxModule
212
- . lro ( {
213
- auth : this . auth ,
214
- grpc : 'grpc' in this . _gaxGrpc ? this . _gaxGrpc . grpc : undefined ,
215
- } )
328
+ . lro ( lroOptions )
216
329
. operationsClient ( opts ) ;
217
330
const createClusterResponse = protoFilesRoot . lookup (
218
331
'.google.cloud.dataproc.v1.Cluster'
0 commit comments