@@ -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 ,
@@ -79,7 +80,7 @@ export class CertificateAuthorityServiceClient {
79
80
*
80
81
* @param {object } [options] - The configuration object.
81
82
* The options accepted by the constructor are described in detail
82
- * in [this document](https://github.com/googleapis/gax-nodejs/blob/master /client-libraries.md#creating-the-client-instance).
83
+ * in [this document](https://github.com/googleapis/gax-nodejs/blob/main /client-libraries.md#creating-the-client-instance).
83
84
* The common options are:
84
85
* @param {object } [options.credentials] - Credentials object.
85
86
* @param {string } [options.credentials.client_email]
@@ -102,11 +103,10 @@ export class CertificateAuthorityServiceClient {
102
103
* API remote host.
103
104
* @param {gax.ClientConfig } [options.clientConfig] - Client configuration override.
104
105
* Follows the structure of {@link gapicConfig}.
105
- * @param {boolean } [options.fallback] - Use HTTP fallback mode.
106
- * In fallback mode, a special browser-compatible transport implementation is used
107
- * instead of gRPC transport. In browser context (if the `window` object is defined)
108
- * the fallback mode is enabled automatically; set `options.fallback` to `false`
109
- * if you need to override this behavior.
106
+ * @param {boolean | "rest" } [options.fallback] - Use HTTP fallback mode.
107
+ * Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
108
+ * For more information, please check the
109
+ * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
110
110
*/
111
111
constructor ( opts ?: ClientOptions ) {
112
112
// Ensure that options include all the required fields.
@@ -229,16 +229,87 @@ export class CertificateAuthorityServiceClient {
229
229
} ;
230
230
231
231
const protoFilesRoot = this . _gaxModule . protobuf . Root . fromJSON ( jsonProtos ) ;
232
-
233
232
// This API contains "long-running operations", which return a
234
233
// an Operation object that allows for tracking of the operation,
235
234
// rather than holding a request open.
236
-
235
+ const lroOptions : GrpcClientOptions = {
236
+ auth : this . auth ,
237
+ grpc : 'grpc' in this . _gaxGrpc ? this . _gaxGrpc . grpc : undefined ,
238
+ } ;
239
+ if ( opts . fallback === 'rest' ) {
240
+ lroOptions . protoJson = protoFilesRoot ;
241
+ lroOptions . httpRules = [
242
+ {
243
+ selector : 'google.cloud.location.Locations.GetLocation' ,
244
+ get : '/v1/{name=projects/*/locations/*}' ,
245
+ } ,
246
+ {
247
+ selector : 'google.cloud.location.Locations.ListLocations' ,
248
+ get : '/v1/{name=projects/*}/locations' ,
249
+ } ,
250
+ {
251
+ selector : 'google.iam.v1.IAMPolicy.GetIamPolicy' ,
252
+ get : '/v1/{resource=projects/*/locations/*/caPools/*}:getIamPolicy' ,
253
+ additional_bindings : [
254
+ {
255
+ get : '/v1/{resource=projects/*/locations/*/certificateTemplates/*}:getIamPolicy' ,
256
+ } ,
257
+ {
258
+ get : '/v1/{resource=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}:getIamPolicy' ,
259
+ } ,
260
+ ] ,
261
+ } ,
262
+ {
263
+ selector : 'google.iam.v1.IAMPolicy.SetIamPolicy' ,
264
+ post : '/v1/{resource=projects/*/locations/*/caPools/*}:setIamPolicy' ,
265
+ body : '*' ,
266
+ additional_bindings : [
267
+ {
268
+ post : '/v1/{resource=projects/*/locations/*/certificateTemplates/*}:setIamPolicy' ,
269
+ body : '*' ,
270
+ } ,
271
+ {
272
+ post : '/v1/{resource=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}:setIamPolicy' ,
273
+ body : '*' ,
274
+ } ,
275
+ ] ,
276
+ } ,
277
+ {
278
+ selector : 'google.iam.v1.IAMPolicy.TestIamPermissions' ,
279
+ post : '/v1/{resource=projects/*/locations/*/caPools/*}:testIamPermissions' ,
280
+ body : '*' ,
281
+ additional_bindings : [
282
+ {
283
+ post : '/v1/{resource=projects/*/locations/*/certificateTemplates/*}:testIamPermissions' ,
284
+ body : '*' ,
285
+ } ,
286
+ {
287
+ post : '/v1/{resource=projects/*/locations/*/caPools/*/certificateAuthorities/*/certificateRevocationLists/*}:testIamPermissions' ,
288
+ body : '*' ,
289
+ } ,
290
+ ] ,
291
+ } ,
292
+ {
293
+ selector : 'google.longrunning.Operations.CancelOperation' ,
294
+ post : '/v1/{name=projects/*/locations/*/operations/*}:cancel' ,
295
+ body : '*' ,
296
+ } ,
297
+ {
298
+ selector : 'google.longrunning.Operations.DeleteOperation' ,
299
+ delete : '/v1/{name=projects/*/locations/*/operations/*}' ,
300
+ } ,
301
+ {
302
+ selector : 'google.longrunning.Operations.GetOperation' ,
303
+ get : '/v1/{name=projects/*/locations/*/operations/*}' ,
304
+ } ,
305
+ {
306
+ selector : 'google.longrunning.Operations.ListOperations' ,
307
+ get : '/v1/{name=projects/*/locations/*}/operations' ,
308
+ } ,
309
+ ] ;
310
+ }
237
311
this . operationsClient = this . _gaxModule
238
- . lro ( {
239
- auth : this . auth ,
240
- grpc : 'grpc' in this . _gaxGrpc ? this . _gaxGrpc . grpc : undefined ,
241
- } )
312
+ . lro ( lroOptions )
242
313
. operationsClient ( opts ) ;
243
314
const activateCertificateAuthorityResponse = protoFilesRoot . lookup (
244
315
'.google.cloud.security.privateca.v1.CertificateAuthority'
0 commit comments