@google-cloud/dms 1.1.0 → 2.1.1

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.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2021 Google LLC
2
+ // Copyright 2022 Google LLC
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -18,8 +18,6 @@
18
18
  // ** All changes to this file may be overwritten. **
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.DataMigrationServiceClient = void 0;
21
- /* global window */
22
- const gax = require("google-gax");
23
21
  const jsonProtos = require("../../protos/protos.json");
24
22
  /**
25
23
  * Client JSON configuration object, loaded from
@@ -27,7 +25,6 @@ const jsonProtos = require("../../protos/protos.json");
27
25
  * This file defines retry strategy and timeouts for all API methods in this library.
28
26
  */
29
27
  const gapicConfig = require("./data_migration_service_client_config.json");
30
- const google_gax_1 = require("google-gax");
31
28
  const version = require('../../../package.json').version;
32
29
  /**
33
30
  * Database Migration service
@@ -40,7 +37,7 @@ class DataMigrationServiceClient {
40
37
  *
41
38
  * @param {object} [options] - The configuration object.
42
39
  * The options accepted by the constructor are described in detail
43
- * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
40
+ * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
44
41
  * The common options are:
45
42
  * @param {object} [options.credentials] - Credentials object.
46
43
  * @param {string} [options.credentials.client_email]
@@ -63,13 +60,19 @@ class DataMigrationServiceClient {
63
60
  * API remote host.
64
61
  * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
65
62
  * Follows the structure of {@link gapicConfig}.
66
- * @param {boolean} [options.fallback] - Use HTTP fallback mode.
67
- * In fallback mode, a special browser-compatible transport implementation is used
68
- * instead of gRPC transport. In browser context (if the `window` object is defined)
69
- * the fallback mode is enabled automatically; set `options.fallback` to `false`
70
- * if you need to override this behavior.
63
+ * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
64
+ * Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
65
+ * For more information, please check the
66
+ * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
67
+ * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
68
+ * need to avoid loading the default gRPC version and want to use the fallback
69
+ * HTTP implementation. Load only fallback version and pass it to the constructor:
70
+ * ```
71
+ * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
72
+ * const client = new DataMigrationServiceClient({fallback: 'rest'}, gax);
73
+ * ```
71
74
  */
72
- constructor(opts) {
75
+ constructor(opts, gaxInstance) {
73
76
  var _a, _b;
74
77
  this._terminated = false;
75
78
  this.descriptors = {
@@ -90,8 +93,12 @@ class DataMigrationServiceClient {
90
93
  if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) {
91
94
  opts['scopes'] = staticMembers.scopes;
92
95
  }
96
+ // Load google-gax module synchronously if needed
97
+ if (!gaxInstance) {
98
+ gaxInstance = require('google-gax');
99
+ }
93
100
  // Choose either gRPC or proto-over-HTTP implementation of google-gax.
94
- this._gaxModule = opts.fallback ? gax.fallback : gax;
101
+ this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance;
95
102
  // Create a `gaxGrpc` object, with any grpc-specific options sent to the client.
96
103
  this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
97
104
  // Save options to use in initialize() method.
@@ -145,11 +152,73 @@ class DataMigrationServiceClient {
145
152
  // This API contains "long-running operations", which return a
146
153
  // an Operation object that allows for tracking of the operation,
147
154
  // rather than holding a request open.
148
- this.operationsClient = this._gaxModule
149
- .lro({
155
+ const lroOptions = {
150
156
  auth: this.auth,
151
157
  grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
152
- })
158
+ };
159
+ if (opts.fallback === 'rest') {
160
+ lroOptions.protoJson = protoFilesRoot;
161
+ lroOptions.httpRules = [
162
+ {
163
+ selector: 'google.cloud.location.Locations.GetLocation',
164
+ get: '/v1/{name=projects/*/locations/*}',
165
+ },
166
+ {
167
+ selector: 'google.cloud.location.Locations.ListLocations',
168
+ get: '/v1/{name=projects/*}/locations',
169
+ },
170
+ {
171
+ selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',
172
+ get: '/v1/{resource=projects/*/locations/*/connectionProfiles/*}:getIamPolicy',
173
+ additional_bindings: [
174
+ {
175
+ get: '/v1/{resource=projects/*/locations/*/migrationJobs/*}:getIamPolicy',
176
+ },
177
+ ],
178
+ },
179
+ {
180
+ selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',
181
+ post: '/v1/{resource=projects/*/locations/*/connectionProfiles/*}:setIamPolicy',
182
+ body: '*',
183
+ additional_bindings: [
184
+ {
185
+ post: '/v1/{resource=projects/*/locations/*/migrationJobs/*}:setIamPolicy',
186
+ body: '*',
187
+ },
188
+ ],
189
+ },
190
+ {
191
+ selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',
192
+ post: '/v1/{resource=projects/*/locations/*/migrationJobs/*}:testIamPermissions',
193
+ body: '*',
194
+ additional_bindings: [
195
+ {
196
+ post: '/v1/{resource=projects/*/locations/*/connectionProfiles/*}:testIamPermissions',
197
+ body: '*',
198
+ },
199
+ ],
200
+ },
201
+ {
202
+ selector: 'google.longrunning.Operations.CancelOperation',
203
+ post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',
204
+ body: '*',
205
+ },
206
+ {
207
+ selector: 'google.longrunning.Operations.DeleteOperation',
208
+ delete: '/v1/{name=projects/*/locations/*/operations/*}',
209
+ },
210
+ {
211
+ selector: 'google.longrunning.Operations.GetOperation',
212
+ get: '/v1/{name=projects/*/locations/*/operations/*}',
213
+ },
214
+ {
215
+ selector: 'google.longrunning.Operations.ListOperations',
216
+ get: '/v1/{name=projects/*/locations/*}/operations',
217
+ },
218
+ ];
219
+ }
220
+ this.operationsClient = this._gaxModule
221
+ .lro(lroOptions)
153
222
  .operationsClient(opts);
154
223
  const createMigrationJobResponse = protoFilesRoot.lookup('.google.cloud.clouddms.v1.MigrationJob');
155
224
  const createMigrationJobMetadata = protoFilesRoot.lookup('.google.cloud.clouddms.v1.OperationMetadata');
@@ -196,7 +265,7 @@ class DataMigrationServiceClient {
196
265
  // merely providing the destination and request information.
197
266
  this.innerApiCalls = {};
198
267
  // Add a warn function to the client constructor so it can be easily tested.
199
- this.warn = gax.warn;
268
+ this.warn = this._gaxModule.warn;
200
269
  }
201
270
  /**
202
271
  * Initialize the client.
@@ -254,7 +323,7 @@ class DataMigrationServiceClient {
254
323
  const descriptor = this.descriptors.page[methodName] ||
255
324
  this.descriptors.longrunning[methodName] ||
256
325
  undefined;
257
- const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor);
326
+ const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
258
327
  this.innerApiCalls[methodName] = apiCall;
259
328
  }
260
329
  return this.dataMigrationServiceStub;
@@ -300,23 +369,6 @@ class DataMigrationServiceClient {
300
369
  }
301
370
  return this.auth.getProjectId();
302
371
  }
303
- /**
304
- * Gets details of a single migration job.
305
- *
306
- * @param {Object} request
307
- * The request object that will be sent.
308
- * @param {string} request.name
309
- * Required. Name of the migration job resource to get.
310
- * @param {object} [options]
311
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
312
- * @returns {Promise} - The promise which resolves to an array.
313
- * The first element of the array is an object representing [MigrationJob]{@link google.cloud.clouddms.v1.MigrationJob}.
314
- * Please see the
315
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
316
- * for more details and examples.
317
- * @example
318
- * const [response] = await client.getMigrationJob(request);
319
- */
320
372
  getMigrationJob(request, optionsOrCallback, callback) {
321
373
  request = request || {};
322
374
  let options;
@@ -331,38 +383,12 @@ class DataMigrationServiceClient {
331
383
  options.otherArgs = options.otherArgs || {};
332
384
  options.otherArgs.headers = options.otherArgs.headers || {};
333
385
  options.otherArgs.headers['x-goog-request-params'] =
334
- gax.routingHeader.fromParams({
386
+ this._gaxModule.routingHeader.fromParams({
335
387
  name: request.name || '',
336
388
  });
337
389
  this.initialize();
338
390
  return this.innerApiCalls.getMigrationJob(request, options, callback);
339
391
  }
340
- /**
341
- * Generate a SSH configuration script to configure the reverse SSH
342
- * connectivity.
343
- *
344
- * @param {Object} request
345
- * The request object that will be sent.
346
- * @param {string} request.migrationJob
347
- * Name of the migration job resource to generate the SSH script.
348
- * @param {string} request.vm
349
- * Required. Bastion VM Instance name to use or to create.
350
- * @param {google.cloud.clouddms.v1.VmCreationConfig} request.vmCreationConfig
351
- * The VM creation configuration
352
- * @param {google.cloud.clouddms.v1.VmSelectionConfig} request.vmSelectionConfig
353
- * The VM selection configuration
354
- * @param {number} request.vmPort
355
- * The port that will be open on the bastion host
356
- * @param {object} [options]
357
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
358
- * @returns {Promise} - The promise which resolves to an array.
359
- * The first element of the array is an object representing [SshScript]{@link google.cloud.clouddms.v1.SshScript}.
360
- * Please see the
361
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
362
- * for more details and examples.
363
- * @example
364
- * const [response] = await client.generateSshScript(request);
365
- */
366
392
  generateSshScript(request, optionsOrCallback, callback) {
367
393
  request = request || {};
368
394
  let options;
@@ -377,29 +403,12 @@ class DataMigrationServiceClient {
377
403
  options.otherArgs = options.otherArgs || {};
378
404
  options.otherArgs.headers = options.otherArgs.headers || {};
379
405
  options.otherArgs.headers['x-goog-request-params'] =
380
- gax.routingHeader.fromParams({
406
+ this._gaxModule.routingHeader.fromParams({
381
407
  migration_job: request.migrationJob || '',
382
408
  });
383
409
  this.initialize();
384
410
  return this.innerApiCalls.generateSshScript(request, options, callback);
385
411
  }
386
- /**
387
- * Gets details of a single connection profile.
388
- *
389
- * @param {Object} request
390
- * The request object that will be sent.
391
- * @param {string} request.name
392
- * Required. Name of the connection profile resource to get.
393
- * @param {object} [options]
394
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
395
- * @returns {Promise} - The promise which resolves to an array.
396
- * The first element of the array is an object representing [ConnectionProfile]{@link google.cloud.clouddms.v1.ConnectionProfile}.
397
- * Please see the
398
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
399
- * for more details and examples.
400
- * @example
401
- * const [response] = await client.getConnectionProfile(request);
402
- */
403
412
  getConnectionProfile(request, optionsOrCallback, callback) {
404
413
  request = request || {};
405
414
  let options;
@@ -414,46 +423,12 @@ class DataMigrationServiceClient {
414
423
  options.otherArgs = options.otherArgs || {};
415
424
  options.otherArgs.headers = options.otherArgs.headers || {};
416
425
  options.otherArgs.headers['x-goog-request-params'] =
417
- gax.routingHeader.fromParams({
426
+ this._gaxModule.routingHeader.fromParams({
418
427
  name: request.name || '',
419
428
  });
420
429
  this.initialize();
421
430
  return this.innerApiCalls.getConnectionProfile(request, options, callback);
422
431
  }
423
- /**
424
- * Creates a new migration job in a given project and location.
425
- *
426
- * @param {Object} request
427
- * The request object that will be sent.
428
- * @param {string} request.parent
429
- * Required. The parent, which owns this collection of migration jobs.
430
- * @param {string} request.migrationJobId
431
- * Required. The ID of the instance to create.
432
- * @param {google.cloud.clouddms.v1.MigrationJob} request.migrationJob
433
- * Required. Represents a [migration
434
- * job](https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.migrationJobs)
435
- * object.
436
- * @param {string} request.requestId
437
- * A unique id used to identify the request. If the server receives two
438
- * requests with the same id, then the second request will be ignored.
439
- *
440
- * It is recommended to always set this value to a UUID.
441
- *
442
- * The id must contain only letters (a-z, A-Z), numbers (0-9), underscores
443
- * (_), and hyphens (-). The maximum length is 40 characters.
444
- * @param {object} [options]
445
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
446
- * @returns {Promise} - The promise which resolves to an array.
447
- * The first element of the array is an object representing
448
- * a long running operation. Its `promise()` method returns a promise
449
- * you can `await` for.
450
- * Please see the
451
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
452
- * for more details and examples.
453
- * @example
454
- * const [operation] = await client.createMigrationJob(request);
455
- * const [response] = await operation.promise();
456
- */
457
432
  createMigrationJob(request, optionsOrCallback, callback) {
458
433
  request = request || {};
459
434
  let options;
@@ -468,7 +443,7 @@ class DataMigrationServiceClient {
468
443
  options.otherArgs = options.otherArgs || {};
469
444
  options.otherArgs.headers = options.otherArgs.headers || {};
470
445
  options.otherArgs.headers['x-goog-request-params'] =
471
- gax.routingHeader.fromParams({
446
+ this._gaxModule.routingHeader.fromParams({
472
447
  parent: request.parent || '',
473
448
  });
474
449
  this.initialize();
@@ -483,49 +458,15 @@ class DataMigrationServiceClient {
483
458
  * Please see the
484
459
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
485
460
  * for more details and examples.
486
- * @example
487
- * const decodedOperation = await checkCreateMigrationJobProgress(name);
488
- * console.log(decodedOperation.result);
489
- * console.log(decodedOperation.done);
490
- * console.log(decodedOperation.metadata);
461
+ * @example <caption>include:samples/generated/v1/data_migration_service.create_migration_job.js</caption>
462
+ * region_tag:datamigration_v1_generated_DataMigrationService_CreateMigrationJob_async
491
463
  */
492
464
  async checkCreateMigrationJobProgress(name) {
493
- const request = new google_gax_1.operationsProtos.google.longrunning.GetOperationRequest({ name });
465
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
494
466
  const [operation] = await this.operationsClient.getOperation(request);
495
- const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createMigrationJob, gax.createDefaultBackoffSettings());
467
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMigrationJob, this._gaxModule.createDefaultBackoffSettings());
496
468
  return decodeOperation;
497
469
  }
498
- /**
499
- * Updates the parameters of a single migration job.
500
- *
501
- * @param {Object} request
502
- * The request object that will be sent.
503
- * @param {google.protobuf.FieldMask} request.updateMask
504
- * Required. Field mask is used to specify the fields to be overwritten in the
505
- * migration job resource by the update.
506
- * @param {google.cloud.clouddms.v1.MigrationJob} request.migrationJob
507
- * Required. The migration job parameters to update.
508
- * @param {string} request.requestId
509
- * A unique id used to identify the request. If the server receives two
510
- * requests with the same id, then the second request will be ignored.
511
- *
512
- * It is recommended to always set this value to a UUID.
513
- *
514
- * The id must contain only letters (a-z, A-Z), numbers (0-9), underscores
515
- * (_), and hyphens (-). The maximum length is 40 characters.
516
- * @param {object} [options]
517
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
518
- * @returns {Promise} - The promise which resolves to an array.
519
- * The first element of the array is an object representing
520
- * a long running operation. Its `promise()` method returns a promise
521
- * you can `await` for.
522
- * Please see the
523
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
524
- * for more details and examples.
525
- * @example
526
- * const [operation] = await client.updateMigrationJob(request);
527
- * const [response] = await operation.promise();
528
- */
529
470
  updateMigrationJob(request, optionsOrCallback, callback) {
530
471
  request = request || {};
531
472
  let options;
@@ -540,7 +481,7 @@ class DataMigrationServiceClient {
540
481
  options.otherArgs = options.otherArgs || {};
541
482
  options.otherArgs.headers = options.otherArgs.headers || {};
542
483
  options.otherArgs.headers['x-goog-request-params'] =
543
- gax.routingHeader.fromParams({
484
+ this._gaxModule.routingHeader.fromParams({
544
485
  'migration_job.name': request.migrationJob.name || '',
545
486
  });
546
487
  this.initialize();
@@ -555,50 +496,15 @@ class DataMigrationServiceClient {
555
496
  * Please see the
556
497
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
557
498
  * for more details and examples.
558
- * @example
559
- * const decodedOperation = await checkUpdateMigrationJobProgress(name);
560
- * console.log(decodedOperation.result);
561
- * console.log(decodedOperation.done);
562
- * console.log(decodedOperation.metadata);
499
+ * @example <caption>include:samples/generated/v1/data_migration_service.update_migration_job.js</caption>
500
+ * region_tag:datamigration_v1_generated_DataMigrationService_UpdateMigrationJob_async
563
501
  */
564
502
  async checkUpdateMigrationJobProgress(name) {
565
- const request = new google_gax_1.operationsProtos.google.longrunning.GetOperationRequest({ name });
503
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
566
504
  const [operation] = await this.operationsClient.getOperation(request);
567
- const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateMigrationJob, gax.createDefaultBackoffSettings());
505
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateMigrationJob, this._gaxModule.createDefaultBackoffSettings());
568
506
  return decodeOperation;
569
507
  }
570
- /**
571
- * Deletes a single migration job.
572
- *
573
- * @param {Object} request
574
- * The request object that will be sent.
575
- * @param {string} request.name
576
- * Required. Name of the migration job resource to delete.
577
- * @param {string} request.requestId
578
- * A unique id used to identify the request. If the server receives two
579
- * requests with the same id, then the second request will be ignored.
580
- *
581
- * It is recommended to always set this value to a UUID.
582
- *
583
- * The id must contain only letters (a-z, A-Z), numbers (0-9), underscores
584
- * (_), and hyphens (-). The maximum length is 40 characters.
585
- * @param {boolean} request.force
586
- * The destination CloudSQL connection profile is always deleted with the
587
- * migration job. In case of force delete, the destination CloudSQL replica
588
- * database is also deleted.
589
- * @param {object} [options]
590
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
591
- * @returns {Promise} - The promise which resolves to an array.
592
- * The first element of the array is an object representing
593
- * a long running operation. Its `promise()` method returns a promise
594
- * you can `await` for.
595
- * Please see the
596
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
597
- * for more details and examples.
598
- * @example
599
- * const [operation] = await client.deleteMigrationJob(request);
600
- * const [response] = await operation.promise();
601
- */
602
508
  deleteMigrationJob(request, optionsOrCallback, callback) {
603
509
  request = request || {};
604
510
  let options;
@@ -613,7 +519,7 @@ class DataMigrationServiceClient {
613
519
  options.otherArgs = options.otherArgs || {};
614
520
  options.otherArgs.headers = options.otherArgs.headers || {};
615
521
  options.otherArgs.headers['x-goog-request-params'] =
616
- gax.routingHeader.fromParams({
522
+ this._gaxModule.routingHeader.fromParams({
617
523
  name: request.name || '',
618
524
  });
619
525
  this.initialize();
@@ -628,38 +534,15 @@ class DataMigrationServiceClient {
628
534
  * Please see the
629
535
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
630
536
  * for more details and examples.
631
- * @example
632
- * const decodedOperation = await checkDeleteMigrationJobProgress(name);
633
- * console.log(decodedOperation.result);
634
- * console.log(decodedOperation.done);
635
- * console.log(decodedOperation.metadata);
537
+ * @example <caption>include:samples/generated/v1/data_migration_service.delete_migration_job.js</caption>
538
+ * region_tag:datamigration_v1_generated_DataMigrationService_DeleteMigrationJob_async
636
539
  */
637
540
  async checkDeleteMigrationJobProgress(name) {
638
- const request = new google_gax_1.operationsProtos.google.longrunning.GetOperationRequest({ name });
541
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
639
542
  const [operation] = await this.operationsClient.getOperation(request);
640
- const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteMigrationJob, gax.createDefaultBackoffSettings());
543
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteMigrationJob, this._gaxModule.createDefaultBackoffSettings());
641
544
  return decodeOperation;
642
545
  }
643
- /**
644
- * Start an already created migration job.
645
- *
646
- * @param {Object} request
647
- * The request object that will be sent.
648
- * @param {string} request.name
649
- * Name of the migration job resource to start.
650
- * @param {object} [options]
651
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
652
- * @returns {Promise} - The promise which resolves to an array.
653
- * The first element of the array is an object representing
654
- * a long running operation. Its `promise()` method returns a promise
655
- * you can `await` for.
656
- * Please see the
657
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
658
- * for more details and examples.
659
- * @example
660
- * const [operation] = await client.startMigrationJob(request);
661
- * const [response] = await operation.promise();
662
- */
663
546
  startMigrationJob(request, optionsOrCallback, callback) {
664
547
  request = request || {};
665
548
  let options;
@@ -674,7 +557,7 @@ class DataMigrationServiceClient {
674
557
  options.otherArgs = options.otherArgs || {};
675
558
  options.otherArgs.headers = options.otherArgs.headers || {};
676
559
  options.otherArgs.headers['x-goog-request-params'] =
677
- gax.routingHeader.fromParams({
560
+ this._gaxModule.routingHeader.fromParams({
678
561
  name: request.name || '',
679
562
  });
680
563
  this.initialize();
@@ -689,38 +572,15 @@ class DataMigrationServiceClient {
689
572
  * Please see the
690
573
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
691
574
  * for more details and examples.
692
- * @example
693
- * const decodedOperation = await checkStartMigrationJobProgress(name);
694
- * console.log(decodedOperation.result);
695
- * console.log(decodedOperation.done);
696
- * console.log(decodedOperation.metadata);
575
+ * @example <caption>include:samples/generated/v1/data_migration_service.start_migration_job.js</caption>
576
+ * region_tag:datamigration_v1_generated_DataMigrationService_StartMigrationJob_async
697
577
  */
698
578
  async checkStartMigrationJobProgress(name) {
699
- const request = new google_gax_1.operationsProtos.google.longrunning.GetOperationRequest({ name });
579
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
700
580
  const [operation] = await this.operationsClient.getOperation(request);
701
- const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.startMigrationJob, gax.createDefaultBackoffSettings());
581
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.startMigrationJob, this._gaxModule.createDefaultBackoffSettings());
702
582
  return decodeOperation;
703
583
  }
704
- /**
705
- * Stops a running migration job.
706
- *
707
- * @param {Object} request
708
- * The request object that will be sent.
709
- * @param {string} request.name
710
- * Name of the migration job resource to stop.
711
- * @param {object} [options]
712
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
713
- * @returns {Promise} - The promise which resolves to an array.
714
- * The first element of the array is an object representing
715
- * a long running operation. Its `promise()` method returns a promise
716
- * you can `await` for.
717
- * Please see the
718
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
719
- * for more details and examples.
720
- * @example
721
- * const [operation] = await client.stopMigrationJob(request);
722
- * const [response] = await operation.promise();
723
- */
724
584
  stopMigrationJob(request, optionsOrCallback, callback) {
725
585
  request = request || {};
726
586
  let options;
@@ -735,7 +595,7 @@ class DataMigrationServiceClient {
735
595
  options.otherArgs = options.otherArgs || {};
736
596
  options.otherArgs.headers = options.otherArgs.headers || {};
737
597
  options.otherArgs.headers['x-goog-request-params'] =
738
- gax.routingHeader.fromParams({
598
+ this._gaxModule.routingHeader.fromParams({
739
599
  name: request.name || '',
740
600
  });
741
601
  this.initialize();
@@ -750,39 +610,15 @@ class DataMigrationServiceClient {
750
610
  * Please see the
751
611
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
752
612
  * for more details and examples.
753
- * @example
754
- * const decodedOperation = await checkStopMigrationJobProgress(name);
755
- * console.log(decodedOperation.result);
756
- * console.log(decodedOperation.done);
757
- * console.log(decodedOperation.metadata);
613
+ * @example <caption>include:samples/generated/v1/data_migration_service.stop_migration_job.js</caption>
614
+ * region_tag:datamigration_v1_generated_DataMigrationService_StopMigrationJob_async
758
615
  */
759
616
  async checkStopMigrationJobProgress(name) {
760
- const request = new google_gax_1.operationsProtos.google.longrunning.GetOperationRequest({ name });
617
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
761
618
  const [operation] = await this.operationsClient.getOperation(request);
762
- const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.stopMigrationJob, gax.createDefaultBackoffSettings());
619
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.stopMigrationJob, this._gaxModule.createDefaultBackoffSettings());
763
620
  return decodeOperation;
764
621
  }
765
- /**
766
- * Resume a migration job that is currently stopped and is resumable (was
767
- * stopped during CDC phase).
768
- *
769
- * @param {Object} request
770
- * The request object that will be sent.
771
- * @param {string} request.name
772
- * Name of the migration job resource to resume.
773
- * @param {object} [options]
774
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
775
- * @returns {Promise} - The promise which resolves to an array.
776
- * The first element of the array is an object representing
777
- * a long running operation. Its `promise()` method returns a promise
778
- * you can `await` for.
779
- * Please see the
780
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
781
- * for more details and examples.
782
- * @example
783
- * const [operation] = await client.resumeMigrationJob(request);
784
- * const [response] = await operation.promise();
785
- */
786
622
  resumeMigrationJob(request, optionsOrCallback, callback) {
787
623
  request = request || {};
788
624
  let options;
@@ -797,7 +633,7 @@ class DataMigrationServiceClient {
797
633
  options.otherArgs = options.otherArgs || {};
798
634
  options.otherArgs.headers = options.otherArgs.headers || {};
799
635
  options.otherArgs.headers['x-goog-request-params'] =
800
- gax.routingHeader.fromParams({
636
+ this._gaxModule.routingHeader.fromParams({
801
637
  name: request.name || '',
802
638
  });
803
639
  this.initialize();
@@ -812,39 +648,15 @@ class DataMigrationServiceClient {
812
648
  * Please see the
813
649
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
814
650
  * for more details and examples.
815
- * @example
816
- * const decodedOperation = await checkResumeMigrationJobProgress(name);
817
- * console.log(decodedOperation.result);
818
- * console.log(decodedOperation.done);
819
- * console.log(decodedOperation.metadata);
651
+ * @example <caption>include:samples/generated/v1/data_migration_service.resume_migration_job.js</caption>
652
+ * region_tag:datamigration_v1_generated_DataMigrationService_ResumeMigrationJob_async
820
653
  */
821
654
  async checkResumeMigrationJobProgress(name) {
822
- const request = new google_gax_1.operationsProtos.google.longrunning.GetOperationRequest({ name });
655
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
823
656
  const [operation] = await this.operationsClient.getOperation(request);
824
- const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.resumeMigrationJob, gax.createDefaultBackoffSettings());
657
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.resumeMigrationJob, this._gaxModule.createDefaultBackoffSettings());
825
658
  return decodeOperation;
826
659
  }
827
- /**
828
- * Promote a migration job, stopping replication to the destination and
829
- * promoting the destination to be a standalone database.
830
- *
831
- * @param {Object} request
832
- * The request object that will be sent.
833
- * @param {string} request.name
834
- * Name of the migration job resource to promote.
835
- * @param {object} [options]
836
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
837
- * @returns {Promise} - The promise which resolves to an array.
838
- * The first element of the array is an object representing
839
- * a long running operation. Its `promise()` method returns a promise
840
- * you can `await` for.
841
- * Please see the
842
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
843
- * for more details and examples.
844
- * @example
845
- * const [operation] = await client.promoteMigrationJob(request);
846
- * const [response] = await operation.promise();
847
- */
848
660
  promoteMigrationJob(request, optionsOrCallback, callback) {
849
661
  request = request || {};
850
662
  let options;
@@ -859,7 +671,7 @@ class DataMigrationServiceClient {
859
671
  options.otherArgs = options.otherArgs || {};
860
672
  options.otherArgs.headers = options.otherArgs.headers || {};
861
673
  options.otherArgs.headers['x-goog-request-params'] =
862
- gax.routingHeader.fromParams({
674
+ this._gaxModule.routingHeader.fromParams({
863
675
  name: request.name || '',
864
676
  });
865
677
  this.initialize();
@@ -874,39 +686,15 @@ class DataMigrationServiceClient {
874
686
  * Please see the
875
687
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
876
688
  * for more details and examples.
877
- * @example
878
- * const decodedOperation = await checkPromoteMigrationJobProgress(name);
879
- * console.log(decodedOperation.result);
880
- * console.log(decodedOperation.done);
881
- * console.log(decodedOperation.metadata);
689
+ * @example <caption>include:samples/generated/v1/data_migration_service.promote_migration_job.js</caption>
690
+ * region_tag:datamigration_v1_generated_DataMigrationService_PromoteMigrationJob_async
882
691
  */
883
692
  async checkPromoteMigrationJobProgress(name) {
884
- const request = new google_gax_1.operationsProtos.google.longrunning.GetOperationRequest({ name });
693
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
885
694
  const [operation] = await this.operationsClient.getOperation(request);
886
- const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.promoteMigrationJob, gax.createDefaultBackoffSettings());
695
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.promoteMigrationJob, this._gaxModule.createDefaultBackoffSettings());
887
696
  return decodeOperation;
888
697
  }
889
- /**
890
- * Verify a migration job, making sure the destination can reach the source
891
- * and that all configuration and prerequisites are met.
892
- *
893
- * @param {Object} request
894
- * The request object that will be sent.
895
- * @param {string} request.name
896
- * Name of the migration job resource to verify.
897
- * @param {object} [options]
898
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
899
- * @returns {Promise} - The promise which resolves to an array.
900
- * The first element of the array is an object representing
901
- * a long running operation. Its `promise()` method returns a promise
902
- * you can `await` for.
903
- * Please see the
904
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
905
- * for more details and examples.
906
- * @example
907
- * const [operation] = await client.verifyMigrationJob(request);
908
- * const [response] = await operation.promise();
909
- */
910
698
  verifyMigrationJob(request, optionsOrCallback, callback) {
911
699
  request = request || {};
912
700
  let options;
@@ -921,7 +709,7 @@ class DataMigrationServiceClient {
921
709
  options.otherArgs = options.otherArgs || {};
922
710
  options.otherArgs.headers = options.otherArgs.headers || {};
923
711
  options.otherArgs.headers['x-goog-request-params'] =
924
- gax.routingHeader.fromParams({
712
+ this._gaxModule.routingHeader.fromParams({
925
713
  name: request.name || '',
926
714
  });
927
715
  this.initialize();
@@ -936,40 +724,15 @@ class DataMigrationServiceClient {
936
724
  * Please see the
937
725
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
938
726
  * for more details and examples.
939
- * @example
940
- * const decodedOperation = await checkVerifyMigrationJobProgress(name);
941
- * console.log(decodedOperation.result);
942
- * console.log(decodedOperation.done);
943
- * console.log(decodedOperation.metadata);
727
+ * @example <caption>include:samples/generated/v1/data_migration_service.verify_migration_job.js</caption>
728
+ * region_tag:datamigration_v1_generated_DataMigrationService_VerifyMigrationJob_async
944
729
  */
945
730
  async checkVerifyMigrationJobProgress(name) {
946
- const request = new google_gax_1.operationsProtos.google.longrunning.GetOperationRequest({ name });
731
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
947
732
  const [operation] = await this.operationsClient.getOperation(request);
948
- const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.verifyMigrationJob, gax.createDefaultBackoffSettings());
733
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.verifyMigrationJob, this._gaxModule.createDefaultBackoffSettings());
949
734
  return decodeOperation;
950
735
  }
951
- /**
952
- * Restart a stopped or failed migration job, resetting the destination
953
- * instance to its original state and starting the migration process from
954
- * scratch.
955
- *
956
- * @param {Object} request
957
- * The request object that will be sent.
958
- * @param {string} request.name
959
- * Name of the migration job resource to restart.
960
- * @param {object} [options]
961
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
962
- * @returns {Promise} - The promise which resolves to an array.
963
- * The first element of the array is an object representing
964
- * a long running operation. Its `promise()` method returns a promise
965
- * you can `await` for.
966
- * Please see the
967
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
968
- * for more details and examples.
969
- * @example
970
- * const [operation] = await client.restartMigrationJob(request);
971
- * const [response] = await operation.promise();
972
- */
973
736
  restartMigrationJob(request, optionsOrCallback, callback) {
974
737
  request = request || {};
975
738
  let options;
@@ -984,7 +747,7 @@ class DataMigrationServiceClient {
984
747
  options.otherArgs = options.otherArgs || {};
985
748
  options.otherArgs.headers = options.otherArgs.headers || {};
986
749
  options.otherArgs.headers['x-goog-request-params'] =
987
- gax.routingHeader.fromParams({
750
+ this._gaxModule.routingHeader.fromParams({
988
751
  name: request.name || '',
989
752
  });
990
753
  this.initialize();
@@ -999,50 +762,15 @@ class DataMigrationServiceClient {
999
762
  * Please see the
1000
763
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
1001
764
  * for more details and examples.
1002
- * @example
1003
- * const decodedOperation = await checkRestartMigrationJobProgress(name);
1004
- * console.log(decodedOperation.result);
1005
- * console.log(decodedOperation.done);
1006
- * console.log(decodedOperation.metadata);
765
+ * @example <caption>include:samples/generated/v1/data_migration_service.restart_migration_job.js</caption>
766
+ * region_tag:datamigration_v1_generated_DataMigrationService_RestartMigrationJob_async
1007
767
  */
1008
768
  async checkRestartMigrationJobProgress(name) {
1009
- const request = new google_gax_1.operationsProtos.google.longrunning.GetOperationRequest({ name });
769
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
1010
770
  const [operation] = await this.operationsClient.getOperation(request);
1011
- const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.restartMigrationJob, gax.createDefaultBackoffSettings());
771
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restartMigrationJob, this._gaxModule.createDefaultBackoffSettings());
1012
772
  return decodeOperation;
1013
773
  }
1014
- /**
1015
- * Creates a new connection profile in a given project and location.
1016
- *
1017
- * @param {Object} request
1018
- * The request object that will be sent.
1019
- * @param {string} request.parent
1020
- * Required. The parent, which owns this collection of connection profiles.
1021
- * @param {string} request.connectionProfileId
1022
- * Required. The connection profile identifier.
1023
- * @param {google.cloud.clouddms.v1.ConnectionProfile} request.connectionProfile
1024
- * Required. The create request body including the connection profile data
1025
- * @param {string} request.requestId
1026
- * A unique id used to identify the request. If the server receives two
1027
- * requests with the same id, then the second request will be ignored.
1028
- *
1029
- * It is recommended to always set this value to a UUID.
1030
- *
1031
- * The id must contain only letters (a-z, A-Z), numbers (0-9), underscores
1032
- * (_), and hyphens (-). The maximum length is 40 characters.
1033
- * @param {object} [options]
1034
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1035
- * @returns {Promise} - The promise which resolves to an array.
1036
- * The first element of the array is an object representing
1037
- * a long running operation. Its `promise()` method returns a promise
1038
- * you can `await` for.
1039
- * Please see the
1040
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
1041
- * for more details and examples.
1042
- * @example
1043
- * const [operation] = await client.createConnectionProfile(request);
1044
- * const [response] = await operation.promise();
1045
- */
1046
774
  createConnectionProfile(request, optionsOrCallback, callback) {
1047
775
  request = request || {};
1048
776
  let options;
@@ -1057,7 +785,7 @@ class DataMigrationServiceClient {
1057
785
  options.otherArgs = options.otherArgs || {};
1058
786
  options.otherArgs.headers = options.otherArgs.headers || {};
1059
787
  options.otherArgs.headers['x-goog-request-params'] =
1060
- gax.routingHeader.fromParams({
788
+ this._gaxModule.routingHeader.fromParams({
1061
789
  parent: request.parent || '',
1062
790
  });
1063
791
  this.initialize();
@@ -1072,49 +800,15 @@ class DataMigrationServiceClient {
1072
800
  * Please see the
1073
801
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
1074
802
  * for more details and examples.
1075
- * @example
1076
- * const decodedOperation = await checkCreateConnectionProfileProgress(name);
1077
- * console.log(decodedOperation.result);
1078
- * console.log(decodedOperation.done);
1079
- * console.log(decodedOperation.metadata);
803
+ * @example <caption>include:samples/generated/v1/data_migration_service.create_connection_profile.js</caption>
804
+ * region_tag:datamigration_v1_generated_DataMigrationService_CreateConnectionProfile_async
1080
805
  */
1081
806
  async checkCreateConnectionProfileProgress(name) {
1082
- const request = new google_gax_1.operationsProtos.google.longrunning.GetOperationRequest({ name });
807
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
1083
808
  const [operation] = await this.operationsClient.getOperation(request);
1084
- const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createConnectionProfile, gax.createDefaultBackoffSettings());
809
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConnectionProfile, this._gaxModule.createDefaultBackoffSettings());
1085
810
  return decodeOperation;
1086
811
  }
1087
- /**
1088
- * Update the configuration of a single connection profile.
1089
- *
1090
- * @param {Object} request
1091
- * The request object that will be sent.
1092
- * @param {google.protobuf.FieldMask} request.updateMask
1093
- * Required. Field mask is used to specify the fields to be overwritten in the
1094
- * connection profile resource by the update.
1095
- * @param {google.cloud.clouddms.v1.ConnectionProfile} request.connectionProfile
1096
- * Required. The connection profile parameters to update.
1097
- * @param {string} request.requestId
1098
- * A unique id used to identify the request. If the server receives two
1099
- * requests with the same id, then the second request will be ignored.
1100
- *
1101
- * It is recommended to always set this value to a UUID.
1102
- *
1103
- * The id must contain only letters (a-z, A-Z), numbers (0-9), underscores
1104
- * (_), and hyphens (-). The maximum length is 40 characters.
1105
- * @param {object} [options]
1106
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1107
- * @returns {Promise} - The promise which resolves to an array.
1108
- * The first element of the array is an object representing
1109
- * a long running operation. Its `promise()` method returns a promise
1110
- * you can `await` for.
1111
- * Please see the
1112
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
1113
- * for more details and examples.
1114
- * @example
1115
- * const [operation] = await client.updateConnectionProfile(request);
1116
- * const [response] = await operation.promise();
1117
- */
1118
812
  updateConnectionProfile(request, optionsOrCallback, callback) {
1119
813
  request = request || {};
1120
814
  let options;
@@ -1129,7 +823,7 @@ class DataMigrationServiceClient {
1129
823
  options.otherArgs = options.otherArgs || {};
1130
824
  options.otherArgs.headers = options.otherArgs.headers || {};
1131
825
  options.otherArgs.headers['x-goog-request-params'] =
1132
- gax.routingHeader.fromParams({
826
+ this._gaxModule.routingHeader.fromParams({
1133
827
  'connection_profile.name': request.connectionProfile.name || '',
1134
828
  });
1135
829
  this.initialize();
@@ -1144,51 +838,15 @@ class DataMigrationServiceClient {
1144
838
  * Please see the
1145
839
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
1146
840
  * for more details and examples.
1147
- * @example
1148
- * const decodedOperation = await checkUpdateConnectionProfileProgress(name);
1149
- * console.log(decodedOperation.result);
1150
- * console.log(decodedOperation.done);
1151
- * console.log(decodedOperation.metadata);
841
+ * @example <caption>include:samples/generated/v1/data_migration_service.update_connection_profile.js</caption>
842
+ * region_tag:datamigration_v1_generated_DataMigrationService_UpdateConnectionProfile_async
1152
843
  */
1153
844
  async checkUpdateConnectionProfileProgress(name) {
1154
- const request = new google_gax_1.operationsProtos.google.longrunning.GetOperationRequest({ name });
845
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
1155
846
  const [operation] = await this.operationsClient.getOperation(request);
1156
- const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateConnectionProfile, gax.createDefaultBackoffSettings());
847
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateConnectionProfile, this._gaxModule.createDefaultBackoffSettings());
1157
848
  return decodeOperation;
1158
849
  }
1159
- /**
1160
- * Deletes a single Database Migration Service connection profile.
1161
- * A connection profile can only be deleted if it is not in use by any
1162
- * active migration jobs.
1163
- *
1164
- * @param {Object} request
1165
- * The request object that will be sent.
1166
- * @param {string} request.name
1167
- * Required. Name of the connection profile resource to delete.
1168
- * @param {string} request.requestId
1169
- * A unique id used to identify the request. If the server receives two
1170
- * requests with the same id, then the second request will be ignored.
1171
- *
1172
- * It is recommended to always set this value to a UUID.
1173
- *
1174
- * The id must contain only letters (a-z, A-Z), numbers (0-9), underscores
1175
- * (_), and hyphens (-). The maximum length is 40 characters.
1176
- * @param {boolean} request.force
1177
- * In case of force delete, the CloudSQL replica database is also deleted
1178
- * (only for CloudSQL connection profile).
1179
- * @param {object} [options]
1180
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1181
- * @returns {Promise} - The promise which resolves to an array.
1182
- * The first element of the array is an object representing
1183
- * a long running operation. Its `promise()` method returns a promise
1184
- * you can `await` for.
1185
- * Please see the
1186
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
1187
- * for more details and examples.
1188
- * @example
1189
- * const [operation] = await client.deleteConnectionProfile(request);
1190
- * const [response] = await operation.promise();
1191
- */
1192
850
  deleteConnectionProfile(request, optionsOrCallback, callback) {
1193
851
  request = request || {};
1194
852
  let options;
@@ -1203,7 +861,7 @@ class DataMigrationServiceClient {
1203
861
  options.otherArgs = options.otherArgs || {};
1204
862
  options.otherArgs.headers = options.otherArgs.headers || {};
1205
863
  options.otherArgs.headers['x-goog-request-params'] =
1206
- gax.routingHeader.fromParams({
864
+ this._gaxModule.routingHeader.fromParams({
1207
865
  name: request.name || '',
1208
866
  });
1209
867
  this.initialize();
@@ -1218,62 +876,15 @@ class DataMigrationServiceClient {
1218
876
  * Please see the
1219
877
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
1220
878
  * for more details and examples.
1221
- * @example
1222
- * const decodedOperation = await checkDeleteConnectionProfileProgress(name);
1223
- * console.log(decodedOperation.result);
1224
- * console.log(decodedOperation.done);
1225
- * console.log(decodedOperation.metadata);
879
+ * @example <caption>include:samples/generated/v1/data_migration_service.delete_connection_profile.js</caption>
880
+ * region_tag:datamigration_v1_generated_DataMigrationService_DeleteConnectionProfile_async
1226
881
  */
1227
882
  async checkDeleteConnectionProfileProgress(name) {
1228
- const request = new google_gax_1.operationsProtos.google.longrunning.GetOperationRequest({ name });
883
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
1229
884
  const [operation] = await this.operationsClient.getOperation(request);
1230
- const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteConnectionProfile, gax.createDefaultBackoffSettings());
885
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteConnectionProfile, this._gaxModule.createDefaultBackoffSettings());
1231
886
  return decodeOperation;
1232
887
  }
1233
- /**
1234
- * Lists migration jobs in a given project and location.
1235
- *
1236
- * @param {Object} request
1237
- * The request object that will be sent.
1238
- * @param {string} request.parent
1239
- * Required. The parent, which owns this collection of migrationJobs.
1240
- * @param {number} request.pageSize
1241
- * The maximum number of migration jobs to return. The service may return
1242
- * fewer than this value. If unspecified, at most 50 migration jobs will be
1243
- * returned. The maximum value is 1000; values above 1000 will be coerced to
1244
- * 1000.
1245
- * @param {string} request.pageToken
1246
- * The nextPageToken value received in the previous call to
1247
- * migrationJobs.list, used in the subsequent request to retrieve the next
1248
- * page of results. On first call this should be left blank. When paginating,
1249
- * all other parameters provided to migrationJobs.list must match the call
1250
- * that provided the page token.
1251
- * @param {string} request.filter
1252
- * A filter expression that filters migration jobs listed in the response.
1253
- * The expression must specify the field name, a comparison operator, and the
1254
- * value that you want to use for filtering. The value must be a string,
1255
- * a number, or a boolean. The comparison operator must be
1256
- * either =, !=, >, or <. For example, list migration jobs created this year
1257
- * by specifying **createTime %gt; 2020-01-01T00:00:00.000000000Z.**
1258
- * You can also filter nested fields. For example, you could specify
1259
- * **reverseSshConnectivity.vmIp = "1.2.3.4"** to select all migration
1260
- * jobs connecting through the specific SSH tunnel bastion.
1261
- * @param {string} request.orderBy
1262
- * Sort the results based on the migration job name.
1263
- * Valid values are: "name", "name asc", and "name desc".
1264
- * @param {object} [options]
1265
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1266
- * @returns {Promise} - The promise which resolves to an array.
1267
- * The first element of the array is Array of [MigrationJob]{@link google.cloud.clouddms.v1.MigrationJob}.
1268
- * The client library will perform auto-pagination by default: it will call the API as many
1269
- * times as needed and will merge results from all the pages into this array.
1270
- * Note that it can affect your quota.
1271
- * We recommend using `listMigrationJobsAsync()`
1272
- * method described below for async iteration which you can stop as needed.
1273
- * Please see the
1274
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
1275
- * for more details and examples.
1276
- */
1277
888
  listMigrationJobs(request, optionsOrCallback, callback) {
1278
889
  request = request || {};
1279
890
  let options;
@@ -1288,7 +899,7 @@ class DataMigrationServiceClient {
1288
899
  options.otherArgs = options.otherArgs || {};
1289
900
  options.otherArgs.headers = options.otherArgs.headers || {};
1290
901
  options.otherArgs.headers['x-goog-request-params'] =
1291
- gax.routingHeader.fromParams({
902
+ this._gaxModule.routingHeader.fromParams({
1292
903
  parent: request.parent || '',
1293
904
  });
1294
905
  this.initialize();
@@ -1342,10 +953,11 @@ class DataMigrationServiceClient {
1342
953
  options.otherArgs = options.otherArgs || {};
1343
954
  options.otherArgs.headers = options.otherArgs.headers || {};
1344
955
  options.otherArgs.headers['x-goog-request-params'] =
1345
- gax.routingHeader.fromParams({
956
+ this._gaxModule.routingHeader.fromParams({
1346
957
  parent: request.parent || '',
1347
958
  });
1348
- const callSettings = new gax.CallSettings(options);
959
+ const defaultCallSettings = this._defaults['listMigrationJobs'];
960
+ const callSettings = defaultCallSettings.merge(options);
1349
961
  this.initialize();
1350
962
  return this.descriptors.page.listMigrationJobs.createStream(this.innerApiCalls.listMigrationJobs, request, callSettings);
1351
963
  }
@@ -1391,11 +1003,8 @@ class DataMigrationServiceClient {
1391
1003
  * Please see the
1392
1004
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
1393
1005
  * for more details and examples.
1394
- * @example
1395
- * const iterable = client.listMigrationJobsAsync(request);
1396
- * for await (const response of iterable) {
1397
- * // process response
1398
- * }
1006
+ * @example <caption>include:samples/generated/v1/data_migration_service.list_migration_jobs.js</caption>
1007
+ * region_tag:datamigration_v1_generated_DataMigrationService_ListMigrationJobs_async
1399
1008
  */
1400
1009
  listMigrationJobsAsync(request, options) {
1401
1010
  request = request || {};
@@ -1403,57 +1012,14 @@ class DataMigrationServiceClient {
1403
1012
  options.otherArgs = options.otherArgs || {};
1404
1013
  options.otherArgs.headers = options.otherArgs.headers || {};
1405
1014
  options.otherArgs.headers['x-goog-request-params'] =
1406
- gax.routingHeader.fromParams({
1015
+ this._gaxModule.routingHeader.fromParams({
1407
1016
  parent: request.parent || '',
1408
1017
  });
1409
- options = options || {};
1410
- const callSettings = new gax.CallSettings(options);
1018
+ const defaultCallSettings = this._defaults['listMigrationJobs'];
1019
+ const callSettings = defaultCallSettings.merge(options);
1411
1020
  this.initialize();
1412
1021
  return this.descriptors.page.listMigrationJobs.asyncIterate(this.innerApiCalls['listMigrationJobs'], request, callSettings);
1413
1022
  }
1414
- /**
1415
- * Retrieve a list of all connection profiles in a given project and location.
1416
- *
1417
- * @param {Object} request
1418
- * The request object that will be sent.
1419
- * @param {string} request.parent
1420
- * Required. The parent, which owns this collection of connection profiles.
1421
- * @param {number} request.pageSize
1422
- * The maximum number of connection profiles to return. The service may return
1423
- * fewer than this value. If unspecified, at most 50 connection profiles will
1424
- * be returned. The maximum value is 1000; values above 1000 will be coerced
1425
- * to 1000.
1426
- * @param {string} request.pageToken
1427
- * A page token, received from a previous `ListConnectionProfiles` call.
1428
- * Provide this to retrieve the subsequent page.
1429
- *
1430
- * When paginating, all other parameters provided to `ListConnectionProfiles`
1431
- * must match the call that provided the page token.
1432
- * @param {string} request.filter
1433
- * A filter expression that filters connection profiles listed in the
1434
- * response. The expression must specify the field name, a comparison
1435
- * operator, and the value that you want to use for filtering. The value must
1436
- * be a string, a number, or a boolean. The comparison operator must be either
1437
- * =, !=, >, or <. For example, list connection profiles created this year by
1438
- * specifying **createTime %gt; 2020-01-01T00:00:00.000000000Z**. You can
1439
- * also filter nested fields. For example, you could specify **mySql.username
1440
- * = %lt;my_username%gt;** to list all connection profiles configured to
1441
- * connect with a specific username.
1442
- * @param {string} request.orderBy
1443
- * the order by fields for the result.
1444
- * @param {object} [options]
1445
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1446
- * @returns {Promise} - The promise which resolves to an array.
1447
- * The first element of the array is Array of [ConnectionProfile]{@link google.cloud.clouddms.v1.ConnectionProfile}.
1448
- * The client library will perform auto-pagination by default: it will call the API as many
1449
- * times as needed and will merge results from all the pages into this array.
1450
- * Note that it can affect your quota.
1451
- * We recommend using `listConnectionProfilesAsync()`
1452
- * method described below for async iteration which you can stop as needed.
1453
- * Please see the
1454
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
1455
- * for more details and examples.
1456
- */
1457
1023
  listConnectionProfiles(request, optionsOrCallback, callback) {
1458
1024
  request = request || {};
1459
1025
  let options;
@@ -1468,7 +1034,7 @@ class DataMigrationServiceClient {
1468
1034
  options.otherArgs = options.otherArgs || {};
1469
1035
  options.otherArgs.headers = options.otherArgs.headers || {};
1470
1036
  options.otherArgs.headers['x-goog-request-params'] =
1471
- gax.routingHeader.fromParams({
1037
+ this._gaxModule.routingHeader.fromParams({
1472
1038
  parent: request.parent || '',
1473
1039
  });
1474
1040
  this.initialize();
@@ -1521,10 +1087,11 @@ class DataMigrationServiceClient {
1521
1087
  options.otherArgs = options.otherArgs || {};
1522
1088
  options.otherArgs.headers = options.otherArgs.headers || {};
1523
1089
  options.otherArgs.headers['x-goog-request-params'] =
1524
- gax.routingHeader.fromParams({
1090
+ this._gaxModule.routingHeader.fromParams({
1525
1091
  parent: request.parent || '',
1526
1092
  });
1527
- const callSettings = new gax.CallSettings(options);
1093
+ const defaultCallSettings = this._defaults['listConnectionProfiles'];
1094
+ const callSettings = defaultCallSettings.merge(options);
1528
1095
  this.initialize();
1529
1096
  return this.descriptors.page.listConnectionProfiles.createStream(this.innerApiCalls.listConnectionProfiles, request, callSettings);
1530
1097
  }
@@ -1569,11 +1136,8 @@ class DataMigrationServiceClient {
1569
1136
  * Please see the
1570
1137
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
1571
1138
  * for more details and examples.
1572
- * @example
1573
- * const iterable = client.listConnectionProfilesAsync(request);
1574
- * for await (const response of iterable) {
1575
- * // process response
1576
- * }
1139
+ * @example <caption>include:samples/generated/v1/data_migration_service.list_connection_profiles.js</caption>
1140
+ * region_tag:datamigration_v1_generated_DataMigrationService_ListConnectionProfiles_async
1577
1141
  */
1578
1142
  listConnectionProfilesAsync(request, options) {
1579
1143
  request = request || {};
@@ -1581,11 +1145,11 @@ class DataMigrationServiceClient {
1581
1145
  options.otherArgs = options.otherArgs || {};
1582
1146
  options.otherArgs.headers = options.otherArgs.headers || {};
1583
1147
  options.otherArgs.headers['x-goog-request-params'] =
1584
- gax.routingHeader.fromParams({
1148
+ this._gaxModule.routingHeader.fromParams({
1585
1149
  parent: request.parent || '',
1586
1150
  });
1587
- options = options || {};
1588
- const callSettings = new gax.CallSettings(options);
1151
+ const defaultCallSettings = this._defaults['listConnectionProfiles'];
1152
+ const callSettings = defaultCallSettings.merge(options);
1589
1153
  this.initialize();
1590
1154
  return this.descriptors.page.listConnectionProfiles.asyncIterate(this.innerApiCalls['listConnectionProfiles'], request, callSettings);
1591
1155
  }
@@ -1746,8 +1310,7 @@ class DataMigrationServiceClient {
1746
1310
  * @returns {Promise} A promise that resolves when the client is closed.
1747
1311
  */
1748
1312
  close() {
1749
- this.initialize();
1750
- if (!this._terminated) {
1313
+ if (this.dataMigrationServiceStub && !this._terminated) {
1751
1314
  return this.dataMigrationServiceStub.then(stub => {
1752
1315
  this._terminated = true;
1753
1316
  stub.close();