@google-cloud/storage-control 0.3.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.
@@ -21,6 +21,7 @@ exports.StorageControlClient = void 0;
21
21
  /* global window */
22
22
  const gax = require("google-gax");
23
23
  const jsonProtos = require("../../protos/protos.json");
24
+ const google_gax_1 = require("google-gax");
24
25
  /**
25
26
  * Client JSON configuration object, loaded from
26
27
  * `src/v2/storage_control_client_config.json`.
@@ -43,6 +44,7 @@ class StorageControlClient {
43
44
  _defaults;
44
45
  _universeDomain;
45
46
  _servicePath;
47
+ _log = google_gax_1.loggingUtils.log('storage-control');
46
48
  auth;
47
49
  descriptors = {
48
50
  page: {},
@@ -77,7 +79,7 @@ class StorageControlClient {
77
79
  * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
78
80
  * the environment variable GCLOUD_PROJECT for your project ID. If your
79
81
  * app is running in an environment which supports
80
- * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
82
+ * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
81
83
  * your project ID will be detected automatically.
82
84
  * @param {string} [options.apiEndpoint] - The domain name of the
83
85
  * API remote host.
@@ -97,26 +99,17 @@ class StorageControlClient {
97
99
  constructor(opts, gaxInstance) {
98
100
  // Ensure that options include all the required fields.
99
101
  const staticMembers = this.constructor;
100
- if (opts?.universe_domain &&
101
- opts?.universeDomain &&
102
- opts?.universe_domain !== opts?.universeDomain) {
102
+ if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) {
103
103
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
104
104
  }
105
- const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
106
- ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
107
- : undefined;
108
- this._universeDomain =
109
- opts?.universeDomain ??
110
- opts?.universe_domain ??
111
- universeDomainEnvVar ??
112
- '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';
113
107
  this._servicePath = 'storage.' + this._universeDomain;
114
108
  const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
115
109
  this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
116
110
  const port = opts?.port || staticMembers.port;
117
111
  const clientConfig = opts?.clientConfig ?? {};
118
- const fallback = opts?.fallback ??
119
- (typeof window !== 'undefined' && typeof window?.fetch === 'function');
112
+ const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function');
120
113
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
121
114
  // Request numeric enum values if REST transport is used.
122
115
  opts.numericEnums = true;
@@ -145,7 +138,10 @@ class StorageControlClient {
145
138
  this.auth.defaultScopes = staticMembers.scopes;
146
139
  }
147
140
  // Determine the client header string.
148
- const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
141
+ const clientHeader = [
142
+ `gax/${this._gaxModule.version}`,
143
+ `gapic/${version}`,
144
+ ];
149
145
  if (typeof process === 'object' && 'versions' in process) {
150
146
  clientHeader.push(`gl-node/${process.versions.node}`);
151
147
  }
@@ -167,10 +163,14 @@ class StorageControlClient {
167
163
  // identifiers to uniquely identify resources within the API.
168
164
  // Create useful helper objects for these.
169
165
  this.pathTemplates = {
166
+ anywhereCachePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/buckets/{bucket}/anywhereCaches/{anywhere_cache}'),
170
167
  bucketPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/buckets/{bucket}'),
171
168
  folderPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/buckets/{bucket}/folders/{folder=**}'),
169
+ folderLocationIntelligenceConfigPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/locations/{location}/intelligenceConfig'),
172
170
  managedFolderPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/buckets/{bucket}/managedFolders/{managed_folder=**}'),
171
+ orgLocationIntelligenceConfigPathTemplate: new this._gaxModule.PathTemplate('organizations/{org}/locations/{location}/intelligenceConfig'),
173
172
  projectPathTemplate: new this._gaxModule.PathTemplate('projects/{project}'),
173
+ projectLocationIntelligenceConfigPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/intelligenceConfig'),
174
174
  storageLayoutPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/buckets/{bucket}/storageLayout'),
175
175
  };
176
176
  // Some of the methods on this service return "paged" results,
@@ -179,26 +179,31 @@ class StorageControlClient {
179
179
  this.descriptors.page = {
180
180
  listFolders: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'folders'),
181
181
  listManagedFolders: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'managedFolders'),
182
+ listAnywhereCaches: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'anywhereCaches')
182
183
  };
183
- const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
184
+ const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos);
184
185
  // This API contains "long-running operations", which return a
185
186
  // an Operation object that allows for tracking of the operation,
186
187
  // rather than holding a request open.
187
188
  const lroOptions = {
188
189
  auth: this.auth,
189
- grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
190
+ grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined
190
191
  };
191
192
  if (opts.fallback) {
192
193
  lroOptions.protoJson = protoFilesRoot;
193
194
  lroOptions.httpRules = [];
194
195
  }
195
- this.operationsClient = this._gaxModule
196
- .lro(lroOptions)
197
- .operationsClient(opts);
196
+ this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts);
198
197
  const renameFolderResponse = protoFilesRoot.lookup('.google.storage.control.v2.Folder');
199
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');
200
203
  this.descriptors.longrunning = {
201
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))
202
207
  };
203
208
  // Put together the default options sent with requests.
204
209
  this._defaults = this._gaxGrpc.constructSettings('google.storage.control.v2.StorageControl', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
@@ -227,24 +232,13 @@ class StorageControlClient {
227
232
  }
228
233
  // Put together the "service stub" for
229
234
  // google.storage.control.v2.StorageControl.
230
- this.storageControlStub = this._gaxGrpc.createStub(this._opts.fallback
231
- ? this._protos.lookupService('google.storage.control.v2.StorageControl')
232
- : // eslint-disable-next-line @typescript-eslint/no-explicit-any
233
- 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);
234
239
  // Iterate over each of the methods that the service provides
235
240
  // and create an API call method for each.
236
- const storageControlStubMethods = [
237
- 'createFolder',
238
- 'deleteFolder',
239
- 'getFolder',
240
- 'listFolders',
241
- 'renameFolder',
242
- 'getStorageLayout',
243
- 'createManagedFolder',
244
- 'deleteManagedFolder',
245
- 'getManagedFolder',
246
- 'listManagedFolders',
247
- ];
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'];
248
242
  for (const methodName of storageControlStubMethods) {
249
243
  const callPromise = this.storageControlStub.then(stub => (...args) => {
250
244
  if (this._terminated) {
@@ -269,8 +263,7 @@ class StorageControlClient {
269
263
  * @returns {string} The DNS address for this service.
270
264
  */
271
265
  static get servicePath() {
272
- if (typeof process === 'object' &&
273
- typeof process.emitWarning === 'function') {
266
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
274
267
  process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
275
268
  }
276
269
  return 'storage.googleapis.com';
@@ -281,8 +274,7 @@ class StorageControlClient {
281
274
  * @returns {string} The DNS address for this service.
282
275
  */
283
276
  static get apiEndpoint() {
284
- if (typeof process === 'object' &&
285
- typeof process.emitWarning === 'function') {
277
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
286
278
  process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
287
279
  }
288
280
  return 'storage.googleapis.com';
@@ -315,7 +307,7 @@ class StorageControlClient {
315
307
  'https://www.googleapis.com/auth/cloud-platform.read-only',
316
308
  'https://www.googleapis.com/auth/devstorage.full_control',
317
309
  'https://www.googleapis.com/auth/devstorage.read_only',
318
- 'https://www.googleapis.com/auth/devstorage.read_write',
310
+ 'https://www.googleapis.com/auth/devstorage.read_write'
319
311
  ];
320
312
  }
321
313
  /**
@@ -345,7 +337,7 @@ class StorageControlClient {
345
337
  options = options || {};
346
338
  options.otherArgs = options.otherArgs || {};
347
339
  options.otherArgs.headers = options.otherArgs.headers || {};
348
- const routingParameter = {};
340
+ let routingParameter = {};
349
341
  {
350
342
  const fieldValue = request.parent;
351
343
  if (fieldValue !== undefined && fieldValue !== null) {
@@ -356,10 +348,26 @@ class StorageControlClient {
356
348
  }
357
349
  }
358
350
  }
359
- options.otherArgs.headers['x-goog-request-params'] =
360
- this._gaxModule.routingHeader.fromParams(routingParameter);
361
- this.initialize();
362
- return this.innerApiCalls.createFolder(request, options, callback);
351
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
352
+ this.initialize().catch(err => { throw err; });
353
+ this._log.info('createFolder request %j', request);
354
+ const wrappedCallback = callback
355
+ ? (error, response, options, rawResponse) => {
356
+ this._log.info('createFolder response %j', response);
357
+ callback(error, response, options, rawResponse); // We verified callback above.
358
+ }
359
+ : undefined;
360
+ return this.innerApiCalls.createFolder(request, options, wrappedCallback)
361
+ ?.then(([response, options, rawResponse]) => {
362
+ this._log.info('createFolder response %j', response);
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;
370
+ });
363
371
  }
364
372
  deleteFolder(request, optionsOrCallback, callback) {
365
373
  request = request || {};
@@ -377,23 +385,37 @@ class StorageControlClient {
377
385
  options = options || {};
378
386
  options.otherArgs = options.otherArgs || {};
379
387
  options.otherArgs.headers = options.otherArgs.headers || {};
380
- const routingParameter = {};
388
+ let routingParameter = {};
381
389
  {
382
390
  const fieldValue = request.name;
383
391
  if (fieldValue !== undefined && fieldValue !== null) {
384
- const match = fieldValue
385
- .toString()
386
- .match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
392
+ const match = fieldValue.toString().match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
387
393
  if (match) {
388
394
  const parameterValue = match.groups?.['bucket'] ?? fieldValue;
389
395
  Object.assign(routingParameter, { bucket: parameterValue });
390
396
  }
391
397
  }
392
398
  }
393
- options.otherArgs.headers['x-goog-request-params'] =
394
- this._gaxModule.routingHeader.fromParams(routingParameter);
395
- this.initialize();
396
- return this.innerApiCalls.deleteFolder(request, options, callback);
399
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
400
+ this.initialize().catch(err => { throw err; });
401
+ this._log.info('deleteFolder request %j', request);
402
+ const wrappedCallback = callback
403
+ ? (error, response, options, rawResponse) => {
404
+ this._log.info('deleteFolder response %j', response);
405
+ callback(error, response, options, rawResponse); // We verified callback above.
406
+ }
407
+ : undefined;
408
+ return this.innerApiCalls.deleteFolder(request, options, wrappedCallback)
409
+ ?.then(([response, options, rawResponse]) => {
410
+ this._log.info('deleteFolder response %j', response);
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;
418
+ });
397
419
  }
398
420
  getFolder(request, optionsOrCallback, callback) {
399
421
  request = request || {};
@@ -411,23 +433,37 @@ class StorageControlClient {
411
433
  options = options || {};
412
434
  options.otherArgs = options.otherArgs || {};
413
435
  options.otherArgs.headers = options.otherArgs.headers || {};
414
- const routingParameter = {};
436
+ let routingParameter = {};
415
437
  {
416
438
  const fieldValue = request.name;
417
439
  if (fieldValue !== undefined && fieldValue !== null) {
418
- const match = fieldValue
419
- .toString()
420
- .match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
440
+ const match = fieldValue.toString().match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
421
441
  if (match) {
422
442
  const parameterValue = match.groups?.['bucket'] ?? fieldValue;
423
443
  Object.assign(routingParameter, { bucket: parameterValue });
424
444
  }
425
445
  }
426
446
  }
427
- options.otherArgs.headers['x-goog-request-params'] =
428
- this._gaxModule.routingHeader.fromParams(routingParameter);
429
- this.initialize();
430
- return this.innerApiCalls.getFolder(request, options, callback);
447
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
448
+ this.initialize().catch(err => { throw err; });
449
+ this._log.info('getFolder request %j', request);
450
+ const wrappedCallback = callback
451
+ ? (error, response, options, rawResponse) => {
452
+ this._log.info('getFolder response %j', response);
453
+ callback(error, response, options, rawResponse); // We verified callback above.
454
+ }
455
+ : undefined;
456
+ return this.innerApiCalls.getFolder(request, options, wrappedCallback)
457
+ ?.then(([response, options, rawResponse]) => {
458
+ this._log.info('getFolder response %j', response);
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;
466
+ });
431
467
  }
432
468
  getStorageLayout(request, optionsOrCallback, callback) {
433
469
  request = request || {};
@@ -445,23 +481,37 @@ class StorageControlClient {
445
481
  options = options || {};
446
482
  options.otherArgs = options.otherArgs || {};
447
483
  options.otherArgs.headers = options.otherArgs.headers || {};
448
- const routingParameter = {};
484
+ let routingParameter = {};
449
485
  {
450
486
  const fieldValue = request.name;
451
487
  if (fieldValue !== undefined && fieldValue !== null) {
452
- const match = fieldValue
453
- .toString()
454
- .match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
488
+ const match = fieldValue.toString().match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
455
489
  if (match) {
456
490
  const parameterValue = match.groups?.['bucket'] ?? fieldValue;
457
491
  Object.assign(routingParameter, { bucket: parameterValue });
458
492
  }
459
493
  }
460
494
  }
461
- options.otherArgs.headers['x-goog-request-params'] =
462
- this._gaxModule.routingHeader.fromParams(routingParameter);
463
- this.initialize();
464
- return this.innerApiCalls.getStorageLayout(request, options, callback);
495
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
496
+ this.initialize().catch(err => { throw err; });
497
+ this._log.info('getStorageLayout request %j', request);
498
+ const wrappedCallback = callback
499
+ ? (error, response, options, rawResponse) => {
500
+ this._log.info('getStorageLayout response %j', response);
501
+ callback(error, response, options, rawResponse); // We verified callback above.
502
+ }
503
+ : undefined;
504
+ return this.innerApiCalls.getStorageLayout(request, options, wrappedCallback)
505
+ ?.then(([response, options, rawResponse]) => {
506
+ this._log.info('getStorageLayout response %j', response);
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;
514
+ });
465
515
  }
466
516
  createManagedFolder(request, optionsOrCallback, callback) {
467
517
  request = request || {};
@@ -479,7 +529,7 @@ class StorageControlClient {
479
529
  options = options || {};
480
530
  options.otherArgs = options.otherArgs || {};
481
531
  options.otherArgs.headers = options.otherArgs.headers || {};
482
- const routingParameter = {};
532
+ let routingParameter = {};
483
533
  {
484
534
  const fieldValue = request.parent;
485
535
  if (fieldValue !== undefined && fieldValue !== null) {
@@ -489,13 +539,533 @@ class StorageControlClient {
489
539
  Object.assign(routingParameter, { bucket: parameterValue });
490
540
  }
491
541
  }
492
- }
493
- options.otherArgs.headers['x-goog-request-params'] =
494
- this._gaxModule.routingHeader.fromParams(routingParameter);
495
- this.initialize();
496
- return this.innerApiCalls.createManagedFolder(request, options, callback);
542
+ }
543
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
544
+ this.initialize().catch(err => { throw err; });
545
+ this._log.info('createManagedFolder request %j', request);
546
+ const wrappedCallback = callback
547
+ ? (error, response, options, rawResponse) => {
548
+ this._log.info('createManagedFolder response %j', response);
549
+ callback(error, response, options, rawResponse); // We verified callback above.
550
+ }
551
+ : undefined;
552
+ return this.innerApiCalls.createManagedFolder(request, options, wrappedCallback)
553
+ ?.then(([response, options, rawResponse]) => {
554
+ this._log.info('createManagedFolder response %j', response);
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;
562
+ });
563
+ }
564
+ deleteManagedFolder(request, optionsOrCallback, callback) {
565
+ request = request || {};
566
+ if (!request.requestId) {
567
+ request.requestId = gax.makeUUID();
568
+ }
569
+ let options;
570
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
571
+ callback = optionsOrCallback;
572
+ options = {};
573
+ }
574
+ else {
575
+ options = optionsOrCallback;
576
+ }
577
+ options = options || {};
578
+ options.otherArgs = options.otherArgs || {};
579
+ options.otherArgs.headers = options.otherArgs.headers || {};
580
+ let routingParameter = {};
581
+ {
582
+ const fieldValue = request.name;
583
+ if (fieldValue !== undefined && fieldValue !== null) {
584
+ const match = fieldValue.toString().match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
585
+ if (match) {
586
+ const parameterValue = match.groups?.['bucket'] ?? fieldValue;
587
+ Object.assign(routingParameter, { bucket: parameterValue });
588
+ }
589
+ }
590
+ }
591
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
592
+ this.initialize().catch(err => { throw err; });
593
+ this._log.info('deleteManagedFolder request %j', request);
594
+ const wrappedCallback = callback
595
+ ? (error, response, options, rawResponse) => {
596
+ this._log.info('deleteManagedFolder response %j', response);
597
+ callback(error, response, options, rawResponse); // We verified callback above.
598
+ }
599
+ : undefined;
600
+ return this.innerApiCalls.deleteManagedFolder(request, options, wrappedCallback)
601
+ ?.then(([response, options, rawResponse]) => {
602
+ this._log.info('deleteManagedFolder response %j', response);
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;
610
+ });
611
+ }
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
+ });
497
1067
  }
498
- deleteManagedFolder(request, optionsOrCallback, callback) {
1068
+ renameFolder(request, optionsOrCallback, callback) {
499
1069
  request = request || {};
500
1070
  if (!request.requestId) {
501
1071
  request.requestId = gax.makeUUID();
@@ -511,25 +1081,51 @@ class StorageControlClient {
511
1081
  options = options || {};
512
1082
  options.otherArgs = options.otherArgs || {};
513
1083
  options.otherArgs.headers = options.otherArgs.headers || {};
514
- const routingParameter = {};
1084
+ let routingParameter = {};
515
1085
  {
516
1086
  const fieldValue = request.name;
517
1087
  if (fieldValue !== undefined && fieldValue !== null) {
518
- const match = fieldValue
519
- .toString()
520
- .match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
1088
+ const match = fieldValue.toString().match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
521
1089
  if (match) {
522
1090
  const parameterValue = match.groups?.['bucket'] ?? fieldValue;
523
1091
  Object.assign(routingParameter, { bucket: parameterValue });
524
1092
  }
525
1093
  }
526
1094
  }
527
- options.otherArgs.headers['x-goog-request-params'] =
528
- this._gaxModule.routingHeader.fromParams(routingParameter);
529
- this.initialize();
530
- return this.innerApiCalls.deleteManagedFolder(request, options, callback);
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
+ });
531
1109
  }
532
- getManagedFolder(request, optionsOrCallback, callback) {
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) {
533
1129
  request = request || {};
534
1130
  if (!request.requestId) {
535
1131
  request.requestId = gax.makeUUID();
@@ -545,25 +1141,51 @@ class StorageControlClient {
545
1141
  options = options || {};
546
1142
  options.otherArgs = options.otherArgs || {};
547
1143
  options.otherArgs.headers = options.otherArgs.headers || {};
548
- const routingParameter = {};
1144
+ let routingParameter = {};
549
1145
  {
550
- const fieldValue = request.name;
1146
+ const fieldValue = request.parent;
551
1147
  if (fieldValue !== undefined && fieldValue !== null) {
552
- const match = fieldValue
553
- .toString()
554
- .match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
1148
+ const match = fieldValue.toString().match(RegExp('(?<bucket>(?:.*)?)'));
555
1149
  if (match) {
556
1150
  const parameterValue = match.groups?.['bucket'] ?? fieldValue;
557
1151
  Object.assign(routingParameter, { bucket: parameterValue });
558
1152
  }
559
1153
  }
560
1154
  }
561
- options.otherArgs.headers['x-goog-request-params'] =
562
- this._gaxModule.routingHeader.fromParams(routingParameter);
563
- this.initialize();
564
- return this.innerApiCalls.getManagedFolder(request, options, callback);
1155
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
1156
+ this.initialize().catch(err => { throw err; });
1157
+ const wrappedCallback = callback
1158
+ ? (error, response, rawResponse, _) => {
1159
+ this._log.info('createAnywhereCache response %j', rawResponse);
1160
+ callback(error, response, rawResponse, _); // We verified callback above.
1161
+ }
1162
+ : undefined;
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, _];
1168
+ });
565
1169
  }
566
- 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) {
567
1189
  request = request || {};
568
1190
  if (!request.requestId) {
569
1191
  request.requestId = gax.makeUUID();
@@ -579,39 +1201,48 @@ class StorageControlClient {
579
1201
  options = options || {};
580
1202
  options.otherArgs = options.otherArgs || {};
581
1203
  options.otherArgs.headers = options.otherArgs.headers || {};
582
- const routingParameter = {};
1204
+ let routingParameter = {};
583
1205
  {
584
- const fieldValue = request.name;
1206
+ const fieldValue = request.anywhereCache?.name;
585
1207
  if (fieldValue !== undefined && fieldValue !== null) {
586
- const match = fieldValue
587
- .toString()
588
- .match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
1208
+ const match = fieldValue.toString().match(RegExp('(?<bucket>projects/[^/]+/buckets/[^/]+)(?:/.*)?'));
589
1209
  if (match) {
590
1210
  const parameterValue = match.groups?.['bucket'] ?? fieldValue;
591
1211
  Object.assign(routingParameter, { bucket: parameterValue });
592
1212
  }
593
1213
  }
594
1214
  }
595
- options.otherArgs.headers['x-goog-request-params'] =
596
- this._gaxModule.routingHeader.fromParams(routingParameter);
597
- this.initialize();
598
- return this.innerApiCalls.renameFolder(request, options, callback);
1215
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
1216
+ this.initialize().catch(err => { throw err; });
1217
+ const wrappedCallback = callback
1218
+ ? (error, response, rawResponse, _) => {
1219
+ this._log.info('updateAnywhereCache response %j', rawResponse);
1220
+ callback(error, response, rawResponse, _); // We verified callback above.
1221
+ }
1222
+ : undefined;
1223
+ this._log.info('updateAnywhereCache request %j', request);
1224
+ return this.innerApiCalls.updateAnywhereCache(request, options, wrappedCallback)
1225
+ ?.then(([response, rawResponse, _]) => {
1226
+ this._log.info('updateAnywhereCache response %j', rawResponse);
1227
+ return [response, rawResponse, _];
1228
+ });
599
1229
  }
600
1230
  /**
601
- * Check the status of the long running operation returned by `renameFolder()`.
1231
+ * Check the status of the long running operation returned by `updateAnywhereCache()`.
602
1232
  * @param {String} name
603
1233
  * The operation name that will be passed.
604
1234
  * @returns {Promise} - The promise which resolves to an object.
605
1235
  * The decoded operation object has result and metadata field to get information from.
606
1236
  * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
607
1237
  * for more details and examples.
608
- * @example <caption>include:samples/generated/v2/storage_control.rename_folder.js</caption>
609
- * 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
610
1240
  */
611
- async checkRenameFolderProgress(name) {
1241
+ async checkUpdateAnywhereCacheProgress(name) {
1242
+ this._log.info('updateAnywhereCache long-running');
612
1243
  const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
613
1244
  const [operation] = await this.operationsClient.getOperation(request);
614
- 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());
615
1246
  return decodeOperation;
616
1247
  }
617
1248
  listFolders(request, optionsOrCallback, callback) {
@@ -627,7 +1258,7 @@ class StorageControlClient {
627
1258
  options = options || {};
628
1259
  options.otherArgs = options.otherArgs || {};
629
1260
  options.otherArgs.headers = options.otherArgs.headers || {};
630
- const routingParameter = {};
1261
+ let routingParameter = {};
631
1262
  {
632
1263
  const fieldValue = request.parent;
633
1264
  if (fieldValue !== undefined && fieldValue !== null) {
@@ -638,10 +1269,21 @@ class StorageControlClient {
638
1269
  }
639
1270
  }
640
1271
  }
641
- options.otherArgs.headers['x-goog-request-params'] =
642
- this._gaxModule.routingHeader.fromParams(routingParameter);
643
- this.initialize();
644
- return this.innerApiCalls.listFolders(request, options, callback);
1272
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
1273
+ this.initialize().catch(err => { throw err; });
1274
+ const wrappedCallback = callback
1275
+ ? (error, values, nextPageRequest, rawResponse) => {
1276
+ this._log.info('listFolders values %j', values);
1277
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
1278
+ }
1279
+ : undefined;
1280
+ this._log.info('listFolders request %j', request);
1281
+ return this.innerApiCalls
1282
+ .listFolders(request, options, wrappedCallback)
1283
+ ?.then(([response, input, output]) => {
1284
+ this._log.info('listFolders values %j', response);
1285
+ return [response, input, output];
1286
+ });
645
1287
  }
646
1288
  /**
647
1289
  * Equivalent to `listFolders`, but returns a NodeJS Stream object.
@@ -692,7 +1334,7 @@ class StorageControlClient {
692
1334
  options = options || {};
693
1335
  options.otherArgs = options.otherArgs || {};
694
1336
  options.otherArgs.headers = options.otherArgs.headers || {};
695
- const routingParameter = {};
1337
+ let routingParameter = {};
696
1338
  {
697
1339
  const fieldValue = request.parent;
698
1340
  if (fieldValue !== undefined && fieldValue !== null) {
@@ -703,11 +1345,11 @@ class StorageControlClient {
703
1345
  }
704
1346
  }
705
1347
  }
706
- options.otherArgs.headers['x-goog-request-params'] =
707
- this._gaxModule.routingHeader.fromParams(routingParameter);
1348
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
708
1349
  const defaultCallSettings = this._defaults['listFolders'];
709
1350
  const callSettings = defaultCallSettings.merge(options);
710
- this.initialize();
1351
+ this.initialize().catch(err => { throw err; });
1352
+ this._log.info('listFolders stream %j', request);
711
1353
  return this.descriptors.page.listFolders.createStream(this.innerApiCalls.listFolders, request, callSettings);
712
1354
  }
713
1355
  /**
@@ -762,7 +1404,7 @@ class StorageControlClient {
762
1404
  options = options || {};
763
1405
  options.otherArgs = options.otherArgs || {};
764
1406
  options.otherArgs.headers = options.otherArgs.headers || {};
765
- const routingParameter = {};
1407
+ let routingParameter = {};
766
1408
  {
767
1409
  const fieldValue = request.parent;
768
1410
  if (fieldValue !== undefined && fieldValue !== null) {
@@ -773,11 +1415,11 @@ class StorageControlClient {
773
1415
  }
774
1416
  }
775
1417
  }
776
- options.otherArgs.headers['x-goog-request-params'] =
777
- this._gaxModule.routingHeader.fromParams(routingParameter);
1418
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
778
1419
  const defaultCallSettings = this._defaults['listFolders'];
779
1420
  const callSettings = defaultCallSettings.merge(options);
780
- this.initialize();
1421
+ this.initialize().catch(err => { throw err; });
1422
+ this._log.info('listFolders iterate %j', request);
781
1423
  return this.descriptors.page.listFolders.asyncIterate(this.innerApiCalls['listFolders'], request, callSettings);
782
1424
  }
783
1425
  listManagedFolders(request, optionsOrCallback, callback) {
@@ -796,7 +1438,7 @@ class StorageControlClient {
796
1438
  options = options || {};
797
1439
  options.otherArgs = options.otherArgs || {};
798
1440
  options.otherArgs.headers = options.otherArgs.headers || {};
799
- const routingParameter = {};
1441
+ let routingParameter = {};
800
1442
  {
801
1443
  const fieldValue = request.parent;
802
1444
  if (fieldValue !== undefined && fieldValue !== null) {
@@ -807,10 +1449,21 @@ class StorageControlClient {
807
1449
  }
808
1450
  }
809
1451
  }
810
- options.otherArgs.headers['x-goog-request-params'] =
811
- this._gaxModule.routingHeader.fromParams(routingParameter);
812
- this.initialize();
813
- return this.innerApiCalls.listManagedFolders(request, options, callback);
1452
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
1453
+ this.initialize().catch(err => { throw err; });
1454
+ const wrappedCallback = callback
1455
+ ? (error, values, nextPageRequest, rawResponse) => {
1456
+ this._log.info('listManagedFolders values %j', values);
1457
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
1458
+ }
1459
+ : undefined;
1460
+ this._log.info('listManagedFolders request %j', request);
1461
+ return this.innerApiCalls
1462
+ .listManagedFolders(request, options, wrappedCallback)
1463
+ ?.then(([response, input, output]) => {
1464
+ this._log.info('listManagedFolders values %j', response);
1465
+ return [response, input, output];
1466
+ });
814
1467
  }
815
1468
  /**
816
1469
  * Equivalent to `listManagedFolders`, but returns a NodeJS Stream object.
@@ -849,7 +1502,7 @@ class StorageControlClient {
849
1502
  options = options || {};
850
1503
  options.otherArgs = options.otherArgs || {};
851
1504
  options.otherArgs.headers = options.otherArgs.headers || {};
852
- const routingParameter = {};
1505
+ let routingParameter = {};
853
1506
  {
854
1507
  const fieldValue = request.parent;
855
1508
  if (fieldValue !== undefined && fieldValue !== null) {
@@ -860,11 +1513,11 @@ class StorageControlClient {
860
1513
  }
861
1514
  }
862
1515
  }
863
- options.otherArgs.headers['x-goog-request-params'] =
864
- this._gaxModule.routingHeader.fromParams(routingParameter);
1516
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
865
1517
  const defaultCallSettings = this._defaults['listManagedFolders'];
866
1518
  const callSettings = defaultCallSettings.merge(options);
867
- this.initialize();
1519
+ this.initialize().catch(err => { throw err; });
1520
+ this._log.info('listManagedFolders stream %j', request);
868
1521
  return this.descriptors.page.listManagedFolders.createStream(this.innerApiCalls.listManagedFolders, request, callSettings);
869
1522
  }
870
1523
  /**
@@ -907,7 +1560,7 @@ class StorageControlClient {
907
1560
  options = options || {};
908
1561
  options.otherArgs = options.otherArgs || {};
909
1562
  options.otherArgs.headers = options.otherArgs.headers || {};
910
- const routingParameter = {};
1563
+ let routingParameter = {};
911
1564
  {
912
1565
  const fieldValue = request.parent;
913
1566
  if (fieldValue !== undefined && fieldValue !== null) {
@@ -918,43 +1571,193 @@ class StorageControlClient {
918
1571
  }
919
1572
  }
920
1573
  }
921
- options.otherArgs.headers['x-goog-request-params'] =
922
- this._gaxModule.routingHeader.fromParams(routingParameter);
1574
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
923
1575
  const defaultCallSettings = this._defaults['listManagedFolders'];
924
1576
  const callSettings = defaultCallSettings.merge(options);
925
- this.initialize();
1577
+ this.initialize().catch(err => { throw err; });
1578
+ this._log.info('listManagedFolders iterate %j', request);
926
1579
  return this.descriptors.page.listManagedFolders.asyncIterate(this.innerApiCalls['listManagedFolders'], request, callSettings);
927
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
+ }
928
1624
  /**
929
- * Gets the latest state of a long-running operation. Clients can use this
930
- * method to poll the operation result at intervals as recommended by the API
931
- * service.
932
- *
933
- * @param {Object} request - The request object that will be sent.
934
- * @param {string} request.name - The name of the operation resource.
935
- * @param {Object=} options
936
- * Optional parameters. You can override the default settings for this call,
937
- * e.g, timeout, retries, paginations, etc. See {@link
938
- * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
939
- * for the details.
940
- * @param {function(?Error, ?Object)=} callback
941
- * The function which will be called with the result of the API call.
942
- *
943
- * The second parameter to the callback is an object representing
944
- * {@link google.longrunning.Operation | google.longrunning.Operation}.
945
- * @return {Promise} - The promise which resolves to an array.
946
- * The first element of the array is an object representing
947
- * {@link google.longrunning.Operation | google.longrunning.Operation}.
948
- * 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.
949
1678
  *
950
- * @example
951
- * ```
952
- * const client = longrunning.operationsClient();
953
- * const name = '';
954
- * const [response] = await client.getOperation({name});
955
- * // doThingsWith(response)
956
- * ```
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
957
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
+ */
958
1761
  getOperation(request, optionsOrCallback, callback) {
959
1762
  let options;
960
1763
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -1108,6 +1911,51 @@ class StorageControlClient {
1108
1911
  // --------------------
1109
1912
  // -- Path templates --
1110
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
+ }
1111
1959
  /**
1112
1960
  * Return a fully-qualified bucket resource name string.
1113
1961
  *
@@ -1186,6 +2034,39 @@ class StorageControlClient {
1186
2034
  matchFolderFromFolderName(folderName) {
1187
2035
  return this.pathTemplates.folderPathTemplate.match(folderName).folder;
1188
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
+ }
1189
2070
  /**
1190
2071
  * Return a fully-qualified managedFolder resource name string.
1191
2072
  *
@@ -1209,8 +2090,7 @@ class StorageControlClient {
1209
2090
  * @returns {string} A string representing the project.
1210
2091
  */
1211
2092
  matchProjectFromManagedFolderName(managedFolderName) {
1212
- return this.pathTemplates.managedFolderPathTemplate.match(managedFolderName)
1213
- .project;
2093
+ return this.pathTemplates.managedFolderPathTemplate.match(managedFolderName).project;
1214
2094
  }
1215
2095
  /**
1216
2096
  * Parse the bucket from ManagedFolder resource.
@@ -1220,8 +2100,7 @@ class StorageControlClient {
1220
2100
  * @returns {string} A string representing the bucket.
1221
2101
  */
1222
2102
  matchBucketFromManagedFolderName(managedFolderName) {
1223
- return this.pathTemplates.managedFolderPathTemplate.match(managedFolderName)
1224
- .bucket;
2103
+ return this.pathTemplates.managedFolderPathTemplate.match(managedFolderName).bucket;
1225
2104
  }
1226
2105
  /**
1227
2106
  * Parse the managed_folder from ManagedFolder resource.
@@ -1231,8 +2110,40 @@ class StorageControlClient {
1231
2110
  * @returns {string} A string representing the managed_folder.
1232
2111
  */
1233
2112
  matchManagedFolderFromManagedFolderName(managedFolderName) {
1234
- return this.pathTemplates.managedFolderPathTemplate.match(managedFolderName)
1235
- .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;
1236
2147
  }
1237
2148
  /**
1238
2149
  * Return a fully-qualified project resource name string.
@@ -1255,6 +2166,39 @@ class StorageControlClient {
1255
2166
  matchProjectFromProjectName(projectName) {
1256
2167
  return this.pathTemplates.projectPathTemplate.match(projectName).project;
1257
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
+ }
1258
2202
  /**
1259
2203
  * Return a fully-qualified storageLayout resource name string.
1260
2204
  *
@@ -1276,8 +2220,7 @@ class StorageControlClient {
1276
2220
  * @returns {string} A string representing the project.
1277
2221
  */
1278
2222
  matchProjectFromStorageLayoutName(storageLayoutName) {
1279
- return this.pathTemplates.storageLayoutPathTemplate.match(storageLayoutName)
1280
- .project;
2223
+ return this.pathTemplates.storageLayoutPathTemplate.match(storageLayoutName).project;
1281
2224
  }
1282
2225
  /**
1283
2226
  * Parse the bucket from StorageLayout resource.
@@ -1287,8 +2230,7 @@ class StorageControlClient {
1287
2230
  * @returns {string} A string representing the bucket.
1288
2231
  */
1289
2232
  matchBucketFromStorageLayoutName(storageLayoutName) {
1290
- return this.pathTemplates.storageLayoutPathTemplate.match(storageLayoutName)
1291
- .bucket;
2233
+ return this.pathTemplates.storageLayoutPathTemplate.match(storageLayoutName).bucket;
1292
2234
  }
1293
2235
  /**
1294
2236
  * Terminate the gRPC channel and close the client.
@@ -1299,9 +2241,10 @@ class StorageControlClient {
1299
2241
  close() {
1300
2242
  if (this.storageControlStub && !this._terminated) {
1301
2243
  return this.storageControlStub.then(stub => {
2244
+ this._log.info('ending gRPC channel');
1302
2245
  this._terminated = true;
1303
2246
  stub.close();
1304
- this.operationsClient.close();
2247
+ void this.operationsClient.close();
1305
2248
  });
1306
2249
  }
1307
2250
  return Promise.resolve();