google-cloud-web_risk-v1 0.7.0 → 0.9.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.
@@ -148,9 +148,22 @@ module Google
148
148
  @quota_project_id = @config.quota_project
149
149
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
150
150
 
151
+ @operations_client = ::Google::Cloud::WebRisk::V1::WebRiskService::Rest::Operations.new do |config|
152
+ config.credentials = credentials
153
+ config.quota_project = @quota_project_id
154
+ config.endpoint = @config.endpoint
155
+ end
156
+
151
157
  @web_risk_service_stub = ::Google::Cloud::WebRisk::V1::WebRiskService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
152
158
  end
153
159
 
160
+ ##
161
+ # Get the associated client for long-running operations.
162
+ #
163
+ # @return [::Google::Cloud::WebRisk::V1::WebRiskService::Rest::Operations]
164
+ #
165
+ attr_reader :operations_client
166
+
154
167
  # Service calls
155
168
 
156
169
  ##
@@ -177,9 +190,9 @@ module Google
177
190
  # the default parameter values, pass an empty Hash as a request object (see above).
178
191
  #
179
192
  # @param threat_type [::Google::Cloud::WebRisk::V1::ThreatType]
180
- # Required. The threat list to update. Only a single ThreatType should be specified
181
- # per request. If you want to handle multiple ThreatTypes, you must make one
182
- # request per ThreatType.
193
+ # Required. The threat list to update. Only a single ThreatType should be
194
+ # specified per request. If you want to handle multiple ThreatTypes, you must
195
+ # make one request per ThreatType.
183
196
  # @param version_token [::String]
184
197
  # The current version token of the client for the requested list (the
185
198
  # client version that was received from the last successful diff).
@@ -255,7 +268,8 @@ module Google
255
268
  # @param uri [::String]
256
269
  # Required. The URI to be checked for matches.
257
270
  # @param threat_types [::Array<::Google::Cloud::WebRisk::V1::ThreatType>]
258
- # Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
271
+ # Required. The ThreatLists to search in. Multiple ThreatLists may be
272
+ # specified.
259
273
  # @yield [result, operation] Access the result along with the TransportOperation object
260
274
  # @yieldparam result [::Google::Cloud::WebRisk::V1::SearchUrisResponse]
261
275
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -326,7 +340,8 @@ module Google
326
340
  # Note that if this parameter is provided by a URI, it must be encoded using
327
341
  # the web safe base64 variant (RFC 4648).
328
342
  # @param threat_types [::Array<::Google::Cloud::WebRisk::V1::ThreatType>]
329
- # Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
343
+ # Required. The ThreatLists to search in. Multiple ThreatLists may be
344
+ # specified.
330
345
  # @yield [result, operation] Access the result along with the TransportOperation object
331
346
  # @yieldparam result [::Google::Cloud::WebRisk::V1::SearchHashesResponse]
332
347
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -394,8 +409,8 @@ module Google
394
409
  # the default parameter values, pass an empty Hash as a request object (see above).
395
410
  #
396
411
  # @param parent [::String]
397
- # Required. The name of the project that is making the submission. This string is in
398
- # the format "projects/\\{project_number}".
412
+ # Required. The name of the project that is making the submission. This
413
+ # string is in the format "projects/\\{project_number}".
399
414
  # @param submission [::Google::Cloud::WebRisk::V1::Submission, ::Hash]
400
415
  # Required. The submission that contains the content of the phishing report.
401
416
  # @yield [result, operation] Access the result along with the TransportOperation object
@@ -440,6 +455,85 @@ module Google
440
455
  raise ::Google::Cloud::Error.from_error(e)
441
456
  end
442
457
 
458
+ ##
459
+ # Submits a URI suspected of containing malicious content to be reviewed.
460
+ # Returns a google.longrunning.Operation which, once the review is complete,
461
+ # is updated with its result. You can use the [Pub/Sub API]
462
+ # (https://cloud.google.com/pubsub) to receive notifications for the returned
463
+ # Operation. If the result verifies the existence of malicious content, the
464
+ # site will be added to the [Google's Social Engineering lists]
465
+ # (https://support.google.com/webmasters/answer/6350487/) in order to
466
+ # protect users that could get exposed to this threat in the future. Only
467
+ # allowlisted projects can use this method during Early Access. Please reach
468
+ # out to Sales or your customer engineer to obtain access.
469
+ #
470
+ # @overload submit_uri(request, options = nil)
471
+ # Pass arguments to `submit_uri` via a request object, either of type
472
+ # {::Google::Cloud::WebRisk::V1::SubmitUriRequest} or an equivalent Hash.
473
+ #
474
+ # @param request [::Google::Cloud::WebRisk::V1::SubmitUriRequest, ::Hash]
475
+ # A request object representing the call parameters. Required. To specify no
476
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
477
+ # @param options [::Gapic::CallOptions, ::Hash]
478
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
479
+ #
480
+ # @overload submit_uri(parent: nil, submission: nil, threat_info: nil, threat_discovery: nil)
481
+ # Pass arguments to `submit_uri` via keyword arguments. Note that at
482
+ # least one keyword argument is required. To specify no parameters, or to keep all
483
+ # the default parameter values, pass an empty Hash as a request object (see above).
484
+ #
485
+ # @param parent [::String]
486
+ # Required. The name of the project that is making the submission. This
487
+ # string is in the format "projects/\\{project_number}".
488
+ # @param submission [::Google::Cloud::WebRisk::V1::Submission, ::Hash]
489
+ # Required. The submission that contains the URI to be scanned.
490
+ # @param threat_info [::Google::Cloud::WebRisk::V1::ThreatInfo, ::Hash]
491
+ # Provides additional information about the submission.
492
+ # @param threat_discovery [::Google::Cloud::WebRisk::V1::ThreatDiscovery, ::Hash]
493
+ # Provides additional information about how the submission was discovered.
494
+ # @yield [result, operation] Access the result along with the TransportOperation object
495
+ # @yieldparam result [::Gapic::Operation]
496
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
497
+ #
498
+ # @return [::Gapic::Operation]
499
+ #
500
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
501
+ def submit_uri request, options = nil
502
+ raise ::ArgumentError, "request must be provided" if request.nil?
503
+
504
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebRisk::V1::SubmitUriRequest
505
+
506
+ # Converts hash and nil to an options object
507
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
508
+
509
+ # Customize the options with defaults
510
+ call_metadata = @config.rpcs.submit_uri.metadata.to_h
511
+
512
+ # Set x-goog-api-client and x-goog-user-project headers
513
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
514
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
515
+ gapic_version: ::Google::Cloud::WebRisk::V1::VERSION,
516
+ transports_version_send: [:rest]
517
+
518
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
519
+
520
+ options.apply_defaults timeout: @config.rpcs.submit_uri.timeout,
521
+ metadata: call_metadata,
522
+ retry_policy: @config.rpcs.submit_uri.retry_policy
523
+
524
+ options.apply_defaults timeout: @config.timeout,
525
+ metadata: @config.metadata,
526
+ retry_policy: @config.retry_policy
527
+
528
+ @web_risk_service_stub.submit_uri request, options do |result, operation|
529
+ result = ::Gapic::Operation.new result, @operations_client, options: options
530
+ yield result, operation if block_given?
531
+ return result
532
+ end
533
+ rescue ::Gapic::Rest::Error => e
534
+ raise ::Google::Cloud::Error.from_error(e)
535
+ end
536
+
443
537
  ##
444
538
  # Configuration class for the WebRiskService REST API.
445
539
  #
@@ -478,9 +572,9 @@ module Google
478
572
  # * (`String`) The path to a service account key file in JSON format
479
573
  # * (`Hash`) A service account key as a Hash
480
574
  # * (`Google::Auth::Credentials`) A googleauth credentials object
481
- # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
575
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
482
576
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
483
- # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
577
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
484
578
  # * (`nil`) indicating no credentials
485
579
  # @return [::Object]
486
580
  # @!attribute [rw] scope
@@ -583,6 +677,11 @@ module Google
583
677
  # @return [::Gapic::Config::Method]
584
678
  #
585
679
  attr_reader :create_submission
680
+ ##
681
+ # RPC-specific configuration for `submit_uri`
682
+ # @return [::Gapic::Config::Method]
683
+ #
684
+ attr_reader :submit_uri
586
685
 
587
686
  # @private
588
687
  def initialize parent_rpcs = nil
@@ -594,6 +693,8 @@ module Google
594
693
  @search_hashes = ::Gapic::Config::Method.new search_hashes_config
595
694
  create_submission_config = parent_rpcs.create_submission if parent_rpcs.respond_to? :create_submission
596
695
  @create_submission = ::Gapic::Config::Method.new create_submission_config
696
+ submit_uri_config = parent_rpcs.submit_uri if parent_rpcs.respond_to? :submit_uri
697
+ @submit_uri = ::Gapic::Config::Method.new submit_uri_config
597
698
 
598
699
  yield self if block_given?
599
700
  end