google-cloud-spanner 1.16.1 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +1 -1
- data/CHANGELOG.md +58 -0
- data/CONTRIBUTING.md +6 -6
- data/TROUBLESHOOTING.md +0 -6
- data/lib/google-cloud-spanner.rb +11 -13
- data/lib/google/cloud/spanner.rb +13 -13
- data/lib/google/cloud/spanner/admin/database/credentials.rb +2 -2
- data/lib/google/cloud/spanner/admin/instance/credentials.rb +2 -2
- data/lib/google/cloud/spanner/backup.rb +1 -1
- data/lib/google/cloud/spanner/backup/job.rb +2 -2
- data/lib/google/cloud/spanner/backup/job/list.rb +2 -2
- data/lib/google/cloud/spanner/backup/list.rb +1 -2
- data/lib/google/cloud/spanner/backup/restore/job.rb +2 -2
- data/lib/google/cloud/spanner/batch_client.rb +2 -2
- data/lib/google/cloud/spanner/batch_snapshot.rb +120 -23
- data/lib/google/cloud/spanner/batch_update.rb +1 -1
- data/lib/google/cloud/spanner/client.rb +388 -47
- data/lib/google/cloud/spanner/commit.rb +14 -14
- data/lib/google/cloud/spanner/commit_response.rb +87 -0
- data/lib/google/cloud/spanner/commit_response/commit_stats.rb +51 -0
- data/lib/google/cloud/spanner/convert.rb +16 -7
- data/lib/google/cloud/spanner/credentials.rb +2 -2
- data/lib/google/cloud/spanner/data.rb +2 -2
- data/lib/google/cloud/spanner/database.rb +22 -22
- data/lib/google/cloud/spanner/database/backup_info.rb +1 -1
- data/lib/google/cloud/spanner/database/job.rb +3 -3
- data/lib/google/cloud/spanner/database/job/list.rb +2 -2
- data/lib/google/cloud/spanner/database/list.rb +1 -1
- data/lib/google/cloud/spanner/database/restore_info.rb +1 -1
- data/lib/google/cloud/spanner/fields.rb +8 -8
- data/lib/google/cloud/spanner/instance.rb +5 -12
- data/lib/google/cloud/spanner/instance/config.rb +1 -1
- data/lib/google/cloud/spanner/instance/config/list.rb +1 -1
- data/lib/google/cloud/spanner/instance/job.rb +2 -2
- data/lib/google/cloud/spanner/instance/list.rb +1 -1
- data/lib/google/cloud/spanner/partition.rb +4 -4
- data/lib/google/cloud/spanner/policy.rb +2 -2
- data/lib/google/cloud/spanner/results.rb +103 -24
- data/lib/google/cloud/spanner/service.rb +367 -349
- data/lib/google/cloud/spanner/session.rb +370 -39
- data/lib/google/cloud/spanner/snapshot.rb +60 -6
- data/lib/google/cloud/spanner/transaction.rb +116 -10
- data/lib/google/cloud/spanner/version.rb +1 -1
- metadata +20 -107
- data/lib/google/cloud/spanner/admin/database.rb +0 -149
- data/lib/google/cloud/spanner/admin/database/v1.rb +0 -147
- data/lib/google/cloud/spanner/admin/database/v1/credentials.rb +0 -46
- data/lib/google/cloud/spanner/admin/database/v1/database_admin_client.rb +0 -1513
- data/lib/google/cloud/spanner/admin/database/v1/database_admin_client_config.json +0 -111
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/iam_policy.rb +0 -64
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/options.rb +0 -33
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/iam/v1/policy.rb +0 -151
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/longrunning/operations.rb +0 -51
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/backup.rb +0 -325
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/spanner/admin/database/v1/spanner_database_admin.rb +0 -368
- data/lib/google/cloud/spanner/admin/database/v1/doc/google/type/expr.rb +0 -45
- data/lib/google/cloud/spanner/admin/instance.rb +0 -164
- data/lib/google/cloud/spanner/admin/instance/v1.rb +0 -162
- data/lib/google/cloud/spanner/admin/instance/v1/credentials.rb +0 -46
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/iam_policy.rb +0 -64
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/options.rb +0 -33
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/iam/v1/policy.rb +0 -151
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/longrunning/operations.rb +0 -51
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/spanner/admin/instance/v1/spanner_instance_admin.rb +0 -334
- data/lib/google/cloud/spanner/admin/instance/v1/doc/google/type/expr.rb +0 -45
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client.rb +0 -975
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin_client_config.json +0 -76
- data/lib/google/cloud/spanner/v1.rb +0 -16
- data/lib/google/cloud/spanner/v1/credentials.rb +0 -42
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/struct.rb +0 -74
- data/lib/google/cloud/spanner/v1/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/spanner/v1/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/keys.rb +0 -150
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/mutation.rb +0 -95
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/query_plan.rb +0 -121
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/result_set.rb +0 -190
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/spanner.rb +0 -570
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/transaction.rb +0 -432
- data/lib/google/cloud/spanner/v1/doc/google/spanner/v1/type.rb +0 -112
- data/lib/google/cloud/spanner/v1/spanner_client.rb +0 -1485
- data/lib/google/cloud/spanner/v1/spanner_client_config.json +0 -121
- data/lib/google/spanner/admin/database/v1/backup_pb.rb +0 -98
- data/lib/google/spanner/admin/database/v1/common_pb.rb +0 -28
- data/lib/google/spanner/admin/database/v1/spanner_database_admin_pb.rb +0 -141
- data/lib/google/spanner/admin/database/v1/spanner_database_admin_services_pb.rb +0 -169
- data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_pb.rb +0 -125
- data/lib/google/spanner/admin/instance/v1/spanner_instance_admin_services_pb.rb +0 -181
- data/lib/google/spanner/v1/keys_pb.rb +0 -34
- data/lib/google/spanner/v1/mutation_pb.rb +0 -39
- data/lib/google/spanner/v1/query_plan_pb.rb +0 -48
- data/lib/google/spanner/v1/result_set_pb.rb +0 -48
- data/lib/google/spanner/v1/spanner_pb.rb +0 -179
- data/lib/google/spanner/v1/spanner_services_pb.rb +0 -179
- data/lib/google/spanner/v1/transaction_pb.rb +0 -56
- data/lib/google/spanner/v1/type_pb.rb +0 -44
@@ -96,8 +96,8 @@ module Google
|
|
96
96
|
rows.delete_if(&:nil?)
|
97
97
|
rows.delete_if(&:empty?)
|
98
98
|
@mutations += rows.map do |row|
|
99
|
-
|
100
|
-
insert_or_update:
|
99
|
+
V1::Mutation.new(
|
100
|
+
insert_or_update: V1::Mutation::Write.new(
|
101
101
|
table: table, columns: row.keys.map(&:to_s),
|
102
102
|
values: [Convert.object_to_grpc_value(row.values).list_value]
|
103
103
|
)
|
@@ -154,8 +154,8 @@ module Google
|
|
154
154
|
rows.delete_if(&:nil?)
|
155
155
|
rows.delete_if(&:empty?)
|
156
156
|
@mutations += rows.map do |row|
|
157
|
-
|
158
|
-
insert:
|
157
|
+
V1::Mutation.new(
|
158
|
+
insert: V1::Mutation::Write.new(
|
159
159
|
table: table, columns: row.keys.map(&:to_s),
|
160
160
|
values: [Convert.object_to_grpc_value(row.values).list_value]
|
161
161
|
)
|
@@ -211,8 +211,8 @@ module Google
|
|
211
211
|
rows.delete_if(&:nil?)
|
212
212
|
rows.delete_if(&:empty?)
|
213
213
|
@mutations += rows.map do |row|
|
214
|
-
|
215
|
-
update:
|
214
|
+
V1::Mutation.new(
|
215
|
+
update: V1::Mutation::Write.new(
|
216
216
|
table: table, columns: row.keys.map(&:to_s),
|
217
217
|
values: [Convert.object_to_grpc_value(row.values).list_value]
|
218
218
|
)
|
@@ -270,8 +270,8 @@ module Google
|
|
270
270
|
rows.delete_if(&:nil?)
|
271
271
|
rows.delete_if(&:empty?)
|
272
272
|
@mutations += rows.map do |row|
|
273
|
-
|
274
|
-
replace:
|
273
|
+
V1::Mutation.new(
|
274
|
+
replace: V1::Mutation::Write.new(
|
275
275
|
table: table, columns: row.keys.map(&:to_s),
|
276
276
|
values: [Convert.object_to_grpc_value(row.values).list_value]
|
277
277
|
)
|
@@ -306,8 +306,8 @@ module Google
|
|
306
306
|
#
|
307
307
|
def delete table, keys = []
|
308
308
|
@mutations += [
|
309
|
-
|
310
|
-
delete:
|
309
|
+
V1::Mutation.new(
|
310
|
+
delete: V1::Mutation::Delete.new(
|
311
311
|
table: table, key_set: key_set(keys)
|
312
312
|
)
|
313
313
|
)
|
@@ -323,20 +323,20 @@ module Google
|
|
323
323
|
protected
|
324
324
|
|
325
325
|
def key_set keys
|
326
|
-
return
|
326
|
+
return V1::KeySet.new all: true if keys.nil?
|
327
327
|
keys = [keys] unless keys.is_a? Array
|
328
|
-
return
|
328
|
+
return V1::KeySet.new all: true if keys.empty?
|
329
329
|
if keys_are_ranges? keys
|
330
330
|
key_ranges = keys.map do |r|
|
331
331
|
Convert.to_key_range r
|
332
332
|
end
|
333
|
-
return
|
333
|
+
return V1::KeySet.new ranges: key_ranges
|
334
334
|
end
|
335
335
|
key_list = keys.map do |key|
|
336
336
|
key = [key] unless key.is_a? Array
|
337
337
|
Convert.object_to_grpc_value(key).list_value
|
338
338
|
end
|
339
|
-
|
339
|
+
V1::KeySet.new keys: key_list
|
340
340
|
end
|
341
341
|
|
342
342
|
def keys_are_ranges? keys
|
@@ -0,0 +1,87 @@
|
|
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/cloud/spanner/commit_response/commit_stats"
|
17
|
+
|
18
|
+
module Google
|
19
|
+
module Cloud
|
20
|
+
module Spanner
|
21
|
+
##
|
22
|
+
# CommitResponse is a timestamp at which the transaction committed
|
23
|
+
# with additional attributes of commit stats.
|
24
|
+
#
|
25
|
+
# @example
|
26
|
+
# require "google/cloud/spanner"
|
27
|
+
#
|
28
|
+
# spanner = Google::Cloud::Spanner.new
|
29
|
+
#
|
30
|
+
# db = spanner.client "my-instance", "my-database"
|
31
|
+
#
|
32
|
+
# timestamp = db.commit do |c|
|
33
|
+
# c.update "users", [{ id: 1, name: "Charlie", active: false }]
|
34
|
+
# c.insert "users", [{ id: 2, name: "Harvey", active: true }]
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# puts timestamp
|
38
|
+
#
|
39
|
+
# @example With commit stats.
|
40
|
+
# require "google/cloud/spanner"
|
41
|
+
#
|
42
|
+
# spanner = Google::Cloud::Spanner.new
|
43
|
+
#
|
44
|
+
# db = spanner.client "my-instance", "my-database"
|
45
|
+
#
|
46
|
+
# commit_options = { return_commit_stats: true }
|
47
|
+
# commit_resp = db.commit commit_options: commit_options do |c|
|
48
|
+
# c.update "users", [{ id: 1, name: "Charlie", active: false }]
|
49
|
+
# c.insert "users", [{ id: 2, name: "Harvey", active: true }]
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
# puts commit_resp.timestamp
|
53
|
+
# puts commit_resp.stats.mutation_count
|
54
|
+
#
|
55
|
+
class CommitResponse
|
56
|
+
##
|
57
|
+
# @private Creates a new CommitResponse instance.
|
58
|
+
def initialize grpc
|
59
|
+
@grpc = grpc
|
60
|
+
end
|
61
|
+
|
62
|
+
##
|
63
|
+
# The timestamp at which the transaction committed.
|
64
|
+
# @return [Time]
|
65
|
+
def timestamp
|
66
|
+
Convert.timestamp_to_time @grpc.commit_timestamp
|
67
|
+
end
|
68
|
+
|
69
|
+
##
|
70
|
+
# Additional statistics about a commit.
|
71
|
+
# @return [CommitStats, nil] Commit stats or nil if not stats not
|
72
|
+
# present.
|
73
|
+
def stats
|
74
|
+
CommitStats.from_grpc @grpc.commit_stats if @grpc.commit_stats
|
75
|
+
end
|
76
|
+
|
77
|
+
##
|
78
|
+
# @private
|
79
|
+
# Creates a new Commit responsee instance from a
|
80
|
+
# `Google::Cloud::Spanner::V1::CommitResponse`.
|
81
|
+
def self.from_grpc grpc
|
82
|
+
new grpc
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,51 @@
|
|
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/cloud/spanner/convert"
|
17
|
+
|
18
|
+
module Google
|
19
|
+
module Cloud
|
20
|
+
module Spanner
|
21
|
+
class CommitResponse
|
22
|
+
##
|
23
|
+
# # CommitStats
|
24
|
+
#
|
25
|
+
# Statistical information of a transaction commit.
|
26
|
+
#
|
27
|
+
class CommitStats
|
28
|
+
##
|
29
|
+
# @private Creates a new CommitStats instance.
|
30
|
+
def initialize grpc
|
31
|
+
@grpc = grpc
|
32
|
+
end
|
33
|
+
|
34
|
+
# The total number of the mutations for the transaction.
|
35
|
+
# @return [Integer]
|
36
|
+
def mutation_count
|
37
|
+
@grpc.mutation_count
|
38
|
+
end
|
39
|
+
|
40
|
+
##
|
41
|
+
# @private
|
42
|
+
# Creates a new CommitStats instance from a
|
43
|
+
# `Google::Cloud::Spanner::V1::CommitResponse::CommitStats`.
|
44
|
+
def self.from_grpc grpc
|
45
|
+
new grpc
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -17,6 +17,7 @@ require "time"
|
|
17
17
|
require "date"
|
18
18
|
require "stringio"
|
19
19
|
require "base64"
|
20
|
+
require "bigdecimal"
|
20
21
|
require "google/cloud/spanner/data"
|
21
22
|
|
22
23
|
module Google
|
@@ -67,6 +68,9 @@ module Google
|
|
67
68
|
Google::Protobuf::Value.new bool_value: false
|
68
69
|
when Integer
|
69
70
|
Google::Protobuf::Value.new string_value: obj.to_s
|
71
|
+
# BigDecimal must be put before Numeric.
|
72
|
+
when BigDecimal
|
73
|
+
Google::Protobuf::Value.new string_value: obj.to_s("F")
|
70
74
|
when Numeric
|
71
75
|
if obj == Float::INFINITY
|
72
76
|
Google::Protobuf::Value.new string_value: "Infinity"
|
@@ -125,6 +129,9 @@ module Google
|
|
125
129
|
:BOOL
|
126
130
|
when Integer
|
127
131
|
:INT64
|
132
|
+
# BigDecimal must be put before Numeric.
|
133
|
+
when BigDecimal
|
134
|
+
:NUMERIC
|
128
135
|
when Numeric
|
129
136
|
:FLOAT64
|
130
137
|
when Time
|
@@ -169,12 +176,12 @@ module Google
|
|
169
176
|
return field.to_grpc_type if field.respond_to? :to_grpc_type
|
170
177
|
|
171
178
|
if Array === field
|
172
|
-
|
179
|
+
V1::Type.new(
|
173
180
|
code: :ARRAY,
|
174
181
|
array_element_type: grpc_type_for_field(field.first)
|
175
182
|
)
|
176
183
|
else
|
177
|
-
|
184
|
+
V1::Type.new(code: field)
|
178
185
|
end
|
179
186
|
end
|
180
187
|
|
@@ -214,6 +221,8 @@ module Google
|
|
214
221
|
end
|
215
222
|
when :STRUCT
|
216
223
|
Data.from_grpc value.list_value.values, type.struct_type.fields
|
224
|
+
when :NUMERIC
|
225
|
+
BigDecimal value.string_value
|
217
226
|
end
|
218
227
|
end
|
219
228
|
|
@@ -274,24 +283,24 @@ module Google
|
|
274
283
|
range_opts.delete :end_closed
|
275
284
|
end
|
276
285
|
|
277
|
-
|
286
|
+
V1::KeyRange.new range_opts
|
278
287
|
end
|
279
288
|
|
280
289
|
def to_key_set keys
|
281
|
-
return
|
290
|
+
return V1::KeySet.new(all: true) if keys.nil?
|
282
291
|
keys = [keys] unless keys.is_a? Array
|
283
|
-
return
|
292
|
+
return V1::KeySet.new(all: true) if keys.empty?
|
284
293
|
|
285
294
|
if keys_are_ranges? keys
|
286
295
|
key_ranges = keys.map { |r| to_key_range(r) }
|
287
|
-
return
|
296
|
+
return V1::KeySet.new(ranges: key_ranges)
|
288
297
|
end
|
289
298
|
|
290
299
|
key_list = keys.map do |key|
|
291
300
|
key = [key] unless key.is_a? Array
|
292
301
|
object_to_grpc_value(key).list_value
|
293
302
|
end
|
294
|
-
|
303
|
+
V1::KeySet.new keys: key_list
|
295
304
|
end
|
296
305
|
|
297
306
|
def keys_are_ranges? keys
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
|
16
|
-
require "google/cloud/spanner/v1/credentials"
|
16
|
+
require "google/cloud/spanner/v1/spanner/credentials"
|
17
17
|
|
18
18
|
module Google
|
19
19
|
module Cloud
|
@@ -37,7 +37,7 @@ module Google
|
|
37
37
|
#
|
38
38
|
# spanner.project_id #=> "my-project"
|
39
39
|
#
|
40
|
-
class Credentials < Google::Cloud::Spanner::V1::Credentials
|
40
|
+
class Credentials < Google::Cloud::Spanner::V1::Spanner::Credentials
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -216,9 +216,9 @@ module Google
|
|
216
216
|
##
|
217
217
|
# @private
|
218
218
|
def to_grpc_type
|
219
|
-
|
219
|
+
V1::Type.new(
|
220
220
|
code: :STRUCT,
|
221
|
-
struct_type:
|
221
|
+
struct_type: V1::StructType.new(
|
222
222
|
fields: @grpc_fields
|
223
223
|
)
|
224
224
|
)
|
@@ -229,7 +229,6 @@ module Google
|
|
229
229
|
true
|
230
230
|
end
|
231
231
|
|
232
|
-
|
233
232
|
# @private
|
234
233
|
DATBASE_OPERATION_METADAT_FILTER_TEMPLATE = [
|
235
234
|
"(metadata.@type:CreateDatabaseMetadata AND " \
|
@@ -248,10 +247,10 @@ module Google
|
|
248
247
|
# response.
|
249
248
|
#
|
250
249
|
# The response returns a list of
|
251
|
-
#
|
250
|
+
# `Google::Longrunning::Operation` long-running operations whose names
|
252
251
|
# are prefixed by a database name within the specified instance.
|
253
252
|
# The long-running operation
|
254
|
-
#
|
253
|
+
# `Google::Longrunning::Operation#metadata` metadata field type
|
255
254
|
# `metadata.type_url` describes the type of the metadata.
|
256
255
|
#
|
257
256
|
# The filter expression must specify the field name,
|
@@ -384,10 +383,9 @@ module Google
|
|
384
383
|
)
|
385
384
|
end
|
386
385
|
|
387
|
-
grpc = service.list_database_operations
|
388
|
-
|
389
|
-
|
390
|
-
page_size: page_size
|
386
|
+
grpc = service.list_database_operations instance_id,
|
387
|
+
filter: database_filter,
|
388
|
+
page_size: page_size
|
391
389
|
Database::Job::List.from_grpc grpc, service
|
392
390
|
end
|
393
391
|
|
@@ -573,20 +571,22 @@ module Google
|
|
573
571
|
#
|
574
572
|
# The permissions that can be checked on a database are:
|
575
573
|
#
|
576
|
-
#
|
577
|
-
#
|
578
|
-
#
|
579
|
-
#
|
580
|
-
#
|
581
|
-
#
|
582
|
-
#
|
583
|
-
#
|
584
|
-
#
|
585
|
-
#
|
586
|
-
#
|
587
|
-
#
|
588
|
-
#
|
589
|
-
#
|
574
|
+
# * spanner.databases.beginPartitionedDmlTransaction
|
575
|
+
# * spanner.databases.create
|
576
|
+
# * spanner.databases.createBackup
|
577
|
+
# * spanner.databases.list
|
578
|
+
# * spanner.databases.update
|
579
|
+
# * spanner.databases.updateDdl
|
580
|
+
# * spanner.databases.get
|
581
|
+
# * spanner.databases.getDdl
|
582
|
+
# * spanner.databases.getIamPolicy
|
583
|
+
# * spanner.databases.setIamPolicy
|
584
|
+
# * spanner.databases.beginReadOnlyTransaction
|
585
|
+
# * spanner.databases.beginOrRollbackReadWriteTransaction
|
586
|
+
# * spanner.databases.read
|
587
|
+
# * spanner.databases.select
|
588
|
+
# * spanner.databases.write
|
589
|
+
# * spanner.databases.drop
|
590
590
|
#
|
591
591
|
# @return [Array<Strings>] The permissions that have access.
|
592
592
|
#
|
@@ -611,7 +611,7 @@ module Google
|
|
611
611
|
|
612
612
|
##
|
613
613
|
# @private Creates a new Database instance from a
|
614
|
-
# Google::Spanner::Admin::Database::V1::Database
|
614
|
+
# `Google::Cloud::Spanner::Admin::Database::V1::Database`.
|
615
615
|
def self.from_grpc grpc, service
|
616
616
|
new grpc, service
|
617
617
|
end
|
@@ -52,7 +52,7 @@ module Google
|
|
52
52
|
#
|
53
53
|
class Job
|
54
54
|
##
|
55
|
-
# @private The
|
55
|
+
# @private The `Gapic::Operation` gRPC object.
|
56
56
|
attr_accessor :grpc
|
57
57
|
|
58
58
|
##
|
@@ -89,7 +89,7 @@ module Google
|
|
89
89
|
return nil unless done?
|
90
90
|
return nil unless @grpc.grpc_op.result == :response
|
91
91
|
return nil unless @grpc.results.instance_of? \
|
92
|
-
|
92
|
+
Admin::Database::V1::Database
|
93
93
|
Database.from_grpc @grpc.results, service
|
94
94
|
end
|
95
95
|
|
@@ -201,7 +201,7 @@ module Google
|
|
201
201
|
end
|
202
202
|
|
203
203
|
##
|
204
|
-
# @private New Database::Job from a
|
204
|
+
# @private New Database::Job from a `Gapic::Operation` object.
|
205
205
|
def self.from_grpc grpc, service
|
206
206
|
new.tap do |job|
|
207
207
|
job.instance_variable_set :@grpc, grpc
|
@@ -146,7 +146,7 @@ module Google
|
|
146
146
|
# @private
|
147
147
|
#
|
148
148
|
# New Database::Job::List from a
|
149
|
-
#
|
149
|
+
# `Gapic::PagedEnumerable<Google::Longrunning::Operation>`
|
150
150
|
# object. Operation object is a database operation.
|
151
151
|
#
|
152
152
|
def self.from_grpc grpc, service
|
@@ -154,7 +154,7 @@ module Google
|
|
154
154
|
service.databases.instance_variable_get "@operations_client"
|
155
155
|
jobs = new(Array(grpc.response.operations).map do |job_grpc|
|
156
156
|
Job.from_grpc \
|
157
|
-
|
157
|
+
Gapic::Operation.new(job_grpc, operations_client),
|
158
158
|
service
|
159
159
|
end)
|
160
160
|
jobs.grpc = grpc
|