google-cloud-spanner 3.55.0__py3-none-any.whl

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