@google-cloud/storage-control 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -99,26 +99,17 @@ class StorageControlClient {
99
99
  constructor(opts, gaxInstance) {
100
100
  // Ensure that options include all the required fields.
101
101
  const staticMembers = this.constructor;
102
- if (opts?.universe_domain &&
103
- opts?.universeDomain &&
104
- opts?.universe_domain !== opts?.universeDomain) {
102
+ if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) {
105
103
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
106
104
  }
107
- const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
108
- ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
109
- : undefined;
110
- this._universeDomain =
111
- opts?.universeDomain ??
112
- opts?.universe_domain ??
113
- universeDomainEnvVar ??
114
- 'googleapis.com';
105
+ const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined;
106
+ this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com';
115
107
  this._servicePath = 'storage.' + this._universeDomain;
116
108
  const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
117
109
  this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
118
110
  const port = opts?.port || staticMembers.port;
119
111
  const clientConfig = opts?.clientConfig ?? {};
120
- const fallback = opts?.fallback ??
121
- (typeof window !== 'undefined' && typeof window?.fetch === 'function');
112
+ const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function');
122
113
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
123
114
  // Request numeric enum values if REST transport is used.
124
115
  opts.numericEnums = true;
@@ -147,7 +138,10 @@ class StorageControlClient {
147
138
  this.auth.defaultScopes = staticMembers.scopes;
148
139
  }
149
140
  // Determine the client header string.
150
- const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
141
+ const clientHeader = [
142
+ `gax/${this._gaxModule.version}`,
143
+ `gapic/${version}`,
144
+ ];
151
145
  if (typeof process === 'object' && 'versions' in process) {
152
146
  clientHeader.push(`gl-node/${process.versions.node}`);
153
147
  }
@@ -169,10 +163,14 @@ class StorageControlClient {
169
163
  // identifiers to uniquely identify resources within the API.
170
164
  // Create useful helper objects for these.
171
165
  this.pathTemplates = {
166
+ anywhereCachePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/buckets/{bucket}/anywhereCaches/{anywhere_cache}'),
172
167
  bucketPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/buckets/{bucket}'),
173
168
  folderPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/buckets/{bucket}/folders/{folder=**}'),
169
+ folderLocationIntelligenceConfigPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/locations/{location}/intelligenceConfig'),
174
170
  managedFolderPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/buckets/{bucket}/managedFolders/{managed_folder=**}'),
171
+ orgLocationIntelligenceConfigPathTemplate: new this._gaxModule.PathTemplate('organizations/{org}/locations/{location}/intelligenceConfig'),
175
172
  projectPathTemplate: new this._gaxModule.PathTemplate('projects/{project}'),
173
+ projectLocationIntelligenceConfigPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/intelligenceConfig'),
176
174
  storageLayoutPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/buckets/{bucket}/storageLayout'),
177
175
  };
178
176
  // Some of the methods on this service return "paged" results,
@@ -181,26 +179,31 @@ class StorageControlClient {
181
179
  this.descriptors.page = {
182
180
  listFolders: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'folders'),
183
181
  listManagedFolders: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'managedFolders'),
182
+ listAnywhereCaches: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'anywhereCaches')
184
183
  };
185
- const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
184
+ const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos);
186
185
  // This API contains "long-running operations", which return a
187
186
  // an Operation object that allows for tracking of the operation,
188
187
  // rather than holding a request open.
189
188
  const lroOptions = {
190
189
  auth: this.auth,
191
- grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
190
+ grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined
192
191
  };
193
192
  if (opts.fallback) {
194
193
  lroOptions.protoJson = protoFilesRoot;
195
194
  lroOptions.httpRules = [];
196
195
  }
197
- this.operationsClient = this._gaxModule
198
- .lro(lroOptions)
199
- .operationsClient(opts);
196
+ this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts);
200
197
  const renameFolderResponse = protoFilesRoot.lookup('.google.storage.control.v2.Folder');
201
198
  const renameFolderMetadata = protoFilesRoot.lookup('.google.storage.control.v2.RenameFolderMetadata');
199
+ const createAnywhereCacheResponse = protoFilesRoot.lookup('.google.storage.control.v2.AnywhereCache');
200
+ const createAnywhereCacheMetadata = protoFilesRoot.lookup('.google.storage.control.v2.CreateAnywhereCacheMetadata');
201
+ const updateAnywhereCacheResponse = protoFilesRoot.lookup('.google.storage.control.v2.AnywhereCache');
202
+ const updateAnywhereCacheMetadata = protoFilesRoot.lookup('.google.storage.control.v2.UpdateAnywhereCacheMetadata');
202
203
  this.descriptors.longrunning = {
203
204
  renameFolder: new this._gaxModule.LongrunningDescriptor(this.operationsClient, renameFolderResponse.decode.bind(renameFolderResponse), renameFolderMetadata.decode.bind(renameFolderMetadata)),
205
+ createAnywhereCache: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createAnywhereCacheResponse.decode.bind(createAnywhereCacheResponse), createAnywhereCacheMetadata.decode.bind(createAnywhereCacheMetadata)),
206
+ updateAnywhereCache: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateAnywhereCacheResponse.decode.bind(updateAnywhereCacheResponse), updateAnywhereCacheMetadata.decode.bind(updateAnywhereCacheMetadata))
204
207
  };
205
208
  // Put together the default options sent with requests.
206
209
  this._defaults = this._gaxGrpc.constructSettings('google.storage.control.v2.StorageControl', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
@@ -229,24 +232,13 @@ class StorageControlClient {
229
232
  }
230
233
  // Put together the "service stub" for
231
234
  // google.storage.control.v2.StorageControl.
232
- this.storageControlStub = this._gaxGrpc.createStub(this._opts.fallback
233
- ? this._protos.lookupService('google.storage.control.v2.StorageControl')
234
- : // eslint-disable-next-line @typescript-eslint/no-explicit-any
235
- this._protos.google.storage.control.v2.StorageControl, this._opts, this._providedCustomServicePath);
235
+ this.storageControlStub = this._gaxGrpc.createStub(this._opts.fallback ?
236
+ this._protos.lookupService('google.storage.control.v2.StorageControl') :
237
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
238
+ this._protos.google.storage.control.v2.StorageControl, this._opts, this._providedCustomServicePath);
236
239
  // Iterate over each of the methods that the service provides
237
240
  // and create an API call method for each.
238
- const storageControlStubMethods = [
239
- 'createFolder',
240
- 'deleteFolder',
241
- 'getFolder',
242
- 'listFolders',
243
- 'renameFolder',
244
- 'getStorageLayout',
245
- 'createManagedFolder',
246
- 'deleteManagedFolder',
247
- 'getManagedFolder',
248
- 'listManagedFolders',
249
- ];
241
+ const storageControlStubMethods = ['createFolder', 'deleteFolder', 'getFolder', 'listFolders', 'renameFolder', 'getStorageLayout', 'createManagedFolder', 'deleteManagedFolder', 'getManagedFolder', 'listManagedFolders', 'createAnywhereCache', 'updateAnywhereCache', 'disableAnywhereCache', 'pauseAnywhereCache', 'resumeAnywhereCache', 'getAnywhereCache', 'listAnywhereCaches', 'getProjectIntelligenceConfig', 'updateProjectIntelligenceConfig', 'getFolderIntelligenceConfig', 'updateFolderIntelligenceConfig', 'getOrganizationIntelligenceConfig', 'updateOrganizationIntelligenceConfig'];
250
242
  for (const methodName of storageControlStubMethods) {
251
243
  const callPromise = this.storageControlStub.then(stub => (...args) => {
252
244
  if (this._terminated) {
@@ -271,8 +263,7 @@ class StorageControlClient {
271
263
  * @returns {string} The DNS address for this service.
272
264
  */
273
265
  static get servicePath() {
274
- if (typeof process === 'object' &&
275
- typeof process.emitWarning === 'function') {
266
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
276
267
  process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
277
268
  }
278
269
  return 'storage.googleapis.com';
@@ -283,8 +274,7 @@ class StorageControlClient {
283
274
  * @returns {string} The DNS address for this service.
284
275
  */
285
276
  static get apiEndpoint() {
286
- if (typeof process === 'object' &&
287
- typeof process.emitWarning === 'function') {
277
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
288
278
  process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
289
279
  }
290
280
  return 'storage.googleapis.com';
@@ -317,7 +307,7 @@ class StorageControlClient {
317
307
  'https://www.googleapis.com/auth/cloud-platform.read-only',
318
308
  'https://www.googleapis.com/auth/devstorage.full_control',
319
309
  'https://www.googleapis.com/auth/devstorage.read_only',
320
- 'https://www.googleapis.com/auth/devstorage.read_write',
310
+ 'https://www.googleapis.com/auth/devstorage.read_write'
321
311
  ];
322
312
  }
323
313
  /**
@@ -347,7 +337,7 @@ class StorageControlClient {
347
337
  options = options || {};
348
338
  options.otherArgs = options.otherArgs || {};
349
339
  options.otherArgs.headers = options.otherArgs.headers || {};
350
- const routingParameter = {};
340
+ let routingParameter = {};
351
341
  {
352
342
  const fieldValue = request.parent;
353
343
  if (fieldValue !== undefined && fieldValue !== null) {
@@ -358,11 +348,8 @@ class StorageControlClient {
358
348
  }
359
349
  }
360
350
  }
361
- options.otherArgs.headers['x-goog-request-params'] =
362
- this._gaxModule.routingHeader.fromParams(routingParameter);
363
- this.initialize().catch(err => {
364
- throw err;
365
- });
351
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
352
+ this.initialize().catch(err => { throw err; });
366
353
  this._log.info('createFolder request %j', request);
367
354
  const wrappedCallback = callback
368
355
  ? (error, response, options, rawResponse) => {
@@ -370,11 +357,16 @@ class StorageControlClient {
370
357
  callback(error, response, options, rawResponse); // We verified callback above.
371
358
  }
372
359
  : undefined;
373
- return this.innerApiCalls
374
- .createFolder(request, options, wrappedCallback)
360
+ return this.innerApiCalls.createFolder(request, options, wrappedCallback)
375
361
  ?.then(([response, options, rawResponse]) => {
376
362
  this._log.info('createFolder response %j', response);
377
363
  return [response, options, rawResponse];
364
+ }).catch((error) => {
365
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
366
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
367
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
368
+ }
369
+ throw error;
378
370
  });
379
371
  }
380
372
  deleteFolder(request, optionsOrCallback, callback) {
@@ -393,24 +385,19 @@ class StorageControlClient {
393
385
  options = options || {};
394
386
  options.otherArgs = options.otherArgs || {};
395
387
  options.otherArgs.headers = options.otherArgs.headers || {};
396
- const routingParameter = {};
388
+ let routingParameter = {};
397
389
  {
398
390
  const fieldValue = request.name;
399
391
  if (fieldValue !== undefined && fieldValue !== null) {
400
- const match = fieldValue
401
- .toString()
402
- .match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
392
+ const match = fieldValue.toString().match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
403
393
  if (match) {
404
394
  const parameterValue = match.groups?.['bucket'] ?? fieldValue;
405
395
  Object.assign(routingParameter, { bucket: parameterValue });
406
396
  }
407
397
  }
408
398
  }
409
- options.otherArgs.headers['x-goog-request-params'] =
410
- this._gaxModule.routingHeader.fromParams(routingParameter);
411
- this.initialize().catch(err => {
412
- throw err;
413
- });
399
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
400
+ this.initialize().catch(err => { throw err; });
414
401
  this._log.info('deleteFolder request %j', request);
415
402
  const wrappedCallback = callback
416
403
  ? (error, response, options, rawResponse) => {
@@ -418,11 +405,16 @@ class StorageControlClient {
418
405
  callback(error, response, options, rawResponse); // We verified callback above.
419
406
  }
420
407
  : undefined;
421
- return this.innerApiCalls
422
- .deleteFolder(request, options, wrappedCallback)
408
+ return this.innerApiCalls.deleteFolder(request, options, wrappedCallback)
423
409
  ?.then(([response, options, rawResponse]) => {
424
410
  this._log.info('deleteFolder response %j', response);
425
411
  return [response, options, rawResponse];
412
+ }).catch((error) => {
413
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
414
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
415
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
416
+ }
417
+ throw error;
426
418
  });
427
419
  }
428
420
  getFolder(request, optionsOrCallback, callback) {
@@ -441,24 +433,19 @@ class StorageControlClient {
441
433
  options = options || {};
442
434
  options.otherArgs = options.otherArgs || {};
443
435
  options.otherArgs.headers = options.otherArgs.headers || {};
444
- const routingParameter = {};
436
+ let routingParameter = {};
445
437
  {
446
438
  const fieldValue = request.name;
447
439
  if (fieldValue !== undefined && fieldValue !== null) {
448
- const match = fieldValue
449
- .toString()
450
- .match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
440
+ const match = fieldValue.toString().match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
451
441
  if (match) {
452
442
  const parameterValue = match.groups?.['bucket'] ?? fieldValue;
453
443
  Object.assign(routingParameter, { bucket: parameterValue });
454
444
  }
455
445
  }
456
446
  }
457
- options.otherArgs.headers['x-goog-request-params'] =
458
- this._gaxModule.routingHeader.fromParams(routingParameter);
459
- this.initialize().catch(err => {
460
- throw err;
461
- });
447
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
448
+ this.initialize().catch(err => { throw err; });
462
449
  this._log.info('getFolder request %j', request);
463
450
  const wrappedCallback = callback
464
451
  ? (error, response, options, rawResponse) => {
@@ -466,11 +453,16 @@ class StorageControlClient {
466
453
  callback(error, response, options, rawResponse); // We verified callback above.
467
454
  }
468
455
  : undefined;
469
- return this.innerApiCalls
470
- .getFolder(request, options, wrappedCallback)
456
+ return this.innerApiCalls.getFolder(request, options, wrappedCallback)
471
457
  ?.then(([response, options, rawResponse]) => {
472
458
  this._log.info('getFolder response %j', response);
473
459
  return [response, options, rawResponse];
460
+ }).catch((error) => {
461
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
462
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
463
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
464
+ }
465
+ throw error;
474
466
  });
475
467
  }
476
468
  getStorageLayout(request, optionsOrCallback, callback) {
@@ -489,24 +481,19 @@ class StorageControlClient {
489
481
  options = options || {};
490
482
  options.otherArgs = options.otherArgs || {};
491
483
  options.otherArgs.headers = options.otherArgs.headers || {};
492
- const routingParameter = {};
484
+ let routingParameter = {};
493
485
  {
494
486
  const fieldValue = request.name;
495
487
  if (fieldValue !== undefined && fieldValue !== null) {
496
- const match = fieldValue
497
- .toString()
498
- .match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
488
+ const match = fieldValue.toString().match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
499
489
  if (match) {
500
490
  const parameterValue = match.groups?.['bucket'] ?? fieldValue;
501
491
  Object.assign(routingParameter, { bucket: parameterValue });
502
492
  }
503
493
  }
504
494
  }
505
- options.otherArgs.headers['x-goog-request-params'] =
506
- this._gaxModule.routingHeader.fromParams(routingParameter);
507
- this.initialize().catch(err => {
508
- throw err;
509
- });
495
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
496
+ this.initialize().catch(err => { throw err; });
510
497
  this._log.info('getStorageLayout request %j', request);
511
498
  const wrappedCallback = callback
512
499
  ? (error, response, options, rawResponse) => {
@@ -514,11 +501,16 @@ class StorageControlClient {
514
501
  callback(error, response, options, rawResponse); // We verified callback above.
515
502
  }
516
503
  : undefined;
517
- return this.innerApiCalls
518
- .getStorageLayout(request, options, wrappedCallback)
504
+ return this.innerApiCalls.getStorageLayout(request, options, wrappedCallback)
519
505
  ?.then(([response, options, rawResponse]) => {
520
506
  this._log.info('getStorageLayout response %j', response);
521
507
  return [response, options, rawResponse];
508
+ }).catch((error) => {
509
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
510
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
511
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
512
+ }
513
+ throw error;
522
514
  });
523
515
  }
524
516
  createManagedFolder(request, optionsOrCallback, callback) {
@@ -537,7 +529,7 @@ class StorageControlClient {
537
529
  options = options || {};
538
530
  options.otherArgs = options.otherArgs || {};
539
531
  options.otherArgs.headers = options.otherArgs.headers || {};
540
- const routingParameter = {};
532
+ let routingParameter = {};
541
533
  {
542
534
  const fieldValue = request.parent;
543
535
  if (fieldValue !== undefined && fieldValue !== null) {
@@ -548,11 +540,8 @@ class StorageControlClient {
548
540
  }
549
541
  }
550
542
  }
551
- options.otherArgs.headers['x-goog-request-params'] =
552
- this._gaxModule.routingHeader.fromParams(routingParameter);
553
- this.initialize().catch(err => {
554
- throw err;
555
- });
543
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
544
+ this.initialize().catch(err => { throw err; });
556
545
  this._log.info('createManagedFolder request %j', request);
557
546
  const wrappedCallback = callback
558
547
  ? (error, response, options, rawResponse) => {
@@ -560,11 +549,16 @@ class StorageControlClient {
560
549
  callback(error, response, options, rawResponse); // We verified callback above.
561
550
  }
562
551
  : undefined;
563
- return this.innerApiCalls
564
- .createManagedFolder(request, options, wrappedCallback)
552
+ return this.innerApiCalls.createManagedFolder(request, options, wrappedCallback)
565
553
  ?.then(([response, options, rawResponse]) => {
566
554
  this._log.info('createManagedFolder response %j', response);
567
555
  return [response, options, rawResponse];
556
+ }).catch((error) => {
557
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
558
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
559
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
560
+ }
561
+ throw error;
568
562
  });
569
563
  }
570
564
  deleteManagedFolder(request, optionsOrCallback, callback) {
@@ -583,24 +577,19 @@ class StorageControlClient {
583
577
  options = options || {};
584
578
  options.otherArgs = options.otherArgs || {};
585
579
  options.otherArgs.headers = options.otherArgs.headers || {};
586
- const routingParameter = {};
580
+ let routingParameter = {};
587
581
  {
588
582
  const fieldValue = request.name;
589
583
  if (fieldValue !== undefined && fieldValue !== null) {
590
- const match = fieldValue
591
- .toString()
592
- .match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
584
+ const match = fieldValue.toString().match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
593
585
  if (match) {
594
586
  const parameterValue = match.groups?.['bucket'] ?? fieldValue;
595
587
  Object.assign(routingParameter, { bucket: parameterValue });
596
588
  }
597
589
  }
598
590
  }
599
- options.otherArgs.headers['x-goog-request-params'] =
600
- this._gaxModule.routingHeader.fromParams(routingParameter);
601
- this.initialize().catch(err => {
602
- throw err;
603
- });
591
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
592
+ this.initialize().catch(err => { throw err; });
604
593
  this._log.info('deleteManagedFolder request %j', request);
605
594
  const wrappedCallback = callback
606
595
  ? (error, response, options, rawResponse) => {
@@ -608,14 +597,535 @@ class StorageControlClient {
608
597
  callback(error, response, options, rawResponse); // We verified callback above.
609
598
  }
610
599
  : undefined;
611
- return this.innerApiCalls
612
- .deleteManagedFolder(request, options, wrappedCallback)
600
+ return this.innerApiCalls.deleteManagedFolder(request, options, wrappedCallback)
613
601
  ?.then(([response, options, rawResponse]) => {
614
602
  this._log.info('deleteManagedFolder response %j', response);
615
603
  return [response, options, rawResponse];
604
+ }).catch((error) => {
605
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
606
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
607
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
608
+ }
609
+ throw error;
616
610
  });
617
611
  }
618
- getManagedFolder(request, optionsOrCallback, callback) {
612
+ getManagedFolder(request, optionsOrCallback, callback) {
613
+ request = request || {};
614
+ if (!request.requestId) {
615
+ request.requestId = gax.makeUUID();
616
+ }
617
+ let options;
618
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
619
+ callback = optionsOrCallback;
620
+ options = {};
621
+ }
622
+ else {
623
+ options = optionsOrCallback;
624
+ }
625
+ options = options || {};
626
+ options.otherArgs = options.otherArgs || {};
627
+ options.otherArgs.headers = options.otherArgs.headers || {};
628
+ let routingParameter = {};
629
+ {
630
+ const fieldValue = request.name;
631
+ if (fieldValue !== undefined && fieldValue !== null) {
632
+ const match = fieldValue.toString().match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
633
+ if (match) {
634
+ const parameterValue = match.groups?.['bucket'] ?? fieldValue;
635
+ Object.assign(routingParameter, { bucket: parameterValue });
636
+ }
637
+ }
638
+ }
639
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
640
+ this.initialize().catch(err => { throw err; });
641
+ this._log.info('getManagedFolder request %j', request);
642
+ const wrappedCallback = callback
643
+ ? (error, response, options, rawResponse) => {
644
+ this._log.info('getManagedFolder response %j', response);
645
+ callback(error, response, options, rawResponse); // We verified callback above.
646
+ }
647
+ : undefined;
648
+ return this.innerApiCalls.getManagedFolder(request, options, wrappedCallback)
649
+ ?.then(([response, options, rawResponse]) => {
650
+ this._log.info('getManagedFolder response %j', response);
651
+ return [response, options, rawResponse];
652
+ }).catch((error) => {
653
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
654
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
655
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
656
+ }
657
+ throw error;
658
+ });
659
+ }
660
+ disableAnywhereCache(request, optionsOrCallback, callback) {
661
+ request = request || {};
662
+ if (!request.requestId) {
663
+ request.requestId = gax.makeUUID();
664
+ }
665
+ let options;
666
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
667
+ callback = optionsOrCallback;
668
+ options = {};
669
+ }
670
+ else {
671
+ options = optionsOrCallback;
672
+ }
673
+ options = options || {};
674
+ options.otherArgs = options.otherArgs || {};
675
+ options.otherArgs.headers = options.otherArgs.headers || {};
676
+ let routingParameter = {};
677
+ {
678
+ const fieldValue = request.name;
679
+ if (fieldValue !== undefined && fieldValue !== null) {
680
+ const match = fieldValue.toString().match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
681
+ if (match) {
682
+ const parameterValue = match.groups?.['bucket'] ?? fieldValue;
683
+ Object.assign(routingParameter, { bucket: parameterValue });
684
+ }
685
+ }
686
+ }
687
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
688
+ this.initialize().catch(err => { throw err; });
689
+ this._log.info('disableAnywhereCache request %j', request);
690
+ const wrappedCallback = callback
691
+ ? (error, response, options, rawResponse) => {
692
+ this._log.info('disableAnywhereCache response %j', response);
693
+ callback(error, response, options, rawResponse); // We verified callback above.
694
+ }
695
+ : undefined;
696
+ return this.innerApiCalls.disableAnywhereCache(request, options, wrappedCallback)
697
+ ?.then(([response, options, rawResponse]) => {
698
+ this._log.info('disableAnywhereCache response %j', response);
699
+ return [response, options, rawResponse];
700
+ }).catch((error) => {
701
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
702
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
703
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
704
+ }
705
+ throw error;
706
+ });
707
+ }
708
+ pauseAnywhereCache(request, optionsOrCallback, callback) {
709
+ request = request || {};
710
+ if (!request.requestId) {
711
+ request.requestId = gax.makeUUID();
712
+ }
713
+ let options;
714
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
715
+ callback = optionsOrCallback;
716
+ options = {};
717
+ }
718
+ else {
719
+ options = optionsOrCallback;
720
+ }
721
+ options = options || {};
722
+ options.otherArgs = options.otherArgs || {};
723
+ options.otherArgs.headers = options.otherArgs.headers || {};
724
+ let routingParameter = {};
725
+ {
726
+ const fieldValue = request.name;
727
+ if (fieldValue !== undefined && fieldValue !== null) {
728
+ const match = fieldValue.toString().match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
729
+ if (match) {
730
+ const parameterValue = match.groups?.['bucket'] ?? fieldValue;
731
+ Object.assign(routingParameter, { bucket: parameterValue });
732
+ }
733
+ }
734
+ }
735
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
736
+ this.initialize().catch(err => { throw err; });
737
+ this._log.info('pauseAnywhereCache request %j', request);
738
+ const wrappedCallback = callback
739
+ ? (error, response, options, rawResponse) => {
740
+ this._log.info('pauseAnywhereCache response %j', response);
741
+ callback(error, response, options, rawResponse); // We verified callback above.
742
+ }
743
+ : undefined;
744
+ return this.innerApiCalls.pauseAnywhereCache(request, options, wrappedCallback)
745
+ ?.then(([response, options, rawResponse]) => {
746
+ this._log.info('pauseAnywhereCache response %j', response);
747
+ return [response, options, rawResponse];
748
+ }).catch((error) => {
749
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
750
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
751
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
752
+ }
753
+ throw error;
754
+ });
755
+ }
756
+ resumeAnywhereCache(request, optionsOrCallback, callback) {
757
+ request = request || {};
758
+ if (!request.requestId) {
759
+ request.requestId = gax.makeUUID();
760
+ }
761
+ let options;
762
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
763
+ callback = optionsOrCallback;
764
+ options = {};
765
+ }
766
+ else {
767
+ options = optionsOrCallback;
768
+ }
769
+ options = options || {};
770
+ options.otherArgs = options.otherArgs || {};
771
+ options.otherArgs.headers = options.otherArgs.headers || {};
772
+ let routingParameter = {};
773
+ {
774
+ const fieldValue = request.name;
775
+ if (fieldValue !== undefined && fieldValue !== null) {
776
+ const match = fieldValue.toString().match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
777
+ if (match) {
778
+ const parameterValue = match.groups?.['bucket'] ?? fieldValue;
779
+ Object.assign(routingParameter, { bucket: parameterValue });
780
+ }
781
+ }
782
+ }
783
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
784
+ this.initialize().catch(err => { throw err; });
785
+ this._log.info('resumeAnywhereCache request %j', request);
786
+ const wrappedCallback = callback
787
+ ? (error, response, options, rawResponse) => {
788
+ this._log.info('resumeAnywhereCache response %j', response);
789
+ callback(error, response, options, rawResponse); // We verified callback above.
790
+ }
791
+ : undefined;
792
+ return this.innerApiCalls.resumeAnywhereCache(request, options, wrappedCallback)
793
+ ?.then(([response, options, rawResponse]) => {
794
+ this._log.info('resumeAnywhereCache response %j', response);
795
+ return [response, options, rawResponse];
796
+ }).catch((error) => {
797
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
798
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
799
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
800
+ }
801
+ throw error;
802
+ });
803
+ }
804
+ getAnywhereCache(request, optionsOrCallback, callback) {
805
+ request = request || {};
806
+ if (!request.requestId) {
807
+ request.requestId = gax.makeUUID();
808
+ }
809
+ let options;
810
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
811
+ callback = optionsOrCallback;
812
+ options = {};
813
+ }
814
+ else {
815
+ options = optionsOrCallback;
816
+ }
817
+ options = options || {};
818
+ options.otherArgs = options.otherArgs || {};
819
+ options.otherArgs.headers = options.otherArgs.headers || {};
820
+ let routingParameter = {};
821
+ {
822
+ const fieldValue = request.name;
823
+ if (fieldValue !== undefined && fieldValue !== null) {
824
+ const match = fieldValue.toString().match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
825
+ if (match) {
826
+ const parameterValue = match.groups?.['bucket'] ?? fieldValue;
827
+ Object.assign(routingParameter, { bucket: parameterValue });
828
+ }
829
+ }
830
+ }
831
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
832
+ this.initialize().catch(err => { throw err; });
833
+ this._log.info('getAnywhereCache request %j', request);
834
+ const wrappedCallback = callback
835
+ ? (error, response, options, rawResponse) => {
836
+ this._log.info('getAnywhereCache response %j', response);
837
+ callback(error, response, options, rawResponse); // We verified callback above.
838
+ }
839
+ : undefined;
840
+ return this.innerApiCalls.getAnywhereCache(request, options, wrappedCallback)
841
+ ?.then(([response, options, rawResponse]) => {
842
+ this._log.info('getAnywhereCache response %j', response);
843
+ return [response, options, rawResponse];
844
+ }).catch((error) => {
845
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
846
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
847
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
848
+ }
849
+ throw error;
850
+ });
851
+ }
852
+ getProjectIntelligenceConfig(request, optionsOrCallback, callback) {
853
+ request = request || {};
854
+ let options;
855
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
856
+ callback = optionsOrCallback;
857
+ options = {};
858
+ }
859
+ else {
860
+ options = optionsOrCallback;
861
+ }
862
+ options = options || {};
863
+ options.otherArgs = options.otherArgs || {};
864
+ options.otherArgs.headers = options.otherArgs.headers || {};
865
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
866
+ 'name': request.name ?? '',
867
+ });
868
+ this.initialize().catch(err => { throw err; });
869
+ this._log.info('getProjectIntelligenceConfig request %j', request);
870
+ const wrappedCallback = callback
871
+ ? (error, response, options, rawResponse) => {
872
+ this._log.info('getProjectIntelligenceConfig response %j', response);
873
+ callback(error, response, options, rawResponse); // We verified callback above.
874
+ }
875
+ : undefined;
876
+ return this.innerApiCalls.getProjectIntelligenceConfig(request, options, wrappedCallback)
877
+ ?.then(([response, options, rawResponse]) => {
878
+ this._log.info('getProjectIntelligenceConfig response %j', response);
879
+ return [response, options, rawResponse];
880
+ }).catch((error) => {
881
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
882
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
883
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
884
+ }
885
+ throw error;
886
+ });
887
+ }
888
+ updateProjectIntelligenceConfig(request, optionsOrCallback, callback) {
889
+ request = request || {};
890
+ let options;
891
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
892
+ callback = optionsOrCallback;
893
+ options = {};
894
+ }
895
+ else {
896
+ options = optionsOrCallback;
897
+ }
898
+ options = options || {};
899
+ options.otherArgs = options.otherArgs || {};
900
+ options.otherArgs.headers = options.otherArgs.headers || {};
901
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
902
+ 'intelligence_config.name': request.intelligenceConfig.name ?? '',
903
+ });
904
+ this.initialize().catch(err => { throw err; });
905
+ this._log.info('updateProjectIntelligenceConfig request %j', request);
906
+ const wrappedCallback = callback
907
+ ? (error, response, options, rawResponse) => {
908
+ this._log.info('updateProjectIntelligenceConfig response %j', response);
909
+ callback(error, response, options, rawResponse); // We verified callback above.
910
+ }
911
+ : undefined;
912
+ return this.innerApiCalls.updateProjectIntelligenceConfig(request, options, wrappedCallback)
913
+ ?.then(([response, options, rawResponse]) => {
914
+ this._log.info('updateProjectIntelligenceConfig response %j', response);
915
+ return [response, options, rawResponse];
916
+ }).catch((error) => {
917
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
918
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
919
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
920
+ }
921
+ throw error;
922
+ });
923
+ }
924
+ getFolderIntelligenceConfig(request, optionsOrCallback, callback) {
925
+ request = request || {};
926
+ let options;
927
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
928
+ callback = optionsOrCallback;
929
+ options = {};
930
+ }
931
+ else {
932
+ options = optionsOrCallback;
933
+ }
934
+ options = options || {};
935
+ options.otherArgs = options.otherArgs || {};
936
+ options.otherArgs.headers = options.otherArgs.headers || {};
937
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
938
+ 'name': request.name ?? '',
939
+ });
940
+ this.initialize().catch(err => { throw err; });
941
+ this._log.info('getFolderIntelligenceConfig request %j', request);
942
+ const wrappedCallback = callback
943
+ ? (error, response, options, rawResponse) => {
944
+ this._log.info('getFolderIntelligenceConfig response %j', response);
945
+ callback(error, response, options, rawResponse); // We verified callback above.
946
+ }
947
+ : undefined;
948
+ return this.innerApiCalls.getFolderIntelligenceConfig(request, options, wrappedCallback)
949
+ ?.then(([response, options, rawResponse]) => {
950
+ this._log.info('getFolderIntelligenceConfig response %j', response);
951
+ return [response, options, rawResponse];
952
+ }).catch((error) => {
953
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
954
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
955
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
956
+ }
957
+ throw error;
958
+ });
959
+ }
960
+ updateFolderIntelligenceConfig(request, optionsOrCallback, callback) {
961
+ request = request || {};
962
+ let options;
963
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
964
+ callback = optionsOrCallback;
965
+ options = {};
966
+ }
967
+ else {
968
+ options = optionsOrCallback;
969
+ }
970
+ options = options || {};
971
+ options.otherArgs = options.otherArgs || {};
972
+ options.otherArgs.headers = options.otherArgs.headers || {};
973
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
974
+ 'intelligence_config.name': request.intelligenceConfig.name ?? '',
975
+ });
976
+ this.initialize().catch(err => { throw err; });
977
+ this._log.info('updateFolderIntelligenceConfig request %j', request);
978
+ const wrappedCallback = callback
979
+ ? (error, response, options, rawResponse) => {
980
+ this._log.info('updateFolderIntelligenceConfig response %j', response);
981
+ callback(error, response, options, rawResponse); // We verified callback above.
982
+ }
983
+ : undefined;
984
+ return this.innerApiCalls.updateFolderIntelligenceConfig(request, options, wrappedCallback)
985
+ ?.then(([response, options, rawResponse]) => {
986
+ this._log.info('updateFolderIntelligenceConfig response %j', response);
987
+ return [response, options, rawResponse];
988
+ }).catch((error) => {
989
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
990
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
991
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
992
+ }
993
+ throw error;
994
+ });
995
+ }
996
+ getOrganizationIntelligenceConfig(request, optionsOrCallback, callback) {
997
+ request = request || {};
998
+ let options;
999
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1000
+ callback = optionsOrCallback;
1001
+ options = {};
1002
+ }
1003
+ else {
1004
+ options = optionsOrCallback;
1005
+ }
1006
+ options = options || {};
1007
+ options.otherArgs = options.otherArgs || {};
1008
+ options.otherArgs.headers = options.otherArgs.headers || {};
1009
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1010
+ 'name': request.name ?? '',
1011
+ });
1012
+ this.initialize().catch(err => { throw err; });
1013
+ this._log.info('getOrganizationIntelligenceConfig request %j', request);
1014
+ const wrappedCallback = callback
1015
+ ? (error, response, options, rawResponse) => {
1016
+ this._log.info('getOrganizationIntelligenceConfig response %j', response);
1017
+ callback(error, response, options, rawResponse); // We verified callback above.
1018
+ }
1019
+ : undefined;
1020
+ return this.innerApiCalls.getOrganizationIntelligenceConfig(request, options, wrappedCallback)
1021
+ ?.then(([response, options, rawResponse]) => {
1022
+ this._log.info('getOrganizationIntelligenceConfig response %j', response);
1023
+ return [response, options, rawResponse];
1024
+ }).catch((error) => {
1025
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1026
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1027
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1028
+ }
1029
+ throw error;
1030
+ });
1031
+ }
1032
+ updateOrganizationIntelligenceConfig(request, optionsOrCallback, callback) {
1033
+ request = request || {};
1034
+ let options;
1035
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1036
+ callback = optionsOrCallback;
1037
+ options = {};
1038
+ }
1039
+ else {
1040
+ options = optionsOrCallback;
1041
+ }
1042
+ options = options || {};
1043
+ options.otherArgs = options.otherArgs || {};
1044
+ options.otherArgs.headers = options.otherArgs.headers || {};
1045
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
1046
+ 'intelligence_config.name': request.intelligenceConfig.name ?? '',
1047
+ });
1048
+ this.initialize().catch(err => { throw err; });
1049
+ this._log.info('updateOrganizationIntelligenceConfig request %j', request);
1050
+ const wrappedCallback = callback
1051
+ ? (error, response, options, rawResponse) => {
1052
+ this._log.info('updateOrganizationIntelligenceConfig response %j', response);
1053
+ callback(error, response, options, rawResponse); // We verified callback above.
1054
+ }
1055
+ : undefined;
1056
+ return this.innerApiCalls.updateOrganizationIntelligenceConfig(request, options, wrappedCallback)
1057
+ ?.then(([response, options, rawResponse]) => {
1058
+ this._log.info('updateOrganizationIntelligenceConfig response %j', response);
1059
+ return [response, options, rawResponse];
1060
+ }).catch((error) => {
1061
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
1062
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
1063
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
1064
+ }
1065
+ throw error;
1066
+ });
1067
+ }
1068
+ renameFolder(request, optionsOrCallback, callback) {
1069
+ request = request || {};
1070
+ if (!request.requestId) {
1071
+ request.requestId = gax.makeUUID();
1072
+ }
1073
+ let options;
1074
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1075
+ callback = optionsOrCallback;
1076
+ options = {};
1077
+ }
1078
+ else {
1079
+ options = optionsOrCallback;
1080
+ }
1081
+ options = options || {};
1082
+ options.otherArgs = options.otherArgs || {};
1083
+ options.otherArgs.headers = options.otherArgs.headers || {};
1084
+ let routingParameter = {};
1085
+ {
1086
+ const fieldValue = request.name;
1087
+ if (fieldValue !== undefined && fieldValue !== null) {
1088
+ const match = fieldValue.toString().match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
1089
+ if (match) {
1090
+ const parameterValue = match.groups?.['bucket'] ?? fieldValue;
1091
+ Object.assign(routingParameter, { bucket: parameterValue });
1092
+ }
1093
+ }
1094
+ }
1095
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
1096
+ this.initialize().catch(err => { throw err; });
1097
+ const wrappedCallback = callback
1098
+ ? (error, response, rawResponse, _) => {
1099
+ this._log.info('renameFolder response %j', rawResponse);
1100
+ callback(error, response, rawResponse, _); // We verified callback above.
1101
+ }
1102
+ : undefined;
1103
+ this._log.info('renameFolder request %j', request);
1104
+ return this.innerApiCalls.renameFolder(request, options, wrappedCallback)
1105
+ ?.then(([response, rawResponse, _]) => {
1106
+ this._log.info('renameFolder response %j', rawResponse);
1107
+ return [response, rawResponse, _];
1108
+ });
1109
+ }
1110
+ /**
1111
+ * Check the status of the long running operation returned by `renameFolder()`.
1112
+ * @param {String} name
1113
+ * The operation name that will be passed.
1114
+ * @returns {Promise} - The promise which resolves to an object.
1115
+ * The decoded operation object has result and metadata field to get information from.
1116
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
1117
+ * for more details and examples.
1118
+ * @example <caption>include:samples/generated/v2/storage_control.rename_folder.js</caption>
1119
+ * region_tag:storage_v2_generated_StorageControl_RenameFolder_async
1120
+ */
1121
+ async checkRenameFolderProgress(name) {
1122
+ this._log.info('renameFolder long-running');
1123
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
1124
+ const [operation] = await this.operationsClient.getOperation(request);
1125
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.renameFolder, this._gaxModule.createDefaultBackoffSettings());
1126
+ return decodeOperation;
1127
+ }
1128
+ createAnywhereCache(request, optionsOrCallback, callback) {
619
1129
  request = request || {};
620
1130
  if (!request.requestId) {
621
1131
  request.requestId = gax.makeUUID();
@@ -631,39 +1141,51 @@ class StorageControlClient {
631
1141
  options = options || {};
632
1142
  options.otherArgs = options.otherArgs || {};
633
1143
  options.otherArgs.headers = options.otherArgs.headers || {};
634
- const routingParameter = {};
1144
+ let routingParameter = {};
635
1145
  {
636
- const fieldValue = request.name;
1146
+ const fieldValue = request.parent;
637
1147
  if (fieldValue !== undefined && fieldValue !== null) {
638
- const match = fieldValue
639
- .toString()
640
- .match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
1148
+ const match = fieldValue.toString().match(RegExp('(?<bucket>(?:.*)?)'));
641
1149
  if (match) {
642
1150
  const parameterValue = match.groups?.['bucket'] ?? fieldValue;
643
1151
  Object.assign(routingParameter, { bucket: parameterValue });
644
1152
  }
645
1153
  }
646
1154
  }
647
- options.otherArgs.headers['x-goog-request-params'] =
648
- this._gaxModule.routingHeader.fromParams(routingParameter);
649
- this.initialize().catch(err => {
650
- throw err;
651
- });
652
- this._log.info('getManagedFolder request %j', request);
1155
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
1156
+ this.initialize().catch(err => { throw err; });
653
1157
  const wrappedCallback = callback
654
- ? (error, response, options, rawResponse) => {
655
- this._log.info('getManagedFolder response %j', response);
656
- callback(error, response, options, rawResponse); // We verified callback above.
1158
+ ? (error, response, rawResponse, _) => {
1159
+ this._log.info('createAnywhereCache response %j', rawResponse);
1160
+ callback(error, response, rawResponse, _); // We verified callback above.
657
1161
  }
658
1162
  : undefined;
659
- return this.innerApiCalls
660
- .getManagedFolder(request, options, wrappedCallback)
661
- ?.then(([response, options, rawResponse]) => {
662
- this._log.info('getManagedFolder response %j', response);
663
- return [response, options, rawResponse];
1163
+ this._log.info('createAnywhereCache request %j', request);
1164
+ return this.innerApiCalls.createAnywhereCache(request, options, wrappedCallback)
1165
+ ?.then(([response, rawResponse, _]) => {
1166
+ this._log.info('createAnywhereCache response %j', rawResponse);
1167
+ return [response, rawResponse, _];
664
1168
  });
665
1169
  }
666
- renameFolder(request, optionsOrCallback, callback) {
1170
+ /**
1171
+ * Check the status of the long running operation returned by `createAnywhereCache()`.
1172
+ * @param {String} name
1173
+ * The operation name that will be passed.
1174
+ * @returns {Promise} - The promise which resolves to an object.
1175
+ * The decoded operation object has result and metadata field to get information from.
1176
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
1177
+ * for more details and examples.
1178
+ * @example <caption>include:samples/generated/v2/storage_control.create_anywhere_cache.js</caption>
1179
+ * region_tag:storage_v2_generated_StorageControl_CreateAnywhereCache_async
1180
+ */
1181
+ async checkCreateAnywhereCacheProgress(name) {
1182
+ this._log.info('createAnywhereCache long-running');
1183
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
1184
+ const [operation] = await this.operationsClient.getOperation(request);
1185
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createAnywhereCache, this._gaxModule.createDefaultBackoffSettings());
1186
+ return decodeOperation;
1187
+ }
1188
+ updateAnywhereCache(request, optionsOrCallback, callback) {
667
1189
  request = request || {};
668
1190
  if (!request.requestId) {
669
1191
  request.requestId = gax.makeUUID();
@@ -679,54 +1201,48 @@ class StorageControlClient {
679
1201
  options = options || {};
680
1202
  options.otherArgs = options.otherArgs || {};
681
1203
  options.otherArgs.headers = options.otherArgs.headers || {};
682
- const routingParameter = {};
1204
+ let routingParameter = {};
683
1205
  {
684
- const fieldValue = request.name;
1206
+ const fieldValue = request.anywhereCache?.name;
685
1207
  if (fieldValue !== undefined && fieldValue !== null) {
686
- const match = fieldValue
687
- .toString()
688
- .match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
1208
+ const match = fieldValue.toString().match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
689
1209
  if (match) {
690
1210
  const parameterValue = match.groups?.['bucket'] ?? fieldValue;
691
1211
  Object.assign(routingParameter, { bucket: parameterValue });
692
1212
  }
693
1213
  }
694
1214
  }
695
- options.otherArgs.headers['x-goog-request-params'] =
696
- this._gaxModule.routingHeader.fromParams(routingParameter);
697
- this.initialize().catch(err => {
698
- throw err;
699
- });
1215
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
1216
+ this.initialize().catch(err => { throw err; });
700
1217
  const wrappedCallback = callback
701
1218
  ? (error, response, rawResponse, _) => {
702
- this._log.info('renameFolder response %j', rawResponse);
1219
+ this._log.info('updateAnywhereCache response %j', rawResponse);
703
1220
  callback(error, response, rawResponse, _); // We verified callback above.
704
1221
  }
705
1222
  : undefined;
706
- this._log.info('renameFolder request %j', request);
707
- return this.innerApiCalls
708
- .renameFolder(request, options, wrappedCallback)
1223
+ this._log.info('updateAnywhereCache request %j', request);
1224
+ return this.innerApiCalls.updateAnywhereCache(request, options, wrappedCallback)
709
1225
  ?.then(([response, rawResponse, _]) => {
710
- this._log.info('renameFolder response %j', rawResponse);
1226
+ this._log.info('updateAnywhereCache response %j', rawResponse);
711
1227
  return [response, rawResponse, _];
712
1228
  });
713
1229
  }
714
1230
  /**
715
- * Check the status of the long running operation returned by `renameFolder()`.
1231
+ * Check the status of the long running operation returned by `updateAnywhereCache()`.
716
1232
  * @param {String} name
717
1233
  * The operation name that will be passed.
718
1234
  * @returns {Promise} - The promise which resolves to an object.
719
1235
  * The decoded operation object has result and metadata field to get information from.
720
1236
  * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
721
1237
  * for more details and examples.
722
- * @example <caption>include:samples/generated/v2/storage_control.rename_folder.js</caption>
723
- * region_tag:storage_v2_generated_StorageControl_RenameFolder_async
1238
+ * @example <caption>include:samples/generated/v2/storage_control.update_anywhere_cache.js</caption>
1239
+ * region_tag:storage_v2_generated_StorageControl_UpdateAnywhereCache_async
724
1240
  */
725
- async checkRenameFolderProgress(name) {
726
- this._log.info('renameFolder long-running');
1241
+ async checkUpdateAnywhereCacheProgress(name) {
1242
+ this._log.info('updateAnywhereCache long-running');
727
1243
  const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
728
1244
  const [operation] = await this.operationsClient.getOperation(request);
729
- const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.renameFolder, this._gaxModule.createDefaultBackoffSettings());
1245
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateAnywhereCache, this._gaxModule.createDefaultBackoffSettings());
730
1246
  return decodeOperation;
731
1247
  }
732
1248
  listFolders(request, optionsOrCallback, callback) {
@@ -742,7 +1258,7 @@ class StorageControlClient {
742
1258
  options = options || {};
743
1259
  options.otherArgs = options.otherArgs || {};
744
1260
  options.otherArgs.headers = options.otherArgs.headers || {};
745
- const routingParameter = {};
1261
+ let routingParameter = {};
746
1262
  {
747
1263
  const fieldValue = request.parent;
748
1264
  if (fieldValue !== undefined && fieldValue !== null) {
@@ -753,11 +1269,8 @@ class StorageControlClient {
753
1269
  }
754
1270
  }
755
1271
  }
756
- options.otherArgs.headers['x-goog-request-params'] =
757
- this._gaxModule.routingHeader.fromParams(routingParameter);
758
- this.initialize().catch(err => {
759
- throw err;
760
- });
1272
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
1273
+ this.initialize().catch(err => { throw err; });
761
1274
  const wrappedCallback = callback
762
1275
  ? (error, values, nextPageRequest, rawResponse) => {
763
1276
  this._log.info('listFolders values %j', values);
@@ -821,7 +1334,7 @@ class StorageControlClient {
821
1334
  options = options || {};
822
1335
  options.otherArgs = options.otherArgs || {};
823
1336
  options.otherArgs.headers = options.otherArgs.headers || {};
824
- const routingParameter = {};
1337
+ let routingParameter = {};
825
1338
  {
826
1339
  const fieldValue = request.parent;
827
1340
  if (fieldValue !== undefined && fieldValue !== null) {
@@ -832,13 +1345,10 @@ class StorageControlClient {
832
1345
  }
833
1346
  }
834
1347
  }
835
- options.otherArgs.headers['x-goog-request-params'] =
836
- this._gaxModule.routingHeader.fromParams(routingParameter);
1348
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
837
1349
  const defaultCallSettings = this._defaults['listFolders'];
838
1350
  const callSettings = defaultCallSettings.merge(options);
839
- this.initialize().catch(err => {
840
- throw err;
841
- });
1351
+ this.initialize().catch(err => { throw err; });
842
1352
  this._log.info('listFolders stream %j', request);
843
1353
  return this.descriptors.page.listFolders.createStream(this.innerApiCalls.listFolders, request, callSettings);
844
1354
  }
@@ -894,7 +1404,7 @@ class StorageControlClient {
894
1404
  options = options || {};
895
1405
  options.otherArgs = options.otherArgs || {};
896
1406
  options.otherArgs.headers = options.otherArgs.headers || {};
897
- const routingParameter = {};
1407
+ let routingParameter = {};
898
1408
  {
899
1409
  const fieldValue = request.parent;
900
1410
  if (fieldValue !== undefined && fieldValue !== null) {
@@ -905,13 +1415,10 @@ class StorageControlClient {
905
1415
  }
906
1416
  }
907
1417
  }
908
- options.otherArgs.headers['x-goog-request-params'] =
909
- this._gaxModule.routingHeader.fromParams(routingParameter);
1418
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
910
1419
  const defaultCallSettings = this._defaults['listFolders'];
911
1420
  const callSettings = defaultCallSettings.merge(options);
912
- this.initialize().catch(err => {
913
- throw err;
914
- });
1421
+ this.initialize().catch(err => { throw err; });
915
1422
  this._log.info('listFolders iterate %j', request);
916
1423
  return this.descriptors.page.listFolders.asyncIterate(this.innerApiCalls['listFolders'], request, callSettings);
917
1424
  }
@@ -931,7 +1438,7 @@ class StorageControlClient {
931
1438
  options = options || {};
932
1439
  options.otherArgs = options.otherArgs || {};
933
1440
  options.otherArgs.headers = options.otherArgs.headers || {};
934
- const routingParameter = {};
1441
+ let routingParameter = {};
935
1442
  {
936
1443
  const fieldValue = request.parent;
937
1444
  if (fieldValue !== undefined && fieldValue !== null) {
@@ -942,11 +1449,8 @@ class StorageControlClient {
942
1449
  }
943
1450
  }
944
1451
  }
945
- options.otherArgs.headers['x-goog-request-params'] =
946
- this._gaxModule.routingHeader.fromParams(routingParameter);
947
- this.initialize().catch(err => {
948
- throw err;
949
- });
1452
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
1453
+ this.initialize().catch(err => { throw err; });
950
1454
  const wrappedCallback = callback
951
1455
  ? (error, values, nextPageRequest, rawResponse) => {
952
1456
  this._log.info('listManagedFolders values %j', values);
@@ -998,7 +1502,7 @@ class StorageControlClient {
998
1502
  options = options || {};
999
1503
  options.otherArgs = options.otherArgs || {};
1000
1504
  options.otherArgs.headers = options.otherArgs.headers || {};
1001
- const routingParameter = {};
1505
+ let routingParameter = {};
1002
1506
  {
1003
1507
  const fieldValue = request.parent;
1004
1508
  if (fieldValue !== undefined && fieldValue !== null) {
@@ -1009,13 +1513,10 @@ class StorageControlClient {
1009
1513
  }
1010
1514
  }
1011
1515
  }
1012
- options.otherArgs.headers['x-goog-request-params'] =
1013
- this._gaxModule.routingHeader.fromParams(routingParameter);
1516
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
1014
1517
  const defaultCallSettings = this._defaults['listManagedFolders'];
1015
1518
  const callSettings = defaultCallSettings.merge(options);
1016
- this.initialize().catch(err => {
1017
- throw err;
1018
- });
1519
+ this.initialize().catch(err => { throw err; });
1019
1520
  this._log.info('listManagedFolders stream %j', request);
1020
1521
  return this.descriptors.page.listManagedFolders.createStream(this.innerApiCalls.listManagedFolders, request, callSettings);
1021
1522
  }
@@ -1059,7 +1560,7 @@ class StorageControlClient {
1059
1560
  options = options || {};
1060
1561
  options.otherArgs = options.otherArgs || {};
1061
1562
  options.otherArgs.headers = options.otherArgs.headers || {};
1062
- const routingParameter = {};
1563
+ let routingParameter = {};
1063
1564
  {
1064
1565
  const fieldValue = request.parent;
1065
1566
  if (fieldValue !== undefined && fieldValue !== null) {
@@ -1070,46 +1571,193 @@ class StorageControlClient {
1070
1571
  }
1071
1572
  }
1072
1573
  }
1073
- options.otherArgs.headers['x-goog-request-params'] =
1074
- this._gaxModule.routingHeader.fromParams(routingParameter);
1574
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
1075
1575
  const defaultCallSettings = this._defaults['listManagedFolders'];
1076
1576
  const callSettings = defaultCallSettings.merge(options);
1077
- this.initialize().catch(err => {
1078
- throw err;
1079
- });
1577
+ this.initialize().catch(err => { throw err; });
1080
1578
  this._log.info('listManagedFolders iterate %j', request);
1081
1579
  return this.descriptors.page.listManagedFolders.asyncIterate(this.innerApiCalls['listManagedFolders'], request, callSettings);
1082
1580
  }
1581
+ listAnywhereCaches(request, optionsOrCallback, callback) {
1582
+ request = request || {};
1583
+ if (!request.requestId) {
1584
+ request.requestId = gax.makeUUID();
1585
+ }
1586
+ let options;
1587
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1588
+ callback = optionsOrCallback;
1589
+ options = {};
1590
+ }
1591
+ else {
1592
+ options = optionsOrCallback;
1593
+ }
1594
+ options = options || {};
1595
+ options.otherArgs = options.otherArgs || {};
1596
+ options.otherArgs.headers = options.otherArgs.headers || {};
1597
+ let routingParameter = {};
1598
+ {
1599
+ const fieldValue = request.parent;
1600
+ if (fieldValue !== undefined && fieldValue !== null) {
1601
+ const match = fieldValue.toString().match(RegExp('(?<bucket>(?:.*)?)'));
1602
+ if (match) {
1603
+ const parameterValue = match.groups?.['bucket'] ?? fieldValue;
1604
+ Object.assign(routingParameter, { bucket: parameterValue });
1605
+ }
1606
+ }
1607
+ }
1608
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
1609
+ this.initialize().catch(err => { throw err; });
1610
+ const wrappedCallback = callback
1611
+ ? (error, values, nextPageRequest, rawResponse) => {
1612
+ this._log.info('listAnywhereCaches values %j', values);
1613
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
1614
+ }
1615
+ : undefined;
1616
+ this._log.info('listAnywhereCaches request %j', request);
1617
+ return this.innerApiCalls
1618
+ .listAnywhereCaches(request, options, wrappedCallback)
1619
+ ?.then(([response, input, output]) => {
1620
+ this._log.info('listAnywhereCaches values %j', response);
1621
+ return [response, input, output];
1622
+ });
1623
+ }
1083
1624
  /**
1084
- * Gets the latest state of a long-running operation. Clients can use this
1085
- * method to poll the operation result at intervals as recommended by the API
1086
- * service.
1087
- *
1088
- * @param {Object} request - The request object that will be sent.
1089
- * @param {string} request.name - The name of the operation resource.
1090
- * @param {Object=} options
1091
- * Optional parameters. You can override the default settings for this call,
1092
- * e.g, timeout, retries, paginations, etc. See {@link
1093
- * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
1094
- * for the details.
1095
- * @param {function(?Error, ?Object)=} callback
1096
- * The function which will be called with the result of the API call.
1097
- *
1098
- * The second parameter to the callback is an object representing
1099
- * {@link google.longrunning.Operation | google.longrunning.Operation}.
1100
- * @return {Promise} - The promise which resolves to an array.
1101
- * The first element of the array is an object representing
1102
- * {@link google.longrunning.Operation | google.longrunning.Operation}.
1103
- * The promise has a method named "cancel" which cancels the ongoing API call.
1625
+ * Equivalent to `listAnywhereCaches`, but returns a NodeJS Stream object.
1626
+ * @param {Object} request
1627
+ * The request object that will be sent.
1628
+ * @param {string} request.parent
1629
+ * Required. The bucket to which this cache belongs.
1630
+ * @param {number} request.pageSize
1631
+ * Maximum number of caches to return in a single response.
1632
+ * The service will use this parameter or 1,000 items, whichever is smaller.
1633
+ * @param {string} request.pageToken
1634
+ * A previously-returned page token representing part of the larger set of
1635
+ * results to view.
1636
+ * @param {string} [request.requestId]
1637
+ * Optional. A unique identifier for this request. UUID is the recommended
1638
+ * format, but other formats are still accepted.
1639
+ * @param {object} [options]
1640
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1641
+ * @returns {Stream}
1642
+ * An object stream which emits an object representing {@link protos.google.storage.control.v2.AnywhereCache|AnywhereCache} on 'data' event.
1643
+ * The client library will perform auto-pagination by default: it will call the API as many
1644
+ * times as needed. Note that it can affect your quota.
1645
+ * We recommend using `listAnywhereCachesAsync()`
1646
+ * method described below for async iteration which you can stop as needed.
1647
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1648
+ * for more details and examples.
1649
+ */
1650
+ listAnywhereCachesStream(request, options) {
1651
+ request = request || {};
1652
+ if (!request.requestId) {
1653
+ request.requestId = gax.makeUUID();
1654
+ }
1655
+ options = options || {};
1656
+ options.otherArgs = options.otherArgs || {};
1657
+ options.otherArgs.headers = options.otherArgs.headers || {};
1658
+ let routingParameter = {};
1659
+ {
1660
+ const fieldValue = request.parent;
1661
+ if (fieldValue !== undefined && fieldValue !== null) {
1662
+ const match = fieldValue.toString().match(RegExp('(?<bucket>(?:.*)?)'));
1663
+ if (match) {
1664
+ const parameterValue = match.groups?.['bucket'] ?? fieldValue;
1665
+ Object.assign(routingParameter, { bucket: parameterValue });
1666
+ }
1667
+ }
1668
+ }
1669
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
1670
+ const defaultCallSettings = this._defaults['listAnywhereCaches'];
1671
+ const callSettings = defaultCallSettings.merge(options);
1672
+ this.initialize().catch(err => { throw err; });
1673
+ this._log.info('listAnywhereCaches stream %j', request);
1674
+ return this.descriptors.page.listAnywhereCaches.createStream(this.innerApiCalls.listAnywhereCaches, request, callSettings);
1675
+ }
1676
+ /**
1677
+ * Equivalent to `listAnywhereCaches`, but returns an iterable object.
1104
1678
  *
1105
- * @example
1106
- * ```
1107
- * const client = longrunning.operationsClient();
1108
- * const name = '';
1109
- * const [response] = await client.getOperation({name});
1110
- * // doThingsWith(response)
1111
- * ```
1679
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
1680
+ * @param {Object} request
1681
+ * The request object that will be sent.
1682
+ * @param {string} request.parent
1683
+ * Required. The bucket to which this cache belongs.
1684
+ * @param {number} request.pageSize
1685
+ * Maximum number of caches to return in a single response.
1686
+ * The service will use this parameter or 1,000 items, whichever is smaller.
1687
+ * @param {string} request.pageToken
1688
+ * A previously-returned page token representing part of the larger set of
1689
+ * results to view.
1690
+ * @param {string} [request.requestId]
1691
+ * Optional. A unique identifier for this request. UUID is the recommended
1692
+ * format, but other formats are still accepted.
1693
+ * @param {object} [options]
1694
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1695
+ * @returns {Object}
1696
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
1697
+ * When you iterate the returned iterable, each element will be an object representing
1698
+ * {@link protos.google.storage.control.v2.AnywhereCache|AnywhereCache}. The API will be called under the hood as needed, once per the page,
1699
+ * so you can stop the iteration when you don't need more results.
1700
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1701
+ * for more details and examples.
1702
+ * @example <caption>include:samples/generated/v2/storage_control.list_anywhere_caches.js</caption>
1703
+ * region_tag:storage_v2_generated_StorageControl_ListAnywhereCaches_async
1112
1704
  */
1705
+ listAnywhereCachesAsync(request, options) {
1706
+ request = request || {};
1707
+ if (!request.requestId) {
1708
+ request.requestId = gax.makeUUID();
1709
+ }
1710
+ options = options || {};
1711
+ options.otherArgs = options.otherArgs || {};
1712
+ options.otherArgs.headers = options.otherArgs.headers || {};
1713
+ let routingParameter = {};
1714
+ {
1715
+ const fieldValue = request.parent;
1716
+ if (fieldValue !== undefined && fieldValue !== null) {
1717
+ const match = fieldValue.toString().match(RegExp('(?<bucket>(?:.*)?)'));
1718
+ if (match) {
1719
+ const parameterValue = match.groups?.['bucket'] ?? fieldValue;
1720
+ Object.assign(routingParameter, { bucket: parameterValue });
1721
+ }
1722
+ }
1723
+ }
1724
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
1725
+ const defaultCallSettings = this._defaults['listAnywhereCaches'];
1726
+ const callSettings = defaultCallSettings.merge(options);
1727
+ this.initialize().catch(err => { throw err; });
1728
+ this._log.info('listAnywhereCaches iterate %j', request);
1729
+ return this.descriptors.page.listAnywhereCaches.asyncIterate(this.innerApiCalls['listAnywhereCaches'], request, callSettings);
1730
+ }
1731
+ /**
1732
+ * Gets the latest state of a long-running operation. Clients can use this
1733
+ * method to poll the operation result at intervals as recommended by the API
1734
+ * service.
1735
+ *
1736
+ * @param {Object} request - The request object that will be sent.
1737
+ * @param {string} request.name - The name of the operation resource.
1738
+ * @param {Object=} options
1739
+ * Optional parameters. You can override the default settings for this call,
1740
+ * e.g, timeout, retries, paginations, etc. See {@link
1741
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
1742
+ * for the details.
1743
+ * @param {function(?Error, ?Object)=} callback
1744
+ * The function which will be called with the result of the API call.
1745
+ *
1746
+ * The second parameter to the callback is an object representing
1747
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
1748
+ * @return {Promise} - The promise which resolves to an array.
1749
+ * The first element of the array is an object representing
1750
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
1751
+ * The promise has a method named "cancel" which cancels the ongoing API call.
1752
+ *
1753
+ * @example
1754
+ * ```
1755
+ * const client = longrunning.operationsClient();
1756
+ * const name = '';
1757
+ * const [response] = await client.getOperation({name});
1758
+ * // doThingsWith(response)
1759
+ * ```
1760
+ */
1113
1761
  getOperation(request, optionsOrCallback, callback) {
1114
1762
  let options;
1115
1763
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -1263,6 +1911,51 @@ class StorageControlClient {
1263
1911
  // --------------------
1264
1912
  // -- Path templates --
1265
1913
  // --------------------
1914
+ /**
1915
+ * Return a fully-qualified anywhereCache resource name string.
1916
+ *
1917
+ * @param {string} project
1918
+ * @param {string} bucket
1919
+ * @param {string} anywhere_cache
1920
+ * @returns {string} Resource name string.
1921
+ */
1922
+ anywhereCachePath(project, bucket, anywhereCache) {
1923
+ return this.pathTemplates.anywhereCachePathTemplate.render({
1924
+ project: project,
1925
+ bucket: bucket,
1926
+ anywhere_cache: anywhereCache,
1927
+ });
1928
+ }
1929
+ /**
1930
+ * Parse the project from AnywhereCache resource.
1931
+ *
1932
+ * @param {string} anywhereCacheName
1933
+ * A fully-qualified path representing AnywhereCache resource.
1934
+ * @returns {string} A string representing the project.
1935
+ */
1936
+ matchProjectFromAnywhereCacheName(anywhereCacheName) {
1937
+ return this.pathTemplates.anywhereCachePathTemplate.match(anywhereCacheName).project;
1938
+ }
1939
+ /**
1940
+ * Parse the bucket from AnywhereCache resource.
1941
+ *
1942
+ * @param {string} anywhereCacheName
1943
+ * A fully-qualified path representing AnywhereCache resource.
1944
+ * @returns {string} A string representing the bucket.
1945
+ */
1946
+ matchBucketFromAnywhereCacheName(anywhereCacheName) {
1947
+ return this.pathTemplates.anywhereCachePathTemplate.match(anywhereCacheName).bucket;
1948
+ }
1949
+ /**
1950
+ * Parse the anywhere_cache from AnywhereCache resource.
1951
+ *
1952
+ * @param {string} anywhereCacheName
1953
+ * A fully-qualified path representing AnywhereCache resource.
1954
+ * @returns {string} A string representing the anywhere_cache.
1955
+ */
1956
+ matchAnywhereCacheFromAnywhereCacheName(anywhereCacheName) {
1957
+ return this.pathTemplates.anywhereCachePathTemplate.match(anywhereCacheName).anywhere_cache;
1958
+ }
1266
1959
  /**
1267
1960
  * Return a fully-qualified bucket resource name string.
1268
1961
  *
@@ -1341,6 +2034,39 @@ class StorageControlClient {
1341
2034
  matchFolderFromFolderName(folderName) {
1342
2035
  return this.pathTemplates.folderPathTemplate.match(folderName).folder;
1343
2036
  }
2037
+ /**
2038
+ * Return a fully-qualified folderLocationIntelligenceConfig resource name string.
2039
+ *
2040
+ * @param {string} folder
2041
+ * @param {string} location
2042
+ * @returns {string} Resource name string.
2043
+ */
2044
+ folderLocationIntelligenceConfigPath(folder, location) {
2045
+ return this.pathTemplates.folderLocationIntelligenceConfigPathTemplate.render({
2046
+ folder: folder,
2047
+ location: location,
2048
+ });
2049
+ }
2050
+ /**
2051
+ * Parse the folder from FolderLocationIntelligenceConfig resource.
2052
+ *
2053
+ * @param {string} folderLocationIntelligenceConfigName
2054
+ * A fully-qualified path representing folder_location_intelligenceConfig resource.
2055
+ * @returns {string} A string representing the folder.
2056
+ */
2057
+ matchFolderFromFolderLocationIntelligenceConfigName(folderLocationIntelligenceConfigName) {
2058
+ return this.pathTemplates.folderLocationIntelligenceConfigPathTemplate.match(folderLocationIntelligenceConfigName).folder;
2059
+ }
2060
+ /**
2061
+ * Parse the location from FolderLocationIntelligenceConfig resource.
2062
+ *
2063
+ * @param {string} folderLocationIntelligenceConfigName
2064
+ * A fully-qualified path representing folder_location_intelligenceConfig resource.
2065
+ * @returns {string} A string representing the location.
2066
+ */
2067
+ matchLocationFromFolderLocationIntelligenceConfigName(folderLocationIntelligenceConfigName) {
2068
+ return this.pathTemplates.folderLocationIntelligenceConfigPathTemplate.match(folderLocationIntelligenceConfigName).location;
2069
+ }
1344
2070
  /**
1345
2071
  * Return a fully-qualified managedFolder resource name string.
1346
2072
  *
@@ -1364,8 +2090,7 @@ class StorageControlClient {
1364
2090
  * @returns {string} A string representing the project.
1365
2091
  */
1366
2092
  matchProjectFromManagedFolderName(managedFolderName) {
1367
- return this.pathTemplates.managedFolderPathTemplate.match(managedFolderName)
1368
- .project;
2093
+ return this.pathTemplates.managedFolderPathTemplate.match(managedFolderName).project;
1369
2094
  }
1370
2095
  /**
1371
2096
  * Parse the bucket from ManagedFolder resource.
@@ -1375,8 +2100,7 @@ class StorageControlClient {
1375
2100
  * @returns {string} A string representing the bucket.
1376
2101
  */
1377
2102
  matchBucketFromManagedFolderName(managedFolderName) {
1378
- return this.pathTemplates.managedFolderPathTemplate.match(managedFolderName)
1379
- .bucket;
2103
+ return this.pathTemplates.managedFolderPathTemplate.match(managedFolderName).bucket;
1380
2104
  }
1381
2105
  /**
1382
2106
  * Parse the managed_folder from ManagedFolder resource.
@@ -1386,8 +2110,40 @@ class StorageControlClient {
1386
2110
  * @returns {string} A string representing the managed_folder.
1387
2111
  */
1388
2112
  matchManagedFolderFromManagedFolderName(managedFolderName) {
1389
- return this.pathTemplates.managedFolderPathTemplate.match(managedFolderName)
1390
- .managed_folder;
2113
+ return this.pathTemplates.managedFolderPathTemplate.match(managedFolderName).managed_folder;
2114
+ }
2115
+ /**
2116
+ * Return a fully-qualified orgLocationIntelligenceConfig resource name string.
2117
+ *
2118
+ * @param {string} org
2119
+ * @param {string} location
2120
+ * @returns {string} Resource name string.
2121
+ */
2122
+ orgLocationIntelligenceConfigPath(org, location) {
2123
+ return this.pathTemplates.orgLocationIntelligenceConfigPathTemplate.render({
2124
+ org: org,
2125
+ location: location,
2126
+ });
2127
+ }
2128
+ /**
2129
+ * Parse the org from OrgLocationIntelligenceConfig resource.
2130
+ *
2131
+ * @param {string} orgLocationIntelligenceConfigName
2132
+ * A fully-qualified path representing org_location_intelligenceConfig resource.
2133
+ * @returns {string} A string representing the org.
2134
+ */
2135
+ matchOrgFromOrgLocationIntelligenceConfigName(orgLocationIntelligenceConfigName) {
2136
+ return this.pathTemplates.orgLocationIntelligenceConfigPathTemplate.match(orgLocationIntelligenceConfigName).org;
2137
+ }
2138
+ /**
2139
+ * Parse the location from OrgLocationIntelligenceConfig resource.
2140
+ *
2141
+ * @param {string} orgLocationIntelligenceConfigName
2142
+ * A fully-qualified path representing org_location_intelligenceConfig resource.
2143
+ * @returns {string} A string representing the location.
2144
+ */
2145
+ matchLocationFromOrgLocationIntelligenceConfigName(orgLocationIntelligenceConfigName) {
2146
+ return this.pathTemplates.orgLocationIntelligenceConfigPathTemplate.match(orgLocationIntelligenceConfigName).location;
1391
2147
  }
1392
2148
  /**
1393
2149
  * Return a fully-qualified project resource name string.
@@ -1410,6 +2166,39 @@ class StorageControlClient {
1410
2166
  matchProjectFromProjectName(projectName) {
1411
2167
  return this.pathTemplates.projectPathTemplate.match(projectName).project;
1412
2168
  }
2169
+ /**
2170
+ * Return a fully-qualified projectLocationIntelligenceConfig resource name string.
2171
+ *
2172
+ * @param {string} project
2173
+ * @param {string} location
2174
+ * @returns {string} Resource name string.
2175
+ */
2176
+ projectLocationIntelligenceConfigPath(project, location) {
2177
+ return this.pathTemplates.projectLocationIntelligenceConfigPathTemplate.render({
2178
+ project: project,
2179
+ location: location,
2180
+ });
2181
+ }
2182
+ /**
2183
+ * Parse the project from ProjectLocationIntelligenceConfig resource.
2184
+ *
2185
+ * @param {string} projectLocationIntelligenceConfigName
2186
+ * A fully-qualified path representing project_location_intelligenceConfig resource.
2187
+ * @returns {string} A string representing the project.
2188
+ */
2189
+ matchProjectFromProjectLocationIntelligenceConfigName(projectLocationIntelligenceConfigName) {
2190
+ return this.pathTemplates.projectLocationIntelligenceConfigPathTemplate.match(projectLocationIntelligenceConfigName).project;
2191
+ }
2192
+ /**
2193
+ * Parse the location from ProjectLocationIntelligenceConfig resource.
2194
+ *
2195
+ * @param {string} projectLocationIntelligenceConfigName
2196
+ * A fully-qualified path representing project_location_intelligenceConfig resource.
2197
+ * @returns {string} A string representing the location.
2198
+ */
2199
+ matchLocationFromProjectLocationIntelligenceConfigName(projectLocationIntelligenceConfigName) {
2200
+ return this.pathTemplates.projectLocationIntelligenceConfigPathTemplate.match(projectLocationIntelligenceConfigName).location;
2201
+ }
1413
2202
  /**
1414
2203
  * Return a fully-qualified storageLayout resource name string.
1415
2204
  *
@@ -1431,8 +2220,7 @@ class StorageControlClient {
1431
2220
  * @returns {string} A string representing the project.
1432
2221
  */
1433
2222
  matchProjectFromStorageLayoutName(storageLayoutName) {
1434
- return this.pathTemplates.storageLayoutPathTemplate.match(storageLayoutName)
1435
- .project;
2223
+ return this.pathTemplates.storageLayoutPathTemplate.match(storageLayoutName).project;
1436
2224
  }
1437
2225
  /**
1438
2226
  * Parse the bucket from StorageLayout resource.
@@ -1442,8 +2230,7 @@ class StorageControlClient {
1442
2230
  * @returns {string} A string representing the bucket.
1443
2231
  */
1444
2232
  matchBucketFromStorageLayoutName(storageLayoutName) {
1445
- return this.pathTemplates.storageLayoutPathTemplate.match(storageLayoutName)
1446
- .bucket;
2233
+ return this.pathTemplates.storageLayoutPathTemplate.match(storageLayoutName).bucket;
1447
2234
  }
1448
2235
  /**
1449
2236
  * Terminate the gRPC channel and close the client.
@@ -1457,7 +2244,7 @@ class StorageControlClient {
1457
2244
  this._log.info('ending gRPC channel');
1458
2245
  this._terminated = true;
1459
2246
  stub.close();
1460
- this.operationsClient.close();
2247
+ void this.operationsClient.close();
1461
2248
  });
1462
2249
  }
1463
2250
  return Promise.resolve();