google-cloud-bigquery-analytics_hub-v1 0.8.1 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -168,8 +168,19 @@ module Google
168
168
  endpoint: @config.endpoint,
169
169
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
170
170
  universe_domain: @config.universe_domain,
171
- credentials: credentials
171
+ credentials: credentials,
172
+ logger: @config.logger
172
173
  )
174
+
175
+ @analytics_hub_service_stub.logger(stub: true)&.info do |entry|
176
+ entry.set_system_name
177
+ entry.set_service
178
+ entry.message = "Created client for #{entry.service}"
179
+ entry.set_credentials_fields credentials
180
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
181
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
182
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
183
+ end
173
184
  end
174
185
 
175
186
  ##
@@ -179,6 +190,15 @@ module Google
179
190
  #
180
191
  attr_reader :operations_client
181
192
 
193
+ ##
194
+ # The logger used for request/response debug logging.
195
+ #
196
+ # @return [Logger]
197
+ #
198
+ def logger
199
+ @analytics_hub_service_stub.logger
200
+ end
201
+
182
202
  # Service calls
183
203
 
184
204
  ##
@@ -266,7 +286,7 @@ module Google
266
286
  @analytics_hub_service_stub.list_data_exchanges request, options do |result, operation|
267
287
  result = ::Gapic::Rest::PagedEnumerable.new @analytics_hub_service_stub, :list_data_exchanges, "data_exchanges", request, result, options
268
288
  yield result, operation if block_given?
269
- return result
289
+ throw :response, result
270
290
  end
271
291
  rescue ::Gapic::Rest::Error => e
272
292
  raise ::Google::Cloud::Error.from_error(e)
@@ -358,7 +378,7 @@ module Google
358
378
  @analytics_hub_service_stub.list_org_data_exchanges request, options do |result, operation|
359
379
  result = ::Gapic::Rest::PagedEnumerable.new @analytics_hub_service_stub, :list_org_data_exchanges, "data_exchanges", request, result, options
360
380
  yield result, operation if block_given?
361
- return result
381
+ throw :response, result
362
382
  end
363
383
  rescue ::Gapic::Rest::Error => e
364
384
  raise ::Google::Cloud::Error.from_error(e)
@@ -438,7 +458,6 @@ module Google
438
458
 
439
459
  @analytics_hub_service_stub.get_data_exchange request, options do |result, operation|
440
460
  yield result, operation if block_given?
441
- return result
442
461
  end
443
462
  rescue ::Gapic::Rest::Error => e
444
463
  raise ::Google::Cloud::Error.from_error(e)
@@ -526,7 +545,6 @@ module Google
526
545
 
527
546
  @analytics_hub_service_stub.create_data_exchange request, options do |result, operation|
528
547
  yield result, operation if block_given?
529
- return result
530
548
  end
531
549
  rescue ::Gapic::Rest::Error => e
532
550
  raise ::Google::Cloud::Error.from_error(e)
@@ -609,7 +627,6 @@ module Google
609
627
 
610
628
  @analytics_hub_service_stub.update_data_exchange request, options do |result, operation|
611
629
  yield result, operation if block_given?
612
- return result
613
630
  end
614
631
  rescue ::Gapic::Rest::Error => e
615
632
  raise ::Google::Cloud::Error.from_error(e)
@@ -689,7 +706,6 @@ module Google
689
706
 
690
707
  @analytics_hub_service_stub.delete_data_exchange request, options do |result, operation|
691
708
  yield result, operation if block_given?
692
- return result
693
709
  end
694
710
  rescue ::Gapic::Rest::Error => e
695
711
  raise ::Google::Cloud::Error.from_error(e)
@@ -780,7 +796,7 @@ module Google
780
796
  @analytics_hub_service_stub.list_listings request, options do |result, operation|
781
797
  result = ::Gapic::Rest::PagedEnumerable.new @analytics_hub_service_stub, :list_listings, "listings", request, result, options
782
798
  yield result, operation if block_given?
783
- return result
799
+ throw :response, result
784
800
  end
785
801
  rescue ::Gapic::Rest::Error => e
786
802
  raise ::Google::Cloud::Error.from_error(e)
@@ -860,7 +876,6 @@ module Google
860
876
 
861
877
  @analytics_hub_service_stub.get_listing request, options do |result, operation|
862
878
  yield result, operation if block_given?
863
- return result
864
879
  end
865
880
  rescue ::Gapic::Rest::Error => e
866
881
  raise ::Google::Cloud::Error.from_error(e)
@@ -948,7 +963,6 @@ module Google
948
963
 
949
964
  @analytics_hub_service_stub.create_listing request, options do |result, operation|
950
965
  yield result, operation if block_given?
951
- return result
952
966
  end
953
967
  rescue ::Gapic::Rest::Error => e
954
968
  raise ::Google::Cloud::Error.from_error(e)
@@ -1031,7 +1045,6 @@ module Google
1031
1045
 
1032
1046
  @analytics_hub_service_stub.update_listing request, options do |result, operation|
1033
1047
  yield result, operation if block_given?
1034
- return result
1035
1048
  end
1036
1049
  rescue ::Gapic::Rest::Error => e
1037
1050
  raise ::Google::Cloud::Error.from_error(e)
@@ -1111,7 +1124,6 @@ module Google
1111
1124
 
1112
1125
  @analytics_hub_service_stub.delete_listing request, options do |result, operation|
1113
1126
  yield result, operation if block_given?
1114
- return result
1115
1127
  end
1116
1128
  rescue ::Gapic::Rest::Error => e
1117
1129
  raise ::Google::Cloud::Error.from_error(e)
@@ -1198,7 +1210,6 @@ module Google
1198
1210
 
1199
1211
  @analytics_hub_service_stub.subscribe_listing request, options do |result, operation|
1200
1212
  yield result, operation if block_given?
1201
- return result
1202
1213
  end
1203
1214
  rescue ::Gapic::Rest::Error => e
1204
1215
  raise ::Google::Cloud::Error.from_error(e)
@@ -1295,7 +1306,7 @@ module Google
1295
1306
  @analytics_hub_service_stub.subscribe_data_exchange request, options do |result, operation|
1296
1307
  result = ::Gapic::Operation.new result, @operations_client, options: options
1297
1308
  yield result, operation if block_given?
1298
- return result
1309
+ throw :response, result
1299
1310
  end
1300
1311
  rescue ::Gapic::Rest::Error => e
1301
1312
  raise ::Google::Cloud::Error.from_error(e)
@@ -1385,7 +1396,7 @@ module Google
1385
1396
  @analytics_hub_service_stub.refresh_subscription request, options do |result, operation|
1386
1397
  result = ::Gapic::Operation.new result, @operations_client, options: options
1387
1398
  yield result, operation if block_given?
1388
- return result
1399
+ throw :response, result
1389
1400
  end
1390
1401
  rescue ::Gapic::Rest::Error => e
1391
1402
  raise ::Google::Cloud::Error.from_error(e)
@@ -1465,7 +1476,6 @@ module Google
1465
1476
 
1466
1477
  @analytics_hub_service_stub.get_subscription request, options do |result, operation|
1467
1478
  yield result, operation if block_given?
1468
- return result
1469
1479
  end
1470
1480
  rescue ::Gapic::Rest::Error => e
1471
1481
  raise ::Google::Cloud::Error.from_error(e)
@@ -1570,7 +1580,7 @@ module Google
1570
1580
  @analytics_hub_service_stub.list_subscriptions request, options do |result, operation|
1571
1581
  result = ::Gapic::Rest::PagedEnumerable.new @analytics_hub_service_stub, :list_subscriptions, "subscriptions", request, result, options
1572
1582
  yield result, operation if block_given?
1573
- return result
1583
+ throw :response, result
1574
1584
  end
1575
1585
  rescue ::Gapic::Rest::Error => e
1576
1586
  raise ::Google::Cloud::Error.from_error(e)
@@ -1664,7 +1674,7 @@ module Google
1664
1674
  @analytics_hub_service_stub.list_shared_resource_subscriptions request, options do |result, operation|
1665
1675
  result = ::Gapic::Rest::PagedEnumerable.new @analytics_hub_service_stub, :list_shared_resource_subscriptions, "shared_resource_subscriptions", request, result, options
1666
1676
  yield result, operation if block_given?
1667
- return result
1677
+ throw :response, result
1668
1678
  end
1669
1679
  rescue ::Gapic::Rest::Error => e
1670
1680
  raise ::Google::Cloud::Error.from_error(e)
@@ -1744,7 +1754,6 @@ module Google
1744
1754
 
1745
1755
  @analytics_hub_service_stub.revoke_subscription request, options do |result, operation|
1746
1756
  yield result, operation if block_given?
1747
- return result
1748
1757
  end
1749
1758
  rescue ::Gapic::Rest::Error => e
1750
1759
  raise ::Google::Cloud::Error.from_error(e)
@@ -1832,7 +1841,7 @@ module Google
1832
1841
  @analytics_hub_service_stub.delete_subscription request, options do |result, operation|
1833
1842
  result = ::Gapic::Operation.new result, @operations_client, options: options
1834
1843
  yield result, operation if block_given?
1835
- return result
1844
+ throw :response, result
1836
1845
  end
1837
1846
  rescue ::Gapic::Rest::Error => e
1838
1847
  raise ::Google::Cloud::Error.from_error(e)
@@ -1915,7 +1924,6 @@ module Google
1915
1924
 
1916
1925
  @analytics_hub_service_stub.get_iam_policy request, options do |result, operation|
1917
1926
  yield result, operation if block_given?
1918
- return result
1919
1927
  end
1920
1928
  rescue ::Gapic::Rest::Error => e
1921
1929
  raise ::Google::Cloud::Error.from_error(e)
@@ -2006,7 +2014,6 @@ module Google
2006
2014
 
2007
2015
  @analytics_hub_service_stub.set_iam_policy request, options do |result, operation|
2008
2016
  yield result, operation if block_given?
2009
- return result
2010
2017
  end
2011
2018
  rescue ::Gapic::Rest::Error => e
2012
2019
  raise ::Google::Cloud::Error.from_error(e)
@@ -2091,7 +2098,6 @@ module Google
2091
2098
 
2092
2099
  @analytics_hub_service_stub.test_iam_permissions request, options do |result, operation|
2093
2100
  yield result, operation if block_given?
2094
- return result
2095
2101
  end
2096
2102
  rescue ::Gapic::Rest::Error => e
2097
2103
  raise ::Google::Cloud::Error.from_error(e)
@@ -2139,6 +2145,13 @@ module Google
2139
2145
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
2140
2146
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
2141
2147
  # * (`nil`) indicating no credentials
2148
+ #
2149
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
2150
+ # external source for authentication to Google Cloud, you must validate it before
2151
+ # providing it to a Google API client library. Providing an unvalidated credential
2152
+ # configuration to Google APIs can compromise the security of your systems and data.
2153
+ # For more information, refer to [Validate credential configurations from external
2154
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
2142
2155
  # @return [::Object]
2143
2156
  # @!attribute [rw] scope
2144
2157
  # The OAuth scopes
@@ -2171,6 +2184,11 @@ module Google
2171
2184
  # default endpoint URL. The default value of nil uses the environment
2172
2185
  # universe (usually the default "googleapis.com" universe).
2173
2186
  # @return [::String,nil]
2187
+ # @!attribute [rw] logger
2188
+ # A custom logger to use for request/response debug logging, or the value
2189
+ # `:default` (the default) to construct a default logger, or `nil` to
2190
+ # explicitly disable logging.
2191
+ # @return [::Logger,:default,nil]
2174
2192
  #
2175
2193
  class Configuration
2176
2194
  extend ::Gapic::Config
@@ -2192,6 +2210,7 @@ module Google
2192
2210
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2193
2211
  config_attr :quota_project, nil, ::String, nil
2194
2212
  config_attr :universe_domain, nil, ::String, nil
2213
+ config_attr :logger, :default, ::Logger, nil, :default
2195
2214
 
2196
2215
  # @private
2197
2216
  def initialize parent_config = nil
@@ -116,14 +116,6 @@ module Google
116
116
  # Lists operations that match the specified filter in the request. If the
117
117
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
118
118
  #
119
- # NOTE: the `name` binding allows API services to override the binding
120
- # to use different resource name schemes, such as `users/*/operations`. To
121
- # override the binding, API services can add a binding such as
122
- # `"/v1/{name=users/*}/operations"` to their service configuration.
123
- # For backwards compatibility, the default name includes the operations
124
- # collection id, however overriding users must ensure the name binding
125
- # is the parent resource, without the operations collection id.
126
- #
127
119
  # @overload list_operations(request, options = nil)
128
120
  # Pass arguments to `list_operations` via a request object, either of type
129
121
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -205,7 +197,7 @@ module Google
205
197
  @operations_stub.list_operations request, options do |result, operation|
206
198
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
207
199
  yield result, operation if block_given?
208
- return result
200
+ throw :response, result
209
201
  end
210
202
  rescue ::Gapic::Rest::Error => e
211
203
  raise ::Google::Cloud::Error.from_error(e)
@@ -294,7 +286,7 @@ module Google
294
286
  @operations_stub.get_operation request, options do |result, operation|
295
287
  result = ::Gapic::Operation.new result, @operations_client, options: options
296
288
  yield result, operation if block_given?
297
- return result
289
+ throw :response, result
298
290
  end
299
291
  rescue ::Gapic::Rest::Error => e
300
292
  raise ::Google::Cloud::Error.from_error(e)
@@ -376,7 +368,6 @@ module Google
376
368
 
377
369
  @operations_stub.delete_operation request, options do |result, operation|
378
370
  yield result, operation if block_given?
379
- return result
380
371
  end
381
372
  rescue ::Gapic::Rest::Error => e
382
373
  raise ::Google::Cloud::Error.from_error(e)
@@ -391,8 +382,9 @@ module Google
391
382
  # other methods to check whether the cancellation succeeded or whether the
392
383
  # operation completed despite cancellation. On successful cancellation,
393
384
  # the operation is not deleted; instead, it becomes an operation with
394
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
395
- # corresponding to `Code.CANCELLED`.
385
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
386
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
387
+ # `Code.CANCELLED`.
396
388
  #
397
389
  # @overload cancel_operation(request, options = nil)
398
390
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -464,7 +456,6 @@ module Google
464
456
 
465
457
  @operations_stub.cancel_operation request, options do |result, operation|
466
458
  yield result, operation if block_given?
467
- return result
468
459
  end
469
460
  rescue ::Gapic::Rest::Error => e
470
461
  raise ::Google::Cloud::Error.from_error(e)
@@ -512,6 +503,13 @@ module Google
512
503
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
513
504
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
514
505
  # * (`nil`) indicating no credentials
506
+ #
507
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
508
+ # external source for authentication to Google Cloud, you must validate it before
509
+ # providing it to a Google API client library. Providing an unvalidated credential
510
+ # configuration to Google APIs can compromise the security of your systems and data.
511
+ # For more information, refer to [Validate credential configurations from external
512
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
515
513
  # @return [::Object]
516
514
  # @!attribute [rw] scope
517
515
  # The OAuth scopes
@@ -544,6 +542,11 @@ module Google
544
542
  # default endpoint URL. The default value of nil uses the environment
545
543
  # universe (usually the default "googleapis.com" universe).
546
544
  # @return [::String,nil]
545
+ # @!attribute [rw] logger
546
+ # A custom logger to use for request/response debug logging, or the value
547
+ # `:default` (the default) to construct a default logger, or `nil` to
548
+ # explicitly disable logging.
549
+ # @return [::Logger,:default,nil]
547
550
  #
548
551
  class Configuration
549
552
  extend ::Gapic::Config
@@ -565,6 +568,7 @@ module Google
565
568
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
566
569
  config_attr :quota_project, nil, ::String, nil
567
570
  config_attr :universe_domain, nil, ::String, nil
571
+ config_attr :logger, :default, ::Logger, nil, :default
568
572
 
569
573
  # @private
570
574
  def initialize parent_config = nil
@@ -684,16 +688,18 @@ module Google
684
688
 
685
689
  response = @client_stub.make_http_request(
686
690
  verb,
687
- uri: uri,
688
- body: body || "",
689
- params: query_string_params,
691
+ uri: uri,
692
+ body: body || "",
693
+ params: query_string_params,
694
+ method_name: "list_operations",
690
695
  options: options
691
696
  )
692
697
  operation = ::Gapic::Rest::TransportOperation.new response
693
698
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
694
-
695
- yield result, operation if block_given?
696
- result
699
+ catch :response do
700
+ yield result, operation if block_given?
701
+ result
702
+ end
697
703
  end
698
704
 
699
705
  ##
@@ -722,16 +728,18 @@ module Google
722
728
 
723
729
  response = @client_stub.make_http_request(
724
730
  verb,
725
- uri: uri,
726
- body: body || "",
727
- params: query_string_params,
731
+ uri: uri,
732
+ body: body || "",
733
+ params: query_string_params,
734
+ method_name: "get_operation",
728
735
  options: options
729
736
  )
730
737
  operation = ::Gapic::Rest::TransportOperation.new response
731
738
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
732
-
733
- yield result, operation if block_given?
734
- result
739
+ catch :response do
740
+ yield result, operation if block_given?
741
+ result
742
+ end
735
743
  end
736
744
 
737
745
  ##
@@ -760,16 +768,18 @@ module Google
760
768
 
761
769
  response = @client_stub.make_http_request(
762
770
  verb,
763
- uri: uri,
764
- body: body || "",
765
- params: query_string_params,
771
+ uri: uri,
772
+ body: body || "",
773
+ params: query_string_params,
774
+ method_name: "delete_operation",
766
775
  options: options
767
776
  )
768
777
  operation = ::Gapic::Rest::TransportOperation.new response
769
778
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
770
-
771
- yield result, operation if block_given?
772
- result
779
+ catch :response do
780
+ yield result, operation if block_given?
781
+ result
782
+ end
773
783
  end
774
784
 
775
785
  ##
@@ -798,16 +808,18 @@ module Google
798
808
 
799
809
  response = @client_stub.make_http_request(
800
810
  verb,
801
- uri: uri,
802
- body: body || "",
803
- params: query_string_params,
811
+ uri: uri,
812
+ body: body || "",
813
+ params: query_string_params,
814
+ method_name: "cancel_operation",
804
815
  options: options
805
816
  )
806
817
  operation = ::Gapic::Rest::TransportOperation.new response
807
818
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
808
-
809
- yield result, operation if block_given?
810
- result
819
+ catch :response do
820
+ yield result, operation if block_given?
821
+ result
822
+ end
811
823
  end
812
824
 
813
825
  ##