google-cloud-web_risk-v1 1.0.2 → 1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1d7a532d2fcc761cd2d4dd212c1e41af590ac82a26db38688506ac67aa47fb7
4
- data.tar.gz: ce655113638113037c0c3de54a70b633ff7d61b70b57a83de93fb6613c45c482
3
+ metadata.gz: ab450f7b84076c19cf263166a7e0679b62e04b2eaa2e14b42674400e11937201
4
+ data.tar.gz: d1a5acb7b7a1378ae091f9f2f2739c0c417204e4da49e57535984d15a4e8b8e5
5
5
  SHA512:
6
- metadata.gz: 4348a201d09f78479b45dcc1eee6478ed70deaae2139f0fce5c99ce395025ebb4fbadf21387294de215084e228d4194d7cf4d2b4c1e7d6e47d51eb70e4bb4d9b
7
- data.tar.gz: a15374d6f2e9aa29858eee09ac0c0f2b12b262f82efa88edbc4cb991c7b0e665aa9102344e96f4d9d9fb5c9cb9339dbb77b87385b49ec6410222ab277db01736
6
+ metadata.gz: ac6a976b7174253ef6eb5a850bc523ea00af453c0a531098c53715bfadde3a8ed1746eb8a2de76769c90266b42b904479a0101b671265c0c970648979b8ed773
7
+ data.tar.gz: cae8145283e0c1228b8225978268caacd9d896e159d99e92315e577e0f55243bd6683c83d695c24431abb3b67b73f597470240f43ef3e39748153250ff3fcf00
data/README.md CHANGED
@@ -43,40 +43,50 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/web-risk)
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_risk/v1"
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::WebRisk::V1::WebRiskService::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).
76
86
 
77
87
  ## Supported Ruby Versions
78
88
 
79
- This library is supported on Ruby 2.7+.
89
+ This library is supported on Ruby 3.0+.
80
90
 
81
91
  Google provides official support for Ruby versions that are actively supported
82
92
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module WebRisk
23
23
  module V1
24
- VERSION = "1.0.2"
24
+ VERSION = "1.2.0"
25
25
  end
26
26
  end
27
27
  end
@@ -182,8 +182,19 @@ module Google
182
182
  universe_domain: @config.universe_domain,
183
183
  channel_args: @config.channel_args,
184
184
  interceptors: @config.interceptors,
185
- channel_pool_config: @config.channel_pool
185
+ channel_pool_config: @config.channel_pool,
186
+ logger: @config.logger
186
187
  )
188
+
189
+ @web_risk_service_stub.stub_logger&.info do |entry|
190
+ entry.set_system_name
191
+ entry.set_service
192
+ entry.message = "Created client for #{entry.service}"
193
+ entry.set_credentials_fields credentials
194
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
195
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
196
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
197
+ end
187
198
  end
188
199
 
189
200
  ##
@@ -193,6 +204,15 @@ module Google
193
204
  #
194
205
  attr_reader :operations_client
195
206
 
207
+ ##
208
+ # The logger used for request/response debug logging.
209
+ #
210
+ # @return [Logger]
211
+ #
212
+ def logger
213
+ @web_risk_service_stub.logger
214
+ end
215
+
196
216
  # Service calls
197
217
 
198
218
  ##
@@ -282,7 +302,6 @@ module Google
282
302
 
283
303
  @web_risk_service_stub.call_rpc :compute_threat_list_diff, request, options: options do |response, operation|
284
304
  yield response, operation if block_given?
285
- return response
286
305
  end
287
306
  rescue ::GRPC::BadStatus => e
288
307
  raise ::Google::Cloud::Error.from_error(e)
@@ -367,7 +386,6 @@ module Google
367
386
 
368
387
  @web_risk_service_stub.call_rpc :search_uris, request, options: options do |response, operation|
369
388
  yield response, operation if block_given?
370
- return response
371
389
  end
372
390
  rescue ::GRPC::BadStatus => e
373
391
  raise ::Google::Cloud::Error.from_error(e)
@@ -455,7 +473,6 @@ module Google
455
473
 
456
474
  @web_risk_service_stub.call_rpc :search_hashes, request, options: options do |response, operation|
457
475
  yield response, operation if block_given?
458
- return response
459
476
  end
460
477
  rescue ::GRPC::BadStatus => e
461
478
  raise ::Google::Cloud::Error.from_error(e)
@@ -550,7 +567,6 @@ module Google
550
567
 
551
568
  @web_risk_service_stub.call_rpc :create_submission, request, options: options do |response, operation|
552
569
  yield response, operation if block_given?
553
- return response
554
570
  end
555
571
  rescue ::GRPC::BadStatus => e
556
572
  raise ::Google::Cloud::Error.from_error(e)
@@ -660,7 +676,7 @@ module Google
660
676
  @web_risk_service_stub.call_rpc :submit_uri, request, options: options do |response, operation|
661
677
  response = ::Gapic::Operation.new response, @operations_client, options: options
662
678
  yield response, operation if block_given?
663
- return response
679
+ throw :response, response
664
680
  end
665
681
  rescue ::GRPC::BadStatus => e
666
682
  raise ::Google::Cloud::Error.from_error(e)
@@ -710,6 +726,13 @@ module Google
710
726
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
711
727
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
712
728
  # * (`nil`) indicating no credentials
729
+ #
730
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
731
+ # external source for authentication to Google Cloud, you must validate it before
732
+ # providing it to a Google API client library. Providing an unvalidated credential
733
+ # configuration to Google APIs can compromise the security of your systems and data.
734
+ # For more information, refer to [Validate credential configurations from external
735
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
713
736
  # @return [::Object]
714
737
  # @!attribute [rw] scope
715
738
  # The OAuth scopes
@@ -749,6 +772,11 @@ module Google
749
772
  # default endpoint URL. The default value of nil uses the environment
750
773
  # universe (usually the default "googleapis.com" universe).
751
774
  # @return [::String,nil]
775
+ # @!attribute [rw] logger
776
+ # A custom logger to use for request/response debug logging, or the value
777
+ # `:default` (the default) to construct a default logger, or `nil` to
778
+ # explicitly disable logging.
779
+ # @return [::Logger,:default,nil]
752
780
  #
753
781
  class Configuration
754
782
  extend ::Gapic::Config
@@ -773,6 +801,7 @@ module Google
773
801
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
774
802
  config_attr :quota_project, nil, ::String, nil
775
803
  config_attr :universe_domain, nil, ::String, nil
804
+ config_attr :logger, :default, ::Logger, nil, :default
776
805
 
777
806
  # @private
778
807
  def initialize parent_config = nil
@@ -213,7 +213,7 @@ module Google
213
213
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
214
214
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
215
215
  yield response, operation if block_given?
216
- return response
216
+ throw :response, response
217
217
  end
218
218
  rescue ::GRPC::BadStatus => e
219
219
  raise ::Google::Cloud::Error.from_error(e)
@@ -309,7 +309,7 @@ module Google
309
309
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
310
310
  response = ::Gapic::Operation.new response, @operations_client, options: options
311
311
  yield response, operation if block_given?
312
- return response
312
+ throw :response, response
313
313
  end
314
314
  rescue ::GRPC::BadStatus => e
315
315
  raise ::Google::Cloud::Error.from_error(e)
@@ -398,7 +398,6 @@ module Google
398
398
 
399
399
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
400
400
  yield response, operation if block_given?
401
- return response
402
401
  end
403
402
  rescue ::GRPC::BadStatus => e
404
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -494,7 +493,6 @@ module Google
494
493
 
495
494
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
496
495
  yield response, operation if block_given?
497
- return response
498
496
  end
499
497
  rescue ::GRPC::BadStatus => e
500
498
  raise ::Google::Cloud::Error.from_error(e)
@@ -592,7 +590,7 @@ module Google
592
590
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
593
591
  response = ::Gapic::Operation.new response, @operations_client, options: options
594
592
  yield response, operation if block_given?
595
- return response
593
+ throw :response, response
596
594
  end
597
595
  rescue ::GRPC::BadStatus => e
598
596
  raise ::Google::Cloud::Error.from_error(e)
@@ -642,6 +640,13 @@ module Google
642
640
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
643
641
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
644
642
  # * (`nil`) indicating no credentials
643
+ #
644
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
645
+ # external source for authentication to Google Cloud, you must validate it before
646
+ # providing it to a Google API client library. Providing an unvalidated credential
647
+ # configuration to Google APIs can compromise the security of your systems and data.
648
+ # For more information, refer to [Validate credential configurations from external
649
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
645
650
  # @return [::Object]
646
651
  # @!attribute [rw] scope
647
652
  # The OAuth scopes
@@ -681,6 +686,11 @@ module Google
681
686
  # default endpoint URL. The default value of nil uses the environment
682
687
  # universe (usually the default "googleapis.com" universe).
683
688
  # @return [::String,nil]
689
+ # @!attribute [rw] logger
690
+ # A custom logger to use for request/response debug logging, or the value
691
+ # `:default` (the default) to construct a default logger, or `nil` to
692
+ # explicitly disable logging.
693
+ # @return [::Logger,:default,nil]
684
694
  #
685
695
  class Configuration
686
696
  extend ::Gapic::Config
@@ -705,6 +715,7 @@ module Google
705
715
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
706
716
  config_attr :quota_project, nil, ::String, nil
707
717
  config_attr :universe_domain, nil, ::String, nil
718
+ config_attr :logger, :default, ::Logger, nil, :default
708
719
 
709
720
  # @private
710
721
  def initialize parent_config = nil
@@ -175,8 +175,19 @@ module Google
175
175
  endpoint: @config.endpoint,
176
176
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
177
177
  universe_domain: @config.universe_domain,
178
- credentials: credentials
178
+ credentials: credentials,
179
+ logger: @config.logger
179
180
  )
181
+
182
+ @web_risk_service_stub.logger(stub: true)&.info do |entry|
183
+ entry.set_system_name
184
+ entry.set_service
185
+ entry.message = "Created client for #{entry.service}"
186
+ entry.set_credentials_fields credentials
187
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
188
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
189
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
190
+ end
180
191
  end
181
192
 
182
193
  ##
@@ -186,6 +197,15 @@ module Google
186
197
  #
187
198
  attr_reader :operations_client
188
199
 
200
+ ##
201
+ # The logger used for request/response debug logging.
202
+ #
203
+ # @return [Logger]
204
+ #
205
+ def logger
206
+ @web_risk_service_stub.logger
207
+ end
208
+
189
209
  # Service calls
190
210
 
191
211
  ##
@@ -276,7 +296,6 @@ module Google
276
296
 
277
297
  @web_risk_service_stub.compute_threat_list_diff request, options do |result, operation|
278
298
  yield result, operation if block_given?
279
- return result
280
299
  end
281
300
  rescue ::Gapic::Rest::Error => e
282
301
  raise ::Google::Cloud::Error.from_error(e)
@@ -362,7 +381,6 @@ module Google
362
381
 
363
382
  @web_risk_service_stub.search_uris request, options do |result, operation|
364
383
  yield result, operation if block_given?
365
- return result
366
384
  end
367
385
  rescue ::Gapic::Rest::Error => e
368
386
  raise ::Google::Cloud::Error.from_error(e)
@@ -451,7 +469,6 @@ module Google
451
469
 
452
470
  @web_risk_service_stub.search_hashes request, options do |result, operation|
453
471
  yield result, operation if block_given?
454
- return result
455
472
  end
456
473
  rescue ::Gapic::Rest::Error => e
457
474
  raise ::Google::Cloud::Error.from_error(e)
@@ -539,7 +556,6 @@ module Google
539
556
 
540
557
  @web_risk_service_stub.create_submission request, options do |result, operation|
541
558
  yield result, operation if block_given?
542
- return result
543
559
  end
544
560
  rescue ::Gapic::Rest::Error => e
545
561
  raise ::Google::Cloud::Error.from_error(e)
@@ -642,7 +658,7 @@ module Google
642
658
  @web_risk_service_stub.submit_uri request, options do |result, operation|
643
659
  result = ::Gapic::Operation.new result, @operations_client, options: options
644
660
  yield result, operation if block_given?
645
- return result
661
+ throw :response, result
646
662
  end
647
663
  rescue ::Gapic::Rest::Error => e
648
664
  raise ::Google::Cloud::Error.from_error(e)
@@ -690,6 +706,13 @@ module Google
690
706
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
691
707
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
692
708
  # * (`nil`) indicating no credentials
709
+ #
710
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
711
+ # external source for authentication to Google Cloud, you must validate it before
712
+ # providing it to a Google API client library. Providing an unvalidated credential
713
+ # configuration to Google APIs can compromise the security of your systems and data.
714
+ # For more information, refer to [Validate credential configurations from external
715
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
693
716
  # @return [::Object]
694
717
  # @!attribute [rw] scope
695
718
  # The OAuth scopes
@@ -722,6 +745,11 @@ module Google
722
745
  # default endpoint URL. The default value of nil uses the environment
723
746
  # universe (usually the default "googleapis.com" universe).
724
747
  # @return [::String,nil]
748
+ # @!attribute [rw] logger
749
+ # A custom logger to use for request/response debug logging, or the value
750
+ # `:default` (the default) to construct a default logger, or `nil` to
751
+ # explicitly disable logging.
752
+ # @return [::Logger,:default,nil]
725
753
  #
726
754
  class Configuration
727
755
  extend ::Gapic::Config
@@ -743,6 +771,7 @@ module Google
743
771
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
744
772
  config_attr :quota_project, nil, ::String, nil
745
773
  config_attr :universe_domain, nil, ::String, nil
774
+ config_attr :logger, :default, ::Logger, nil, :default
746
775
 
747
776
  # @private
748
777
  def initialize parent_config = nil
@@ -196,7 +196,7 @@ module Google
196
196
  @operations_stub.list_operations request, options do |result, operation|
197
197
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
198
198
  yield result, operation if block_given?
199
- return result
199
+ throw :response, result
200
200
  end
201
201
  rescue ::Gapic::Rest::Error => e
202
202
  raise ::Google::Cloud::Error.from_error(e)
@@ -285,7 +285,7 @@ module Google
285
285
  @operations_stub.get_operation request, options do |result, operation|
286
286
  result = ::Gapic::Operation.new result, @operations_client, options: options
287
287
  yield result, operation if block_given?
288
- return result
288
+ throw :response, result
289
289
  end
290
290
  rescue ::Gapic::Rest::Error => e
291
291
  raise ::Google::Cloud::Error.from_error(e)
@@ -367,7 +367,6 @@ module Google
367
367
 
368
368
  @operations_stub.delete_operation request, options do |result, operation|
369
369
  yield result, operation if block_given?
370
- return result
371
370
  end
372
371
  rescue ::Gapic::Rest::Error => e
373
372
  raise ::Google::Cloud::Error.from_error(e)
@@ -456,7 +455,6 @@ module Google
456
455
 
457
456
  @operations_stub.cancel_operation request, options do |result, operation|
458
457
  yield result, operation if block_given?
459
- return result
460
458
  end
461
459
  rescue ::Gapic::Rest::Error => e
462
460
  raise ::Google::Cloud::Error.from_error(e)
@@ -504,6 +502,13 @@ module Google
504
502
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
505
503
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
506
504
  # * (`nil`) indicating no credentials
505
+ #
506
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
507
+ # external source for authentication to Google Cloud, you must validate it before
508
+ # providing it to a Google API client library. Providing an unvalidated credential
509
+ # configuration to Google APIs can compromise the security of your systems and data.
510
+ # For more information, refer to [Validate credential configurations from external
511
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
507
512
  # @return [::Object]
508
513
  # @!attribute [rw] scope
509
514
  # The OAuth scopes
@@ -536,6 +541,11 @@ module Google
536
541
  # default endpoint URL. The default value of nil uses the environment
537
542
  # universe (usually the default "googleapis.com" universe).
538
543
  # @return [::String,nil]
544
+ # @!attribute [rw] logger
545
+ # A custom logger to use for request/response debug logging, or the value
546
+ # `:default` (the default) to construct a default logger, or `nil` to
547
+ # explicitly disable logging.
548
+ # @return [::Logger,:default,nil]
539
549
  #
540
550
  class Configuration
541
551
  extend ::Gapic::Config
@@ -557,6 +567,7 @@ module Google
557
567
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
558
568
  config_attr :quota_project, nil, ::String, nil
559
569
  config_attr :universe_domain, nil, ::String, nil
570
+ config_attr :logger, :default, ::Logger, nil, :default
560
571
 
561
572
  # @private
562
573
  def initialize parent_config = nil
@@ -676,16 +687,18 @@ module Google
676
687
 
677
688
  response = @client_stub.make_http_request(
678
689
  verb,
679
- uri: uri,
680
- body: body || "",
681
- params: query_string_params,
690
+ uri: uri,
691
+ body: body || "",
692
+ params: query_string_params,
693
+ method_name: "list_operations",
682
694
  options: options
683
695
  )
684
696
  operation = ::Gapic::Rest::TransportOperation.new response
685
697
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
686
-
687
- yield result, operation if block_given?
688
- result
698
+ catch :response do
699
+ yield result, operation if block_given?
700
+ result
701
+ end
689
702
  end
690
703
 
691
704
  ##
@@ -714,16 +727,18 @@ module Google
714
727
 
715
728
  response = @client_stub.make_http_request(
716
729
  verb,
717
- uri: uri,
718
- body: body || "",
719
- params: query_string_params,
730
+ uri: uri,
731
+ body: body || "",
732
+ params: query_string_params,
733
+ method_name: "get_operation",
720
734
  options: options
721
735
  )
722
736
  operation = ::Gapic::Rest::TransportOperation.new response
723
737
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
724
-
725
- yield result, operation if block_given?
726
- result
738
+ catch :response do
739
+ yield result, operation if block_given?
740
+ result
741
+ end
727
742
  end
728
743
 
729
744
  ##
@@ -752,16 +767,18 @@ module Google
752
767
 
753
768
  response = @client_stub.make_http_request(
754
769
  verb,
755
- uri: uri,
756
- body: body || "",
757
- params: query_string_params,
770
+ uri: uri,
771
+ body: body || "",
772
+ params: query_string_params,
773
+ method_name: "delete_operation",
758
774
  options: options
759
775
  )
760
776
  operation = ::Gapic::Rest::TransportOperation.new response
761
777
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
762
-
763
- yield result, operation if block_given?
764
- result
778
+ catch :response do
779
+ yield result, operation if block_given?
780
+ result
781
+ end
765
782
  end
766
783
 
767
784
  ##
@@ -790,16 +807,18 @@ module Google
790
807
 
791
808
  response = @client_stub.make_http_request(
792
809
  verb,
793
- uri: uri,
794
- body: body || "",
795
- params: query_string_params,
810
+ uri: uri,
811
+ body: body || "",
812
+ params: query_string_params,
813
+ method_name: "cancel_operation",
796
814
  options: options
797
815
  )
798
816
  operation = ::Gapic::Rest::TransportOperation.new response
799
817
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
800
-
801
- yield result, operation if block_given?
802
- result
818
+ catch :response do
819
+ yield result, operation if block_given?
820
+ result
821
+ end
803
822
  end
804
823
 
805
824
  ##
@@ -30,7 +30,8 @@ module Google
30
30
  # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
33
+ # @private
34
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
34
35
  # These require statements are intentionally placed here to initialize
35
36
  # the REST modules only when it's required.
36
37
  require "gapic/rest"
@@ -40,7 +41,9 @@ module Google
40
41
  universe_domain: universe_domain,
41
42
  credentials: credentials,
42
43
  numeric_enums: true,
43
- raise_faraday_errors: false
44
+ service_name: self.class,
45
+ raise_faraday_errors: false,
46
+ logger: logger
44
47
  end
45
48
 
46
49
  ##
@@ -61,6 +64,15 @@ module Google
61
64
  @client_stub.endpoint
62
65
  end
63
66
 
67
+ ##
68
+ # The logger used for request/response debug logging.
69
+ #
70
+ # @return [Logger]
71
+ #
72
+ def logger stub: false
73
+ stub ? @client_stub.stub_logger : @client_stub.logger
74
+ end
75
+
64
76
  ##
65
77
  # Baseline implementation for the compute_threat_list_diff REST call
66
78
  #
@@ -87,16 +99,18 @@ module Google
87
99
 
88
100
  response = @client_stub.make_http_request(
89
101
  verb,
90
- uri: uri,
91
- body: body || "",
92
- params: query_string_params,
102
+ uri: uri,
103
+ body: body || "",
104
+ params: query_string_params,
105
+ method_name: "compute_threat_list_diff",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::WebRisk::V1::ComputeThreatListDiffResponse.decode_json response.body, ignore_unknown_fields: true
97
-
98
- yield result, operation if block_given?
99
- result
110
+ catch :response do
111
+ yield result, operation if block_given?
112
+ result
113
+ end
100
114
  end
101
115
 
102
116
  ##
@@ -125,16 +139,18 @@ module Google
125
139
 
126
140
  response = @client_stub.make_http_request(
127
141
  verb,
128
- uri: uri,
129
- body: body || "",
130
- params: query_string_params,
142
+ uri: uri,
143
+ body: body || "",
144
+ params: query_string_params,
145
+ method_name: "search_uris",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Cloud::WebRisk::V1::SearchUrisResponse.decode_json response.body, ignore_unknown_fields: true
135
-
136
- yield result, operation if block_given?
137
- result
150
+ catch :response do
151
+ yield result, operation if block_given?
152
+ result
153
+ end
138
154
  end
139
155
 
140
156
  ##
@@ -163,16 +179,18 @@ module Google
163
179
 
164
180
  response = @client_stub.make_http_request(
165
181
  verb,
166
- uri: uri,
167
- body: body || "",
168
- params: query_string_params,
182
+ uri: uri,
183
+ body: body || "",
184
+ params: query_string_params,
185
+ method_name: "search_hashes",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Cloud::WebRisk::V1::SearchHashesResponse.decode_json response.body, ignore_unknown_fields: true
173
-
174
- yield result, operation if block_given?
175
- result
190
+ catch :response do
191
+ yield result, operation if block_given?
192
+ result
193
+ end
176
194
  end
177
195
 
178
196
  ##
@@ -201,16 +219,18 @@ module Google
201
219
 
202
220
  response = @client_stub.make_http_request(
203
221
  verb,
204
- uri: uri,
205
- body: body || "",
206
- params: query_string_params,
222
+ uri: uri,
223
+ body: body || "",
224
+ params: query_string_params,
225
+ method_name: "create_submission",
207
226
  options: options
208
227
  )
209
228
  operation = ::Gapic::Rest::TransportOperation.new response
210
229
  result = ::Google::Cloud::WebRisk::V1::Submission.decode_json response.body, ignore_unknown_fields: true
211
-
212
- yield result, operation if block_given?
213
- result
230
+ catch :response do
231
+ yield result, operation if block_given?
232
+ result
233
+ end
214
234
  end
215
235
 
216
236
  ##
@@ -239,16 +259,18 @@ module Google
239
259
 
240
260
  response = @client_stub.make_http_request(
241
261
  verb,
242
- uri: uri,
243
- body: body || "",
244
- params: query_string_params,
262
+ uri: uri,
263
+ body: body || "",
264
+ params: query_string_params,
265
+ method_name: "submit_uri",
245
266
  options: options
246
267
  )
247
268
  operation = ::Gapic::Rest::TransportOperation.new response
248
269
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
249
-
250
- yield result, operation if block_given?
251
- result
270
+ catch :response do
271
+ yield result, operation if block_given?
272
+ result
273
+ end
252
274
  end
253
275
 
254
276
  ##
@@ -323,9 +323,13 @@ module Google
323
323
  # A decimal representation of confidence in the range of 0
324
324
  # to 1 where 0 indicates no confidence and 1 indicates
325
325
  # complete confidence.
326
+ #
327
+ # Note: The following fields are mutually exclusive: `score`, `level`. If a field in that set is populated, all other fields in the set will automatically be cleared.
326
328
  # @!attribute [rw] level
327
329
  # @return [::Google::Cloud::WebRisk::V1::ThreatInfo::Confidence::ConfidenceLevel]
328
330
  # Enum representation of confidence.
331
+ #
332
+ # Note: The following fields are mutually exclusive: `level`, `score`. If a field in that set is populated, all other fields in the set will automatically be cleared.
329
333
  class Confidence
330
334
  include ::Google::Protobuf::MessageExts
331
335
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -40,6 +40,8 @@ module Google
40
40
  # @!attribute [rw] error
41
41
  # @return [::Google::Rpc::Status]
42
42
  # The error result of the operation in case of failure or cancellation.
43
+ #
44
+ # Note: The following fields are mutually exclusive: `error`, `response`. If a field in that set is populated, all other fields in the set will automatically be cleared.
43
45
  # @!attribute [rw] response
44
46
  # @return [::Google::Protobuf::Any]
45
47
  # The normal, successful response of the operation. If the original
@@ -50,6 +52,8 @@ module Google
50
52
  # is the original method name. For example, if the original method name
51
53
  # is `TakeSnapshot()`, the inferred response type is
52
54
  # `TakeSnapshotResponse`.
55
+ #
56
+ # Note: The following fields are mutually exclusive: `response`, `error`. If a field in that set is populated, all other fields in the set will automatically be cleared.
53
57
  class Operation
54
58
  include ::Google::Protobuf::MessageExts
55
59
  extend ::Google::Protobuf::MessageExts::ClassMethods
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-web_risk-v1
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-12-05 00:00:00.000000000 Z
10
+ date: 2025-01-29 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: gapic-common
@@ -16,7 +15,7 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: 0.21.1
18
+ version: 0.25.0
20
19
  - - "<"
21
20
  - !ruby/object:Gem::Version
22
21
  version: 2.a
@@ -26,7 +25,7 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- version: 0.21.1
28
+ version: 0.25.0
30
29
  - - "<"
31
30
  - !ruby/object:Gem::Version
32
31
  version: 2.a
@@ -89,7 +88,6 @@ homepage: https://github.com/googleapis/google-cloud-ruby
89
88
  licenses:
90
89
  - Apache-2.0
91
90
  metadata: {}
92
- post_install_message:
93
91
  rdoc_options: []
94
92
  require_paths:
95
93
  - lib
@@ -97,15 +95,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
95
  requirements:
98
96
  - - ">="
99
97
  - !ruby/object:Gem::Version
100
- version: '2.7'
98
+ version: '3.0'
101
99
  required_rubygems_version: !ruby/object:Gem::Requirement
102
100
  requirements:
103
101
  - - ">="
104
102
  - !ruby/object:Gem::Version
105
103
  version: '0'
106
104
  requirements: []
107
- rubygems_version: 3.5.23
108
- signing_key:
105
+ rubygems_version: 3.6.2
109
106
  specification_version: 4
110
107
  summary: API Client library for the Web Risk V1 API
111
108
  test_files: []