@google-cloud/spanner 7.18.0 → 7.19.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 (84) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +1 -0
  3. package/build/protos/google/spanner/admin/database/v1/backup.proto +773 -0
  4. package/build/protos/google/spanner/admin/database/v1/backup_schedule.proto +230 -0
  5. package/build/protos/google/spanner/admin/database/v1/common.proto +132 -0
  6. package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +1279 -0
  7. package/build/protos/google/spanner/admin/instance/v1/common.proto +64 -0
  8. package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +2110 -0
  9. package/build/protos/google/spanner/executor/v1/cloud_executor.proto +1520 -0
  10. package/build/protos/google/spanner/v1/commit_response.proto +59 -0
  11. package/build/protos/google/spanner/v1/keys.proto +163 -0
  12. package/build/protos/google/spanner/v1/mutation.proto +107 -0
  13. package/build/protos/google/spanner/v1/query_plan.proto +128 -0
  14. package/build/protos/google/spanner/v1/result_set.proto +237 -0
  15. package/build/protos/google/spanner/v1/spanner.proto +1389 -0
  16. package/build/protos/google/spanner/v1/transaction.proto +622 -0
  17. package/build/protos/google/spanner/v1/type.proto +214 -0
  18. package/build/protos/protos.d.ts +39869 -0
  19. package/build/protos/protos.js +101659 -0
  20. package/build/protos/protos.json +10391 -0
  21. package/build/src/backup.d.ts +349 -0
  22. package/build/src/backup.js +246 -0
  23. package/build/src/batch-transaction.d.ts +247 -0
  24. package/build/src/batch-transaction.js +384 -0
  25. package/build/src/codec.d.ts +362 -0
  26. package/build/src/codec.js +791 -0
  27. package/build/src/common-grpc/service-object.d.ts +80 -0
  28. package/build/src/common-grpc/service-object.js +101 -0
  29. package/build/src/common-grpc/service.d.ts +445 -0
  30. package/build/src/common-grpc/service.js +826 -0
  31. package/build/src/common.d.ts +66 -0
  32. package/build/src/common.js +54 -0
  33. package/build/src/database.d.ts +2103 -0
  34. package/build/src/database.js +1660 -0
  35. package/build/src/extra_proto_list.json +1 -0
  36. package/build/src/helper.d.ts +45 -0
  37. package/build/src/helper.js +71 -0
  38. package/build/src/index.d.ts +1195 -0
  39. package/build/src/index.js +1059 -0
  40. package/build/src/instance-config.d.ts +294 -0
  41. package/build/src/instance-config.js +216 -0
  42. package/build/src/instance.d.ts +832 -0
  43. package/build/src/instance.js +781 -0
  44. package/build/src/instrument.d.ts +85 -0
  45. package/build/src/instrument.js +215 -0
  46. package/build/src/multiplexed-session.d.ts +135 -0
  47. package/build/src/multiplexed-session.js +194 -0
  48. package/build/src/partial-result-stream.d.ts +253 -0
  49. package/build/src/partial-result-stream.js +400 -0
  50. package/build/src/request_id_header.d.ts +41 -0
  51. package/build/src/request_id_header.js +138 -0
  52. package/build/src/session-factory.d.ts +115 -0
  53. package/build/src/session-factory.js +106 -0
  54. package/build/src/session-pool.d.ts +471 -0
  55. package/build/src/session-pool.js +765 -0
  56. package/build/src/session.d.ts +258 -0
  57. package/build/src/session.js +348 -0
  58. package/build/src/spanner_grpc_config.json +92 -0
  59. package/build/src/table.d.ts +831 -0
  60. package/build/src/table.js +277 -0
  61. package/build/src/transaction-runner.d.ts +185 -0
  62. package/build/src/transaction-runner.js +282 -0
  63. package/build/src/transaction.d.ts +1691 -0
  64. package/build/src/transaction.js +2003 -0
  65. package/build/src/v1/database_admin_client.d.ts +2332 -0
  66. package/build/src/v1/database_admin_client.js +2364 -0
  67. package/build/src/v1/database_admin_client_config.json +165 -0
  68. package/build/src/v1/database_admin_proto_list.json +6 -0
  69. package/build/src/v1/gapic_metadata.json +27 -0
  70. package/build/src/v1/index.d.ts +4 -0
  71. package/build/src/v1/index.js +29 -0
  72. package/build/src/v1/instance_admin_client.d.ts +1985 -0
  73. package/build/src/v1/instance_admin_client.js +1768 -0
  74. package/build/src/v1/instance_admin_client_config.json +129 -0
  75. package/build/src/v1/instance_admin_proto_list.json +4 -0
  76. package/build/src/v1/spanner_client.d.ts +1250 -0
  77. package/build/src/v1/spanner_client.js +1086 -0
  78. package/build/src/v1/spanner_client_config.json +119 -0
  79. package/build/src/v1/spanner_executor_proxy_client.d.ts +418 -0
  80. package/build/src/v1/spanner_executor_proxy_client.js +706 -0
  81. package/build/src/v1/spanner_executor_proxy_client_config.json +30 -0
  82. package/build/src/v1/spanner_executor_proxy_proto_list.json +14 -0
  83. package/build/src/v1/spanner_proto_list.json +10 -0
  84. package/package.json +1 -1
@@ -0,0 +1,1279 @@
1
+ // Copyright 2024 Google LLC
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ syntax = "proto3";
16
+
17
+ package google.spanner.admin.database.v1;
18
+
19
+ import "google/api/annotations.proto";
20
+ import "google/api/client.proto";
21
+ import "google/api/field_behavior.proto";
22
+ import "google/api/resource.proto";
23
+ import "google/iam/v1/iam_policy.proto";
24
+ import "google/iam/v1/policy.proto";
25
+ import "google/longrunning/operations.proto";
26
+ import "google/protobuf/empty.proto";
27
+ import "google/protobuf/field_mask.proto";
28
+ import "google/protobuf/struct.proto";
29
+ import "google/protobuf/timestamp.proto";
30
+ import "google/spanner/admin/database/v1/backup.proto";
31
+ import "google/spanner/admin/database/v1/backup_schedule.proto";
32
+ import "google/spanner/admin/database/v1/common.proto";
33
+
34
+ option csharp_namespace = "Google.Cloud.Spanner.Admin.Database.V1";
35
+ option go_package = "cloud.google.com/go/spanner/admin/database/apiv1/databasepb;databasepb";
36
+ option java_multiple_files = true;
37
+ option java_outer_classname = "SpannerDatabaseAdminProto";
38
+ option java_package = "com.google.spanner.admin.database.v1";
39
+ option php_namespace = "Google\\Cloud\\Spanner\\Admin\\Database\\V1";
40
+ option ruby_package = "Google::Cloud::Spanner::Admin::Database::V1";
41
+ option (google.api.resource_definition) = {
42
+ type: "spanner.googleapis.com/Instance"
43
+ pattern: "projects/{project}/instances/{instance}"
44
+ };
45
+ option (google.api.resource_definition) = {
46
+ type: "spanner.googleapis.com/InstancePartition"
47
+ pattern: "projects/{project}/instances/{instance}/instancePartitions/{instance_partition}"
48
+ };
49
+
50
+ // Cloud Spanner Database Admin API
51
+ //
52
+ // The Cloud Spanner Database Admin API can be used to:
53
+ // * create, drop, and list databases
54
+ // * update the schema of pre-existing databases
55
+ // * create, delete, copy and list backups for a database
56
+ // * restore a database from an existing backup
57
+ service DatabaseAdmin {
58
+ option (google.api.default_host) = "spanner.googleapis.com";
59
+ option (google.api.oauth_scopes) =
60
+ "https://www.googleapis.com/auth/cloud-platform,"
61
+ "https://www.googleapis.com/auth/spanner.admin";
62
+
63
+ // Lists Cloud Spanner databases.
64
+ rpc ListDatabases(ListDatabasesRequest) returns (ListDatabasesResponse) {
65
+ option (google.api.http) = {
66
+ get: "/v1/{parent=projects/*/instances/*}/databases"
67
+ };
68
+ option (google.api.method_signature) = "parent";
69
+ }
70
+
71
+ // Creates a new Cloud Spanner database and starts to prepare it for serving.
72
+ // The returned [long-running operation][google.longrunning.Operation] will
73
+ // have a name of the format `<database_name>/operations/<operation_id>` and
74
+ // can be used to track preparation of the database. The
75
+ // [metadata][google.longrunning.Operation.metadata] field type is
76
+ // [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata].
77
+ // The [response][google.longrunning.Operation.response] field type is
78
+ // [Database][google.spanner.admin.database.v1.Database], if successful.
79
+ rpc CreateDatabase(CreateDatabaseRequest)
80
+ returns (google.longrunning.Operation) {
81
+ option (google.api.http) = {
82
+ post: "/v1/{parent=projects/*/instances/*}/databases"
83
+ body: "*"
84
+ };
85
+ option (google.api.method_signature) = "parent,create_statement";
86
+ option (google.longrunning.operation_info) = {
87
+ response_type: "google.spanner.admin.database.v1.Database"
88
+ metadata_type: "google.spanner.admin.database.v1.CreateDatabaseMetadata"
89
+ };
90
+ }
91
+
92
+ // Gets the state of a Cloud Spanner database.
93
+ rpc GetDatabase(GetDatabaseRequest) returns (Database) {
94
+ option (google.api.http) = {
95
+ get: "/v1/{name=projects/*/instances/*/databases/*}"
96
+ };
97
+ option (google.api.method_signature) = "name";
98
+ }
99
+
100
+ // Updates a Cloud Spanner database. The returned
101
+ // [long-running operation][google.longrunning.Operation] can be used to track
102
+ // the progress of updating the database. If the named database does not
103
+ // exist, returns `NOT_FOUND`.
104
+ //
105
+ // While the operation is pending:
106
+ //
107
+ // * The database's
108
+ // [reconciling][google.spanner.admin.database.v1.Database.reconciling]
109
+ // field is set to true.
110
+ // * Cancelling the operation is best-effort. If the cancellation succeeds,
111
+ // the operation metadata's
112
+ // [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time]
113
+ // is set, the updates are reverted, and the operation terminates with a
114
+ // `CANCELLED` status.
115
+ // * New UpdateDatabase requests will return a `FAILED_PRECONDITION` error
116
+ // until the pending operation is done (returns successfully or with
117
+ // error).
118
+ // * Reading the database via the API continues to give the pre-request
119
+ // values.
120
+ //
121
+ // Upon completion of the returned operation:
122
+ //
123
+ // * The new values are in effect and readable via the API.
124
+ // * The database's
125
+ // [reconciling][google.spanner.admin.database.v1.Database.reconciling]
126
+ // field becomes false.
127
+ //
128
+ // The returned [long-running operation][google.longrunning.Operation] will
129
+ // have a name of the format
130
+ // `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`
131
+ // and can be used to track the database modification. The
132
+ // [metadata][google.longrunning.Operation.metadata] field type is
133
+ // [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata].
134
+ // The [response][google.longrunning.Operation.response] field type is
135
+ // [Database][google.spanner.admin.database.v1.Database], if successful.
136
+ rpc UpdateDatabase(UpdateDatabaseRequest)
137
+ returns (google.longrunning.Operation) {
138
+ option (google.api.http) = {
139
+ patch: "/v1/{database.name=projects/*/instances/*/databases/*}"
140
+ body: "database"
141
+ };
142
+ option (google.api.method_signature) = "database,update_mask";
143
+ option (google.longrunning.operation_info) = {
144
+ response_type: "Database"
145
+ metadata_type: "UpdateDatabaseMetadata"
146
+ };
147
+ }
148
+
149
+ // Updates the schema of a Cloud Spanner database by
150
+ // creating/altering/dropping tables, columns, indexes, etc. The returned
151
+ // [long-running operation][google.longrunning.Operation] will have a name of
152
+ // the format `<database_name>/operations/<operation_id>` and can be used to
153
+ // track execution of the schema change(s). The
154
+ // [metadata][google.longrunning.Operation.metadata] field type is
155
+ // [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata].
156
+ // The operation has no response.
157
+ rpc UpdateDatabaseDdl(UpdateDatabaseDdlRequest)
158
+ returns (google.longrunning.Operation) {
159
+ option (google.api.http) = {
160
+ patch: "/v1/{database=projects/*/instances/*/databases/*}/ddl"
161
+ body: "*"
162
+ };
163
+ option (google.api.method_signature) = "database,statements";
164
+ option (google.longrunning.operation_info) = {
165
+ response_type: "google.protobuf.Empty"
166
+ metadata_type: "google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata"
167
+ };
168
+ }
169
+
170
+ // Drops (aka deletes) a Cloud Spanner database.
171
+ // Completed backups for the database will be retained according to their
172
+ // `expire_time`.
173
+ // Note: Cloud Spanner might continue to accept requests for a few seconds
174
+ // after the database has been deleted.
175
+ rpc DropDatabase(DropDatabaseRequest) returns (google.protobuf.Empty) {
176
+ option (google.api.http) = {
177
+ delete: "/v1/{database=projects/*/instances/*/databases/*}"
178
+ };
179
+ option (google.api.method_signature) = "database";
180
+ }
181
+
182
+ // Returns the schema of a Cloud Spanner database as a list of formatted
183
+ // DDL statements. This method does not show pending schema updates, those may
184
+ // be queried using the [Operations][google.longrunning.Operations] API.
185
+ rpc GetDatabaseDdl(GetDatabaseDdlRequest) returns (GetDatabaseDdlResponse) {
186
+ option (google.api.http) = {
187
+ get: "/v1/{database=projects/*/instances/*/databases/*}/ddl"
188
+ };
189
+ option (google.api.method_signature) = "database";
190
+ }
191
+
192
+ // Sets the access control policy on a database or backup resource.
193
+ // Replaces any existing policy.
194
+ //
195
+ // Authorization requires `spanner.databases.setIamPolicy`
196
+ // permission on [resource][google.iam.v1.SetIamPolicyRequest.resource].
197
+ // For backups, authorization requires `spanner.backups.setIamPolicy`
198
+ // permission on [resource][google.iam.v1.SetIamPolicyRequest.resource].
199
+ rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest)
200
+ returns (google.iam.v1.Policy) {
201
+ option (google.api.http) = {
202
+ post: "/v1/{resource=projects/*/instances/*/databases/*}:setIamPolicy"
203
+ body: "*"
204
+ additional_bindings {
205
+ post: "/v1/{resource=projects/*/instances/*/backups/*}:setIamPolicy"
206
+ body: "*"
207
+ }
208
+ additional_bindings {
209
+ post: "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:setIamPolicy"
210
+ body: "*"
211
+ }
212
+ };
213
+ option (google.api.method_signature) = "resource,policy";
214
+ }
215
+
216
+ // Gets the access control policy for a database or backup resource.
217
+ // Returns an empty policy if a database or backup exists but does not have a
218
+ // policy set.
219
+ //
220
+ // Authorization requires `spanner.databases.getIamPolicy` permission on
221
+ // [resource][google.iam.v1.GetIamPolicyRequest.resource].
222
+ // For backups, authorization requires `spanner.backups.getIamPolicy`
223
+ // permission on [resource][google.iam.v1.GetIamPolicyRequest.resource].
224
+ rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest)
225
+ returns (google.iam.v1.Policy) {
226
+ option (google.api.http) = {
227
+ post: "/v1/{resource=projects/*/instances/*/databases/*}:getIamPolicy"
228
+ body: "*"
229
+ additional_bindings {
230
+ post: "/v1/{resource=projects/*/instances/*/backups/*}:getIamPolicy"
231
+ body: "*"
232
+ }
233
+ additional_bindings {
234
+ post: "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:getIamPolicy"
235
+ body: "*"
236
+ }
237
+ };
238
+ option (google.api.method_signature) = "resource";
239
+ }
240
+
241
+ // Returns permissions that the caller has on the specified database or backup
242
+ // resource.
243
+ //
244
+ // Attempting this RPC on a non-existent Cloud Spanner database will
245
+ // result in a NOT_FOUND error if the user has
246
+ // `spanner.databases.list` permission on the containing Cloud
247
+ // Spanner instance. Otherwise returns an empty set of permissions.
248
+ // Calling this method on a backup that does not exist will
249
+ // result in a NOT_FOUND error if the user has
250
+ // `spanner.backups.list` permission on the containing instance.
251
+ rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest)
252
+ returns (google.iam.v1.TestIamPermissionsResponse) {
253
+ option (google.api.http) = {
254
+ post: "/v1/{resource=projects/*/instances/*/databases/*}:testIamPermissions"
255
+ body: "*"
256
+ additional_bindings {
257
+ post: "/v1/{resource=projects/*/instances/*/backups/*}:testIamPermissions"
258
+ body: "*"
259
+ }
260
+ additional_bindings {
261
+ post: "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:testIamPermissions"
262
+ body: "*"
263
+ }
264
+ additional_bindings {
265
+ post: "/v1/{resource=projects/*/instances/*/databases/*/databaseRoles/*}:testIamPermissions"
266
+ body: "*"
267
+ }
268
+ };
269
+ option (google.api.method_signature) = "resource,permissions";
270
+ }
271
+
272
+ // Starts creating a new Cloud Spanner Backup.
273
+ // The returned backup [long-running operation][google.longrunning.Operation]
274
+ // will have a name of the format
275
+ // `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
276
+ // and can be used to track creation of the backup. The
277
+ // [metadata][google.longrunning.Operation.metadata] field type is
278
+ // [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata].
279
+ // The [response][google.longrunning.Operation.response] field type is
280
+ // [Backup][google.spanner.admin.database.v1.Backup], if successful.
281
+ // Cancelling the returned operation will stop the creation and delete the
282
+ // backup. There can be only one pending backup creation per database. Backup
283
+ // creation of different databases can run concurrently.
284
+ rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) {
285
+ option (google.api.http) = {
286
+ post: "/v1/{parent=projects/*/instances/*}/backups"
287
+ body: "backup"
288
+ };
289
+ option (google.api.method_signature) = "parent,backup,backup_id";
290
+ option (google.longrunning.operation_info) = {
291
+ response_type: "google.spanner.admin.database.v1.Backup"
292
+ metadata_type: "google.spanner.admin.database.v1.CreateBackupMetadata"
293
+ };
294
+ }
295
+
296
+ // Starts copying a Cloud Spanner Backup.
297
+ // The returned backup [long-running operation][google.longrunning.Operation]
298
+ // will have a name of the format
299
+ // `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
300
+ // and can be used to track copying of the backup. The operation is associated
301
+ // with the destination backup.
302
+ // The [metadata][google.longrunning.Operation.metadata] field type is
303
+ // [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata].
304
+ // The [response][google.longrunning.Operation.response] field type is
305
+ // [Backup][google.spanner.admin.database.v1.Backup], if successful.
306
+ // Cancelling the returned operation will stop the copying and delete the
307
+ // destination backup. Concurrent CopyBackup requests can run on the same
308
+ // source backup.
309
+ rpc CopyBackup(CopyBackupRequest) returns (google.longrunning.Operation) {
310
+ option (google.api.http) = {
311
+ post: "/v1/{parent=projects/*/instances/*}/backups:copy"
312
+ body: "*"
313
+ };
314
+ option (google.api.method_signature) =
315
+ "parent,backup_id,source_backup,expire_time";
316
+ option (google.longrunning.operation_info) = {
317
+ response_type: "google.spanner.admin.database.v1.Backup"
318
+ metadata_type: "google.spanner.admin.database.v1.CopyBackupMetadata"
319
+ };
320
+ }
321
+
322
+ // Gets metadata on a pending or completed
323
+ // [Backup][google.spanner.admin.database.v1.Backup].
324
+ rpc GetBackup(GetBackupRequest) returns (Backup) {
325
+ option (google.api.http) = {
326
+ get: "/v1/{name=projects/*/instances/*/backups/*}"
327
+ };
328
+ option (google.api.method_signature) = "name";
329
+ }
330
+
331
+ // Updates a pending or completed
332
+ // [Backup][google.spanner.admin.database.v1.Backup].
333
+ rpc UpdateBackup(UpdateBackupRequest) returns (Backup) {
334
+ option (google.api.http) = {
335
+ patch: "/v1/{backup.name=projects/*/instances/*/backups/*}"
336
+ body: "backup"
337
+ };
338
+ option (google.api.method_signature) = "backup,update_mask";
339
+ }
340
+
341
+ // Deletes a pending or completed
342
+ // [Backup][google.spanner.admin.database.v1.Backup].
343
+ rpc DeleteBackup(DeleteBackupRequest) returns (google.protobuf.Empty) {
344
+ option (google.api.http) = {
345
+ delete: "/v1/{name=projects/*/instances/*/backups/*}"
346
+ };
347
+ option (google.api.method_signature) = "name";
348
+ }
349
+
350
+ // Lists completed and pending backups.
351
+ // Backups returned are ordered by `create_time` in descending order,
352
+ // starting from the most recent `create_time`.
353
+ rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) {
354
+ option (google.api.http) = {
355
+ get: "/v1/{parent=projects/*/instances/*}/backups"
356
+ };
357
+ option (google.api.method_signature) = "parent";
358
+ }
359
+
360
+ // Create a new database by restoring from a completed backup. The new
361
+ // database must be in the same project and in an instance with the same
362
+ // instance configuration as the instance containing
363
+ // the backup. The returned database [long-running
364
+ // operation][google.longrunning.Operation] has a name of the format
365
+ // `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`,
366
+ // and can be used to track the progress of the operation, and to cancel it.
367
+ // The [metadata][google.longrunning.Operation.metadata] field type is
368
+ // [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata].
369
+ // The [response][google.longrunning.Operation.response] type
370
+ // is [Database][google.spanner.admin.database.v1.Database], if
371
+ // successful. Cancelling the returned operation will stop the restore and
372
+ // delete the database.
373
+ // There can be only one database being restored into an instance at a time.
374
+ // Once the restore operation completes, a new restore operation can be
375
+ // initiated, without waiting for the optimize operation associated with the
376
+ // first restore to complete.
377
+ rpc RestoreDatabase(RestoreDatabaseRequest)
378
+ returns (google.longrunning.Operation) {
379
+ option (google.api.http) = {
380
+ post: "/v1/{parent=projects/*/instances/*}/databases:restore"
381
+ body: "*"
382
+ };
383
+ option (google.api.method_signature) = "parent,database_id,backup";
384
+ option (google.longrunning.operation_info) = {
385
+ response_type: "google.spanner.admin.database.v1.Database"
386
+ metadata_type: "google.spanner.admin.database.v1.RestoreDatabaseMetadata"
387
+ };
388
+ }
389
+
390
+ // Lists database [longrunning-operations][google.longrunning.Operation].
391
+ // A database operation has a name of the form
392
+ // `projects/<project>/instances/<instance>/databases/<database>/operations/<operation>`.
393
+ // The long-running operation
394
+ // [metadata][google.longrunning.Operation.metadata] field type
395
+ // `metadata.type_url` describes the type of the metadata. Operations returned
396
+ // include those that have completed/failed/canceled within the last 7 days,
397
+ // and pending operations.
398
+ rpc ListDatabaseOperations(ListDatabaseOperationsRequest)
399
+ returns (ListDatabaseOperationsResponse) {
400
+ option (google.api.http) = {
401
+ get: "/v1/{parent=projects/*/instances/*}/databaseOperations"
402
+ };
403
+ option (google.api.method_signature) = "parent";
404
+ }
405
+
406
+ // Lists the backup [long-running operations][google.longrunning.Operation] in
407
+ // the given instance. A backup operation has a name of the form
408
+ // `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation>`.
409
+ // The long-running operation
410
+ // [metadata][google.longrunning.Operation.metadata] field type
411
+ // `metadata.type_url` describes the type of the metadata. Operations returned
412
+ // include those that have completed/failed/canceled within the last 7 days,
413
+ // and pending operations. Operations returned are ordered by
414
+ // `operation.metadata.value.progress.start_time` in descending order starting
415
+ // from the most recently started operation.
416
+ rpc ListBackupOperations(ListBackupOperationsRequest)
417
+ returns (ListBackupOperationsResponse) {
418
+ option (google.api.http) = {
419
+ get: "/v1/{parent=projects/*/instances/*}/backupOperations"
420
+ };
421
+ option (google.api.method_signature) = "parent";
422
+ }
423
+
424
+ // Lists Cloud Spanner database roles.
425
+ rpc ListDatabaseRoles(ListDatabaseRolesRequest)
426
+ returns (ListDatabaseRolesResponse) {
427
+ option (google.api.http) = {
428
+ get: "/v1/{parent=projects/*/instances/*/databases/*}/databaseRoles"
429
+ };
430
+ option (google.api.method_signature) = "parent";
431
+ }
432
+
433
+ // Adds split points to specified tables, indexes of a database.
434
+ rpc AddSplitPoints(AddSplitPointsRequest) returns (AddSplitPointsResponse) {
435
+ option (google.api.http) = {
436
+ post: "/v1/{database=projects/*/instances/*/databases/*}:addSplitPoints"
437
+ body: "*"
438
+ };
439
+ option (google.api.method_signature) = "database,split_points";
440
+ }
441
+
442
+ // Creates a new backup schedule.
443
+ rpc CreateBackupSchedule(CreateBackupScheduleRequest)
444
+ returns (BackupSchedule) {
445
+ option (google.api.http) = {
446
+ post: "/v1/{parent=projects/*/instances/*/databases/*}/backupSchedules"
447
+ body: "backup_schedule"
448
+ };
449
+ option (google.api.method_signature) =
450
+ "parent,backup_schedule,backup_schedule_id";
451
+ }
452
+
453
+ // Gets backup schedule for the input schedule name.
454
+ rpc GetBackupSchedule(GetBackupScheduleRequest) returns (BackupSchedule) {
455
+ option (google.api.http) = {
456
+ get: "/v1/{name=projects/*/instances/*/databases/*/backupSchedules/*}"
457
+ };
458
+ option (google.api.method_signature) = "name";
459
+ }
460
+
461
+ // Updates a backup schedule.
462
+ rpc UpdateBackupSchedule(UpdateBackupScheduleRequest)
463
+ returns (BackupSchedule) {
464
+ option (google.api.http) = {
465
+ patch: "/v1/{backup_schedule.name=projects/*/instances/*/databases/*/backupSchedules/*}"
466
+ body: "backup_schedule"
467
+ };
468
+ option (google.api.method_signature) = "backup_schedule,update_mask";
469
+ }
470
+
471
+ // Deletes a backup schedule.
472
+ rpc DeleteBackupSchedule(DeleteBackupScheduleRequest)
473
+ returns (google.protobuf.Empty) {
474
+ option (google.api.http) = {
475
+ delete: "/v1/{name=projects/*/instances/*/databases/*/backupSchedules/*}"
476
+ };
477
+ option (google.api.method_signature) = "name";
478
+ }
479
+
480
+ // Lists all the backup schedules for the database.
481
+ rpc ListBackupSchedules(ListBackupSchedulesRequest)
482
+ returns (ListBackupSchedulesResponse) {
483
+ option (google.api.http) = {
484
+ get: "/v1/{parent=projects/*/instances/*/databases/*}/backupSchedules"
485
+ };
486
+ option (google.api.method_signature) = "parent";
487
+ }
488
+ }
489
+
490
+ // Information about the database restore.
491
+ message RestoreInfo {
492
+ // The type of the restore source.
493
+ RestoreSourceType source_type = 1;
494
+
495
+ // Information about the source used to restore the database.
496
+ oneof source_info {
497
+ // Information about the backup used to restore the database. The backup
498
+ // may no longer exist.
499
+ BackupInfo backup_info = 2;
500
+ }
501
+ }
502
+
503
+ // A Cloud Spanner database.
504
+ message Database {
505
+ option (google.api.resource) = {
506
+ type: "spanner.googleapis.com/Database"
507
+ pattern: "projects/{project}/instances/{instance}/databases/{database}"
508
+ };
509
+
510
+ // Indicates the current state of the database.
511
+ enum State {
512
+ // Not specified.
513
+ STATE_UNSPECIFIED = 0;
514
+
515
+ // The database is still being created. Operations on the database may fail
516
+ // with `FAILED_PRECONDITION` in this state.
517
+ CREATING = 1;
518
+
519
+ // The database is fully created and ready for use.
520
+ READY = 2;
521
+
522
+ // The database is fully created and ready for use, but is still
523
+ // being optimized for performance and cannot handle full load.
524
+ //
525
+ // In this state, the database still references the backup
526
+ // it was restore from, preventing the backup
527
+ // from being deleted. When optimizations are complete, the full performance
528
+ // of the database will be restored, and the database will transition to
529
+ // `READY` state.
530
+ READY_OPTIMIZING = 3;
531
+ }
532
+
533
+ // Required. The name of the database. Values are of the form
534
+ // `projects/<project>/instances/<instance>/databases/<database>`,
535
+ // where `<database>` is as specified in the `CREATE DATABASE`
536
+ // statement. This name can be passed to other API methods to
537
+ // identify the database.
538
+ string name = 1 [(google.api.field_behavior) = REQUIRED];
539
+
540
+ // Output only. The current database state.
541
+ State state = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
542
+
543
+ // Output only. If exists, the time at which the database creation started.
544
+ google.protobuf.Timestamp create_time = 3
545
+ [(google.api.field_behavior) = OUTPUT_ONLY];
546
+
547
+ // Output only. Applicable only for restored databases. Contains information
548
+ // about the restore source.
549
+ RestoreInfo restore_info = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
550
+
551
+ // Output only. For databases that are using customer managed encryption, this
552
+ // field contains the encryption configuration for the database.
553
+ // For databases that are using Google default or other types of encryption,
554
+ // this field is empty.
555
+ EncryptionConfig encryption_config = 5
556
+ [(google.api.field_behavior) = OUTPUT_ONLY];
557
+
558
+ // Output only. For databases that are using customer managed encryption, this
559
+ // field contains the encryption information for the database, such as
560
+ // all Cloud KMS key versions that are in use. The `encryption_status' field
561
+ // inside of each `EncryptionInfo` is not populated.
562
+ //
563
+ // For databases that are using Google default or other types of encryption,
564
+ // this field is empty.
565
+ //
566
+ // This field is propagated lazily from the backend. There might be a delay
567
+ // from when a key version is being used and when it appears in this field.
568
+ repeated EncryptionInfo encryption_info = 8
569
+ [(google.api.field_behavior) = OUTPUT_ONLY];
570
+
571
+ // Output only. The period in which Cloud Spanner retains all versions of data
572
+ // for the database. This is the same as the value of version_retention_period
573
+ // database option set using
574
+ // [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl].
575
+ // Defaults to 1 hour, if not set.
576
+ string version_retention_period = 6
577
+ [(google.api.field_behavior) = OUTPUT_ONLY];
578
+
579
+ // Output only. Earliest timestamp at which older versions of the data can be
580
+ // read. This value is continuously updated by Cloud Spanner and becomes stale
581
+ // the moment it is queried. If you are using this value to recover data, make
582
+ // sure to account for the time from the moment when the value is queried to
583
+ // the moment when you initiate the recovery.
584
+ google.protobuf.Timestamp earliest_version_time = 7
585
+ [(google.api.field_behavior) = OUTPUT_ONLY];
586
+
587
+ // Output only. The read-write region which contains the database's leader
588
+ // replicas.
589
+ //
590
+ // This is the same as the value of default_leader
591
+ // database option set using DatabaseAdmin.CreateDatabase or
592
+ // DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty.
593
+ string default_leader = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
594
+
595
+ // Output only. The dialect of the Cloud Spanner Database.
596
+ DatabaseDialect database_dialect = 10
597
+ [(google.api.field_behavior) = OUTPUT_ONLY];
598
+
599
+ // Whether drop protection is enabled for this database. Defaults to false,
600
+ // if not set. For more details, please see how to [prevent accidental
601
+ // database
602
+ // deletion](https://cloud.google.com/spanner/docs/prevent-database-deletion).
603
+ bool enable_drop_protection = 11;
604
+
605
+ // Output only. If true, the database is being updated. If false, there are no
606
+ // ongoing update operations for the database.
607
+ bool reconciling = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
608
+ }
609
+
610
+ // The request for
611
+ // [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
612
+ message ListDatabasesRequest {
613
+ // Required. The instance whose databases should be listed.
614
+ // Values are of the form `projects/<project>/instances/<instance>`.
615
+ string parent = 1 [
616
+ (google.api.field_behavior) = REQUIRED,
617
+ (google.api.resource_reference) = {
618
+ type: "spanner.googleapis.com/Instance"
619
+ }
620
+ ];
621
+
622
+ // Number of databases to be returned in the response. If 0 or less,
623
+ // defaults to the server's maximum allowed page size.
624
+ int32 page_size = 3;
625
+
626
+ // If non-empty, `page_token` should contain a
627
+ // [next_page_token][google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token]
628
+ // from a previous
629
+ // [ListDatabasesResponse][google.spanner.admin.database.v1.ListDatabasesResponse].
630
+ string page_token = 4;
631
+ }
632
+
633
+ // The response for
634
+ // [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].
635
+ message ListDatabasesResponse {
636
+ // Databases that matched the request.
637
+ repeated Database databases = 1;
638
+
639
+ // `next_page_token` can be sent in a subsequent
640
+ // [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases]
641
+ // call to fetch more of the matching databases.
642
+ string next_page_token = 2;
643
+ }
644
+
645
+ // The request for
646
+ // [CreateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase].
647
+ message CreateDatabaseRequest {
648
+ // Required. The name of the instance that will serve the new database.
649
+ // Values are of the form `projects/<project>/instances/<instance>`.
650
+ string parent = 1 [
651
+ (google.api.field_behavior) = REQUIRED,
652
+ (google.api.resource_reference) = {
653
+ type: "spanner.googleapis.com/Instance"
654
+ }
655
+ ];
656
+
657
+ // Required. A `CREATE DATABASE` statement, which specifies the ID of the
658
+ // new database. The database ID must conform to the regular expression
659
+ // `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length.
660
+ // If the database ID is a reserved word or if it contains a hyphen, the
661
+ // database ID must be enclosed in backticks (`` ` ``).
662
+ string create_statement = 2 [(google.api.field_behavior) = REQUIRED];
663
+
664
+ // Optional. A list of DDL statements to run inside the newly created
665
+ // database. Statements can create tables, indexes, etc. These
666
+ // statements execute atomically with the creation of the database:
667
+ // if there is an error in any statement, the database is not created.
668
+ repeated string extra_statements = 3 [(google.api.field_behavior) = OPTIONAL];
669
+
670
+ // Optional. The encryption configuration for the database. If this field is
671
+ // not specified, Cloud Spanner will encrypt/decrypt all data at rest using
672
+ // Google default encryption.
673
+ EncryptionConfig encryption_config = 4
674
+ [(google.api.field_behavior) = OPTIONAL];
675
+
676
+ // Optional. The dialect of the Cloud Spanner Database.
677
+ DatabaseDialect database_dialect = 5 [(google.api.field_behavior) = OPTIONAL];
678
+
679
+ // Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements in
680
+ // 'extra_statements' above.
681
+ // Contains a protobuf-serialized
682
+ // [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto).
683
+ // To generate it, [install](https://grpc.io/docs/protoc-installation/) and
684
+ // run `protoc` with --include_imports and --descriptor_set_out. For example,
685
+ // to generate for moon/shot/app.proto, run
686
+ // ```
687
+ // $protoc --proto_path=/app_path --proto_path=/lib_path \
688
+ // --include_imports \
689
+ // --descriptor_set_out=descriptors.data \
690
+ // moon/shot/app.proto
691
+ // ```
692
+ // For more details, see protobuffer [self
693
+ // description](https://developers.google.com/protocol-buffers/docs/techniques#self-description).
694
+ bytes proto_descriptors = 6 [(google.api.field_behavior) = OPTIONAL];
695
+ }
696
+
697
+ // Metadata type for the operation returned by
698
+ // [CreateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase].
699
+ message CreateDatabaseMetadata {
700
+ // The database being created.
701
+ string database = 1 [(google.api.resource_reference) = {
702
+ type: "spanner.googleapis.com/Database"
703
+ }];
704
+ }
705
+
706
+ // The request for
707
+ // [GetDatabase][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabase].
708
+ message GetDatabaseRequest {
709
+ // Required. The name of the requested database. Values are of the form
710
+ // `projects/<project>/instances/<instance>/databases/<database>`.
711
+ string name = 1 [
712
+ (google.api.field_behavior) = REQUIRED,
713
+ (google.api.resource_reference) = {
714
+ type: "spanner.googleapis.com/Database"
715
+ }
716
+ ];
717
+ }
718
+
719
+ // The request for
720
+ // [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase].
721
+ message UpdateDatabaseRequest {
722
+ // Required. The database to update.
723
+ // The `name` field of the database is of the form
724
+ // `projects/<project>/instances/<instance>/databases/<database>`.
725
+ Database database = 1 [(google.api.field_behavior) = REQUIRED];
726
+
727
+ // Required. The list of fields to update. Currently, only
728
+ // `enable_drop_protection` field can be updated.
729
+ google.protobuf.FieldMask update_mask = 2
730
+ [(google.api.field_behavior) = REQUIRED];
731
+ }
732
+
733
+ // Metadata type for the operation returned by
734
+ // [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase].
735
+ message UpdateDatabaseMetadata {
736
+ // The request for
737
+ // [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase].
738
+ UpdateDatabaseRequest request = 1;
739
+
740
+ // The progress of the
741
+ // [UpdateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase]
742
+ // operation.
743
+ OperationProgress progress = 2;
744
+
745
+ // The time at which this operation was cancelled. If set, this operation is
746
+ // in the process of undoing itself (which is best-effort).
747
+ google.protobuf.Timestamp cancel_time = 3;
748
+ }
749
+
750
+ // Enqueues the given DDL statements to be applied, in order but not
751
+ // necessarily all at once, to the database schema at some point (or
752
+ // points) in the future. The server checks that the statements
753
+ // are executable (syntactically valid, name tables that exist, etc.)
754
+ // before enqueueing them, but they may still fail upon
755
+ // later execution (e.g., if a statement from another batch of
756
+ // statements is applied first and it conflicts in some way, or if
757
+ // there is some data-related problem like a `NULL` value in a column to
758
+ // which `NOT NULL` would be added). If a statement fails, all
759
+ // subsequent statements in the batch are automatically cancelled.
760
+ //
761
+ // Each batch of statements is assigned a name which can be used with
762
+ // the [Operations][google.longrunning.Operations] API to monitor
763
+ // progress. See the
764
+ // [operation_id][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.operation_id]
765
+ // field for more details.
766
+ message UpdateDatabaseDdlRequest {
767
+ // Required. The database to update.
768
+ string database = 1 [
769
+ (google.api.field_behavior) = REQUIRED,
770
+ (google.api.resource_reference) = {
771
+ type: "spanner.googleapis.com/Database"
772
+ }
773
+ ];
774
+
775
+ // Required. DDL statements to be applied to the database.
776
+ repeated string statements = 2 [(google.api.field_behavior) = REQUIRED];
777
+
778
+ // If empty, the new update request is assigned an
779
+ // automatically-generated operation ID. Otherwise, `operation_id`
780
+ // is used to construct the name of the resulting
781
+ // [Operation][google.longrunning.Operation].
782
+ //
783
+ // Specifying an explicit operation ID simplifies determining
784
+ // whether the statements were executed in the event that the
785
+ // [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]
786
+ // call is replayed, or the return value is otherwise lost: the
787
+ // [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database]
788
+ // and `operation_id` fields can be combined to form the
789
+ // [name][google.longrunning.Operation.name] of the resulting
790
+ // [longrunning.Operation][google.longrunning.Operation]:
791
+ // `<database>/operations/<operation_id>`.
792
+ //
793
+ // `operation_id` should be unique within the database, and must be
794
+ // a valid identifier: `[a-z][a-z0-9_]*`. Note that
795
+ // automatically-generated operation IDs always begin with an
796
+ // underscore. If the named operation already exists,
797
+ // [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]
798
+ // returns `ALREADY_EXISTS`.
799
+ string operation_id = 3;
800
+
801
+ // Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements.
802
+ // Contains a protobuf-serialized
803
+ // [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto).
804
+ // To generate it, [install](https://grpc.io/docs/protoc-installation/) and
805
+ // run `protoc` with --include_imports and --descriptor_set_out. For example,
806
+ // to generate for moon/shot/app.proto, run
807
+ // ```
808
+ // $protoc --proto_path=/app_path --proto_path=/lib_path \
809
+ // --include_imports \
810
+ // --descriptor_set_out=descriptors.data \
811
+ // moon/shot/app.proto
812
+ // ```
813
+ // For more details, see protobuffer [self
814
+ // description](https://developers.google.com/protocol-buffers/docs/techniques#self-description).
815
+ bytes proto_descriptors = 4 [(google.api.field_behavior) = OPTIONAL];
816
+ }
817
+
818
+ // Action information extracted from a DDL statement. This proto is used to
819
+ // display the brief info of the DDL statement for the operation
820
+ // [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl].
821
+ message DdlStatementActionInfo {
822
+ // The action for the DDL statement, e.g. CREATE, ALTER, DROP, GRANT, etc.
823
+ // This field is a non-empty string.
824
+ string action = 1;
825
+
826
+ // The entity type for the DDL statement, e.g. TABLE, INDEX, VIEW, etc.
827
+ // This field can be empty string for some DDL statement,
828
+ // e.g. for statement "ANALYZE", `entity_type` = "".
829
+ string entity_type = 2;
830
+
831
+ // The entity name(s) being operated on the DDL statement.
832
+ // E.g.
833
+ // 1. For statement "CREATE TABLE t1(...)", `entity_names` = ["t1"].
834
+ // 2. For statement "GRANT ROLE r1, r2 ...", `entity_names` = ["r1", "r2"].
835
+ // 3. For statement "ANALYZE", `entity_names` = [].
836
+ repeated string entity_names = 3;
837
+ }
838
+
839
+ // Metadata type for the operation returned by
840
+ // [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl].
841
+ message UpdateDatabaseDdlMetadata {
842
+ // The database being modified.
843
+ string database = 1 [(google.api.resource_reference) = {
844
+ type: "spanner.googleapis.com/Database"
845
+ }];
846
+
847
+ // For an update this list contains all the statements. For an
848
+ // individual statement, this list contains only that statement.
849
+ repeated string statements = 2;
850
+
851
+ // Reports the commit timestamps of all statements that have
852
+ // succeeded so far, where `commit_timestamps[i]` is the commit
853
+ // timestamp for the statement `statements[i]`.
854
+ repeated google.protobuf.Timestamp commit_timestamps = 3;
855
+
856
+ // Output only. When true, indicates that the operation is throttled e.g.
857
+ // due to resource constraints. When resources become available the operation
858
+ // will resume and this field will be false again.
859
+ bool throttled = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
860
+
861
+ // The progress of the
862
+ // [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]
863
+ // operations. All DDL statements will have continuously updating progress,
864
+ // and `progress[i]` is the operation progress for `statements[i]`. Also,
865
+ // `progress[i]` will have start time and end time populated with commit
866
+ // timestamp of operation, as well as a progress of 100% once the operation
867
+ // has completed.
868
+ repeated OperationProgress progress = 5;
869
+
870
+ // The brief action info for the DDL statements.
871
+ // `actions[i]` is the brief info for `statements[i]`.
872
+ repeated DdlStatementActionInfo actions = 6;
873
+ }
874
+
875
+ // The request for
876
+ // [DropDatabase][google.spanner.admin.database.v1.DatabaseAdmin.DropDatabase].
877
+ message DropDatabaseRequest {
878
+ // Required. The database to be dropped.
879
+ string database = 1 [
880
+ (google.api.field_behavior) = REQUIRED,
881
+ (google.api.resource_reference) = {
882
+ type: "spanner.googleapis.com/Database"
883
+ }
884
+ ];
885
+ }
886
+
887
+ // The request for
888
+ // [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].
889
+ message GetDatabaseDdlRequest {
890
+ // Required. The database whose schema we wish to get.
891
+ // Values are of the form
892
+ // `projects/<project>/instances/<instance>/databases/<database>`
893
+ string database = 1 [
894
+ (google.api.field_behavior) = REQUIRED,
895
+ (google.api.resource_reference) = {
896
+ type: "spanner.googleapis.com/Database"
897
+ }
898
+ ];
899
+ }
900
+
901
+ // The response for
902
+ // [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].
903
+ message GetDatabaseDdlResponse {
904
+ // A list of formatted DDL statements defining the schema of the database
905
+ // specified in the request.
906
+ repeated string statements = 1;
907
+
908
+ // Proto descriptors stored in the database.
909
+ // Contains a protobuf-serialized
910
+ // [google.protobuf.FileDescriptorSet](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/descriptor.proto).
911
+ // For more details, see protobuffer [self
912
+ // description](https://developers.google.com/protocol-buffers/docs/techniques#self-description).
913
+ bytes proto_descriptors = 2;
914
+ }
915
+
916
+ // The request for
917
+ // [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations].
918
+ message ListDatabaseOperationsRequest {
919
+ // Required. The instance of the database operations.
920
+ // Values are of the form `projects/<project>/instances/<instance>`.
921
+ string parent = 1 [
922
+ (google.api.field_behavior) = REQUIRED,
923
+ (google.api.resource_reference) = {
924
+ type: "spanner.googleapis.com/Instance"
925
+ }
926
+ ];
927
+
928
+ // An expression that filters the list of returned operations.
929
+ //
930
+ // A filter expression consists of a field name, a
931
+ // comparison operator, and a value for filtering.
932
+ // The value must be a string, a number, or a boolean. The comparison operator
933
+ // must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
934
+ // Colon `:` is the contains operator. Filter rules are not case sensitive.
935
+ //
936
+ // The following fields in the [Operation][google.longrunning.Operation]
937
+ // are eligible for filtering:
938
+ //
939
+ // * `name` - The name of the long-running operation
940
+ // * `done` - False if the operation is in progress, else true.
941
+ // * `metadata.@type` - the type of metadata. For example, the type string
942
+ // for
943
+ // [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]
944
+ // is
945
+ // `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
946
+ // * `metadata.<field_name>` - any field in metadata.value.
947
+ // `metadata.@type` must be specified first, if filtering on metadata
948
+ // fields.
949
+ // * `error` - Error associated with the long-running operation.
950
+ // * `response.@type` - the type of response.
951
+ // * `response.<field_name>` - any field in response.value.
952
+ //
953
+ // You can combine multiple expressions by enclosing each expression in
954
+ // parentheses. By default, expressions are combined with AND logic. However,
955
+ // you can specify AND, OR, and NOT logic explicitly.
956
+ //
957
+ // Here are a few examples:
958
+ //
959
+ // * `done:true` - The operation is complete.
960
+ // * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \
961
+ // `(metadata.source_type:BACKUP) AND` \
962
+ // `(metadata.backup_info.backup:backup_howl) AND` \
963
+ // `(metadata.name:restored_howl) AND` \
964
+ // `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
965
+ // `(error:*)` - Return operations where:
966
+ // * The operation's metadata type is
967
+ // [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata].
968
+ // * The database is restored from a backup.
969
+ // * The backup name contains "backup_howl".
970
+ // * The restored database's name contains "restored_howl".
971
+ // * The operation started before 2018-03-28T14:50:00Z.
972
+ // * The operation resulted in an error.
973
+ string filter = 2;
974
+
975
+ // Number of operations to be returned in the response. If 0 or
976
+ // less, defaults to the server's maximum allowed page size.
977
+ int32 page_size = 3;
978
+
979
+ // If non-empty, `page_token` should contain a
980
+ // [next_page_token][google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token]
981
+ // from a previous
982
+ // [ListDatabaseOperationsResponse][google.spanner.admin.database.v1.ListDatabaseOperationsResponse]
983
+ // to the same `parent` and with the same `filter`.
984
+ string page_token = 4;
985
+ }
986
+
987
+ // The response for
988
+ // [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations].
989
+ message ListDatabaseOperationsResponse {
990
+ // The list of matching database [long-running
991
+ // operations][google.longrunning.Operation]. Each operation's name will be
992
+ // prefixed by the database's name. The operation's
993
+ // [metadata][google.longrunning.Operation.metadata] field type
994
+ // `metadata.type_url` describes the type of the metadata.
995
+ repeated google.longrunning.Operation operations = 1;
996
+
997
+ // `next_page_token` can be sent in a subsequent
998
+ // [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations]
999
+ // call to fetch more of the matching metadata.
1000
+ string next_page_token = 2;
1001
+ }
1002
+
1003
+ // The request for
1004
+ // [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase].
1005
+ message RestoreDatabaseRequest {
1006
+ // Required. The name of the instance in which to create the
1007
+ // restored database. This instance must be in the same project and
1008
+ // have the same instance configuration as the instance containing
1009
+ // the source backup. Values are of the form
1010
+ // `projects/<project>/instances/<instance>`.
1011
+ string parent = 1 [
1012
+ (google.api.field_behavior) = REQUIRED,
1013
+ (google.api.resource_reference) = {
1014
+ type: "spanner.googleapis.com/Instance"
1015
+ }
1016
+ ];
1017
+
1018
+ // Required. The id of the database to create and restore to. This
1019
+ // database must not already exist. The `database_id` appended to
1020
+ // `parent` forms the full database name of the form
1021
+ // `projects/<project>/instances/<instance>/databases/<database_id>`.
1022
+ string database_id = 2 [(google.api.field_behavior) = REQUIRED];
1023
+
1024
+ // Required. The source from which to restore.
1025
+ oneof source {
1026
+ // Name of the backup from which to restore. Values are of the form
1027
+ // `projects/<project>/instances/<instance>/backups/<backup>`.
1028
+ string backup = 3 [(google.api.resource_reference) = {
1029
+ type: "spanner.googleapis.com/Backup"
1030
+ }];
1031
+ }
1032
+
1033
+ // Optional. An encryption configuration describing the encryption type and
1034
+ // key resources in Cloud KMS used to encrypt/decrypt the database to restore
1035
+ // to. If this field is not specified, the restored database will use the same
1036
+ // encryption configuration as the backup by default, namely
1037
+ // [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type]
1038
+ // = `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`.
1039
+ RestoreDatabaseEncryptionConfig encryption_config = 4
1040
+ [(google.api.field_behavior) = OPTIONAL];
1041
+ }
1042
+
1043
+ // Encryption configuration for the restored database.
1044
+ message RestoreDatabaseEncryptionConfig {
1045
+ // Encryption types for the database to be restored.
1046
+ enum EncryptionType {
1047
+ // Unspecified. Do not use.
1048
+ ENCRYPTION_TYPE_UNSPECIFIED = 0;
1049
+
1050
+ // This is the default option when
1051
+ // [encryption_config][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig]
1052
+ // is not specified.
1053
+ USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION = 1;
1054
+
1055
+ // Use Google default encryption.
1056
+ GOOGLE_DEFAULT_ENCRYPTION = 2;
1057
+
1058
+ // Use customer managed encryption. If specified, `kms_key_name` must
1059
+ // must contain a valid Cloud KMS key.
1060
+ CUSTOMER_MANAGED_ENCRYPTION = 3;
1061
+ }
1062
+
1063
+ // Required. The encryption type of the restored database.
1064
+ EncryptionType encryption_type = 1 [(google.api.field_behavior) = REQUIRED];
1065
+
1066
+ // Optional. The Cloud KMS key that will be used to encrypt/decrypt the
1067
+ // restored database. This field should be set only when
1068
+ // [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type]
1069
+ // is `CUSTOMER_MANAGED_ENCRYPTION`. Values are of the form
1070
+ // `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
1071
+ string kms_key_name = 2 [
1072
+ (google.api.field_behavior) = OPTIONAL,
1073
+ (google.api.resource_reference) = {
1074
+ type: "cloudkms.googleapis.com/CryptoKey"
1075
+ }
1076
+ ];
1077
+
1078
+ // Optional. Specifies the KMS configuration for the one or more keys used to
1079
+ // encrypt the database. Values are of the form
1080
+ // `projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>`.
1081
+ //
1082
+ // The keys referenced by kms_key_names must fully cover all
1083
+ // regions of the database instance configuration. Some examples:
1084
+ // * For single region database instance configs, specify a single regional
1085
+ // location KMS key.
1086
+ // * For multi-regional database instance configs of type GOOGLE_MANAGED,
1087
+ // either specify a multi-regional location KMS key or multiple regional
1088
+ // location KMS keys that cover all regions in the instance config.
1089
+ // * For a database instance config of type USER_MANAGED, please specify only
1090
+ // regional location KMS keys to cover each region in the instance config.
1091
+ // Multi-regional location KMS keys are not supported for USER_MANAGED
1092
+ // instance configs.
1093
+ repeated string kms_key_names = 3 [
1094
+ (google.api.field_behavior) = OPTIONAL,
1095
+ (google.api.resource_reference) = {
1096
+ type: "cloudkms.googleapis.com/CryptoKey"
1097
+ }
1098
+ ];
1099
+ }
1100
+
1101
+ // Metadata type for the long-running operation returned by
1102
+ // [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase].
1103
+ message RestoreDatabaseMetadata {
1104
+ // Name of the database being created and restored to.
1105
+ string name = 1 [(google.api.resource_reference) = {
1106
+ type: "spanner.googleapis.com/Database"
1107
+ }];
1108
+
1109
+ // The type of the restore source.
1110
+ RestoreSourceType source_type = 2;
1111
+
1112
+ // Information about the source used to restore the database, as specified by
1113
+ // `source` in
1114
+ // [RestoreDatabaseRequest][google.spanner.admin.database.v1.RestoreDatabaseRequest].
1115
+ oneof source_info {
1116
+ // Information about the backup used to restore the database.
1117
+ BackupInfo backup_info = 3;
1118
+ }
1119
+
1120
+ // The progress of the
1121
+ // [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase]
1122
+ // operation.
1123
+ OperationProgress progress = 4;
1124
+
1125
+ // The time at which cancellation of this operation was received.
1126
+ // [Operations.CancelOperation][google.longrunning.Operations.CancelOperation]
1127
+ // starts asynchronous cancellation on a long-running operation. The server
1128
+ // makes a best effort to cancel the operation, but success is not guaranteed.
1129
+ // Clients can use
1130
+ // [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
1131
+ // other methods to check whether the cancellation succeeded or whether the
1132
+ // operation completed despite cancellation. On successful cancellation,
1133
+ // the operation is not deleted; instead, it becomes an operation with
1134
+ // an [Operation.error][google.longrunning.Operation.error] value with a
1135
+ // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
1136
+ // `Code.CANCELLED`.
1137
+ google.protobuf.Timestamp cancel_time = 5;
1138
+
1139
+ // If exists, the name of the long-running operation that will be used to
1140
+ // track the post-restore optimization process to optimize the performance of
1141
+ // the restored database, and remove the dependency on the restore source.
1142
+ // The name is of the form
1143
+ // `projects/<project>/instances/<instance>/databases/<database>/operations/<operation>`
1144
+ // where the <database> is the name of database being created and restored to.
1145
+ // The metadata type of the long-running operation is
1146
+ // [OptimizeRestoredDatabaseMetadata][google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata].
1147
+ // This long-running operation will be automatically created by the system
1148
+ // after the RestoreDatabase long-running operation completes successfully.
1149
+ // This operation will not be created if the restore was not successful.
1150
+ string optimize_database_operation_name = 6;
1151
+ }
1152
+
1153
+ // Metadata type for the long-running operation used to track the progress
1154
+ // of optimizations performed on a newly restored database. This long-running
1155
+ // operation is automatically created by the system after the successful
1156
+ // completion of a database restore, and cannot be cancelled.
1157
+ message OptimizeRestoredDatabaseMetadata {
1158
+ // Name of the restored database being optimized.
1159
+ string name = 1 [(google.api.resource_reference) = {
1160
+ type: "spanner.googleapis.com/Database"
1161
+ }];
1162
+
1163
+ // The progress of the post-restore optimizations.
1164
+ OperationProgress progress = 2;
1165
+ }
1166
+
1167
+ // Indicates the type of the restore source.
1168
+ enum RestoreSourceType {
1169
+ // No restore associated.
1170
+ TYPE_UNSPECIFIED = 0;
1171
+
1172
+ // A backup was used as the source of the restore.
1173
+ BACKUP = 1;
1174
+ }
1175
+
1176
+ // A Cloud Spanner database role.
1177
+ message DatabaseRole {
1178
+ option (google.api.resource) = {
1179
+ type: "spanner.googleapis.com/DatabaseRole"
1180
+ pattern: "projects/{project}/instances/{instance}/databases/{database}/databaseRoles/{role}"
1181
+ };
1182
+
1183
+ // Required. The name of the database role. Values are of the form
1184
+ // `projects/<project>/instances/<instance>/databases/<database>/databaseRoles/<role>`
1185
+ // where `<role>` is as specified in the `CREATE ROLE` DDL statement.
1186
+ string name = 1 [(google.api.field_behavior) = REQUIRED];
1187
+ }
1188
+
1189
+ // The request for
1190
+ // [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles].
1191
+ message ListDatabaseRolesRequest {
1192
+ // Required. The database whose roles should be listed.
1193
+ // Values are of the form
1194
+ // `projects/<project>/instances/<instance>/databases/<database>`.
1195
+ string parent = 1 [
1196
+ (google.api.field_behavior) = REQUIRED,
1197
+ (google.api.resource_reference) = {
1198
+ type: "spanner.googleapis.com/Database"
1199
+ }
1200
+ ];
1201
+
1202
+ // Number of database roles to be returned in the response. If 0 or less,
1203
+ // defaults to the server's maximum allowed page size.
1204
+ int32 page_size = 2;
1205
+
1206
+ // If non-empty, `page_token` should contain a
1207
+ // [next_page_token][google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token]
1208
+ // from a previous
1209
+ // [ListDatabaseRolesResponse][google.spanner.admin.database.v1.ListDatabaseRolesResponse].
1210
+ string page_token = 3;
1211
+ }
1212
+
1213
+ // The response for
1214
+ // [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles].
1215
+ message ListDatabaseRolesResponse {
1216
+ // Database roles that matched the request.
1217
+ repeated DatabaseRole database_roles = 1;
1218
+
1219
+ // `next_page_token` can be sent in a subsequent
1220
+ // [ListDatabaseRoles][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseRoles]
1221
+ // call to fetch more of the matching roles.
1222
+ string next_page_token = 2;
1223
+ }
1224
+
1225
+ // The request for
1226
+ // [AddSplitPoints][google.spanner.admin.database.v1.DatabaseAdmin.AddSplitPoints].
1227
+ message AddSplitPointsRequest {
1228
+ // Required. The database on whose tables/indexes split points are to be
1229
+ // added. Values are of the form
1230
+ // `projects/<project>/instances/<instance>/databases/<database>`.
1231
+ string database = 1 [
1232
+ (google.api.field_behavior) = REQUIRED,
1233
+ (google.api.resource_reference) = {
1234
+ type: "spanner.googleapis.com/Database"
1235
+ }
1236
+ ];
1237
+
1238
+ // Required. The split points to add.
1239
+ repeated SplitPoints split_points = 2
1240
+ [(google.api.field_behavior) = REQUIRED];
1241
+
1242
+ // Optional. A user-supplied tag associated with the split points.
1243
+ // For example, "intital_data_load", "special_event_1".
1244
+ // Defaults to "CloudAddSplitPointsAPI" if not specified.
1245
+ // The length of the tag must not exceed 50 characters,else will be trimmed.
1246
+ // Only valid UTF8 characters are allowed.
1247
+ string initiator = 3 [(google.api.field_behavior) = OPTIONAL];
1248
+ }
1249
+
1250
+ // The response for
1251
+ // [AddSplitPoints][google.spanner.admin.database.v1.DatabaseAdmin.AddSplitPoints].
1252
+ message AddSplitPointsResponse {}
1253
+
1254
+ // The split points of a table/index.
1255
+ message SplitPoints {
1256
+ // A split key.
1257
+ message Key {
1258
+ // Required. The column values making up the split key.
1259
+ google.protobuf.ListValue key_parts = 1
1260
+ [(google.api.field_behavior) = REQUIRED];
1261
+ }
1262
+
1263
+ // The table to split.
1264
+ string table = 1;
1265
+
1266
+ // The index to split.
1267
+ // If specified, the `table` field must refer to the index's base table.
1268
+ string index = 2;
1269
+
1270
+ // Required. The list of split keys, i.e., the split boundaries.
1271
+ repeated Key keys = 3 [(google.api.field_behavior) = REQUIRED];
1272
+
1273
+ // Optional. The expiration timestamp of the split points.
1274
+ // A timestamp in the past means immediate expiration.
1275
+ // The maximum value can be 30 days in the future.
1276
+ // Defaults to 10 days in the future if not specified.
1277
+ google.protobuf.Timestamp expire_time = 5
1278
+ [(google.api.field_behavior) = OPTIONAL];
1279
+ }