google-cloud-kms-v1 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -287,15 +287,27 @@ module Google
287
287
  endpoint: @config.endpoint,
288
288
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
289
289
  universe_domain: @config.universe_domain,
290
- credentials: credentials
290
+ credentials: credentials,
291
+ logger: @config.logger
291
292
  )
292
293
 
294
+ @key_management_service_stub.logger(stub: true)&.info do |entry|
295
+ entry.set_system_name
296
+ entry.set_service
297
+ entry.message = "Created client for #{entry.service}"
298
+ entry.set_credentials_fields credentials
299
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
300
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
301
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
302
+ end
303
+
293
304
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
294
305
  config.credentials = credentials
295
306
  config.quota_project = @quota_project_id
296
307
  config.endpoint = @key_management_service_stub.endpoint
297
308
  config.universe_domain = @key_management_service_stub.universe_domain
298
309
  config.bindings_override = @config.bindings_override
310
+ config.logger = @key_management_service_stub.logger if config.respond_to? :logger=
299
311
  end
300
312
 
301
313
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
@@ -304,6 +316,7 @@ module Google
304
316
  config.endpoint = @key_management_service_stub.endpoint
305
317
  config.universe_domain = @key_management_service_stub.universe_domain
306
318
  config.bindings_override = @config.bindings_override
319
+ config.logger = @key_management_service_stub.logger if config.respond_to? :logger=
307
320
  end
308
321
  end
309
322
 
@@ -321,6 +334,15 @@ module Google
321
334
  #
322
335
  attr_reader :iam_policy_client
323
336
 
337
+ ##
338
+ # The logger used for request/response debug logging.
339
+ #
340
+ # @return [Logger]
341
+ #
342
+ def logger
343
+ @key_management_service_stub.logger
344
+ end
345
+
324
346
  # Service calls
325
347
 
326
348
  ##
@@ -424,7 +446,7 @@ module Google
424
446
  @key_management_service_stub.list_key_rings request, options do |result, operation|
425
447
  result = ::Gapic::Rest::PagedEnumerable.new @key_management_service_stub, :list_key_rings, "key_rings", request, result, options
426
448
  yield result, operation if block_given?
427
- return result
449
+ throw :response, result
428
450
  end
429
451
  rescue ::Gapic::Rest::Error => e
430
452
  raise ::Google::Cloud::Error.from_error(e)
@@ -532,7 +554,7 @@ module Google
532
554
  @key_management_service_stub.list_crypto_keys request, options do |result, operation|
533
555
  result = ::Gapic::Rest::PagedEnumerable.new @key_management_service_stub, :list_crypto_keys, "crypto_keys", request, result, options
534
556
  yield result, operation if block_given?
535
- return result
557
+ throw :response, result
536
558
  end
537
559
  rescue ::Gapic::Rest::Error => e
538
560
  raise ::Google::Cloud::Error.from_error(e)
@@ -641,7 +663,7 @@ module Google
641
663
  @key_management_service_stub.list_crypto_key_versions request, options do |result, operation|
642
664
  result = ::Gapic::Rest::PagedEnumerable.new @key_management_service_stub, :list_crypto_key_versions, "crypto_key_versions", request, result, options
643
665
  yield result, operation if block_given?
644
- return result
666
+ throw :response, result
645
667
  end
646
668
  rescue ::Gapic::Rest::Error => e
647
669
  raise ::Google::Cloud::Error.from_error(e)
@@ -747,7 +769,7 @@ module Google
747
769
  @key_management_service_stub.list_import_jobs request, options do |result, operation|
748
770
  result = ::Gapic::Rest::PagedEnumerable.new @key_management_service_stub, :list_import_jobs, "import_jobs", request, result, options
749
771
  yield result, operation if block_given?
750
- return result
772
+ throw :response, result
751
773
  end
752
774
  rescue ::Gapic::Rest::Error => e
753
775
  raise ::Google::Cloud::Error.from_error(e)
@@ -827,7 +849,6 @@ module Google
827
849
 
828
850
  @key_management_service_stub.get_key_ring request, options do |result, operation|
829
851
  yield result, operation if block_given?
830
- return result
831
852
  end
832
853
  rescue ::Gapic::Rest::Error => e
833
854
  raise ::Google::Cloud::Error.from_error(e)
@@ -909,7 +930,6 @@ module Google
909
930
 
910
931
  @key_management_service_stub.get_crypto_key request, options do |result, operation|
911
932
  yield result, operation if block_given?
912
- return result
913
933
  end
914
934
  rescue ::Gapic::Rest::Error => e
915
935
  raise ::Google::Cloud::Error.from_error(e)
@@ -990,7 +1010,6 @@ module Google
990
1010
 
991
1011
  @key_management_service_stub.get_crypto_key_version request, options do |result, operation|
992
1012
  yield result, operation if block_given?
993
- return result
994
1013
  end
995
1014
  rescue ::Gapic::Rest::Error => e
996
1015
  raise ::Google::Cloud::Error.from_error(e)
@@ -1075,7 +1094,6 @@ module Google
1075
1094
 
1076
1095
  @key_management_service_stub.get_public_key request, options do |result, operation|
1077
1096
  yield result, operation if block_given?
1078
- return result
1079
1097
  end
1080
1098
  rescue ::Gapic::Rest::Error => e
1081
1099
  raise ::Google::Cloud::Error.from_error(e)
@@ -1155,7 +1173,6 @@ module Google
1155
1173
 
1156
1174
  @key_management_service_stub.get_import_job request, options do |result, operation|
1157
1175
  yield result, operation if block_given?
1158
- return result
1159
1176
  end
1160
1177
  rescue ::Gapic::Rest::Error => e
1161
1178
  raise ::Google::Cloud::Error.from_error(e)
@@ -1243,7 +1260,6 @@ module Google
1243
1260
 
1244
1261
  @key_management_service_stub.create_key_ring request, options do |result, operation|
1245
1262
  yield result, operation if block_given?
1246
- return result
1247
1263
  end
1248
1264
  rescue ::Gapic::Rest::Error => e
1249
1265
  raise ::Google::Cloud::Error.from_error(e)
@@ -1343,7 +1359,6 @@ module Google
1343
1359
 
1344
1360
  @key_management_service_stub.create_crypto_key request, options do |result, operation|
1345
1361
  yield result, operation if block_given?
1346
- return result
1347
1362
  end
1348
1363
  rescue ::Gapic::Rest::Error => e
1349
1364
  raise ::Google::Cloud::Error.from_error(e)
@@ -1432,7 +1447,6 @@ module Google
1432
1447
 
1433
1448
  @key_management_service_stub.create_crypto_key_version request, options do |result, operation|
1434
1449
  yield result, operation if block_given?
1435
- return result
1436
1450
  end
1437
1451
  rescue ::Gapic::Rest::Error => e
1438
1452
  raise ::Google::Cloud::Error.from_error(e)
@@ -1598,7 +1612,6 @@ module Google
1598
1612
 
1599
1613
  @key_management_service_stub.import_crypto_key_version request, options do |result, operation|
1600
1614
  yield result, operation if block_given?
1601
- return result
1602
1615
  end
1603
1616
  rescue ::Gapic::Rest::Error => e
1604
1617
  raise ::Google::Cloud::Error.from_error(e)
@@ -1689,7 +1702,6 @@ module Google
1689
1702
 
1690
1703
  @key_management_service_stub.create_import_job request, options do |result, operation|
1691
1704
  yield result, operation if block_given?
1692
- return result
1693
1705
  end
1694
1706
  rescue ::Gapic::Rest::Error => e
1695
1707
  raise ::Google::Cloud::Error.from_error(e)
@@ -1770,7 +1782,6 @@ module Google
1770
1782
 
1771
1783
  @key_management_service_stub.update_crypto_key request, options do |result, operation|
1772
1784
  yield result, operation if block_given?
1773
- return result
1774
1785
  end
1775
1786
  rescue ::Gapic::Rest::Error => e
1776
1787
  raise ::Google::Cloud::Error.from_error(e)
@@ -1863,7 +1874,6 @@ module Google
1863
1874
 
1864
1875
  @key_management_service_stub.update_crypto_key_version request, options do |result, operation|
1865
1876
  yield result, operation if block_given?
1866
- return result
1867
1877
  end
1868
1878
  rescue ::Gapic::Rest::Error => e
1869
1879
  raise ::Google::Cloud::Error.from_error(e)
@@ -1951,7 +1961,6 @@ module Google
1951
1961
 
1952
1962
  @key_management_service_stub.update_crypto_key_primary_version request, options do |result, operation|
1953
1963
  yield result, operation if block_given?
1954
- return result
1955
1964
  end
1956
1965
  rescue ::Gapic::Rest::Error => e
1957
1966
  raise ::Google::Cloud::Error.from_error(e)
@@ -2051,7 +2060,6 @@ module Google
2051
2060
 
2052
2061
  @key_management_service_stub.destroy_crypto_key_version request, options do |result, operation|
2053
2062
  yield result, operation if block_given?
2054
- return result
2055
2063
  end
2056
2064
  rescue ::Gapic::Rest::Error => e
2057
2065
  raise ::Google::Cloud::Error.from_error(e)
@@ -2139,7 +2147,6 @@ module Google
2139
2147
 
2140
2148
  @key_management_service_stub.restore_crypto_key_version request, options do |result, operation|
2141
2149
  yield result, operation if block_given?
2142
- return result
2143
2150
  end
2144
2151
  rescue ::Gapic::Rest::Error => e
2145
2152
  raise ::Google::Cloud::Error.from_error(e)
@@ -2293,7 +2300,6 @@ module Google
2293
2300
 
2294
2301
  @key_management_service_stub.encrypt request, options do |result, operation|
2295
2302
  yield result, operation if block_given?
2296
- return result
2297
2303
  end
2298
2304
  rescue ::Gapic::Rest::Error => e
2299
2305
  raise ::Google::Cloud::Error.from_error(e)
@@ -2423,7 +2429,6 @@ module Google
2423
2429
 
2424
2430
  @key_management_service_stub.decrypt request, options do |result, operation|
2425
2431
  yield result, operation if block_given?
2426
- return result
2427
2432
  end
2428
2433
  rescue ::Gapic::Rest::Error => e
2429
2434
  raise ::Google::Cloud::Error.from_error(e)
@@ -2590,7 +2595,6 @@ module Google
2590
2595
 
2591
2596
  @key_management_service_stub.raw_encrypt request, options do |result, operation|
2592
2597
  yield result, operation if block_given?
2593
- return result
2594
2598
  end
2595
2599
  rescue ::Gapic::Rest::Error => e
2596
2600
  raise ::Google::Cloud::Error.from_error(e)
@@ -2737,7 +2741,6 @@ module Google
2737
2741
 
2738
2742
  @key_management_service_stub.raw_decrypt request, options do |result, operation|
2739
2743
  yield result, operation if block_given?
2740
- return result
2741
2744
  end
2742
2745
  rescue ::Gapic::Rest::Error => e
2743
2746
  raise ::Google::Cloud::Error.from_error(e)
@@ -2875,7 +2878,6 @@ module Google
2875
2878
 
2876
2879
  @key_management_service_stub.asymmetric_sign request, options do |result, operation|
2877
2880
  yield result, operation if block_given?
2878
- return result
2879
2881
  end
2880
2882
  rescue ::Gapic::Rest::Error => e
2881
2883
  raise ::Google::Cloud::Error.from_error(e)
@@ -2984,7 +2986,6 @@ module Google
2984
2986
 
2985
2987
  @key_management_service_stub.asymmetric_decrypt request, options do |result, operation|
2986
2988
  yield result, operation if block_given?
2987
- return result
2988
2989
  end
2989
2990
  rescue ::Gapic::Rest::Error => e
2990
2991
  raise ::Google::Cloud::Error.from_error(e)
@@ -3088,7 +3089,6 @@ module Google
3088
3089
 
3089
3090
  @key_management_service_stub.mac_sign request, options do |result, operation|
3090
3091
  yield result, operation if block_given?
3091
- return result
3092
3092
  end
3093
3093
  rescue ::Gapic::Rest::Error => e
3094
3094
  raise ::Google::Cloud::Error.from_error(e)
@@ -3214,7 +3214,6 @@ module Google
3214
3214
 
3215
3215
  @key_management_service_stub.mac_verify request, options do |result, operation|
3216
3216
  yield result, operation if block_given?
3217
- return result
3218
3217
  end
3219
3218
  rescue ::Gapic::Rest::Error => e
3220
3219
  raise ::Google::Cloud::Error.from_error(e)
@@ -3303,7 +3302,6 @@ module Google
3303
3302
 
3304
3303
  @key_management_service_stub.generate_random_bytes request, options do |result, operation|
3305
3304
  yield result, operation if block_given?
3306
- return result
3307
3305
  end
3308
3306
  rescue ::Gapic::Rest::Error => e
3309
3307
  raise ::Google::Cloud::Error.from_error(e)
@@ -3383,6 +3381,11 @@ module Google
3383
3381
  # default endpoint URL. The default value of nil uses the environment
3384
3382
  # universe (usually the default "googleapis.com" universe).
3385
3383
  # @return [::String,nil]
3384
+ # @!attribute [rw] logger
3385
+ # A custom logger to use for request/response debug logging, or the value
3386
+ # `:default` (the default) to construct a default logger, or `nil` to
3387
+ # explicitly disable logging.
3388
+ # @return [::Logger,:default,nil]
3386
3389
  #
3387
3390
  class Configuration
3388
3391
  extend ::Gapic::Config
@@ -3411,6 +3414,7 @@ module Google
3411
3414
  # by the host service.
3412
3415
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
3413
3416
  config_attr :bindings_override, {}, ::Hash, nil
3417
+ config_attr :logger, :default, ::Logger, nil, :default
3414
3418
 
3415
3419
  # @private
3416
3420
  def initialize parent_config = nil