@google-cloud/spanner 5.16.2 → 5.18.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 +43 -0
- package/README.md +25 -12
- package/build/protos/google/spanner/admin/database/v1/backup.proto +177 -9
- package/build/protos/google/spanner/admin/database/v1/common.proto +14 -2
- package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +40 -5
- package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +8 -5
- package/build/protos/google/spanner/v1/commit_response.proto +2 -4
- package/build/protos/google/spanner/v1/keys.proto +0 -1
- package/build/protos/google/spanner/v1/mutation.proto +5 -5
- package/build/protos/google/spanner/v1/query_plan.proto +18 -19
- package/build/protos/google/spanner/v1/result_set.proto +1 -1
- package/build/protos/google/spanner/v1/spanner.proto +21 -19
- package/build/protos/google/spanner/v1/transaction.proto +19 -32
- package/build/protos/google/spanner/v1/type.proto +33 -7
- package/build/protos/protos.d.ts +463 -64
- package/build/protos/protos.js +1267 -182
- package/build/protos/protos.json +221 -21
- package/build/src/backup.d.ts +22 -4
- package/build/src/backup.js +60 -29
- package/build/src/codec.d.ts +11 -0
- package/build/src/codec.js +41 -3
- package/build/src/database.d.ts +1 -1
- package/build/src/database.js +2 -2
- package/build/src/index.d.ts +20 -5
- package/build/src/index.js +26 -7
- package/build/src/instance.d.ts +44 -5
- package/build/src/instance.js +61 -6
- package/build/src/partial-result-stream.js +3 -0
- package/build/src/session-pool.d.ts +4 -4
- package/build/src/session-pool.js +6 -6
- package/build/src/transaction.js +1 -1
- package/build/src/v1/database_admin_client.d.ts +175 -10
- package/build/src/v1/database_admin_client.js +113 -11
- package/build/src/v1/database_admin_client_config.json +5 -0
- package/build/src/v1/instance_admin_client.js +2 -3
- package/build/src/v1/spanner_client.d.ts +1 -31
- package/build/src/v1/spanner_client.js +11 -9
- package/package.json +4 -4
|
@@ -6,10 +6,11 @@ import * as protos from '../../protos/protos';
|
|
|
6
6
|
/**
|
|
7
7
|
* Cloud Spanner Database Admin API
|
|
8
8
|
*
|
|
9
|
-
* The Cloud Spanner Database Admin API can be used to
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* The Cloud Spanner Database Admin API can be used to:
|
|
10
|
+
* * create, drop, and list databases
|
|
11
|
+
* * update the schema of pre-existing databases
|
|
12
|
+
* * create, delete and list backups for a database
|
|
13
|
+
* * restore a database from an existing backup
|
|
13
14
|
* @class
|
|
14
15
|
* @memberof v1
|
|
15
16
|
*/
|
|
@@ -132,6 +133,8 @@ export declare class DatabaseAdminClient {
|
|
|
132
133
|
* Drops (aka deletes) a Cloud Spanner database.
|
|
133
134
|
* Completed backups for the database will be retained according to their
|
|
134
135
|
* `expire_time`.
|
|
136
|
+
* Note: Cloud Spanner might continue to accept requests for a few seconds
|
|
137
|
+
* after the database has been deleted.
|
|
135
138
|
*
|
|
136
139
|
* @param {Object} request
|
|
137
140
|
* The request object that will be sent.
|
|
@@ -375,6 +378,8 @@ export declare class DatabaseAdminClient {
|
|
|
375
378
|
* Optional. The encryption configuration for the database. If this field is not
|
|
376
379
|
* specified, Cloud Spanner will encrypt/decrypt all data at rest using
|
|
377
380
|
* Google default encryption.
|
|
381
|
+
* @param {google.spanner.admin.database.v1.DatabaseDialect} [request.databaseDialect]
|
|
382
|
+
* Optional. The dialect of the Cloud Spanner Database.
|
|
378
383
|
* @param {object} [options]
|
|
379
384
|
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
380
385
|
* @returns {Promise} - The promise which resolves to an array.
|
|
@@ -529,6 +534,76 @@ export declare class DatabaseAdminClient {
|
|
|
529
534
|
* region_tag:spanner_v1_generated_DatabaseAdmin_CreateBackup_async
|
|
530
535
|
*/
|
|
531
536
|
checkCreateBackupProgress(name: string): Promise<LROperation<protos.google.spanner.admin.database.v1.Backup, protos.google.spanner.admin.database.v1.CreateBackupMetadata>>;
|
|
537
|
+
/**
|
|
538
|
+
* Starts copying a Cloud Spanner Backup.
|
|
539
|
+
* The returned backup {@link google.longrunning.Operation|long-running operation}
|
|
540
|
+
* will have a name of the format
|
|
541
|
+
* `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
|
|
542
|
+
* and can be used to track copying of the backup. The operation is associated
|
|
543
|
+
* with the destination backup.
|
|
544
|
+
* The {@link google.longrunning.Operation.metadata|metadata} field type is
|
|
545
|
+
* {@link google.spanner.admin.database.v1.CopyBackupMetadata|CopyBackupMetadata}.
|
|
546
|
+
* The {@link google.longrunning.Operation.response|response} field type is
|
|
547
|
+
* {@link google.spanner.admin.database.v1.Backup|Backup}, if successful. Cancelling the returned operation will stop the
|
|
548
|
+
* copying and delete the backup.
|
|
549
|
+
* Concurrent CopyBackup requests can run on the same source backup.
|
|
550
|
+
*
|
|
551
|
+
* @param {Object} request
|
|
552
|
+
* The request object that will be sent.
|
|
553
|
+
* @param {string} request.parent
|
|
554
|
+
* Required. The name of the destination instance that will contain the backup copy.
|
|
555
|
+
* Values are of the form: `projects/<project>/instances/<instance>`.
|
|
556
|
+
* @param {string} request.backupId
|
|
557
|
+
* Required. The id of the backup copy.
|
|
558
|
+
* The `backup_id` appended to `parent` forms the full backup_uri of the form
|
|
559
|
+
* `projects/<project>/instances/<instance>/backups/<backup>`.
|
|
560
|
+
* @param {string} request.sourceBackup
|
|
561
|
+
* Required. The source backup to be copied.
|
|
562
|
+
* The source backup needs to be in READY state for it to be copied.
|
|
563
|
+
* Once CopyBackup is in progress, the source backup cannot be deleted or
|
|
564
|
+
* cleaned up on expiration until CopyBackup is finished.
|
|
565
|
+
* Values are of the form:
|
|
566
|
+
* `projects/<project>/instances/<instance>/backups/<backup>`.
|
|
567
|
+
* @param {google.protobuf.Timestamp} request.expireTime
|
|
568
|
+
* Required. The expiration time of the backup in microsecond granularity.
|
|
569
|
+
* The expiration time must be at least 6 hours and at most 366 days
|
|
570
|
+
* from the `create_time` of the source backup. Once the `expire_time` has
|
|
571
|
+
* passed, the backup is eligible to be automatically deleted by Cloud Spanner
|
|
572
|
+
* to free the resources used by the backup.
|
|
573
|
+
* @param {google.spanner.admin.database.v1.CopyBackupEncryptionConfig} [request.encryptionConfig]
|
|
574
|
+
* Optional. The encryption configuration used to encrypt the backup. If this field is
|
|
575
|
+
* not specified, the backup will use the same
|
|
576
|
+
* encryption configuration as the source backup by default, namely
|
|
577
|
+
* {@link google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type|encryption_type} =
|
|
578
|
+
* `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`.
|
|
579
|
+
* @param {object} [options]
|
|
580
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
581
|
+
* @returns {Promise} - The promise which resolves to an array.
|
|
582
|
+
* The first element of the array is an object representing
|
|
583
|
+
* a long running operation. Its `promise()` method returns a promise
|
|
584
|
+
* you can `await` for.
|
|
585
|
+
* Please see the
|
|
586
|
+
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
|
|
587
|
+
* for more details and examples.
|
|
588
|
+
* @example <caption>include:samples/generated/v1/database_admin.copy_backup.js</caption>
|
|
589
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_CopyBackup_async
|
|
590
|
+
*/
|
|
591
|
+
copyBackup(request?: protos.google.spanner.admin.database.v1.ICopyBackupRequest, options?: CallOptions): Promise<[LROperation<protos.google.spanner.admin.database.v1.IBackup, protos.google.spanner.admin.database.v1.ICopyBackupMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined]>;
|
|
592
|
+
copyBackup(request: protos.google.spanner.admin.database.v1.ICopyBackupRequest, options: CallOptions, callback: Callback<LROperation<protos.google.spanner.admin.database.v1.IBackup, protos.google.spanner.admin.database.v1.ICopyBackupMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
|
|
593
|
+
copyBackup(request: protos.google.spanner.admin.database.v1.ICopyBackupRequest, callback: Callback<LROperation<protos.google.spanner.admin.database.v1.IBackup, protos.google.spanner.admin.database.v1.ICopyBackupMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
|
|
594
|
+
/**
|
|
595
|
+
* Check the status of the long running operation returned by `copyBackup()`.
|
|
596
|
+
* @param {String} name
|
|
597
|
+
* The operation name that will be passed.
|
|
598
|
+
* @returns {Promise} - The promise which resolves to an object.
|
|
599
|
+
* The decoded operation object has result and metadata field to get information from.
|
|
600
|
+
* Please see the
|
|
601
|
+
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
|
|
602
|
+
* for more details and examples.
|
|
603
|
+
* @example <caption>include:samples/generated/v1/database_admin.copy_backup.js</caption>
|
|
604
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_CopyBackup_async
|
|
605
|
+
*/
|
|
606
|
+
checkCopyBackupProgress(name: string): Promise<LROperation<protos.google.spanner.admin.database.v1.Backup, protos.google.spanner.admin.database.v1.CopyBackupMetadata>>;
|
|
532
607
|
/**
|
|
533
608
|
* Create a new database by restoring from a completed backup. The new
|
|
534
609
|
* database must be in the same project and in an instance with the same
|
|
@@ -921,6 +996,8 @@ export declare class DatabaseAdminClient {
|
|
|
921
996
|
* for {@link google.spanner.admin.database.v1.RestoreDatabaseMetadata|RestoreDatabaseMetadata} is
|
|
922
997
|
* `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
|
|
923
998
|
* * `metadata.<field_name>` - any field in metadata.value.
|
|
999
|
+
* `metadata.@type` must be specified first, if filtering on metadata
|
|
1000
|
+
* fields.
|
|
924
1001
|
* * `error` - Error associated with the long-running operation.
|
|
925
1002
|
* * `response.@type` - the type of response.
|
|
926
1003
|
* * `response.<field_name>` - any field in response.value.
|
|
@@ -993,6 +1070,8 @@ export declare class DatabaseAdminClient {
|
|
|
993
1070
|
* for {@link google.spanner.admin.database.v1.RestoreDatabaseMetadata|RestoreDatabaseMetadata} is
|
|
994
1071
|
* `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
|
|
995
1072
|
* * `metadata.<field_name>` - any field in metadata.value.
|
|
1073
|
+
* `metadata.@type` must be specified first, if filtering on metadata
|
|
1074
|
+
* fields.
|
|
996
1075
|
* * `error` - Error associated with the long-running operation.
|
|
997
1076
|
* * `response.@type` - the type of response.
|
|
998
1077
|
* * `response.<field_name>` - any field in response.value.
|
|
@@ -1064,6 +1143,8 @@ export declare class DatabaseAdminClient {
|
|
|
1064
1143
|
* for {@link google.spanner.admin.database.v1.RestoreDatabaseMetadata|RestoreDatabaseMetadata} is
|
|
1065
1144
|
* `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
|
|
1066
1145
|
* * `metadata.<field_name>` - any field in metadata.value.
|
|
1146
|
+
* `metadata.@type` must be specified first, if filtering on metadata
|
|
1147
|
+
* fields.
|
|
1067
1148
|
* * `error` - Error associated with the long-running operation.
|
|
1068
1149
|
* * `response.@type` - the type of response.
|
|
1069
1150
|
* * `response.<field_name>` - any field in response.value.
|
|
@@ -1144,6 +1225,8 @@ export declare class DatabaseAdminClient {
|
|
|
1144
1225
|
* for {@link google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata} is
|
|
1145
1226
|
* `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`.
|
|
1146
1227
|
* * `metadata.<field_name>` - any field in metadata.value.
|
|
1228
|
+
* `metadata.@type` must be specified first if filtering on metadata
|
|
1229
|
+
* fields.
|
|
1147
1230
|
* * `error` - Error associated with the long-running operation.
|
|
1148
1231
|
* * `response.@type` - the type of response.
|
|
1149
1232
|
* * `response.<field_name>` - any field in response.value.
|
|
@@ -1155,8 +1238,11 @@ export declare class DatabaseAdminClient {
|
|
|
1155
1238
|
* Here are a few examples:
|
|
1156
1239
|
*
|
|
1157
1240
|
* * `done:true` - The operation is complete.
|
|
1158
|
-
* * `metadata.database
|
|
1159
|
-
*
|
|
1241
|
+
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
1242
|
+
* `metadata.database:prod` - Returns operations where:
|
|
1243
|
+
* * The operation's metadata type is {@link google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}.
|
|
1244
|
+
* * The database the backup was taken from has a name containing the
|
|
1245
|
+
* string "prod".
|
|
1160
1246
|
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
1161
1247
|
* `(metadata.name:howl) AND` \
|
|
1162
1248
|
* `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
|
|
@@ -1165,6 +1251,29 @@ export declare class DatabaseAdminClient {
|
|
|
1165
1251
|
* * The backup name contains the string "howl".
|
|
1166
1252
|
* * The operation started before 2018-03-28T14:50:00Z.
|
|
1167
1253
|
* * The operation resulted in an error.
|
|
1254
|
+
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \
|
|
1255
|
+
* `(metadata.source_backup:test) AND` \
|
|
1256
|
+
* `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \
|
|
1257
|
+
* `(error:*)` - Returns operations where:
|
|
1258
|
+
* * The operation's metadata type is {@link google.spanner.admin.database.v1.CopyBackupMetadata|CopyBackupMetadata}.
|
|
1259
|
+
* * The source backup of the copied backup name contains the string
|
|
1260
|
+
* "test".
|
|
1261
|
+
* * The operation started before 2022-01-18T14:50:00Z.
|
|
1262
|
+
* * The operation resulted in an error.
|
|
1263
|
+
* * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
1264
|
+
* `(metadata.database:test_db)) OR` \
|
|
1265
|
+
* `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata)
|
|
1266
|
+
* AND` \
|
|
1267
|
+
* `(metadata.source_backup:test_bkp)) AND` \
|
|
1268
|
+
* `(error:*)` - Returns operations where:
|
|
1269
|
+
* * The operation's metadata matches either of criteria:
|
|
1270
|
+
* * The operation's metadata type is {@link google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata} AND the
|
|
1271
|
+
* database the backup was taken from has name containing string
|
|
1272
|
+
* "test_db"
|
|
1273
|
+
* * The operation's metadata type is {@link google.spanner.admin.database.v1.CopyBackupMetadata|CopyBackupMetadata} AND the
|
|
1274
|
+
* backup the backup was copied from has name containing string
|
|
1275
|
+
* "test_bkp"
|
|
1276
|
+
* * The operation resulted in an error.
|
|
1168
1277
|
* @param {number} request.pageSize
|
|
1169
1278
|
* Number of operations to be returned in the response. If 0 or
|
|
1170
1279
|
* less, defaults to the server's maximum allowed page size.
|
|
@@ -1214,6 +1323,8 @@ export declare class DatabaseAdminClient {
|
|
|
1214
1323
|
* for {@link google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata} is
|
|
1215
1324
|
* `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`.
|
|
1216
1325
|
* * `metadata.<field_name>` - any field in metadata.value.
|
|
1326
|
+
* `metadata.@type` must be specified first if filtering on metadata
|
|
1327
|
+
* fields.
|
|
1217
1328
|
* * `error` - Error associated with the long-running operation.
|
|
1218
1329
|
* * `response.@type` - the type of response.
|
|
1219
1330
|
* * `response.<field_name>` - any field in response.value.
|
|
@@ -1225,8 +1336,11 @@ export declare class DatabaseAdminClient {
|
|
|
1225
1336
|
* Here are a few examples:
|
|
1226
1337
|
*
|
|
1227
1338
|
* * `done:true` - The operation is complete.
|
|
1228
|
-
* * `metadata.database
|
|
1229
|
-
*
|
|
1339
|
+
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
1340
|
+
* `metadata.database:prod` - Returns operations where:
|
|
1341
|
+
* * The operation's metadata type is {@link google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}.
|
|
1342
|
+
* * The database the backup was taken from has a name containing the
|
|
1343
|
+
* string "prod".
|
|
1230
1344
|
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
1231
1345
|
* `(metadata.name:howl) AND` \
|
|
1232
1346
|
* `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
|
|
@@ -1235,6 +1349,29 @@ export declare class DatabaseAdminClient {
|
|
|
1235
1349
|
* * The backup name contains the string "howl".
|
|
1236
1350
|
* * The operation started before 2018-03-28T14:50:00Z.
|
|
1237
1351
|
* * The operation resulted in an error.
|
|
1352
|
+
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \
|
|
1353
|
+
* `(metadata.source_backup:test) AND` \
|
|
1354
|
+
* `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \
|
|
1355
|
+
* `(error:*)` - Returns operations where:
|
|
1356
|
+
* * The operation's metadata type is {@link google.spanner.admin.database.v1.CopyBackupMetadata|CopyBackupMetadata}.
|
|
1357
|
+
* * The source backup of the copied backup name contains the string
|
|
1358
|
+
* "test".
|
|
1359
|
+
* * The operation started before 2022-01-18T14:50:00Z.
|
|
1360
|
+
* * The operation resulted in an error.
|
|
1361
|
+
* * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
1362
|
+
* `(metadata.database:test_db)) OR` \
|
|
1363
|
+
* `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata)
|
|
1364
|
+
* AND` \
|
|
1365
|
+
* `(metadata.source_backup:test_bkp)) AND` \
|
|
1366
|
+
* `(error:*)` - Returns operations where:
|
|
1367
|
+
* * The operation's metadata matches either of criteria:
|
|
1368
|
+
* * The operation's metadata type is {@link google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata} AND the
|
|
1369
|
+
* database the backup was taken from has name containing string
|
|
1370
|
+
* "test_db"
|
|
1371
|
+
* * The operation's metadata type is {@link google.spanner.admin.database.v1.CopyBackupMetadata|CopyBackupMetadata} AND the
|
|
1372
|
+
* backup the backup was copied from has name containing string
|
|
1373
|
+
* "test_bkp"
|
|
1374
|
+
* * The operation resulted in an error.
|
|
1238
1375
|
* @param {number} request.pageSize
|
|
1239
1376
|
* Number of operations to be returned in the response. If 0 or
|
|
1240
1377
|
* less, defaults to the server's maximum allowed page size.
|
|
@@ -1283,6 +1420,8 @@ export declare class DatabaseAdminClient {
|
|
|
1283
1420
|
* for {@link google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata} is
|
|
1284
1421
|
* `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`.
|
|
1285
1422
|
* * `metadata.<field_name>` - any field in metadata.value.
|
|
1423
|
+
* `metadata.@type` must be specified first if filtering on metadata
|
|
1424
|
+
* fields.
|
|
1286
1425
|
* * `error` - Error associated with the long-running operation.
|
|
1287
1426
|
* * `response.@type` - the type of response.
|
|
1288
1427
|
* * `response.<field_name>` - any field in response.value.
|
|
@@ -1294,8 +1433,11 @@ export declare class DatabaseAdminClient {
|
|
|
1294
1433
|
* Here are a few examples:
|
|
1295
1434
|
*
|
|
1296
1435
|
* * `done:true` - The operation is complete.
|
|
1297
|
-
* * `metadata.database
|
|
1298
|
-
*
|
|
1436
|
+
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
1437
|
+
* `metadata.database:prod` - Returns operations where:
|
|
1438
|
+
* * The operation's metadata type is {@link google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}.
|
|
1439
|
+
* * The database the backup was taken from has a name containing the
|
|
1440
|
+
* string "prod".
|
|
1299
1441
|
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
1300
1442
|
* `(metadata.name:howl) AND` \
|
|
1301
1443
|
* `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
|
|
@@ -1304,6 +1446,29 @@ export declare class DatabaseAdminClient {
|
|
|
1304
1446
|
* * The backup name contains the string "howl".
|
|
1305
1447
|
* * The operation started before 2018-03-28T14:50:00Z.
|
|
1306
1448
|
* * The operation resulted in an error.
|
|
1449
|
+
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \
|
|
1450
|
+
* `(metadata.source_backup:test) AND` \
|
|
1451
|
+
* `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \
|
|
1452
|
+
* `(error:*)` - Returns operations where:
|
|
1453
|
+
* * The operation's metadata type is {@link google.spanner.admin.database.v1.CopyBackupMetadata|CopyBackupMetadata}.
|
|
1454
|
+
* * The source backup of the copied backup name contains the string
|
|
1455
|
+
* "test".
|
|
1456
|
+
* * The operation started before 2022-01-18T14:50:00Z.
|
|
1457
|
+
* * The operation resulted in an error.
|
|
1458
|
+
* * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
1459
|
+
* `(metadata.database:test_db)) OR` \
|
|
1460
|
+
* `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata)
|
|
1461
|
+
* AND` \
|
|
1462
|
+
* `(metadata.source_backup:test_bkp)) AND` \
|
|
1463
|
+
* `(error:*)` - Returns operations where:
|
|
1464
|
+
* * The operation's metadata matches either of criteria:
|
|
1465
|
+
* * The operation's metadata type is {@link google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata} AND the
|
|
1466
|
+
* database the backup was taken from has name containing string
|
|
1467
|
+
* "test_db"
|
|
1468
|
+
* * The operation's metadata type is {@link google.spanner.admin.database.v1.CopyBackupMetadata|CopyBackupMetadata} AND the
|
|
1469
|
+
* backup the backup was copied from has name containing string
|
|
1470
|
+
* "test_bkp"
|
|
1471
|
+
* * The operation resulted in an error.
|
|
1307
1472
|
* @param {number} request.pageSize
|
|
1308
1473
|
* Number of operations to be returned in the response. If 0 or
|
|
1309
1474
|
* less, defaults to the server's maximum allowed page size.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Copyright
|
|
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.
|
|
@@ -32,10 +32,11 @@ const version = require('../../../package.json').version;
|
|
|
32
32
|
/**
|
|
33
33
|
* Cloud Spanner Database Admin API
|
|
34
34
|
*
|
|
35
|
-
* The Cloud Spanner Database Admin API can be used to
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
35
|
+
* The Cloud Spanner Database Admin API can be used to:
|
|
36
|
+
* * create, drop, and list databases
|
|
37
|
+
* * update the schema of pre-existing databases
|
|
38
|
+
* * create, delete and list backups for a database
|
|
39
|
+
* * restore a database from an existing backup
|
|
39
40
|
* @class
|
|
40
41
|
* @memberof v1
|
|
41
42
|
*/
|
|
@@ -164,12 +165,15 @@ class DatabaseAdminClient {
|
|
|
164
165
|
const updateDatabaseDdlMetadata = protoFilesRoot.lookup('.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata');
|
|
165
166
|
const createBackupResponse = protoFilesRoot.lookup('.google.spanner.admin.database.v1.Backup');
|
|
166
167
|
const createBackupMetadata = protoFilesRoot.lookup('.google.spanner.admin.database.v1.CreateBackupMetadata');
|
|
168
|
+
const copyBackupResponse = protoFilesRoot.lookup('.google.spanner.admin.database.v1.Backup');
|
|
169
|
+
const copyBackupMetadata = protoFilesRoot.lookup('.google.spanner.admin.database.v1.CopyBackupMetadata');
|
|
167
170
|
const restoreDatabaseResponse = protoFilesRoot.lookup('.google.spanner.admin.database.v1.Database');
|
|
168
171
|
const restoreDatabaseMetadata = protoFilesRoot.lookup('.google.spanner.admin.database.v1.RestoreDatabaseMetadata');
|
|
169
172
|
this.descriptors.longrunning = {
|
|
170
173
|
createDatabase: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createDatabaseResponse.decode.bind(createDatabaseResponse), createDatabaseMetadata.decode.bind(createDatabaseMetadata)),
|
|
171
174
|
updateDatabaseDdl: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateDatabaseDdlResponse.decode.bind(updateDatabaseDdlResponse), updateDatabaseDdlMetadata.decode.bind(updateDatabaseDdlMetadata)),
|
|
172
175
|
createBackup: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createBackupResponse.decode.bind(createBackupResponse), createBackupMetadata.decode.bind(createBackupMetadata)),
|
|
176
|
+
copyBackup: new this._gaxModule.LongrunningDescriptor(this.operationsClient, copyBackupResponse.decode.bind(copyBackupResponse), copyBackupMetadata.decode.bind(copyBackupMetadata)),
|
|
173
177
|
restoreDatabase: new this._gaxModule.LongrunningDescriptor(this.operationsClient, restoreDatabaseResponse.decode.bind(restoreDatabaseResponse), restoreDatabaseMetadata.decode.bind(restoreDatabaseMetadata)),
|
|
174
178
|
};
|
|
175
179
|
// Put together the default options sent with requests.
|
|
@@ -216,6 +220,7 @@ class DatabaseAdminClient {
|
|
|
216
220
|
'getIamPolicy',
|
|
217
221
|
'testIamPermissions',
|
|
218
222
|
'createBackup',
|
|
223
|
+
'copyBackup',
|
|
219
224
|
'getBackup',
|
|
220
225
|
'updateBackup',
|
|
221
226
|
'deleteBackup',
|
|
@@ -580,6 +585,44 @@ class DatabaseAdminClient {
|
|
|
580
585
|
const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createBackup, gax.createDefaultBackoffSettings());
|
|
581
586
|
return decodeOperation;
|
|
582
587
|
}
|
|
588
|
+
copyBackup(request, optionsOrCallback, callback) {
|
|
589
|
+
request = request || {};
|
|
590
|
+
let options;
|
|
591
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
592
|
+
callback = optionsOrCallback;
|
|
593
|
+
options = {};
|
|
594
|
+
}
|
|
595
|
+
else {
|
|
596
|
+
options = optionsOrCallback;
|
|
597
|
+
}
|
|
598
|
+
options = options || {};
|
|
599
|
+
options.otherArgs = options.otherArgs || {};
|
|
600
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
601
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
602
|
+
gax.routingHeader.fromParams({
|
|
603
|
+
parent: request.parent || '',
|
|
604
|
+
});
|
|
605
|
+
this.initialize();
|
|
606
|
+
return this.innerApiCalls.copyBackup(request, options, callback);
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Check the status of the long running operation returned by `copyBackup()`.
|
|
610
|
+
* @param {String} name
|
|
611
|
+
* The operation name that will be passed.
|
|
612
|
+
* @returns {Promise} - The promise which resolves to an object.
|
|
613
|
+
* The decoded operation object has result and metadata field to get information from.
|
|
614
|
+
* Please see the
|
|
615
|
+
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
|
|
616
|
+
* for more details and examples.
|
|
617
|
+
* @example <caption>include:samples/generated/v1/database_admin.copy_backup.js</caption>
|
|
618
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_CopyBackup_async
|
|
619
|
+
*/
|
|
620
|
+
async checkCopyBackupProgress(name) {
|
|
621
|
+
const request = new google_gax_1.operationsProtos.google.longrunning.GetOperationRequest({ name });
|
|
622
|
+
const [operation] = await this.operationsClient.getOperation(request);
|
|
623
|
+
const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.copyBackup, gax.createDefaultBackoffSettings());
|
|
624
|
+
return decodeOperation;
|
|
625
|
+
}
|
|
583
626
|
restoreDatabase(request, optionsOrCallback, callback) {
|
|
584
627
|
request = request || {};
|
|
585
628
|
let options;
|
|
@@ -943,6 +986,8 @@ class DatabaseAdminClient {
|
|
|
943
986
|
* for {@link google.spanner.admin.database.v1.RestoreDatabaseMetadata|RestoreDatabaseMetadata} is
|
|
944
987
|
* `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
|
|
945
988
|
* * `metadata.<field_name>` - any field in metadata.value.
|
|
989
|
+
* `metadata.@type` must be specified first, if filtering on metadata
|
|
990
|
+
* fields.
|
|
946
991
|
* * `error` - Error associated with the long-running operation.
|
|
947
992
|
* * `response.@type` - the type of response.
|
|
948
993
|
* * `response.<field_name>` - any field in response.value.
|
|
@@ -1027,6 +1072,8 @@ class DatabaseAdminClient {
|
|
|
1027
1072
|
* for {@link google.spanner.admin.database.v1.RestoreDatabaseMetadata|RestoreDatabaseMetadata} is
|
|
1028
1073
|
* `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
|
|
1029
1074
|
* * `metadata.<field_name>` - any field in metadata.value.
|
|
1075
|
+
* `metadata.@type` must be specified first, if filtering on metadata
|
|
1076
|
+
* fields.
|
|
1030
1077
|
* * `error` - Error associated with the long-running operation.
|
|
1031
1078
|
* * `response.@type` - the type of response.
|
|
1032
1079
|
* * `response.<field_name>` - any field in response.value.
|
|
@@ -1130,6 +1177,8 @@ class DatabaseAdminClient {
|
|
|
1130
1177
|
* for {@link google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata} is
|
|
1131
1178
|
* `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`.
|
|
1132
1179
|
* * `metadata.<field_name>` - any field in metadata.value.
|
|
1180
|
+
* `metadata.@type` must be specified first if filtering on metadata
|
|
1181
|
+
* fields.
|
|
1133
1182
|
* * `error` - Error associated with the long-running operation.
|
|
1134
1183
|
* * `response.@type` - the type of response.
|
|
1135
1184
|
* * `response.<field_name>` - any field in response.value.
|
|
@@ -1141,8 +1190,11 @@ class DatabaseAdminClient {
|
|
|
1141
1190
|
* Here are a few examples:
|
|
1142
1191
|
*
|
|
1143
1192
|
* * `done:true` - The operation is complete.
|
|
1144
|
-
* * `metadata.database
|
|
1145
|
-
*
|
|
1193
|
+
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
1194
|
+
* `metadata.database:prod` - Returns operations where:
|
|
1195
|
+
* * The operation's metadata type is {@link google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}.
|
|
1196
|
+
* * The database the backup was taken from has a name containing the
|
|
1197
|
+
* string "prod".
|
|
1146
1198
|
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
1147
1199
|
* `(metadata.name:howl) AND` \
|
|
1148
1200
|
* `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
|
|
@@ -1151,6 +1203,29 @@ class DatabaseAdminClient {
|
|
|
1151
1203
|
* * The backup name contains the string "howl".
|
|
1152
1204
|
* * The operation started before 2018-03-28T14:50:00Z.
|
|
1153
1205
|
* * The operation resulted in an error.
|
|
1206
|
+
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \
|
|
1207
|
+
* `(metadata.source_backup:test) AND` \
|
|
1208
|
+
* `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \
|
|
1209
|
+
* `(error:*)` - Returns operations where:
|
|
1210
|
+
* * The operation's metadata type is {@link google.spanner.admin.database.v1.CopyBackupMetadata|CopyBackupMetadata}.
|
|
1211
|
+
* * The source backup of the copied backup name contains the string
|
|
1212
|
+
* "test".
|
|
1213
|
+
* * The operation started before 2022-01-18T14:50:00Z.
|
|
1214
|
+
* * The operation resulted in an error.
|
|
1215
|
+
* * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
1216
|
+
* `(metadata.database:test_db)) OR` \
|
|
1217
|
+
* `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata)
|
|
1218
|
+
* AND` \
|
|
1219
|
+
* `(metadata.source_backup:test_bkp)) AND` \
|
|
1220
|
+
* `(error:*)` - Returns operations where:
|
|
1221
|
+
* * The operation's metadata matches either of criteria:
|
|
1222
|
+
* * The operation's metadata type is {@link google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata} AND the
|
|
1223
|
+
* database the backup was taken from has name containing string
|
|
1224
|
+
* "test_db"
|
|
1225
|
+
* * The operation's metadata type is {@link google.spanner.admin.database.v1.CopyBackupMetadata|CopyBackupMetadata} AND the
|
|
1226
|
+
* backup the backup was copied from has name containing string
|
|
1227
|
+
* "test_bkp"
|
|
1228
|
+
* * The operation resulted in an error.
|
|
1154
1229
|
* @param {number} request.pageSize
|
|
1155
1230
|
* Number of operations to be returned in the response. If 0 or
|
|
1156
1231
|
* less, defaults to the server's maximum allowed page size.
|
|
@@ -1212,6 +1287,8 @@ class DatabaseAdminClient {
|
|
|
1212
1287
|
* for {@link google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata} is
|
|
1213
1288
|
* `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`.
|
|
1214
1289
|
* * `metadata.<field_name>` - any field in metadata.value.
|
|
1290
|
+
* `metadata.@type` must be specified first if filtering on metadata
|
|
1291
|
+
* fields.
|
|
1215
1292
|
* * `error` - Error associated with the long-running operation.
|
|
1216
1293
|
* * `response.@type` - the type of response.
|
|
1217
1294
|
* * `response.<field_name>` - any field in response.value.
|
|
@@ -1223,8 +1300,11 @@ class DatabaseAdminClient {
|
|
|
1223
1300
|
* Here are a few examples:
|
|
1224
1301
|
*
|
|
1225
1302
|
* * `done:true` - The operation is complete.
|
|
1226
|
-
* * `metadata.database
|
|
1227
|
-
*
|
|
1303
|
+
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
1304
|
+
* `metadata.database:prod` - Returns operations where:
|
|
1305
|
+
* * The operation's metadata type is {@link google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}.
|
|
1306
|
+
* * The database the backup was taken from has a name containing the
|
|
1307
|
+
* string "prod".
|
|
1228
1308
|
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
1229
1309
|
* `(metadata.name:howl) AND` \
|
|
1230
1310
|
* `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
|
|
@@ -1233,6 +1313,29 @@ class DatabaseAdminClient {
|
|
|
1233
1313
|
* * The backup name contains the string "howl".
|
|
1234
1314
|
* * The operation started before 2018-03-28T14:50:00Z.
|
|
1235
1315
|
* * The operation resulted in an error.
|
|
1316
|
+
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \
|
|
1317
|
+
* `(metadata.source_backup:test) AND` \
|
|
1318
|
+
* `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \
|
|
1319
|
+
* `(error:*)` - Returns operations where:
|
|
1320
|
+
* * The operation's metadata type is {@link google.spanner.admin.database.v1.CopyBackupMetadata|CopyBackupMetadata}.
|
|
1321
|
+
* * The source backup of the copied backup name contains the string
|
|
1322
|
+
* "test".
|
|
1323
|
+
* * The operation started before 2022-01-18T14:50:00Z.
|
|
1324
|
+
* * The operation resulted in an error.
|
|
1325
|
+
* * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
1326
|
+
* `(metadata.database:test_db)) OR` \
|
|
1327
|
+
* `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata)
|
|
1328
|
+
* AND` \
|
|
1329
|
+
* `(metadata.source_backup:test_bkp)) AND` \
|
|
1330
|
+
* `(error:*)` - Returns operations where:
|
|
1331
|
+
* * The operation's metadata matches either of criteria:
|
|
1332
|
+
* * The operation's metadata type is {@link google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata} AND the
|
|
1333
|
+
* database the backup was taken from has name containing string
|
|
1334
|
+
* "test_db"
|
|
1335
|
+
* * The operation's metadata type is {@link google.spanner.admin.database.v1.CopyBackupMetadata|CopyBackupMetadata} AND the
|
|
1336
|
+
* backup the backup was copied from has name containing string
|
|
1337
|
+
* "test_bkp"
|
|
1338
|
+
* * The operation resulted in an error.
|
|
1236
1339
|
* @param {number} request.pageSize
|
|
1237
1340
|
* Number of operations to be returned in the response. If 0 or
|
|
1238
1341
|
* less, defaults to the server's maximum allowed page size.
|
|
@@ -1462,8 +1565,7 @@ class DatabaseAdminClient {
|
|
|
1462
1565
|
* @returns {Promise} A promise that resolves when the client is closed.
|
|
1463
1566
|
*/
|
|
1464
1567
|
close() {
|
|
1465
|
-
this.
|
|
1466
|
-
if (!this._terminated) {
|
|
1568
|
+
if (this.databaseAdminStub && !this._terminated) {
|
|
1467
1569
|
return this.databaseAdminStub.then(stub => {
|
|
1468
1570
|
this._terminated = true;
|
|
1469
1571
|
stub.close();
|
|
@@ -79,6 +79,11 @@
|
|
|
79
79
|
"retry_codes_name": "non_idempotent",
|
|
80
80
|
"retry_params_name": "default"
|
|
81
81
|
},
|
|
82
|
+
"CopyBackup": {
|
|
83
|
+
"timeout_millis": 3600000,
|
|
84
|
+
"retry_codes_name": "non_idempotent",
|
|
85
|
+
"retry_params_name": "default"
|
|
86
|
+
},
|
|
82
87
|
"GetBackup": {
|
|
83
88
|
"timeout_millis": 3600000,
|
|
84
89
|
"retry_codes_name": "idempotent",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Copyright
|
|
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.
|
|
@@ -826,8 +826,7 @@ class InstanceAdminClient {
|
|
|
826
826
|
* @returns {Promise} A promise that resolves when the client is closed.
|
|
827
827
|
*/
|
|
828
828
|
close() {
|
|
829
|
-
this.
|
|
830
|
-
if (!this._terminated) {
|
|
829
|
+
if (this.instanceAdminStub && !this._terminated) {
|
|
831
830
|
return this.instanceAdminStub.then(stub => {
|
|
832
831
|
this._terminated = true;
|
|
833
832
|
stub.close();
|