@google-cloud/spanner 7.20.0 → 8.0.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.
Files changed (54) hide show
  1. package/README.md +1 -0
  2. package/build/protos/google/spanner/admin/database/v1/backup.proto +1 -1
  3. package/build/protos/google/spanner/admin/database/v1/backup_schedule.proto +1 -1
  4. package/build/protos/google/spanner/admin/database/v1/common.proto +1 -1
  5. package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +1 -1
  6. package/build/protos/google/spanner/admin/instance/v1/common.proto +1 -1
  7. package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +1 -1
  8. package/build/protos/google/spanner/executor/v1/cloud_executor.proto +1 -1
  9. package/build/protos/google/spanner/v1/commit_response.proto +1 -1
  10. package/build/protos/google/spanner/v1/keys.proto +1 -1
  11. package/build/protos/google/spanner/v1/mutation.proto +1 -1
  12. package/build/protos/google/spanner/v1/query_plan.proto +1 -1
  13. package/build/protos/google/spanner/v1/result_set.proto +55 -49
  14. package/build/protos/google/spanner/v1/spanner.proto +1 -1
  15. package/build/protos/google/spanner/v1/transaction.proto +1 -1
  16. package/build/protos/google/spanner/v1/type.proto +1 -1
  17. package/build/protos/protos.d.ts +56 -50
  18. package/build/protos/protos.js +1016 -331
  19. package/build/protos/protos.json +47 -20
  20. package/build/src/backup.js +7 -0
  21. package/build/src/batch-transaction.d.ts +48 -29
  22. package/build/src/batch-transaction.js +13 -98
  23. package/build/src/codec.js +43 -26
  24. package/build/src/common-grpc/service-object.js +1 -0
  25. package/build/src/common-grpc/service.js +25 -8
  26. package/build/src/database.js +77 -49
  27. package/build/src/helper.d.ts +9 -0
  28. package/build/src/helper.js +24 -0
  29. package/build/src/index.js +24 -13
  30. package/build/src/instance-config.d.ts +1 -1
  31. package/build/src/instance-config.js +4 -0
  32. package/build/src/instance.js +12 -6
  33. package/build/src/instrument.d.ts +2 -0
  34. package/build/src/instrument.js +12 -9
  35. package/build/src/multiplexed-session.js +7 -1
  36. package/build/src/partial-result-stream.js +9 -5
  37. package/build/src/request_id_header.js +1 -0
  38. package/build/src/session-factory.js +5 -2
  39. package/build/src/session-pool.js +23 -6
  40. package/build/src/session.d.ts +2 -1
  41. package/build/src/session.js +8 -2
  42. package/build/src/table.js +6 -1
  43. package/build/src/transaction-runner.js +12 -2
  44. package/build/src/transaction.d.ts +2 -1
  45. package/build/src/transaction.js +95 -81
  46. package/build/src/v1/database_admin_client.d.ts +3 -2
  47. package/build/src/v1/database_admin_client.js +551 -167
  48. package/build/src/v1/instance_admin_client.d.ts +2 -1
  49. package/build/src/v1/instance_admin_client.js +453 -133
  50. package/build/src/v1/spanner_client.d.ts +2 -1
  51. package/build/src/v1/spanner_client.js +283 -85
  52. package/build/src/v1/spanner_executor_proxy_client.d.ts +2 -1
  53. package/build/src/v1/spanner_executor_proxy_client.js +41 -19
  54. package/package.json +57 -58
@@ -19,6 +19,7 @@
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.DatabaseAdminClient = void 0;
21
21
  const jsonProtos = require("../../protos/protos.json");
22
+ const google_gax_1 = require("google-gax");
22
23
  /**
23
24
  * Client JSON configuration object, loaded from
24
25
  * `src/v1/database_admin_client_config.json`.
@@ -38,6 +39,28 @@ const version = require('../../../package.json').version;
38
39
  * @memberof v1
39
40
  */
40
41
  class DatabaseAdminClient {
42
+ _terminated = false;
43
+ _opts;
44
+ _providedCustomServicePath;
45
+ _gaxModule;
46
+ _gaxGrpc;
47
+ _protos;
48
+ _defaults;
49
+ _universeDomain;
50
+ _servicePath;
51
+ _log = google_gax_1.loggingUtils.log('spanner');
52
+ auth;
53
+ descriptors = {
54
+ page: {},
55
+ stream: {},
56
+ longrunning: {},
57
+ batching: {},
58
+ };
59
+ warn;
60
+ innerApiCalls;
61
+ pathTemplates;
62
+ operationsClient;
63
+ databaseAdminStub;
41
64
  /**
42
65
  * Construct an instance of DatabaseAdminClient.
43
66
  *
@@ -60,7 +83,7 @@ class DatabaseAdminClient {
60
83
  * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
61
84
  * the environment variable GCLOUD_PROJECT for your project ID. If your
62
85
  * app is running in an environment which supports
63
- * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
86
+ * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
64
87
  * your project ID will be detected automatically.
65
88
  * @param {string} [options.apiEndpoint] - The domain name of the
66
89
  * API remote host.
@@ -78,32 +101,28 @@ class DatabaseAdminClient {
78
101
  * ```
79
102
  */
80
103
  constructor(opts, gaxInstance) {
81
- var _a, _b, _c, _d, _e;
82
- this._terminated = false;
83
- this.descriptors = {
84
- page: {},
85
- stream: {},
86
- longrunning: {},
87
- batching: {},
88
- };
89
104
  // Ensure that options include all the required fields.
90
105
  const staticMembers = this.constructor;
91
- if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) &&
92
- (opts === null || opts === void 0 ? void 0 : opts.universeDomain) &&
93
- (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) {
106
+ if (opts?.universe_domain &&
107
+ opts?.universeDomain &&
108
+ opts?.universe_domain !== opts?.universeDomain) {
94
109
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
95
110
  }
96
111
  const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
97
112
  ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
98
113
  : undefined;
99
114
  this._universeDomain =
100
- (_c = (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : universeDomainEnvVar) !== null && _c !== void 0 ? _c : 'googleapis.com';
115
+ opts?.universeDomain ??
116
+ opts?.universe_domain ??
117
+ universeDomainEnvVar ??
118
+ 'googleapis.com';
101
119
  this._servicePath = 'spanner.' + this._universeDomain;
102
- const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
103
- this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
104
- const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
105
- const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {};
106
- const fallback = (_e = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _e !== void 0 ? _e : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
120
+ const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
121
+ this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
122
+ const port = opts?.port || staticMembers.port;
123
+ const clientConfig = opts?.clientConfig ?? {};
124
+ const fallback = opts?.fallback ??
125
+ (typeof window !== 'undefined' && typeof window?.fetch === 'function');
107
126
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
108
127
  // Request numeric enum values if REST transport is used.
109
128
  opts.numericEnums = true;
@@ -393,7 +412,6 @@ class DatabaseAdminClient {
393
412
  return this.auth.getProjectId();
394
413
  }
395
414
  getDatabase(request, optionsOrCallback, callback) {
396
- var _a;
397
415
  request = request || {};
398
416
  let options;
399
417
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -408,13 +426,26 @@ class DatabaseAdminClient {
408
426
  options.otherArgs.headers = options.otherArgs.headers || {};
409
427
  options.otherArgs.headers['x-goog-request-params'] =
410
428
  this._gaxModule.routingHeader.fromParams({
411
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
429
+ name: request.name ?? '',
412
430
  });
413
- this.initialize();
414
- return this.innerApiCalls.getDatabase(request, options, callback);
431
+ this.initialize().catch(err => {
432
+ throw err;
433
+ });
434
+ this._log.info('getDatabase request %j', request);
435
+ const wrappedCallback = callback
436
+ ? (error, response, options, rawResponse) => {
437
+ this._log.info('getDatabase response %j', response);
438
+ callback(error, response, options, rawResponse); // We verified callback above.
439
+ }
440
+ : undefined;
441
+ return this.innerApiCalls
442
+ .getDatabase(request, options, wrappedCallback)
443
+ ?.then(([response, options, rawResponse]) => {
444
+ this._log.info('getDatabase response %j', response);
445
+ return [response, options, rawResponse];
446
+ });
415
447
  }
416
448
  dropDatabase(request, optionsOrCallback, callback) {
417
- var _a;
418
449
  request = request || {};
419
450
  let options;
420
451
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -429,13 +460,26 @@ class DatabaseAdminClient {
429
460
  options.otherArgs.headers = options.otherArgs.headers || {};
430
461
  options.otherArgs.headers['x-goog-request-params'] =
431
462
  this._gaxModule.routingHeader.fromParams({
432
- database: (_a = request.database) !== null && _a !== void 0 ? _a : '',
463
+ database: request.database ?? '',
433
464
  });
434
- this.initialize();
435
- return this.innerApiCalls.dropDatabase(request, options, callback);
465
+ this.initialize().catch(err => {
466
+ throw err;
467
+ });
468
+ this._log.info('dropDatabase request %j', request);
469
+ const wrappedCallback = callback
470
+ ? (error, response, options, rawResponse) => {
471
+ this._log.info('dropDatabase response %j', response);
472
+ callback(error, response, options, rawResponse); // We verified callback above.
473
+ }
474
+ : undefined;
475
+ return this.innerApiCalls
476
+ .dropDatabase(request, options, wrappedCallback)
477
+ ?.then(([response, options, rawResponse]) => {
478
+ this._log.info('dropDatabase response %j', response);
479
+ return [response, options, rawResponse];
480
+ });
436
481
  }
437
482
  getDatabaseDdl(request, optionsOrCallback, callback) {
438
- var _a;
439
483
  request = request || {};
440
484
  let options;
441
485
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -450,13 +494,26 @@ class DatabaseAdminClient {
450
494
  options.otherArgs.headers = options.otherArgs.headers || {};
451
495
  options.otherArgs.headers['x-goog-request-params'] =
452
496
  this._gaxModule.routingHeader.fromParams({
453
- database: (_a = request.database) !== null && _a !== void 0 ? _a : '',
497
+ database: request.database ?? '',
454
498
  });
455
- this.initialize();
456
- return this.innerApiCalls.getDatabaseDdl(request, options, callback);
499
+ this.initialize().catch(err => {
500
+ throw err;
501
+ });
502
+ this._log.info('getDatabaseDdl request %j', request);
503
+ const wrappedCallback = callback
504
+ ? (error, response, options, rawResponse) => {
505
+ this._log.info('getDatabaseDdl response %j', response);
506
+ callback(error, response, options, rawResponse); // We verified callback above.
507
+ }
508
+ : undefined;
509
+ return this.innerApiCalls
510
+ .getDatabaseDdl(request, options, wrappedCallback)
511
+ ?.then(([response, options, rawResponse]) => {
512
+ this._log.info('getDatabaseDdl response %j', response);
513
+ return [response, options, rawResponse];
514
+ });
457
515
  }
458
516
  setIamPolicy(request, optionsOrCallback, callback) {
459
- var _a;
460
517
  request = request || {};
461
518
  let options;
462
519
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -471,13 +528,26 @@ class DatabaseAdminClient {
471
528
  options.otherArgs.headers = options.otherArgs.headers || {};
472
529
  options.otherArgs.headers['x-goog-request-params'] =
473
530
  this._gaxModule.routingHeader.fromParams({
474
- resource: (_a = request.resource) !== null && _a !== void 0 ? _a : '',
531
+ resource: request.resource ?? '',
475
532
  });
476
- this.initialize();
477
- return this.innerApiCalls.setIamPolicy(request, options, callback);
533
+ this.initialize().catch(err => {
534
+ throw err;
535
+ });
536
+ this._log.info('setIamPolicy request %j', request);
537
+ const wrappedCallback = callback
538
+ ? (error, response, options, rawResponse) => {
539
+ this._log.info('setIamPolicy response %j', response);
540
+ callback(error, response, options, rawResponse); // We verified callback above.
541
+ }
542
+ : undefined;
543
+ return this.innerApiCalls
544
+ .setIamPolicy(request, options, wrappedCallback)
545
+ ?.then(([response, options, rawResponse]) => {
546
+ this._log.info('setIamPolicy response %j', response);
547
+ return [response, options, rawResponse];
548
+ });
478
549
  }
479
550
  getIamPolicy(request, optionsOrCallback, callback) {
480
- var _a;
481
551
  request = request || {};
482
552
  let options;
483
553
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -492,13 +562,26 @@ class DatabaseAdminClient {
492
562
  options.otherArgs.headers = options.otherArgs.headers || {};
493
563
  options.otherArgs.headers['x-goog-request-params'] =
494
564
  this._gaxModule.routingHeader.fromParams({
495
- resource: (_a = request.resource) !== null && _a !== void 0 ? _a : '',
565
+ resource: request.resource ?? '',
496
566
  });
497
- this.initialize();
498
- return this.innerApiCalls.getIamPolicy(request, options, callback);
567
+ this.initialize().catch(err => {
568
+ throw err;
569
+ });
570
+ this._log.info('getIamPolicy request %j', request);
571
+ const wrappedCallback = callback
572
+ ? (error, response, options, rawResponse) => {
573
+ this._log.info('getIamPolicy response %j', response);
574
+ callback(error, response, options, rawResponse); // We verified callback above.
575
+ }
576
+ : undefined;
577
+ return this.innerApiCalls
578
+ .getIamPolicy(request, options, wrappedCallback)
579
+ ?.then(([response, options, rawResponse]) => {
580
+ this._log.info('getIamPolicy response %j', response);
581
+ return [response, options, rawResponse];
582
+ });
499
583
  }
500
584
  testIamPermissions(request, optionsOrCallback, callback) {
501
- var _a;
502
585
  request = request || {};
503
586
  let options;
504
587
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -513,13 +596,26 @@ class DatabaseAdminClient {
513
596
  options.otherArgs.headers = options.otherArgs.headers || {};
514
597
  options.otherArgs.headers['x-goog-request-params'] =
515
598
  this._gaxModule.routingHeader.fromParams({
516
- resource: (_a = request.resource) !== null && _a !== void 0 ? _a : '',
599
+ resource: request.resource ?? '',
517
600
  });
518
- this.initialize();
519
- return this.innerApiCalls.testIamPermissions(request, options, callback);
601
+ this.initialize().catch(err => {
602
+ throw err;
603
+ });
604
+ this._log.info('testIamPermissions request %j', request);
605
+ const wrappedCallback = callback
606
+ ? (error, response, options, rawResponse) => {
607
+ this._log.info('testIamPermissions response %j', response);
608
+ callback(error, response, options, rawResponse); // We verified callback above.
609
+ }
610
+ : undefined;
611
+ return this.innerApiCalls
612
+ .testIamPermissions(request, options, wrappedCallback)
613
+ ?.then(([response, options, rawResponse]) => {
614
+ this._log.info('testIamPermissions response %j', response);
615
+ return [response, options, rawResponse];
616
+ });
520
617
  }
521
618
  getBackup(request, optionsOrCallback, callback) {
522
- var _a;
523
619
  request = request || {};
524
620
  let options;
525
621
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -534,13 +630,26 @@ class DatabaseAdminClient {
534
630
  options.otherArgs.headers = options.otherArgs.headers || {};
535
631
  options.otherArgs.headers['x-goog-request-params'] =
536
632
  this._gaxModule.routingHeader.fromParams({
537
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
633
+ name: request.name ?? '',
538
634
  });
539
- this.initialize();
540
- return this.innerApiCalls.getBackup(request, options, callback);
635
+ this.initialize().catch(err => {
636
+ throw err;
637
+ });
638
+ this._log.info('getBackup request %j', request);
639
+ const wrappedCallback = callback
640
+ ? (error, response, options, rawResponse) => {
641
+ this._log.info('getBackup response %j', response);
642
+ callback(error, response, options, rawResponse); // We verified callback above.
643
+ }
644
+ : undefined;
645
+ return this.innerApiCalls
646
+ .getBackup(request, options, wrappedCallback)
647
+ ?.then(([response, options, rawResponse]) => {
648
+ this._log.info('getBackup response %j', response);
649
+ return [response, options, rawResponse];
650
+ });
541
651
  }
542
652
  updateBackup(request, optionsOrCallback, callback) {
543
- var _a;
544
653
  request = request || {};
545
654
  let options;
546
655
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -555,13 +664,26 @@ class DatabaseAdminClient {
555
664
  options.otherArgs.headers = options.otherArgs.headers || {};
556
665
  options.otherArgs.headers['x-goog-request-params'] =
557
666
  this._gaxModule.routingHeader.fromParams({
558
- 'backup.name': (_a = request.backup.name) !== null && _a !== void 0 ? _a : '',
667
+ 'backup.name': request.backup.name ?? '',
559
668
  });
560
- this.initialize();
561
- return this.innerApiCalls.updateBackup(request, options, callback);
669
+ this.initialize().catch(err => {
670
+ throw err;
671
+ });
672
+ this._log.info('updateBackup request %j', request);
673
+ const wrappedCallback = callback
674
+ ? (error, response, options, rawResponse) => {
675
+ this._log.info('updateBackup response %j', response);
676
+ callback(error, response, options, rawResponse); // We verified callback above.
677
+ }
678
+ : undefined;
679
+ return this.innerApiCalls
680
+ .updateBackup(request, options, wrappedCallback)
681
+ ?.then(([response, options, rawResponse]) => {
682
+ this._log.info('updateBackup response %j', response);
683
+ return [response, options, rawResponse];
684
+ });
562
685
  }
563
686
  deleteBackup(request, optionsOrCallback, callback) {
564
- var _a;
565
687
  request = request || {};
566
688
  let options;
567
689
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -576,13 +698,26 @@ class DatabaseAdminClient {
576
698
  options.otherArgs.headers = options.otherArgs.headers || {};
577
699
  options.otherArgs.headers['x-goog-request-params'] =
578
700
  this._gaxModule.routingHeader.fromParams({
579
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
701
+ name: request.name ?? '',
580
702
  });
581
- this.initialize();
582
- return this.innerApiCalls.deleteBackup(request, options, callback);
703
+ this.initialize().catch(err => {
704
+ throw err;
705
+ });
706
+ this._log.info('deleteBackup request %j', request);
707
+ const wrappedCallback = callback
708
+ ? (error, response, options, rawResponse) => {
709
+ this._log.info('deleteBackup response %j', response);
710
+ callback(error, response, options, rawResponse); // We verified callback above.
711
+ }
712
+ : undefined;
713
+ return this.innerApiCalls
714
+ .deleteBackup(request, options, wrappedCallback)
715
+ ?.then(([response, options, rawResponse]) => {
716
+ this._log.info('deleteBackup response %j', response);
717
+ return [response, options, rawResponse];
718
+ });
583
719
  }
584
720
  addSplitPoints(request, optionsOrCallback, callback) {
585
- var _a;
586
721
  request = request || {};
587
722
  let options;
588
723
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -597,13 +732,26 @@ class DatabaseAdminClient {
597
732
  options.otherArgs.headers = options.otherArgs.headers || {};
598
733
  options.otherArgs.headers['x-goog-request-params'] =
599
734
  this._gaxModule.routingHeader.fromParams({
600
- database: (_a = request.database) !== null && _a !== void 0 ? _a : '',
735
+ database: request.database ?? '',
601
736
  });
602
- this.initialize();
603
- return this.innerApiCalls.addSplitPoints(request, options, callback);
737
+ this.initialize().catch(err => {
738
+ throw err;
739
+ });
740
+ this._log.info('addSplitPoints request %j', request);
741
+ const wrappedCallback = callback
742
+ ? (error, response, options, rawResponse) => {
743
+ this._log.info('addSplitPoints response %j', response);
744
+ callback(error, response, options, rawResponse); // We verified callback above.
745
+ }
746
+ : undefined;
747
+ return this.innerApiCalls
748
+ .addSplitPoints(request, options, wrappedCallback)
749
+ ?.then(([response, options, rawResponse]) => {
750
+ this._log.info('addSplitPoints response %j', response);
751
+ return [response, options, rawResponse];
752
+ });
604
753
  }
605
754
  createBackupSchedule(request, optionsOrCallback, callback) {
606
- var _a;
607
755
  request = request || {};
608
756
  let options;
609
757
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -618,13 +766,26 @@ class DatabaseAdminClient {
618
766
  options.otherArgs.headers = options.otherArgs.headers || {};
619
767
  options.otherArgs.headers['x-goog-request-params'] =
620
768
  this._gaxModule.routingHeader.fromParams({
621
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
769
+ parent: request.parent ?? '',
622
770
  });
623
- this.initialize();
624
- return this.innerApiCalls.createBackupSchedule(request, options, callback);
771
+ this.initialize().catch(err => {
772
+ throw err;
773
+ });
774
+ this._log.info('createBackupSchedule request %j', request);
775
+ const wrappedCallback = callback
776
+ ? (error, response, options, rawResponse) => {
777
+ this._log.info('createBackupSchedule response %j', response);
778
+ callback(error, response, options, rawResponse); // We verified callback above.
779
+ }
780
+ : undefined;
781
+ return this.innerApiCalls
782
+ .createBackupSchedule(request, options, wrappedCallback)
783
+ ?.then(([response, options, rawResponse]) => {
784
+ this._log.info('createBackupSchedule response %j', response);
785
+ return [response, options, rawResponse];
786
+ });
625
787
  }
626
788
  getBackupSchedule(request, optionsOrCallback, callback) {
627
- var _a;
628
789
  request = request || {};
629
790
  let options;
630
791
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -639,13 +800,26 @@ class DatabaseAdminClient {
639
800
  options.otherArgs.headers = options.otherArgs.headers || {};
640
801
  options.otherArgs.headers['x-goog-request-params'] =
641
802
  this._gaxModule.routingHeader.fromParams({
642
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
803
+ name: request.name ?? '',
643
804
  });
644
- this.initialize();
645
- return this.innerApiCalls.getBackupSchedule(request, options, callback);
805
+ this.initialize().catch(err => {
806
+ throw err;
807
+ });
808
+ this._log.info('getBackupSchedule request %j', request);
809
+ const wrappedCallback = callback
810
+ ? (error, response, options, rawResponse) => {
811
+ this._log.info('getBackupSchedule response %j', response);
812
+ callback(error, response, options, rawResponse); // We verified callback above.
813
+ }
814
+ : undefined;
815
+ return this.innerApiCalls
816
+ .getBackupSchedule(request, options, wrappedCallback)
817
+ ?.then(([response, options, rawResponse]) => {
818
+ this._log.info('getBackupSchedule response %j', response);
819
+ return [response, options, rawResponse];
820
+ });
646
821
  }
647
822
  updateBackupSchedule(request, optionsOrCallback, callback) {
648
- var _a;
649
823
  request = request || {};
650
824
  let options;
651
825
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -660,13 +834,26 @@ class DatabaseAdminClient {
660
834
  options.otherArgs.headers = options.otherArgs.headers || {};
661
835
  options.otherArgs.headers['x-goog-request-params'] =
662
836
  this._gaxModule.routingHeader.fromParams({
663
- 'backup_schedule.name': (_a = request.backupSchedule.name) !== null && _a !== void 0 ? _a : '',
837
+ 'backup_schedule.name': request.backupSchedule.name ?? '',
664
838
  });
665
- this.initialize();
666
- return this.innerApiCalls.updateBackupSchedule(request, options, callback);
839
+ this.initialize().catch(err => {
840
+ throw err;
841
+ });
842
+ this._log.info('updateBackupSchedule request %j', request);
843
+ const wrappedCallback = callback
844
+ ? (error, response, options, rawResponse) => {
845
+ this._log.info('updateBackupSchedule response %j', response);
846
+ callback(error, response, options, rawResponse); // We verified callback above.
847
+ }
848
+ : undefined;
849
+ return this.innerApiCalls
850
+ .updateBackupSchedule(request, options, wrappedCallback)
851
+ ?.then(([response, options, rawResponse]) => {
852
+ this._log.info('updateBackupSchedule response %j', response);
853
+ return [response, options, rawResponse];
854
+ });
667
855
  }
668
856
  deleteBackupSchedule(request, optionsOrCallback, callback) {
669
- var _a;
670
857
  request = request || {};
671
858
  let options;
672
859
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -681,13 +868,26 @@ class DatabaseAdminClient {
681
868
  options.otherArgs.headers = options.otherArgs.headers || {};
682
869
  options.otherArgs.headers['x-goog-request-params'] =
683
870
  this._gaxModule.routingHeader.fromParams({
684
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
871
+ name: request.name ?? '',
685
872
  });
686
- this.initialize();
687
- return this.innerApiCalls.deleteBackupSchedule(request, options, callback);
873
+ this.initialize().catch(err => {
874
+ throw err;
875
+ });
876
+ this._log.info('deleteBackupSchedule request %j', request);
877
+ const wrappedCallback = callback
878
+ ? (error, response, options, rawResponse) => {
879
+ this._log.info('deleteBackupSchedule response %j', response);
880
+ callback(error, response, options, rawResponse); // We verified callback above.
881
+ }
882
+ : undefined;
883
+ return this.innerApiCalls
884
+ .deleteBackupSchedule(request, options, wrappedCallback)
885
+ ?.then(([response, options, rawResponse]) => {
886
+ this._log.info('deleteBackupSchedule response %j', response);
887
+ return [response, options, rawResponse];
888
+ });
688
889
  }
689
890
  createDatabase(request, optionsOrCallback, callback) {
690
- var _a;
691
891
  request = request || {};
692
892
  let options;
693
893
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -702,10 +902,24 @@ class DatabaseAdminClient {
702
902
  options.otherArgs.headers = options.otherArgs.headers || {};
703
903
  options.otherArgs.headers['x-goog-request-params'] =
704
904
  this._gaxModule.routingHeader.fromParams({
705
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
905
+ parent: request.parent ?? '',
706
906
  });
707
- this.initialize();
708
- return this.innerApiCalls.createDatabase(request, options, callback);
907
+ this.initialize().catch(err => {
908
+ throw err;
909
+ });
910
+ const wrappedCallback = callback
911
+ ? (error, response, rawResponse, _) => {
912
+ this._log.info('createDatabase response %j', rawResponse);
913
+ callback(error, response, rawResponse, _); // We verified callback above.
914
+ }
915
+ : undefined;
916
+ this._log.info('createDatabase request %j', request);
917
+ return this.innerApiCalls
918
+ .createDatabase(request, options, wrappedCallback)
919
+ ?.then(([response, rawResponse, _]) => {
920
+ this._log.info('createDatabase response %j', rawResponse);
921
+ return [response, rawResponse, _];
922
+ });
709
923
  }
710
924
  /**
711
925
  * Check the status of the long running operation returned by `createDatabase()`.
@@ -717,13 +931,13 @@ class DatabaseAdminClient {
717
931
  * for more details and examples.
718
932
  */
719
933
  async checkCreateDatabaseProgress(name) {
934
+ this._log.info('createDatabase long-running');
720
935
  const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
721
936
  const [operation] = await this.operationsClient.getOperation(request);
722
937
  const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createDatabase, this._gaxModule.createDefaultBackoffSettings());
723
938
  return decodeOperation;
724
939
  }
725
940
  updateDatabase(request, optionsOrCallback, callback) {
726
- var _a;
727
941
  request = request || {};
728
942
  let options;
729
943
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -738,10 +952,24 @@ class DatabaseAdminClient {
738
952
  options.otherArgs.headers = options.otherArgs.headers || {};
739
953
  options.otherArgs.headers['x-goog-request-params'] =
740
954
  this._gaxModule.routingHeader.fromParams({
741
- 'database.name': (_a = request.database.name) !== null && _a !== void 0 ? _a : '',
955
+ 'database.name': request.database.name ?? '',
742
956
  });
743
- this.initialize();
744
- return this.innerApiCalls.updateDatabase(request, options, callback);
957
+ this.initialize().catch(err => {
958
+ throw err;
959
+ });
960
+ const wrappedCallback = callback
961
+ ? (error, response, rawResponse, _) => {
962
+ this._log.info('updateDatabase response %j', rawResponse);
963
+ callback(error, response, rawResponse, _); // We verified callback above.
964
+ }
965
+ : undefined;
966
+ this._log.info('updateDatabase request %j', request);
967
+ return this.innerApiCalls
968
+ .updateDatabase(request, options, wrappedCallback)
969
+ ?.then(([response, rawResponse, _]) => {
970
+ this._log.info('updateDatabase response %j', rawResponse);
971
+ return [response, rawResponse, _];
972
+ });
745
973
  }
746
974
  /**
747
975
  * Check the status of the long running operation returned by `updateDatabase()`.
@@ -753,13 +981,13 @@ class DatabaseAdminClient {
753
981
  * for more details and examples.
754
982
  */
755
983
  async checkUpdateDatabaseProgress(name) {
984
+ this._log.info('updateDatabase long-running');
756
985
  const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
757
986
  const [operation] = await this.operationsClient.getOperation(request);
758
987
  const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDatabase, this._gaxModule.createDefaultBackoffSettings());
759
988
  return decodeOperation;
760
989
  }
761
990
  updateDatabaseDdl(request, optionsOrCallback, callback) {
762
- var _a;
763
991
  request = request || {};
764
992
  let options;
765
993
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -774,10 +1002,24 @@ class DatabaseAdminClient {
774
1002
  options.otherArgs.headers = options.otherArgs.headers || {};
775
1003
  options.otherArgs.headers['x-goog-request-params'] =
776
1004
  this._gaxModule.routingHeader.fromParams({
777
- database: (_a = request.database) !== null && _a !== void 0 ? _a : '',
1005
+ database: request.database ?? '',
778
1006
  });
779
- this.initialize();
780
- return this.innerApiCalls.updateDatabaseDdl(request, options, callback);
1007
+ this.initialize().catch(err => {
1008
+ throw err;
1009
+ });
1010
+ const wrappedCallback = callback
1011
+ ? (error, response, rawResponse, _) => {
1012
+ this._log.info('updateDatabaseDdl response %j', rawResponse);
1013
+ callback(error, response, rawResponse, _); // We verified callback above.
1014
+ }
1015
+ : undefined;
1016
+ this._log.info('updateDatabaseDdl request %j', request);
1017
+ return this.innerApiCalls
1018
+ .updateDatabaseDdl(request, options, wrappedCallback)
1019
+ ?.then(([response, rawResponse, _]) => {
1020
+ this._log.info('updateDatabaseDdl response %j', rawResponse);
1021
+ return [response, rawResponse, _];
1022
+ });
781
1023
  }
782
1024
  /**
783
1025
  * Check the status of the long running operation returned by `updateDatabaseDdl()`.
@@ -789,13 +1031,13 @@ class DatabaseAdminClient {
789
1031
  * for more details and examples.
790
1032
  */
791
1033
  async checkUpdateDatabaseDdlProgress(name) {
1034
+ this._log.info('updateDatabaseDdl long-running');
792
1035
  const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
793
1036
  const [operation] = await this.operationsClient.getOperation(request);
794
1037
  const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDatabaseDdl, this._gaxModule.createDefaultBackoffSettings());
795
1038
  return decodeOperation;
796
1039
  }
797
1040
  createBackup(request, optionsOrCallback, callback) {
798
- var _a;
799
1041
  request = request || {};
800
1042
  let options;
801
1043
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -810,10 +1052,24 @@ class DatabaseAdminClient {
810
1052
  options.otherArgs.headers = options.otherArgs.headers || {};
811
1053
  options.otherArgs.headers['x-goog-request-params'] =
812
1054
  this._gaxModule.routingHeader.fromParams({
813
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1055
+ parent: request.parent ?? '',
814
1056
  });
815
- this.initialize();
816
- return this.innerApiCalls.createBackup(request, options, callback);
1057
+ this.initialize().catch(err => {
1058
+ throw err;
1059
+ });
1060
+ const wrappedCallback = callback
1061
+ ? (error, response, rawResponse, _) => {
1062
+ this._log.info('createBackup response %j', rawResponse);
1063
+ callback(error, response, rawResponse, _); // We verified callback above.
1064
+ }
1065
+ : undefined;
1066
+ this._log.info('createBackup request %j', request);
1067
+ return this.innerApiCalls
1068
+ .createBackup(request, options, wrappedCallback)
1069
+ ?.then(([response, rawResponse, _]) => {
1070
+ this._log.info('createBackup response %j', rawResponse);
1071
+ return [response, rawResponse, _];
1072
+ });
817
1073
  }
818
1074
  /**
819
1075
  * Check the status of the long running operation returned by `createBackup()`.
@@ -825,13 +1081,13 @@ class DatabaseAdminClient {
825
1081
  * for more details and examples.
826
1082
  */
827
1083
  async checkCreateBackupProgress(name) {
1084
+ this._log.info('createBackup long-running');
828
1085
  const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
829
1086
  const [operation] = await this.operationsClient.getOperation(request);
830
1087
  const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBackup, this._gaxModule.createDefaultBackoffSettings());
831
1088
  return decodeOperation;
832
1089
  }
833
1090
  copyBackup(request, optionsOrCallback, callback) {
834
- var _a;
835
1091
  request = request || {};
836
1092
  let options;
837
1093
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -846,10 +1102,24 @@ class DatabaseAdminClient {
846
1102
  options.otherArgs.headers = options.otherArgs.headers || {};
847
1103
  options.otherArgs.headers['x-goog-request-params'] =
848
1104
  this._gaxModule.routingHeader.fromParams({
849
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1105
+ parent: request.parent ?? '',
850
1106
  });
851
- this.initialize();
852
- return this.innerApiCalls.copyBackup(request, options, callback);
1107
+ this.initialize().catch(err => {
1108
+ throw err;
1109
+ });
1110
+ const wrappedCallback = callback
1111
+ ? (error, response, rawResponse, _) => {
1112
+ this._log.info('copyBackup response %j', rawResponse);
1113
+ callback(error, response, rawResponse, _); // We verified callback above.
1114
+ }
1115
+ : undefined;
1116
+ this._log.info('copyBackup request %j', request);
1117
+ return this.innerApiCalls
1118
+ .copyBackup(request, options, wrappedCallback)
1119
+ ?.then(([response, rawResponse, _]) => {
1120
+ this._log.info('copyBackup response %j', rawResponse);
1121
+ return [response, rawResponse, _];
1122
+ });
853
1123
  }
854
1124
  /**
855
1125
  * Check the status of the long running operation returned by `copyBackup()`.
@@ -861,13 +1131,13 @@ class DatabaseAdminClient {
861
1131
  * for more details and examples.
862
1132
  */
863
1133
  async checkCopyBackupProgress(name) {
1134
+ this._log.info('copyBackup long-running');
864
1135
  const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
865
1136
  const [operation] = await this.operationsClient.getOperation(request);
866
1137
  const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.copyBackup, this._gaxModule.createDefaultBackoffSettings());
867
1138
  return decodeOperation;
868
1139
  }
869
1140
  restoreDatabase(request, optionsOrCallback, callback) {
870
- var _a;
871
1141
  request = request || {};
872
1142
  let options;
873
1143
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -882,10 +1152,24 @@ class DatabaseAdminClient {
882
1152
  options.otherArgs.headers = options.otherArgs.headers || {};
883
1153
  options.otherArgs.headers['x-goog-request-params'] =
884
1154
  this._gaxModule.routingHeader.fromParams({
885
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1155
+ parent: request.parent ?? '',
886
1156
  });
887
- this.initialize();
888
- return this.innerApiCalls.restoreDatabase(request, options, callback);
1157
+ this.initialize().catch(err => {
1158
+ throw err;
1159
+ });
1160
+ const wrappedCallback = callback
1161
+ ? (error, response, rawResponse, _) => {
1162
+ this._log.info('restoreDatabase response %j', rawResponse);
1163
+ callback(error, response, rawResponse, _); // We verified callback above.
1164
+ }
1165
+ : undefined;
1166
+ this._log.info('restoreDatabase request %j', request);
1167
+ return this.innerApiCalls
1168
+ .restoreDatabase(request, options, wrappedCallback)
1169
+ ?.then(([response, rawResponse, _]) => {
1170
+ this._log.info('restoreDatabase response %j', rawResponse);
1171
+ return [response, rawResponse, _];
1172
+ });
889
1173
  }
890
1174
  /**
891
1175
  * Check the status of the long running operation returned by `restoreDatabase()`.
@@ -897,13 +1181,13 @@ class DatabaseAdminClient {
897
1181
  * for more details and examples.
898
1182
  */
899
1183
  async checkRestoreDatabaseProgress(name) {
1184
+ this._log.info('restoreDatabase long-running');
900
1185
  const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
901
1186
  const [operation] = await this.operationsClient.getOperation(request);
902
1187
  const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restoreDatabase, this._gaxModule.createDefaultBackoffSettings());
903
1188
  return decodeOperation;
904
1189
  }
905
1190
  listDatabases(request, optionsOrCallback, callback) {
906
- var _a;
907
1191
  request = request || {};
908
1192
  let options;
909
1193
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -918,10 +1202,24 @@ class DatabaseAdminClient {
918
1202
  options.otherArgs.headers = options.otherArgs.headers || {};
919
1203
  options.otherArgs.headers['x-goog-request-params'] =
920
1204
  this._gaxModule.routingHeader.fromParams({
921
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1205
+ parent: request.parent ?? '',
922
1206
  });
923
- this.initialize();
924
- return this.innerApiCalls.listDatabases(request, options, callback);
1207
+ this.initialize().catch(err => {
1208
+ throw err;
1209
+ });
1210
+ const wrappedCallback = callback
1211
+ ? (error, values, nextPageRequest, rawResponse) => {
1212
+ this._log.info('listDatabases values %j', values);
1213
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
1214
+ }
1215
+ : undefined;
1216
+ this._log.info('listDatabases request %j', request);
1217
+ return this.innerApiCalls
1218
+ .listDatabases(request, options, wrappedCallback)
1219
+ ?.then(([response, input, output]) => {
1220
+ this._log.info('listDatabases values %j', response);
1221
+ return [response, input, output];
1222
+ });
925
1223
  }
926
1224
  /**
927
1225
  * Equivalent to `listDatabases`, but returns a NodeJS Stream object.
@@ -950,18 +1248,20 @@ class DatabaseAdminClient {
950
1248
  * for more details and examples.
951
1249
  */
952
1250
  listDatabasesStream(request, options) {
953
- var _a;
954
1251
  request = request || {};
955
1252
  options = options || {};
956
1253
  options.otherArgs = options.otherArgs || {};
957
1254
  options.otherArgs.headers = options.otherArgs.headers || {};
958
1255
  options.otherArgs.headers['x-goog-request-params'] =
959
1256
  this._gaxModule.routingHeader.fromParams({
960
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1257
+ parent: request.parent ?? '',
961
1258
  });
962
1259
  const defaultCallSettings = this._defaults['listDatabases'];
963
1260
  const callSettings = defaultCallSettings.merge(options);
964
- this.initialize();
1261
+ this.initialize().catch(err => {
1262
+ throw err;
1263
+ });
1264
+ this._log.info('listDatabases stream %j', request);
965
1265
  return this.descriptors.page.listDatabases.createStream(this.innerApiCalls.listDatabases, request, callSettings);
966
1266
  }
967
1267
  /**
@@ -992,22 +1292,23 @@ class DatabaseAdminClient {
992
1292
  * for more details and examples.
993
1293
  */
994
1294
  listDatabasesAsync(request, options) {
995
- var _a;
996
1295
  request = request || {};
997
1296
  options = options || {};
998
1297
  options.otherArgs = options.otherArgs || {};
999
1298
  options.otherArgs.headers = options.otherArgs.headers || {};
1000
1299
  options.otherArgs.headers['x-goog-request-params'] =
1001
1300
  this._gaxModule.routingHeader.fromParams({
1002
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1301
+ parent: request.parent ?? '',
1003
1302
  });
1004
1303
  const defaultCallSettings = this._defaults['listDatabases'];
1005
1304
  const callSettings = defaultCallSettings.merge(options);
1006
- this.initialize();
1305
+ this.initialize().catch(err => {
1306
+ throw err;
1307
+ });
1308
+ this._log.info('listDatabases iterate %j', request);
1007
1309
  return this.descriptors.page.listDatabases.asyncIterate(this.innerApiCalls['listDatabases'], request, callSettings);
1008
1310
  }
1009
1311
  listBackups(request, optionsOrCallback, callback) {
1010
- var _a;
1011
1312
  request = request || {};
1012
1313
  let options;
1013
1314
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -1022,10 +1323,24 @@ class DatabaseAdminClient {
1022
1323
  options.otherArgs.headers = options.otherArgs.headers || {};
1023
1324
  options.otherArgs.headers['x-goog-request-params'] =
1024
1325
  this._gaxModule.routingHeader.fromParams({
1025
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1326
+ parent: request.parent ?? '',
1026
1327
  });
1027
- this.initialize();
1028
- return this.innerApiCalls.listBackups(request, options, callback);
1328
+ this.initialize().catch(err => {
1329
+ throw err;
1330
+ });
1331
+ const wrappedCallback = callback
1332
+ ? (error, values, nextPageRequest, rawResponse) => {
1333
+ this._log.info('listBackups values %j', values);
1334
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
1335
+ }
1336
+ : undefined;
1337
+ this._log.info('listBackups request %j', request);
1338
+ return this.innerApiCalls
1339
+ .listBackups(request, options, wrappedCallback)
1340
+ ?.then(([response, input, output]) => {
1341
+ this._log.info('listBackups values %j', response);
1342
+ return [response, input, output];
1343
+ });
1029
1344
  }
1030
1345
  /**
1031
1346
  * Equivalent to `listBackups`, but returns a NodeJS Stream object.
@@ -1096,18 +1411,20 @@ class DatabaseAdminClient {
1096
1411
  * for more details and examples.
1097
1412
  */
1098
1413
  listBackupsStream(request, options) {
1099
- var _a;
1100
1414
  request = request || {};
1101
1415
  options = options || {};
1102
1416
  options.otherArgs = options.otherArgs || {};
1103
1417
  options.otherArgs.headers = options.otherArgs.headers || {};
1104
1418
  options.otherArgs.headers['x-goog-request-params'] =
1105
1419
  this._gaxModule.routingHeader.fromParams({
1106
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1420
+ parent: request.parent ?? '',
1107
1421
  });
1108
1422
  const defaultCallSettings = this._defaults['listBackups'];
1109
1423
  const callSettings = defaultCallSettings.merge(options);
1110
- this.initialize();
1424
+ this.initialize().catch(err => {
1425
+ throw err;
1426
+ });
1427
+ this._log.info('listBackups stream %j', request);
1111
1428
  return this.descriptors.page.listBackups.createStream(this.innerApiCalls.listBackups, request, callSettings);
1112
1429
  }
1113
1430
  /**
@@ -1180,22 +1497,23 @@ class DatabaseAdminClient {
1180
1497
  * for more details and examples.
1181
1498
  */
1182
1499
  listBackupsAsync(request, options) {
1183
- var _a;
1184
1500
  request = request || {};
1185
1501
  options = options || {};
1186
1502
  options.otherArgs = options.otherArgs || {};
1187
1503
  options.otherArgs.headers = options.otherArgs.headers || {};
1188
1504
  options.otherArgs.headers['x-goog-request-params'] =
1189
1505
  this._gaxModule.routingHeader.fromParams({
1190
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1506
+ parent: request.parent ?? '',
1191
1507
  });
1192
1508
  const defaultCallSettings = this._defaults['listBackups'];
1193
1509
  const callSettings = defaultCallSettings.merge(options);
1194
- this.initialize();
1510
+ this.initialize().catch(err => {
1511
+ throw err;
1512
+ });
1513
+ this._log.info('listBackups iterate %j', request);
1195
1514
  return this.descriptors.page.listBackups.asyncIterate(this.innerApiCalls['listBackups'], request, callSettings);
1196
1515
  }
1197
1516
  listDatabaseOperations(request, optionsOrCallback, callback) {
1198
- var _a;
1199
1517
  request = request || {};
1200
1518
  let options;
1201
1519
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -1210,10 +1528,24 @@ class DatabaseAdminClient {
1210
1528
  options.otherArgs.headers = options.otherArgs.headers || {};
1211
1529
  options.otherArgs.headers['x-goog-request-params'] =
1212
1530
  this._gaxModule.routingHeader.fromParams({
1213
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1531
+ parent: request.parent ?? '',
1214
1532
  });
1215
- this.initialize();
1216
- return this.innerApiCalls.listDatabaseOperations(request, options, callback);
1533
+ this.initialize().catch(err => {
1534
+ throw err;
1535
+ });
1536
+ const wrappedCallback = callback
1537
+ ? (error, values, nextPageRequest, rawResponse) => {
1538
+ this._log.info('listDatabaseOperations values %j', values);
1539
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
1540
+ }
1541
+ : undefined;
1542
+ this._log.info('listDatabaseOperations request %j', request);
1543
+ return this.innerApiCalls
1544
+ .listDatabaseOperations(request, options, wrappedCallback)
1545
+ ?.then(([response, input, output]) => {
1546
+ this._log.info('listDatabaseOperations values %j', response);
1547
+ return [response, input, output];
1548
+ });
1217
1549
  }
1218
1550
  /**
1219
1551
  * Equivalent to `listDatabaseOperations`, but returns a NodeJS Stream object.
@@ -1289,18 +1621,20 @@ class DatabaseAdminClient {
1289
1621
  * for more details and examples.
1290
1622
  */
1291
1623
  listDatabaseOperationsStream(request, options) {
1292
- var _a;
1293
1624
  request = request || {};
1294
1625
  options = options || {};
1295
1626
  options.otherArgs = options.otherArgs || {};
1296
1627
  options.otherArgs.headers = options.otherArgs.headers || {};
1297
1628
  options.otherArgs.headers['x-goog-request-params'] =
1298
1629
  this._gaxModule.routingHeader.fromParams({
1299
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1630
+ parent: request.parent ?? '',
1300
1631
  });
1301
1632
  const defaultCallSettings = this._defaults['listDatabaseOperations'];
1302
1633
  const callSettings = defaultCallSettings.merge(options);
1303
- this.initialize();
1634
+ this.initialize().catch(err => {
1635
+ throw err;
1636
+ });
1637
+ this._log.info('listDatabaseOperations stream %j', request);
1304
1638
  return this.descriptors.page.listDatabaseOperations.createStream(this.innerApiCalls.listDatabaseOperations, request, callSettings);
1305
1639
  }
1306
1640
  /**
@@ -1378,22 +1712,23 @@ class DatabaseAdminClient {
1378
1712
  * for more details and examples.
1379
1713
  */
1380
1714
  listDatabaseOperationsAsync(request, options) {
1381
- var _a;
1382
1715
  request = request || {};
1383
1716
  options = options || {};
1384
1717
  options.otherArgs = options.otherArgs || {};
1385
1718
  options.otherArgs.headers = options.otherArgs.headers || {};
1386
1719
  options.otherArgs.headers['x-goog-request-params'] =
1387
1720
  this._gaxModule.routingHeader.fromParams({
1388
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1721
+ parent: request.parent ?? '',
1389
1722
  });
1390
1723
  const defaultCallSettings = this._defaults['listDatabaseOperations'];
1391
1724
  const callSettings = defaultCallSettings.merge(options);
1392
- this.initialize();
1725
+ this.initialize().catch(err => {
1726
+ throw err;
1727
+ });
1728
+ this._log.info('listDatabaseOperations iterate %j', request);
1393
1729
  return this.descriptors.page.listDatabaseOperations.asyncIterate(this.innerApiCalls['listDatabaseOperations'], request, callSettings);
1394
1730
  }
1395
1731
  listBackupOperations(request, optionsOrCallback, callback) {
1396
- var _a;
1397
1732
  request = request || {};
1398
1733
  let options;
1399
1734
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -1408,10 +1743,24 @@ class DatabaseAdminClient {
1408
1743
  options.otherArgs.headers = options.otherArgs.headers || {};
1409
1744
  options.otherArgs.headers['x-goog-request-params'] =
1410
1745
  this._gaxModule.routingHeader.fromParams({
1411
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1746
+ parent: request.parent ?? '',
1412
1747
  });
1413
- this.initialize();
1414
- return this.innerApiCalls.listBackupOperations(request, options, callback);
1748
+ this.initialize().catch(err => {
1749
+ throw err;
1750
+ });
1751
+ const wrappedCallback = callback
1752
+ ? (error, values, nextPageRequest, rawResponse) => {
1753
+ this._log.info('listBackupOperations values %j', values);
1754
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
1755
+ }
1756
+ : undefined;
1757
+ this._log.info('listBackupOperations request %j', request);
1758
+ return this.innerApiCalls
1759
+ .listBackupOperations(request, options, wrappedCallback)
1760
+ ?.then(([response, input, output]) => {
1761
+ this._log.info('listBackupOperations values %j', response);
1762
+ return [response, input, output];
1763
+ });
1415
1764
  }
1416
1765
  /**
1417
1766
  * Equivalent to `listBackupOperations`, but returns a NodeJS Stream object.
@@ -1512,18 +1861,20 @@ class DatabaseAdminClient {
1512
1861
  * for more details and examples.
1513
1862
  */
1514
1863
  listBackupOperationsStream(request, options) {
1515
- var _a;
1516
1864
  request = request || {};
1517
1865
  options = options || {};
1518
1866
  options.otherArgs = options.otherArgs || {};
1519
1867
  options.otherArgs.headers = options.otherArgs.headers || {};
1520
1868
  options.otherArgs.headers['x-goog-request-params'] =
1521
1869
  this._gaxModule.routingHeader.fromParams({
1522
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1870
+ parent: request.parent ?? '',
1523
1871
  });
1524
1872
  const defaultCallSettings = this._defaults['listBackupOperations'];
1525
1873
  const callSettings = defaultCallSettings.merge(options);
1526
- this.initialize();
1874
+ this.initialize().catch(err => {
1875
+ throw err;
1876
+ });
1877
+ this._log.info('listBackupOperations stream %j', request);
1527
1878
  return this.descriptors.page.listBackupOperations.createStream(this.innerApiCalls.listBackupOperations, request, callSettings);
1528
1879
  }
1529
1880
  /**
@@ -1626,22 +1977,23 @@ class DatabaseAdminClient {
1626
1977
  * for more details and examples.
1627
1978
  */
1628
1979
  listBackupOperationsAsync(request, options) {
1629
- var _a;
1630
1980
  request = request || {};
1631
1981
  options = options || {};
1632
1982
  options.otherArgs = options.otherArgs || {};
1633
1983
  options.otherArgs.headers = options.otherArgs.headers || {};
1634
1984
  options.otherArgs.headers['x-goog-request-params'] =
1635
1985
  this._gaxModule.routingHeader.fromParams({
1636
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1986
+ parent: request.parent ?? '',
1637
1987
  });
1638
1988
  const defaultCallSettings = this._defaults['listBackupOperations'];
1639
1989
  const callSettings = defaultCallSettings.merge(options);
1640
- this.initialize();
1990
+ this.initialize().catch(err => {
1991
+ throw err;
1992
+ });
1993
+ this._log.info('listBackupOperations iterate %j', request);
1641
1994
  return this.descriptors.page.listBackupOperations.asyncIterate(this.innerApiCalls['listBackupOperations'], request, callSettings);
1642
1995
  }
1643
1996
  listDatabaseRoles(request, optionsOrCallback, callback) {
1644
- var _a;
1645
1997
  request = request || {};
1646
1998
  let options;
1647
1999
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -1656,10 +2008,24 @@ class DatabaseAdminClient {
1656
2008
  options.otherArgs.headers = options.otherArgs.headers || {};
1657
2009
  options.otherArgs.headers['x-goog-request-params'] =
1658
2010
  this._gaxModule.routingHeader.fromParams({
1659
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
2011
+ parent: request.parent ?? '',
1660
2012
  });
1661
- this.initialize();
1662
- return this.innerApiCalls.listDatabaseRoles(request, options, callback);
2013
+ this.initialize().catch(err => {
2014
+ throw err;
2015
+ });
2016
+ const wrappedCallback = callback
2017
+ ? (error, values, nextPageRequest, rawResponse) => {
2018
+ this._log.info('listDatabaseRoles values %j', values);
2019
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
2020
+ }
2021
+ : undefined;
2022
+ this._log.info('listDatabaseRoles request %j', request);
2023
+ return this.innerApiCalls
2024
+ .listDatabaseRoles(request, options, wrappedCallback)
2025
+ ?.then(([response, input, output]) => {
2026
+ this._log.info('listDatabaseRoles values %j', response);
2027
+ return [response, input, output];
2028
+ });
1663
2029
  }
1664
2030
  /**
1665
2031
  * Equivalent to `listDatabaseRoles`, but returns a NodeJS Stream object.
@@ -1689,18 +2055,20 @@ class DatabaseAdminClient {
1689
2055
  * for more details and examples.
1690
2056
  */
1691
2057
  listDatabaseRolesStream(request, options) {
1692
- var _a;
1693
2058
  request = request || {};
1694
2059
  options = options || {};
1695
2060
  options.otherArgs = options.otherArgs || {};
1696
2061
  options.otherArgs.headers = options.otherArgs.headers || {};
1697
2062
  options.otherArgs.headers['x-goog-request-params'] =
1698
2063
  this._gaxModule.routingHeader.fromParams({
1699
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
2064
+ parent: request.parent ?? '',
1700
2065
  });
1701
2066
  const defaultCallSettings = this._defaults['listDatabaseRoles'];
1702
2067
  const callSettings = defaultCallSettings.merge(options);
1703
- this.initialize();
2068
+ this.initialize().catch(err => {
2069
+ throw err;
2070
+ });
2071
+ this._log.info('listDatabaseRoles stream %j', request);
1704
2072
  return this.descriptors.page.listDatabaseRoles.createStream(this.innerApiCalls.listDatabaseRoles, request, callSettings);
1705
2073
  }
1706
2074
  /**
@@ -1732,22 +2100,23 @@ class DatabaseAdminClient {
1732
2100
  * for more details and examples.
1733
2101
  */
1734
2102
  listDatabaseRolesAsync(request, options) {
1735
- var _a;
1736
2103
  request = request || {};
1737
2104
  options = options || {};
1738
2105
  options.otherArgs = options.otherArgs || {};
1739
2106
  options.otherArgs.headers = options.otherArgs.headers || {};
1740
2107
  options.otherArgs.headers['x-goog-request-params'] =
1741
2108
  this._gaxModule.routingHeader.fromParams({
1742
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
2109
+ parent: request.parent ?? '',
1743
2110
  });
1744
2111
  const defaultCallSettings = this._defaults['listDatabaseRoles'];
1745
2112
  const callSettings = defaultCallSettings.merge(options);
1746
- this.initialize();
2113
+ this.initialize().catch(err => {
2114
+ throw err;
2115
+ });
2116
+ this._log.info('listDatabaseRoles iterate %j', request);
1747
2117
  return this.descriptors.page.listDatabaseRoles.asyncIterate(this.innerApiCalls['listDatabaseRoles'], request, callSettings);
1748
2118
  }
1749
2119
  listBackupSchedules(request, optionsOrCallback, callback) {
1750
- var _a;
1751
2120
  request = request || {};
1752
2121
  let options;
1753
2122
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -1762,10 +2131,24 @@ class DatabaseAdminClient {
1762
2131
  options.otherArgs.headers = options.otherArgs.headers || {};
1763
2132
  options.otherArgs.headers['x-goog-request-params'] =
1764
2133
  this._gaxModule.routingHeader.fromParams({
1765
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
2134
+ parent: request.parent ?? '',
1766
2135
  });
1767
- this.initialize();
1768
- return this.innerApiCalls.listBackupSchedules(request, options, callback);
2136
+ this.initialize().catch(err => {
2137
+ throw err;
2138
+ });
2139
+ const wrappedCallback = callback
2140
+ ? (error, values, nextPageRequest, rawResponse) => {
2141
+ this._log.info('listBackupSchedules values %j', values);
2142
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
2143
+ }
2144
+ : undefined;
2145
+ this._log.info('listBackupSchedules request %j', request);
2146
+ return this.innerApiCalls
2147
+ .listBackupSchedules(request, options, wrappedCallback)
2148
+ ?.then(([response, input, output]) => {
2149
+ this._log.info('listBackupSchedules values %j', response);
2150
+ return [response, input, output];
2151
+ });
1769
2152
  }
1770
2153
  /**
1771
2154
  * Equivalent to `listBackupSchedules`, but returns a NodeJS Stream object.
@@ -1796,18 +2179,20 @@ class DatabaseAdminClient {
1796
2179
  * for more details and examples.
1797
2180
  */
1798
2181
  listBackupSchedulesStream(request, options) {
1799
- var _a;
1800
2182
  request = request || {};
1801
2183
  options = options || {};
1802
2184
  options.otherArgs = options.otherArgs || {};
1803
2185
  options.otherArgs.headers = options.otherArgs.headers || {};
1804
2186
  options.otherArgs.headers['x-goog-request-params'] =
1805
2187
  this._gaxModule.routingHeader.fromParams({
1806
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
2188
+ parent: request.parent ?? '',
1807
2189
  });
1808
2190
  const defaultCallSettings = this._defaults['listBackupSchedules'];
1809
2191
  const callSettings = defaultCallSettings.merge(options);
1810
- this.initialize();
2192
+ this.initialize().catch(err => {
2193
+ throw err;
2194
+ });
2195
+ this._log.info('listBackupSchedules stream %j', request);
1811
2196
  return this.descriptors.page.listBackupSchedules.createStream(this.innerApiCalls.listBackupSchedules, request, callSettings);
1812
2197
  }
1813
2198
  /**
@@ -1840,18 +2225,20 @@ class DatabaseAdminClient {
1840
2225
  * for more details and examples.
1841
2226
  */
1842
2227
  listBackupSchedulesAsync(request, options) {
1843
- var _a;
1844
2228
  request = request || {};
1845
2229
  options = options || {};
1846
2230
  options.otherArgs = options.otherArgs || {};
1847
2231
  options.otherArgs.headers = options.otherArgs.headers || {};
1848
2232
  options.otherArgs.headers['x-goog-request-params'] =
1849
2233
  this._gaxModule.routingHeader.fromParams({
1850
- parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
2234
+ parent: request.parent ?? '',
1851
2235
  });
1852
2236
  const defaultCallSettings = this._defaults['listBackupSchedules'];
1853
2237
  const callSettings = defaultCallSettings.merge(options);
1854
- this.initialize();
2238
+ this.initialize().catch(err => {
2239
+ throw err;
2240
+ });
2241
+ this._log.info('listBackupSchedules iterate %j', request);
1855
2242
  return this.descriptors.page.listBackupSchedules.asyncIterate(this.innerApiCalls['listBackupSchedules'], request, callSettings);
1856
2243
  }
1857
2244
  /**
@@ -1885,7 +2272,6 @@ class DatabaseAdminClient {
1885
2272
  * ```
1886
2273
  */
1887
2274
  getOperation(request, optionsOrCallback, callback) {
1888
- var _a;
1889
2275
  let options;
1890
2276
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
1891
2277
  callback = optionsOrCallback;
@@ -1899,7 +2285,7 @@ class DatabaseAdminClient {
1899
2285
  options.otherArgs.headers = options.otherArgs.headers || {};
1900
2286
  options.otherArgs.headers['x-goog-request-params'] =
1901
2287
  this._gaxModule.routingHeader.fromParams({
1902
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
2288
+ name: request.name ?? '',
1903
2289
  });
1904
2290
  return this.operationsClient.getOperation(request, options, callback);
1905
2291
  }
@@ -1934,13 +2320,12 @@ class DatabaseAdminClient {
1934
2320
  * ```
1935
2321
  */
1936
2322
  listOperationsAsync(request, options) {
1937
- var _a;
1938
2323
  options = options || {};
1939
2324
  options.otherArgs = options.otherArgs || {};
1940
2325
  options.otherArgs.headers = options.otherArgs.headers || {};
1941
2326
  options.otherArgs.headers['x-goog-request-params'] =
1942
2327
  this._gaxModule.routingHeader.fromParams({
1943
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
2328
+ name: request.name ?? '',
1944
2329
  });
1945
2330
  return this.operationsClient.listOperationsAsync(request, options);
1946
2331
  }
@@ -1976,7 +2361,6 @@ class DatabaseAdminClient {
1976
2361
  * ```
1977
2362
  */
1978
2363
  cancelOperation(request, optionsOrCallback, callback) {
1979
- var _a;
1980
2364
  let options;
1981
2365
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
1982
2366
  callback = optionsOrCallback;
@@ -1990,7 +2374,7 @@ class DatabaseAdminClient {
1990
2374
  options.otherArgs.headers = options.otherArgs.headers || {};
1991
2375
  options.otherArgs.headers['x-goog-request-params'] =
1992
2376
  this._gaxModule.routingHeader.fromParams({
1993
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
2377
+ name: request.name ?? '',
1994
2378
  });
1995
2379
  return this.operationsClient.cancelOperation(request, options, callback);
1996
2380
  }
@@ -2020,7 +2404,6 @@ class DatabaseAdminClient {
2020
2404
  * ```
2021
2405
  */
2022
2406
  deleteOperation(request, optionsOrCallback, callback) {
2023
- var _a;
2024
2407
  let options;
2025
2408
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
2026
2409
  callback = optionsOrCallback;
@@ -2034,7 +2417,7 @@ class DatabaseAdminClient {
2034
2417
  options.otherArgs.headers = options.otherArgs.headers || {};
2035
2418
  options.otherArgs.headers['x-goog-request-params'] =
2036
2419
  this._gaxModule.routingHeader.fromParams({
2037
- name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
2420
+ name: request.name ?? '',
2038
2421
  });
2039
2422
  return this.operationsClient.deleteOperation(request, options, callback);
2040
2423
  }
@@ -2352,9 +2735,10 @@ class DatabaseAdminClient {
2352
2735
  close() {
2353
2736
  if (this.databaseAdminStub && !this._terminated) {
2354
2737
  return this.databaseAdminStub.then(stub => {
2738
+ this._log.info('ending gRPC channel');
2355
2739
  this._terminated = true;
2356
2740
  stub.close();
2357
- this.operationsClient.close();
2741
+ void this.operationsClient.close();
2358
2742
  });
2359
2743
  }
2360
2744
  return Promise.resolve();