google-cloud-web_risk-v1beta1 0.1.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 +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +71 -0
- data/lib/google-cloud-web_risk-v1beta1.rb +21 -0
- data/lib/google/cloud/web_risk/v1beta1.rb +35 -0
- data/lib/google/cloud/web_risk/v1beta1/version.rb +28 -0
- data/lib/google/cloud/web_risk/v1beta1/web_risk_service.rb +49 -0
- data/lib/google/cloud/web_risk/v1beta1/web_risk_service/client.rb +529 -0
- data/lib/google/cloud/web_risk/v1beta1/web_risk_service/credentials.rb +51 -0
- data/lib/google/cloud/webrisk/v1beta1/webrisk_pb.rb +122 -0
- data/lib/google/cloud/webrisk/v1beta1/webrisk_services_pb.rb +55 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/resource.rb +247 -0
- data/proto_docs/google/cloud/webrisk/v1beta1/webrisk.rb +307 -0
- data/proto_docs/google/protobuf/timestamp.rb +120 -0
- metadata +172 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
# This gem does not autoload during Bundler.require. To load this gem,
|
20
|
+
# issue explicit require statements for the packages desired, e.g.:
|
21
|
+
# require "google/cloud/web_risk/v1beta1"
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/web_risk/v1beta1/web_risk_service"
|
20
|
+
require "google/cloud/web_risk/v1beta1/version"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module WebRisk
|
25
|
+
##
|
26
|
+
# To load this package, including all its services, and instantiate a client:
|
27
|
+
#
|
28
|
+
# require "google/cloud/web_risk/v1beta1"
|
29
|
+
# client = Google::Cloud::WebRisk::V1beta1::WebRiskService::Client.new
|
30
|
+
#
|
31
|
+
module V1beta1
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module WebRisk
|
23
|
+
module V1beta1
|
24
|
+
VERSION = "0.1.0"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "gapic/common"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/web_risk/v1beta1/version"
|
24
|
+
|
25
|
+
require "google/cloud/web_risk/v1beta1/web_risk_service/credentials"
|
26
|
+
require "google/cloud/web_risk/v1beta1/web_risk_service/client"
|
27
|
+
|
28
|
+
module Google
|
29
|
+
module Cloud
|
30
|
+
module WebRisk
|
31
|
+
module V1beta1
|
32
|
+
##
|
33
|
+
# Web Risk v1beta1 API defines an interface to detect malicious URLs on your
|
34
|
+
# website and in client applications.
|
35
|
+
#
|
36
|
+
# To load this service and instantiate a client:
|
37
|
+
#
|
38
|
+
# require "google/cloud/web_risk/v1beta1/web_risk_service"
|
39
|
+
# client = Google::Cloud::WebRisk::V1beta1::WebRiskService::Client.new
|
40
|
+
#
|
41
|
+
module WebRiskService
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
helper_path = ::File.join __dir__, "web_risk_service", "helpers.rb"
|
49
|
+
require "google/cloud/web_risk/v1beta1/web_risk_service/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,529 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/webrisk/v1beta1/webrisk_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module WebRisk
|
25
|
+
module V1beta1
|
26
|
+
module WebRiskService
|
27
|
+
##
|
28
|
+
# Client for the WebRiskServiceV1Beta1 service.
|
29
|
+
#
|
30
|
+
# Web Risk v1beta1 API defines an interface to detect malicious URLs on your
|
31
|
+
# website and in client applications.
|
32
|
+
#
|
33
|
+
class Client
|
34
|
+
# @private
|
35
|
+
attr_reader :web_risk_service_v1_beta1_stub
|
36
|
+
|
37
|
+
##
|
38
|
+
# Configure the WebRiskServiceV1Beta1 Client class.
|
39
|
+
#
|
40
|
+
# See {Google::Cloud::WebRisk::V1beta1::WebRiskService::Client::Configuration}
|
41
|
+
# for a description of the configuration fields.
|
42
|
+
#
|
43
|
+
# ## Example
|
44
|
+
#
|
45
|
+
# To modify the configuration for all WebRiskServiceV1Beta1 clients:
|
46
|
+
#
|
47
|
+
# Google::Cloud::WebRisk::V1beta1::WebRiskService::Client.configure do |config|
|
48
|
+
# config.timeout = 10_000
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# @yield [config] Configure the Client client.
|
52
|
+
# @yieldparam config [Client::Configuration]
|
53
|
+
#
|
54
|
+
# @return [Client::Configuration]
|
55
|
+
#
|
56
|
+
def self.configure
|
57
|
+
@configure ||= begin
|
58
|
+
namespace = ["Google", "Cloud", "WebRisk", "V1beta1"]
|
59
|
+
parent_config = while namespace.any?
|
60
|
+
parent_name = namespace.join "::"
|
61
|
+
parent_const = const_get parent_name
|
62
|
+
break parent_const.configure if parent_const&.respond_to? :configure
|
63
|
+
namespace.pop
|
64
|
+
end
|
65
|
+
default_config = Client::Configuration.new parent_config
|
66
|
+
|
67
|
+
default_config.rpcs.compute_threat_list_diff.timeout = 600.0
|
68
|
+
default_config.rpcs.compute_threat_list_diff.retry_policy = {
|
69
|
+
initial_delay: 0.1,
|
70
|
+
max_delay: 60.0,
|
71
|
+
multiplier: 1.3,
|
72
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
73
|
+
}
|
74
|
+
|
75
|
+
default_config.rpcs.search_uris.timeout = 600.0
|
76
|
+
default_config.rpcs.search_uris.retry_policy = {
|
77
|
+
initial_delay: 0.1,
|
78
|
+
max_delay: 60.0,
|
79
|
+
multiplier: 1.3,
|
80
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
81
|
+
}
|
82
|
+
|
83
|
+
default_config.rpcs.search_hashes.timeout = 600.0
|
84
|
+
default_config.rpcs.search_hashes.retry_policy = {
|
85
|
+
initial_delay: 0.1,
|
86
|
+
max_delay: 60.0,
|
87
|
+
multiplier: 1.3,
|
88
|
+
retry_codes: ["DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
89
|
+
}
|
90
|
+
|
91
|
+
default_config
|
92
|
+
end
|
93
|
+
yield @configure if block_given?
|
94
|
+
@configure
|
95
|
+
end
|
96
|
+
|
97
|
+
##
|
98
|
+
# Configure the WebRiskServiceV1Beta1 Client instance.
|
99
|
+
#
|
100
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
101
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
102
|
+
# should be made on {Client.configure}.
|
103
|
+
#
|
104
|
+
# See {Google::Cloud::WebRisk::V1beta1::WebRiskService::Client::Configuration}
|
105
|
+
# for a description of the configuration fields.
|
106
|
+
#
|
107
|
+
# @yield [config] Configure the Client client.
|
108
|
+
# @yieldparam config [Client::Configuration]
|
109
|
+
#
|
110
|
+
# @return [Client::Configuration]
|
111
|
+
#
|
112
|
+
def configure
|
113
|
+
yield @config if block_given?
|
114
|
+
@config
|
115
|
+
end
|
116
|
+
|
117
|
+
##
|
118
|
+
# Create a new WebRiskServiceV1Beta1 client object.
|
119
|
+
#
|
120
|
+
# ## Examples
|
121
|
+
#
|
122
|
+
# To create a new WebRiskServiceV1Beta1 client with the default
|
123
|
+
# configuration:
|
124
|
+
#
|
125
|
+
# client = Google::Cloud::WebRisk::V1beta1::WebRiskService::Client.new
|
126
|
+
#
|
127
|
+
# To create a new WebRiskServiceV1Beta1 client with a custom
|
128
|
+
# configuration:
|
129
|
+
#
|
130
|
+
# client = Google::Cloud::WebRisk::V1beta1::WebRiskService::Client.new do |config|
|
131
|
+
# config.timeout = 10_000
|
132
|
+
# end
|
133
|
+
#
|
134
|
+
# @yield [config] Configure the WebRiskServiceV1Beta1 client.
|
135
|
+
# @yieldparam config [Client::Configuration]
|
136
|
+
#
|
137
|
+
def initialize
|
138
|
+
# These require statements are intentionally placed here to initialize
|
139
|
+
# the gRPC module only when it's required.
|
140
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
141
|
+
require "gapic/grpc"
|
142
|
+
require "google/cloud/webrisk/v1beta1/webrisk_services_pb"
|
143
|
+
|
144
|
+
# Create the configuration object
|
145
|
+
@config = Configuration.new Client.configure
|
146
|
+
|
147
|
+
# Yield the configuration if needed
|
148
|
+
yield @config if block_given?
|
149
|
+
|
150
|
+
# Create credentials
|
151
|
+
credentials = @config.credentials
|
152
|
+
credentials ||= Credentials.default scope: @config.scope
|
153
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
154
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
155
|
+
end
|
156
|
+
@quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
|
157
|
+
|
158
|
+
@web_risk_service_v1_beta1_stub = Gapic::ServiceStub.new(
|
159
|
+
Google::Cloud::WebRisk::V1beta1::WebRiskServiceV1Beta1::Stub,
|
160
|
+
credentials: credentials,
|
161
|
+
endpoint: @config.endpoint,
|
162
|
+
channel_args: @config.channel_args,
|
163
|
+
interceptors: @config.interceptors
|
164
|
+
)
|
165
|
+
end
|
166
|
+
|
167
|
+
# Service calls
|
168
|
+
|
169
|
+
##
|
170
|
+
# Gets the most recent threat list diffs.
|
171
|
+
#
|
172
|
+
# @overload compute_threat_list_diff(request, options = nil)
|
173
|
+
# Pass arguments to `compute_threat_list_diff` via a request object, either of type
|
174
|
+
# {Google::Cloud::WebRisk::V1beta1::ComputeThreatListDiffRequest} or an equivalent Hash.
|
175
|
+
#
|
176
|
+
# @param request [Google::Cloud::WebRisk::V1beta1::ComputeThreatListDiffRequest, Hash]
|
177
|
+
# A request object representing the call parameters. Required. To specify no
|
178
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
179
|
+
# @param options [Gapic::CallOptions, Hash]
|
180
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
181
|
+
#
|
182
|
+
# @overload compute_threat_list_diff(threat_type: nil, version_token: nil, constraints: nil)
|
183
|
+
# Pass arguments to `compute_threat_list_diff` via keyword arguments. Note that at
|
184
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
185
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
186
|
+
#
|
187
|
+
# @param threat_type [Google::Cloud::WebRisk::V1beta1::ThreatType]
|
188
|
+
# The ThreatList to update.
|
189
|
+
# @param version_token [String]
|
190
|
+
# The current version token of the client for the requested list (the
|
191
|
+
# client version that was received from the last successful diff).
|
192
|
+
# @param constraints [Google::Cloud::WebRisk::V1beta1::ComputeThreatListDiffRequest::Constraints, Hash]
|
193
|
+
# Required. The constraints associated with this request.
|
194
|
+
#
|
195
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
196
|
+
# @yieldparam response [Google::Cloud::WebRisk::V1beta1::ComputeThreatListDiffResponse]
|
197
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
198
|
+
#
|
199
|
+
# @return [Google::Cloud::WebRisk::V1beta1::ComputeThreatListDiffResponse]
|
200
|
+
#
|
201
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
202
|
+
#
|
203
|
+
def compute_threat_list_diff request, options = nil
|
204
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
205
|
+
|
206
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::WebRisk::V1beta1::ComputeThreatListDiffRequest
|
207
|
+
|
208
|
+
# Converts hash and nil to an options object
|
209
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
210
|
+
|
211
|
+
# Customize the options with defaults
|
212
|
+
metadata = @config.rpcs.compute_threat_list_diff.metadata.to_h
|
213
|
+
|
214
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
215
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
216
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
217
|
+
gapic_version: ::Google::Cloud::WebRisk::V1beta1::VERSION
|
218
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
219
|
+
|
220
|
+
options.apply_defaults timeout: @config.rpcs.compute_threat_list_diff.timeout,
|
221
|
+
metadata: metadata,
|
222
|
+
retry_policy: @config.rpcs.compute_threat_list_diff.retry_policy
|
223
|
+
options.apply_defaults metadata: @config.metadata,
|
224
|
+
retry_policy: @config.retry_policy
|
225
|
+
|
226
|
+
@web_risk_service_v1_beta1_stub.call_rpc :compute_threat_list_diff, request, options: options do |response, operation|
|
227
|
+
yield response, operation if block_given?
|
228
|
+
return response
|
229
|
+
end
|
230
|
+
rescue GRPC::BadStatus => e
|
231
|
+
raise Google::Cloud::Error.from_error(e)
|
232
|
+
end
|
233
|
+
|
234
|
+
##
|
235
|
+
# This method is used to check whether a URI is on a given threatList.
|
236
|
+
#
|
237
|
+
# @overload search_uris(request, options = nil)
|
238
|
+
# Pass arguments to `search_uris` via a request object, either of type
|
239
|
+
# {Google::Cloud::WebRisk::V1beta1::SearchUrisRequest} or an equivalent Hash.
|
240
|
+
#
|
241
|
+
# @param request [Google::Cloud::WebRisk::V1beta1::SearchUrisRequest, Hash]
|
242
|
+
# A request object representing the call parameters. Required. To specify no
|
243
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
244
|
+
# @param options [Gapic::CallOptions, Hash]
|
245
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
246
|
+
#
|
247
|
+
# @overload search_uris(uri: nil, threat_types: nil)
|
248
|
+
# Pass arguments to `search_uris` via keyword arguments. Note that at
|
249
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
250
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
251
|
+
#
|
252
|
+
# @param uri [String]
|
253
|
+
# Required. The URI to be checked for matches.
|
254
|
+
# @param threat_types [Array<Google::Cloud::WebRisk::V1beta1::ThreatType>]
|
255
|
+
# Required. The ThreatLists to search in.
|
256
|
+
#
|
257
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
258
|
+
# @yieldparam response [Google::Cloud::WebRisk::V1beta1::SearchUrisResponse]
|
259
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
260
|
+
#
|
261
|
+
# @return [Google::Cloud::WebRisk::V1beta1::SearchUrisResponse]
|
262
|
+
#
|
263
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
264
|
+
#
|
265
|
+
def search_uris request, options = nil
|
266
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
267
|
+
|
268
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::WebRisk::V1beta1::SearchUrisRequest
|
269
|
+
|
270
|
+
# Converts hash and nil to an options object
|
271
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
272
|
+
|
273
|
+
# Customize the options with defaults
|
274
|
+
metadata = @config.rpcs.search_uris.metadata.to_h
|
275
|
+
|
276
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
277
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
278
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
279
|
+
gapic_version: ::Google::Cloud::WebRisk::V1beta1::VERSION
|
280
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
281
|
+
|
282
|
+
options.apply_defaults timeout: @config.rpcs.search_uris.timeout,
|
283
|
+
metadata: metadata,
|
284
|
+
retry_policy: @config.rpcs.search_uris.retry_policy
|
285
|
+
options.apply_defaults metadata: @config.metadata,
|
286
|
+
retry_policy: @config.retry_policy
|
287
|
+
|
288
|
+
@web_risk_service_v1_beta1_stub.call_rpc :search_uris, request, options: options do |response, operation|
|
289
|
+
yield response, operation if block_given?
|
290
|
+
return response
|
291
|
+
end
|
292
|
+
rescue GRPC::BadStatus => e
|
293
|
+
raise Google::Cloud::Error.from_error(e)
|
294
|
+
end
|
295
|
+
|
296
|
+
##
|
297
|
+
# Gets the full hashes that match the requested hash prefix.
|
298
|
+
# This is used after a hash prefix is looked up in a threatList
|
299
|
+
# and there is a match. The client side threatList only holds partial hashes
|
300
|
+
# so the client must query this method to determine if there is a full
|
301
|
+
# hash match of a threat.
|
302
|
+
#
|
303
|
+
# @overload search_hashes(request, options = nil)
|
304
|
+
# Pass arguments to `search_hashes` via a request object, either of type
|
305
|
+
# {Google::Cloud::WebRisk::V1beta1::SearchHashesRequest} or an equivalent Hash.
|
306
|
+
#
|
307
|
+
# @param request [Google::Cloud::WebRisk::V1beta1::SearchHashesRequest, Hash]
|
308
|
+
# A request object representing the call parameters. Required. To specify no
|
309
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
310
|
+
# @param options [Gapic::CallOptions, Hash]
|
311
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
312
|
+
#
|
313
|
+
# @overload search_hashes(hash_prefix: nil, threat_types: nil)
|
314
|
+
# Pass arguments to `search_hashes` via keyword arguments. Note that at
|
315
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
316
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
317
|
+
#
|
318
|
+
# @param hash_prefix [String]
|
319
|
+
# A hash prefix, consisting of the most significant 4-32 bytes of a SHA256
|
320
|
+
# hash. For JSON requests, this field is base64-encoded.
|
321
|
+
# @param threat_types [Array<Google::Cloud::WebRisk::V1beta1::ThreatType>]
|
322
|
+
# Required. The ThreatLists to search in.
|
323
|
+
#
|
324
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
325
|
+
# @yieldparam response [Google::Cloud::WebRisk::V1beta1::SearchHashesResponse]
|
326
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
327
|
+
#
|
328
|
+
# @return [Google::Cloud::WebRisk::V1beta1::SearchHashesResponse]
|
329
|
+
#
|
330
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
331
|
+
#
|
332
|
+
def search_hashes request, options = nil
|
333
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
334
|
+
|
335
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::WebRisk::V1beta1::SearchHashesRequest
|
336
|
+
|
337
|
+
# Converts hash and nil to an options object
|
338
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
339
|
+
|
340
|
+
# Customize the options with defaults
|
341
|
+
metadata = @config.rpcs.search_hashes.metadata.to_h
|
342
|
+
|
343
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
344
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
345
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
346
|
+
gapic_version: ::Google::Cloud::WebRisk::V1beta1::VERSION
|
347
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
348
|
+
|
349
|
+
options.apply_defaults timeout: @config.rpcs.search_hashes.timeout,
|
350
|
+
metadata: metadata,
|
351
|
+
retry_policy: @config.rpcs.search_hashes.retry_policy
|
352
|
+
options.apply_defaults metadata: @config.metadata,
|
353
|
+
retry_policy: @config.retry_policy
|
354
|
+
|
355
|
+
@web_risk_service_v1_beta1_stub.call_rpc :search_hashes, request, options: options do |response, operation|
|
356
|
+
yield response, operation if block_given?
|
357
|
+
return response
|
358
|
+
end
|
359
|
+
rescue GRPC::BadStatus => e
|
360
|
+
raise Google::Cloud::Error.from_error(e)
|
361
|
+
end
|
362
|
+
|
363
|
+
##
|
364
|
+
# Configuration class for the WebRiskServiceV1Beta1 API.
|
365
|
+
#
|
366
|
+
# This class represents the configuration for WebRiskServiceV1Beta1,
|
367
|
+
# providing control over timeouts, retry behavior, logging, transport
|
368
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
369
|
+
# applied individually to specific RPCs. See
|
370
|
+
# {Google::Cloud::WebRisk::V1beta1::WebRiskService::Client::Configuration::Rpcs}
|
371
|
+
# for a list of RPCs that can be configured independently.
|
372
|
+
#
|
373
|
+
# Configuration can be applied globally to all clients, or to a single client
|
374
|
+
# on construction.
|
375
|
+
#
|
376
|
+
# # Examples
|
377
|
+
#
|
378
|
+
# To modify the global config, setting the timeout for compute_threat_list_diff
|
379
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
380
|
+
#
|
381
|
+
# Google::Cloud::WebRisk::V1beta1::WebRiskService::Client.configure do |config|
|
382
|
+
# config.timeout = 10_000
|
383
|
+
# config.rpcs.compute_threat_list_diff.timeout = 20_000
|
384
|
+
# end
|
385
|
+
#
|
386
|
+
# To apply the above configuration only to a new client:
|
387
|
+
#
|
388
|
+
# client = Google::Cloud::WebRisk::V1beta1::WebRiskService::Client.new do |config|
|
389
|
+
# config.timeout = 10_000
|
390
|
+
# config.rpcs.compute_threat_list_diff.timeout = 20_000
|
391
|
+
# end
|
392
|
+
#
|
393
|
+
# @!attribute [rw] endpoint
|
394
|
+
# The hostname or hostname:port of the service endpoint.
|
395
|
+
# Defaults to `"webrisk.googleapis.com"`.
|
396
|
+
# @return [String]
|
397
|
+
# @!attribute [rw] credentials
|
398
|
+
# Credentials to send with calls. You may provide any of the following types:
|
399
|
+
# * (`String`) The path to a service account key file in JSON format
|
400
|
+
# * (`Hash`) A service account key as a Hash
|
401
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
402
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
403
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
404
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
405
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
406
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
407
|
+
# * (`nil`) indicating no credentials
|
408
|
+
# @return [Object]
|
409
|
+
# @!attribute [rw] scope
|
410
|
+
# The OAuth scopes
|
411
|
+
# @return [Array<String>]
|
412
|
+
# @!attribute [rw] lib_name
|
413
|
+
# The library name as recorded in instrumentation and logging
|
414
|
+
# @return [String]
|
415
|
+
# @!attribute [rw] lib_version
|
416
|
+
# The library version as recorded in instrumentation and logging
|
417
|
+
# @return [String]
|
418
|
+
# @!attribute [rw] channel_args
|
419
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
420
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
421
|
+
# @return [Hash]
|
422
|
+
# @!attribute [rw] interceptors
|
423
|
+
# An array of interceptors that are run before calls are executed.
|
424
|
+
# @return [Array<GRPC::ClientInterceptor>]
|
425
|
+
# @!attribute [rw] timeout
|
426
|
+
# The call timeout in milliseconds.
|
427
|
+
# @return [Numeric]
|
428
|
+
# @!attribute [rw] metadata
|
429
|
+
# Additional gRPC headers to be sent with the call.
|
430
|
+
# @return [Hash{Symbol=>String}]
|
431
|
+
# @!attribute [rw] retry_policy
|
432
|
+
# The retry policy. The value is a hash with the following keys:
|
433
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
434
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
435
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
436
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
437
|
+
# trigger a retry.
|
438
|
+
# @return [Hash]
|
439
|
+
#
|
440
|
+
class Configuration
|
441
|
+
extend Gapic::Config
|
442
|
+
|
443
|
+
config_attr :endpoint, "webrisk.googleapis.com", String
|
444
|
+
config_attr :credentials, nil do |value|
|
445
|
+
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
446
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
447
|
+
allowed.any? { |klass| klass === value }
|
448
|
+
end
|
449
|
+
config_attr :scope, nil, String, Array, nil
|
450
|
+
config_attr :lib_name, nil, String, nil
|
451
|
+
config_attr :lib_version, nil, String, nil
|
452
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, Hash, nil)
|
453
|
+
config_attr :interceptors, nil, Array, nil
|
454
|
+
config_attr :timeout, nil, Numeric, nil
|
455
|
+
config_attr :metadata, nil, Hash, nil
|
456
|
+
config_attr :retry_policy, nil, Hash, Proc, nil
|
457
|
+
|
458
|
+
# @private
|
459
|
+
def initialize parent_config = nil
|
460
|
+
@parent_config = parent_config unless parent_config.nil?
|
461
|
+
|
462
|
+
yield self if block_given?
|
463
|
+
end
|
464
|
+
|
465
|
+
##
|
466
|
+
# Configurations for individual RPCs
|
467
|
+
# @return [Rpcs]
|
468
|
+
#
|
469
|
+
def rpcs
|
470
|
+
@rpcs ||= begin
|
471
|
+
parent_rpcs = nil
|
472
|
+
parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
|
473
|
+
Rpcs.new parent_rpcs
|
474
|
+
end
|
475
|
+
end
|
476
|
+
|
477
|
+
##
|
478
|
+
# Configuration RPC class for the WebRiskServiceV1Beta1 API.
|
479
|
+
#
|
480
|
+
# Includes fields providing the configuration for each RPC in this service.
|
481
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
482
|
+
# the following configuration fields:
|
483
|
+
#
|
484
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
485
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
486
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
487
|
+
# include the following keys:
|
488
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
489
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
490
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
491
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
492
|
+
# trigger a retry.
|
493
|
+
#
|
494
|
+
class Rpcs
|
495
|
+
##
|
496
|
+
# RPC-specific configuration for `compute_threat_list_diff`
|
497
|
+
# @return [Gapic::Config::Method]
|
498
|
+
#
|
499
|
+
attr_reader :compute_threat_list_diff
|
500
|
+
##
|
501
|
+
# RPC-specific configuration for `search_uris`
|
502
|
+
# @return [Gapic::Config::Method]
|
503
|
+
#
|
504
|
+
attr_reader :search_uris
|
505
|
+
##
|
506
|
+
# RPC-specific configuration for `search_hashes`
|
507
|
+
# @return [Gapic::Config::Method]
|
508
|
+
#
|
509
|
+
attr_reader :search_hashes
|
510
|
+
|
511
|
+
# @private
|
512
|
+
def initialize parent_rpcs = nil
|
513
|
+
compute_threat_list_diff_config = parent_rpcs&.compute_threat_list_diff if parent_rpcs&.respond_to? :compute_threat_list_diff
|
514
|
+
@compute_threat_list_diff = Gapic::Config::Method.new compute_threat_list_diff_config
|
515
|
+
search_uris_config = parent_rpcs&.search_uris if parent_rpcs&.respond_to? :search_uris
|
516
|
+
@search_uris = Gapic::Config::Method.new search_uris_config
|
517
|
+
search_hashes_config = parent_rpcs&.search_hashes if parent_rpcs&.respond_to? :search_hashes
|
518
|
+
@search_hashes = Gapic::Config::Method.new search_hashes_config
|
519
|
+
|
520
|
+
yield self if block_given?
|
521
|
+
end
|
522
|
+
end
|
523
|
+
end
|
524
|
+
end
|
525
|
+
end
|
526
|
+
end
|
527
|
+
end
|
528
|
+
end
|
529
|
+
end
|