google-cloud-datastream-v1 0.11.0 → 0.13.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)
@@ -752,21 +772,37 @@ module Google
752
772
  # the format `projects/*/locations/*`.
753
773
  # @param connection_profile [::Google::Cloud::Datastream::V1::ConnectionProfile, ::Hash]
754
774
  # An ad-hoc connection profile configuration.
775
+ #
776
+ # Note: The following fields are mutually exclusive: `connection_profile`, `connection_profile_name`. If a field in that set is populated, all other fields in the set will automatically be cleared.
755
777
  # @param connection_profile_name [::String]
756
778
  # A reference to an existing connection profile.
779
+ #
780
+ # Note: The following fields are mutually exclusive: `connection_profile_name`, `connection_profile`. If a field in that set is populated, all other fields in the set will automatically be cleared.
757
781
  # @param full_hierarchy [::Boolean]
758
782
  # Whether to retrieve the full hierarchy of data objects (TRUE) or only the
759
783
  # current level (FALSE).
784
+ #
785
+ # Note: The following fields are mutually exclusive: `full_hierarchy`, `hierarchy_depth`. If a field in that set is populated, all other fields in the set will automatically be cleared.
760
786
  # @param hierarchy_depth [::Integer]
761
787
  # The number of hierarchy levels below the current level to be retrieved.
788
+ #
789
+ # Note: The following fields are mutually exclusive: `hierarchy_depth`, `full_hierarchy`. If a field in that set is populated, all other fields in the set will automatically be cleared.
762
790
  # @param oracle_rdbms [::Google::Cloud::Datastream::V1::OracleRdbms, ::Hash]
763
791
  # Oracle RDBMS to enrich with child data objects and metadata.
792
+ #
793
+ # Note: The following fields are mutually exclusive: `oracle_rdbms`, `mysql_rdbms`, `postgresql_rdbms`, `sql_server_rdbms`. If a field in that set is populated, all other fields in the set will automatically be cleared.
764
794
  # @param mysql_rdbms [::Google::Cloud::Datastream::V1::MysqlRdbms, ::Hash]
765
795
  # MySQL RDBMS to enrich with child data objects and metadata.
796
+ #
797
+ # Note: The following fields are mutually exclusive: `mysql_rdbms`, `oracle_rdbms`, `postgresql_rdbms`, `sql_server_rdbms`. If a field in that set is populated, all other fields in the set will automatically be cleared.
766
798
  # @param postgresql_rdbms [::Google::Cloud::Datastream::V1::PostgresqlRdbms, ::Hash]
767
799
  # PostgreSQL RDBMS to enrich with child data objects and metadata.
800
+ #
801
+ # Note: The following fields are mutually exclusive: `postgresql_rdbms`, `oracle_rdbms`, `mysql_rdbms`, `sql_server_rdbms`. If a field in that set is populated, all other fields in the set will automatically be cleared.
768
802
  # @param sql_server_rdbms [::Google::Cloud::Datastream::V1::SqlServerRdbms, ::Hash]
769
803
  # SQLServer RDBMS to enrich with child data objects and metadata.
804
+ #
805
+ # Note: The following fields are mutually exclusive: `sql_server_rdbms`, `oracle_rdbms`, `mysql_rdbms`, `postgresql_rdbms`. If a field in that set is populated, all other fields in the set will automatically be cleared.
770
806
  # @yield [result, operation] Access the result along with the TransportOperation object
771
807
  # @yieldparam result [::Google::Cloud::Datastream::V1::DiscoverConnectionProfileResponse]
772
808
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -820,7 +856,6 @@ module Google
820
856
 
821
857
  @datastream_stub.discover_connection_profile request, options do |result, operation|
822
858
  yield result, operation if block_given?
823
- return result
824
859
  end
825
860
  rescue ::Gapic::Rest::Error => e
826
861
  raise ::Google::Cloud::Error.from_error(e)
@@ -917,7 +952,6 @@ module Google
917
952
 
918
953
  @datastream_stub.list_streams request, options do |result, operation|
919
954
  yield result, operation if block_given?
920
- return result
921
955
  end
922
956
  rescue ::Gapic::Rest::Error => e
923
957
  raise ::Google::Cloud::Error.from_error(e)
@@ -996,7 +1030,6 @@ module Google
996
1030
 
997
1031
  @datastream_stub.get_stream request, options do |result, operation|
998
1032
  yield result, operation if block_given?
999
- return result
1000
1033
  end
1001
1034
  rescue ::Gapic::Rest::Error => e
1002
1035
  raise ::Google::Cloud::Error.from_error(e)
@@ -1106,7 +1139,7 @@ module Google
1106
1139
  @datastream_stub.create_stream request, options do |result, operation|
1107
1140
  result = ::Gapic::Operation.new result, @operations_client, options: options
1108
1141
  yield result, operation if block_given?
1109
- return result
1142
+ throw :response, result
1110
1143
  end
1111
1144
  rescue ::Gapic::Rest::Error => e
1112
1145
  raise ::Google::Cloud::Error.from_error(e)
@@ -1218,7 +1251,7 @@ module Google
1218
1251
  @datastream_stub.update_stream request, options do |result, operation|
1219
1252
  result = ::Gapic::Operation.new result, @operations_client, options: options
1220
1253
  yield result, operation if block_given?
1221
- return result
1254
+ throw :response, result
1222
1255
  end
1223
1256
  rescue ::Gapic::Rest::Error => e
1224
1257
  raise ::Google::Cloud::Error.from_error(e)
@@ -1319,7 +1352,7 @@ module Google
1319
1352
  @datastream_stub.delete_stream request, options do |result, operation|
1320
1353
  result = ::Gapic::Operation.new result, @operations_client, options: options
1321
1354
  yield result, operation if block_given?
1322
- return result
1355
+ throw :response, result
1323
1356
  end
1324
1357
  rescue ::Gapic::Rest::Error => e
1325
1358
  raise ::Google::Cloud::Error.from_error(e)
@@ -1413,7 +1446,7 @@ module Google
1413
1446
  @datastream_stub.run_stream request, options do |result, operation|
1414
1447
  result = ::Gapic::Operation.new result, @operations_client, options: options
1415
1448
  yield result, operation if block_given?
1416
- return result
1449
+ throw :response, result
1417
1450
  end
1418
1451
  rescue ::Gapic::Rest::Error => e
1419
1452
  raise ::Google::Cloud::Error.from_error(e)
@@ -1492,7 +1525,6 @@ module Google
1492
1525
 
1493
1526
  @datastream_stub.get_stream_object request, options do |result, operation|
1494
1527
  yield result, operation if block_given?
1495
- return result
1496
1528
  end
1497
1529
  rescue ::Gapic::Rest::Error => e
1498
1530
  raise ::Google::Cloud::Error.from_error(e)
@@ -1573,7 +1605,6 @@ module Google
1573
1605
 
1574
1606
  @datastream_stub.lookup_stream_object request, options do |result, operation|
1575
1607
  yield result, operation if block_given?
1576
- return result
1577
1608
  end
1578
1609
  rescue ::Gapic::Rest::Error => e
1579
1610
  raise ::Google::Cloud::Error.from_error(e)
@@ -1667,7 +1698,7 @@ module Google
1667
1698
  @datastream_stub.list_stream_objects request, options do |result, operation|
1668
1699
  result = ::Gapic::Rest::PagedEnumerable.new @datastream_stub, :list_stream_objects, "stream_objects", request, result, options
1669
1700
  yield result, operation if block_given?
1670
- return result
1701
+ throw :response, result
1671
1702
  end
1672
1703
  rescue ::Gapic::Rest::Error => e
1673
1704
  raise ::Google::Cloud::Error.from_error(e)
@@ -1747,7 +1778,6 @@ module Google
1747
1778
 
1748
1779
  @datastream_stub.start_backfill_job request, options do |result, operation|
1749
1780
  yield result, operation if block_given?
1750
- return result
1751
1781
  end
1752
1782
  rescue ::Gapic::Rest::Error => e
1753
1783
  raise ::Google::Cloud::Error.from_error(e)
@@ -1827,7 +1857,6 @@ module Google
1827
1857
 
1828
1858
  @datastream_stub.stop_backfill_job request, options do |result, operation|
1829
1859
  yield result, operation if block_given?
1830
- return result
1831
1860
  end
1832
1861
  rescue ::Gapic::Rest::Error => e
1833
1862
  raise ::Google::Cloud::Error.from_error(e)
@@ -1914,7 +1943,7 @@ module Google
1914
1943
  @datastream_stub.fetch_static_ips request, options do |result, operation|
1915
1944
  result = ::Gapic::Rest::PagedEnumerable.new @datastream_stub, :fetch_static_ips, "static_ips", request, result, options
1916
1945
  yield result, operation if block_given?
1917
- return result
1946
+ throw :response, result
1918
1947
  end
1919
1948
  rescue ::Gapic::Rest::Error => e
1920
1949
  raise ::Google::Cloud::Error.from_error(e)
@@ -2021,7 +2050,7 @@ module Google
2021
2050
  @datastream_stub.create_private_connection request, options do |result, operation|
2022
2051
  result = ::Gapic::Operation.new result, @operations_client, options: options
2023
2052
  yield result, operation if block_given?
2024
- return result
2053
+ throw :response, result
2025
2054
  end
2026
2055
  rescue ::Gapic::Rest::Error => e
2027
2056
  raise ::Google::Cloud::Error.from_error(e)
@@ -2100,7 +2129,6 @@ module Google
2100
2129
 
2101
2130
  @datastream_stub.get_private_connection request, options do |result, operation|
2102
2131
  yield result, operation if block_given?
2103
- return result
2104
2132
  end
2105
2133
  rescue ::Gapic::Rest::Error => e
2106
2134
  raise ::Google::Cloud::Error.from_error(e)
@@ -2201,7 +2229,6 @@ module Google
2201
2229
 
2202
2230
  @datastream_stub.list_private_connections request, options do |result, operation|
2203
2231
  yield result, operation if block_given?
2204
- return result
2205
2232
  end
2206
2233
  rescue ::Gapic::Rest::Error => e
2207
2234
  raise ::Google::Cloud::Error.from_error(e)
@@ -2305,7 +2332,7 @@ module Google
2305
2332
  @datastream_stub.delete_private_connection request, options do |result, operation|
2306
2333
  result = ::Gapic::Operation.new result, @operations_client, options: options
2307
2334
  yield result, operation if block_given?
2308
- return result
2335
+ throw :response, result
2309
2336
  end
2310
2337
  rescue ::Gapic::Rest::Error => e
2311
2338
  raise ::Google::Cloud::Error.from_error(e)
@@ -2411,7 +2438,7 @@ module Google
2411
2438
  @datastream_stub.create_route request, options do |result, operation|
2412
2439
  result = ::Gapic::Operation.new result, @operations_client, options: options
2413
2440
  yield result, operation if block_given?
2414
- return result
2441
+ throw :response, result
2415
2442
  end
2416
2443
  rescue ::Gapic::Rest::Error => e
2417
2444
  raise ::Google::Cloud::Error.from_error(e)
@@ -2490,7 +2517,6 @@ module Google
2490
2517
 
2491
2518
  @datastream_stub.get_route request, options do |result, operation|
2492
2519
  yield result, operation if block_given?
2493
- return result
2494
2520
  end
2495
2521
  rescue ::Gapic::Rest::Error => e
2496
2522
  raise ::Google::Cloud::Error.from_error(e)
@@ -2590,7 +2616,6 @@ module Google
2590
2616
 
2591
2617
  @datastream_stub.list_routes request, options do |result, operation|
2592
2618
  yield result, operation if block_given?
2593
- return result
2594
2619
  end
2595
2620
  rescue ::Gapic::Rest::Error => e
2596
2621
  raise ::Google::Cloud::Error.from_error(e)
@@ -2691,7 +2716,7 @@ module Google
2691
2716
  @datastream_stub.delete_route request, options do |result, operation|
2692
2717
  result = ::Gapic::Operation.new result, @operations_client, options: options
2693
2718
  yield result, operation if block_given?
2694
- return result
2719
+ throw :response, result
2695
2720
  end
2696
2721
  rescue ::Gapic::Rest::Error => e
2697
2722
  raise ::Google::Cloud::Error.from_error(e)
@@ -2739,6 +2764,13 @@ module Google
2739
2764
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
2740
2765
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
2741
2766
  # * (`nil`) indicating no credentials
2767
+ #
2768
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
2769
+ # external source for authentication to Google Cloud, you must validate it before
2770
+ # providing it to a Google API client library. Providing an unvalidated credential
2771
+ # configuration to Google APIs can compromise the security of your systems and data.
2772
+ # For more information, refer to [Validate credential configurations from external
2773
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
2742
2774
  # @return [::Object]
2743
2775
  # @!attribute [rw] scope
2744
2776
  # The OAuth scopes
@@ -2771,6 +2803,11 @@ module Google
2771
2803
  # default endpoint URL. The default value of nil uses the environment
2772
2804
  # universe (usually the default "googleapis.com" universe).
2773
2805
  # @return [::String,nil]
2806
+ # @!attribute [rw] logger
2807
+ # A custom logger to use for request/response debug logging, or the value
2808
+ # `:default` (the default) to construct a default logger, or `nil` to
2809
+ # explicitly disable logging.
2810
+ # @return [::Logger,:default,nil]
2774
2811
  #
2775
2812
  class Configuration
2776
2813
  extend ::Gapic::Config
@@ -2799,6 +2836,7 @@ module Google
2799
2836
  # by the host service.
2800
2837
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
2801
2838
  config_attr :bindings_override, {}, ::Hash, nil
2839
+ config_attr :logger, :default, ::Logger, nil, :default
2802
2840
 
2803
2841
  # @private
2804
2842
  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)
@@ -504,6 +502,13 @@ module Google
504
502
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
505
503
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
506
504
  # * (`nil`) indicating no credentials
505
+ #
506
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
507
+ # external source for authentication to Google Cloud, you must validate it before
508
+ # providing it to a Google API client library. Providing an unvalidated credential
509
+ # configuration to Google APIs can compromise the security of your systems and data.
510
+ # For more information, refer to [Validate credential configurations from external
511
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
507
512
  # @return [::Object]
508
513
  # @!attribute [rw] scope
509
514
  # The OAuth scopes
@@ -536,6 +541,11 @@ module Google
536
541
  # default endpoint URL. The default value of nil uses the environment
537
542
  # universe (usually the default "googleapis.com" universe).
538
543
  # @return [::String,nil]
544
+ # @!attribute [rw] logger
545
+ # A custom logger to use for request/response debug logging, or the value
546
+ # `:default` (the default) to construct a default logger, or `nil` to
547
+ # explicitly disable logging.
548
+ # @return [::Logger,:default,nil]
539
549
  #
540
550
  class Configuration
541
551
  extend ::Gapic::Config
@@ -557,6 +567,7 @@ module Google
557
567
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
558
568
  config_attr :quota_project, nil, ::String, nil
559
569
  config_attr :universe_domain, nil, ::String, nil
570
+ config_attr :logger, :default, ::Logger, nil, :default
560
571
 
561
572
  # @private
562
573
  def initialize parent_config = nil
@@ -676,16 +687,18 @@ module Google
676
687
 
677
688
  response = @client_stub.make_http_request(
678
689
  verb,
679
- uri: uri,
680
- body: body || "",
681
- params: query_string_params,
690
+ uri: uri,
691
+ body: body || "",
692
+ params: query_string_params,
693
+ method_name: "list_operations",
682
694
  options: options
683
695
  )
684
696
  operation = ::Gapic::Rest::TransportOperation.new response
685
697
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
686
-
687
- yield result, operation if block_given?
688
- result
698
+ catch :response do
699
+ yield result, operation if block_given?
700
+ result
701
+ end
689
702
  end
690
703
 
691
704
  ##
@@ -714,16 +727,18 @@ module Google
714
727
 
715
728
  response = @client_stub.make_http_request(
716
729
  verb,
717
- uri: uri,
718
- body: body || "",
719
- params: query_string_params,
730
+ uri: uri,
731
+ body: body || "",
732
+ params: query_string_params,
733
+ method_name: "get_operation",
720
734
  options: options
721
735
  )
722
736
  operation = ::Gapic::Rest::TransportOperation.new response
723
737
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
724
-
725
- yield result, operation if block_given?
726
- result
738
+ catch :response do
739
+ yield result, operation if block_given?
740
+ result
741
+ end
727
742
  end
728
743
 
729
744
  ##
@@ -752,16 +767,18 @@ module Google
752
767
 
753
768
  response = @client_stub.make_http_request(
754
769
  verb,
755
- uri: uri,
756
- body: body || "",
757
- params: query_string_params,
770
+ uri: uri,
771
+ body: body || "",
772
+ params: query_string_params,
773
+ method_name: "delete_operation",
758
774
  options: options
759
775
  )
760
776
  operation = ::Gapic::Rest::TransportOperation.new response
761
777
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
762
-
763
- yield result, operation if block_given?
764
- result
778
+ catch :response do
779
+ yield result, operation if block_given?
780
+ result
781
+ end
765
782
  end
766
783
 
767
784
  ##
@@ -790,16 +807,18 @@ module Google
790
807
 
791
808
  response = @client_stub.make_http_request(
792
809
  verb,
793
- uri: uri,
794
- body: body || "",
795
- params: query_string_params,
810
+ uri: uri,
811
+ body: body || "",
812
+ params: query_string_params,
813
+ method_name: "cancel_operation",
796
814
  options: options
797
815
  )
798
816
  operation = ::Gapic::Rest::TransportOperation.new response
799
817
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
800
-
801
- yield result, operation if block_given?
802
- result
818
+ catch :response do
819
+ yield result, operation if block_given?
820
+ result
821
+ end
803
822
  end
804
823
 
805
824
  ##