google-cloud-spanner-v1 1.19.1 → 1.19.2

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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/spanner/v1/rest.rb +37 -0
  4. data/lib/google/cloud/spanner/v1/spanner/client.rb +1 -1
  5. data/lib/google/cloud/spanner/v1/spanner/credentials.rb +1 -1
  6. data/lib/google/cloud/spanner/v1/spanner/paths.rb +1 -1
  7. data/lib/google/cloud/spanner/v1/spanner/rest/client.rb +2593 -0
  8. data/lib/google/cloud/spanner/v1/spanner/rest/service_stub.rb +1108 -0
  9. data/lib/google/cloud/spanner/v1/spanner/rest.rb +55 -0
  10. data/lib/google/cloud/spanner/v1/spanner.rb +7 -1
  11. data/lib/google/cloud/spanner/v1/version.rb +1 -1
  12. data/lib/google/cloud/spanner/v1.rb +6 -1
  13. data/lib/google/spanner/v1/spanner_services_pb.rb +1 -1
  14. data/lib/google-cloud-spanner-v1.rb +1 -1
  15. data/proto_docs/google/api/client.rb +1 -1
  16. data/proto_docs/google/api/field_behavior.rb +1 -1
  17. data/proto_docs/google/api/launch_stage.rb +1 -1
  18. data/proto_docs/google/api/resource.rb +1 -1
  19. data/proto_docs/google/protobuf/any.rb +1 -1
  20. data/proto_docs/google/protobuf/duration.rb +1 -1
  21. data/proto_docs/google/protobuf/empty.rb +1 -1
  22. data/proto_docs/google/protobuf/struct.rb +1 -1
  23. data/proto_docs/google/protobuf/timestamp.rb +8 -7
  24. data/proto_docs/google/rpc/status.rb +1 -1
  25. data/proto_docs/google/spanner/v1/change_stream.rb +1 -1
  26. data/proto_docs/google/spanner/v1/commit_response.rb +1 -1
  27. data/proto_docs/google/spanner/v1/keys.rb +1 -1
  28. data/proto_docs/google/spanner/v1/location.rb +1 -1
  29. data/proto_docs/google/spanner/v1/mutation.rb +1 -1
  30. data/proto_docs/google/spanner/v1/query_plan.rb +1 -1
  31. data/proto_docs/google/spanner/v1/result_set.rb +1 -1
  32. data/proto_docs/google/spanner/v1/spanner.rb +1 -1
  33. data/proto_docs/google/spanner/v1/transaction.rb +1 -1
  34. data/proto_docs/google/spanner/v1/type.rb +1 -1
  35. metadata +5 -1
@@ -0,0 +1,1108 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/spanner/v1/spanner_pb"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Spanner
24
+ module V1
25
+ module Spanner
26
+ module Rest
27
+ ##
28
+ # REST service stub for the Spanner service.
29
+ # Service stub contains baseline method implementations
30
+ # including transcoding, making the REST call, and deserialing the response.
31
+ #
32
+ class ServiceStub
33
+ # @private
34
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
35
+ # These require statements are intentionally placed here to initialize
36
+ # the REST modules only when it's required.
37
+ require "gapic/rest"
38
+
39
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
40
+ endpoint_template: endpoint_template,
41
+ universe_domain: universe_domain,
42
+ credentials: credentials,
43
+ numeric_enums: true,
44
+ service_name: self.class,
45
+ raise_faraday_errors: false,
46
+ logger: logger
47
+ end
48
+
49
+ ##
50
+ # The effective universe domain
51
+ #
52
+ # @return [String]
53
+ #
54
+ def universe_domain
55
+ @client_stub.universe_domain
56
+ end
57
+
58
+ ##
59
+ # The effective endpoint
60
+ #
61
+ # @return [String]
62
+ #
63
+ def endpoint
64
+ @client_stub.endpoint
65
+ end
66
+
67
+ ##
68
+ # The logger used for request/response debug logging.
69
+ #
70
+ # @return [Logger]
71
+ #
72
+ def logger stub: false
73
+ stub ? @client_stub.stub_logger : @client_stub.logger
74
+ end
75
+
76
+ ##
77
+ # Baseline implementation for the create_session REST call
78
+ #
79
+ # @param request_pb [::Google::Cloud::Spanner::V1::CreateSessionRequest]
80
+ # A request object representing the call parameters. Required.
81
+ # @param options [::Gapic::CallOptions]
82
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
83
+ #
84
+ # @yield [result, operation] Access the result along with the TransportOperation object
85
+ # @yieldparam result [::Google::Cloud::Spanner::V1::Session]
86
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
87
+ #
88
+ # @return [::Google::Cloud::Spanner::V1::Session]
89
+ # A result object deserialized from the server's reply
90
+ def create_session request_pb, options = nil
91
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
92
+
93
+ verb, uri, query_string_params, body = ServiceStub.transcode_create_session_request request_pb
94
+ query_string_params = if query_string_params.any?
95
+ query_string_params.to_h { |p| p.split "=", 2 }
96
+ else
97
+ {}
98
+ end
99
+
100
+ response = @client_stub.make_http_request(
101
+ verb,
102
+ uri: uri,
103
+ body: body || "",
104
+ params: query_string_params,
105
+ method_name: "create_session",
106
+ options: options
107
+ )
108
+ operation = ::Gapic::Rest::TransportOperation.new response
109
+ result = ::Google::Cloud::Spanner::V1::Session.decode_json response.body, ignore_unknown_fields: true
110
+ catch :response do
111
+ yield result, operation if block_given?
112
+ result
113
+ end
114
+ end
115
+
116
+ ##
117
+ # Baseline implementation for the batch_create_sessions REST call
118
+ #
119
+ # @param request_pb [::Google::Cloud::Spanner::V1::BatchCreateSessionsRequest]
120
+ # A request object representing the call parameters. Required.
121
+ # @param options [::Gapic::CallOptions]
122
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
123
+ #
124
+ # @yield [result, operation] Access the result along with the TransportOperation object
125
+ # @yieldparam result [::Google::Cloud::Spanner::V1::BatchCreateSessionsResponse]
126
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
127
+ #
128
+ # @return [::Google::Cloud::Spanner::V1::BatchCreateSessionsResponse]
129
+ # A result object deserialized from the server's reply
130
+ def batch_create_sessions request_pb, options = nil
131
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
132
+
133
+ verb, uri, query_string_params, body = ServiceStub.transcode_batch_create_sessions_request request_pb
134
+ query_string_params = if query_string_params.any?
135
+ query_string_params.to_h { |p| p.split "=", 2 }
136
+ else
137
+ {}
138
+ end
139
+
140
+ response = @client_stub.make_http_request(
141
+ verb,
142
+ uri: uri,
143
+ body: body || "",
144
+ params: query_string_params,
145
+ method_name: "batch_create_sessions",
146
+ options: options
147
+ )
148
+ operation = ::Gapic::Rest::TransportOperation.new response
149
+ result = ::Google::Cloud::Spanner::V1::BatchCreateSessionsResponse.decode_json response.body, ignore_unknown_fields: true
150
+ catch :response do
151
+ yield result, operation if block_given?
152
+ result
153
+ end
154
+ end
155
+
156
+ ##
157
+ # Baseline implementation for the get_session REST call
158
+ #
159
+ # @param request_pb [::Google::Cloud::Spanner::V1::GetSessionRequest]
160
+ # A request object representing the call parameters. Required.
161
+ # @param options [::Gapic::CallOptions]
162
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
163
+ #
164
+ # @yield [result, operation] Access the result along with the TransportOperation object
165
+ # @yieldparam result [::Google::Cloud::Spanner::V1::Session]
166
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
167
+ #
168
+ # @return [::Google::Cloud::Spanner::V1::Session]
169
+ # A result object deserialized from the server's reply
170
+ def get_session request_pb, options = nil
171
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
172
+
173
+ verb, uri, query_string_params, body = ServiceStub.transcode_get_session_request request_pb
174
+ query_string_params = if query_string_params.any?
175
+ query_string_params.to_h { |p| p.split "=", 2 }
176
+ else
177
+ {}
178
+ end
179
+
180
+ response = @client_stub.make_http_request(
181
+ verb,
182
+ uri: uri,
183
+ body: body || "",
184
+ params: query_string_params,
185
+ method_name: "get_session",
186
+ options: options
187
+ )
188
+ operation = ::Gapic::Rest::TransportOperation.new response
189
+ result = ::Google::Cloud::Spanner::V1::Session.decode_json response.body, ignore_unknown_fields: true
190
+ catch :response do
191
+ yield result, operation if block_given?
192
+ result
193
+ end
194
+ end
195
+
196
+ ##
197
+ # Baseline implementation for the list_sessions REST call
198
+ #
199
+ # @param request_pb [::Google::Cloud::Spanner::V1::ListSessionsRequest]
200
+ # A request object representing the call parameters. Required.
201
+ # @param options [::Gapic::CallOptions]
202
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
203
+ #
204
+ # @yield [result, operation] Access the result along with the TransportOperation object
205
+ # @yieldparam result [::Google::Cloud::Spanner::V1::ListSessionsResponse]
206
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
207
+ #
208
+ # @return [::Google::Cloud::Spanner::V1::ListSessionsResponse]
209
+ # A result object deserialized from the server's reply
210
+ def list_sessions request_pb, options = nil
211
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
212
+
213
+ verb, uri, query_string_params, body = ServiceStub.transcode_list_sessions_request request_pb
214
+ query_string_params = if query_string_params.any?
215
+ query_string_params.to_h { |p| p.split "=", 2 }
216
+ else
217
+ {}
218
+ end
219
+
220
+ response = @client_stub.make_http_request(
221
+ verb,
222
+ uri: uri,
223
+ body: body || "",
224
+ params: query_string_params,
225
+ method_name: "list_sessions",
226
+ options: options
227
+ )
228
+ operation = ::Gapic::Rest::TransportOperation.new response
229
+ result = ::Google::Cloud::Spanner::V1::ListSessionsResponse.decode_json response.body, ignore_unknown_fields: true
230
+ catch :response do
231
+ yield result, operation if block_given?
232
+ result
233
+ end
234
+ end
235
+
236
+ ##
237
+ # Baseline implementation for the delete_session REST call
238
+ #
239
+ # @param request_pb [::Google::Cloud::Spanner::V1::DeleteSessionRequest]
240
+ # A request object representing the call parameters. Required.
241
+ # @param options [::Gapic::CallOptions]
242
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
243
+ #
244
+ # @yield [result, operation] Access the result along with the TransportOperation object
245
+ # @yieldparam result [::Google::Protobuf::Empty]
246
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
247
+ #
248
+ # @return [::Google::Protobuf::Empty]
249
+ # A result object deserialized from the server's reply
250
+ def delete_session request_pb, options = nil
251
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
252
+
253
+ verb, uri, query_string_params, body = ServiceStub.transcode_delete_session_request request_pb
254
+ query_string_params = if query_string_params.any?
255
+ query_string_params.to_h { |p| p.split "=", 2 }
256
+ else
257
+ {}
258
+ end
259
+
260
+ response = @client_stub.make_http_request(
261
+ verb,
262
+ uri: uri,
263
+ body: body || "",
264
+ params: query_string_params,
265
+ method_name: "delete_session",
266
+ options: options
267
+ )
268
+ operation = ::Gapic::Rest::TransportOperation.new response
269
+ result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
270
+ catch :response do
271
+ yield result, operation if block_given?
272
+ result
273
+ end
274
+ end
275
+
276
+ ##
277
+ # Baseline implementation for the execute_sql REST call
278
+ #
279
+ # @param request_pb [::Google::Cloud::Spanner::V1::ExecuteSqlRequest]
280
+ # A request object representing the call parameters. Required.
281
+ # @param options [::Gapic::CallOptions]
282
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
283
+ #
284
+ # @yield [result, operation] Access the result along with the TransportOperation object
285
+ # @yieldparam result [::Google::Cloud::Spanner::V1::ResultSet]
286
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
287
+ #
288
+ # @return [::Google::Cloud::Spanner::V1::ResultSet]
289
+ # A result object deserialized from the server's reply
290
+ def execute_sql request_pb, options = nil
291
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
292
+
293
+ verb, uri, query_string_params, body = ServiceStub.transcode_execute_sql_request request_pb
294
+ query_string_params = if query_string_params.any?
295
+ query_string_params.to_h { |p| p.split "=", 2 }
296
+ else
297
+ {}
298
+ end
299
+
300
+ response = @client_stub.make_http_request(
301
+ verb,
302
+ uri: uri,
303
+ body: body || "",
304
+ params: query_string_params,
305
+ method_name: "execute_sql",
306
+ options: options
307
+ )
308
+ operation = ::Gapic::Rest::TransportOperation.new response
309
+ result = ::Google::Cloud::Spanner::V1::ResultSet.decode_json response.body, ignore_unknown_fields: true
310
+ catch :response do
311
+ yield result, operation if block_given?
312
+ result
313
+ end
314
+ end
315
+
316
+ ##
317
+ # Baseline implementation for the execute_streaming_sql REST call
318
+ #
319
+ # @param request_pb [::Google::Cloud::Spanner::V1::ExecuteSqlRequest]
320
+ # A request object representing the call parameters. Required.
321
+ # @param options [::Gapic::CallOptions]
322
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
323
+ #
324
+ # @yieldparam chunk [::String] The chunk of data received during server streaming.
325
+ #
326
+ # @return [::Gapic::Rest::TransportOperation]
327
+ def execute_streaming_sql(request_pb, options = nil, &)
328
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
329
+
330
+ verb, uri, query_string_params, body = ServiceStub.transcode_execute_streaming_sql_request request_pb
331
+ query_string_params = if query_string_params.any?
332
+ query_string_params.to_h { |p| p.split "=", 2 }
333
+ else
334
+ {}
335
+ end
336
+
337
+ response = @client_stub.make_http_request(
338
+ verb,
339
+ uri: uri,
340
+ body: body || "",
341
+ params: query_string_params,
342
+ method_name: "execute_streaming_sql",
343
+ options: options,
344
+ is_server_streaming: true,
345
+ &
346
+ )
347
+ ::Gapic::Rest::TransportOperation.new response
348
+ end
349
+
350
+ ##
351
+ # Baseline implementation for the execute_batch_dml REST call
352
+ #
353
+ # @param request_pb [::Google::Cloud::Spanner::V1::ExecuteBatchDmlRequest]
354
+ # A request object representing the call parameters. Required.
355
+ # @param options [::Gapic::CallOptions]
356
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
357
+ #
358
+ # @yield [result, operation] Access the result along with the TransportOperation object
359
+ # @yieldparam result [::Google::Cloud::Spanner::V1::ExecuteBatchDmlResponse]
360
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
361
+ #
362
+ # @return [::Google::Cloud::Spanner::V1::ExecuteBatchDmlResponse]
363
+ # A result object deserialized from the server's reply
364
+ def execute_batch_dml request_pb, options = nil
365
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
366
+
367
+ verb, uri, query_string_params, body = ServiceStub.transcode_execute_batch_dml_request request_pb
368
+ query_string_params = if query_string_params.any?
369
+ query_string_params.to_h { |p| p.split "=", 2 }
370
+ else
371
+ {}
372
+ end
373
+
374
+ response = @client_stub.make_http_request(
375
+ verb,
376
+ uri: uri,
377
+ body: body || "",
378
+ params: query_string_params,
379
+ method_name: "execute_batch_dml",
380
+ options: options
381
+ )
382
+ operation = ::Gapic::Rest::TransportOperation.new response
383
+ result = ::Google::Cloud::Spanner::V1::ExecuteBatchDmlResponse.decode_json response.body, ignore_unknown_fields: true
384
+ catch :response do
385
+ yield result, operation if block_given?
386
+ result
387
+ end
388
+ end
389
+
390
+ ##
391
+ # Baseline implementation for the read REST call
392
+ #
393
+ # @param request_pb [::Google::Cloud::Spanner::V1::ReadRequest]
394
+ # A request object representing the call parameters. Required.
395
+ # @param options [::Gapic::CallOptions]
396
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
397
+ #
398
+ # @yield [result, operation] Access the result along with the TransportOperation object
399
+ # @yieldparam result [::Google::Cloud::Spanner::V1::ResultSet]
400
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
401
+ #
402
+ # @return [::Google::Cloud::Spanner::V1::ResultSet]
403
+ # A result object deserialized from the server's reply
404
+ def read request_pb, options = nil
405
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
406
+
407
+ verb, uri, query_string_params, body = ServiceStub.transcode_read_request request_pb
408
+ query_string_params = if query_string_params.any?
409
+ query_string_params.to_h { |p| p.split "=", 2 }
410
+ else
411
+ {}
412
+ end
413
+
414
+ response = @client_stub.make_http_request(
415
+ verb,
416
+ uri: uri,
417
+ body: body || "",
418
+ params: query_string_params,
419
+ method_name: "read",
420
+ options: options
421
+ )
422
+ operation = ::Gapic::Rest::TransportOperation.new response
423
+ result = ::Google::Cloud::Spanner::V1::ResultSet.decode_json response.body, ignore_unknown_fields: true
424
+ catch :response do
425
+ yield result, operation if block_given?
426
+ result
427
+ end
428
+ end
429
+
430
+ ##
431
+ # Baseline implementation for the streaming_read REST call
432
+ #
433
+ # @param request_pb [::Google::Cloud::Spanner::V1::ReadRequest]
434
+ # A request object representing the call parameters. Required.
435
+ # @param options [::Gapic::CallOptions]
436
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
437
+ #
438
+ # @yieldparam chunk [::String] The chunk of data received during server streaming.
439
+ #
440
+ # @return [::Gapic::Rest::TransportOperation]
441
+ def streaming_read(request_pb, options = nil, &)
442
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
443
+
444
+ verb, uri, query_string_params, body = ServiceStub.transcode_streaming_read_request request_pb
445
+ query_string_params = if query_string_params.any?
446
+ query_string_params.to_h { |p| p.split "=", 2 }
447
+ else
448
+ {}
449
+ end
450
+
451
+ response = @client_stub.make_http_request(
452
+ verb,
453
+ uri: uri,
454
+ body: body || "",
455
+ params: query_string_params,
456
+ method_name: "streaming_read",
457
+ options: options,
458
+ is_server_streaming: true,
459
+ &
460
+ )
461
+ ::Gapic::Rest::TransportOperation.new response
462
+ end
463
+
464
+ ##
465
+ # Baseline implementation for the begin_transaction REST call
466
+ #
467
+ # @param request_pb [::Google::Cloud::Spanner::V1::BeginTransactionRequest]
468
+ # A request object representing the call parameters. Required.
469
+ # @param options [::Gapic::CallOptions]
470
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
471
+ #
472
+ # @yield [result, operation] Access the result along with the TransportOperation object
473
+ # @yieldparam result [::Google::Cloud::Spanner::V1::Transaction]
474
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
475
+ #
476
+ # @return [::Google::Cloud::Spanner::V1::Transaction]
477
+ # A result object deserialized from the server's reply
478
+ def begin_transaction request_pb, options = nil
479
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
480
+
481
+ verb, uri, query_string_params, body = ServiceStub.transcode_begin_transaction_request request_pb
482
+ query_string_params = if query_string_params.any?
483
+ query_string_params.to_h { |p| p.split "=", 2 }
484
+ else
485
+ {}
486
+ end
487
+
488
+ response = @client_stub.make_http_request(
489
+ verb,
490
+ uri: uri,
491
+ body: body || "",
492
+ params: query_string_params,
493
+ method_name: "begin_transaction",
494
+ options: options
495
+ )
496
+ operation = ::Gapic::Rest::TransportOperation.new response
497
+ result = ::Google::Cloud::Spanner::V1::Transaction.decode_json response.body, ignore_unknown_fields: true
498
+ catch :response do
499
+ yield result, operation if block_given?
500
+ result
501
+ end
502
+ end
503
+
504
+ ##
505
+ # Baseline implementation for the commit REST call
506
+ #
507
+ # @param request_pb [::Google::Cloud::Spanner::V1::CommitRequest]
508
+ # A request object representing the call parameters. Required.
509
+ # @param options [::Gapic::CallOptions]
510
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
511
+ #
512
+ # @yield [result, operation] Access the result along with the TransportOperation object
513
+ # @yieldparam result [::Google::Cloud::Spanner::V1::CommitResponse]
514
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
515
+ #
516
+ # @return [::Google::Cloud::Spanner::V1::CommitResponse]
517
+ # A result object deserialized from the server's reply
518
+ def commit request_pb, options = nil
519
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
520
+
521
+ verb, uri, query_string_params, body = ServiceStub.transcode_commit_request request_pb
522
+ query_string_params = if query_string_params.any?
523
+ query_string_params.to_h { |p| p.split "=", 2 }
524
+ else
525
+ {}
526
+ end
527
+
528
+ response = @client_stub.make_http_request(
529
+ verb,
530
+ uri: uri,
531
+ body: body || "",
532
+ params: query_string_params,
533
+ method_name: "commit",
534
+ options: options
535
+ )
536
+ operation = ::Gapic::Rest::TransportOperation.new response
537
+ result = ::Google::Cloud::Spanner::V1::CommitResponse.decode_json response.body, ignore_unknown_fields: true
538
+ catch :response do
539
+ yield result, operation if block_given?
540
+ result
541
+ end
542
+ end
543
+
544
+ ##
545
+ # Baseline implementation for the rollback REST call
546
+ #
547
+ # @param request_pb [::Google::Cloud::Spanner::V1::RollbackRequest]
548
+ # A request object representing the call parameters. Required.
549
+ # @param options [::Gapic::CallOptions]
550
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
551
+ #
552
+ # @yield [result, operation] Access the result along with the TransportOperation object
553
+ # @yieldparam result [::Google::Protobuf::Empty]
554
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
555
+ #
556
+ # @return [::Google::Protobuf::Empty]
557
+ # A result object deserialized from the server's reply
558
+ def rollback request_pb, options = nil
559
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
560
+
561
+ verb, uri, query_string_params, body = ServiceStub.transcode_rollback_request request_pb
562
+ query_string_params = if query_string_params.any?
563
+ query_string_params.to_h { |p| p.split "=", 2 }
564
+ else
565
+ {}
566
+ end
567
+
568
+ response = @client_stub.make_http_request(
569
+ verb,
570
+ uri: uri,
571
+ body: body || "",
572
+ params: query_string_params,
573
+ method_name: "rollback",
574
+ options: options
575
+ )
576
+ operation = ::Gapic::Rest::TransportOperation.new response
577
+ result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
578
+ catch :response do
579
+ yield result, operation if block_given?
580
+ result
581
+ end
582
+ end
583
+
584
+ ##
585
+ # Baseline implementation for the partition_query REST call
586
+ #
587
+ # @param request_pb [::Google::Cloud::Spanner::V1::PartitionQueryRequest]
588
+ # A request object representing the call parameters. Required.
589
+ # @param options [::Gapic::CallOptions]
590
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
591
+ #
592
+ # @yield [result, operation] Access the result along with the TransportOperation object
593
+ # @yieldparam result [::Google::Cloud::Spanner::V1::PartitionResponse]
594
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
595
+ #
596
+ # @return [::Google::Cloud::Spanner::V1::PartitionResponse]
597
+ # A result object deserialized from the server's reply
598
+ def partition_query request_pb, options = nil
599
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
600
+
601
+ verb, uri, query_string_params, body = ServiceStub.transcode_partition_query_request request_pb
602
+ query_string_params = if query_string_params.any?
603
+ query_string_params.to_h { |p| p.split "=", 2 }
604
+ else
605
+ {}
606
+ end
607
+
608
+ response = @client_stub.make_http_request(
609
+ verb,
610
+ uri: uri,
611
+ body: body || "",
612
+ params: query_string_params,
613
+ method_name: "partition_query",
614
+ options: options
615
+ )
616
+ operation = ::Gapic::Rest::TransportOperation.new response
617
+ result = ::Google::Cloud::Spanner::V1::PartitionResponse.decode_json response.body, ignore_unknown_fields: true
618
+ catch :response do
619
+ yield result, operation if block_given?
620
+ result
621
+ end
622
+ end
623
+
624
+ ##
625
+ # Baseline implementation for the partition_read REST call
626
+ #
627
+ # @param request_pb [::Google::Cloud::Spanner::V1::PartitionReadRequest]
628
+ # A request object representing the call parameters. Required.
629
+ # @param options [::Gapic::CallOptions]
630
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
631
+ #
632
+ # @yield [result, operation] Access the result along with the TransportOperation object
633
+ # @yieldparam result [::Google::Cloud::Spanner::V1::PartitionResponse]
634
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
635
+ #
636
+ # @return [::Google::Cloud::Spanner::V1::PartitionResponse]
637
+ # A result object deserialized from the server's reply
638
+ def partition_read request_pb, options = nil
639
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
640
+
641
+ verb, uri, query_string_params, body = ServiceStub.transcode_partition_read_request request_pb
642
+ query_string_params = if query_string_params.any?
643
+ query_string_params.to_h { |p| p.split "=", 2 }
644
+ else
645
+ {}
646
+ end
647
+
648
+ response = @client_stub.make_http_request(
649
+ verb,
650
+ uri: uri,
651
+ body: body || "",
652
+ params: query_string_params,
653
+ method_name: "partition_read",
654
+ options: options
655
+ )
656
+ operation = ::Gapic::Rest::TransportOperation.new response
657
+ result = ::Google::Cloud::Spanner::V1::PartitionResponse.decode_json response.body, ignore_unknown_fields: true
658
+ catch :response do
659
+ yield result, operation if block_given?
660
+ result
661
+ end
662
+ end
663
+
664
+ ##
665
+ # Baseline implementation for the batch_write REST call
666
+ #
667
+ # @param request_pb [::Google::Cloud::Spanner::V1::BatchWriteRequest]
668
+ # A request object representing the call parameters. Required.
669
+ # @param options [::Gapic::CallOptions]
670
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
671
+ #
672
+ # @yieldparam chunk [::String] The chunk of data received during server streaming.
673
+ #
674
+ # @return [::Gapic::Rest::TransportOperation]
675
+ def batch_write(request_pb, options = nil, &)
676
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
677
+
678
+ verb, uri, query_string_params, body = ServiceStub.transcode_batch_write_request request_pb
679
+ query_string_params = if query_string_params.any?
680
+ query_string_params.to_h { |p| p.split "=", 2 }
681
+ else
682
+ {}
683
+ end
684
+
685
+ response = @client_stub.make_http_request(
686
+ verb,
687
+ uri: uri,
688
+ body: body || "",
689
+ params: query_string_params,
690
+ method_name: "batch_write",
691
+ options: options,
692
+ is_server_streaming: true,
693
+ &
694
+ )
695
+ ::Gapic::Rest::TransportOperation.new response
696
+ end
697
+
698
+ ##
699
+ # Baseline implementation for the fetch_cache_update REST call
700
+ #
701
+ # @param request_pb [::Google::Cloud::Spanner::V1::FetchCacheUpdateRequest]
702
+ # A request object representing the call parameters. Required.
703
+ # @param options [::Gapic::CallOptions]
704
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
705
+ #
706
+ # @yieldparam chunk [::String] The chunk of data received during server streaming.
707
+ #
708
+ # @return [::Gapic::Rest::TransportOperation]
709
+ def fetch_cache_update(request_pb, options = nil, &)
710
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
711
+
712
+ verb, uri, query_string_params, body = ServiceStub.transcode_fetch_cache_update_request request_pb
713
+ query_string_params = if query_string_params.any?
714
+ query_string_params.to_h { |p| p.split "=", 2 }
715
+ else
716
+ {}
717
+ end
718
+
719
+ response = @client_stub.make_http_request(
720
+ verb,
721
+ uri: uri,
722
+ body: body || "",
723
+ params: query_string_params,
724
+ method_name: "fetch_cache_update",
725
+ options: options,
726
+ is_server_streaming: true,
727
+ &
728
+ )
729
+ ::Gapic::Rest::TransportOperation.new response
730
+ end
731
+
732
+ ##
733
+ # @private
734
+ #
735
+ # GRPC transcoding helper method for the create_session REST call
736
+ #
737
+ # @param request_pb [::Google::Cloud::Spanner::V1::CreateSessionRequest]
738
+ # A request object representing the call parameters. Required.
739
+ # @return [Array(String, [String, nil], Hash{String => String})]
740
+ # Uri, Body, Query string parameters
741
+ def self.transcode_create_session_request request_pb
742
+ transcoder = Gapic::Rest::GrpcTranscoder.new
743
+ .with_bindings(
744
+ uri_method: :post,
745
+ uri_template: "/v1/{database}/sessions",
746
+ body: "*",
747
+ matches: [
748
+ ["database", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/?$}, false]
749
+ ]
750
+ )
751
+ transcoder.transcode request_pb
752
+ end
753
+
754
+ ##
755
+ # @private
756
+ #
757
+ # GRPC transcoding helper method for the batch_create_sessions REST call
758
+ #
759
+ # @param request_pb [::Google::Cloud::Spanner::V1::BatchCreateSessionsRequest]
760
+ # A request object representing the call parameters. Required.
761
+ # @return [Array(String, [String, nil], Hash{String => String})]
762
+ # Uri, Body, Query string parameters
763
+ def self.transcode_batch_create_sessions_request request_pb
764
+ transcoder = Gapic::Rest::GrpcTranscoder.new
765
+ .with_bindings(
766
+ uri_method: :post,
767
+ uri_template: "/v1/{database}/sessions:batchCreate",
768
+ body: "*",
769
+ matches: [
770
+ ["database", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/?$}, false]
771
+ ]
772
+ )
773
+ transcoder.transcode request_pb
774
+ end
775
+
776
+ ##
777
+ # @private
778
+ #
779
+ # GRPC transcoding helper method for the get_session REST call
780
+ #
781
+ # @param request_pb [::Google::Cloud::Spanner::V1::GetSessionRequest]
782
+ # A request object representing the call parameters. Required.
783
+ # @return [Array(String, [String, nil], Hash{String => String})]
784
+ # Uri, Body, Query string parameters
785
+ def self.transcode_get_session_request request_pb
786
+ transcoder = Gapic::Rest::GrpcTranscoder.new
787
+ .with_bindings(
788
+ uri_method: :get,
789
+ uri_template: "/v1/{name}",
790
+ matches: [
791
+ ["name", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+/?$}, false]
792
+ ]
793
+ )
794
+ transcoder.transcode request_pb
795
+ end
796
+
797
+ ##
798
+ # @private
799
+ #
800
+ # GRPC transcoding helper method for the list_sessions REST call
801
+ #
802
+ # @param request_pb [::Google::Cloud::Spanner::V1::ListSessionsRequest]
803
+ # A request object representing the call parameters. Required.
804
+ # @return [Array(String, [String, nil], Hash{String => String})]
805
+ # Uri, Body, Query string parameters
806
+ def self.transcode_list_sessions_request request_pb
807
+ transcoder = Gapic::Rest::GrpcTranscoder.new
808
+ .with_bindings(
809
+ uri_method: :get,
810
+ uri_template: "/v1/{database}/sessions",
811
+ matches: [
812
+ ["database", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/?$}, false]
813
+ ]
814
+ )
815
+ transcoder.transcode request_pb
816
+ end
817
+
818
+ ##
819
+ # @private
820
+ #
821
+ # GRPC transcoding helper method for the delete_session REST call
822
+ #
823
+ # @param request_pb [::Google::Cloud::Spanner::V1::DeleteSessionRequest]
824
+ # A request object representing the call parameters. Required.
825
+ # @return [Array(String, [String, nil], Hash{String => String})]
826
+ # Uri, Body, Query string parameters
827
+ def self.transcode_delete_session_request request_pb
828
+ transcoder = Gapic::Rest::GrpcTranscoder.new
829
+ .with_bindings(
830
+ uri_method: :delete,
831
+ uri_template: "/v1/{name}",
832
+ matches: [
833
+ ["name", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+/?$}, false]
834
+ ]
835
+ )
836
+ transcoder.transcode request_pb
837
+ end
838
+
839
+ ##
840
+ # @private
841
+ #
842
+ # GRPC transcoding helper method for the execute_sql REST call
843
+ #
844
+ # @param request_pb [::Google::Cloud::Spanner::V1::ExecuteSqlRequest]
845
+ # A request object representing the call parameters. Required.
846
+ # @return [Array(String, [String, nil], Hash{String => String})]
847
+ # Uri, Body, Query string parameters
848
+ def self.transcode_execute_sql_request request_pb
849
+ transcoder = Gapic::Rest::GrpcTranscoder.new
850
+ .with_bindings(
851
+ uri_method: :post,
852
+ uri_template: "/v1/{session}:executeSql",
853
+ body: "*",
854
+ matches: [
855
+ ["session", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+/?$}, false]
856
+ ]
857
+ )
858
+ transcoder.transcode request_pb
859
+ end
860
+
861
+ ##
862
+ # @private
863
+ #
864
+ # GRPC transcoding helper method for the execute_streaming_sql REST call
865
+ #
866
+ # @param request_pb [::Google::Cloud::Spanner::V1::ExecuteSqlRequest]
867
+ # A request object representing the call parameters. Required.
868
+ # @return [Array(String, [String, nil], Hash{String => String})]
869
+ # Uri, Body, Query string parameters
870
+ def self.transcode_execute_streaming_sql_request request_pb
871
+ transcoder = Gapic::Rest::GrpcTranscoder.new
872
+ .with_bindings(
873
+ uri_method: :post,
874
+ uri_template: "/v1/{session}:executeStreamingSql",
875
+ body: "*",
876
+ matches: [
877
+ ["session", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+/?$}, false]
878
+ ]
879
+ )
880
+ transcoder.transcode request_pb
881
+ end
882
+
883
+ ##
884
+ # @private
885
+ #
886
+ # GRPC transcoding helper method for the execute_batch_dml REST call
887
+ #
888
+ # @param request_pb [::Google::Cloud::Spanner::V1::ExecuteBatchDmlRequest]
889
+ # A request object representing the call parameters. Required.
890
+ # @return [Array(String, [String, nil], Hash{String => String})]
891
+ # Uri, Body, Query string parameters
892
+ def self.transcode_execute_batch_dml_request request_pb
893
+ transcoder = Gapic::Rest::GrpcTranscoder.new
894
+ .with_bindings(
895
+ uri_method: :post,
896
+ uri_template: "/v1/{session}:executeBatchDml",
897
+ body: "*",
898
+ matches: [
899
+ ["session", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+/?$}, false]
900
+ ]
901
+ )
902
+ transcoder.transcode request_pb
903
+ end
904
+
905
+ ##
906
+ # @private
907
+ #
908
+ # GRPC transcoding helper method for the read REST call
909
+ #
910
+ # @param request_pb [::Google::Cloud::Spanner::V1::ReadRequest]
911
+ # A request object representing the call parameters. Required.
912
+ # @return [Array(String, [String, nil], Hash{String => String})]
913
+ # Uri, Body, Query string parameters
914
+ def self.transcode_read_request request_pb
915
+ transcoder = Gapic::Rest::GrpcTranscoder.new
916
+ .with_bindings(
917
+ uri_method: :post,
918
+ uri_template: "/v1/{session}:read",
919
+ body: "*",
920
+ matches: [
921
+ ["session", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+/?$}, false]
922
+ ]
923
+ )
924
+ transcoder.transcode request_pb
925
+ end
926
+
927
+ ##
928
+ # @private
929
+ #
930
+ # GRPC transcoding helper method for the streaming_read REST call
931
+ #
932
+ # @param request_pb [::Google::Cloud::Spanner::V1::ReadRequest]
933
+ # A request object representing the call parameters. Required.
934
+ # @return [Array(String, [String, nil], Hash{String => String})]
935
+ # Uri, Body, Query string parameters
936
+ def self.transcode_streaming_read_request request_pb
937
+ transcoder = Gapic::Rest::GrpcTranscoder.new
938
+ .with_bindings(
939
+ uri_method: :post,
940
+ uri_template: "/v1/{session}:streamingRead",
941
+ body: "*",
942
+ matches: [
943
+ ["session", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+/?$}, false]
944
+ ]
945
+ )
946
+ transcoder.transcode request_pb
947
+ end
948
+
949
+ ##
950
+ # @private
951
+ #
952
+ # GRPC transcoding helper method for the begin_transaction REST call
953
+ #
954
+ # @param request_pb [::Google::Cloud::Spanner::V1::BeginTransactionRequest]
955
+ # A request object representing the call parameters. Required.
956
+ # @return [Array(String, [String, nil], Hash{String => String})]
957
+ # Uri, Body, Query string parameters
958
+ def self.transcode_begin_transaction_request request_pb
959
+ transcoder = Gapic::Rest::GrpcTranscoder.new
960
+ .with_bindings(
961
+ uri_method: :post,
962
+ uri_template: "/v1/{session}:beginTransaction",
963
+ body: "*",
964
+ matches: [
965
+ ["session", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+/?$}, false]
966
+ ]
967
+ )
968
+ transcoder.transcode request_pb
969
+ end
970
+
971
+ ##
972
+ # @private
973
+ #
974
+ # GRPC transcoding helper method for the commit REST call
975
+ #
976
+ # @param request_pb [::Google::Cloud::Spanner::V1::CommitRequest]
977
+ # A request object representing the call parameters. Required.
978
+ # @return [Array(String, [String, nil], Hash{String => String})]
979
+ # Uri, Body, Query string parameters
980
+ def self.transcode_commit_request request_pb
981
+ transcoder = Gapic::Rest::GrpcTranscoder.new
982
+ .with_bindings(
983
+ uri_method: :post,
984
+ uri_template: "/v1/{session}:commit",
985
+ body: "*",
986
+ matches: [
987
+ ["session", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+/?$}, false]
988
+ ]
989
+ )
990
+ transcoder.transcode request_pb
991
+ end
992
+
993
+ ##
994
+ # @private
995
+ #
996
+ # GRPC transcoding helper method for the rollback REST call
997
+ #
998
+ # @param request_pb [::Google::Cloud::Spanner::V1::RollbackRequest]
999
+ # A request object representing the call parameters. Required.
1000
+ # @return [Array(String, [String, nil], Hash{String => String})]
1001
+ # Uri, Body, Query string parameters
1002
+ def self.transcode_rollback_request request_pb
1003
+ transcoder = Gapic::Rest::GrpcTranscoder.new
1004
+ .with_bindings(
1005
+ uri_method: :post,
1006
+ uri_template: "/v1/{session}:rollback",
1007
+ body: "*",
1008
+ matches: [
1009
+ ["session", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+/?$}, false]
1010
+ ]
1011
+ )
1012
+ transcoder.transcode request_pb
1013
+ end
1014
+
1015
+ ##
1016
+ # @private
1017
+ #
1018
+ # GRPC transcoding helper method for the partition_query REST call
1019
+ #
1020
+ # @param request_pb [::Google::Cloud::Spanner::V1::PartitionQueryRequest]
1021
+ # A request object representing the call parameters. Required.
1022
+ # @return [Array(String, [String, nil], Hash{String => String})]
1023
+ # Uri, Body, Query string parameters
1024
+ def self.transcode_partition_query_request request_pb
1025
+ transcoder = Gapic::Rest::GrpcTranscoder.new
1026
+ .with_bindings(
1027
+ uri_method: :post,
1028
+ uri_template: "/v1/{session}:partitionQuery",
1029
+ body: "*",
1030
+ matches: [
1031
+ ["session", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+/?$}, false]
1032
+ ]
1033
+ )
1034
+ transcoder.transcode request_pb
1035
+ end
1036
+
1037
+ ##
1038
+ # @private
1039
+ #
1040
+ # GRPC transcoding helper method for the partition_read REST call
1041
+ #
1042
+ # @param request_pb [::Google::Cloud::Spanner::V1::PartitionReadRequest]
1043
+ # A request object representing the call parameters. Required.
1044
+ # @return [Array(String, [String, nil], Hash{String => String})]
1045
+ # Uri, Body, Query string parameters
1046
+ def self.transcode_partition_read_request request_pb
1047
+ transcoder = Gapic::Rest::GrpcTranscoder.new
1048
+ .with_bindings(
1049
+ uri_method: :post,
1050
+ uri_template: "/v1/{session}:partitionRead",
1051
+ body: "*",
1052
+ matches: [
1053
+ ["session", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+/?$}, false]
1054
+ ]
1055
+ )
1056
+ transcoder.transcode request_pb
1057
+ end
1058
+
1059
+ ##
1060
+ # @private
1061
+ #
1062
+ # GRPC transcoding helper method for the batch_write REST call
1063
+ #
1064
+ # @param request_pb [::Google::Cloud::Spanner::V1::BatchWriteRequest]
1065
+ # A request object representing the call parameters. Required.
1066
+ # @return [Array(String, [String, nil], Hash{String => String})]
1067
+ # Uri, Body, Query string parameters
1068
+ def self.transcode_batch_write_request request_pb
1069
+ transcoder = Gapic::Rest::GrpcTranscoder.new
1070
+ .with_bindings(
1071
+ uri_method: :post,
1072
+ uri_template: "/v1/{session}:batchWrite",
1073
+ body: "*",
1074
+ matches: [
1075
+ ["session", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/sessions/[^/]+/?$}, false]
1076
+ ]
1077
+ )
1078
+ transcoder.transcode request_pb
1079
+ end
1080
+
1081
+ ##
1082
+ # @private
1083
+ #
1084
+ # GRPC transcoding helper method for the fetch_cache_update REST call
1085
+ #
1086
+ # @param request_pb [::Google::Cloud::Spanner::V1::FetchCacheUpdateRequest]
1087
+ # A request object representing the call parameters. Required.
1088
+ # @return [Array(String, [String, nil], Hash{String => String})]
1089
+ # Uri, Body, Query string parameters
1090
+ def self.transcode_fetch_cache_update_request request_pb
1091
+ transcoder = Gapic::Rest::GrpcTranscoder.new
1092
+ .with_bindings(
1093
+ uri_method: :post,
1094
+ uri_template: "/v1/{database}:cacheUpdate",
1095
+ body: "*",
1096
+ matches: [
1097
+ ["database", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/?$}, false]
1098
+ ]
1099
+ )
1100
+ transcoder.transcode request_pb
1101
+ end
1102
+ end
1103
+ end
1104
+ end
1105
+ end
1106
+ end
1107
+ end
1108
+ end