@google-cloud/spanner 6.8.0 → 6.10.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.
- package/CHANGELOG.md +20 -0
- package/README.md +1 -0
- package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +90 -1
- package/build/protos/protos.d.ts +245 -0
- package/build/protos/protos.js +581 -0
- package/build/protos/protos.json +73 -0
- package/build/src/batch-transaction.js +10 -0
- package/build/src/common-grpc/service.js +4 -0
- package/build/src/common.d.ts +11 -0
- package/build/src/common.js +13 -1
- package/build/src/database.d.ts +74 -0
- package/build/src/database.js +41 -2
- package/build/src/index.d.ts +7 -0
- package/build/src/index.js +4 -0
- package/build/src/session-pool.d.ts +3 -3
- package/build/src/session.d.ts +8 -0
- package/build/src/session.js +15 -1
- package/build/src/transaction.d.ts +9 -0
- package/build/src/transaction.js +46 -6
- package/build/src/v1/database_admin_client.d.ts +79 -0
- package/build/src/v1/database_admin_client.js +43 -0
- package/build/src/v1/database_admin_client_config.json +5 -0
- package/package.json +1 -1
|
@@ -460,6 +460,85 @@ export declare class DatabaseAdminClient {
|
|
|
460
460
|
* region_tag:spanner_v1_generated_DatabaseAdmin_CreateDatabase_async
|
|
461
461
|
*/
|
|
462
462
|
checkCreateDatabaseProgress(name: string): Promise<LROperation<protos.google.spanner.admin.database.v1.Database, protos.google.spanner.admin.database.v1.CreateDatabaseMetadata>>;
|
|
463
|
+
/**
|
|
464
|
+
* Updates a Cloud Spanner database. The returned
|
|
465
|
+
* {@link google.longrunning.Operation|long-running operation} can be used to track
|
|
466
|
+
* the progress of updating the database. If the named database does not
|
|
467
|
+
* exist, returns `NOT_FOUND`.
|
|
468
|
+
*
|
|
469
|
+
* While the operation is pending:
|
|
470
|
+
*
|
|
471
|
+
* * The database's
|
|
472
|
+
* {@link google.spanner.admin.database.v1.Database.reconciling|reconciling}
|
|
473
|
+
* field is set to true.
|
|
474
|
+
* * Cancelling the operation is best-effort. If the cancellation succeeds,
|
|
475
|
+
* the operation metadata's
|
|
476
|
+
* {@link google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time|cancel_time}
|
|
477
|
+
* is set, the updates are reverted, and the operation terminates with a
|
|
478
|
+
* `CANCELLED` status.
|
|
479
|
+
* * New UpdateDatabase requests will return a `FAILED_PRECONDITION` error
|
|
480
|
+
* until the pending operation is done (returns successfully or with
|
|
481
|
+
* error).
|
|
482
|
+
* * Reading the database via the API continues to give the pre-request
|
|
483
|
+
* values.
|
|
484
|
+
*
|
|
485
|
+
* Upon completion of the returned operation:
|
|
486
|
+
*
|
|
487
|
+
* * The new values are in effect and readable via the API.
|
|
488
|
+
* * The database's
|
|
489
|
+
* {@link google.spanner.admin.database.v1.Database.reconciling|reconciling}
|
|
490
|
+
* field becomes false.
|
|
491
|
+
*
|
|
492
|
+
* The returned {@link google.longrunning.Operation|long-running operation} will
|
|
493
|
+
* have a name of the format
|
|
494
|
+
* `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`
|
|
495
|
+
* and can be used to track the database modification. The
|
|
496
|
+
* {@link google.longrunning.Operation.metadata|metadata} field type is
|
|
497
|
+
* {@link google.spanner.admin.database.v1.UpdateDatabaseMetadata|UpdateDatabaseMetadata}.
|
|
498
|
+
* The {@link google.longrunning.Operation.response|response} field type is
|
|
499
|
+
* {@link google.spanner.admin.database.v1.Database|Database}, if successful.
|
|
500
|
+
*
|
|
501
|
+
* @param {Object} request
|
|
502
|
+
* The request object that will be sent.
|
|
503
|
+
* @param {google.spanner.admin.database.v1.Database} request.database
|
|
504
|
+
* Required. The database to update.
|
|
505
|
+
* The `name` field of the database is of the form
|
|
506
|
+
* `projects/<project>/instances/<instance>/databases/<database>`.
|
|
507
|
+
* @param {google.protobuf.FieldMask} request.updateMask
|
|
508
|
+
* Required. The list of fields to update. Currently, only
|
|
509
|
+
* `enable_drop_protection` field can be updated.
|
|
510
|
+
* @param {object} [options]
|
|
511
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
512
|
+
* @returns {Promise} - The promise which resolves to an array.
|
|
513
|
+
* The first element of the array is an object representing
|
|
514
|
+
* a long running operation. Its `promise()` method returns a promise
|
|
515
|
+
* you can `await` for.
|
|
516
|
+
* Please see the
|
|
517
|
+
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
|
|
518
|
+
* for more details and examples.
|
|
519
|
+
* @example <caption>include:samples/generated/v1/database_admin.update_database.js</caption>
|
|
520
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_UpdateDatabase_async
|
|
521
|
+
*/
|
|
522
|
+
updateDatabase(request?: protos.google.spanner.admin.database.v1.IUpdateDatabaseRequest, options?: CallOptions): Promise<[
|
|
523
|
+
LROperation<protos.google.spanner.admin.database.v1.IDatabase, protos.google.spanner.admin.database.v1.IUpdateDatabaseMetadata>,
|
|
524
|
+
protos.google.longrunning.IOperation | undefined,
|
|
525
|
+
{} | undefined
|
|
526
|
+
]>;
|
|
527
|
+
updateDatabase(request: protos.google.spanner.admin.database.v1.IUpdateDatabaseRequest, options: CallOptions, callback: Callback<LROperation<protos.google.spanner.admin.database.v1.IDatabase, protos.google.spanner.admin.database.v1.IUpdateDatabaseMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
|
|
528
|
+
updateDatabase(request: protos.google.spanner.admin.database.v1.IUpdateDatabaseRequest, callback: Callback<LROperation<protos.google.spanner.admin.database.v1.IDatabase, protos.google.spanner.admin.database.v1.IUpdateDatabaseMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
|
|
529
|
+
/**
|
|
530
|
+
* Check the status of the long running operation returned by `updateDatabase()`.
|
|
531
|
+
* @param {String} name
|
|
532
|
+
* The operation name that will be passed.
|
|
533
|
+
* @returns {Promise} - The promise which resolves to an object.
|
|
534
|
+
* The decoded operation object has result and metadata field to get information from.
|
|
535
|
+
* Please see the
|
|
536
|
+
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
|
|
537
|
+
* for more details and examples.
|
|
538
|
+
* @example <caption>include:samples/generated/v1/database_admin.update_database.js</caption>
|
|
539
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_UpdateDatabase_async
|
|
540
|
+
*/
|
|
541
|
+
checkUpdateDatabaseProgress(name: string): Promise<LROperation<protos.google.spanner.admin.database.v1.Database, protos.google.spanner.admin.database.v1.UpdateDatabaseMetadata>>;
|
|
463
542
|
/**
|
|
464
543
|
* Updates the schema of a Cloud Spanner database by
|
|
465
544
|
* creating/altering/dropping tables, columns, indexes, etc. The returned
|
|
@@ -220,6 +220,8 @@ class DatabaseAdminClient {
|
|
|
220
220
|
.operationsClient(opts);
|
|
221
221
|
const createDatabaseResponse = protoFilesRoot.lookup('.google.spanner.admin.database.v1.Database');
|
|
222
222
|
const createDatabaseMetadata = protoFilesRoot.lookup('.google.spanner.admin.database.v1.CreateDatabaseMetadata');
|
|
223
|
+
const updateDatabaseResponse = protoFilesRoot.lookup('.google.spanner.admin.database.v1.Database');
|
|
224
|
+
const updateDatabaseMetadata = protoFilesRoot.lookup('.google.spanner.admin.database.v1.UpdateDatabaseMetadata');
|
|
223
225
|
const updateDatabaseDdlResponse = protoFilesRoot.lookup('.google.protobuf.Empty');
|
|
224
226
|
const updateDatabaseDdlMetadata = protoFilesRoot.lookup('.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata');
|
|
225
227
|
const createBackupResponse = protoFilesRoot.lookup('.google.spanner.admin.database.v1.Backup');
|
|
@@ -230,6 +232,7 @@ class DatabaseAdminClient {
|
|
|
230
232
|
const restoreDatabaseMetadata = protoFilesRoot.lookup('.google.spanner.admin.database.v1.RestoreDatabaseMetadata');
|
|
231
233
|
this.descriptors.longrunning = {
|
|
232
234
|
createDatabase: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createDatabaseResponse.decode.bind(createDatabaseResponse), createDatabaseMetadata.decode.bind(createDatabaseMetadata)),
|
|
235
|
+
updateDatabase: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateDatabaseResponse.decode.bind(updateDatabaseResponse), updateDatabaseMetadata.decode.bind(updateDatabaseMetadata)),
|
|
233
236
|
updateDatabaseDdl: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateDatabaseDdlResponse.decode.bind(updateDatabaseDdlResponse), updateDatabaseDdlMetadata.decode.bind(updateDatabaseDdlMetadata)),
|
|
234
237
|
createBackup: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createBackupResponse.decode.bind(createBackupResponse), createBackupMetadata.decode.bind(createBackupMetadata)),
|
|
235
238
|
copyBackup: new this._gaxModule.LongrunningDescriptor(this.operationsClient, copyBackupResponse.decode.bind(copyBackupResponse), copyBackupMetadata.decode.bind(copyBackupMetadata)),
|
|
@@ -272,6 +275,7 @@ class DatabaseAdminClient {
|
|
|
272
275
|
'listDatabases',
|
|
273
276
|
'createDatabase',
|
|
274
277
|
'getDatabase',
|
|
278
|
+
'updateDatabase',
|
|
275
279
|
'updateDatabaseDdl',
|
|
276
280
|
'dropDatabase',
|
|
277
281
|
'getDatabaseDdl',
|
|
@@ -579,6 +583,45 @@ class DatabaseAdminClient {
|
|
|
579
583
|
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createDatabase, this._gaxModule.createDefaultBackoffSettings());
|
|
580
584
|
return decodeOperation;
|
|
581
585
|
}
|
|
586
|
+
updateDatabase(request, optionsOrCallback, callback) {
|
|
587
|
+
var _a;
|
|
588
|
+
request = request || {};
|
|
589
|
+
let options;
|
|
590
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
591
|
+
callback = optionsOrCallback;
|
|
592
|
+
options = {};
|
|
593
|
+
}
|
|
594
|
+
else {
|
|
595
|
+
options = optionsOrCallback;
|
|
596
|
+
}
|
|
597
|
+
options = options || {};
|
|
598
|
+
options.otherArgs = options.otherArgs || {};
|
|
599
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
600
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
601
|
+
this._gaxModule.routingHeader.fromParams({
|
|
602
|
+
'database.name': (_a = request.database.name) !== null && _a !== void 0 ? _a : '',
|
|
603
|
+
});
|
|
604
|
+
this.initialize();
|
|
605
|
+
return this.innerApiCalls.updateDatabase(request, options, callback);
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Check the status of the long running operation returned by `updateDatabase()`.
|
|
609
|
+
* @param {String} name
|
|
610
|
+
* The operation name that will be passed.
|
|
611
|
+
* @returns {Promise} - The promise which resolves to an object.
|
|
612
|
+
* The decoded operation object has result and metadata field to get information from.
|
|
613
|
+
* Please see the
|
|
614
|
+
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
|
|
615
|
+
* for more details and examples.
|
|
616
|
+
* @example <caption>include:samples/generated/v1/database_admin.update_database.js</caption>
|
|
617
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_UpdateDatabase_async
|
|
618
|
+
*/
|
|
619
|
+
async checkUpdateDatabaseProgress(name) {
|
|
620
|
+
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
|
|
621
|
+
const [operation] = await this.operationsClient.getOperation(request);
|
|
622
|
+
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDatabase, this._gaxModule.createDefaultBackoffSettings());
|
|
623
|
+
return decodeOperation;
|
|
624
|
+
}
|
|
582
625
|
updateDatabaseDdl(request, optionsOrCallback, callback) {
|
|
583
626
|
var _a;
|
|
584
627
|
request = request || {};
|
|
@@ -44,6 +44,11 @@
|
|
|
44
44
|
"retry_codes_name": "idempotent",
|
|
45
45
|
"retry_params_name": "e9fafda332ce8a1702dc1575de3ca81c4feb4799"
|
|
46
46
|
},
|
|
47
|
+
"UpdateDatabase": {
|
|
48
|
+
"timeout_millis": 3600000,
|
|
49
|
+
"retry_codes_name": "idempotent",
|
|
50
|
+
"retry_params_name": "e9fafda332ce8a1702dc1575de3ca81c4feb4799"
|
|
51
|
+
},
|
|
47
52
|
"UpdateDatabaseDdl": {
|
|
48
53
|
"timeout_millis": 3600000,
|
|
49
54
|
"retry_codes_name": "idempotent",
|