google-cloud-datastream-v1alpha1 0.7.1 → 0.9.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.
@@ -182,8 +182,19 @@ module Google
182
182
  endpoint: @config.endpoint,
183
183
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
184
184
  universe_domain: @config.universe_domain,
185
- credentials: credentials
185
+ credentials: credentials,
186
+ logger: @config.logger
186
187
  )
188
+
189
+ @datastream_stub.logger(stub: true)&.info do |entry|
190
+ entry.set_system_name
191
+ entry.set_service
192
+ entry.message = "Created client for #{entry.service}"
193
+ entry.set_credentials_fields credentials
194
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
195
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
196
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
197
+ end
187
198
  end
188
199
 
189
200
  ##
@@ -193,6 +204,15 @@ module Google
193
204
  #
194
205
  attr_reader :operations_client
195
206
 
207
+ ##
208
+ # The logger used for request/response debug logging.
209
+ #
210
+ # @return [Logger]
211
+ #
212
+ def logger
213
+ @datastream_stub.logger
214
+ end
215
+
196
216
  # Service calls
197
217
 
198
218
  ##
@@ -287,7 +307,6 @@ module Google
287
307
 
288
308
  @datastream_stub.list_connection_profiles request, options do |result, operation|
289
309
  yield result, operation if block_given?
290
- return result
291
310
  end
292
311
  rescue ::Gapic::Rest::Error => e
293
312
  raise ::Google::Cloud::Error.from_error(e)
@@ -366,7 +385,6 @@ module Google
366
385
 
367
386
  @datastream_stub.get_connection_profile request, options do |result, operation|
368
387
  yield result, operation if block_given?
369
- return result
370
388
  end
371
389
  rescue ::Gapic::Rest::Error => e
372
390
  raise ::Google::Cloud::Error.from_error(e)
@@ -471,7 +489,7 @@ module Google
471
489
  @datastream_stub.create_connection_profile request, options do |result, operation|
472
490
  result = ::Gapic::Operation.new result, @operations_client, options: options
473
491
  yield result, operation if block_given?
474
- return result
492
+ throw :response, result
475
493
  end
476
494
  rescue ::Gapic::Rest::Error => e
477
495
  raise ::Google::Cloud::Error.from_error(e)
@@ -578,7 +596,7 @@ module Google
578
596
  @datastream_stub.update_connection_profile request, options do |result, operation|
579
597
  result = ::Gapic::Operation.new result, @operations_client, options: options
580
598
  yield result, operation if block_given?
581
- return result
599
+ throw :response, result
582
600
  end
583
601
  rescue ::Gapic::Rest::Error => e
584
602
  raise ::Google::Cloud::Error.from_error(e)
@@ -679,7 +697,7 @@ module Google
679
697
  @datastream_stub.delete_connection_profile request, options do |result, operation|
680
698
  result = ::Gapic::Operation.new result, @operations_client, options: options
681
699
  yield result, operation if block_given?
682
- return result
700
+ throw :response, result
683
701
  end
684
702
  rescue ::Gapic::Rest::Error => e
685
703
  raise ::Google::Cloud::Error.from_error(e)
@@ -711,17 +729,29 @@ module Google
711
729
  # format `projects/*/locations/*`.
712
730
  # @param connection_profile [::Google::Cloud::Datastream::V1alpha1::ConnectionProfile, ::Hash]
713
731
  # An ad-hoc ConnectionProfile configuration.
732
+ #
733
+ # 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.
714
734
  # @param connection_profile_name [::String]
715
735
  # A reference to an existing ConnectionProfile.
736
+ #
737
+ # 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.
716
738
  # @param recursive [::Boolean]
717
739
  # Whether to retrieve the full hierarchy of data objects (TRUE) or only the
718
740
  # current level (FALSE).
741
+ #
742
+ # Note: The following fields are mutually exclusive: `recursive`, `recursion_depth`. If a field in that set is populated, all other fields in the set will automatically be cleared.
719
743
  # @param recursion_depth [::Integer]
720
744
  # The number of hierarchy levels below the current level to be retrieved.
745
+ #
746
+ # Note: The following fields are mutually exclusive: `recursion_depth`, `recursive`. If a field in that set is populated, all other fields in the set will automatically be cleared.
721
747
  # @param oracle_rdbms [::Google::Cloud::Datastream::V1alpha1::OracleRdbms, ::Hash]
722
748
  # Oracle RDBMS to enrich with child data objects and metadata.
749
+ #
750
+ # Note: The following fields are mutually exclusive: `oracle_rdbms`, `mysql_rdbms`. If a field in that set is populated, all other fields in the set will automatically be cleared.
723
751
  # @param mysql_rdbms [::Google::Cloud::Datastream::V1alpha1::MysqlRdbms, ::Hash]
724
752
  # MySQL RDBMS to enrich with child data objects and metadata.
753
+ #
754
+ # Note: The following fields are mutually exclusive: `mysql_rdbms`, `oracle_rdbms`. If a field in that set is populated, all other fields in the set will automatically be cleared.
725
755
  # @yield [result, operation] Access the result along with the TransportOperation object
726
756
  # @yieldparam result [::Google::Cloud::Datastream::V1alpha1::DiscoverConnectionProfileResponse]
727
757
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -775,7 +805,6 @@ module Google
775
805
 
776
806
  @datastream_stub.discover_connection_profile request, options do |result, operation|
777
807
  yield result, operation if block_given?
778
- return result
779
808
  end
780
809
  rescue ::Gapic::Rest::Error => e
781
810
  raise ::Google::Cloud::Error.from_error(e)
@@ -872,7 +901,6 @@ module Google
872
901
 
873
902
  @datastream_stub.list_streams request, options do |result, operation|
874
903
  yield result, operation if block_given?
875
- return result
876
904
  end
877
905
  rescue ::Gapic::Rest::Error => e
878
906
  raise ::Google::Cloud::Error.from_error(e)
@@ -951,7 +979,6 @@ module Google
951
979
 
952
980
  @datastream_stub.get_stream request, options do |result, operation|
953
981
  yield result, operation if block_given?
954
- return result
955
982
  end
956
983
  rescue ::Gapic::Rest::Error => e
957
984
  raise ::Google::Cloud::Error.from_error(e)
@@ -1061,7 +1088,7 @@ module Google
1061
1088
  @datastream_stub.create_stream request, options do |result, operation|
1062
1089
  result = ::Gapic::Operation.new result, @operations_client, options: options
1063
1090
  yield result, operation if block_given?
1064
- return result
1091
+ throw :response, result
1065
1092
  end
1066
1093
  rescue ::Gapic::Rest::Error => e
1067
1094
  raise ::Google::Cloud::Error.from_error(e)
@@ -1173,7 +1200,7 @@ module Google
1173
1200
  @datastream_stub.update_stream request, options do |result, operation|
1174
1201
  result = ::Gapic::Operation.new result, @operations_client, options: options
1175
1202
  yield result, operation if block_given?
1176
- return result
1203
+ throw :response, result
1177
1204
  end
1178
1205
  rescue ::Gapic::Rest::Error => e
1179
1206
  raise ::Google::Cloud::Error.from_error(e)
@@ -1274,7 +1301,7 @@ module Google
1274
1301
  @datastream_stub.delete_stream request, options do |result, operation|
1275
1302
  result = ::Gapic::Operation.new result, @operations_client, options: options
1276
1303
  yield result, operation if block_given?
1277
- return result
1304
+ throw :response, result
1278
1305
  end
1279
1306
  rescue ::Gapic::Rest::Error => e
1280
1307
  raise ::Google::Cloud::Error.from_error(e)
@@ -1361,7 +1388,7 @@ module Google
1361
1388
  @datastream_stub.fetch_errors request, options do |result, operation|
1362
1389
  result = ::Gapic::Operation.new result, @operations_client, options: options
1363
1390
  yield result, operation if block_given?
1364
- return result
1391
+ throw :response, result
1365
1392
  end
1366
1393
  rescue ::Gapic::Rest::Error => e
1367
1394
  raise ::Google::Cloud::Error.from_error(e)
@@ -1449,7 +1476,7 @@ module Google
1449
1476
  @datastream_stub.fetch_static_ips request, options do |result, operation|
1450
1477
  result = ::Gapic::Rest::PagedEnumerable.new @datastream_stub, :fetch_static_ips, "static_ips", request, result, options
1451
1478
  yield result, operation if block_given?
1452
- return result
1479
+ throw :response, result
1453
1480
  end
1454
1481
  rescue ::Gapic::Rest::Error => e
1455
1482
  raise ::Google::Cloud::Error.from_error(e)
@@ -1554,7 +1581,7 @@ module Google
1554
1581
  @datastream_stub.create_private_connection request, options do |result, operation|
1555
1582
  result = ::Gapic::Operation.new result, @operations_client, options: options
1556
1583
  yield result, operation if block_given?
1557
- return result
1584
+ throw :response, result
1558
1585
  end
1559
1586
  rescue ::Gapic::Rest::Error => e
1560
1587
  raise ::Google::Cloud::Error.from_error(e)
@@ -1633,7 +1660,6 @@ module Google
1633
1660
 
1634
1661
  @datastream_stub.get_private_connection request, options do |result, operation|
1635
1662
  yield result, operation if block_given?
1636
- return result
1637
1663
  end
1638
1664
  rescue ::Gapic::Rest::Error => e
1639
1665
  raise ::Google::Cloud::Error.from_error(e)
@@ -1733,7 +1759,6 @@ module Google
1733
1759
 
1734
1760
  @datastream_stub.list_private_connections request, options do |result, operation|
1735
1761
  yield result, operation if block_given?
1736
- return result
1737
1762
  end
1738
1763
  rescue ::Gapic::Rest::Error => e
1739
1764
  raise ::Google::Cloud::Error.from_error(e)
@@ -1837,7 +1862,7 @@ module Google
1837
1862
  @datastream_stub.delete_private_connection request, options do |result, operation|
1838
1863
  result = ::Gapic::Operation.new result, @operations_client, options: options
1839
1864
  yield result, operation if block_given?
1840
- return result
1865
+ throw :response, result
1841
1866
  end
1842
1867
  rescue ::Gapic::Rest::Error => e
1843
1868
  raise ::Google::Cloud::Error.from_error(e)
@@ -1943,7 +1968,7 @@ module Google
1943
1968
  @datastream_stub.create_route request, options do |result, operation|
1944
1969
  result = ::Gapic::Operation.new result, @operations_client, options: options
1945
1970
  yield result, operation if block_given?
1946
- return result
1971
+ throw :response, result
1947
1972
  end
1948
1973
  rescue ::Gapic::Rest::Error => e
1949
1974
  raise ::Google::Cloud::Error.from_error(e)
@@ -2022,7 +2047,6 @@ module Google
2022
2047
 
2023
2048
  @datastream_stub.get_route request, options do |result, operation|
2024
2049
  yield result, operation if block_given?
2025
- return result
2026
2050
  end
2027
2051
  rescue ::Gapic::Rest::Error => e
2028
2052
  raise ::Google::Cloud::Error.from_error(e)
@@ -2122,7 +2146,6 @@ module Google
2122
2146
 
2123
2147
  @datastream_stub.list_routes request, options do |result, operation|
2124
2148
  yield result, operation if block_given?
2125
- return result
2126
2149
  end
2127
2150
  rescue ::Gapic::Rest::Error => e
2128
2151
  raise ::Google::Cloud::Error.from_error(e)
@@ -2223,7 +2246,7 @@ module Google
2223
2246
  @datastream_stub.delete_route request, options do |result, operation|
2224
2247
  result = ::Gapic::Operation.new result, @operations_client, options: options
2225
2248
  yield result, operation if block_given?
2226
- return result
2249
+ throw :response, result
2227
2250
  end
2228
2251
  rescue ::Gapic::Rest::Error => e
2229
2252
  raise ::Google::Cloud::Error.from_error(e)
@@ -2271,6 +2294,13 @@ module Google
2271
2294
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
2272
2295
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
2273
2296
  # * (`nil`) indicating no credentials
2297
+ #
2298
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
2299
+ # external source for authentication to Google Cloud, you must validate it before
2300
+ # providing it to a Google API client library. Providing an unvalidated credential
2301
+ # configuration to Google APIs can compromise the security of your systems and data.
2302
+ # For more information, refer to [Validate credential configurations from external
2303
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
2274
2304
  # @return [::Object]
2275
2305
  # @!attribute [rw] scope
2276
2306
  # The OAuth scopes
@@ -2303,6 +2333,11 @@ module Google
2303
2333
  # default endpoint URL. The default value of nil uses the environment
2304
2334
  # universe (usually the default "googleapis.com" universe).
2305
2335
  # @return [::String,nil]
2336
+ # @!attribute [rw] logger
2337
+ # A custom logger to use for request/response debug logging, or the value
2338
+ # `:default` (the default) to construct a default logger, or `nil` to
2339
+ # explicitly disable logging.
2340
+ # @return [::Logger,:default,nil]
2306
2341
  #
2307
2342
  class Configuration
2308
2343
  extend ::Gapic::Config
@@ -2324,6 +2359,7 @@ module Google
2324
2359
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2325
2360
  config_attr :quota_project, nil, ::String, nil
2326
2361
  config_attr :universe_domain, nil, ::String, nil
2362
+ config_attr :logger, :default, ::Logger, nil, :default
2327
2363
 
2328
2364
  # @private
2329
2365
  def initialize parent_config = nil
@@ -115,14 +115,6 @@ module Google
115
115
  # Lists operations that match the specified filter in the request. If the
116
116
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
117
117
  #
118
- # NOTE: the `name` binding allows API services to override the binding
119
- # to use different resource name schemes, such as `users/*/operations`. To
120
- # override the binding, API services can add a binding such as
121
- # `"/v1/{name=users/*}/operations"` to their service configuration.
122
- # For backwards compatibility, the default name includes the operations
123
- # collection id, however overriding users must ensure the name binding
124
- # is the parent resource, without the operations collection id.
125
- #
126
118
  # @overload list_operations(request, options = nil)
127
119
  # Pass arguments to `list_operations` via a request object, either of type
128
120
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -204,7 +196,7 @@ module Google
204
196
  @operations_stub.list_operations request, options do |result, operation|
205
197
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
206
198
  yield result, operation if block_given?
207
- return result
199
+ throw :response, result
208
200
  end
209
201
  rescue ::Gapic::Rest::Error => e
210
202
  raise ::Google::Cloud::Error.from_error(e)
@@ -293,7 +285,7 @@ module Google
293
285
  @operations_stub.get_operation request, options do |result, operation|
294
286
  result = ::Gapic::Operation.new result, @operations_client, options: options
295
287
  yield result, operation if block_given?
296
- return result
288
+ throw :response, result
297
289
  end
298
290
  rescue ::Gapic::Rest::Error => e
299
291
  raise ::Google::Cloud::Error.from_error(e)
@@ -375,7 +367,6 @@ module Google
375
367
 
376
368
  @operations_stub.delete_operation request, options do |result, operation|
377
369
  yield result, operation if block_given?
378
- return result
379
370
  end
380
371
  rescue ::Gapic::Rest::Error => e
381
372
  raise ::Google::Cloud::Error.from_error(e)
@@ -390,8 +381,9 @@ module Google
390
381
  # other methods to check whether the cancellation succeeded or whether the
391
382
  # operation completed despite cancellation. On successful cancellation,
392
383
  # the operation is not deleted; instead, it becomes an operation with
393
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
394
- # corresponding to `Code.CANCELLED`.
384
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
385
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
386
+ # `Code.CANCELLED`.
395
387
  #
396
388
  # @overload cancel_operation(request, options = nil)
397
389
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -463,7 +455,6 @@ module Google
463
455
 
464
456
  @operations_stub.cancel_operation request, options do |result, operation|
465
457
  yield result, operation if block_given?
466
- return result
467
458
  end
468
459
  rescue ::Gapic::Rest::Error => e
469
460
  raise ::Google::Cloud::Error.from_error(e)
@@ -511,6 +502,13 @@ module Google
511
502
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
512
503
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
513
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).
514
512
  # @return [::Object]
515
513
  # @!attribute [rw] scope
516
514
  # The OAuth scopes
@@ -543,6 +541,11 @@ module Google
543
541
  # default endpoint URL. The default value of nil uses the environment
544
542
  # universe (usually the default "googleapis.com" universe).
545
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]
546
549
  #
547
550
  class Configuration
548
551
  extend ::Gapic::Config
@@ -564,6 +567,7 @@ module Google
564
567
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
565
568
  config_attr :quota_project, nil, ::String, nil
566
569
  config_attr :universe_domain, nil, ::String, nil
570
+ config_attr :logger, :default, ::Logger, nil, :default
567
571
 
568
572
  # @private
569
573
  def initialize parent_config = nil
@@ -683,16 +687,18 @@ module Google
683
687
 
684
688
  response = @client_stub.make_http_request(
685
689
  verb,
686
- uri: uri,
687
- body: body || "",
688
- params: query_string_params,
690
+ uri: uri,
691
+ body: body || "",
692
+ params: query_string_params,
693
+ method_name: "list_operations",
689
694
  options: options
690
695
  )
691
696
  operation = ::Gapic::Rest::TransportOperation.new response
692
697
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
693
-
694
- yield result, operation if block_given?
695
- result
698
+ catch :response do
699
+ yield result, operation if block_given?
700
+ result
701
+ end
696
702
  end
697
703
 
698
704
  ##
@@ -721,16 +727,18 @@ module Google
721
727
 
722
728
  response = @client_stub.make_http_request(
723
729
  verb,
724
- uri: uri,
725
- body: body || "",
726
- params: query_string_params,
730
+ uri: uri,
731
+ body: body || "",
732
+ params: query_string_params,
733
+ method_name: "get_operation",
727
734
  options: options
728
735
  )
729
736
  operation = ::Gapic::Rest::TransportOperation.new response
730
737
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
731
-
732
- yield result, operation if block_given?
733
- result
738
+ catch :response do
739
+ yield result, operation if block_given?
740
+ result
741
+ end
734
742
  end
735
743
 
736
744
  ##
@@ -759,16 +767,18 @@ module Google
759
767
 
760
768
  response = @client_stub.make_http_request(
761
769
  verb,
762
- uri: uri,
763
- body: body || "",
764
- params: query_string_params,
770
+ uri: uri,
771
+ body: body || "",
772
+ params: query_string_params,
773
+ method_name: "delete_operation",
765
774
  options: options
766
775
  )
767
776
  operation = ::Gapic::Rest::TransportOperation.new response
768
777
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
769
-
770
- yield result, operation if block_given?
771
- result
778
+ catch :response do
779
+ yield result, operation if block_given?
780
+ result
781
+ end
772
782
  end
773
783
 
774
784
  ##
@@ -797,16 +807,18 @@ module Google
797
807
 
798
808
  response = @client_stub.make_http_request(
799
809
  verb,
800
- uri: uri,
801
- body: body || "",
802
- params: query_string_params,
810
+ uri: uri,
811
+ body: body || "",
812
+ params: query_string_params,
813
+ method_name: "cancel_operation",
803
814
  options: options
804
815
  )
805
816
  operation = ::Gapic::Rest::TransportOperation.new response
806
817
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
807
-
808
- yield result, operation if block_given?
809
- result
818
+ catch :response do
819
+ yield result, operation if block_given?
820
+ result
821
+ end
810
822
  end
811
823
 
812
824
  ##