google-cloud-bigquery-reservation-v1 1.0.1 → 1.2.0

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.
@@ -31,7 +31,8 @@ module Google
31
31
  # including transcoding, making the REST call, and deserialing the response.
32
32
  #
33
33
  class ServiceStub
34
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
34
+ # @private
35
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
35
36
  # These require statements are intentionally placed here to initialize
36
37
  # the REST modules only when it's required.
37
38
  require "gapic/rest"
@@ -41,7 +42,9 @@ module Google
41
42
  universe_domain: universe_domain,
42
43
  credentials: credentials,
43
44
  numeric_enums: true,
44
- raise_faraday_errors: false
45
+ service_name: self.class,
46
+ raise_faraday_errors: false,
47
+ logger: logger
45
48
  end
46
49
 
47
50
  ##
@@ -62,6 +65,15 @@ module Google
62
65
  @client_stub.endpoint
63
66
  end
64
67
 
68
+ ##
69
+ # The logger used for request/response debug logging.
70
+ #
71
+ # @return [Logger]
72
+ #
73
+ def logger stub: false
74
+ stub ? @client_stub.stub_logger : @client_stub.logger
75
+ end
76
+
65
77
  ##
66
78
  # Baseline implementation for the create_reservation REST call
67
79
  #
@@ -88,16 +100,18 @@ module Google
88
100
 
89
101
  response = @client_stub.make_http_request(
90
102
  verb,
91
- uri: uri,
92
- body: body || "",
93
- params: query_string_params,
103
+ uri: uri,
104
+ body: body || "",
105
+ params: query_string_params,
106
+ method_name: "create_reservation",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Cloud::Bigquery::Reservation::V1::Reservation.decode_json response.body, ignore_unknown_fields: true
98
-
99
- yield result, operation if block_given?
100
- result
111
+ catch :response do
112
+ yield result, operation if block_given?
113
+ result
114
+ end
101
115
  end
102
116
 
103
117
  ##
@@ -126,16 +140,18 @@ module Google
126
140
 
127
141
  response = @client_stub.make_http_request(
128
142
  verb,
129
- uri: uri,
130
- body: body || "",
131
- params: query_string_params,
143
+ uri: uri,
144
+ body: body || "",
145
+ params: query_string_params,
146
+ method_name: "list_reservations",
132
147
  options: options
133
148
  )
134
149
  operation = ::Gapic::Rest::TransportOperation.new response
135
150
  result = ::Google::Cloud::Bigquery::Reservation::V1::ListReservationsResponse.decode_json response.body, ignore_unknown_fields: true
136
-
137
- yield result, operation if block_given?
138
- result
151
+ catch :response do
152
+ yield result, operation if block_given?
153
+ result
154
+ end
139
155
  end
140
156
 
141
157
  ##
@@ -164,16 +180,18 @@ module Google
164
180
 
165
181
  response = @client_stub.make_http_request(
166
182
  verb,
167
- uri: uri,
168
- body: body || "",
169
- params: query_string_params,
183
+ uri: uri,
184
+ body: body || "",
185
+ params: query_string_params,
186
+ method_name: "get_reservation",
170
187
  options: options
171
188
  )
172
189
  operation = ::Gapic::Rest::TransportOperation.new response
173
190
  result = ::Google::Cloud::Bigquery::Reservation::V1::Reservation.decode_json response.body, ignore_unknown_fields: true
174
-
175
- yield result, operation if block_given?
176
- result
191
+ catch :response do
192
+ yield result, operation if block_given?
193
+ result
194
+ end
177
195
  end
178
196
 
179
197
  ##
@@ -202,16 +220,18 @@ module Google
202
220
 
203
221
  response = @client_stub.make_http_request(
204
222
  verb,
205
- uri: uri,
206
- body: body || "",
207
- params: query_string_params,
223
+ uri: uri,
224
+ body: body || "",
225
+ params: query_string_params,
226
+ method_name: "delete_reservation",
208
227
  options: options
209
228
  )
210
229
  operation = ::Gapic::Rest::TransportOperation.new response
211
230
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
212
-
213
- yield result, operation if block_given?
214
- result
231
+ catch :response do
232
+ yield result, operation if block_given?
233
+ result
234
+ end
215
235
  end
216
236
 
217
237
  ##
@@ -240,16 +260,58 @@ module Google
240
260
 
241
261
  response = @client_stub.make_http_request(
242
262
  verb,
243
- uri: uri,
244
- body: body || "",
245
- params: query_string_params,
263
+ uri: uri,
264
+ body: body || "",
265
+ params: query_string_params,
266
+ method_name: "update_reservation",
246
267
  options: options
247
268
  )
248
269
  operation = ::Gapic::Rest::TransportOperation.new response
249
270
  result = ::Google::Cloud::Bigquery::Reservation::V1::Reservation.decode_json response.body, ignore_unknown_fields: true
271
+ catch :response do
272
+ yield result, operation if block_given?
273
+ result
274
+ end
275
+ end
276
+
277
+ ##
278
+ # Baseline implementation for the failover_reservation REST call
279
+ #
280
+ # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::FailoverReservationRequest]
281
+ # A request object representing the call parameters. Required.
282
+ # @param options [::Gapic::CallOptions]
283
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
284
+ #
285
+ # @yield [result, operation] Access the result along with the TransportOperation object
286
+ # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::Reservation]
287
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
288
+ #
289
+ # @return [::Google::Cloud::Bigquery::Reservation::V1::Reservation]
290
+ # A result object deserialized from the server's reply
291
+ def failover_reservation request_pb, options = nil
292
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
293
+
294
+ verb, uri, query_string_params, body = ServiceStub.transcode_failover_reservation_request request_pb
295
+ query_string_params = if query_string_params.any?
296
+ query_string_params.to_h { |p| p.split "=", 2 }
297
+ else
298
+ {}
299
+ end
250
300
 
251
- yield result, operation if block_given?
252
- result
301
+ response = @client_stub.make_http_request(
302
+ verb,
303
+ uri: uri,
304
+ body: body || "",
305
+ params: query_string_params,
306
+ method_name: "failover_reservation",
307
+ options: options
308
+ )
309
+ operation = ::Gapic::Rest::TransportOperation.new response
310
+ result = ::Google::Cloud::Bigquery::Reservation::V1::Reservation.decode_json response.body, ignore_unknown_fields: true
311
+ catch :response do
312
+ yield result, operation if block_given?
313
+ result
314
+ end
253
315
  end
254
316
 
255
317
  ##
@@ -278,16 +340,18 @@ module Google
278
340
 
279
341
  response = @client_stub.make_http_request(
280
342
  verb,
281
- uri: uri,
282
- body: body || "",
283
- params: query_string_params,
343
+ uri: uri,
344
+ body: body || "",
345
+ params: query_string_params,
346
+ method_name: "create_capacity_commitment",
284
347
  options: options
285
348
  )
286
349
  operation = ::Gapic::Rest::TransportOperation.new response
287
350
  result = ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment.decode_json response.body, ignore_unknown_fields: true
288
-
289
- yield result, operation if block_given?
290
- result
351
+ catch :response do
352
+ yield result, operation if block_given?
353
+ result
354
+ end
291
355
  end
292
356
 
293
357
  ##
@@ -316,16 +380,18 @@ module Google
316
380
 
317
381
  response = @client_stub.make_http_request(
318
382
  verb,
319
- uri: uri,
320
- body: body || "",
321
- params: query_string_params,
383
+ uri: uri,
384
+ body: body || "",
385
+ params: query_string_params,
386
+ method_name: "list_capacity_commitments",
322
387
  options: options
323
388
  )
324
389
  operation = ::Gapic::Rest::TransportOperation.new response
325
390
  result = ::Google::Cloud::Bigquery::Reservation::V1::ListCapacityCommitmentsResponse.decode_json response.body, ignore_unknown_fields: true
326
-
327
- yield result, operation if block_given?
328
- result
391
+ catch :response do
392
+ yield result, operation if block_given?
393
+ result
394
+ end
329
395
  end
330
396
 
331
397
  ##
@@ -354,16 +420,18 @@ module Google
354
420
 
355
421
  response = @client_stub.make_http_request(
356
422
  verb,
357
- uri: uri,
358
- body: body || "",
359
- params: query_string_params,
423
+ uri: uri,
424
+ body: body || "",
425
+ params: query_string_params,
426
+ method_name: "get_capacity_commitment",
360
427
  options: options
361
428
  )
362
429
  operation = ::Gapic::Rest::TransportOperation.new response
363
430
  result = ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment.decode_json response.body, ignore_unknown_fields: true
364
-
365
- yield result, operation if block_given?
366
- result
431
+ catch :response do
432
+ yield result, operation if block_given?
433
+ result
434
+ end
367
435
  end
368
436
 
369
437
  ##
@@ -392,16 +460,18 @@ module Google
392
460
 
393
461
  response = @client_stub.make_http_request(
394
462
  verb,
395
- uri: uri,
396
- body: body || "",
397
- params: query_string_params,
463
+ uri: uri,
464
+ body: body || "",
465
+ params: query_string_params,
466
+ method_name: "delete_capacity_commitment",
398
467
  options: options
399
468
  )
400
469
  operation = ::Gapic::Rest::TransportOperation.new response
401
470
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
402
-
403
- yield result, operation if block_given?
404
- result
471
+ catch :response do
472
+ yield result, operation if block_given?
473
+ result
474
+ end
405
475
  end
406
476
 
407
477
  ##
@@ -430,16 +500,18 @@ module Google
430
500
 
431
501
  response = @client_stub.make_http_request(
432
502
  verb,
433
- uri: uri,
434
- body: body || "",
435
- params: query_string_params,
503
+ uri: uri,
504
+ body: body || "",
505
+ params: query_string_params,
506
+ method_name: "update_capacity_commitment",
436
507
  options: options
437
508
  )
438
509
  operation = ::Gapic::Rest::TransportOperation.new response
439
510
  result = ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment.decode_json response.body, ignore_unknown_fields: true
440
-
441
- yield result, operation if block_given?
442
- result
511
+ catch :response do
512
+ yield result, operation if block_given?
513
+ result
514
+ end
443
515
  end
444
516
 
445
517
  ##
@@ -468,16 +540,18 @@ module Google
468
540
 
469
541
  response = @client_stub.make_http_request(
470
542
  verb,
471
- uri: uri,
472
- body: body || "",
473
- params: query_string_params,
543
+ uri: uri,
544
+ body: body || "",
545
+ params: query_string_params,
546
+ method_name: "split_capacity_commitment",
474
547
  options: options
475
548
  )
476
549
  operation = ::Gapic::Rest::TransportOperation.new response
477
550
  result = ::Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentResponse.decode_json response.body, ignore_unknown_fields: true
478
-
479
- yield result, operation if block_given?
480
- result
551
+ catch :response do
552
+ yield result, operation if block_given?
553
+ result
554
+ end
481
555
  end
482
556
 
483
557
  ##
@@ -506,16 +580,18 @@ module Google
506
580
 
507
581
  response = @client_stub.make_http_request(
508
582
  verb,
509
- uri: uri,
510
- body: body || "",
511
- params: query_string_params,
583
+ uri: uri,
584
+ body: body || "",
585
+ params: query_string_params,
586
+ method_name: "merge_capacity_commitments",
512
587
  options: options
513
588
  )
514
589
  operation = ::Gapic::Rest::TransportOperation.new response
515
590
  result = ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment.decode_json response.body, ignore_unknown_fields: true
516
-
517
- yield result, operation if block_given?
518
- result
591
+ catch :response do
592
+ yield result, operation if block_given?
593
+ result
594
+ end
519
595
  end
520
596
 
521
597
  ##
@@ -544,16 +620,18 @@ module Google
544
620
 
545
621
  response = @client_stub.make_http_request(
546
622
  verb,
547
- uri: uri,
548
- body: body || "",
549
- params: query_string_params,
623
+ uri: uri,
624
+ body: body || "",
625
+ params: query_string_params,
626
+ method_name: "create_assignment",
550
627
  options: options
551
628
  )
552
629
  operation = ::Gapic::Rest::TransportOperation.new response
553
630
  result = ::Google::Cloud::Bigquery::Reservation::V1::Assignment.decode_json response.body, ignore_unknown_fields: true
554
-
555
- yield result, operation if block_given?
556
- result
631
+ catch :response do
632
+ yield result, operation if block_given?
633
+ result
634
+ end
557
635
  end
558
636
 
559
637
  ##
@@ -582,16 +660,18 @@ module Google
582
660
 
583
661
  response = @client_stub.make_http_request(
584
662
  verb,
585
- uri: uri,
586
- body: body || "",
587
- params: query_string_params,
663
+ uri: uri,
664
+ body: body || "",
665
+ params: query_string_params,
666
+ method_name: "list_assignments",
588
667
  options: options
589
668
  )
590
669
  operation = ::Gapic::Rest::TransportOperation.new response
591
670
  result = ::Google::Cloud::Bigquery::Reservation::V1::ListAssignmentsResponse.decode_json response.body, ignore_unknown_fields: true
592
-
593
- yield result, operation if block_given?
594
- result
671
+ catch :response do
672
+ yield result, operation if block_given?
673
+ result
674
+ end
595
675
  end
596
676
 
597
677
  ##
@@ -620,16 +700,18 @@ module Google
620
700
 
621
701
  response = @client_stub.make_http_request(
622
702
  verb,
623
- uri: uri,
624
- body: body || "",
625
- params: query_string_params,
703
+ uri: uri,
704
+ body: body || "",
705
+ params: query_string_params,
706
+ method_name: "delete_assignment",
626
707
  options: options
627
708
  )
628
709
  operation = ::Gapic::Rest::TransportOperation.new response
629
710
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
630
-
631
- yield result, operation if block_given?
632
- result
711
+ catch :response do
712
+ yield result, operation if block_given?
713
+ result
714
+ end
633
715
  end
634
716
 
635
717
  ##
@@ -658,16 +740,18 @@ module Google
658
740
 
659
741
  response = @client_stub.make_http_request(
660
742
  verb,
661
- uri: uri,
662
- body: body || "",
663
- params: query_string_params,
743
+ uri: uri,
744
+ body: body || "",
745
+ params: query_string_params,
746
+ method_name: "search_assignments",
664
747
  options: options
665
748
  )
666
749
  operation = ::Gapic::Rest::TransportOperation.new response
667
750
  result = ::Google::Cloud::Bigquery::Reservation::V1::SearchAssignmentsResponse.decode_json response.body, ignore_unknown_fields: true
668
-
669
- yield result, operation if block_given?
670
- result
751
+ catch :response do
752
+ yield result, operation if block_given?
753
+ result
754
+ end
671
755
  end
672
756
 
673
757
  ##
@@ -696,16 +780,18 @@ module Google
696
780
 
697
781
  response = @client_stub.make_http_request(
698
782
  verb,
699
- uri: uri,
700
- body: body || "",
701
- params: query_string_params,
783
+ uri: uri,
784
+ body: body || "",
785
+ params: query_string_params,
786
+ method_name: "search_all_assignments",
702
787
  options: options
703
788
  )
704
789
  operation = ::Gapic::Rest::TransportOperation.new response
705
790
  result = ::Google::Cloud::Bigquery::Reservation::V1::SearchAllAssignmentsResponse.decode_json response.body, ignore_unknown_fields: true
706
-
707
- yield result, operation if block_given?
708
- result
791
+ catch :response do
792
+ yield result, operation if block_given?
793
+ result
794
+ end
709
795
  end
710
796
 
711
797
  ##
@@ -734,16 +820,18 @@ module Google
734
820
 
735
821
  response = @client_stub.make_http_request(
736
822
  verb,
737
- uri: uri,
738
- body: body || "",
739
- params: query_string_params,
823
+ uri: uri,
824
+ body: body || "",
825
+ params: query_string_params,
826
+ method_name: "move_assignment",
740
827
  options: options
741
828
  )
742
829
  operation = ::Gapic::Rest::TransportOperation.new response
743
830
  result = ::Google::Cloud::Bigquery::Reservation::V1::Assignment.decode_json response.body, ignore_unknown_fields: true
744
-
745
- yield result, operation if block_given?
746
- result
831
+ catch :response do
832
+ yield result, operation if block_given?
833
+ result
834
+ end
747
835
  end
748
836
 
749
837
  ##
@@ -772,16 +860,18 @@ module Google
772
860
 
773
861
  response = @client_stub.make_http_request(
774
862
  verb,
775
- uri: uri,
776
- body: body || "",
777
- params: query_string_params,
863
+ uri: uri,
864
+ body: body || "",
865
+ params: query_string_params,
866
+ method_name: "update_assignment",
778
867
  options: options
779
868
  )
780
869
  operation = ::Gapic::Rest::TransportOperation.new response
781
870
  result = ::Google::Cloud::Bigquery::Reservation::V1::Assignment.decode_json response.body, ignore_unknown_fields: true
782
-
783
- yield result, operation if block_given?
784
- result
871
+ catch :response do
872
+ yield result, operation if block_given?
873
+ result
874
+ end
785
875
  end
786
876
 
787
877
  ##
@@ -810,16 +900,18 @@ module Google
810
900
 
811
901
  response = @client_stub.make_http_request(
812
902
  verb,
813
- uri: uri,
814
- body: body || "",
815
- params: query_string_params,
903
+ uri: uri,
904
+ body: body || "",
905
+ params: query_string_params,
906
+ method_name: "get_bi_reservation",
816
907
  options: options
817
908
  )
818
909
  operation = ::Gapic::Rest::TransportOperation.new response
819
910
  result = ::Google::Cloud::Bigquery::Reservation::V1::BiReservation.decode_json response.body, ignore_unknown_fields: true
820
-
821
- yield result, operation if block_given?
822
- result
911
+ catch :response do
912
+ yield result, operation if block_given?
913
+ result
914
+ end
823
915
  end
824
916
 
825
917
  ##
@@ -848,16 +940,18 @@ module Google
848
940
 
849
941
  response = @client_stub.make_http_request(
850
942
  verb,
851
- uri: uri,
852
- body: body || "",
853
- params: query_string_params,
943
+ uri: uri,
944
+ body: body || "",
945
+ params: query_string_params,
946
+ method_name: "update_bi_reservation",
854
947
  options: options
855
948
  )
856
949
  operation = ::Gapic::Rest::TransportOperation.new response
857
950
  result = ::Google::Cloud::Bigquery::Reservation::V1::BiReservation.decode_json response.body, ignore_unknown_fields: true
858
-
859
- yield result, operation if block_given?
860
- result
951
+ catch :response do
952
+ yield result, operation if block_given?
953
+ result
954
+ end
861
955
  end
862
956
 
863
957
  ##
@@ -967,6 +1061,28 @@ module Google
967
1061
  transcoder.transcode request_pb
968
1062
  end
969
1063
 
1064
+ ##
1065
+ # @private
1066
+ #
1067
+ # GRPC transcoding helper method for the failover_reservation REST call
1068
+ #
1069
+ # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::FailoverReservationRequest]
1070
+ # A request object representing the call parameters. Required.
1071
+ # @return [Array(String, [String, nil], Hash{String => String})]
1072
+ # Uri, Body, Query string parameters
1073
+ def self.transcode_failover_reservation_request request_pb
1074
+ transcoder = Gapic::Rest::GrpcTranscoder.new
1075
+ .with_bindings(
1076
+ uri_method: :post,
1077
+ uri_template: "/v1/{name}:failoverReservation",
1078
+ body: "*",
1079
+ matches: [
1080
+ ["name", %r{^projects/[^/]+/locations/[^/]+/reservations/[^/]+/?$}, false]
1081
+ ]
1082
+ )
1083
+ transcoder.transcode request_pb
1084
+ end
1085
+
970
1086
  ##
971
1087
  # @private
972
1088
  #
@@ -60,6 +60,12 @@ module Google
60
60
  rpc :DeleteReservation, ::Google::Cloud::Bigquery::Reservation::V1::DeleteReservationRequest, ::Google::Protobuf::Empty
61
61
  # Updates an existing reservation resource.
62
62
  rpc :UpdateReservation, ::Google::Cloud::Bigquery::Reservation::V1::UpdateReservationRequest, ::Google::Cloud::Bigquery::Reservation::V1::Reservation
63
+ # Fail over a reservation to the secondary location. The operation should be
64
+ # done in the current secondary location, which will be promoted to the
65
+ # new primary location for the reservation.
66
+ # Attempting to failover a reservation in the current primary location will
67
+ # fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.
68
+ rpc :FailoverReservation, ::Google::Cloud::Bigquery::Reservation::V1::FailoverReservationRequest, ::Google::Cloud::Bigquery::Reservation::V1::Reservation
63
69
  # Creates a new capacity commitment resource.
64
70
  rpc :CreateCapacityCommitment, ::Google::Cloud::Bigquery::Reservation::V1::CreateCapacityCommitmentRequest, ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment
65
71
  # Lists all the capacity commitments for the admin project.
@@ -22,7 +22,7 @@ module Google
22
22
  module Bigquery
23
23
  module Reservation
24
24
  module V1
25
- VERSION = "1.0.1"
25
+ VERSION = "1.2.0"
26
26
  end
27
27
  end
28
28
  end