google-cloud-datastream-v1 0.11.0 → 0.12.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.
@@ -184,15 +184,27 @@ module Google
184
184
  endpoint: @config.endpoint,
185
185
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
186
186
  universe_domain: @config.universe_domain,
187
- credentials: credentials
187
+ credentials: credentials,
188
+ logger: @config.logger
188
189
  )
189
190
 
191
+ @datastream_stub.logger(stub: true)&.info do |entry|
192
+ entry.set_system_name
193
+ entry.set_service
194
+ entry.message = "Created client for #{entry.service}"
195
+ entry.set_credentials_fields credentials
196
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
197
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
198
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
199
+ end
200
+
190
201
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
191
202
  config.credentials = credentials
192
203
  config.quota_project = @quota_project_id
193
204
  config.endpoint = @datastream_stub.endpoint
194
205
  config.universe_domain = @datastream_stub.universe_domain
195
206
  config.bindings_override = @config.bindings_override
207
+ config.logger = @datastream_stub.logger if config.respond_to? :logger=
196
208
  end
197
209
 
198
210
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
@@ -200,6 +212,7 @@ module Google
200
212
  config.quota_project = @quota_project_id
201
213
  config.endpoint = @datastream_stub.endpoint
202
214
  config.universe_domain = @datastream_stub.universe_domain
215
+ config.logger = @datastream_stub.logger if config.respond_to? :logger=
203
216
  end
204
217
  end
205
218
 
@@ -224,6 +237,15 @@ module Google
224
237
  #
225
238
  attr_reader :iam_policy_client
226
239
 
240
+ ##
241
+ # The logger used for request/response debug logging.
242
+ #
243
+ # @return [Logger]
244
+ #
245
+ def logger
246
+ @datastream_stub.logger
247
+ end
248
+
227
249
  # Service calls
228
250
 
229
251
  ##
@@ -318,7 +340,6 @@ module Google
318
340
 
319
341
  @datastream_stub.list_connection_profiles request, options do |result, operation|
320
342
  yield result, operation if block_given?
321
- return result
322
343
  end
323
344
  rescue ::Gapic::Rest::Error => e
324
345
  raise ::Google::Cloud::Error.from_error(e)
@@ -397,7 +418,6 @@ module Google
397
418
 
398
419
  @datastream_stub.get_connection_profile request, options do |result, operation|
399
420
  yield result, operation if block_given?
400
- return result
401
421
  end
402
422
  rescue ::Gapic::Rest::Error => e
403
423
  raise ::Google::Cloud::Error.from_error(e)
@@ -507,7 +527,7 @@ module Google
507
527
  @datastream_stub.create_connection_profile request, options do |result, operation|
508
528
  result = ::Gapic::Operation.new result, @operations_client, options: options
509
529
  yield result, operation if block_given?
510
- return result
530
+ throw :response, result
511
531
  end
512
532
  rescue ::Gapic::Rest::Error => e
513
533
  raise ::Google::Cloud::Error.from_error(e)
@@ -619,7 +639,7 @@ module Google
619
639
  @datastream_stub.update_connection_profile request, options do |result, operation|
620
640
  result = ::Gapic::Operation.new result, @operations_client, options: options
621
641
  yield result, operation if block_given?
622
- return result
642
+ throw :response, result
623
643
  end
624
644
  rescue ::Gapic::Rest::Error => e
625
645
  raise ::Google::Cloud::Error.from_error(e)
@@ -720,7 +740,7 @@ module Google
720
740
  @datastream_stub.delete_connection_profile request, options do |result, operation|
721
741
  result = ::Gapic::Operation.new result, @operations_client, options: options
722
742
  yield result, operation if block_given?
723
- return result
743
+ throw :response, result
724
744
  end
725
745
  rescue ::Gapic::Rest::Error => e
726
746
  raise ::Google::Cloud::Error.from_error(e)
@@ -820,7 +840,6 @@ module Google
820
840
 
821
841
  @datastream_stub.discover_connection_profile request, options do |result, operation|
822
842
  yield result, operation if block_given?
823
- return result
824
843
  end
825
844
  rescue ::Gapic::Rest::Error => e
826
845
  raise ::Google::Cloud::Error.from_error(e)
@@ -917,7 +936,6 @@ module Google
917
936
 
918
937
  @datastream_stub.list_streams request, options do |result, operation|
919
938
  yield result, operation if block_given?
920
- return result
921
939
  end
922
940
  rescue ::Gapic::Rest::Error => e
923
941
  raise ::Google::Cloud::Error.from_error(e)
@@ -996,7 +1014,6 @@ module Google
996
1014
 
997
1015
  @datastream_stub.get_stream request, options do |result, operation|
998
1016
  yield result, operation if block_given?
999
- return result
1000
1017
  end
1001
1018
  rescue ::Gapic::Rest::Error => e
1002
1019
  raise ::Google::Cloud::Error.from_error(e)
@@ -1106,7 +1123,7 @@ module Google
1106
1123
  @datastream_stub.create_stream request, options do |result, operation|
1107
1124
  result = ::Gapic::Operation.new result, @operations_client, options: options
1108
1125
  yield result, operation if block_given?
1109
- return result
1126
+ throw :response, result
1110
1127
  end
1111
1128
  rescue ::Gapic::Rest::Error => e
1112
1129
  raise ::Google::Cloud::Error.from_error(e)
@@ -1218,7 +1235,7 @@ module Google
1218
1235
  @datastream_stub.update_stream request, options do |result, operation|
1219
1236
  result = ::Gapic::Operation.new result, @operations_client, options: options
1220
1237
  yield result, operation if block_given?
1221
- return result
1238
+ throw :response, result
1222
1239
  end
1223
1240
  rescue ::Gapic::Rest::Error => e
1224
1241
  raise ::Google::Cloud::Error.from_error(e)
@@ -1319,7 +1336,7 @@ module Google
1319
1336
  @datastream_stub.delete_stream request, options do |result, operation|
1320
1337
  result = ::Gapic::Operation.new result, @operations_client, options: options
1321
1338
  yield result, operation if block_given?
1322
- return result
1339
+ throw :response, result
1323
1340
  end
1324
1341
  rescue ::Gapic::Rest::Error => e
1325
1342
  raise ::Google::Cloud::Error.from_error(e)
@@ -1413,7 +1430,7 @@ module Google
1413
1430
  @datastream_stub.run_stream request, options do |result, operation|
1414
1431
  result = ::Gapic::Operation.new result, @operations_client, options: options
1415
1432
  yield result, operation if block_given?
1416
- return result
1433
+ throw :response, result
1417
1434
  end
1418
1435
  rescue ::Gapic::Rest::Error => e
1419
1436
  raise ::Google::Cloud::Error.from_error(e)
@@ -1492,7 +1509,6 @@ module Google
1492
1509
 
1493
1510
  @datastream_stub.get_stream_object request, options do |result, operation|
1494
1511
  yield result, operation if block_given?
1495
- return result
1496
1512
  end
1497
1513
  rescue ::Gapic::Rest::Error => e
1498
1514
  raise ::Google::Cloud::Error.from_error(e)
@@ -1573,7 +1589,6 @@ module Google
1573
1589
 
1574
1590
  @datastream_stub.lookup_stream_object request, options do |result, operation|
1575
1591
  yield result, operation if block_given?
1576
- return result
1577
1592
  end
1578
1593
  rescue ::Gapic::Rest::Error => e
1579
1594
  raise ::Google::Cloud::Error.from_error(e)
@@ -1667,7 +1682,7 @@ module Google
1667
1682
  @datastream_stub.list_stream_objects request, options do |result, operation|
1668
1683
  result = ::Gapic::Rest::PagedEnumerable.new @datastream_stub, :list_stream_objects, "stream_objects", request, result, options
1669
1684
  yield result, operation if block_given?
1670
- return result
1685
+ throw :response, result
1671
1686
  end
1672
1687
  rescue ::Gapic::Rest::Error => e
1673
1688
  raise ::Google::Cloud::Error.from_error(e)
@@ -1747,7 +1762,6 @@ module Google
1747
1762
 
1748
1763
  @datastream_stub.start_backfill_job request, options do |result, operation|
1749
1764
  yield result, operation if block_given?
1750
- return result
1751
1765
  end
1752
1766
  rescue ::Gapic::Rest::Error => e
1753
1767
  raise ::Google::Cloud::Error.from_error(e)
@@ -1827,7 +1841,6 @@ module Google
1827
1841
 
1828
1842
  @datastream_stub.stop_backfill_job request, options do |result, operation|
1829
1843
  yield result, operation if block_given?
1830
- return result
1831
1844
  end
1832
1845
  rescue ::Gapic::Rest::Error => e
1833
1846
  raise ::Google::Cloud::Error.from_error(e)
@@ -1914,7 +1927,7 @@ module Google
1914
1927
  @datastream_stub.fetch_static_ips request, options do |result, operation|
1915
1928
  result = ::Gapic::Rest::PagedEnumerable.new @datastream_stub, :fetch_static_ips, "static_ips", request, result, options
1916
1929
  yield result, operation if block_given?
1917
- return result
1930
+ throw :response, result
1918
1931
  end
1919
1932
  rescue ::Gapic::Rest::Error => e
1920
1933
  raise ::Google::Cloud::Error.from_error(e)
@@ -2021,7 +2034,7 @@ module Google
2021
2034
  @datastream_stub.create_private_connection request, options do |result, operation|
2022
2035
  result = ::Gapic::Operation.new result, @operations_client, options: options
2023
2036
  yield result, operation if block_given?
2024
- return result
2037
+ throw :response, result
2025
2038
  end
2026
2039
  rescue ::Gapic::Rest::Error => e
2027
2040
  raise ::Google::Cloud::Error.from_error(e)
@@ -2100,7 +2113,6 @@ module Google
2100
2113
 
2101
2114
  @datastream_stub.get_private_connection request, options do |result, operation|
2102
2115
  yield result, operation if block_given?
2103
- return result
2104
2116
  end
2105
2117
  rescue ::Gapic::Rest::Error => e
2106
2118
  raise ::Google::Cloud::Error.from_error(e)
@@ -2201,7 +2213,6 @@ module Google
2201
2213
 
2202
2214
  @datastream_stub.list_private_connections request, options do |result, operation|
2203
2215
  yield result, operation if block_given?
2204
- return result
2205
2216
  end
2206
2217
  rescue ::Gapic::Rest::Error => e
2207
2218
  raise ::Google::Cloud::Error.from_error(e)
@@ -2305,7 +2316,7 @@ module Google
2305
2316
  @datastream_stub.delete_private_connection request, options do |result, operation|
2306
2317
  result = ::Gapic::Operation.new result, @operations_client, options: options
2307
2318
  yield result, operation if block_given?
2308
- return result
2319
+ throw :response, result
2309
2320
  end
2310
2321
  rescue ::Gapic::Rest::Error => e
2311
2322
  raise ::Google::Cloud::Error.from_error(e)
@@ -2411,7 +2422,7 @@ module Google
2411
2422
  @datastream_stub.create_route request, options do |result, operation|
2412
2423
  result = ::Gapic::Operation.new result, @operations_client, options: options
2413
2424
  yield result, operation if block_given?
2414
- return result
2425
+ throw :response, result
2415
2426
  end
2416
2427
  rescue ::Gapic::Rest::Error => e
2417
2428
  raise ::Google::Cloud::Error.from_error(e)
@@ -2490,7 +2501,6 @@ module Google
2490
2501
 
2491
2502
  @datastream_stub.get_route request, options do |result, operation|
2492
2503
  yield result, operation if block_given?
2493
- return result
2494
2504
  end
2495
2505
  rescue ::Gapic::Rest::Error => e
2496
2506
  raise ::Google::Cloud::Error.from_error(e)
@@ -2590,7 +2600,6 @@ module Google
2590
2600
 
2591
2601
  @datastream_stub.list_routes request, options do |result, operation|
2592
2602
  yield result, operation if block_given?
2593
- return result
2594
2603
  end
2595
2604
  rescue ::Gapic::Rest::Error => e
2596
2605
  raise ::Google::Cloud::Error.from_error(e)
@@ -2691,7 +2700,7 @@ module Google
2691
2700
  @datastream_stub.delete_route request, options do |result, operation|
2692
2701
  result = ::Gapic::Operation.new result, @operations_client, options: options
2693
2702
  yield result, operation if block_given?
2694
- return result
2703
+ throw :response, result
2695
2704
  end
2696
2705
  rescue ::Gapic::Rest::Error => e
2697
2706
  raise ::Google::Cloud::Error.from_error(e)
@@ -2771,6 +2780,11 @@ module Google
2771
2780
  # default endpoint URL. The default value of nil uses the environment
2772
2781
  # universe (usually the default "googleapis.com" universe).
2773
2782
  # @return [::String,nil]
2783
+ # @!attribute [rw] logger
2784
+ # A custom logger to use for request/response debug logging, or the value
2785
+ # `:default` (the default) to construct a default logger, or `nil` to
2786
+ # explicitly disable logging.
2787
+ # @return [::Logger,:default,nil]
2774
2788
  #
2775
2789
  class Configuration
2776
2790
  extend ::Gapic::Config
@@ -2799,6 +2813,7 @@ module Google
2799
2813
  # by the host service.
2800
2814
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
2801
2815
  config_attr :bindings_override, {}, ::Hash, nil
2816
+ config_attr :logger, :default, ::Logger, nil, :default
2802
2817
 
2803
2818
  # @private
2804
2819
  def initialize parent_config = nil
@@ -196,7 +196,7 @@ module Google
196
196
  @operations_stub.list_operations request, options do |result, operation|
197
197
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
198
198
  yield result, operation if block_given?
199
- return result
199
+ throw :response, result
200
200
  end
201
201
  rescue ::Gapic::Rest::Error => e
202
202
  raise ::Google::Cloud::Error.from_error(e)
@@ -285,7 +285,7 @@ module Google
285
285
  @operations_stub.get_operation request, options do |result, operation|
286
286
  result = ::Gapic::Operation.new result, @operations_client, options: options
287
287
  yield result, operation if block_given?
288
- return result
288
+ throw :response, result
289
289
  end
290
290
  rescue ::Gapic::Rest::Error => e
291
291
  raise ::Google::Cloud::Error.from_error(e)
@@ -367,7 +367,6 @@ module Google
367
367
 
368
368
  @operations_stub.delete_operation request, options do |result, operation|
369
369
  yield result, operation if block_given?
370
- return result
371
370
  end
372
371
  rescue ::Gapic::Rest::Error => e
373
372
  raise ::Google::Cloud::Error.from_error(e)
@@ -456,7 +455,6 @@ module Google
456
455
 
457
456
  @operations_stub.cancel_operation request, options do |result, operation|
458
457
  yield result, operation if block_given?
459
- return result
460
458
  end
461
459
  rescue ::Gapic::Rest::Error => e
462
460
  raise ::Google::Cloud::Error.from_error(e)
@@ -536,6 +534,11 @@ module Google
536
534
  # default endpoint URL. The default value of nil uses the environment
537
535
  # universe (usually the default "googleapis.com" universe).
538
536
  # @return [::String,nil]
537
+ # @!attribute [rw] logger
538
+ # A custom logger to use for request/response debug logging, or the value
539
+ # `:default` (the default) to construct a default logger, or `nil` to
540
+ # explicitly disable logging.
541
+ # @return [::Logger,:default,nil]
539
542
  #
540
543
  class Configuration
541
544
  extend ::Gapic::Config
@@ -557,6 +560,7 @@ module Google
557
560
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
558
561
  config_attr :quota_project, nil, ::String, nil
559
562
  config_attr :universe_domain, nil, ::String, nil
563
+ config_attr :logger, :default, ::Logger, nil, :default
560
564
 
561
565
  # @private
562
566
  def initialize parent_config = nil
@@ -676,16 +680,18 @@ module Google
676
680
 
677
681
  response = @client_stub.make_http_request(
678
682
  verb,
679
- uri: uri,
680
- body: body || "",
681
- params: query_string_params,
683
+ uri: uri,
684
+ body: body || "",
685
+ params: query_string_params,
686
+ method_name: "list_operations",
682
687
  options: options
683
688
  )
684
689
  operation = ::Gapic::Rest::TransportOperation.new response
685
690
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
686
-
687
- yield result, operation if block_given?
688
- result
691
+ catch :response do
692
+ yield result, operation if block_given?
693
+ result
694
+ end
689
695
  end
690
696
 
691
697
  ##
@@ -714,16 +720,18 @@ module Google
714
720
 
715
721
  response = @client_stub.make_http_request(
716
722
  verb,
717
- uri: uri,
718
- body: body || "",
719
- params: query_string_params,
723
+ uri: uri,
724
+ body: body || "",
725
+ params: query_string_params,
726
+ method_name: "get_operation",
720
727
  options: options
721
728
  )
722
729
  operation = ::Gapic::Rest::TransportOperation.new response
723
730
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
724
-
725
- yield result, operation if block_given?
726
- result
731
+ catch :response do
732
+ yield result, operation if block_given?
733
+ result
734
+ end
727
735
  end
728
736
 
729
737
  ##
@@ -752,16 +760,18 @@ module Google
752
760
 
753
761
  response = @client_stub.make_http_request(
754
762
  verb,
755
- uri: uri,
756
- body: body || "",
757
- params: query_string_params,
763
+ uri: uri,
764
+ body: body || "",
765
+ params: query_string_params,
766
+ method_name: "delete_operation",
758
767
  options: options
759
768
  )
760
769
  operation = ::Gapic::Rest::TransportOperation.new response
761
770
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
762
-
763
- yield result, operation if block_given?
764
- result
771
+ catch :response do
772
+ yield result, operation if block_given?
773
+ result
774
+ end
765
775
  end
766
776
 
767
777
  ##
@@ -790,16 +800,18 @@ module Google
790
800
 
791
801
  response = @client_stub.make_http_request(
792
802
  verb,
793
- uri: uri,
794
- body: body || "",
795
- params: query_string_params,
803
+ uri: uri,
804
+ body: body || "",
805
+ params: query_string_params,
806
+ method_name: "cancel_operation",
796
807
  options: options
797
808
  )
798
809
  operation = ::Gapic::Rest::TransportOperation.new response
799
810
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
800
-
801
- yield result, operation if block_given?
802
- result
811
+ catch :response do
812
+ yield result, operation if block_given?
813
+ result
814
+ end
803
815
  end
804
816
 
805
817
  ##