google-cloud-web_security_scanner-v1beta 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -34,6 +34,9 @@ module Google
34
34
  # attempts to exercise as many user inputs and event handlers as possible.
35
35
  #
36
36
  class Client
37
+ # @private
38
+ API_VERSION = ""
39
+
37
40
  # @private
38
41
  DEFAULT_ENDPOINT_TEMPLATE = "websecurityscanner.$UNIVERSE_DOMAIN$"
39
42
 
@@ -202,8 +205,28 @@ module Google
202
205
  endpoint: @config.endpoint,
203
206
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
204
207
  universe_domain: @config.universe_domain,
205
- credentials: credentials
208
+ credentials: credentials,
209
+ logger: @config.logger
206
210
  )
211
+
212
+ @web_security_scanner_stub.logger(stub: true)&.info do |entry|
213
+ entry.set_system_name
214
+ entry.set_service
215
+ entry.message = "Created client for #{entry.service}"
216
+ entry.set_credentials_fields credentials
217
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
218
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
219
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
220
+ end
221
+ end
222
+
223
+ ##
224
+ # The logger used for request/response debug logging.
225
+ #
226
+ # @return [Logger]
227
+ #
228
+ def logger
229
+ @web_security_scanner_stub.logger
207
230
  end
208
231
 
209
232
  # Service calls
@@ -265,12 +288,13 @@ module Google
265
288
  # Customize the options with defaults
266
289
  call_metadata = @config.rpcs.create_scan_config.metadata.to_h
267
290
 
268
- # Set x-goog-api-client and x-goog-user-project headers
291
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
269
292
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
270
293
  lib_name: @config.lib_name, lib_version: @config.lib_version,
271
294
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION,
272
295
  transports_version_send: [:rest]
273
296
 
297
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
274
298
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
275
299
 
276
300
  options.apply_defaults timeout: @config.rpcs.create_scan_config.timeout,
@@ -283,7 +307,6 @@ module Google
283
307
 
284
308
  @web_security_scanner_stub.create_scan_config request, options do |result, operation|
285
309
  yield result, operation if block_given?
286
- return result
287
310
  end
288
311
  rescue ::Gapic::Rest::Error => e
289
312
  raise ::Google::Cloud::Error.from_error(e)
@@ -344,12 +367,13 @@ module Google
344
367
  # Customize the options with defaults
345
368
  call_metadata = @config.rpcs.delete_scan_config.metadata.to_h
346
369
 
347
- # Set x-goog-api-client and x-goog-user-project headers
370
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
348
371
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
349
372
  lib_name: @config.lib_name, lib_version: @config.lib_version,
350
373
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION,
351
374
  transports_version_send: [:rest]
352
375
 
376
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
353
377
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
354
378
 
355
379
  options.apply_defaults timeout: @config.rpcs.delete_scan_config.timeout,
@@ -362,7 +386,6 @@ module Google
362
386
 
363
387
  @web_security_scanner_stub.delete_scan_config request, options do |result, operation|
364
388
  yield result, operation if block_given?
365
- return result
366
389
  end
367
390
  rescue ::Gapic::Rest::Error => e
368
391
  raise ::Google::Cloud::Error.from_error(e)
@@ -423,12 +446,13 @@ module Google
423
446
  # Customize the options with defaults
424
447
  call_metadata = @config.rpcs.get_scan_config.metadata.to_h
425
448
 
426
- # Set x-goog-api-client and x-goog-user-project headers
449
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
427
450
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
428
451
  lib_name: @config.lib_name, lib_version: @config.lib_version,
429
452
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION,
430
453
  transports_version_send: [:rest]
431
454
 
455
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
432
456
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
433
457
 
434
458
  options.apply_defaults timeout: @config.rpcs.get_scan_config.timeout,
@@ -441,7 +465,6 @@ module Google
441
465
 
442
466
  @web_security_scanner_stub.get_scan_config request, options do |result, operation|
443
467
  yield result, operation if block_given?
444
- return result
445
468
  end
446
469
  rescue ::Gapic::Rest::Error => e
447
470
  raise ::Google::Cloud::Error.from_error(e)
@@ -514,12 +537,13 @@ module Google
514
537
  # Customize the options with defaults
515
538
  call_metadata = @config.rpcs.list_scan_configs.metadata.to_h
516
539
 
517
- # Set x-goog-api-client and x-goog-user-project headers
540
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
518
541
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
519
542
  lib_name: @config.lib_name, lib_version: @config.lib_version,
520
543
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION,
521
544
  transports_version_send: [:rest]
522
545
 
546
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
523
547
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
524
548
 
525
549
  options.apply_defaults timeout: @config.rpcs.list_scan_configs.timeout,
@@ -533,7 +557,7 @@ module Google
533
557
  @web_security_scanner_stub.list_scan_configs request, options do |result, operation|
534
558
  result = ::Gapic::Rest::PagedEnumerable.new @web_security_scanner_stub, :list_scan_configs, "scan_configs", request, result, options
535
559
  yield result, operation if block_given?
536
- return result
560
+ throw :response, result
537
561
  end
538
562
  rescue ::Gapic::Rest::Error => e
539
563
  raise ::Google::Cloud::Error.from_error(e)
@@ -599,12 +623,13 @@ module Google
599
623
  # Customize the options with defaults
600
624
  call_metadata = @config.rpcs.update_scan_config.metadata.to_h
601
625
 
602
- # Set x-goog-api-client and x-goog-user-project headers
626
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
603
627
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
604
628
  lib_name: @config.lib_name, lib_version: @config.lib_version,
605
629
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION,
606
630
  transports_version_send: [:rest]
607
631
 
632
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
608
633
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
609
634
 
610
635
  options.apply_defaults timeout: @config.rpcs.update_scan_config.timeout,
@@ -617,7 +642,6 @@ module Google
617
642
 
618
643
  @web_security_scanner_stub.update_scan_config request, options do |result, operation|
619
644
  yield result, operation if block_given?
620
- return result
621
645
  end
622
646
  rescue ::Gapic::Rest::Error => e
623
647
  raise ::Google::Cloud::Error.from_error(e)
@@ -678,12 +702,13 @@ module Google
678
702
  # Customize the options with defaults
679
703
  call_metadata = @config.rpcs.start_scan_run.metadata.to_h
680
704
 
681
- # Set x-goog-api-client and x-goog-user-project headers
705
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
682
706
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
683
707
  lib_name: @config.lib_name, lib_version: @config.lib_version,
684
708
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION,
685
709
  transports_version_send: [:rest]
686
710
 
711
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
687
712
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
688
713
 
689
714
  options.apply_defaults timeout: @config.rpcs.start_scan_run.timeout,
@@ -696,7 +721,6 @@ module Google
696
721
 
697
722
  @web_security_scanner_stub.start_scan_run request, options do |result, operation|
698
723
  yield result, operation if block_given?
699
- return result
700
724
  end
701
725
  rescue ::Gapic::Rest::Error => e
702
726
  raise ::Google::Cloud::Error.from_error(e)
@@ -758,12 +782,13 @@ module Google
758
782
  # Customize the options with defaults
759
783
  call_metadata = @config.rpcs.get_scan_run.metadata.to_h
760
784
 
761
- # Set x-goog-api-client and x-goog-user-project headers
785
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
762
786
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
763
787
  lib_name: @config.lib_name, lib_version: @config.lib_version,
764
788
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION,
765
789
  transports_version_send: [:rest]
766
790
 
791
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
767
792
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
768
793
 
769
794
  options.apply_defaults timeout: @config.rpcs.get_scan_run.timeout,
@@ -776,7 +801,6 @@ module Google
776
801
 
777
802
  @web_security_scanner_stub.get_scan_run request, options do |result, operation|
778
803
  yield result, operation if block_given?
779
- return result
780
804
  end
781
805
  rescue ::Gapic::Rest::Error => e
782
806
  raise ::Google::Cloud::Error.from_error(e)
@@ -850,12 +874,13 @@ module Google
850
874
  # Customize the options with defaults
851
875
  call_metadata = @config.rpcs.list_scan_runs.metadata.to_h
852
876
 
853
- # Set x-goog-api-client and x-goog-user-project headers
877
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
854
878
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
855
879
  lib_name: @config.lib_name, lib_version: @config.lib_version,
856
880
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION,
857
881
  transports_version_send: [:rest]
858
882
 
883
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
859
884
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
860
885
 
861
886
  options.apply_defaults timeout: @config.rpcs.list_scan_runs.timeout,
@@ -869,7 +894,7 @@ module Google
869
894
  @web_security_scanner_stub.list_scan_runs request, options do |result, operation|
870
895
  result = ::Gapic::Rest::PagedEnumerable.new @web_security_scanner_stub, :list_scan_runs, "scan_runs", request, result, options
871
896
  yield result, operation if block_given?
872
- return result
897
+ throw :response, result
873
898
  end
874
899
  rescue ::Gapic::Rest::Error => e
875
900
  raise ::Google::Cloud::Error.from_error(e)
@@ -931,12 +956,13 @@ module Google
931
956
  # Customize the options with defaults
932
957
  call_metadata = @config.rpcs.stop_scan_run.metadata.to_h
933
958
 
934
- # Set x-goog-api-client and x-goog-user-project headers
959
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
935
960
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
936
961
  lib_name: @config.lib_name, lib_version: @config.lib_version,
937
962
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION,
938
963
  transports_version_send: [:rest]
939
964
 
965
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
940
966
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
941
967
 
942
968
  options.apply_defaults timeout: @config.rpcs.stop_scan_run.timeout,
@@ -949,7 +975,6 @@ module Google
949
975
 
950
976
  @web_security_scanner_stub.stop_scan_run request, options do |result, operation|
951
977
  yield result, operation if block_given?
952
- return result
953
978
  end
954
979
  rescue ::Gapic::Rest::Error => e
955
980
  raise ::Google::Cloud::Error.from_error(e)
@@ -1023,12 +1048,13 @@ module Google
1023
1048
  # Customize the options with defaults
1024
1049
  call_metadata = @config.rpcs.list_crawled_urls.metadata.to_h
1025
1050
 
1026
- # Set x-goog-api-client and x-goog-user-project headers
1051
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1027
1052
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1028
1053
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1029
1054
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION,
1030
1055
  transports_version_send: [:rest]
1031
1056
 
1057
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1032
1058
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1033
1059
 
1034
1060
  options.apply_defaults timeout: @config.rpcs.list_crawled_urls.timeout,
@@ -1042,7 +1068,7 @@ module Google
1042
1068
  @web_security_scanner_stub.list_crawled_urls request, options do |result, operation|
1043
1069
  result = ::Gapic::Rest::PagedEnumerable.new @web_security_scanner_stub, :list_crawled_urls, "crawled_urls", request, result, options
1044
1070
  yield result, operation if block_given?
1045
- return result
1071
+ throw :response, result
1046
1072
  end
1047
1073
  rescue ::Gapic::Rest::Error => e
1048
1074
  raise ::Google::Cloud::Error.from_error(e)
@@ -1104,12 +1130,13 @@ module Google
1104
1130
  # Customize the options with defaults
1105
1131
  call_metadata = @config.rpcs.get_finding.metadata.to_h
1106
1132
 
1107
- # Set x-goog-api-client and x-goog-user-project headers
1133
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1108
1134
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1109
1135
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1110
1136
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION,
1111
1137
  transports_version_send: [:rest]
1112
1138
 
1139
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1113
1140
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1114
1141
 
1115
1142
  options.apply_defaults timeout: @config.rpcs.get_finding.timeout,
@@ -1122,7 +1149,6 @@ module Google
1122
1149
 
1123
1150
  @web_security_scanner_stub.get_finding request, options do |result, operation|
1124
1151
  yield result, operation if block_given?
1125
- return result
1126
1152
  end
1127
1153
  rescue ::Gapic::Rest::Error => e
1128
1154
  raise ::Google::Cloud::Error.from_error(e)
@@ -1201,12 +1227,13 @@ module Google
1201
1227
  # Customize the options with defaults
1202
1228
  call_metadata = @config.rpcs.list_findings.metadata.to_h
1203
1229
 
1204
- # Set x-goog-api-client and x-goog-user-project headers
1230
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1205
1231
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1206
1232
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1207
1233
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION,
1208
1234
  transports_version_send: [:rest]
1209
1235
 
1236
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1210
1237
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1211
1238
 
1212
1239
  options.apply_defaults timeout: @config.rpcs.list_findings.timeout,
@@ -1220,7 +1247,7 @@ module Google
1220
1247
  @web_security_scanner_stub.list_findings request, options do |result, operation|
1221
1248
  result = ::Gapic::Rest::PagedEnumerable.new @web_security_scanner_stub, :list_findings, "findings", request, result, options
1222
1249
  yield result, operation if block_given?
1223
- return result
1250
+ throw :response, result
1224
1251
  end
1225
1252
  rescue ::Gapic::Rest::Error => e
1226
1253
  raise ::Google::Cloud::Error.from_error(e)
@@ -1282,12 +1309,13 @@ module Google
1282
1309
  # Customize the options with defaults
1283
1310
  call_metadata = @config.rpcs.list_finding_type_stats.metadata.to_h
1284
1311
 
1285
- # Set x-goog-api-client and x-goog-user-project headers
1312
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1286
1313
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1287
1314
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1288
1315
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION,
1289
1316
  transports_version_send: [:rest]
1290
1317
 
1318
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1291
1319
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1292
1320
 
1293
1321
  options.apply_defaults timeout: @config.rpcs.list_finding_type_stats.timeout,
@@ -1300,7 +1328,6 @@ module Google
1300
1328
 
1301
1329
  @web_security_scanner_stub.list_finding_type_stats request, options do |result, operation|
1302
1330
  yield result, operation if block_given?
1303
- return result
1304
1331
  end
1305
1332
  rescue ::Gapic::Rest::Error => e
1306
1333
  raise ::Google::Cloud::Error.from_error(e)
@@ -1380,6 +1407,11 @@ module Google
1380
1407
  # default endpoint URL. The default value of nil uses the environment
1381
1408
  # universe (usually the default "googleapis.com" universe).
1382
1409
  # @return [::String,nil]
1410
+ # @!attribute [rw] logger
1411
+ # A custom logger to use for request/response debug logging, or the value
1412
+ # `:default` (the default) to construct a default logger, or `nil` to
1413
+ # explicitly disable logging.
1414
+ # @return [::Logger,:default,nil]
1383
1415
  #
1384
1416
  class Configuration
1385
1417
  extend ::Gapic::Config
@@ -1401,6 +1433,7 @@ module Google
1401
1433
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1402
1434
  config_attr :quota_project, nil, ::String, nil
1403
1435
  config_attr :universe_domain, nil, ::String, nil
1436
+ config_attr :logger, :default, ::Logger, nil, :default
1404
1437
 
1405
1438
  # @private
1406
1439
  def initialize parent_config = nil