@google-cloud/spanner 5.17.0 → 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 +15 -0
- package/README.md +13 -0
- package/build/protos/google/spanner/admin/database/v1/backup.proto +174 -9
- package/build/protos/google/spanner/admin/database/v1/common.proto +1 -2
- package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +27 -2
- package/build/protos/google/spanner/v1/commit_response.proto +0 -2
- package/build/protos/google/spanner/v1/keys.proto +0 -1
- package/build/protos/google/spanner/v1/mutation.proto +0 -1
- package/build/protos/google/spanner/v1/query_plan.proto +0 -1
- package/build/protos/google/spanner/v1/result_set.proto +0 -1
- package/build/protos/google/spanner/v1/transaction.proto +0 -1
- package/build/protos/google/spanner/v1/type.proto +0 -1
- package/build/protos/protos.d.ts +623 -261
- package/build/protos/protos.js +2996 -2096
- package/build/protos/protos.json +227 -87
- 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 +39 -2
- package/build/src/index.d.ts +17 -2
- package/build/src/index.js +19 -0
- package/build/src/instance.d.ts +40 -1
- package/build/src/instance.js +55 -1
- package/build/src/v1/database_admin_client.d.ts +166 -6
- package/build/src/v1/database_admin_client.js +106 -4
- package/build/src/v1/database_admin_client_config.json +5 -0
- package/package.json +1 -1
|
@@ -165,12 +165,15 @@ class DatabaseAdminClient {
|
|
|
165
165
|
const updateDatabaseDdlMetadata = protoFilesRoot.lookup('.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata');
|
|
166
166
|
const createBackupResponse = protoFilesRoot.lookup('.google.spanner.admin.database.v1.Backup');
|
|
167
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');
|
|
168
170
|
const restoreDatabaseResponse = protoFilesRoot.lookup('.google.spanner.admin.database.v1.Database');
|
|
169
171
|
const restoreDatabaseMetadata = protoFilesRoot.lookup('.google.spanner.admin.database.v1.RestoreDatabaseMetadata');
|
|
170
172
|
this.descriptors.longrunning = {
|
|
171
173
|
createDatabase: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createDatabaseResponse.decode.bind(createDatabaseResponse), createDatabaseMetadata.decode.bind(createDatabaseMetadata)),
|
|
172
174
|
updateDatabaseDdl: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateDatabaseDdlResponse.decode.bind(updateDatabaseDdlResponse), updateDatabaseDdlMetadata.decode.bind(updateDatabaseDdlMetadata)),
|
|
173
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)),
|
|
174
177
|
restoreDatabase: new this._gaxModule.LongrunningDescriptor(this.operationsClient, restoreDatabaseResponse.decode.bind(restoreDatabaseResponse), restoreDatabaseMetadata.decode.bind(restoreDatabaseMetadata)),
|
|
175
178
|
};
|
|
176
179
|
// Put together the default options sent with requests.
|
|
@@ -217,6 +220,7 @@ class DatabaseAdminClient {
|
|
|
217
220
|
'getIamPolicy',
|
|
218
221
|
'testIamPermissions',
|
|
219
222
|
'createBackup',
|
|
223
|
+
'copyBackup',
|
|
220
224
|
'getBackup',
|
|
221
225
|
'updateBackup',
|
|
222
226
|
'deleteBackup',
|
|
@@ -581,6 +585,44 @@ class DatabaseAdminClient {
|
|
|
581
585
|
const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createBackup, gax.createDefaultBackoffSettings());
|
|
582
586
|
return decodeOperation;
|
|
583
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
|
+
}
|
|
584
626
|
restoreDatabase(request, optionsOrCallback, callback) {
|
|
585
627
|
request = request || {};
|
|
586
628
|
let options;
|
|
@@ -944,6 +986,8 @@ class DatabaseAdminClient {
|
|
|
944
986
|
* for {@link google.spanner.admin.database.v1.RestoreDatabaseMetadata|RestoreDatabaseMetadata} is
|
|
945
987
|
* `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
|
|
946
988
|
* * `metadata.<field_name>` - any field in metadata.value.
|
|
989
|
+
* `metadata.@type` must be specified first, if filtering on metadata
|
|
990
|
+
* fields.
|
|
947
991
|
* * `error` - Error associated with the long-running operation.
|
|
948
992
|
* * `response.@type` - the type of response.
|
|
949
993
|
* * `response.<field_name>` - any field in response.value.
|
|
@@ -1028,6 +1072,8 @@ class DatabaseAdminClient {
|
|
|
1028
1072
|
* for {@link google.spanner.admin.database.v1.RestoreDatabaseMetadata|RestoreDatabaseMetadata} is
|
|
1029
1073
|
* `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
|
|
1030
1074
|
* * `metadata.<field_name>` - any field in metadata.value.
|
|
1075
|
+
* `metadata.@type` must be specified first, if filtering on metadata
|
|
1076
|
+
* fields.
|
|
1031
1077
|
* * `error` - Error associated with the long-running operation.
|
|
1032
1078
|
* * `response.@type` - the type of response.
|
|
1033
1079
|
* * `response.<field_name>` - any field in response.value.
|
|
@@ -1131,6 +1177,8 @@ class DatabaseAdminClient {
|
|
|
1131
1177
|
* for {@link google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata} is
|
|
1132
1178
|
* `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`.
|
|
1133
1179
|
* * `metadata.<field_name>` - any field in metadata.value.
|
|
1180
|
+
* `metadata.@type` must be specified first if filtering on metadata
|
|
1181
|
+
* fields.
|
|
1134
1182
|
* * `error` - Error associated with the long-running operation.
|
|
1135
1183
|
* * `response.@type` - the type of response.
|
|
1136
1184
|
* * `response.<field_name>` - any field in response.value.
|
|
@@ -1142,8 +1190,11 @@ class DatabaseAdminClient {
|
|
|
1142
1190
|
* Here are a few examples:
|
|
1143
1191
|
*
|
|
1144
1192
|
* * `done:true` - The operation is complete.
|
|
1145
|
-
* * `metadata.database
|
|
1146
|
-
*
|
|
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".
|
|
1147
1198
|
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
1148
1199
|
* `(metadata.name:howl) AND` \
|
|
1149
1200
|
* `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
|
|
@@ -1152,6 +1203,29 @@ class DatabaseAdminClient {
|
|
|
1152
1203
|
* * The backup name contains the string "howl".
|
|
1153
1204
|
* * The operation started before 2018-03-28T14:50:00Z.
|
|
1154
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.
|
|
1155
1229
|
* @param {number} request.pageSize
|
|
1156
1230
|
* Number of operations to be returned in the response. If 0 or
|
|
1157
1231
|
* less, defaults to the server's maximum allowed page size.
|
|
@@ -1213,6 +1287,8 @@ class DatabaseAdminClient {
|
|
|
1213
1287
|
* for {@link google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata} is
|
|
1214
1288
|
* `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`.
|
|
1215
1289
|
* * `metadata.<field_name>` - any field in metadata.value.
|
|
1290
|
+
* `metadata.@type` must be specified first if filtering on metadata
|
|
1291
|
+
* fields.
|
|
1216
1292
|
* * `error` - Error associated with the long-running operation.
|
|
1217
1293
|
* * `response.@type` - the type of response.
|
|
1218
1294
|
* * `response.<field_name>` - any field in response.value.
|
|
@@ -1224,8 +1300,11 @@ class DatabaseAdminClient {
|
|
|
1224
1300
|
* Here are a few examples:
|
|
1225
1301
|
*
|
|
1226
1302
|
* * `done:true` - The operation is complete.
|
|
1227
|
-
* * `metadata.database
|
|
1228
|
-
*
|
|
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".
|
|
1229
1308
|
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
1230
1309
|
* `(metadata.name:howl) AND` \
|
|
1231
1310
|
* `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
|
|
@@ -1234,6 +1313,29 @@ class DatabaseAdminClient {
|
|
|
1234
1313
|
* * The backup name contains the string "howl".
|
|
1235
1314
|
* * The operation started before 2018-03-28T14:50:00Z.
|
|
1236
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.
|
|
1237
1339
|
* @param {number} request.pageSize
|
|
1238
1340
|
* Number of operations to be returned in the response. If 0 or
|
|
1239
1341
|
* less, defaults to the server's maximum allowed page size.
|
|
@@ -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",
|