google-cloud-spanner 1.16.0 → 2.2.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 +54 -0
- data/CONTRIBUTING.md +5 -5
- data/TROUBLESHOOTING.md +0 -6
- data/lib/google-cloud-spanner.rb +11 -13
- data/lib/google/cloud/spanner.rb +6 -8
- 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 +189 -30
- data/lib/google/cloud/spanner/commit.rb +14 -14
- 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 +363 -350
- data/lib/google/cloud/spanner/session.rb +186 -31
- 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 -109
- 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
@@ -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
|
@@ -142,7 +142,7 @@ module Google
|
|
142
142
|
|
143
143
|
##
|
144
144
|
# @private New Database::List from a
|
145
|
-
# Google::Spanner::Admin::Database::V1::ListDatabasesResponse
|
145
|
+
# `Google::Cloud::Spanner::Admin::Database::V1::ListDatabasesResponse`
|
146
146
|
# object.
|
147
147
|
def self.from_grpc grpc, service, instance_id, max = nil
|
148
148
|
databases = List.new(Array(grpc.databases).map do |database|
|
@@ -372,9 +372,9 @@ module Google
|
|
372
372
|
##
|
373
373
|
# @private
|
374
374
|
def to_grpc_type
|
375
|
-
|
375
|
+
V1::Type.new(
|
376
376
|
code: :STRUCT,
|
377
|
-
struct_type:
|
377
|
+
struct_type: V1::StructType.new(
|
378
378
|
fields: @grpc_fields
|
379
379
|
)
|
380
380
|
)
|
@@ -382,7 +382,7 @@ module Google
|
|
382
382
|
|
383
383
|
##
|
384
384
|
# @private Creates a new Fields instance from a
|
385
|
-
#
|
385
|
+
# V1::Metadata::Row_type::Fields.
|
386
386
|
def self.from_grpc fields
|
387
387
|
new([]).tap do |f|
|
388
388
|
f.instance_variable_set :@grpc_fields, Array(fields)
|
@@ -412,18 +412,18 @@ module Google
|
|
412
412
|
if pair.is_a?(Array)
|
413
413
|
if pair.count == 2
|
414
414
|
if pair.first.is_a?(Integer)
|
415
|
-
|
415
|
+
V1::StructType::Field.new(
|
416
416
|
type: Convert.grpc_type_for_field(pair.last)
|
417
417
|
)
|
418
418
|
else
|
419
|
-
|
419
|
+
V1::StructType::Field.new(
|
420
420
|
name: String(pair.first),
|
421
421
|
type: Convert.grpc_type_for_field(pair.last)
|
422
422
|
)
|
423
423
|
end
|
424
424
|
else
|
425
|
-
|
426
|
-
type:
|
425
|
+
V1::StructType::Field.new(
|
426
|
+
type: V1::Type.new(
|
427
427
|
code: :ARRAY,
|
428
428
|
array_element_type: Convert.grpc_type_for_field(pair.last)
|
429
429
|
)
|
@@ -435,7 +435,7 @@ module Google
|
|
435
435
|
unless pair.is_a?(Symbol)
|
436
436
|
raise ArgumentError, "type must be a symbol"
|
437
437
|
end
|
438
|
-
|
438
|
+
V1::StructType::Field.new(
|
439
439
|
type: Convert.grpc_type_for_field(pair)
|
440
440
|
)
|
441
441
|
end
|
@@ -342,10 +342,10 @@ module Google
|
|
342
342
|
# response.
|
343
343
|
#
|
344
344
|
# The response returns a list of
|
345
|
-
#
|
345
|
+
# `Google::Longrunning::Operation` long-running operations whose names
|
346
346
|
# are prefixed by a database name within the specified instance.
|
347
347
|
# The long-running operation
|
348
|
-
#
|
348
|
+
# `Google::Longrunning::Operation#metadata` metadata field type
|
349
349
|
# `metadata.type_url` describes the type of the metadata.
|
350
350
|
#
|
351
351
|
# The filter expression must specify the field name,
|
@@ -603,10 +603,10 @@ module Google
|
|
603
603
|
# response.
|
604
604
|
#
|
605
605
|
# The response returns a list of
|
606
|
-
#
|
606
|
+
# `Google::Longrunning::Operation` long-running operations whose names
|
607
607
|
# are prefixed by a backup name within the specified instance.
|
608
608
|
# The long-running operation
|
609
|
-
#
|
609
|
+
# `Google::Longrunning::Operation#metadata` metadata field type
|
610
610
|
# `metadata.type_url` describes the type of the metadata.
|
611
611
|
#
|
612
612
|
# The filter expression must specify the field name of an operation, a
|
@@ -856,7 +856,7 @@ module Google
|
|
856
856
|
|
857
857
|
##
|
858
858
|
# @private Creates a new Instance instance from a
|
859
|
-
# Google::Spanner::Admin::Instance::V1::Instance
|
859
|
+
# `Google::Cloud::Spanner::Admin::Instance::V1::Instance`.
|
860
860
|
def self.from_grpc grpc, service
|
861
861
|
new grpc, service
|
862
862
|
end
|
@@ -869,13 +869,6 @@ module Google
|
|
869
869
|
def ensure_service!
|
870
870
|
raise "Must have active connection to service" unless service
|
871
871
|
end
|
872
|
-
|
873
|
-
def instance_config_path name
|
874
|
-
return name if name.to_s.include? "/"
|
875
|
-
Admin::Instance::V1::InstanceAdminClient.instance_config_path(
|
876
|
-
project, name.to_s
|
877
|
-
)
|
878
|
-
end
|
879
872
|
end
|
880
873
|
end
|
881
874
|
end
|
@@ -142,7 +142,7 @@ module Google
|
|
142
142
|
|
143
143
|
##
|
144
144
|
# @private New Instance::Config::List from a
|
145
|
-
# Google::Spanner::Admin::Instance::V1::ListInstanceConfigsResponse
|
145
|
+
# `Google::Cloud::Spanner::Admin::Instance::V1::ListInstanceConfigsResponse`
|
146
146
|
# object.
|
147
147
|
def self.from_grpc grpc, service, max = nil
|
148
148
|
configs = List.new(Array(grpc.instance_configs).map do |config|
|
@@ -54,7 +54,7 @@ module Google
|
|
54
54
|
#
|
55
55
|
class Job
|
56
56
|
##
|
57
|
-
# @private The
|
57
|
+
# @private The `Gapic::Operation` gRPC object.
|
58
58
|
attr_accessor :grpc
|
59
59
|
|
60
60
|
##
|
@@ -219,7 +219,7 @@ module Google
|
|
219
219
|
end
|
220
220
|
|
221
221
|
##
|
222
|
-
# @private New Instance::Job from a
|
222
|
+
# @private New Instance::Job from a `Gapic::Operation` object.
|
223
223
|
def self.from_grpc grpc, service
|
224
224
|
new.tap do |job|
|
225
225
|
job.instance_variable_set :@grpc, grpc
|
@@ -139,7 +139,7 @@ module Google
|
|
139
139
|
|
140
140
|
##
|
141
141
|
# @private New Instance::List from a
|
142
|
-
# Google::Spanner::Admin::Instance::V1::ListInstancesResponse
|
142
|
+
# `Google::Cloud::Spanner::Admin::Instance::V1::ListInstancesResponse`
|
143
143
|
# object.
|
144
144
|
def self.from_grpc grpc, service, max = nil
|
145
145
|
instances = List.new(Array(grpc.instances).map do |instance|
|
@@ -172,13 +172,13 @@ module Google
|
|
172
172
|
new.tap do |p|
|
173
173
|
if data[:execute]
|
174
174
|
execute_sql_grpc = \
|
175
|
-
|
175
|
+
V1::ExecuteSqlRequest.decode(
|
176
176
|
Base64.decode64(data[:execute])
|
177
177
|
)
|
178
178
|
p.instance_variable_set :@execute, execute_sql_grpc
|
179
179
|
end
|
180
180
|
if data[:read]
|
181
|
-
read_grpc =
|
181
|
+
read_grpc = V1::ReadRequest.decode \
|
182
182
|
Base64.decode64(data[:read])
|
183
183
|
p.instance_variable_set :@read, read_grpc
|
184
184
|
end
|
@@ -194,7 +194,7 @@ module Google
|
|
194
194
|
end
|
195
195
|
|
196
196
|
##
|
197
|
-
# @private New Partition from a Google::Spanner::V1::ExecuteSqlRequest
|
197
|
+
# @private New Partition from a `Google::Cloud::Spanner::V1::ExecuteSqlRequest`
|
198
198
|
# object.
|
199
199
|
def self.from_execute_sql_grpc grpc
|
200
200
|
new.tap do |p|
|
@@ -203,7 +203,7 @@ module Google
|
|
203
203
|
end
|
204
204
|
|
205
205
|
##
|
206
|
-
# @private New Partition from a Google::Spanner::V1::ReadRequest object.
|
206
|
+
# @private New Partition from a `Google::Cloud::Spanner::V1::ReadRequest` object.
|
207
207
|
def self.from_read_grpc grpc
|
208
208
|
new.tap do |p|
|
209
209
|
p.instance_variable_set :@read, grpc
|
@@ -159,7 +159,7 @@ module Google
|
|
159
159
|
end
|
160
160
|
|
161
161
|
##
|
162
|
-
# @private Convert the Policy to a Google::Iam::V1::Policy object.
|
162
|
+
# @private Convert the Policy to a `Google::Iam::V1::Policy` object.
|
163
163
|
def to_grpc
|
164
164
|
Google::Iam::V1::Policy.new(
|
165
165
|
etag: etag,
|
@@ -174,7 +174,7 @@ module Google
|
|
174
174
|
end
|
175
175
|
|
176
176
|
##
|
177
|
-
# @private New Policy from a Google::Iam::V1::Policy object.
|
177
|
+
# @private New Policy from a `Google::Iam::V1::Policy` object.
|
178
178
|
def self.from_grpc grpc
|
179
179
|
roles = grpc.bindings.each_with_object({}) do |binding, memo|
|
180
180
|
memo[binding.role] = binding.members.to_a
|