google-cloud-web_risk-v1 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,608 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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/v1/webrisk_pb"
21
+ require "google/cloud/web_risk/v1/web_risk_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module WebRisk
26
+ module V1
27
+ module WebRiskService
28
+ module Rest
29
+ ##
30
+ # REST client for the WebRiskService service.
31
+ #
32
+ # Web Risk API defines an interface to detect malicious URLs on your
33
+ # website and in client applications.
34
+ #
35
+ class Client
36
+ include Paths
37
+
38
+ # @private
39
+ attr_reader :web_risk_service_stub
40
+
41
+ ##
42
+ # Configure the WebRiskService Client class.
43
+ #
44
+ # See {::Google::Cloud::WebRisk::V1::WebRiskService::Rest::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # @example
48
+ #
49
+ # # Modify the configuration for all WebRiskService clients
50
+ # ::Google::Cloud::WebRisk::V1::WebRiskService::Rest::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
53
+ #
54
+ # @yield [config] Configure the Client client.
55
+ # @yieldparam config [Client::Configuration]
56
+ #
57
+ # @return [Client::Configuration]
58
+ #
59
+ def self.configure
60
+ @configure ||= begin
61
+ namespace = ["Google", "Cloud", "WebRisk", "V1"]
62
+ parent_config = while namespace.any?
63
+ parent_name = namespace.join "::"
64
+ parent_const = const_get parent_name
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
+ namespace.pop
67
+ end
68
+ default_config = Client::Configuration.new parent_config
69
+
70
+ default_config.rpcs.compute_threat_list_diff.timeout = 600.0
71
+ default_config.rpcs.compute_threat_list_diff.retry_policy = {
72
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
73
+ }
74
+
75
+ default_config.rpcs.search_uris.timeout = 600.0
76
+ default_config.rpcs.search_uris.retry_policy = {
77
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
78
+ }
79
+
80
+ default_config.rpcs.search_hashes.timeout = 600.0
81
+ default_config.rpcs.search_hashes.retry_policy = {
82
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
83
+ }
84
+
85
+ default_config.rpcs.create_submission.timeout = 600.0
86
+
87
+ default_config
88
+ end
89
+ yield @configure if block_given?
90
+ @configure
91
+ end
92
+
93
+ ##
94
+ # Configure the WebRiskService Client instance.
95
+ #
96
+ # The configuration is set to the derived mode, meaning that values can be changed,
97
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
98
+ # should be made on {Client.configure}.
99
+ #
100
+ # See {::Google::Cloud::WebRisk::V1::WebRiskService::Rest::Client::Configuration}
101
+ # for a description of the configuration fields.
102
+ #
103
+ # @yield [config] Configure the Client client.
104
+ # @yieldparam config [Client::Configuration]
105
+ #
106
+ # @return [Client::Configuration]
107
+ #
108
+ def configure
109
+ yield @config if block_given?
110
+ @config
111
+ end
112
+
113
+ ##
114
+ # Create a new WebRiskService REST client object.
115
+ #
116
+ # @example
117
+ #
118
+ # # Create a client using the default configuration
119
+ # client = ::Google::Cloud::WebRisk::V1::WebRiskService::Rest::Client.new
120
+ #
121
+ # # Create a client using a custom configuration
122
+ # client = ::Google::Cloud::WebRisk::V1::WebRiskService::Rest::Client.new do |config|
123
+ # config.timeout = 10.0
124
+ # end
125
+ #
126
+ # @yield [config] Configure the WebRiskService client.
127
+ # @yieldparam config [Client::Configuration]
128
+ #
129
+ def initialize
130
+ # Create the configuration object
131
+ @config = Configuration.new Client.configure
132
+
133
+ # Yield the configuration if needed
134
+ yield @config if block_given?
135
+
136
+ # Create credentials
137
+ credentials = @config.credentials
138
+ # Use self-signed JWT if the endpoint is unchanged from default,
139
+ # but only if the default endpoint does not have a region prefix.
140
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
141
+ !@config.endpoint.split(".").first.include?("-")
142
+ credentials ||= Credentials.default scope: @config.scope,
143
+ enable_self_signed_jwt: enable_self_signed_jwt
144
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
145
+ credentials = Credentials.new credentials, scope: @config.scope
146
+ end
147
+
148
+ @quota_project_id = @config.quota_project
149
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
150
+
151
+ @web_risk_service_stub = ::Google::Cloud::WebRisk::V1::WebRiskService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
152
+ end
153
+
154
+ # Service calls
155
+
156
+ ##
157
+ # Gets the most recent threat list diffs. These diffs should be applied to
158
+ # a local database of hashes to keep it up-to-date. If the local database is
159
+ # empty or excessively out-of-date, a complete snapshot of the database will
160
+ # be returned. This Method only updates a single ThreatList at a time. To
161
+ # update multiple ThreatList databases, this method needs to be called once
162
+ # for each list.
163
+ #
164
+ # @overload compute_threat_list_diff(request, options = nil)
165
+ # Pass arguments to `compute_threat_list_diff` via a request object, either of type
166
+ # {::Google::Cloud::WebRisk::V1::ComputeThreatListDiffRequest} or an equivalent Hash.
167
+ #
168
+ # @param request [::Google::Cloud::WebRisk::V1::ComputeThreatListDiffRequest, ::Hash]
169
+ # A request object representing the call parameters. Required. To specify no
170
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
171
+ # @param options [::Gapic::CallOptions, ::Hash]
172
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
173
+ #
174
+ # @overload compute_threat_list_diff(threat_type: nil, version_token: nil, constraints: nil)
175
+ # Pass arguments to `compute_threat_list_diff` via keyword arguments. Note that at
176
+ # least one keyword argument is required. To specify no parameters, or to keep all
177
+ # the default parameter values, pass an empty Hash as a request object (see above).
178
+ #
179
+ # @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.
183
+ # @param version_token [::String]
184
+ # The current version token of the client for the requested list (the
185
+ # client version that was received from the last successful diff).
186
+ # If the client does not have a version token (this is the first time calling
187
+ # ComputeThreatListDiff), this may be left empty and a full database
188
+ # snapshot will be returned.
189
+ # @param constraints [::Google::Cloud::WebRisk::V1::ComputeThreatListDiffRequest::Constraints, ::Hash]
190
+ # Required. The constraints associated with this request.
191
+ # @yield [result, operation] Access the result along with the TransportOperation object
192
+ # @yieldparam result [::Google::Cloud::WebRisk::V1::ComputeThreatListDiffResponse]
193
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
194
+ #
195
+ # @return [::Google::Cloud::WebRisk::V1::ComputeThreatListDiffResponse]
196
+ #
197
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
198
+ def compute_threat_list_diff request, options = nil
199
+ raise ::ArgumentError, "request must be provided" if request.nil?
200
+
201
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebRisk::V1::ComputeThreatListDiffRequest
202
+
203
+ # Converts hash and nil to an options object
204
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
205
+
206
+ # Customize the options with defaults
207
+ call_metadata = @config.rpcs.compute_threat_list_diff.metadata.to_h
208
+
209
+ # Set x-goog-api-client and x-goog-user-project headers
210
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
211
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
212
+ gapic_version: ::Google::Cloud::WebRisk::V1::VERSION,
213
+ transports_version_send: [:rest]
214
+
215
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
216
+
217
+ options.apply_defaults timeout: @config.rpcs.compute_threat_list_diff.timeout,
218
+ metadata: call_metadata,
219
+ retry_policy: @config.rpcs.compute_threat_list_diff.retry_policy
220
+
221
+ options.apply_defaults timeout: @config.timeout,
222
+ metadata: @config.metadata,
223
+ retry_policy: @config.retry_policy
224
+
225
+ @web_risk_service_stub.compute_threat_list_diff request, options do |result, operation|
226
+ yield result, operation if block_given?
227
+ return result
228
+ end
229
+ rescue ::Gapic::Rest::Error => e
230
+ raise ::Google::Cloud::Error.from_error(e)
231
+ end
232
+
233
+ ##
234
+ # This method is used to check whether a URI is on a given threatList.
235
+ # Multiple threatLists may be searched in a single query.
236
+ # The response will list all requested threatLists the URI was found to
237
+ # match. If the URI is not found on any of the requested ThreatList an
238
+ # empty response will be returned.
239
+ #
240
+ # @overload search_uris(request, options = nil)
241
+ # Pass arguments to `search_uris` via a request object, either of type
242
+ # {::Google::Cloud::WebRisk::V1::SearchUrisRequest} or an equivalent Hash.
243
+ #
244
+ # @param request [::Google::Cloud::WebRisk::V1::SearchUrisRequest, ::Hash]
245
+ # A request object representing the call parameters. Required. To specify no
246
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
247
+ # @param options [::Gapic::CallOptions, ::Hash]
248
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
249
+ #
250
+ # @overload search_uris(uri: nil, threat_types: nil)
251
+ # Pass arguments to `search_uris` via keyword arguments. Note that at
252
+ # least one keyword argument is required. To specify no parameters, or to keep all
253
+ # the default parameter values, pass an empty Hash as a request object (see above).
254
+ #
255
+ # @param uri [::String]
256
+ # Required. The URI to be checked for matches.
257
+ # @param threat_types [::Array<::Google::Cloud::WebRisk::V1::ThreatType>]
258
+ # Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
259
+ # @yield [result, operation] Access the result along with the TransportOperation object
260
+ # @yieldparam result [::Google::Cloud::WebRisk::V1::SearchUrisResponse]
261
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
262
+ #
263
+ # @return [::Google::Cloud::WebRisk::V1::SearchUrisResponse]
264
+ #
265
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
266
+ def search_uris request, options = nil
267
+ raise ::ArgumentError, "request must be provided" if request.nil?
268
+
269
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebRisk::V1::SearchUrisRequest
270
+
271
+ # Converts hash and nil to an options object
272
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
273
+
274
+ # Customize the options with defaults
275
+ call_metadata = @config.rpcs.search_uris.metadata.to_h
276
+
277
+ # Set x-goog-api-client and x-goog-user-project headers
278
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
279
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
280
+ gapic_version: ::Google::Cloud::WebRisk::V1::VERSION,
281
+ transports_version_send: [:rest]
282
+
283
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
284
+
285
+ options.apply_defaults timeout: @config.rpcs.search_uris.timeout,
286
+ metadata: call_metadata,
287
+ retry_policy: @config.rpcs.search_uris.retry_policy
288
+
289
+ options.apply_defaults timeout: @config.timeout,
290
+ metadata: @config.metadata,
291
+ retry_policy: @config.retry_policy
292
+
293
+ @web_risk_service_stub.search_uris request, options do |result, operation|
294
+ yield result, operation if block_given?
295
+ return result
296
+ end
297
+ rescue ::Gapic::Rest::Error => e
298
+ raise ::Google::Cloud::Error.from_error(e)
299
+ end
300
+
301
+ ##
302
+ # Gets the full hashes that match the requested hash prefix.
303
+ # This is used after a hash prefix is looked up in a threatList
304
+ # and there is a match. The client side threatList only holds partial hashes
305
+ # so the client must query this method to determine if there is a full
306
+ # hash match of a threat.
307
+ #
308
+ # @overload search_hashes(request, options = nil)
309
+ # Pass arguments to `search_hashes` via a request object, either of type
310
+ # {::Google::Cloud::WebRisk::V1::SearchHashesRequest} or an equivalent Hash.
311
+ #
312
+ # @param request [::Google::Cloud::WebRisk::V1::SearchHashesRequest, ::Hash]
313
+ # A request object representing the call parameters. Required. To specify no
314
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
315
+ # @param options [::Gapic::CallOptions, ::Hash]
316
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
317
+ #
318
+ # @overload search_hashes(hash_prefix: nil, threat_types: nil)
319
+ # Pass arguments to `search_hashes` via keyword arguments. Note that at
320
+ # least one keyword argument is required. To specify no parameters, or to keep all
321
+ # the default parameter values, pass an empty Hash as a request object (see above).
322
+ #
323
+ # @param hash_prefix [::String]
324
+ # A hash prefix, consisting of the most significant 4-32 bytes of a SHA256
325
+ # hash. For JSON requests, this field is base64-encoded.
326
+ # Note that if this parameter is provided by a URI, it must be encoded using
327
+ # the web safe base64 variant (RFC 4648).
328
+ # @param threat_types [::Array<::Google::Cloud::WebRisk::V1::ThreatType>]
329
+ # Required. The ThreatLists to search in. Multiple ThreatLists may be specified.
330
+ # @yield [result, operation] Access the result along with the TransportOperation object
331
+ # @yieldparam result [::Google::Cloud::WebRisk::V1::SearchHashesResponse]
332
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
333
+ #
334
+ # @return [::Google::Cloud::WebRisk::V1::SearchHashesResponse]
335
+ #
336
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
337
+ def search_hashes request, options = nil
338
+ raise ::ArgumentError, "request must be provided" if request.nil?
339
+
340
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebRisk::V1::SearchHashesRequest
341
+
342
+ # Converts hash and nil to an options object
343
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
344
+
345
+ # Customize the options with defaults
346
+ call_metadata = @config.rpcs.search_hashes.metadata.to_h
347
+
348
+ # Set x-goog-api-client and x-goog-user-project headers
349
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
350
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
351
+ gapic_version: ::Google::Cloud::WebRisk::V1::VERSION,
352
+ transports_version_send: [:rest]
353
+
354
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
355
+
356
+ options.apply_defaults timeout: @config.rpcs.search_hashes.timeout,
357
+ metadata: call_metadata,
358
+ retry_policy: @config.rpcs.search_hashes.retry_policy
359
+
360
+ options.apply_defaults timeout: @config.timeout,
361
+ metadata: @config.metadata,
362
+ retry_policy: @config.retry_policy
363
+
364
+ @web_risk_service_stub.search_hashes request, options do |result, operation|
365
+ yield result, operation if block_given?
366
+ return result
367
+ end
368
+ rescue ::Gapic::Rest::Error => e
369
+ raise ::Google::Cloud::Error.from_error(e)
370
+ end
371
+
372
+ ##
373
+ # Creates a Submission of a URI suspected of containing phishing content to
374
+ # be reviewed. If the result verifies the existence of malicious phishing
375
+ # content, the site will be added to the [Google's Social Engineering
376
+ # lists](https://support.google.com/webmasters/answer/6350487/) in order to
377
+ # protect users that could get exposed to this threat in the future. Only
378
+ # allowlisted projects can use this method during Early Access. Please reach
379
+ # out to Sales or your customer engineer to obtain access.
380
+ #
381
+ # @overload create_submission(request, options = nil)
382
+ # Pass arguments to `create_submission` via a request object, either of type
383
+ # {::Google::Cloud::WebRisk::V1::CreateSubmissionRequest} or an equivalent Hash.
384
+ #
385
+ # @param request [::Google::Cloud::WebRisk::V1::CreateSubmissionRequest, ::Hash]
386
+ # A request object representing the call parameters. Required. To specify no
387
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
388
+ # @param options [::Gapic::CallOptions, ::Hash]
389
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
390
+ #
391
+ # @overload create_submission(parent: nil, submission: nil)
392
+ # Pass arguments to `create_submission` via keyword arguments. Note that at
393
+ # least one keyword argument is required. To specify no parameters, or to keep all
394
+ # the default parameter values, pass an empty Hash as a request object (see above).
395
+ #
396
+ # @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}".
399
+ # @param submission [::Google::Cloud::WebRisk::V1::Submission, ::Hash]
400
+ # Required. The submission that contains the content of the phishing report.
401
+ # @yield [result, operation] Access the result along with the TransportOperation object
402
+ # @yieldparam result [::Google::Cloud::WebRisk::V1::Submission]
403
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
404
+ #
405
+ # @return [::Google::Cloud::WebRisk::V1::Submission]
406
+ #
407
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
408
+ def create_submission request, options = nil
409
+ raise ::ArgumentError, "request must be provided" if request.nil?
410
+
411
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebRisk::V1::CreateSubmissionRequest
412
+
413
+ # Converts hash and nil to an options object
414
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
415
+
416
+ # Customize the options with defaults
417
+ call_metadata = @config.rpcs.create_submission.metadata.to_h
418
+
419
+ # Set x-goog-api-client and x-goog-user-project headers
420
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
421
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
422
+ gapic_version: ::Google::Cloud::WebRisk::V1::VERSION,
423
+ transports_version_send: [:rest]
424
+
425
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
426
+
427
+ options.apply_defaults timeout: @config.rpcs.create_submission.timeout,
428
+ metadata: call_metadata,
429
+ retry_policy: @config.rpcs.create_submission.retry_policy
430
+
431
+ options.apply_defaults timeout: @config.timeout,
432
+ metadata: @config.metadata,
433
+ retry_policy: @config.retry_policy
434
+
435
+ @web_risk_service_stub.create_submission request, options do |result, operation|
436
+ yield result, operation if block_given?
437
+ return result
438
+ end
439
+ rescue ::Gapic::Rest::Error => e
440
+ raise ::Google::Cloud::Error.from_error(e)
441
+ end
442
+
443
+ ##
444
+ # Configuration class for the WebRiskService REST API.
445
+ #
446
+ # This class represents the configuration for WebRiskService REST,
447
+ # providing control over timeouts, retry behavior, logging, transport
448
+ # parameters, and other low-level controls. Certain parameters can also be
449
+ # applied individually to specific RPCs. See
450
+ # {::Google::Cloud::WebRisk::V1::WebRiskService::Rest::Client::Configuration::Rpcs}
451
+ # for a list of RPCs that can be configured independently.
452
+ #
453
+ # Configuration can be applied globally to all clients, or to a single client
454
+ # on construction.
455
+ #
456
+ # @example
457
+ #
458
+ # # Modify the global config, setting the timeout for
459
+ # # compute_threat_list_diff to 20 seconds,
460
+ # # and all remaining timeouts to 10 seconds.
461
+ # ::Google::Cloud::WebRisk::V1::WebRiskService::Rest::Client.configure do |config|
462
+ # config.timeout = 10.0
463
+ # config.rpcs.compute_threat_list_diff.timeout = 20.0
464
+ # end
465
+ #
466
+ # # Apply the above configuration only to a new client.
467
+ # client = ::Google::Cloud::WebRisk::V1::WebRiskService::Rest::Client.new do |config|
468
+ # config.timeout = 10.0
469
+ # config.rpcs.compute_threat_list_diff.timeout = 20.0
470
+ # end
471
+ #
472
+ # @!attribute [rw] endpoint
473
+ # The hostname or hostname:port of the service endpoint.
474
+ # Defaults to `"webrisk.googleapis.com"`.
475
+ # @return [::String]
476
+ # @!attribute [rw] credentials
477
+ # Credentials to send with calls. You may provide any of the following types:
478
+ # * (`String`) The path to a service account key file in JSON format
479
+ # * (`Hash`) A service account key as a Hash
480
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
481
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
482
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
483
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
484
+ # * (`nil`) indicating no credentials
485
+ # @return [::Object]
486
+ # @!attribute [rw] scope
487
+ # The OAuth scopes
488
+ # @return [::Array<::String>]
489
+ # @!attribute [rw] lib_name
490
+ # The library name as recorded in instrumentation and logging
491
+ # @return [::String]
492
+ # @!attribute [rw] lib_version
493
+ # The library version as recorded in instrumentation and logging
494
+ # @return [::String]
495
+ # @!attribute [rw] timeout
496
+ # The call timeout in seconds.
497
+ # @return [::Numeric]
498
+ # @!attribute [rw] metadata
499
+ # Additional headers to be sent with the call.
500
+ # @return [::Hash{::Symbol=>::String}]
501
+ # @!attribute [rw] retry_policy
502
+ # The retry policy. The value is a hash with the following keys:
503
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
504
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
505
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
506
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
507
+ # trigger a retry.
508
+ # @return [::Hash]
509
+ # @!attribute [rw] quota_project
510
+ # A separate project against which to charge quota.
511
+ # @return [::String]
512
+ #
513
+ class Configuration
514
+ extend ::Gapic::Config
515
+
516
+ config_attr :endpoint, "webrisk.googleapis.com", ::String
517
+ config_attr :credentials, nil do |value|
518
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
519
+ allowed.any? { |klass| klass === value }
520
+ end
521
+ config_attr :scope, nil, ::String, ::Array, nil
522
+ config_attr :lib_name, nil, ::String, nil
523
+ config_attr :lib_version, nil, ::String, nil
524
+ config_attr :timeout, nil, ::Numeric, nil
525
+ config_attr :metadata, nil, ::Hash, nil
526
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
527
+ config_attr :quota_project, nil, ::String, nil
528
+
529
+ # @private
530
+ def initialize parent_config = nil
531
+ @parent_config = parent_config unless parent_config.nil?
532
+
533
+ yield self if block_given?
534
+ end
535
+
536
+ ##
537
+ # Configurations for individual RPCs
538
+ # @return [Rpcs]
539
+ #
540
+ def rpcs
541
+ @rpcs ||= begin
542
+ parent_rpcs = nil
543
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
544
+ Rpcs.new parent_rpcs
545
+ end
546
+ end
547
+
548
+ ##
549
+ # Configuration RPC class for the WebRiskService API.
550
+ #
551
+ # Includes fields providing the configuration for each RPC in this service.
552
+ # Each configuration object is of type `Gapic::Config::Method` and includes
553
+ # the following configuration fields:
554
+ #
555
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
556
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
557
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
558
+ # include the following keys:
559
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
560
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
561
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
562
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
563
+ # trigger a retry.
564
+ #
565
+ class Rpcs
566
+ ##
567
+ # RPC-specific configuration for `compute_threat_list_diff`
568
+ # @return [::Gapic::Config::Method]
569
+ #
570
+ attr_reader :compute_threat_list_diff
571
+ ##
572
+ # RPC-specific configuration for `search_uris`
573
+ # @return [::Gapic::Config::Method]
574
+ #
575
+ attr_reader :search_uris
576
+ ##
577
+ # RPC-specific configuration for `search_hashes`
578
+ # @return [::Gapic::Config::Method]
579
+ #
580
+ attr_reader :search_hashes
581
+ ##
582
+ # RPC-specific configuration for `create_submission`
583
+ # @return [::Gapic::Config::Method]
584
+ #
585
+ attr_reader :create_submission
586
+
587
+ # @private
588
+ def initialize parent_rpcs = nil
589
+ compute_threat_list_diff_config = parent_rpcs.compute_threat_list_diff if parent_rpcs.respond_to? :compute_threat_list_diff
590
+ @compute_threat_list_diff = ::Gapic::Config::Method.new compute_threat_list_diff_config
591
+ search_uris_config = parent_rpcs.search_uris if parent_rpcs.respond_to? :search_uris
592
+ @search_uris = ::Gapic::Config::Method.new search_uris_config
593
+ search_hashes_config = parent_rpcs.search_hashes if parent_rpcs.respond_to? :search_hashes
594
+ @search_hashes = ::Gapic::Config::Method.new search_hashes_config
595
+ create_submission_config = parent_rpcs.create_submission if parent_rpcs.respond_to? :create_submission
596
+ @create_submission = ::Gapic::Config::Method.new create_submission_config
597
+
598
+ yield self if block_given?
599
+ end
600
+ end
601
+ end
602
+ end
603
+ end
604
+ end
605
+ end
606
+ end
607
+ end
608
+ end