google-cloud-web_risk-v1 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/google/cloud/web_risk/v1/version.rb +1 -1
- data/lib/google/cloud/web_risk/v1/web_risk_service/client.rb +140 -9
- data/lib/google/cloud/web_risk/v1/web_risk_service/operations.rb +768 -0
- data/lib/google/cloud/web_risk/v1/web_risk_service/rest/client.rb +110 -9
- data/lib/google/cloud/web_risk/v1/web_risk_service/rest/operations.rb +793 -0
- data/lib/google/cloud/web_risk/v1/web_risk_service/rest/service_stub.rb +60 -0
- data/lib/google/cloud/web_risk/v1/web_risk_service/rest.rb +1 -0
- data/lib/google/cloud/web_risk/v1/web_risk_service.rb +1 -0
- data/lib/google/cloud/webrisk/v1/webrisk_pb.rb +76 -0
- data/lib/google/cloud/webrisk/v1/webrisk_services_pb.rb +11 -0
- data/proto_docs/google/api/client.rb +67 -4
- data/proto_docs/google/cloud/webrisk/v1/webrisk.rb +191 -8
- data/proto_docs/google/longrunning/operations.rb +164 -0
- data/proto_docs/google/protobuf/any.rb +141 -0
- data/proto_docs/google/protobuf/empty.rb +34 -0
- data/proto_docs/google/rpc/status.rb +48 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5917c20c38860aa4203e645388a14d19e694f03231c7227446022b6144d438e3
|
4
|
+
data.tar.gz: 0c62427299f2a62d8261c2fd96cea1c331c4d5275726f006c7aa80eea64e3d09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f057ccdca509ca2dfb7a5996805ea7e98678ddcb15be0eb6e3f0baf77ec3f9d8bd41b80e0ab72a7c37069707fe17cfcc96b40c15fe4a988c6b341f2c623a5a47
|
7
|
+
data.tar.gz: 2b16c774b6a7302d7b44e26fc25d4f0cafb6aabc9bcb956ee2af970b4d9fe0876090c69133d490a9d8e7d91d15f068c668fd8915b1e734f33052dd6ed11ce2c2
|
data/README.md
CHANGED
@@ -47,7 +47,7 @@ for general usage information.
|
|
47
47
|
|
48
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
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://
|
50
|
+
or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
|
51
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
52
|
and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
53
53
|
|
@@ -151,6 +151,12 @@ module Google
|
|
151
151
|
@quota_project_id = @config.quota_project
|
152
152
|
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
153
153
|
|
154
|
+
@operations_client = Operations.new do |config|
|
155
|
+
config.credentials = credentials
|
156
|
+
config.quota_project = @quota_project_id
|
157
|
+
config.endpoint = @config.endpoint
|
158
|
+
end
|
159
|
+
|
154
160
|
@web_risk_service_stub = ::Gapic::ServiceStub.new(
|
155
161
|
::Google::Cloud::WebRisk::V1::WebRiskService::Stub,
|
156
162
|
credentials: credentials,
|
@@ -160,6 +166,13 @@ module Google
|
|
160
166
|
)
|
161
167
|
end
|
162
168
|
|
169
|
+
##
|
170
|
+
# Get the associated client for long-running operations.
|
171
|
+
#
|
172
|
+
# @return [::Google::Cloud::WebRisk::V1::WebRiskService::Operations]
|
173
|
+
#
|
174
|
+
attr_reader :operations_client
|
175
|
+
|
163
176
|
# Service calls
|
164
177
|
|
165
178
|
##
|
@@ -186,9 +199,9 @@ module Google
|
|
186
199
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
187
200
|
#
|
188
201
|
# @param threat_type [::Google::Cloud::WebRisk::V1::ThreatType]
|
189
|
-
# Required. The threat list to update. Only a single ThreatType should be
|
190
|
-
# per request. If you want to handle multiple ThreatTypes, you must
|
191
|
-
# request per ThreatType.
|
202
|
+
# Required. The threat list to update. Only a single ThreatType should be
|
203
|
+
# specified per request. If you want to handle multiple ThreatTypes, you must
|
204
|
+
# make one request per ThreatType.
|
192
205
|
# @param version_token [::String]
|
193
206
|
# The current version token of the client for the requested list (the
|
194
207
|
# client version that was received from the last successful diff).
|
@@ -279,7 +292,8 @@ module Google
|
|
279
292
|
# @param uri [::String]
|
280
293
|
# Required. The URI to be checked for matches.
|
281
294
|
# @param threat_types [::Array<::Google::Cloud::WebRisk::V1::ThreatType>]
|
282
|
-
# Required. The ThreatLists to search in. Multiple ThreatLists may be
|
295
|
+
# Required. The ThreatLists to search in. Multiple ThreatLists may be
|
296
|
+
# specified.
|
283
297
|
#
|
284
298
|
# @yield [response, operation] Access the result along with the RPC operation
|
285
299
|
# @yieldparam response [::Google::Cloud::WebRisk::V1::SearchUrisResponse]
|
@@ -365,7 +379,8 @@ module Google
|
|
365
379
|
# Note that if this parameter is provided by a URI, it must be encoded using
|
366
380
|
# the web safe base64 variant (RFC 4648).
|
367
381
|
# @param threat_types [::Array<::Google::Cloud::WebRisk::V1::ThreatType>]
|
368
|
-
# Required. The ThreatLists to search in. Multiple ThreatLists may be
|
382
|
+
# Required. The ThreatLists to search in. Multiple ThreatLists may be
|
383
|
+
# specified.
|
369
384
|
#
|
370
385
|
# @yield [response, operation] Access the result along with the RPC operation
|
371
386
|
# @yieldparam response [::Google::Cloud::WebRisk::V1::SearchHashesResponse]
|
@@ -448,8 +463,8 @@ module Google
|
|
448
463
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
449
464
|
#
|
450
465
|
# @param parent [::String]
|
451
|
-
# Required. The name of the project that is making the submission. This
|
452
|
-
# the format "projects/\\{project_number}".
|
466
|
+
# Required. The name of the project that is making the submission. This
|
467
|
+
# string is in the format "projects/\\{project_number}".
|
453
468
|
# @param submission [::Google::Cloud::WebRisk::V1::Submission, ::Hash]
|
454
469
|
# Required. The submission that contains the content of the phishing report.
|
455
470
|
#
|
@@ -517,6 +532,115 @@ module Google
|
|
517
532
|
raise ::Google::Cloud::Error.from_error(e)
|
518
533
|
end
|
519
534
|
|
535
|
+
##
|
536
|
+
# Submits a URI suspected of containing malicious content to be reviewed.
|
537
|
+
# Returns a google.longrunning.Operation which, once the review is complete,
|
538
|
+
# is updated with its result. You can use the [Pub/Sub API]
|
539
|
+
# (https://cloud.google.com/pubsub) to receive notifications for the returned
|
540
|
+
# Operation. If the result verifies the existence of malicious content, the
|
541
|
+
# site will be added to the [Google's Social Engineering lists]
|
542
|
+
# (https://support.google.com/webmasters/answer/6350487/) in order to
|
543
|
+
# protect users that could get exposed to this threat in the future. Only
|
544
|
+
# allowlisted projects can use this method during Early Access. Please reach
|
545
|
+
# out to Sales or your customer engineer to obtain access.
|
546
|
+
#
|
547
|
+
# @overload submit_uri(request, options = nil)
|
548
|
+
# Pass arguments to `submit_uri` via a request object, either of type
|
549
|
+
# {::Google::Cloud::WebRisk::V1::SubmitUriRequest} or an equivalent Hash.
|
550
|
+
#
|
551
|
+
# @param request [::Google::Cloud::WebRisk::V1::SubmitUriRequest, ::Hash]
|
552
|
+
# A request object representing the call parameters. Required. To specify no
|
553
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
554
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
555
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
556
|
+
#
|
557
|
+
# @overload submit_uri(parent: nil, submission: nil, threat_info: nil, threat_discovery: nil)
|
558
|
+
# Pass arguments to `submit_uri` via keyword arguments. Note that at
|
559
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
560
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
561
|
+
#
|
562
|
+
# @param parent [::String]
|
563
|
+
# Required. The name of the project that is making the submission. This
|
564
|
+
# string is in the format "projects/\\{project_number}".
|
565
|
+
# @param submission [::Google::Cloud::WebRisk::V1::Submission, ::Hash]
|
566
|
+
# Required. The submission that contains the URI to be scanned.
|
567
|
+
# @param threat_info [::Google::Cloud::WebRisk::V1::ThreatInfo, ::Hash]
|
568
|
+
# Provides additional information about the submission.
|
569
|
+
# @param threat_discovery [::Google::Cloud::WebRisk::V1::ThreatDiscovery, ::Hash]
|
570
|
+
# Provides additional information about how the submission was discovered.
|
571
|
+
#
|
572
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
573
|
+
# @yieldparam response [::Gapic::Operation]
|
574
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
575
|
+
#
|
576
|
+
# @return [::Gapic::Operation]
|
577
|
+
#
|
578
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
579
|
+
#
|
580
|
+
# @example Basic example
|
581
|
+
# require "google/cloud/web_risk/v1"
|
582
|
+
#
|
583
|
+
# # Create a client object. The client can be reused for multiple calls.
|
584
|
+
# client = Google::Cloud::WebRisk::V1::WebRiskService::Client.new
|
585
|
+
#
|
586
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
587
|
+
# request = Google::Cloud::WebRisk::V1::SubmitUriRequest.new
|
588
|
+
#
|
589
|
+
# # Call the submit_uri method.
|
590
|
+
# result = client.submit_uri request
|
591
|
+
#
|
592
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
593
|
+
# # check the status of an operation, cancel it, or wait for results.
|
594
|
+
# # Here is how to wait for a response.
|
595
|
+
# result.wait_until_done! timeout: 60
|
596
|
+
# if result.response?
|
597
|
+
# p result.response
|
598
|
+
# else
|
599
|
+
# puts "No response received."
|
600
|
+
# end
|
601
|
+
#
|
602
|
+
def submit_uri request, options = nil
|
603
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
604
|
+
|
605
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebRisk::V1::SubmitUriRequest
|
606
|
+
|
607
|
+
# Converts hash and nil to an options object
|
608
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
609
|
+
|
610
|
+
# Customize the options with defaults
|
611
|
+
metadata = @config.rpcs.submit_uri.metadata.to_h
|
612
|
+
|
613
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
614
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
615
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
616
|
+
gapic_version: ::Google::Cloud::WebRisk::V1::VERSION
|
617
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
618
|
+
|
619
|
+
header_params = {}
|
620
|
+
if request.parent
|
621
|
+
header_params["parent"] = request.parent
|
622
|
+
end
|
623
|
+
|
624
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
625
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
626
|
+
|
627
|
+
options.apply_defaults timeout: @config.rpcs.submit_uri.timeout,
|
628
|
+
metadata: metadata,
|
629
|
+
retry_policy: @config.rpcs.submit_uri.retry_policy
|
630
|
+
|
631
|
+
options.apply_defaults timeout: @config.timeout,
|
632
|
+
metadata: @config.metadata,
|
633
|
+
retry_policy: @config.retry_policy
|
634
|
+
|
635
|
+
@web_risk_service_stub.call_rpc :submit_uri, request, options: options do |response, operation|
|
636
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
637
|
+
yield response, operation if block_given?
|
638
|
+
return response
|
639
|
+
end
|
640
|
+
rescue ::GRPC::BadStatus => e
|
641
|
+
raise ::Google::Cloud::Error.from_error(e)
|
642
|
+
end
|
643
|
+
|
520
644
|
##
|
521
645
|
# Configuration class for the WebRiskService API.
|
522
646
|
#
|
@@ -555,9 +679,9 @@ module Google
|
|
555
679
|
# * (`String`) The path to a service account key file in JSON format
|
556
680
|
# * (`Hash`) A service account key as a Hash
|
557
681
|
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
558
|
-
# (see the [googleauth docs](https://
|
682
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
559
683
|
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
560
|
-
# (see the [signet docs](https://
|
684
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
561
685
|
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
562
686
|
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
563
687
|
# * (`nil`) indicating no credentials
|
@@ -672,6 +796,11 @@ module Google
|
|
672
796
|
# @return [::Gapic::Config::Method]
|
673
797
|
#
|
674
798
|
attr_reader :create_submission
|
799
|
+
##
|
800
|
+
# RPC-specific configuration for `submit_uri`
|
801
|
+
# @return [::Gapic::Config::Method]
|
802
|
+
#
|
803
|
+
attr_reader :submit_uri
|
675
804
|
|
676
805
|
# @private
|
677
806
|
def initialize parent_rpcs = nil
|
@@ -683,6 +812,8 @@ module Google
|
|
683
812
|
@search_hashes = ::Gapic::Config::Method.new search_hashes_config
|
684
813
|
create_submission_config = parent_rpcs.create_submission if parent_rpcs.respond_to? :create_submission
|
685
814
|
@create_submission = ::Gapic::Config::Method.new create_submission_config
|
815
|
+
submit_uri_config = parent_rpcs.submit_uri if parent_rpcs.respond_to? :submit_uri
|
816
|
+
@submit_uri = ::Gapic::Config::Method.new submit_uri_config
|
686
817
|
|
687
818
|
yield self if block_given?
|
688
819
|
end
|