google-cloud-secret_manager-v1beta2 0.1.0 → 0.2.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.
@@ -39,6 +39,9 @@ module Google
39
39
  # * {::Google::Cloud::SecretManager::V1beta2::SecretVersion SecretVersion}
40
40
  #
41
41
  class Client
42
+ # @private
43
+ API_VERSION = ""
44
+
42
45
  # @private
43
46
  DEFAULT_ENDPOINT_TEMPLATE = "secretmanager.$UNIVERSE_DOMAIN$"
44
47
 
@@ -187,15 +190,27 @@ module Google
187
190
  endpoint: @config.endpoint,
188
191
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
189
192
  universe_domain: @config.universe_domain,
190
- credentials: credentials
193
+ credentials: credentials,
194
+ logger: @config.logger
191
195
  )
192
196
 
197
+ @secret_manager_service_stub.logger(stub: true)&.info do |entry|
198
+ entry.set_system_name
199
+ entry.set_service
200
+ entry.message = "Created client for #{entry.service}"
201
+ entry.set_credentials_fields credentials
202
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
203
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
204
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
205
+ end
206
+
193
207
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
194
208
  config.credentials = credentials
195
209
  config.quota_project = @quota_project_id
196
210
  config.endpoint = @secret_manager_service_stub.endpoint
197
211
  config.universe_domain = @secret_manager_service_stub.universe_domain
198
212
  config.bindings_override = @config.bindings_override
213
+ config.logger = @secret_manager_service_stub.logger if config.respond_to? :logger=
199
214
  end
200
215
  end
201
216
 
@@ -206,6 +221,15 @@ module Google
206
221
  #
207
222
  attr_reader :location_client
208
223
 
224
+ ##
225
+ # The logger used for request/response debug logging.
226
+ #
227
+ # @return [Logger]
228
+ #
229
+ def logger
230
+ @secret_manager_service_stub.logger
231
+ end
232
+
209
233
  # Service calls
210
234
 
211
235
  ##
@@ -281,12 +305,13 @@ module Google
281
305
  # Customize the options with defaults
282
306
  call_metadata = @config.rpcs.list_secrets.metadata.to_h
283
307
 
284
- # Set x-goog-api-client and x-goog-user-project headers
308
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
285
309
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
286
310
  lib_name: @config.lib_name, lib_version: @config.lib_version,
287
311
  gapic_version: ::Google::Cloud::SecretManager::V1beta2::VERSION,
288
312
  transports_version_send: [:rest]
289
313
 
314
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
290
315
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
291
316
 
292
317
  options.apply_defaults timeout: @config.rpcs.list_secrets.timeout,
@@ -300,7 +325,7 @@ module Google
300
325
  @secret_manager_service_stub.list_secrets request, options do |result, operation|
301
326
  result = ::Gapic::Rest::PagedEnumerable.new @secret_manager_service_stub, :list_secrets, "secrets", request, result, options
302
327
  yield result, operation if block_given?
303
- return result
328
+ throw :response, result
304
329
  end
305
330
  rescue ::Gapic::Rest::Error => e
306
331
  raise ::Google::Cloud::Error.from_error(e)
@@ -373,12 +398,13 @@ module Google
373
398
  # Customize the options with defaults
374
399
  call_metadata = @config.rpcs.create_secret.metadata.to_h
375
400
 
376
- # Set x-goog-api-client and x-goog-user-project headers
401
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
377
402
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
378
403
  lib_name: @config.lib_name, lib_version: @config.lib_version,
379
404
  gapic_version: ::Google::Cloud::SecretManager::V1beta2::VERSION,
380
405
  transports_version_send: [:rest]
381
406
 
407
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
382
408
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
383
409
 
384
410
  options.apply_defaults timeout: @config.rpcs.create_secret.timeout,
@@ -391,7 +417,6 @@ module Google
391
417
 
392
418
  @secret_manager_service_stub.create_secret request, options do |result, operation|
393
419
  yield result, operation if block_given?
394
- return result
395
420
  end
396
421
  rescue ::Gapic::Rest::Error => e
397
422
  raise ::Google::Cloud::Error.from_error(e)
@@ -460,12 +485,13 @@ module Google
460
485
  # Customize the options with defaults
461
486
  call_metadata = @config.rpcs.add_secret_version.metadata.to_h
462
487
 
463
- # Set x-goog-api-client and x-goog-user-project headers
488
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
464
489
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
465
490
  lib_name: @config.lib_name, lib_version: @config.lib_version,
466
491
  gapic_version: ::Google::Cloud::SecretManager::V1beta2::VERSION,
467
492
  transports_version_send: [:rest]
468
493
 
494
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
469
495
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
470
496
 
471
497
  options.apply_defaults timeout: @config.rpcs.add_secret_version.timeout,
@@ -478,7 +504,6 @@ module Google
478
504
 
479
505
  @secret_manager_service_stub.add_secret_version request, options do |result, operation|
480
506
  yield result, operation if block_given?
481
- return result
482
507
  end
483
508
  rescue ::Gapic::Rest::Error => e
484
509
  raise ::Google::Cloud::Error.from_error(e)
@@ -541,12 +566,13 @@ module Google
541
566
  # Customize the options with defaults
542
567
  call_metadata = @config.rpcs.get_secret.metadata.to_h
543
568
 
544
- # Set x-goog-api-client and x-goog-user-project headers
569
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
545
570
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
546
571
  lib_name: @config.lib_name, lib_version: @config.lib_version,
547
572
  gapic_version: ::Google::Cloud::SecretManager::V1beta2::VERSION,
548
573
  transports_version_send: [:rest]
549
574
 
575
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
550
576
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
551
577
 
552
578
  options.apply_defaults timeout: @config.rpcs.get_secret.timeout,
@@ -559,7 +585,6 @@ module Google
559
585
 
560
586
  @secret_manager_service_stub.get_secret request, options do |result, operation|
561
587
  yield result, operation if block_given?
562
- return result
563
588
  end
564
589
  rescue ::Gapic::Rest::Error => e
565
590
  raise ::Google::Cloud::Error.from_error(e)
@@ -623,12 +648,13 @@ module Google
623
648
  # Customize the options with defaults
624
649
  call_metadata = @config.rpcs.update_secret.metadata.to_h
625
650
 
626
- # Set x-goog-api-client and x-goog-user-project headers
651
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
627
652
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
628
653
  lib_name: @config.lib_name, lib_version: @config.lib_version,
629
654
  gapic_version: ::Google::Cloud::SecretManager::V1beta2::VERSION,
630
655
  transports_version_send: [:rest]
631
656
 
657
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
632
658
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
633
659
 
634
660
  options.apply_defaults timeout: @config.rpcs.update_secret.timeout,
@@ -641,7 +667,6 @@ module Google
641
667
 
642
668
  @secret_manager_service_stub.update_secret request, options do |result, operation|
643
669
  yield result, operation if block_given?
644
- return result
645
670
  end
646
671
  rescue ::Gapic::Rest::Error => e
647
672
  raise ::Google::Cloud::Error.from_error(e)
@@ -707,12 +732,13 @@ module Google
707
732
  # Customize the options with defaults
708
733
  call_metadata = @config.rpcs.delete_secret.metadata.to_h
709
734
 
710
- # Set x-goog-api-client and x-goog-user-project headers
735
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
711
736
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
712
737
  lib_name: @config.lib_name, lib_version: @config.lib_version,
713
738
  gapic_version: ::Google::Cloud::SecretManager::V1beta2::VERSION,
714
739
  transports_version_send: [:rest]
715
740
 
741
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
716
742
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
717
743
 
718
744
  options.apply_defaults timeout: @config.rpcs.delete_secret.timeout,
@@ -725,7 +751,6 @@ module Google
725
751
 
726
752
  @secret_manager_service_stub.delete_secret request, options do |result, operation|
727
753
  yield result, operation if block_given?
728
- return result
729
754
  end
730
755
  rescue ::Gapic::Rest::Error => e
731
756
  raise ::Google::Cloud::Error.from_error(e)
@@ -806,12 +831,13 @@ module Google
806
831
  # Customize the options with defaults
807
832
  call_metadata = @config.rpcs.list_secret_versions.metadata.to_h
808
833
 
809
- # Set x-goog-api-client and x-goog-user-project headers
834
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
810
835
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
811
836
  lib_name: @config.lib_name, lib_version: @config.lib_version,
812
837
  gapic_version: ::Google::Cloud::SecretManager::V1beta2::VERSION,
813
838
  transports_version_send: [:rest]
814
839
 
840
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
815
841
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
816
842
 
817
843
  options.apply_defaults timeout: @config.rpcs.list_secret_versions.timeout,
@@ -825,7 +851,7 @@ module Google
825
851
  @secret_manager_service_stub.list_secret_versions request, options do |result, operation|
826
852
  result = ::Gapic::Rest::PagedEnumerable.new @secret_manager_service_stub, :list_secret_versions, "versions", request, result, options
827
853
  yield result, operation if block_given?
828
- return result
854
+ throw :response, result
829
855
  end
830
856
  rescue ::Gapic::Rest::Error => e
831
857
  raise ::Google::Cloud::Error.from_error(e)
@@ -897,12 +923,13 @@ module Google
897
923
  # Customize the options with defaults
898
924
  call_metadata = @config.rpcs.get_secret_version.metadata.to_h
899
925
 
900
- # Set x-goog-api-client and x-goog-user-project headers
926
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
901
927
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
902
928
  lib_name: @config.lib_name, lib_version: @config.lib_version,
903
929
  gapic_version: ::Google::Cloud::SecretManager::V1beta2::VERSION,
904
930
  transports_version_send: [:rest]
905
931
 
932
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
906
933
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
907
934
 
908
935
  options.apply_defaults timeout: @config.rpcs.get_secret_version.timeout,
@@ -915,7 +942,6 @@ module Google
915
942
 
916
943
  @secret_manager_service_stub.get_secret_version request, options do |result, operation|
917
944
  yield result, operation if block_given?
918
- return result
919
945
  end
920
946
  rescue ::Gapic::Rest::Error => e
921
947
  raise ::Google::Cloud::Error.from_error(e)
@@ -988,12 +1014,13 @@ module Google
988
1014
  # Customize the options with defaults
989
1015
  call_metadata = @config.rpcs.access_secret_version.metadata.to_h
990
1016
 
991
- # Set x-goog-api-client and x-goog-user-project headers
1017
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
992
1018
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
993
1019
  lib_name: @config.lib_name, lib_version: @config.lib_version,
994
1020
  gapic_version: ::Google::Cloud::SecretManager::V1beta2::VERSION,
995
1021
  transports_version_send: [:rest]
996
1022
 
1023
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
997
1024
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
998
1025
 
999
1026
  options.apply_defaults timeout: @config.rpcs.access_secret_version.timeout,
@@ -1006,7 +1033,6 @@ module Google
1006
1033
 
1007
1034
  @secret_manager_service_stub.access_secret_version request, options do |result, operation|
1008
1035
  yield result, operation if block_given?
1009
- return result
1010
1036
  end
1011
1037
  rescue ::Gapic::Rest::Error => e
1012
1038
  raise ::Google::Cloud::Error.from_error(e)
@@ -1079,12 +1105,13 @@ module Google
1079
1105
  # Customize the options with defaults
1080
1106
  call_metadata = @config.rpcs.disable_secret_version.metadata.to_h
1081
1107
 
1082
- # Set x-goog-api-client and x-goog-user-project headers
1108
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1083
1109
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1084
1110
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1085
1111
  gapic_version: ::Google::Cloud::SecretManager::V1beta2::VERSION,
1086
1112
  transports_version_send: [:rest]
1087
1113
 
1114
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1088
1115
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1089
1116
 
1090
1117
  options.apply_defaults timeout: @config.rpcs.disable_secret_version.timeout,
@@ -1097,7 +1124,6 @@ module Google
1097
1124
 
1098
1125
  @secret_manager_service_stub.disable_secret_version request, options do |result, operation|
1099
1126
  yield result, operation if block_given?
1100
- return result
1101
1127
  end
1102
1128
  rescue ::Gapic::Rest::Error => e
1103
1129
  raise ::Google::Cloud::Error.from_error(e)
@@ -1170,12 +1196,13 @@ module Google
1170
1196
  # Customize the options with defaults
1171
1197
  call_metadata = @config.rpcs.enable_secret_version.metadata.to_h
1172
1198
 
1173
- # Set x-goog-api-client and x-goog-user-project headers
1199
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1174
1200
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1175
1201
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1176
1202
  gapic_version: ::Google::Cloud::SecretManager::V1beta2::VERSION,
1177
1203
  transports_version_send: [:rest]
1178
1204
 
1205
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1179
1206
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1180
1207
 
1181
1208
  options.apply_defaults timeout: @config.rpcs.enable_secret_version.timeout,
@@ -1188,7 +1215,6 @@ module Google
1188
1215
 
1189
1216
  @secret_manager_service_stub.enable_secret_version request, options do |result, operation|
1190
1217
  yield result, operation if block_given?
1191
- return result
1192
1218
  end
1193
1219
  rescue ::Gapic::Rest::Error => e
1194
1220
  raise ::Google::Cloud::Error.from_error(e)
@@ -1262,12 +1288,13 @@ module Google
1262
1288
  # Customize the options with defaults
1263
1289
  call_metadata = @config.rpcs.destroy_secret_version.metadata.to_h
1264
1290
 
1265
- # Set x-goog-api-client and x-goog-user-project headers
1291
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1266
1292
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1267
1293
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1268
1294
  gapic_version: ::Google::Cloud::SecretManager::V1beta2::VERSION,
1269
1295
  transports_version_send: [:rest]
1270
1296
 
1297
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1271
1298
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1272
1299
 
1273
1300
  options.apply_defaults timeout: @config.rpcs.destroy_secret_version.timeout,
@@ -1280,7 +1307,6 @@ module Google
1280
1307
 
1281
1308
  @secret_manager_service_stub.destroy_secret_version request, options do |result, operation|
1282
1309
  yield result, operation if block_given?
1283
- return result
1284
1310
  end
1285
1311
  rescue ::Gapic::Rest::Error => e
1286
1312
  raise ::Google::Cloud::Error.from_error(e)
@@ -1358,12 +1384,13 @@ module Google
1358
1384
  # Customize the options with defaults
1359
1385
  call_metadata = @config.rpcs.set_iam_policy.metadata.to_h
1360
1386
 
1361
- # Set x-goog-api-client and x-goog-user-project headers
1387
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1362
1388
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1363
1389
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1364
1390
  gapic_version: ::Google::Cloud::SecretManager::V1beta2::VERSION,
1365
1391
  transports_version_send: [:rest]
1366
1392
 
1393
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1367
1394
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1368
1395
 
1369
1396
  options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
@@ -1376,7 +1403,6 @@ module Google
1376
1403
 
1377
1404
  @secret_manager_service_stub.set_iam_policy request, options do |result, operation|
1378
1405
  yield result, operation if block_given?
1379
- return result
1380
1406
  end
1381
1407
  rescue ::Gapic::Rest::Error => e
1382
1408
  raise ::Google::Cloud::Error.from_error(e)
@@ -1441,12 +1467,13 @@ module Google
1441
1467
  # Customize the options with defaults
1442
1468
  call_metadata = @config.rpcs.get_iam_policy.metadata.to_h
1443
1469
 
1444
- # Set x-goog-api-client and x-goog-user-project headers
1470
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1445
1471
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1446
1472
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1447
1473
  gapic_version: ::Google::Cloud::SecretManager::V1beta2::VERSION,
1448
1474
  transports_version_send: [:rest]
1449
1475
 
1476
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1450
1477
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1451
1478
 
1452
1479
  options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
@@ -1459,7 +1486,6 @@ module Google
1459
1486
 
1460
1487
  @secret_manager_service_stub.get_iam_policy request, options do |result, operation|
1461
1488
  yield result, operation if block_given?
1462
- return result
1463
1489
  end
1464
1490
  rescue ::Gapic::Rest::Error => e
1465
1491
  raise ::Google::Cloud::Error.from_error(e)
@@ -1531,12 +1557,13 @@ module Google
1531
1557
  # Customize the options with defaults
1532
1558
  call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
1533
1559
 
1534
- # Set x-goog-api-client and x-goog-user-project headers
1560
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1535
1561
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1536
1562
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1537
1563
  gapic_version: ::Google::Cloud::SecretManager::V1beta2::VERSION,
1538
1564
  transports_version_send: [:rest]
1539
1565
 
1566
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1540
1567
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1541
1568
 
1542
1569
  options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
@@ -1549,7 +1576,6 @@ module Google
1549
1576
 
1550
1577
  @secret_manager_service_stub.test_iam_permissions request, options do |result, operation|
1551
1578
  yield result, operation if block_given?
1552
- return result
1553
1579
  end
1554
1580
  rescue ::Gapic::Rest::Error => e
1555
1581
  raise ::Google::Cloud::Error.from_error(e)
@@ -1629,6 +1655,11 @@ module Google
1629
1655
  # default endpoint URL. The default value of nil uses the environment
1630
1656
  # universe (usually the default "googleapis.com" universe).
1631
1657
  # @return [::String,nil]
1658
+ # @!attribute [rw] logger
1659
+ # A custom logger to use for request/response debug logging, or the value
1660
+ # `:default` (the default) to construct a default logger, or `nil` to
1661
+ # explicitly disable logging.
1662
+ # @return [::Logger,:default,nil]
1632
1663
  #
1633
1664
  class Configuration
1634
1665
  extend ::Gapic::Config
@@ -1657,6 +1688,7 @@ module Google
1657
1688
  # by the host service.
1658
1689
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1659
1690
  config_attr :bindings_override, {}, ::Hash, nil
1691
+ config_attr :logger, :default, ::Logger, nil, :default
1660
1692
 
1661
1693
  # @private
1662
1694
  def initialize parent_config = nil