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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dea3fa77ced511caa309b9f87695a877ac839c2ef047c0f97f95801512e7c322
4
- data.tar.gz: 73623a958bcd506fe14947320bac2979ac63b99fc21455fc8562f4cd152b9c33
3
+ metadata.gz: e60a32caf45b372a98d7a639809cad13a602356dfe265e3e51bac750fd23f940
4
+ data.tar.gz: 56a2ee06ae5817ff08a81cfe9707ff19e34b330ec5e2bb7ba13b0f8f259e5aa5
5
5
  SHA512:
6
- metadata.gz: 16ebb9fee0beff59d90d8b4b9f668cba77e7ab221022fed0c5bc30baa5f8dbaa5fbe5c9c91d359269affc10925a060050635132ee7c6d4766a8a886b003e4362
7
- data.tar.gz: 527889199f20411a4c661e54b6e6cf199a63121b13e6f2c8d8db5f5486b1e3f83fa666c5304c769da00bee93acb5b170bc11650e70dbafb8c9b95a93466bb567
6
+ metadata.gz: 364b5a75ff67af07241f3d7b9929cf5db2cf1fb4aa052b0b6093e400dc2e39cf92a7dd20b47f949c110d7046d6b04f9a4f5f8d537fc5866ecfa04b92ff503e99
7
+ data.tar.gz: b560be7272c54a6d2531bab292c6dff3eb4b8332c5beee17115da087de690cacbe223c754f9447a089746611249936b8d9734e9e67bf3da84f372e27f64f7230
data/README.md CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/security-command-center/docs/concepts-web-security-scanner-overview/)
44
44
  for general usage information.
45
45
 
46
- ## Enabling Logging
47
-
48
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
51
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
53
-
54
- Configuring a Ruby stdlib logger:
46
+ ## Debug Logging
47
+
48
+ This library comes with opt-in Debug Logging that can help you troubleshoot
49
+ your application's integration with the API. When logging is activated, key
50
+ events such as requests and responses, along with data payloads and metadata
51
+ such as headers and client configuration, are logged to the standard error
52
+ stream.
53
+
54
+ **WARNING:** Client Library Debug Logging includes your data payloads in
55
+ plaintext, which could include sensitive data such as PII for yourself or your
56
+ customers, private keys, or other security data that could be compromising if
57
+ leaked. Always practice good data hygiene with your application logs, and follow
58
+ the principle of least access. Google also recommends that Client Library Debug
59
+ Logging be enabled only temporarily during active debugging, and not used
60
+ permanently in production.
61
+
62
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
63
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
64
+ list of client library gem names. This will select the default logging behavior,
65
+ which writes logs to the standard error stream. On a local workstation, this may
66
+ result in logs appearing on the console. When running on a Google Cloud hosting
67
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
68
+ results in logs appearing alongside your application logs in the
69
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
70
+
71
+ You can customize logging by modifying the `logger` configuration when
72
+ constructing a client object. For example:
55
73
 
56
74
  ```ruby
75
+ require "google/cloud/web_security_scanner/v1beta"
57
76
  require "logger"
58
77
 
59
- module MyLogger
60
- LOGGER = Logger.new $stderr, level: Logger::WARN
61
- def logger
62
- LOGGER
63
- end
64
- end
65
-
66
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
67
- module GRPC
68
- extend MyLogger
78
+ client = ::Google::Cloud::WebSecurityScanner::V1beta::WebSecurityScanner::Client.new do |config|
79
+ config.logger = Logger.new "my-app.log"
69
80
  end
70
81
  ```
71
82
 
72
-
73
83
  ## Google Cloud Samples
74
84
 
75
85
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module WebSecurityScanner
23
23
  module V1beta
24
- VERSION = "0.9.0"
24
+ VERSION = "0.10.0"
25
25
  end
26
26
  end
27
27
  end
@@ -32,6 +32,9 @@ module Google
32
32
  # attempts to exercise as many user inputs and event handlers as possible.
33
33
  #
34
34
  class Client
35
+ # @private
36
+ API_VERSION = ""
37
+
35
38
  # @private
36
39
  DEFAULT_ENDPOINT_TEMPLATE = "websecurityscanner.$UNIVERSE_DOMAIN$"
37
40
 
@@ -209,8 +212,28 @@ module Google
209
212
  universe_domain: @config.universe_domain,
210
213
  channel_args: @config.channel_args,
211
214
  interceptors: @config.interceptors,
212
- channel_pool_config: @config.channel_pool
215
+ channel_pool_config: @config.channel_pool,
216
+ logger: @config.logger
213
217
  )
218
+
219
+ @web_security_scanner_stub.stub_logger&.info do |entry|
220
+ entry.set_system_name
221
+ entry.set_service
222
+ entry.message = "Created client for #{entry.service}"
223
+ entry.set_credentials_fields credentials
224
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
225
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
226
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
227
+ end
228
+ end
229
+
230
+ ##
231
+ # The logger used for request/response debug logging.
232
+ #
233
+ # @return [Logger]
234
+ #
235
+ def logger
236
+ @web_security_scanner_stub.logger
214
237
  end
215
238
 
216
239
  # Service calls
@@ -273,10 +296,11 @@ module Google
273
296
  # Customize the options with defaults
274
297
  metadata = @config.rpcs.create_scan_config.metadata.to_h
275
298
 
276
- # Set x-goog-api-client and x-goog-user-project headers
299
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
277
300
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
278
301
  lib_name: @config.lib_name, lib_version: @config.lib_version,
279
302
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION
303
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
280
304
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
281
305
 
282
306
  header_params = {}
@@ -297,7 +321,6 @@ module Google
297
321
 
298
322
  @web_security_scanner_stub.call_rpc :create_scan_config, request, options: options do |response, operation|
299
323
  yield response, operation if block_given?
300
- return response
301
324
  end
302
325
  rescue ::GRPC::BadStatus => e
303
326
  raise ::Google::Cloud::Error.from_error(e)
@@ -359,10 +382,11 @@ module Google
359
382
  # Customize the options with defaults
360
383
  metadata = @config.rpcs.delete_scan_config.metadata.to_h
361
384
 
362
- # Set x-goog-api-client and x-goog-user-project headers
385
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
363
386
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
364
387
  lib_name: @config.lib_name, lib_version: @config.lib_version,
365
388
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION
389
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
366
390
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
367
391
 
368
392
  header_params = {}
@@ -383,7 +407,6 @@ module Google
383
407
 
384
408
  @web_security_scanner_stub.call_rpc :delete_scan_config, request, options: options do |response, operation|
385
409
  yield response, operation if block_given?
386
- return response
387
410
  end
388
411
  rescue ::GRPC::BadStatus => e
389
412
  raise ::Google::Cloud::Error.from_error(e)
@@ -445,10 +468,11 @@ module Google
445
468
  # Customize the options with defaults
446
469
  metadata = @config.rpcs.get_scan_config.metadata.to_h
447
470
 
448
- # Set x-goog-api-client and x-goog-user-project headers
471
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
449
472
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
450
473
  lib_name: @config.lib_name, lib_version: @config.lib_version,
451
474
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION
475
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
452
476
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
453
477
 
454
478
  header_params = {}
@@ -469,7 +493,6 @@ module Google
469
493
 
470
494
  @web_security_scanner_stub.call_rpc :get_scan_config, request, options: options do |response, operation|
471
495
  yield response, operation if block_given?
472
- return response
473
496
  end
474
497
  rescue ::GRPC::BadStatus => e
475
498
  raise ::Google::Cloud::Error.from_error(e)
@@ -543,10 +566,11 @@ module Google
543
566
  # Customize the options with defaults
544
567
  metadata = @config.rpcs.list_scan_configs.metadata.to_h
545
568
 
546
- # 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
547
570
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
548
571
  lib_name: @config.lib_name, lib_version: @config.lib_version,
549
572
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION
573
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
550
574
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
551
575
 
552
576
  header_params = {}
@@ -568,7 +592,7 @@ module Google
568
592
  @web_security_scanner_stub.call_rpc :list_scan_configs, request, options: options do |response, operation|
569
593
  response = ::Gapic::PagedEnumerable.new @web_security_scanner_stub, :list_scan_configs, request, response, operation, options
570
594
  yield response, operation if block_given?
571
- return response
595
+ throw :response, response
572
596
  end
573
597
  rescue ::GRPC::BadStatus => e
574
598
  raise ::Google::Cloud::Error.from_error(e)
@@ -635,10 +659,11 @@ module Google
635
659
  # Customize the options with defaults
636
660
  metadata = @config.rpcs.update_scan_config.metadata.to_h
637
661
 
638
- # Set x-goog-api-client and x-goog-user-project headers
662
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
639
663
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
640
664
  lib_name: @config.lib_name, lib_version: @config.lib_version,
641
665
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION
666
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
642
667
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
643
668
 
644
669
  header_params = {}
@@ -659,7 +684,6 @@ module Google
659
684
 
660
685
  @web_security_scanner_stub.call_rpc :update_scan_config, request, options: options do |response, operation|
661
686
  yield response, operation if block_given?
662
- return response
663
687
  end
664
688
  rescue ::GRPC::BadStatus => e
665
689
  raise ::Google::Cloud::Error.from_error(e)
@@ -721,10 +745,11 @@ module Google
721
745
  # Customize the options with defaults
722
746
  metadata = @config.rpcs.start_scan_run.metadata.to_h
723
747
 
724
- # Set x-goog-api-client and x-goog-user-project headers
748
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
725
749
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
726
750
  lib_name: @config.lib_name, lib_version: @config.lib_version,
727
751
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION
752
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
728
753
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
729
754
 
730
755
  header_params = {}
@@ -745,7 +770,6 @@ module Google
745
770
 
746
771
  @web_security_scanner_stub.call_rpc :start_scan_run, request, options: options do |response, operation|
747
772
  yield response, operation if block_given?
748
- return response
749
773
  end
750
774
  rescue ::GRPC::BadStatus => e
751
775
  raise ::Google::Cloud::Error.from_error(e)
@@ -808,10 +832,11 @@ module Google
808
832
  # Customize the options with defaults
809
833
  metadata = @config.rpcs.get_scan_run.metadata.to_h
810
834
 
811
- # Set x-goog-api-client and x-goog-user-project headers
835
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
812
836
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
813
837
  lib_name: @config.lib_name, lib_version: @config.lib_version,
814
838
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION
839
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
815
840
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
816
841
 
817
842
  header_params = {}
@@ -832,7 +857,6 @@ module Google
832
857
 
833
858
  @web_security_scanner_stub.call_rpc :get_scan_run, request, options: options do |response, operation|
834
859
  yield response, operation if block_given?
835
- return response
836
860
  end
837
861
  rescue ::GRPC::BadStatus => e
838
862
  raise ::Google::Cloud::Error.from_error(e)
@@ -907,10 +931,11 @@ module Google
907
931
  # Customize the options with defaults
908
932
  metadata = @config.rpcs.list_scan_runs.metadata.to_h
909
933
 
910
- # Set x-goog-api-client and x-goog-user-project headers
934
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
911
935
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
912
936
  lib_name: @config.lib_name, lib_version: @config.lib_version,
913
937
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION
938
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
914
939
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
915
940
 
916
941
  header_params = {}
@@ -932,7 +957,7 @@ module Google
932
957
  @web_security_scanner_stub.call_rpc :list_scan_runs, request, options: options do |response, operation|
933
958
  response = ::Gapic::PagedEnumerable.new @web_security_scanner_stub, :list_scan_runs, request, response, operation, options
934
959
  yield response, operation if block_given?
935
- return response
960
+ throw :response, response
936
961
  end
937
962
  rescue ::GRPC::BadStatus => e
938
963
  raise ::Google::Cloud::Error.from_error(e)
@@ -995,10 +1020,11 @@ module Google
995
1020
  # Customize the options with defaults
996
1021
  metadata = @config.rpcs.stop_scan_run.metadata.to_h
997
1022
 
998
- # Set x-goog-api-client and x-goog-user-project headers
1023
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
999
1024
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1000
1025
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1001
1026
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION
1027
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1002
1028
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1003
1029
 
1004
1030
  header_params = {}
@@ -1019,7 +1045,6 @@ module Google
1019
1045
 
1020
1046
  @web_security_scanner_stub.call_rpc :stop_scan_run, request, options: options do |response, operation|
1021
1047
  yield response, operation if block_given?
1022
- return response
1023
1048
  end
1024
1049
  rescue ::GRPC::BadStatus => e
1025
1050
  raise ::Google::Cloud::Error.from_error(e)
@@ -1094,10 +1119,11 @@ module Google
1094
1119
  # Customize the options with defaults
1095
1120
  metadata = @config.rpcs.list_crawled_urls.metadata.to_h
1096
1121
 
1097
- # Set x-goog-api-client and x-goog-user-project headers
1122
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1098
1123
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1099
1124
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1100
1125
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION
1126
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1101
1127
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1102
1128
 
1103
1129
  header_params = {}
@@ -1119,7 +1145,7 @@ module Google
1119
1145
  @web_security_scanner_stub.call_rpc :list_crawled_urls, request, options: options do |response, operation|
1120
1146
  response = ::Gapic::PagedEnumerable.new @web_security_scanner_stub, :list_crawled_urls, request, response, operation, options
1121
1147
  yield response, operation if block_given?
1122
- return response
1148
+ throw :response, response
1123
1149
  end
1124
1150
  rescue ::GRPC::BadStatus => e
1125
1151
  raise ::Google::Cloud::Error.from_error(e)
@@ -1182,10 +1208,11 @@ module Google
1182
1208
  # Customize the options with defaults
1183
1209
  metadata = @config.rpcs.get_finding.metadata.to_h
1184
1210
 
1185
- # Set x-goog-api-client and x-goog-user-project headers
1211
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1186
1212
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1187
1213
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1188
1214
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION
1215
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1189
1216
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1190
1217
 
1191
1218
  header_params = {}
@@ -1206,7 +1233,6 @@ module Google
1206
1233
 
1207
1234
  @web_security_scanner_stub.call_rpc :get_finding, request, options: options do |response, operation|
1208
1235
  yield response, operation if block_given?
1209
- return response
1210
1236
  end
1211
1237
  rescue ::GRPC::BadStatus => e
1212
1238
  raise ::Google::Cloud::Error.from_error(e)
@@ -1286,10 +1312,11 @@ module Google
1286
1312
  # Customize the options with defaults
1287
1313
  metadata = @config.rpcs.list_findings.metadata.to_h
1288
1314
 
1289
- # Set x-goog-api-client and x-goog-user-project headers
1315
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1290
1316
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1291
1317
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1292
1318
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION
1319
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1293
1320
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1294
1321
 
1295
1322
  header_params = {}
@@ -1311,7 +1338,7 @@ module Google
1311
1338
  @web_security_scanner_stub.call_rpc :list_findings, request, options: options do |response, operation|
1312
1339
  response = ::Gapic::PagedEnumerable.new @web_security_scanner_stub, :list_findings, request, response, operation, options
1313
1340
  yield response, operation if block_given?
1314
- return response
1341
+ throw :response, response
1315
1342
  end
1316
1343
  rescue ::GRPC::BadStatus => e
1317
1344
  raise ::Google::Cloud::Error.from_error(e)
@@ -1374,10 +1401,11 @@ module Google
1374
1401
  # Customize the options with defaults
1375
1402
  metadata = @config.rpcs.list_finding_type_stats.metadata.to_h
1376
1403
 
1377
- # Set x-goog-api-client and x-goog-user-project headers
1404
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1378
1405
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1379
1406
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1380
1407
  gapic_version: ::Google::Cloud::WebSecurityScanner::V1beta::VERSION
1408
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1381
1409
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1382
1410
 
1383
1411
  header_params = {}
@@ -1398,7 +1426,6 @@ module Google
1398
1426
 
1399
1427
  @web_security_scanner_stub.call_rpc :list_finding_type_stats, request, options: options do |response, operation|
1400
1428
  yield response, operation if block_given?
1401
- return response
1402
1429
  end
1403
1430
  rescue ::GRPC::BadStatus => e
1404
1431
  raise ::Google::Cloud::Error.from_error(e)
@@ -1487,6 +1514,11 @@ module Google
1487
1514
  # default endpoint URL. The default value of nil uses the environment
1488
1515
  # universe (usually the default "googleapis.com" universe).
1489
1516
  # @return [::String,nil]
1517
+ # @!attribute [rw] logger
1518
+ # A custom logger to use for request/response debug logging, or the value
1519
+ # `:default` (the default) to construct a default logger, or `nil` to
1520
+ # explicitly disable logging.
1521
+ # @return [::Logger,:default,nil]
1490
1522
  #
1491
1523
  class Configuration
1492
1524
  extend ::Gapic::Config
@@ -1511,6 +1543,7 @@ module Google
1511
1543
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1512
1544
  config_attr :quota_project, nil, ::String, nil
1513
1545
  config_attr :universe_domain, nil, ::String, nil
1546
+ config_attr :logger, :default, ::Logger, nil, :default
1514
1547
 
1515
1548
  # @private
1516
1549
  def initialize parent_config = nil