google-cloud-service_directory-v1 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -170,15 +170,27 @@ module Google
170
170
  endpoint: @config.endpoint,
171
171
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
172
172
  universe_domain: @config.universe_domain,
173
- credentials: credentials
173
+ credentials: credentials,
174
+ logger: @config.logger
174
175
  )
175
176
 
177
+ @registration_service_stub.logger(stub: true)&.info do |entry|
178
+ entry.set_system_name
179
+ entry.set_service
180
+ entry.message = "Created client for #{entry.service}"
181
+ entry.set_credentials_fields credentials
182
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
183
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
184
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
185
+ end
186
+
176
187
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
177
188
  config.credentials = credentials
178
189
  config.quota_project = @quota_project_id
179
190
  config.endpoint = @registration_service_stub.endpoint
180
191
  config.universe_domain = @registration_service_stub.universe_domain
181
192
  config.bindings_override = @config.bindings_override
193
+ config.logger = @registration_service_stub.logger if config.respond_to? :logger=
182
194
  end
183
195
  end
184
196
 
@@ -189,6 +201,15 @@ module Google
189
201
  #
190
202
  attr_reader :location_client
191
203
 
204
+ ##
205
+ # The logger used for request/response debug logging.
206
+ #
207
+ # @return [Logger]
208
+ #
209
+ def logger
210
+ @registration_service_stub.logger
211
+ end
212
+
192
213
  # Service calls
193
214
 
194
215
  ##
@@ -275,7 +296,6 @@ module Google
275
296
 
276
297
  @registration_service_stub.create_namespace request, options do |result, operation|
277
298
  yield result, operation if block_given?
278
- return result
279
299
  end
280
300
  rescue ::Gapic::Rest::Error => e
281
301
  raise ::Google::Cloud::Error.from_error(e)
@@ -405,7 +425,7 @@ module Google
405
425
  @registration_service_stub.list_namespaces request, options do |result, operation|
406
426
  result = ::Gapic::Rest::PagedEnumerable.new @registration_service_stub, :list_namespaces, "namespaces", request, result, options
407
427
  yield result, operation if block_given?
408
- return result
428
+ throw :response, result
409
429
  end
410
430
  rescue ::Gapic::Rest::Error => e
411
431
  raise ::Google::Cloud::Error.from_error(e)
@@ -484,7 +504,6 @@ module Google
484
504
 
485
505
  @registration_service_stub.get_namespace request, options do |result, operation|
486
506
  yield result, operation if block_given?
487
- return result
488
507
  end
489
508
  rescue ::Gapic::Rest::Error => e
490
509
  raise ::Google::Cloud::Error.from_error(e)
@@ -565,7 +584,6 @@ module Google
565
584
 
566
585
  @registration_service_stub.update_namespace request, options do |result, operation|
567
586
  yield result, operation if block_given?
568
- return result
569
587
  end
570
588
  rescue ::Gapic::Rest::Error => e
571
589
  raise ::Google::Cloud::Error.from_error(e)
@@ -645,7 +663,6 @@ module Google
645
663
 
646
664
  @registration_service_stub.delete_namespace request, options do |result, operation|
647
665
  yield result, operation if block_given?
648
- return result
649
666
  end
650
667
  rescue ::Gapic::Rest::Error => e
651
668
  raise ::Google::Cloud::Error.from_error(e)
@@ -734,7 +751,6 @@ module Google
734
751
 
735
752
  @registration_service_stub.create_service request, options do |result, operation|
736
753
  yield result, operation if block_given?
737
- return result
738
754
  end
739
755
  rescue ::Gapic::Rest::Error => e
740
756
  raise ::Google::Cloud::Error.from_error(e)
@@ -866,7 +882,7 @@ module Google
866
882
  @registration_service_stub.list_services request, options do |result, operation|
867
883
  result = ::Gapic::Rest::PagedEnumerable.new @registration_service_stub, :list_services, "services", request, result, options
868
884
  yield result, operation if block_given?
869
- return result
885
+ throw :response, result
870
886
  end
871
887
  rescue ::Gapic::Rest::Error => e
872
888
  raise ::Google::Cloud::Error.from_error(e)
@@ -945,7 +961,6 @@ module Google
945
961
 
946
962
  @registration_service_stub.get_service request, options do |result, operation|
947
963
  yield result, operation if block_given?
948
- return result
949
964
  end
950
965
  rescue ::Gapic::Rest::Error => e
951
966
  raise ::Google::Cloud::Error.from_error(e)
@@ -1026,7 +1041,6 @@ module Google
1026
1041
 
1027
1042
  @registration_service_stub.update_service request, options do |result, operation|
1028
1043
  yield result, operation if block_given?
1029
- return result
1030
1044
  end
1031
1045
  rescue ::Gapic::Rest::Error => e
1032
1046
  raise ::Google::Cloud::Error.from_error(e)
@@ -1106,7 +1120,6 @@ module Google
1106
1120
 
1107
1121
  @registration_service_stub.delete_service request, options do |result, operation|
1108
1122
  yield result, operation if block_given?
1109
- return result
1110
1123
  end
1111
1124
  rescue ::Gapic::Rest::Error => e
1112
1125
  raise ::Google::Cloud::Error.from_error(e)
@@ -1195,7 +1208,6 @@ module Google
1195
1208
 
1196
1209
  @registration_service_stub.create_endpoint request, options do |result, operation|
1197
1210
  yield result, operation if block_given?
1198
- return result
1199
1211
  end
1200
1212
  rescue ::Gapic::Rest::Error => e
1201
1213
  raise ::Google::Cloud::Error.from_error(e)
@@ -1330,7 +1342,7 @@ module Google
1330
1342
  @registration_service_stub.list_endpoints request, options do |result, operation|
1331
1343
  result = ::Gapic::Rest::PagedEnumerable.new @registration_service_stub, :list_endpoints, "endpoints", request, result, options
1332
1344
  yield result, operation if block_given?
1333
- return result
1345
+ throw :response, result
1334
1346
  end
1335
1347
  rescue ::Gapic::Rest::Error => e
1336
1348
  raise ::Google::Cloud::Error.from_error(e)
@@ -1409,7 +1421,6 @@ module Google
1409
1421
 
1410
1422
  @registration_service_stub.get_endpoint request, options do |result, operation|
1411
1423
  yield result, operation if block_given?
1412
- return result
1413
1424
  end
1414
1425
  rescue ::Gapic::Rest::Error => e
1415
1426
  raise ::Google::Cloud::Error.from_error(e)
@@ -1490,7 +1501,6 @@ module Google
1490
1501
 
1491
1502
  @registration_service_stub.update_endpoint request, options do |result, operation|
1492
1503
  yield result, operation if block_given?
1493
- return result
1494
1504
  end
1495
1505
  rescue ::Gapic::Rest::Error => e
1496
1506
  raise ::Google::Cloud::Error.from_error(e)
@@ -1569,7 +1579,6 @@ module Google
1569
1579
 
1570
1580
  @registration_service_stub.delete_endpoint request, options do |result, operation|
1571
1581
  yield result, operation if block_given?
1572
- return result
1573
1582
  end
1574
1583
  rescue ::Gapic::Rest::Error => e
1575
1584
  raise ::Google::Cloud::Error.from_error(e)
@@ -1652,7 +1661,6 @@ module Google
1652
1661
 
1653
1662
  @registration_service_stub.get_iam_policy request, options do |result, operation|
1654
1663
  yield result, operation if block_given?
1655
- return result
1656
1664
  end
1657
1665
  rescue ::Gapic::Rest::Error => e
1658
1666
  raise ::Google::Cloud::Error.from_error(e)
@@ -1743,7 +1751,6 @@ module Google
1743
1751
 
1744
1752
  @registration_service_stub.set_iam_policy request, options do |result, operation|
1745
1753
  yield result, operation if block_given?
1746
- return result
1747
1754
  end
1748
1755
  rescue ::Gapic::Rest::Error => e
1749
1756
  raise ::Google::Cloud::Error.from_error(e)
@@ -1828,7 +1835,6 @@ module Google
1828
1835
 
1829
1836
  @registration_service_stub.test_iam_permissions request, options do |result, operation|
1830
1837
  yield result, operation if block_given?
1831
- return result
1832
1838
  end
1833
1839
  rescue ::Gapic::Rest::Error => e
1834
1840
  raise ::Google::Cloud::Error.from_error(e)
@@ -1908,6 +1914,11 @@ module Google
1908
1914
  # default endpoint URL. The default value of nil uses the environment
1909
1915
  # universe (usually the default "googleapis.com" universe).
1910
1916
  # @return [::String,nil]
1917
+ # @!attribute [rw] logger
1918
+ # A custom logger to use for request/response debug logging, or the value
1919
+ # `:default` (the default) to construct a default logger, or `nil` to
1920
+ # explicitly disable logging.
1921
+ # @return [::Logger,:default,nil]
1911
1922
  #
1912
1923
  class Configuration
1913
1924
  extend ::Gapic::Config
@@ -1936,6 +1947,7 @@ module Google
1936
1947
  # by the host service.
1937
1948
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1938
1949
  config_attr :bindings_override, {}, ::Hash, nil
1950
+ config_attr :logger, :default, ::Logger, nil, :default
1939
1951
 
1940
1952
  # @private
1941
1953
  def initialize parent_config = nil