google-cloud-secret_manager-v1beta1 0.15.0 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -38,6 +38,9 @@ module Google
38
38
  # * {::Google::Cloud::SecretManager::V1beta1::SecretVersion SecretVersion}
39
39
  #
40
40
  class Client
41
+ # @private
42
+ API_VERSION = ""
43
+
41
44
  # @private
42
45
  DEFAULT_ENDPOINT_TEMPLATE = "secretmanager.$UNIVERSE_DOMAIN$"
43
46
 
@@ -186,8 +189,28 @@ module Google
186
189
  endpoint: @config.endpoint,
187
190
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
188
191
  universe_domain: @config.universe_domain,
189
- credentials: credentials
192
+ credentials: credentials,
193
+ logger: @config.logger
190
194
  )
195
+
196
+ @secret_manager_service_stub.logger(stub: true)&.info do |entry|
197
+ entry.set_system_name
198
+ entry.set_service
199
+ entry.message = "Created client for #{entry.service}"
200
+ entry.set_credentials_fields credentials
201
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
202
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
203
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
204
+ end
205
+ end
206
+
207
+ ##
208
+ # The logger used for request/response debug logging.
209
+ #
210
+ # @return [Logger]
211
+ #
212
+ def logger
213
+ @secret_manager_service_stub.logger
191
214
  end
192
215
 
193
216
  # Service calls
@@ -258,12 +281,13 @@ module Google
258
281
  # Customize the options with defaults
259
282
  call_metadata = @config.rpcs.list_secrets.metadata.to_h
260
283
 
261
- # Set x-goog-api-client and x-goog-user-project headers
284
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
262
285
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
263
286
  lib_name: @config.lib_name, lib_version: @config.lib_version,
264
287
  gapic_version: ::Google::Cloud::SecretManager::V1beta1::VERSION,
265
288
  transports_version_send: [:rest]
266
289
 
290
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
267
291
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
268
292
 
269
293
  options.apply_defaults timeout: @config.rpcs.list_secrets.timeout,
@@ -277,7 +301,7 @@ module Google
277
301
  @secret_manager_service_stub.list_secrets request, options do |result, operation|
278
302
  result = ::Gapic::Rest::PagedEnumerable.new @secret_manager_service_stub, :list_secrets, "secrets", request, result, options
279
303
  yield result, operation if block_given?
280
- return result
304
+ throw :response, result
281
305
  end
282
306
  rescue ::Gapic::Rest::Error => e
283
307
  raise ::Google::Cloud::Error.from_error(e)
@@ -346,12 +370,13 @@ module Google
346
370
  # Customize the options with defaults
347
371
  call_metadata = @config.rpcs.create_secret.metadata.to_h
348
372
 
349
- # Set x-goog-api-client and x-goog-user-project headers
373
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
350
374
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
351
375
  lib_name: @config.lib_name, lib_version: @config.lib_version,
352
376
  gapic_version: ::Google::Cloud::SecretManager::V1beta1::VERSION,
353
377
  transports_version_send: [:rest]
354
378
 
379
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
355
380
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
356
381
 
357
382
  options.apply_defaults timeout: @config.rpcs.create_secret.timeout,
@@ -364,7 +389,6 @@ module Google
364
389
 
365
390
  @secret_manager_service_stub.create_secret request, options do |result, operation|
366
391
  yield result, operation if block_given?
367
- return result
368
392
  end
369
393
  rescue ::Gapic::Rest::Error => e
370
394
  raise ::Google::Cloud::Error.from_error(e)
@@ -428,12 +452,13 @@ module Google
428
452
  # Customize the options with defaults
429
453
  call_metadata = @config.rpcs.add_secret_version.metadata.to_h
430
454
 
431
- # Set x-goog-api-client and x-goog-user-project headers
455
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
432
456
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
433
457
  lib_name: @config.lib_name, lib_version: @config.lib_version,
434
458
  gapic_version: ::Google::Cloud::SecretManager::V1beta1::VERSION,
435
459
  transports_version_send: [:rest]
436
460
 
461
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
437
462
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
438
463
 
439
464
  options.apply_defaults timeout: @config.rpcs.add_secret_version.timeout,
@@ -446,7 +471,6 @@ module Google
446
471
 
447
472
  @secret_manager_service_stub.add_secret_version request, options do |result, operation|
448
473
  yield result, operation if block_given?
449
- return result
450
474
  end
451
475
  rescue ::Gapic::Rest::Error => e
452
476
  raise ::Google::Cloud::Error.from_error(e)
@@ -506,12 +530,13 @@ module Google
506
530
  # Customize the options with defaults
507
531
  call_metadata = @config.rpcs.get_secret.metadata.to_h
508
532
 
509
- # Set x-goog-api-client and x-goog-user-project headers
533
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
510
534
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
511
535
  lib_name: @config.lib_name, lib_version: @config.lib_version,
512
536
  gapic_version: ::Google::Cloud::SecretManager::V1beta1::VERSION,
513
537
  transports_version_send: [:rest]
514
538
 
539
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
515
540
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
516
541
 
517
542
  options.apply_defaults timeout: @config.rpcs.get_secret.timeout,
@@ -524,7 +549,6 @@ module Google
524
549
 
525
550
  @secret_manager_service_stub.get_secret request, options do |result, operation|
526
551
  yield result, operation if block_given?
527
- return result
528
552
  end
529
553
  rescue ::Gapic::Rest::Error => e
530
554
  raise ::Google::Cloud::Error.from_error(e)
@@ -586,12 +610,13 @@ module Google
586
610
  # Customize the options with defaults
587
611
  call_metadata = @config.rpcs.update_secret.metadata.to_h
588
612
 
589
- # Set x-goog-api-client and x-goog-user-project headers
613
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
590
614
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
591
615
  lib_name: @config.lib_name, lib_version: @config.lib_version,
592
616
  gapic_version: ::Google::Cloud::SecretManager::V1beta1::VERSION,
593
617
  transports_version_send: [:rest]
594
618
 
619
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
595
620
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
596
621
 
597
622
  options.apply_defaults timeout: @config.rpcs.update_secret.timeout,
@@ -604,7 +629,6 @@ module Google
604
629
 
605
630
  @secret_manager_service_stub.update_secret request, options do |result, operation|
606
631
  yield result, operation if block_given?
607
- return result
608
632
  end
609
633
  rescue ::Gapic::Rest::Error => e
610
634
  raise ::Google::Cloud::Error.from_error(e)
@@ -665,12 +689,13 @@ module Google
665
689
  # Customize the options with defaults
666
690
  call_metadata = @config.rpcs.delete_secret.metadata.to_h
667
691
 
668
- # Set x-goog-api-client and x-goog-user-project headers
692
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
669
693
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
670
694
  lib_name: @config.lib_name, lib_version: @config.lib_version,
671
695
  gapic_version: ::Google::Cloud::SecretManager::V1beta1::VERSION,
672
696
  transports_version_send: [:rest]
673
697
 
698
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
674
699
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
675
700
 
676
701
  options.apply_defaults timeout: @config.rpcs.delete_secret.timeout,
@@ -683,7 +708,6 @@ module Google
683
708
 
684
709
  @secret_manager_service_stub.delete_secret request, options do |result, operation|
685
710
  yield result, operation if block_given?
686
- return result
687
711
  end
688
712
  rescue ::Gapic::Rest::Error => e
689
713
  raise ::Google::Cloud::Error.from_error(e)
@@ -757,12 +781,13 @@ module Google
757
781
  # Customize the options with defaults
758
782
  call_metadata = @config.rpcs.list_secret_versions.metadata.to_h
759
783
 
760
- # Set x-goog-api-client and x-goog-user-project headers
784
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
761
785
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
762
786
  lib_name: @config.lib_name, lib_version: @config.lib_version,
763
787
  gapic_version: ::Google::Cloud::SecretManager::V1beta1::VERSION,
764
788
  transports_version_send: [:rest]
765
789
 
790
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
766
791
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
767
792
 
768
793
  options.apply_defaults timeout: @config.rpcs.list_secret_versions.timeout,
@@ -776,7 +801,7 @@ module Google
776
801
  @secret_manager_service_stub.list_secret_versions request, options do |result, operation|
777
802
  result = ::Gapic::Rest::PagedEnumerable.new @secret_manager_service_stub, :list_secret_versions, "versions", request, result, options
778
803
  yield result, operation if block_given?
779
- return result
804
+ throw :response, result
780
805
  end
781
806
  rescue ::Gapic::Rest::Error => e
782
807
  raise ::Google::Cloud::Error.from_error(e)
@@ -842,12 +867,13 @@ module Google
842
867
  # Customize the options with defaults
843
868
  call_metadata = @config.rpcs.get_secret_version.metadata.to_h
844
869
 
845
- # Set x-goog-api-client and x-goog-user-project headers
870
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
846
871
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
847
872
  lib_name: @config.lib_name, lib_version: @config.lib_version,
848
873
  gapic_version: ::Google::Cloud::SecretManager::V1beta1::VERSION,
849
874
  transports_version_send: [:rest]
850
875
 
876
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
851
877
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
852
878
 
853
879
  options.apply_defaults timeout: @config.rpcs.get_secret_version.timeout,
@@ -860,7 +886,6 @@ module Google
860
886
 
861
887
  @secret_manager_service_stub.get_secret_version request, options do |result, operation|
862
888
  yield result, operation if block_given?
863
- return result
864
889
  end
865
890
  rescue ::Gapic::Rest::Error => e
866
891
  raise ::Google::Cloud::Error.from_error(e)
@@ -924,12 +949,13 @@ module Google
924
949
  # Customize the options with defaults
925
950
  call_metadata = @config.rpcs.access_secret_version.metadata.to_h
926
951
 
927
- # Set x-goog-api-client and x-goog-user-project headers
952
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
928
953
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
929
954
  lib_name: @config.lib_name, lib_version: @config.lib_version,
930
955
  gapic_version: ::Google::Cloud::SecretManager::V1beta1::VERSION,
931
956
  transports_version_send: [:rest]
932
957
 
958
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
933
959
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
934
960
 
935
961
  options.apply_defaults timeout: @config.rpcs.access_secret_version.timeout,
@@ -942,7 +968,6 @@ module Google
942
968
 
943
969
  @secret_manager_service_stub.access_secret_version request, options do |result, operation|
944
970
  yield result, operation if block_given?
945
- return result
946
971
  end
947
972
  rescue ::Gapic::Rest::Error => e
948
973
  raise ::Google::Cloud::Error.from_error(e)
@@ -1006,12 +1031,13 @@ module Google
1006
1031
  # Customize the options with defaults
1007
1032
  call_metadata = @config.rpcs.disable_secret_version.metadata.to_h
1008
1033
 
1009
- # Set x-goog-api-client and x-goog-user-project headers
1034
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1010
1035
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1011
1036
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1012
1037
  gapic_version: ::Google::Cloud::SecretManager::V1beta1::VERSION,
1013
1038
  transports_version_send: [:rest]
1014
1039
 
1040
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1015
1041
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1016
1042
 
1017
1043
  options.apply_defaults timeout: @config.rpcs.disable_secret_version.timeout,
@@ -1024,7 +1050,6 @@ module Google
1024
1050
 
1025
1051
  @secret_manager_service_stub.disable_secret_version request, options do |result, operation|
1026
1052
  yield result, operation if block_given?
1027
- return result
1028
1053
  end
1029
1054
  rescue ::Gapic::Rest::Error => e
1030
1055
  raise ::Google::Cloud::Error.from_error(e)
@@ -1088,12 +1113,13 @@ module Google
1088
1113
  # Customize the options with defaults
1089
1114
  call_metadata = @config.rpcs.enable_secret_version.metadata.to_h
1090
1115
 
1091
- # Set x-goog-api-client and x-goog-user-project headers
1116
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1092
1117
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1093
1118
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1094
1119
  gapic_version: ::Google::Cloud::SecretManager::V1beta1::VERSION,
1095
1120
  transports_version_send: [:rest]
1096
1121
 
1122
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1097
1123
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1098
1124
 
1099
1125
  options.apply_defaults timeout: @config.rpcs.enable_secret_version.timeout,
@@ -1106,7 +1132,6 @@ module Google
1106
1132
 
1107
1133
  @secret_manager_service_stub.enable_secret_version request, options do |result, operation|
1108
1134
  yield result, operation if block_given?
1109
- return result
1110
1135
  end
1111
1136
  rescue ::Gapic::Rest::Error => e
1112
1137
  raise ::Google::Cloud::Error.from_error(e)
@@ -1171,12 +1196,13 @@ module Google
1171
1196
  # Customize the options with defaults
1172
1197
  call_metadata = @config.rpcs.destroy_secret_version.metadata.to_h
1173
1198
 
1174
- # 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
1175
1200
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1176
1201
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1177
1202
  gapic_version: ::Google::Cloud::SecretManager::V1beta1::VERSION,
1178
1203
  transports_version_send: [:rest]
1179
1204
 
1205
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1180
1206
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1181
1207
 
1182
1208
  options.apply_defaults timeout: @config.rpcs.destroy_secret_version.timeout,
@@ -1189,7 +1215,6 @@ module Google
1189
1215
 
1190
1216
  @secret_manager_service_stub.destroy_secret_version request, options do |result, operation|
1191
1217
  yield result, operation if block_given?
1192
- return result
1193
1218
  end
1194
1219
  rescue ::Gapic::Rest::Error => e
1195
1220
  raise ::Google::Cloud::Error.from_error(e)
@@ -1265,12 +1290,13 @@ module Google
1265
1290
  # Customize the options with defaults
1266
1291
  call_metadata = @config.rpcs.set_iam_policy.metadata.to_h
1267
1292
 
1268
- # Set x-goog-api-client and x-goog-user-project headers
1293
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1269
1294
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1270
1295
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1271
1296
  gapic_version: ::Google::Cloud::SecretManager::V1beta1::VERSION,
1272
1297
  transports_version_send: [:rest]
1273
1298
 
1299
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1274
1300
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1275
1301
 
1276
1302
  options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
@@ -1283,7 +1309,6 @@ module Google
1283
1309
 
1284
1310
  @secret_manager_service_stub.set_iam_policy request, options do |result, operation|
1285
1311
  yield result, operation if block_given?
1286
- return result
1287
1312
  end
1288
1313
  rescue ::Gapic::Rest::Error => e
1289
1314
  raise ::Google::Cloud::Error.from_error(e)
@@ -1348,12 +1373,13 @@ module Google
1348
1373
  # Customize the options with defaults
1349
1374
  call_metadata = @config.rpcs.get_iam_policy.metadata.to_h
1350
1375
 
1351
- # Set x-goog-api-client and x-goog-user-project headers
1376
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1352
1377
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1353
1378
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1354
1379
  gapic_version: ::Google::Cloud::SecretManager::V1beta1::VERSION,
1355
1380
  transports_version_send: [:rest]
1356
1381
 
1382
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1357
1383
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1358
1384
 
1359
1385
  options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
@@ -1366,7 +1392,6 @@ module Google
1366
1392
 
1367
1393
  @secret_manager_service_stub.get_iam_policy request, options do |result, operation|
1368
1394
  yield result, operation if block_given?
1369
- return result
1370
1395
  end
1371
1396
  rescue ::Gapic::Rest::Error => e
1372
1397
  raise ::Google::Cloud::Error.from_error(e)
@@ -1438,12 +1463,13 @@ module Google
1438
1463
  # Customize the options with defaults
1439
1464
  call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
1440
1465
 
1441
- # Set x-goog-api-client and x-goog-user-project headers
1466
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1442
1467
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1443
1468
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1444
1469
  gapic_version: ::Google::Cloud::SecretManager::V1beta1::VERSION,
1445
1470
  transports_version_send: [:rest]
1446
1471
 
1472
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1447
1473
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1448
1474
 
1449
1475
  options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
@@ -1456,7 +1482,6 @@ module Google
1456
1482
 
1457
1483
  @secret_manager_service_stub.test_iam_permissions request, options do |result, operation|
1458
1484
  yield result, operation if block_given?
1459
- return result
1460
1485
  end
1461
1486
  rescue ::Gapic::Rest::Error => e
1462
1487
  raise ::Google::Cloud::Error.from_error(e)
@@ -1536,6 +1561,11 @@ module Google
1536
1561
  # default endpoint URL. The default value of nil uses the environment
1537
1562
  # universe (usually the default "googleapis.com" universe).
1538
1563
  # @return [::String,nil]
1564
+ # @!attribute [rw] logger
1565
+ # A custom logger to use for request/response debug logging, or the value
1566
+ # `:default` (the default) to construct a default logger, or `nil` to
1567
+ # explicitly disable logging.
1568
+ # @return [::Logger,:default,nil]
1539
1569
  #
1540
1570
  class Configuration
1541
1571
  extend ::Gapic::Config
@@ -1557,6 +1587,7 @@ module Google
1557
1587
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1558
1588
  config_attr :quota_project, nil, ::String, nil
1559
1589
  config_attr :universe_domain, nil, ::String, nil
1590
+ config_attr :logger, :default, ::Logger, nil, :default
1560
1591
 
1561
1592
  # @private
1562
1593
  def initialize parent_config = nil