google-cloud-spanner 1.15.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +1 -1
  3. data/CHANGELOG.md +49 -0
  4. data/CONTRIBUTING.md +5 -5
  5. data/TROUBLESHOOTING.md +0 -6
  6. data/lib/google-cloud-spanner.rb +10 -13
  7. data/lib/google/cloud/spanner.rb +6 -8
  8. data/lib/google/cloud/spanner/admin/database/credentials.rb +2 -2
  9. data/lib/google/cloud/spanner/admin/instance/credentials.rb +2 -2
  10. data/lib/google/cloud/spanner/backup.rb +315 -0
  11. data/lib/google/cloud/spanner/backup/job.rb +274 -0
  12. data/lib/google/cloud/spanner/backup/job/list.rb +177 -0
  13. data/lib/google/cloud/spanner/backup/list.rb +169 -0
  14. data/lib/google/cloud/spanner/backup/restore/job.rb +246 -0
  15. data/lib/google/cloud/spanner/batch_client.rb +2 -2
  16. data/lib/google/cloud/spanner/batch_snapshot.rb +120 -23
  17. data/lib/google/cloud/spanner/batch_update.rb +1 -1
  18. data/lib/google/cloud/spanner/client.rb +189 -30
  19. data/lib/google/cloud/spanner/commit.rb +14 -14
  20. data/lib/google/cloud/spanner/convert.rb +7 -7
  21. data/lib/google/cloud/spanner/credentials.rb +2 -2
  22. data/lib/google/cloud/spanner/data.rb +2 -2
  23. data/lib/google/cloud/spanner/database.rb +275 -15
  24. data/lib/google/cloud/spanner/database/backup_info.rb +105 -0
  25. data/lib/google/cloud/spanner/database/job.rb +5 -2
  26. data/lib/google/cloud/spanner/database/job/list.rb +177 -0
  27. data/lib/google/cloud/spanner/database/list.rb +1 -1
  28. data/lib/google/cloud/spanner/database/restore_info.rb +63 -0
  29. data/lib/google/cloud/spanner/fields.rb +8 -8
  30. data/lib/google/cloud/spanner/instance.rb +401 -8
  31. data/lib/google/cloud/spanner/instance/config.rb +1 -1
  32. data/lib/google/cloud/spanner/instance/config/list.rb +1 -1
  33. data/lib/google/cloud/spanner/instance/job.rb +2 -2
  34. data/lib/google/cloud/spanner/instance/list.rb +1 -1
  35. data/lib/google/cloud/spanner/partition.rb +4 -4
  36. data/lib/google/cloud/spanner/policy.rb +2 -2
  37. data/lib/google/cloud/spanner/results.rb +9 -6
  38. data/lib/google/cloud/spanner/service.rb +392 -302
  39. data/lib/google/cloud/spanner/session.rb +186 -31
  40. data/lib/google/cloud/spanner/snapshot.rb +60 -6
  41. data/lib/google/cloud/spanner/transaction.rb +116 -10
  42. data/lib/google/cloud/spanner/version.rb +1 -1
  43. metadata +28 -109
  44. data/lib/google/cloud/spanner/admin/database.rb +0 -149
  45. data/lib/google/cloud/spanner/admin/database/v1.rb +0 -147
  46. data/lib/google/cloud/spanner/admin/database/v1/credentials.rb +0 -46
  47. data/lib/google/cloud/spanner/admin/database/v1/database_admin_client.rb +0 -1513
  48. data/lib/google/cloud/spanner/admin/database/v1/database_admin_client_config.json +0 -111
  49. data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/iam_policy.rb +0 -64
  50. data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/options.rb +0 -33
  51. data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/policy.rb +0 -151
  52. data/lib/google/cloud/spanner/admin/database/v1/doc/google/longrunning/operations.rb +0 -51
  53. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/any.rb +0 -131
  54. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/empty.rb +0 -29
  55. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/field_mask.rb +0 -222
  56. data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/timestamp.rb +0 -113
  57. data/lib/google/cloud/spanner/admin/database/v1/doc/google/rpc/status.rb +0 -39
  58. data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/backup.rb +0 -325
  59. data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/spanner_database_admin.rb +0 -368
  60. data/lib/google/cloud/spanner/admin/database/v1/doc/google/type/expr.rb +0 -45
  61. data/lib/google/cloud/spanner/admin/instance.rb +0 -164
  62. data/lib/google/cloud/spanner/admin/instance/v1.rb +0 -162
  63. data/lib/google/cloud/spanner/admin/instance/v1/credentials.rb +0 -46
  64. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/iam_policy.rb +0 -64
  65. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/options.rb +0 -33
  66. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/policy.rb +0 -151
  67. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/longrunning/operations.rb +0 -51
  68. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/any.rb +0 -131
  69. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/empty.rb +0 -29
  70. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/field_mask.rb +0 -222
  71. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/rpc/status.rb +0 -39
  72. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/spanner/admin/instance/v1/spanner_instance_admin.rb +0 -334
  73. data/lib/google/cloud/spanner/admin/instance/v1/doc/google/type/expr.rb +0 -45
  74. data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client.rb +0 -975
  75. data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client_config.json +0 -76
  76. data/lib/google/cloud/spanner/v1.rb +0 -16
  77. data/lib/google/cloud/spanner/v1/credentials.rb +0 -42
  78. data/lib/google/cloud/spanner/v1/doc/google/protobuf/any.rb +0 -131
  79. data/lib/google/cloud/spanner/v1/doc/google/protobuf/duration.rb +0 -91
  80. data/lib/google/cloud/spanner/v1/doc/google/protobuf/empty.rb +0 -29
  81. data/lib/google/cloud/spanner/v1/doc/google/protobuf/struct.rb +0 -74
  82. data/lib/google/cloud/spanner/v1/doc/google/protobuf/timestamp.rb +0 -113
  83. data/lib/google/cloud/spanner/v1/doc/google/rpc/status.rb +0 -39
  84. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/keys.rb +0 -150
  85. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/mutation.rb +0 -95
  86. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/query_plan.rb +0 -121
  87. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/result_set.rb +0 -190
  88. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/spanner.rb +0 -570
  89. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/transaction.rb +0 -432
  90. data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/type.rb +0 -112
  91. data/lib/google/cloud/spanner/v1/spanner_client.rb +0 -1485
  92. data/lib/google/cloud/spanner/v1/spanner_client_config.json +0 -121
  93. data/lib/google/spanner/admin/database/v1/backup_pb.rb +0 -98
  94. data/lib/google/spanner/admin/database/v1/common_pb.rb +0 -28
  95. data/lib/google/spanner/admin/database/v1/spanner_database_admin_pb.rb +0 -141
  96. data/lib/google/spanner/admin/database/v1/spanner_database_admin_services_pb.rb +0 -169
  97. data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_pb.rb +0 -125
  98. data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_services_pb.rb +0 -181
  99. data/lib/google/spanner/v1/keys_pb.rb +0 -34
  100. data/lib/google/spanner/v1/mutation_pb.rb +0 -39
  101. data/lib/google/spanner/v1/query_plan_pb.rb +0 -48
  102. data/lib/google/spanner/v1/result_set_pb.rb +0 -48
  103. data/lib/google/spanner/v1/spanner_pb.rb +0 -179
  104. data/lib/google/spanner/v1/spanner_services_pb.rb +0 -179
  105. data/lib/google/spanner/v1/transaction_pb.rb +0 -56
  106. data/lib/google/spanner/v1/type_pb.rb +0 -44
@@ -1,368 +0,0 @@
1
- # Copyright 2020 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
- # https://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
-
16
- module Google
17
- module Spanner
18
- module Admin
19
- module Database
20
- module V1
21
- # Information about the database restore.
22
- # @!attribute [rw] source_type
23
- # @return [Google::Spanner::Admin::Database::V1::RestoreSourceType]
24
- # The type of the restore source.
25
- # @!attribute [rw] backup_info
26
- # @return [Google::Spanner::Admin::Database::V1::BackupInfo]
27
- # Information about the backup used to restore the database. The backup
28
- # may no longer exist.
29
- class RestoreInfo; end
30
-
31
- # A Cloud Spanner database.
32
- # @!attribute [rw] name
33
- # @return [String]
34
- # Required. The name of the database. Values are of the form
35
- # `projects/<project>/instances/<instance>/databases/<database>`,
36
- # where `<database>` is as specified in the `CREATE DATABASE`
37
- # statement. This name can be passed to other API methods to
38
- # identify the database.
39
- # @!attribute [rw] state
40
- # @return [Google::Spanner::Admin::Database::V1::Database::State]
41
- # Output only. The current database state.
42
- # @!attribute [rw] create_time
43
- # @return [Google::Protobuf::Timestamp]
44
- # Output only. If exists, the time at which the database creation started.
45
- # @!attribute [rw] restore_info
46
- # @return [Google::Spanner::Admin::Database::V1::RestoreInfo]
47
- # Output only. Applicable only for restored databases. Contains information
48
- # about the restore source.
49
- class Database
50
- # Indicates the current state of the database.
51
- module State
52
- # Not specified.
53
- STATE_UNSPECIFIED = 0
54
-
55
- # The database is still being created. Operations on the database may fail
56
- # with `FAILED_PRECONDITION` in this state.
57
- CREATING = 1
58
-
59
- # The database is fully created and ready for use.
60
- READY = 2
61
-
62
- # The database is fully created and ready for use, but is still
63
- # being optimized for performance and cannot handle full load.
64
- #
65
- # In this state, the database still references the backup
66
- # it was restore from, preventing the backup
67
- # from being deleted. When optimizations are complete, the full performance
68
- # of the database will be restored, and the database will transition to
69
- # `READY` state.
70
- READY_OPTIMIZING = 3
71
- end
72
- end
73
-
74
- # The request for {Google::Spanner::Admin::Database::V1::DatabaseAdmin::ListDatabases ListDatabases}.
75
- # @!attribute [rw] parent
76
- # @return [String]
77
- # Required. The instance whose databases should be listed.
78
- # Values are of the form `projects/<project>/instances/<instance>`.
79
- # @!attribute [rw] page_size
80
- # @return [Integer]
81
- # Number of databases to be returned in the response. If 0 or less,
82
- # defaults to the server's maximum allowed page size.
83
- # @!attribute [rw] page_token
84
- # @return [String]
85
- # If non-empty, `page_token` should contain a
86
- # {Google::Spanner::Admin::Database::V1::ListDatabasesResponse#next_page_token next_page_token} from a
87
- # previous {Google::Spanner::Admin::Database::V1::ListDatabasesResponse ListDatabasesResponse}.
88
- class ListDatabasesRequest; end
89
-
90
- # The response for {Google::Spanner::Admin::Database::V1::DatabaseAdmin::ListDatabases ListDatabases}.
91
- # @!attribute [rw] databases
92
- # @return [Array<Google::Spanner::Admin::Database::V1::Database>]
93
- # Databases that matched the request.
94
- # @!attribute [rw] next_page_token
95
- # @return [String]
96
- # `next_page_token` can be sent in a subsequent
97
- # {Google::Spanner::Admin::Database::V1::DatabaseAdmin::ListDatabases ListDatabases} call to fetch more
98
- # of the matching databases.
99
- class ListDatabasesResponse; end
100
-
101
- # The request for {Google::Spanner::Admin::Database::V1::DatabaseAdmin::CreateDatabase CreateDatabase}.
102
- # @!attribute [rw] parent
103
- # @return [String]
104
- # Required. The name of the instance that will serve the new database.
105
- # Values are of the form `projects/<project>/instances/<instance>`.
106
- # @!attribute [rw] create_statement
107
- # @return [String]
108
- # Required. A `CREATE DATABASE` statement, which specifies the ID of the
109
- # new database. The database ID must conform to the regular expression
110
- # `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length.
111
- # If the database ID is a reserved word or if it contains a hyphen, the
112
- # database ID must be enclosed in backticks (`` ` ``).
113
- # @!attribute [rw] extra_statements
114
- # @return [Array<String>]
115
- # Optional. A list of DDL statements to run inside the newly created
116
- # database. Statements can create tables, indexes, etc. These
117
- # statements execute atomically with the creation of the database:
118
- # if there is an error in any statement, the database is not created.
119
- class CreateDatabaseRequest; end
120
-
121
- # Metadata type for the operation returned by
122
- # {Google::Spanner::Admin::Database::V1::DatabaseAdmin::CreateDatabase CreateDatabase}.
123
- # @!attribute [rw] database
124
- # @return [String]
125
- # The database being created.
126
- class CreateDatabaseMetadata; end
127
-
128
- # The request for {Google::Spanner::Admin::Database::V1::DatabaseAdmin::GetDatabase GetDatabase}.
129
- # @!attribute [rw] name
130
- # @return [String]
131
- # Required. The name of the requested database. Values are of the form
132
- # `projects/<project>/instances/<instance>/databases/<database>`.
133
- class GetDatabaseRequest; end
134
-
135
- # Enqueues the given DDL statements to be applied, in order but not
136
- # necessarily all at once, to the database schema at some point (or
137
- # points) in the future. The server checks that the statements
138
- # are executable (syntactically valid, name tables that exist, etc.)
139
- # before enqueueing them, but they may still fail upon
140
- # later execution (e.g., if a statement from another batch of
141
- # statements is applied first and it conflicts in some way, or if
142
- # there is some data-related problem like a `NULL` value in a column to
143
- # which `NOT NULL` would be added). If a statement fails, all
144
- # subsequent statements in the batch are automatically cancelled.
145
- #
146
- # Each batch of statements is assigned a name which can be used with
147
- # the {Google::Longrunning::Operations Operations} API to monitor
148
- # progress. See the
149
- # {Google::Spanner::Admin::Database::V1::UpdateDatabaseDdlRequest#operation_id operation_id} field for more
150
- # details.
151
- # @!attribute [rw] database
152
- # @return [String]
153
- # Required. The database to update.
154
- # @!attribute [rw] statements
155
- # @return [Array<String>]
156
- # Required. DDL statements to be applied to the database.
157
- # @!attribute [rw] operation_id
158
- # @return [String]
159
- # If empty, the new update request is assigned an
160
- # automatically-generated operation ID. Otherwise, `operation_id`
161
- # is used to construct the name of the resulting
162
- # {Google::Longrunning::Operation Operation}.
163
- #
164
- # Specifying an explicit operation ID simplifies determining
165
- # whether the statements were executed in the event that the
166
- # {Google::Spanner::Admin::Database::V1::DatabaseAdmin::UpdateDatabaseDdl UpdateDatabaseDdl} call is replayed,
167
- # or the return value is otherwise lost: the {Google::Spanner::Admin::Database::V1::UpdateDatabaseDdlRequest#database database} and
168
- # `operation_id` fields can be combined to form the
169
- # {Google::Longrunning::Operation#name name} of the resulting
170
- # {Google::Longrunning::Operation longrunning::Operation}: `<database>/operations/<operation_id>`.
171
- #
172
- # `operation_id` should be unique within the database, and must be
173
- # a valid identifier: `[a-z][a-z0-9_]*`. Note that
174
- # automatically-generated operation IDs always begin with an
175
- # underscore. If the named operation already exists,
176
- # {Google::Spanner::Admin::Database::V1::DatabaseAdmin::UpdateDatabaseDdl UpdateDatabaseDdl} returns
177
- # `ALREADY_EXISTS`.
178
- class UpdateDatabaseDdlRequest; end
179
-
180
- # Metadata type for the operation returned by
181
- # {Google::Spanner::Admin::Database::V1::DatabaseAdmin::UpdateDatabaseDdl UpdateDatabaseDdl}.
182
- # @!attribute [rw] database
183
- # @return [String]
184
- # The database being modified.
185
- # @!attribute [rw] statements
186
- # @return [Array<String>]
187
- # For an update this list contains all the statements. For an
188
- # individual statement, this list contains only that statement.
189
- # @!attribute [rw] commit_timestamps
190
- # @return [Array<Google::Protobuf::Timestamp>]
191
- # Reports the commit timestamps of all statements that have
192
- # succeeded so far, where `commit_timestamps[i]` is the commit
193
- # timestamp for the statement `statements[i]`.
194
- class UpdateDatabaseDdlMetadata; end
195
-
196
- # The request for {Google::Spanner::Admin::Database::V1::DatabaseAdmin::DropDatabase DropDatabase}.
197
- # @!attribute [rw] database
198
- # @return [String]
199
- # Required. The database to be dropped.
200
- class DropDatabaseRequest; end
201
-
202
- # The request for {Google::Spanner::Admin::Database::V1::DatabaseAdmin::GetDatabaseDdl GetDatabaseDdl}.
203
- # @!attribute [rw] database
204
- # @return [String]
205
- # Required. The database whose schema we wish to get.
206
- class GetDatabaseDdlRequest; end
207
-
208
- # The response for {Google::Spanner::Admin::Database::V1::DatabaseAdmin::GetDatabaseDdl GetDatabaseDdl}.
209
- # @!attribute [rw] statements
210
- # @return [Array<String>]
211
- # A list of formatted DDL statements defining the schema of the database
212
- # specified in the request.
213
- class GetDatabaseDdlResponse; end
214
-
215
- # The request for
216
- # {Google::Spanner::Admin::Database::V1::DatabaseAdmin::ListDatabaseOperations ListDatabaseOperations}.
217
- # @!attribute [rw] parent
218
- # @return [String]
219
- # Required. The instance of the database operations.
220
- # Values are of the form `projects/<project>/instances/<instance>`.
221
- # @!attribute [rw] filter
222
- # @return [String]
223
- # An expression that filters the list of returned operations.
224
- #
225
- # A filter expression consists of a field name, a
226
- # comparison operator, and a value for filtering.
227
- # The value must be a string, a number, or a boolean. The comparison operator
228
- # must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
229
- # Colon `:` is the contains operator. Filter rules are not case sensitive.
230
- #
231
- # The following fields in the {Google::Longrunning::Operation Operation}
232
- # are eligible for filtering:
233
- #
234
- # * `name` - The name of the long-running operation
235
- # * `done` - False if the operation is in progress, else true.
236
- # * `metadata.@type` - the type of metadata. For example, the type string
237
- # for {Google::Spanner::Admin::Database::V1::RestoreDatabaseMetadata RestoreDatabaseMetadata} is
238
- # `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
239
- # * `metadata.<field_name>` - any field in metadata.value.
240
- # * `error` - Error associated with the long-running operation.
241
- # * `response.@type` - the type of response.
242
- # * `response.<field_name>` - any field in response.value.
243
- #
244
- # You can combine multiple expressions by enclosing each expression in
245
- # parentheses. By default, expressions are combined with AND logic. However,
246
- # you can specify AND, OR, and NOT logic explicitly.
247
- #
248
- # Here are a few examples:
249
- #
250
- # * `done:true` - The operation is complete.
251
- # * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` <br/>
252
- # `(metadata.source_type:BACKUP) AND` <br/>
253
- # `(metadata.backup_info.backup:backup_howl) AND` <br/>
254
- # `(metadata.name:restored_howl) AND` <br/>
255
- # `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` <br/>
256
- # `(error:*)` - Return operations where:
257
- # * The operation's metadata type is {Google::Spanner::Admin::Database::V1::RestoreDatabaseMetadata RestoreDatabaseMetadata}.
258
- # * The database is restored from a backup.
259
- # * The backup name contains "backup_howl".
260
- # * The restored database's name contains "restored_howl".
261
- # * The operation started before 2018-03-28T14:50:00Z.
262
- # * The operation resulted in an error.
263
- # @!attribute [rw] page_size
264
- # @return [Integer]
265
- # Number of operations to be returned in the response. If 0 or
266
- # less, defaults to the server's maximum allowed page size.
267
- # @!attribute [rw] page_token
268
- # @return [String]
269
- # If non-empty, `page_token` should contain a
270
- # {Google::Spanner::Admin::Database::V1::ListDatabaseOperationsResponse#next_page_token next_page_token}
271
- # from a previous {Google::Spanner::Admin::Database::V1::ListDatabaseOperationsResponse ListDatabaseOperationsResponse} to the
272
- # same `parent` and with the same `filter`.
273
- class ListDatabaseOperationsRequest; end
274
-
275
- # The response for
276
- # {Google::Spanner::Admin::Database::V1::DatabaseAdmin::ListDatabaseOperations ListDatabaseOperations}.
277
- # @!attribute [rw] operations
278
- # @return [Array<Google::Longrunning::Operation>]
279
- # The list of matching database [long-running
280
- # operations][google.longrunning.Operation]. Each operation's name will be
281
- # prefixed by the database's name. The operation's
282
- # {Google::Longrunning::Operation#metadata metadata} field type
283
- # `metadata.type_url` describes the type of the metadata.
284
- # @!attribute [rw] next_page_token
285
- # @return [String]
286
- # `next_page_token` can be sent in a subsequent
287
- # {Google::Spanner::Admin::Database::V1::DatabaseAdmin::ListDatabaseOperations ListDatabaseOperations}
288
- # call to fetch more of the matching metadata.
289
- class ListDatabaseOperationsResponse; end
290
-
291
- # The request for
292
- # {Google::Spanner::Admin::Database::V1::DatabaseAdmin::RestoreDatabase RestoreDatabase}.
293
- # @!attribute [rw] parent
294
- # @return [String]
295
- # Required. The name of the instance in which to create the
296
- # restored database. This instance must be in the same project and
297
- # have the same instance configuration as the instance containing
298
- # the source backup. Values are of the form
299
- # `projects/<project>/instances/<instance>`.
300
- # @!attribute [rw] database_id
301
- # @return [String]
302
- # Required. The id of the database to create and restore to. This
303
- # database must not already exist. The `database_id` appended to
304
- # `parent` forms the full database name of the form
305
- # `projects/<project>/instances/<instance>/databases/<database_id>`.
306
- # @!attribute [rw] backup
307
- # @return [String]
308
- # Name of the backup from which to restore. Values are of the form
309
- # `projects/<project>/instances/<instance>/backups/<backup>`.
310
- class RestoreDatabaseRequest; end
311
-
312
- # Metadata type for the long-running operation returned by
313
- # {Google::Spanner::Admin::Database::V1::DatabaseAdmin::RestoreDatabase RestoreDatabase}.
314
- # @!attribute [rw] name
315
- # @return [String]
316
- # Name of the database being created and restored to.
317
- # @!attribute [rw] source_type
318
- # @return [Google::Spanner::Admin::Database::V1::RestoreSourceType]
319
- # The type of the restore source.
320
- # @!attribute [rw] backup_info
321
- # @return [Google::Spanner::Admin::Database::V1::BackupInfo]
322
- # Information about the backup used to restore the database.
323
- # @!attribute [rw] progress
324
- # @return [Google::Spanner::Admin::Database::V1::OperationProgress]
325
- # The progress of the
326
- # {Google::Spanner::Admin::Database::V1::DatabaseAdmin::RestoreDatabase RestoreDatabase}
327
- # operation.
328
- # @!attribute [rw] cancel_time
329
- # @return [Google::Protobuf::Timestamp]
330
- # The time at which cancellation of this operation was received.
331
- # {Google::Longrunning::Operations::CancelOperation Operations::CancelOperation}
332
- # starts asynchronous cancellation on a long-running operation. The server
333
- # makes a best effort to cancel the operation, but success is not guaranteed.
334
- # Clients can use
335
- # {Google::Longrunning::Operations::GetOperation Operations::GetOperation} or
336
- # other methods to check whether the cancellation succeeded or whether the
337
- # operation completed despite cancellation. On successful cancellation,
338
- # the operation is not deleted; instead, it becomes an operation with
339
- # an {Google::Longrunning::Operation#error Operation#error} value with a
340
- # {Google::Rpc::Status#code} of 1, corresponding to `Code.CANCELLED`.
341
- # @!attribute [rw] optimize_database_operation_name
342
- # @return [String]
343
- # If exists, the name of the long-running operation that will be used to
344
- # track the post-restore optimization process to optimize the performance of
345
- # the restored database, and remove the dependency on the restore source.
346
- # The name is of the form
347
- # `projects/<project>/instances/<instance>/databases/<database>/operations/<operation>`
348
- # where the <database> is the name of database being created and restored to.
349
- # The metadata type of the long-running operation is
350
- # {Google::Spanner::Admin::Database::V1::OptimizeRestoredDatabaseMetadata OptimizeRestoredDatabaseMetadata}. This long-running operation will be
351
- # automatically created by the system after the RestoreDatabase long-running
352
- # operation completes successfully. This operation will not be created if the
353
- # restore was not successful.
354
- class RestoreDatabaseMetadata; end
355
-
356
- # Indicates the type of the restore source.
357
- module RestoreSourceType
358
- # No restore associated.
359
- TYPE_UNSPECIFIED = 0
360
-
361
- # A backup was used as the source of the restore.
362
- BACKUP = 1
363
- end
364
- end
365
- end
366
- end
367
- end
368
- end
@@ -1,45 +0,0 @@
1
- # Copyright 2020 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
- # https://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
-
16
- module Google
17
- module Type
18
- # Represents an expression text. Example:
19
- #
20
- # title: "User account presence"
21
- # description: "Determines whether the request has a user account"
22
- # expression: "size(request.user) > 0"
23
- # @!attribute [rw] expression
24
- # @return [String]
25
- # Textual representation of an expression in
26
- # Common Expression Language syntax.
27
- #
28
- # The application context of the containing message determines which
29
- # well-known feature set of CEL is supported.
30
- # @!attribute [rw] title
31
- # @return [String]
32
- # An optional title for the expression, i.e. a short string describing
33
- # its purpose. This can be used e.g. in UIs which allow to enter the
34
- # expression.
35
- # @!attribute [rw] description
36
- # @return [String]
37
- # An optional description of the expression. This is a longer text which
38
- # describes the expression, e.g. when hovered over it in a UI.
39
- # @!attribute [rw] location
40
- # @return [String]
41
- # An optional string indicating the location of the expression for error
42
- # reporting, e.g. a file name and a position in the file.
43
- class Expr; end
44
- end
45
- end
@@ -1,164 +0,0 @@
1
- # Copyright 2020 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
- # https://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
-
16
- require "google/gax"
17
- require "pathname"
18
-
19
- module Google
20
- module Cloud
21
- module Spanner
22
- module Admin
23
- # rubocop:disable LineLength
24
-
25
- ##
26
- # # Ruby Client for Cloud Spanner Instance Admin API
27
- #
28
- # [Cloud Spanner Instance Admin API][Product Documentation]:
29
- #
30
- # - [Product Documentation][]
31
- #
32
- # ## Quick Start
33
- # In order to use this library, you first need to go through the following
34
- # steps:
35
- #
36
- # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
37
- # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
38
- # 3. [Enable the Cloud Spanner Instance Admin API.](https://console.cloud.google.com/apis/library/spanner.googleapis.com)
39
- # 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-spanner/latest/file.AUTHENTICATION.html)
40
- #
41
- # ### Installation
42
- # ```
43
- # $ gem install google-cloud-spanner
44
- # ```
45
- #
46
- # ### Next Steps
47
- # - Read the [Cloud Spanner Instance Admin API Product documentation][Product Documentation]
48
- # to learn more about the product and see How-to Guides.
49
- # - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
50
- # to see the full list of Cloud APIs that we cover.
51
- #
52
- # [Product Documentation]: https://cloud.google.com/spanner
53
- #
54
- # ## Enabling Logging
55
- #
56
- # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
57
- # The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
58
- # or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
59
- # that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
60
- # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
61
- #
62
- # Configuring a Ruby stdlib logger:
63
- #
64
- # ```ruby
65
- # require "logger"
66
- #
67
- # module MyLogger
68
- # LOGGER = Logger.new $stderr, level: Logger::WARN
69
- # def logger
70
- # LOGGER
71
- # end
72
- # end
73
- #
74
- # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
75
- # module GRPC
76
- # extend MyLogger
77
- # end
78
- # ```
79
- #
80
- module Instance
81
- # rubocop:enable LineLength
82
-
83
- FILE_DIR = File.realdirpath(Pathname.new(__FILE__).join("..").join("instance"))
84
-
85
- AVAILABLE_VERSIONS = Dir["#{FILE_DIR}/*"]
86
- .select { |file| File.directory?(file) }
87
- .select { |dir| Google::Gax::VERSION_MATCHER.match(File.basename(dir)) }
88
- .select { |dir| File.exist?(dir + ".rb") }
89
- .map { |dir| File.basename(dir) }
90
-
91
- ##
92
- # Cloud Spanner Instance Admin API
93
- #
94
- # The Cloud Spanner Instance Admin API can be used to create, delete,
95
- # modify and list instances. Instances are dedicated Cloud Spanner serving
96
- # and storage resources to be used by Cloud Spanner databases.
97
- #
98
- # Each instance has a "configuration", which dictates where the
99
- # serving resources for the Cloud Spanner instance are located (e.g.,
100
- # US-central, Europe). Configurations are created by Google based on
101
- # resource availability.
102
- #
103
- # Cloud Spanner billing is based on the instances that exist and their
104
- # sizes. After an instance exists, there are no additional
105
- # per-database or per-operation charges for use of the instance
106
- # (though there may be additional network bandwidth charges).
107
- # Instances offer isolation: problems with databases in one instance
108
- # will not affect other instances. However, within an instance
109
- # databases can affect each other. For example, if one database in an
110
- # instance receives a lot of requests and consumes most of the
111
- # instance resources, fewer resources are available for other
112
- # databases in that instance, and their performance may suffer.
113
- #
114
- # @param version [Symbol, String]
115
- # The major version of the service to be used. By default :v1
116
- # is used.
117
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
118
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
119
- # Provides the means for authenticating requests made by the client. This parameter can
120
- # be many types.
121
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
122
- # authenticating requests made by this client.
123
- # A `String` will be treated as the path to the keyfile to be used for the construction of
124
- # credentials for this client.
125
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
126
- # credentials for this client.
127
- # A `GRPC::Core::Channel` will be used to make calls through.
128
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
129
- # should already be composed with a `GRPC::Core::CallCredentials` object.
130
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
131
- # metadata for requests, generally, to give OAuth credentials.
132
- # @param scopes [Array<String>]
133
- # The OAuth scopes for this service. This parameter is ignored if
134
- # an updater_proc is supplied.
135
- # @param client_config [Hash]
136
- # A Hash for call options for each method. See
137
- # Google::Gax#construct_settings for the structure of
138
- # this data. Falls back to the default config if not specified
139
- # or the specified config is missing data points.
140
- # @param timeout [Numeric]
141
- # The default timeout, in seconds, for calls made through this client.
142
- # @param metadata [Hash]
143
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
144
- # @param exception_transformer [Proc]
145
- # An optional proc that intercepts any exceptions raised during an API call to inject
146
- # custom error handling.
147
- def self.new(*args, version: :v1, **kwargs)
148
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
149
- raise "The version: #{version} is not available. The available versions " \
150
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
151
- end
152
-
153
- require "#{FILE_DIR}/#{version.to_s.downcase}"
154
- version_module = Google::Cloud::Spanner::Admin::Instance
155
- .constants
156
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
157
- .first
158
- Google::Cloud::Spanner::Admin::Instance.const_get(version_module).new(*args, **kwargs)
159
- end
160
- end
161
- end
162
- end
163
- end
164
- end