google-cloud-kms-v1 1.2.1 → 1.3.1

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)
@@ -1482,7 +1496,9 @@ module Google
1482
1496
  # {::Google::Cloud::Kms::V1::CryptoKeyVersion CryptoKeyVersion}, the
1483
1497
  # {::Google::Cloud::Kms::V1::CryptoKeyVersion CryptoKeyVersion} must be a child of
1484
1498
  # {::Google::Cloud::Kms::V1::ImportCryptoKeyVersionRequest#parent ImportCryptoKeyVersionRequest.parent},
1485
- # have been previously created via [ImportCryptoKeyVersion][], and be in
1499
+ # have been previously created via
1500
+ # {::Google::Cloud::Kms::V1::KeyManagementService::Rest::Client#import_crypto_key_version ImportCryptoKeyVersion},
1501
+ # and be in
1486
1502
  # {::Google::Cloud::Kms::V1::CryptoKeyVersion::CryptoKeyVersionState::DESTROYED DESTROYED}
1487
1503
  # or
1488
1504
  # {::Google::Cloud::Kms::V1::CryptoKeyVersion::CryptoKeyVersionState::IMPORT_FAILED IMPORT_FAILED}
@@ -1598,7 +1614,6 @@ module Google
1598
1614
 
1599
1615
  @key_management_service_stub.import_crypto_key_version request, options do |result, operation|
1600
1616
  yield result, operation if block_given?
1601
- return result
1602
1617
  end
1603
1618
  rescue ::Gapic::Rest::Error => e
1604
1619
  raise ::Google::Cloud::Error.from_error(e)
@@ -1689,7 +1704,6 @@ module Google
1689
1704
 
1690
1705
  @key_management_service_stub.create_import_job request, options do |result, operation|
1691
1706
  yield result, operation if block_given?
1692
- return result
1693
1707
  end
1694
1708
  rescue ::Gapic::Rest::Error => e
1695
1709
  raise ::Google::Cloud::Error.from_error(e)
@@ -1770,7 +1784,6 @@ module Google
1770
1784
 
1771
1785
  @key_management_service_stub.update_crypto_key request, options do |result, operation|
1772
1786
  yield result, operation if block_given?
1773
- return result
1774
1787
  end
1775
1788
  rescue ::Gapic::Rest::Error => e
1776
1789
  raise ::Google::Cloud::Error.from_error(e)
@@ -1863,7 +1876,6 @@ module Google
1863
1876
 
1864
1877
  @key_management_service_stub.update_crypto_key_version request, options do |result, operation|
1865
1878
  yield result, operation if block_given?
1866
- return result
1867
1879
  end
1868
1880
  rescue ::Gapic::Rest::Error => e
1869
1881
  raise ::Google::Cloud::Error.from_error(e)
@@ -1951,7 +1963,6 @@ module Google
1951
1963
 
1952
1964
  @key_management_service_stub.update_crypto_key_primary_version request, options do |result, operation|
1953
1965
  yield result, operation if block_given?
1954
- return result
1955
1966
  end
1956
1967
  rescue ::Gapic::Rest::Error => e
1957
1968
  raise ::Google::Cloud::Error.from_error(e)
@@ -2051,7 +2062,6 @@ module Google
2051
2062
 
2052
2063
  @key_management_service_stub.destroy_crypto_key_version request, options do |result, operation|
2053
2064
  yield result, operation if block_given?
2054
- return result
2055
2065
  end
2056
2066
  rescue ::Gapic::Rest::Error => e
2057
2067
  raise ::Google::Cloud::Error.from_error(e)
@@ -2139,7 +2149,6 @@ module Google
2139
2149
 
2140
2150
  @key_management_service_stub.restore_crypto_key_version request, options do |result, operation|
2141
2151
  yield result, operation if block_given?
2142
- return result
2143
2152
  end
2144
2153
  rescue ::Gapic::Rest::Error => e
2145
2154
  raise ::Google::Cloud::Error.from_error(e)
@@ -2293,7 +2302,6 @@ module Google
2293
2302
 
2294
2303
  @key_management_service_stub.encrypt request, options do |result, operation|
2295
2304
  yield result, operation if block_given?
2296
- return result
2297
2305
  end
2298
2306
  rescue ::Gapic::Rest::Error => e
2299
2307
  raise ::Google::Cloud::Error.from_error(e)
@@ -2423,7 +2431,6 @@ module Google
2423
2431
 
2424
2432
  @key_management_service_stub.decrypt request, options do |result, operation|
2425
2433
  yield result, operation if block_given?
2426
- return result
2427
2434
  end
2428
2435
  rescue ::Gapic::Rest::Error => e
2429
2436
  raise ::Google::Cloud::Error.from_error(e)
@@ -2590,7 +2597,6 @@ module Google
2590
2597
 
2591
2598
  @key_management_service_stub.raw_encrypt request, options do |result, operation|
2592
2599
  yield result, operation if block_given?
2593
- return result
2594
2600
  end
2595
2601
  rescue ::Gapic::Rest::Error => e
2596
2602
  raise ::Google::Cloud::Error.from_error(e)
@@ -2737,7 +2743,6 @@ module Google
2737
2743
 
2738
2744
  @key_management_service_stub.raw_decrypt request, options do |result, operation|
2739
2745
  yield result, operation if block_given?
2740
- return result
2741
2746
  end
2742
2747
  rescue ::Gapic::Rest::Error => e
2743
2748
  raise ::Google::Cloud::Error.from_error(e)
@@ -2875,7 +2880,6 @@ module Google
2875
2880
 
2876
2881
  @key_management_service_stub.asymmetric_sign request, options do |result, operation|
2877
2882
  yield result, operation if block_given?
2878
- return result
2879
2883
  end
2880
2884
  rescue ::Gapic::Rest::Error => e
2881
2885
  raise ::Google::Cloud::Error.from_error(e)
@@ -2984,7 +2988,6 @@ module Google
2984
2988
 
2985
2989
  @key_management_service_stub.asymmetric_decrypt request, options do |result, operation|
2986
2990
  yield result, operation if block_given?
2987
- return result
2988
2991
  end
2989
2992
  rescue ::Gapic::Rest::Error => e
2990
2993
  raise ::Google::Cloud::Error.from_error(e)
@@ -3088,7 +3091,6 @@ module Google
3088
3091
 
3089
3092
  @key_management_service_stub.mac_sign request, options do |result, operation|
3090
3093
  yield result, operation if block_given?
3091
- return result
3092
3094
  end
3093
3095
  rescue ::Gapic::Rest::Error => e
3094
3096
  raise ::Google::Cloud::Error.from_error(e)
@@ -3153,7 +3155,8 @@ module Google
3153
3155
  # checksum. {::Google::Cloud::Kms::V1::KeyManagementService::Rest::Client KeyManagementService}
3154
3156
  # will report an error if the checksum verification fails. If you receive a
3155
3157
  # checksum error, your client should verify that
3156
- # CRC32C([MacVerifyRequest.tag][]) is equal to
3158
+ # CRC32C({::Google::Cloud::Kms::V1::MacVerifyRequest#mac MacVerifyRequest.mac}) is
3159
+ # equal to
3157
3160
  # {::Google::Cloud::Kms::V1::MacVerifyRequest#mac_crc32c MacVerifyRequest.mac_crc32c},
3158
3161
  # and if so, perform a limited number of retries. A persistent mismatch may
3159
3162
  # indicate an issue in your computation of the CRC32C checksum. Note: This
@@ -3214,7 +3217,6 @@ module Google
3214
3217
 
3215
3218
  @key_management_service_stub.mac_verify request, options do |result, operation|
3216
3219
  yield result, operation if block_given?
3217
- return result
3218
3220
  end
3219
3221
  rescue ::Gapic::Rest::Error => e
3220
3222
  raise ::Google::Cloud::Error.from_error(e)
@@ -3303,7 +3305,6 @@ module Google
3303
3305
 
3304
3306
  @key_management_service_stub.generate_random_bytes request, options do |result, operation|
3305
3307
  yield result, operation if block_given?
3306
- return result
3307
3308
  end
3308
3309
  rescue ::Gapic::Rest::Error => e
3309
3310
  raise ::Google::Cloud::Error.from_error(e)
@@ -3383,6 +3384,11 @@ module Google
3383
3384
  # default endpoint URL. The default value of nil uses the environment
3384
3385
  # universe (usually the default "googleapis.com" universe).
3385
3386
  # @return [::String,nil]
3387
+ # @!attribute [rw] logger
3388
+ # A custom logger to use for request/response debug logging, or the value
3389
+ # `:default` (the default) to construct a default logger, or `nil` to
3390
+ # explicitly disable logging.
3391
+ # @return [::Logger,:default,nil]
3386
3392
  #
3387
3393
  class Configuration
3388
3394
  extend ::Gapic::Config
@@ -3411,6 +3417,7 @@ module Google
3411
3417
  # by the host service.
3412
3418
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
3413
3419
  config_attr :bindings_override, {}, ::Hash, nil
3420
+ config_attr :logger, :default, ::Logger, nil, :default
3414
3421
 
3415
3422
  # @private
3416
3423
  def initialize parent_config = nil