@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.
Files changed (38) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +25 -12
  3. package/build/protos/google/spanner/admin/database/v1/backup.proto +177 -9
  4. package/build/protos/google/spanner/admin/database/v1/common.proto +14 -2
  5. package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +40 -5
  6. package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +8 -5
  7. package/build/protos/google/spanner/v1/commit_response.proto +2 -4
  8. package/build/protos/google/spanner/v1/keys.proto +0 -1
  9. package/build/protos/google/spanner/v1/mutation.proto +5 -5
  10. package/build/protos/google/spanner/v1/query_plan.proto +18 -19
  11. package/build/protos/google/spanner/v1/result_set.proto +1 -1
  12. package/build/protos/google/spanner/v1/spanner.proto +21 -19
  13. package/build/protos/google/spanner/v1/transaction.proto +19 -32
  14. package/build/protos/google/spanner/v1/type.proto +33 -7
  15. package/build/protos/protos.d.ts +463 -64
  16. package/build/protos/protos.js +1267 -182
  17. package/build/protos/protos.json +221 -21
  18. package/build/src/backup.d.ts +22 -4
  19. package/build/src/backup.js +60 -29
  20. package/build/src/codec.d.ts +11 -0
  21. package/build/src/codec.js +41 -3
  22. package/build/src/database.d.ts +1 -1
  23. package/build/src/database.js +2 -2
  24. package/build/src/index.d.ts +20 -5
  25. package/build/src/index.js +26 -7
  26. package/build/src/instance.d.ts +44 -5
  27. package/build/src/instance.js +61 -6
  28. package/build/src/partial-result-stream.js +3 -0
  29. package/build/src/session-pool.d.ts +4 -4
  30. package/build/src/session-pool.js +6 -6
  31. package/build/src/transaction.js +1 -1
  32. package/build/src/v1/database_admin_client.d.ts +175 -10
  33. package/build/src/v1/database_admin_client.js +113 -11
  34. package/build/src/v1/database_admin_client_config.json +5 -0
  35. package/build/src/v1/instance_admin_client.js +2 -3
  36. package/build/src/v1/spanner_client.d.ts +1 -31
  37. package/build/src/v1/spanner_client.js +11 -9
  38. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -4,6 +4,49 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/nodejs-spanner?activeTab=versions
6
6
 
7
+ ## [5.18.0](https://github.com/googleapis/nodejs-spanner/compare/v5.17.0...v5.18.0) (2022-04-03)
8
+
9
+
10
+ ### Features
11
+
12
+ * add support for Cross region backup proto changes ([#1587](https://github.com/googleapis/nodejs-spanner/issues/1587)) ([9439ca4](https://github.com/googleapis/nodejs-spanner/commit/9439ca4cf260923a7cb90e0568864cb719ab8fc6))
13
+ * integration testing for postgres dialect ([#1593](https://github.com/googleapis/nodejs-spanner/issues/1593)) ([ebe06a6](https://github.com/googleapis/nodejs-spanner/commit/ebe06a6cefbeacc37c40f2474b9d265b78c846e2))
14
+ * Postgres Numeric and database support ([#1592](https://github.com/googleapis/nodejs-spanner/issues/1592)) ([7ca3975](https://github.com/googleapis/nodejs-spanner/commit/7ca3975c5e25e78983f77df9e921642c90874f90))
15
+ * Spanner copy backup ([#1530](https://github.com/googleapis/nodejs-spanner/issues/1530)) ([cefb1b4](https://github.com/googleapis/nodejs-spanner/commit/cefb1b4c831997e5c52122c5e6c3fd9cd9cb2c76))
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * removing table_catalog from schema information ([#1595](https://github.com/googleapis/nodejs-spanner/issues/1595)) ([8bcbd95](https://github.com/googleapis/nodejs-spanner/commit/8bcbd95e7423f03aa16ffd500fca998f75c8d0cf))
21
+
22
+ ## [5.17.0](https://github.com/googleapis/nodejs-spanner/compare/v5.16.3...v5.17.0) (2022-03-09)
23
+
24
+
25
+ ### Features
26
+
27
+ * Refactor create database options schema to accept array ([#1578](https://github.com/googleapis/nodejs-spanner/issues/1578)) ([b1c88ac](https://github.com/googleapis/nodejs-spanner/commit/b1c88accee3770bb94e6a7d73e767eaa426a86a3))
28
+
29
+ ### [5.16.3](https://github.com/googleapis/nodejs-spanner/compare/v5.16.3...v5.16.3) (2022-01-31)
30
+
31
+
32
+ ### Miscellaneous Chores
33
+
34
+ * Release-As: 5.16.3 ([#1556](https://github.com/googleapis/nodejs-spanner/issues/1556)) ([31f5fbc](https://github.com/googleapis/nodejs-spanner/commit/31f5fbc6d890fd7296497d6992a7d186ea786476))
35
+
36
+ ### [5.16.3](https://github.com/googleapis/nodejs-spanner/compare/v5.16.3...v5.16.3) (2022-01-21)
37
+
38
+
39
+ ### Miscellaneous Chores
40
+
41
+ * Release-As: 5.16.3 ([#1556](https://github.com/googleapis/nodejs-spanner/issues/1556)) ([31f5fbc](https://github.com/googleapis/nodejs-spanner/commit/31f5fbc6d890fd7296497d6992a7d186ea786476))
42
+
43
+ ### [5.16.3](https://github.com/googleapis/nodejs-spanner/compare/v5.16.2...v5.16.3) (2022-01-19)
44
+
45
+
46
+ ### Bug Fixes
47
+
48
+ * for merging when array/struct chunks contain null ([#1541](https://github.com/googleapis/nodejs-spanner/issues/1541)) ([72871fc](https://github.com/googleapis/nodejs-spanner/commit/72871fca5b67aec3af633484ff70a73be55372be))
49
+
7
50
  ### [5.16.2](https://github.com/googleapis/nodejs-spanner/compare/v5.16.1...v5.16.2) (2022-01-17)
8
51
 
9
52
 
package/README.md CHANGED
@@ -90,6 +90,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-spanner/tre
90
90
  | Sample | Source Code | Try it |
91
91
  | --------------------------- | --------------------------------- | ------ |
92
92
  | Backups-cancel | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/backups-cancel.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/backups-cancel.js,samples/README.md) |
93
+ | Copies a source backup | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/backups-copy.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/backups-copy.js,samples/README.md) |
93
94
  | Backups-create-with-encryption-key | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/backups-create-with-encryption-key.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/backups-create-with-encryption-key.js,samples/README.md) |
94
95
  | Backups-create | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/backups-create.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/backups-create.js,samples/README.md) |
95
96
  | Backups-delete | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/backups-delete.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/backups-delete.js,samples/README.md) |
@@ -128,6 +129,18 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-spanner/tre
128
129
  | Numeric-add-column | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/numeric-add-column.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/numeric-add-column.js,samples/README.md) |
129
130
  | Numeric-query-parameter | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/numeric-query-parameter.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/numeric-query-parameter.js,samples/README.md) |
130
131
  | Numeric-update-data | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/numeric-update-data.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/numeric-update-data.js,samples/README.md) |
132
+ | Showcase the rules for case-sensitivity and case folding for a Spanner PostgreSQL database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-case-sensitivity.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-case-sensitivity.js,samples/README.md) |
133
+ | Creates a PostgreSQL Database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-database-create.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-database-create.js,samples/README.md) |
134
+ | Use cast operator to cast from one data type to another in a Spanner PostgreSQL database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-datatypes-casting.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-datatypes-casting.js,samples/README.md) |
135
+ | Execute a batch of DML statements on a Spanner PostgreSQL database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-dml-batch.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-dml-batch.js,samples/README.md) |
136
+ | Execute a Partitioned DML on a Spanner PostgreSQL database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-dml-partitioned.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-dml-partitioned.js,samples/README.md) |
137
+ | Execute a DML statement with parameters on a Spanner PostgreSQL database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-dml-with-parameter.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-dml-with-parameter.js,samples/README.md) |
138
+ | Calls a server side function on a Spanner PostgreSQL database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-functions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-functions.js,samples/README.md) |
139
+ | Created interleaved table hierarchy using PostgreSQL dialect. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-interleaving.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-interleaving.js,samples/README.md) |
140
+ | Showcase how to work with the PostgreSQL NUMERIC/DECIMAL data type on a Spanner PostgreSQL database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-numeric-data-type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-numeric-data-type.js,samples/README.md) |
141
+ | Showcases how a Spanner PostgreSQL database orders null values in a query. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-ordering-nulls.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-ordering-nulls.js,samples/README.md) |
142
+ | Execute a query with parameters on a Spanner PostgreSQL database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-query-parameter.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-query-parameter.js,samples/README.md) |
143
+ | Query the information schema metadata in a Spanner PostgreSQL database. | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/pg-schema-information.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/pg-schema-information.js,samples/README.md) |
131
144
  | Queryoptions | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/queryoptions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/queryoptions.js,samples/README.md) |
132
145
  | Quickstart | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) |
133
146
  | Sets a request tag for a single query | [source code](https://github.com/googleapis/nodejs-spanner/blob/main/samples/request-tag.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-spanner&page=editor&open_in_editor=samples/request-tag.js,samples/README.md) |
@@ -148,21 +161,21 @@ also contains samples.
148
161
  Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/).
149
162
  Libraries are compatible with all current _active_ and _maintenance_ versions of
150
163
  Node.js.
164
+ If you are using an end-of-life version of Node.js, we recommend that you update
165
+ as soon as possible to an actively supported LTS version.
151
166
 
152
- Client libraries targeting some end-of-life versions of Node.js are available, and
153
- can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag).
154
- The dist-tags follow the naming convention `legacy-(version)`.
155
-
156
- _Legacy Node.js versions are supported as a best effort:_
167
+ Google's client libraries support legacy versions of Node.js runtimes on a
168
+ best-efforts basis with the following warnings:
157
169
 
158
- * Legacy versions will not be tested in continuous integration.
159
- * Some security patches may not be able to be backported.
160
- * Dependencies will not be kept up-to-date, and features will not be backported.
170
+ * Legacy versions are not tested in continuous integration.
171
+ * Some security patches and features cannot be backported.
172
+ * Dependencies cannot be kept up-to-date.
161
173
 
162
- #### Legacy tags available
163
-
164
- * `legacy-8`: install client libraries from this dist-tag for versions
165
- compatible with Node.js 8.
174
+ Client libraries targeting some end-of-life versions of Node.js are available, and
175
+ can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag).
176
+ The dist-tags follow the naming convention `legacy-(version)`.
177
+ For example, `npm install @google-cloud/spanner@legacy-8` installs client libraries
178
+ for versions compatible with Node.js 8.
166
179
 
167
180
  ## Versioning
168
181
 
@@ -1,4 +1,4 @@
1
- // Copyright 2021 Google LLC
1
+ // Copyright 2022 Google LLC
2
2
  //
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
@@ -22,7 +22,6 @@ import "google/longrunning/operations.proto";
22
22
  import "google/protobuf/field_mask.proto";
23
23
  import "google/protobuf/timestamp.proto";
24
24
  import "google/spanner/admin/database/v1/common.proto";
25
- import "google/api/annotations.proto";
26
25
 
27
26
  option csharp_namespace = "Google.Cloud.Spanner.Admin.Database.V1";
28
27
  option go_package = "google.golang.org/genproto/googleapis/spanner/admin/database/v1;database";
@@ -117,6 +116,30 @@ message Backup {
117
116
 
118
117
  // Output only. The encryption information for the backup.
119
118
  EncryptionInfo encryption_info = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
119
+
120
+ // Output only. The database dialect information for the backup.
121
+ DatabaseDialect database_dialect = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
122
+
123
+ // Output only. The names of the destination backups being created by copying
124
+ // this source backup. The backup names are of the form
125
+ // `projects/<project>/instances/<instance>/backups/<backup>`.
126
+ // Referencing backups may exist in different instances. The existence of
127
+ // any referencing backup prevents the backup from being deleted. When the
128
+ // copy operation is done (either successfully completed or cancelled or the
129
+ // destination backup is deleted), the reference to the backup is removed.
130
+ repeated string referencing_backups = 11 [
131
+ (google.api.field_behavior) = OUTPUT_ONLY,
132
+ (google.api.resource_reference) = {
133
+ type: "spanner.googleapis.com/Backup"
134
+ }
135
+ ];
136
+
137
+ // Output only. The max allowed expiration time of the backup, with
138
+ // microseconds granularity. A backup's expiration time can be configured in
139
+ // multiple APIs: CreateBackup, UpdateBackup, CopyBackup. When updating or
140
+ // copying an existing backup, the expiration time specified must be
141
+ // less than `Backup.max_expire_time`.
142
+ google.protobuf.Timestamp max_expire_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
120
143
  }
121
144
 
122
145
  // The request for [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup].
@@ -182,6 +205,86 @@ message CreateBackupMetadata {
182
205
  google.protobuf.Timestamp cancel_time = 4;
183
206
  }
184
207
 
208
+ // The request for [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup].
209
+ message CopyBackupRequest {
210
+ // Required. The name of the destination instance that will contain the backup copy.
211
+ // Values are of the form: `projects/<project>/instances/<instance>`.
212
+ string parent = 1 [
213
+ (google.api.field_behavior) = REQUIRED,
214
+ (google.api.resource_reference) = {
215
+ type: "spanner.googleapis.com/Instance"
216
+ }
217
+ ];
218
+
219
+ // Required. The id of the backup copy.
220
+ // The `backup_id` appended to `parent` forms the full backup_uri of the form
221
+ // `projects/<project>/instances/<instance>/backups/<backup>`.
222
+ string backup_id = 2 [(google.api.field_behavior) = REQUIRED];
223
+
224
+ // Required. The source backup to be copied.
225
+ // The source backup needs to be in READY state for it to be copied.
226
+ // Once CopyBackup is in progress, the source backup cannot be deleted or
227
+ // cleaned up on expiration until CopyBackup is finished.
228
+ // Values are of the form:
229
+ // `projects/<project>/instances/<instance>/backups/<backup>`.
230
+ string source_backup = 3 [
231
+ (google.api.field_behavior) = REQUIRED,
232
+ (google.api.resource_reference) = {
233
+ type: "spanner.googleapis.com/Backup"
234
+ }
235
+ ];
236
+
237
+ // Required. The expiration time of the backup in microsecond granularity.
238
+ // The expiration time must be at least 6 hours and at most 366 days
239
+ // from the `create_time` of the source backup. Once the `expire_time` has
240
+ // passed, the backup is eligible to be automatically deleted by Cloud Spanner
241
+ // to free the resources used by the backup.
242
+ google.protobuf.Timestamp expire_time = 4 [(google.api.field_behavior) = REQUIRED];
243
+
244
+ // Optional. The encryption configuration used to encrypt the backup. If this field is
245
+ // not specified, the backup will use the same
246
+ // encryption configuration as the source backup by default, namely
247
+ // [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] =
248
+ // `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`.
249
+ CopyBackupEncryptionConfig encryption_config = 5 [(google.api.field_behavior) = OPTIONAL];
250
+ }
251
+
252
+ // Metadata type for the google.longrunning.Operation returned by
253
+ // [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup].
254
+ message CopyBackupMetadata {
255
+ // The name of the backup being created through the copy operation.
256
+ // Values are of the form
257
+ // `projects/<project>/instances/<instance>/backups/<backup>`.
258
+ string name = 1 [(google.api.resource_reference) = {
259
+ type: "spanner.googleapis.com/Backup"
260
+ }];
261
+
262
+ // The name of the source backup that is being copied.
263
+ // Values are of the form
264
+ // `projects/<project>/instances/<instance>/backups/<backup>`.
265
+ string source_backup = 2 [(google.api.resource_reference) = {
266
+ type: "spanner.googleapis.com/Backup"
267
+ }];
268
+
269
+ // The progress of the
270
+ // [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup] operation.
271
+ OperationProgress progress = 3;
272
+
273
+ // The time at which cancellation of CopyBackup operation was received.
274
+ // [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]
275
+ // starts asynchronous cancellation on a long-running operation. The server
276
+ // makes a best effort to cancel the operation, but success is not guaranteed.
277
+ // Clients can use
278
+ // [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
279
+ // other methods to check whether the cancellation succeeded or whether the
280
+ // operation completed despite cancellation. On successful cancellation,
281
+ // the operation is not deleted; instead, it becomes an operation with
282
+ // an [Operation.error][google.longrunning.Operation.error] value with a
283
+ // [google.rpc.Status.code][google.rpc.Status.code] of 1,
284
+ // corresponding to `Code.CANCELLED`.
285
+ google.protobuf.Timestamp cancel_time = 4;
286
+ }
287
+
185
288
  // The request for [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup].
186
289
  message UpdateBackupRequest {
187
290
  // Required. The backup to update. `backup.name`, and the fields to be updated
@@ -324,6 +427,8 @@ message ListBackupOperationsRequest {
324
427
  // for [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] is
325
428
  // `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`.
326
429
  // * `metadata.<field_name>` - any field in metadata.value.
430
+ // `metadata.@type` must be specified first if filtering on metadata
431
+ // fields.
327
432
  // * `error` - Error associated with the long-running operation.
328
433
  // * `response.@type` - the type of response.
329
434
  // * `response.<field_name>` - any field in response.value.
@@ -335,8 +440,11 @@ message ListBackupOperationsRequest {
335
440
  // Here are a few examples:
336
441
  //
337
442
  // * `done:true` - The operation is complete.
338
- // * `metadata.database:prod` - The database the backup was taken from has
339
- // a name containing the string "prod".
443
+ // * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
444
+ // `metadata.database:prod` - Returns operations where:
445
+ // * The operation's metadata type is [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata].
446
+ // * The database the backup was taken from has a name containing the
447
+ // string "prod".
340
448
  // * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
341
449
  // `(metadata.name:howl) AND` \
342
450
  // `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
@@ -345,6 +453,29 @@ message ListBackupOperationsRequest {
345
453
  // * The backup name contains the string "howl".
346
454
  // * The operation started before 2018-03-28T14:50:00Z.
347
455
  // * The operation resulted in an error.
456
+ // * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \
457
+ // `(metadata.source_backup:test) AND` \
458
+ // `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \
459
+ // `(error:*)` - Returns operations where:
460
+ // * The operation's metadata type is [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata].
461
+ // * The source backup of the copied backup name contains the string
462
+ // "test".
463
+ // * The operation started before 2022-01-18T14:50:00Z.
464
+ // * The operation resulted in an error.
465
+ // * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
466
+ // `(metadata.database:test_db)) OR` \
467
+ // `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata)
468
+ // AND` \
469
+ // `(metadata.source_backup:test_bkp)) AND` \
470
+ // `(error:*)` - Returns operations where:
471
+ // * The operation's metadata matches either of criteria:
472
+ // * The operation's metadata type is [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] AND the
473
+ // database the backup was taken from has name containing string
474
+ // "test_db"
475
+ // * The operation's metadata type is [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata] AND the
476
+ // backup the backup was copied from has name containing string
477
+ // "test_bkp"
478
+ // * The operation resulted in an error.
348
479
  string filter = 2;
349
480
 
350
481
  // Number of operations to be returned in the response. If 0 or
@@ -363,11 +494,11 @@ message ListBackupOperationsRequest {
363
494
  message ListBackupOperationsResponse {
364
495
  // The list of matching backup [long-running
365
496
  // operations][google.longrunning.Operation]. Each operation's name will be
366
- // prefixed by the backup's name and the operation's
367
- // [metadata][google.longrunning.Operation.metadata] will be of type
368
- // [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. Operations returned include those that are
369
- // pending or have completed/failed/canceled within the last 7 days.
370
- // Operations returned are ordered by
497
+ // prefixed by the backup's name. The operation's
498
+ // [metadata][google.longrunning.Operation.metadata] field type
499
+ // `metadata.type_url` describes the type of the metadata. Operations returned
500
+ // include those that are pending or have completed/failed/canceled within the
501
+ // last 7 days. Operations returned are ordered by
371
502
  // `operation.metadata.value.progress.start_time` in descending order starting
372
503
  // from the most recently started operation.
373
504
  repeated google.longrunning.Operation operations = 1;
@@ -439,3 +570,40 @@ message CreateBackupEncryptionConfig {
439
570
  }
440
571
  ];
441
572
  }
573
+
574
+ // Encryption configuration for the copied backup.
575
+ message CopyBackupEncryptionConfig {
576
+ // Encryption types for the backup.
577
+ enum EncryptionType {
578
+ // Unspecified. Do not use.
579
+ ENCRYPTION_TYPE_UNSPECIFIED = 0;
580
+
581
+ // This is the default option for [CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup]
582
+ // when [encryption_config][google.spanner.admin.database.v1.CopyBackupEncryptionConfig] is not specified.
583
+ // For example, if the source backup is using `Customer_Managed_Encryption`,
584
+ // the backup will be using the same Cloud KMS key as the source backup.
585
+ USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION = 1;
586
+
587
+ // Use Google default encryption.
588
+ GOOGLE_DEFAULT_ENCRYPTION = 2;
589
+
590
+ // Use customer managed encryption. If specified, `kms_key_name`
591
+ // must contain a valid Cloud KMS key.
592
+ CUSTOMER_MANAGED_ENCRYPTION = 3;
593
+ }
594
+
595
+ // Required. The encryption type of the backup.
596
+ EncryptionType encryption_type = 1 [(google.api.field_behavior) = REQUIRED];
597
+
598
+ // Optional. The Cloud KMS key that will be used to protect the backup.
599
+ // This field should be set only when
600
+ // [encryption_type][google.spanner.admin.database.v1.CopyBackupEncryptionConfig.encryption_type] is
601
+ // `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form
602
+ // `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
603
+ string kms_key_name = 2 [
604
+ (google.api.field_behavior) = OPTIONAL,
605
+ (google.api.resource_reference) = {
606
+ type: "cloudkms.googleapis.com/CryptoKey"
607
+ }
608
+ ];
609
+ }
@@ -1,4 +1,4 @@
1
- // Copyright 2021 Google LLC
1
+ // Copyright 2022 Google LLC
2
2
  //
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@ import "google/api/field_behavior.proto";
20
20
  import "google/api/resource.proto";
21
21
  import "google/protobuf/timestamp.proto";
22
22
  import "google/rpc/status.proto";
23
- import "google/api/annotations.proto";
24
23
 
25
24
  option csharp_namespace = "Google.Cloud.Spanner.Admin.Database.V1";
26
25
  option go_package = "google.golang.org/genproto/googleapis/spanner/admin/database/v1;database";
@@ -98,3 +97,16 @@ message EncryptionInfo {
98
97
  }
99
98
  ];
100
99
  }
100
+
101
+ // Indicates the dialect type of a database.
102
+ enum DatabaseDialect {
103
+ // Default value. This value will create a database with the
104
+ // GOOGLE_STANDARD_SQL dialect.
105
+ DATABASE_DIALECT_UNSPECIFIED = 0;
106
+
107
+ // Google standard SQL.
108
+ GOOGLE_STANDARD_SQL = 1;
109
+
110
+ // PostgreSQL supported SQL.
111
+ POSTGRESQL = 2;
112
+ }
@@ -1,4 +1,4 @@
1
- // Copyright 2021 Google LLC
1
+ // Copyright 2022 Google LLC
2
2
  //
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
@@ -42,10 +42,11 @@ option (google.api.resource_definition) = {
42
42
 
43
43
  // Cloud Spanner Database Admin API
44
44
  //
45
- // The Cloud Spanner Database Admin API can be used to create, drop, and
46
- // list databases. It also enables updating the schema of pre-existing
47
- // databases. It can be also used to create, delete and list backups for a
48
- // database and to restore from an existing backup.
45
+ // The Cloud Spanner Database Admin API can be used to:
46
+ // * create, drop, and list databases
47
+ // * update the schema of pre-existing databases
48
+ // * create, delete and list backups for a database
49
+ // * restore a database from an existing backup
49
50
  service DatabaseAdmin {
50
51
  option (google.api.default_host) = "spanner.googleapis.com";
51
52
  option (google.api.oauth_scopes) =
@@ -110,6 +111,8 @@ service DatabaseAdmin {
110
111
  // Drops (aka deletes) a Cloud Spanner database.
111
112
  // Completed backups for the database will be retained according to their
112
113
  // `expire_time`.
114
+ // Note: Cloud Spanner might continue to accept requests for a few seconds
115
+ // after the database has been deleted.
113
116
  rpc DropDatabase(DropDatabaseRequest) returns (google.protobuf.Empty) {
114
117
  option (google.api.http) = {
115
118
  delete: "/v1/{database=projects/*/instances/*/databases/*}"
@@ -212,6 +215,30 @@ service DatabaseAdmin {
212
215
  };
213
216
  }
214
217
 
218
+ // Starts copying a Cloud Spanner Backup.
219
+ // The returned backup [long-running operation][google.longrunning.Operation]
220
+ // will have a name of the format
221
+ // `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
222
+ // and can be used to track copying of the backup. The operation is associated
223
+ // with the destination backup.
224
+ // The [metadata][google.longrunning.Operation.metadata] field type is
225
+ // [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata].
226
+ // The [response][google.longrunning.Operation.response] field type is
227
+ // [Backup][google.spanner.admin.database.v1.Backup], if successful. Cancelling the returned operation will stop the
228
+ // copying and delete the backup.
229
+ // Concurrent CopyBackup requests can run on the same source backup.
230
+ rpc CopyBackup(CopyBackupRequest) returns (google.longrunning.Operation) {
231
+ option (google.api.http) = {
232
+ post: "/v1/{parent=projects/*/instances/*}/backups:copy"
233
+ body: "*"
234
+ };
235
+ option (google.api.method_signature) = "parent,backup_id,source_backup,expire_time";
236
+ option (google.longrunning.operation_info) = {
237
+ response_type: "google.spanner.admin.database.v1.Backup"
238
+ metadata_type: "google.spanner.admin.database.v1.CopyBackupMetadata"
239
+ };
240
+ }
241
+
215
242
  // Gets metadata on a pending or completed [Backup][google.spanner.admin.database.v1.Backup].
216
243
  rpc GetBackup(GetBackupRequest) returns (Backup) {
217
244
  option (google.api.http) = {
@@ -407,6 +434,9 @@ message Database {
407
434
  // database option set using DatabaseAdmin.CreateDatabase or
408
435
  // DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty.
409
436
  string default_leader = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
437
+
438
+ // Output only. The dialect of the Cloud Spanner Database.
439
+ DatabaseDialect database_dialect = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
410
440
  }
411
441
 
412
442
  // The request for [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
@@ -469,6 +499,9 @@ message CreateDatabaseRequest {
469
499
  // specified, Cloud Spanner will encrypt/decrypt all data at rest using
470
500
  // Google default encryption.
471
501
  EncryptionConfig encryption_config = 4 [(google.api.field_behavior) = OPTIONAL];
502
+
503
+ // Optional. The dialect of the Cloud Spanner Database.
504
+ DatabaseDialect database_dialect = 5 [(google.api.field_behavior) = OPTIONAL];
472
505
  }
473
506
 
474
507
  // Metadata type for the operation returned by
@@ -635,6 +668,8 @@ message ListDatabaseOperationsRequest {
635
668
  // for [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata] is
636
669
  // `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
637
670
  // * `metadata.<field_name>` - any field in metadata.value.
671
+ // `metadata.@type` must be specified first, if filtering on metadata
672
+ // fields.
638
673
  // * `error` - Error associated with the long-running operation.
639
674
  // * `response.@type` - the type of response.
640
675
  // * `response.<field_name>` - any field in response.value.
@@ -350,19 +350,22 @@ message Instance {
350
350
  // after the instance is created. Values are of the form
351
351
  // `projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9]`. The final
352
352
  // segment of the name must be between 2 and 64 characters in length.
353
- string name = 1;
353
+ string name = 1 [(google.api.field_behavior) = REQUIRED];
354
354
 
355
355
  // Required. The name of the instance's configuration. Values are of the form
356
356
  // `projects/<project>/instanceConfigs/<configuration>`. See
357
357
  // also [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and
358
358
  // [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
359
- string config = 2 [(google.api.resource_reference) = {
360
- type: "spanner.googleapis.com/InstanceConfig"
361
- }];
359
+ string config = 2 [
360
+ (google.api.field_behavior) = REQUIRED,
361
+ (google.api.resource_reference) = {
362
+ type: "spanner.googleapis.com/InstanceConfig"
363
+ }
364
+ ];
362
365
 
363
366
  // Required. The descriptive name for this instance as it appears in UIs.
364
367
  // Must be unique per project and between 4 and 30 characters in length.
365
- string display_name = 3;
368
+ string display_name = 3 [(google.api.field_behavior) = REQUIRED];
366
369
 
367
370
  // Required. The number of nodes allocated to this instance. This may be zero
368
371
  // in API responses for instances that are not yet in state `READY`.
@@ -16,9 +16,7 @@ syntax = "proto3";
16
16
 
17
17
  package google.spanner.v1;
18
18
 
19
- import "google/protobuf/duration.proto";
20
19
  import "google/protobuf/timestamp.proto";
21
- import "google/api/annotations.proto";
22
20
 
23
21
  option csharp_namespace = "Google.Cloud.Spanner.V1";
24
22
  option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner";
@@ -36,9 +34,9 @@ message CommitResponse {
36
34
  // `mutation_count` value can help you maximize the number of mutations
37
35
  // in a transaction and minimize the number of API round trips. You can
38
36
  // also monitor this value to prevent transactions from exceeding the system
39
- // [limit](http://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data).
37
+ // [limit](https://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data).
40
38
  // If the number of mutations exceeds the limit, the server returns
41
- // [INVALID_ARGUMENT](http://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT).
39
+ // [INVALID_ARGUMENT](https://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT).
42
40
  int64 mutation_count = 1;
43
41
  }
44
42
 
@@ -17,7 +17,6 @@ syntax = "proto3";
17
17
  package google.spanner.v1;
18
18
 
19
19
  import "google/protobuf/struct.proto";
20
- import "google/api/annotations.proto";
21
20
 
22
21
  option csharp_namespace = "Google.Cloud.Spanner.V1";
23
22
  option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner";
@@ -1,4 +1,4 @@
1
- // Copyright 2020 Google LLC
1
+ // Copyright 2021 Google LLC
2
2
  //
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
@@ -16,9 +16,9 @@ syntax = "proto3";
16
16
 
17
17
  package google.spanner.v1;
18
18
 
19
+ import "google/api/field_behavior.proto";
19
20
  import "google/protobuf/struct.proto";
20
21
  import "google/spanner/v1/keys.proto";
21
- import "google/api/annotations.proto";
22
22
 
23
23
  option csharp_namespace = "Google.Cloud.Spanner.V1";
24
24
  option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner";
@@ -36,7 +36,7 @@ message Mutation {
36
36
  // [replace][google.spanner.v1.Mutation.replace] operations.
37
37
  message Write {
38
38
  // Required. The table whose rows will be written.
39
- string table = 1;
39
+ string table = 1 [(google.api.field_behavior) = REQUIRED];
40
40
 
41
41
  // The names of the columns in [table][google.spanner.v1.Mutation.Write.table] to be written.
42
42
  //
@@ -59,7 +59,7 @@ message Mutation {
59
59
  // Arguments to [delete][google.spanner.v1.Mutation.delete] operations.
60
60
  message Delete {
61
61
  // Required. The table whose rows will be deleted.
62
- string table = 1;
62
+ string table = 1 [(google.api.field_behavior) = REQUIRED];
63
63
 
64
64
  // Required. The primary keys of the rows within [table][google.spanner.v1.Mutation.Delete.table] to delete. The
65
65
  // primary keys must be specified in the order in which they appear in the
@@ -67,7 +67,7 @@ message Mutation {
67
67
  // statement used to create the table).
68
68
  // Delete is idempotent. The transaction will succeed even if some or all
69
69
  // rows do not exist.
70
- KeySet key_set = 2;
70
+ KeySet key_set = 2 [(google.api.field_behavior) = REQUIRED];
71
71
  }
72
72
 
73
73
  // Required. The operation to perform.