google-cloud-web_risk-v1beta1 0.4.5 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 318d5e1dc45c3a08add742f6bc33c21dc2ea59f578555e6a14f730d3830c1211
4
- data.tar.gz: 0ef9c5edc34066259a40b67da1393810b070a48675b9e389efb26410e9eb06a3
3
+ metadata.gz: 6b06434cd947a44189834877bf309d87ae5d55c478df02244c61eca294d906af
4
+ data.tar.gz: 0dafb9346912e0ddc179baa907b0908306b0638042d245b3fd74e78585f518d4
5
5
  SHA512:
6
- metadata.gz: 408126ea1f5f3b4f70e45d1c0fd6b50b38a2a0d7d88e488a396c69e3a286aae42e67aa9d2b89e994605f75c4bb1cb77ebe9174252f47a6d76fe54034cca9faaa
7
- data.tar.gz: efe4dd26828909d59872755e74a444e855baf26a8378cffef6c12d20dd44812f1138853e2ceba36fc8278d7bf9d85a1fa66530711458f4ac8110173ed9e1a993
6
+ metadata.gz: 97d43df12435aed76a6a0dd5248eeb618bb40f7b83eb974829394fd522e6e7dacdeb5513fc47079c6cb517bd2e46b177ae3f86f64654da58c13489d4195fa7a6
7
+ data.tar.gz: 6701050c05e34504647cd6fc2ba90bddbc7b04ad5cdfafed97569d8d715f7ae19ab11c10444f8528f8216a165cba8d75ac763e79f22afbf5f9fef50dfd7b143c
data/AUTHENTICATION.md CHANGED
@@ -114,7 +114,7 @@ credentials are discovered.
114
114
  To configure your system for this, simply:
115
115
 
116
116
  1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
117
- 2. Authenticate using OAuth 2.0 `$ gcloud auth login`
117
+ 2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login`
118
118
  3. Write code as if already authenticated.
119
119
 
120
120
  **NOTE:** This is _not_ recommended for running in production. The Cloud SDK
data/README.md CHANGED
@@ -37,7 +37,7 @@ request = ::Google::Cloud::WebRisk::V1beta1::ComputeThreatListDiffRequest.new #
37
37
  response = client.compute_threat_list_diff request
38
38
  ```
39
39
 
40
- View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-web_risk-v1beta1/latest)
40
+ View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-web_risk-v1beta1/latest)
41
41
  for class and method documentation.
42
42
 
43
43
  See also the [Product Documentation](https://cloud.google.com/web-risk)
@@ -46,7 +46,7 @@ for general usage information.
46
46
  ## Enabling Logging
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
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
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
50
  or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/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.
@@ -69,16 +69,21 @@ module GRPC
69
69
  end
70
70
  ```
71
71
 
72
+
73
+ ## Google Cloud Samples
74
+
75
+ To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
76
+
72
77
  ## Supported Ruby Versions
73
78
 
74
- This library is supported on Ruby 2.5+.
79
+ This library is supported on Ruby 2.6+.
75
80
 
76
81
  Google provides official support for Ruby versions that are actively supported
77
82
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
78
- in security maintenance, and not end of life. Currently, this means Ruby 2.5
79
- and later. Older versions of Ruby _may_ still work, but are unsupported and not
80
- recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
81
- about the Ruby support schedule.
83
+ in security maintenance, and not end of life. Older versions of Ruby _may_
84
+ still work, but are unsupported and not recommended. See
85
+ https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby
86
+ support schedule.
82
87
 
83
88
  ## Which client should I use?
84
89
 
@@ -0,0 +1,37 @@
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/web_risk/v1beta1/web_risk_service/rest"
20
+ require "google/cloud/web_risk/v1beta1/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module WebRisk
25
+ ##
26
+ # To load just the REST part of this package, including all its services, and instantiate a REST client:
27
+ #
28
+ # @example
29
+ #
30
+ # require "google/cloud/web_risk/v1beta1/rest"
31
+ # client = ::Google::Cloud::WebRisk::V1beta1::WebRiskService::Rest::Client.new
32
+ #
33
+ module V1beta1
34
+ end
35
+ end
36
+ end
37
+ end
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module WebRisk
23
23
  module V1beta1
24
- VERSION = "0.4.5"
24
+ VERSION = "0.6.0"
25
25
  end
26
26
  end
27
27
  end
@@ -0,0 +1,510 @@
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/v1beta1/webrisk_pb"
21
+ require "google/cloud/web_risk/v1beta1/web_risk_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module WebRisk
26
+ module V1beta1
27
+ module WebRiskService
28
+ module Rest
29
+ ##
30
+ # REST client for the WebRiskService service.
31
+ #
32
+ # Web Risk v1beta1 API defines an interface to detect malicious URLs on your
33
+ # website and in client applications.
34
+ #
35
+ class Client
36
+ # @private
37
+ attr_reader :web_risk_service_stub
38
+
39
+ ##
40
+ # Configure the WebRiskService Client class.
41
+ #
42
+ # See {::Google::Cloud::WebRisk::V1beta1::WebRiskService::Rest::Client::Configuration}
43
+ # for a description of the configuration fields.
44
+ #
45
+ # @example
46
+ #
47
+ # # Modify the configuration for all WebRiskService clients
48
+ # ::Google::Cloud::WebRisk::V1beta1::WebRiskService::Rest::Client.configure do |config|
49
+ # config.timeout = 10.0
50
+ # end
51
+ #
52
+ # @yield [config] Configure the Client client.
53
+ # @yieldparam config [Client::Configuration]
54
+ #
55
+ # @return [Client::Configuration]
56
+ #
57
+ def self.configure
58
+ @configure ||= begin
59
+ namespace = ["Google", "Cloud", "WebRisk", "V1beta1"]
60
+ parent_config = while namespace.any?
61
+ parent_name = namespace.join "::"
62
+ parent_const = const_get parent_name
63
+ break parent_const.configure if parent_const.respond_to? :configure
64
+ namespace.pop
65
+ end
66
+ default_config = Client::Configuration.new parent_config
67
+
68
+ default_config.rpcs.compute_threat_list_diff.timeout = 600.0
69
+ default_config.rpcs.compute_threat_list_diff.retry_policy = {
70
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
71
+ }
72
+
73
+ default_config.rpcs.search_uris.timeout = 600.0
74
+ default_config.rpcs.search_uris.retry_policy = {
75
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
76
+ }
77
+
78
+ default_config.rpcs.search_hashes.timeout = 600.0
79
+ default_config.rpcs.search_hashes.retry_policy = {
80
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
81
+ }
82
+
83
+ default_config
84
+ end
85
+ yield @configure if block_given?
86
+ @configure
87
+ end
88
+
89
+ ##
90
+ # Configure the WebRiskService Client instance.
91
+ #
92
+ # The configuration is set to the derived mode, meaning that values can be changed,
93
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
94
+ # should be made on {Client.configure}.
95
+ #
96
+ # See {::Google::Cloud::WebRisk::V1beta1::WebRiskService::Rest::Client::Configuration}
97
+ # for a description of the configuration fields.
98
+ #
99
+ # @yield [config] Configure the Client client.
100
+ # @yieldparam config [Client::Configuration]
101
+ #
102
+ # @return [Client::Configuration]
103
+ #
104
+ def configure
105
+ yield @config if block_given?
106
+ @config
107
+ end
108
+
109
+ ##
110
+ # Create a new WebRiskService REST client object.
111
+ #
112
+ # @example
113
+ #
114
+ # # Create a client using the default configuration
115
+ # client = ::Google::Cloud::WebRisk::V1beta1::WebRiskService::Rest::Client.new
116
+ #
117
+ # # Create a client using a custom configuration
118
+ # client = ::Google::Cloud::WebRisk::V1beta1::WebRiskService::Rest::Client.new do |config|
119
+ # config.timeout = 10.0
120
+ # end
121
+ #
122
+ # @yield [config] Configure the WebRiskService client.
123
+ # @yieldparam config [Client::Configuration]
124
+ #
125
+ def initialize
126
+ # Create the configuration object
127
+ @config = Configuration.new Client.configure
128
+
129
+ # Yield the configuration if needed
130
+ yield @config if block_given?
131
+
132
+ # Create credentials
133
+ credentials = @config.credentials
134
+ # Use self-signed JWT if the endpoint is unchanged from default,
135
+ # but only if the default endpoint does not have a region prefix.
136
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
137
+ !@config.endpoint.split(".").first.include?("-")
138
+ credentials ||= Credentials.default scope: @config.scope,
139
+ enable_self_signed_jwt: enable_self_signed_jwt
140
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
141
+ credentials = Credentials.new credentials, scope: @config.scope
142
+ end
143
+
144
+ @quota_project_id = @config.quota_project
145
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
146
+
147
+ @web_risk_service_stub = ::Google::Cloud::WebRisk::V1beta1::WebRiskService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
148
+ end
149
+
150
+ # Service calls
151
+
152
+ ##
153
+ # Gets the most recent threat list diffs.
154
+ #
155
+ # @overload compute_threat_list_diff(request, options = nil)
156
+ # Pass arguments to `compute_threat_list_diff` via a request object, either of type
157
+ # {::Google::Cloud::WebRisk::V1beta1::ComputeThreatListDiffRequest} or an equivalent Hash.
158
+ #
159
+ # @param request [::Google::Cloud::WebRisk::V1beta1::ComputeThreatListDiffRequest, ::Hash]
160
+ # A request object representing the call parameters. Required. To specify no
161
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
162
+ # @param options [::Gapic::CallOptions, ::Hash]
163
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
164
+ #
165
+ # @overload compute_threat_list_diff(threat_type: nil, version_token: nil, constraints: nil)
166
+ # Pass arguments to `compute_threat_list_diff` via keyword arguments. Note that at
167
+ # least one keyword argument is required. To specify no parameters, or to keep all
168
+ # the default parameter values, pass an empty Hash as a request object (see above).
169
+ #
170
+ # @param threat_type [::Google::Cloud::WebRisk::V1beta1::ThreatType]
171
+ # The ThreatList to update.
172
+ # @param version_token [::String]
173
+ # The current version token of the client for the requested list (the
174
+ # client version that was received from the last successful diff).
175
+ # @param constraints [::Google::Cloud::WebRisk::V1beta1::ComputeThreatListDiffRequest::Constraints, ::Hash]
176
+ # Required. The constraints associated with this request.
177
+ # @yield [result, operation] Access the result along with the TransportOperation object
178
+ # @yieldparam result [::Google::Cloud::WebRisk::V1beta1::ComputeThreatListDiffResponse]
179
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
180
+ #
181
+ # @return [::Google::Cloud::WebRisk::V1beta1::ComputeThreatListDiffResponse]
182
+ #
183
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
184
+ def compute_threat_list_diff request, options = nil
185
+ raise ::ArgumentError, "request must be provided" if request.nil?
186
+
187
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebRisk::V1beta1::ComputeThreatListDiffRequest
188
+
189
+ # Converts hash and nil to an options object
190
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
191
+
192
+ # Customize the options with defaults
193
+ call_metadata = @config.rpcs.compute_threat_list_diff.metadata.to_h
194
+
195
+ # Set x-goog-api-client and x-goog-user-project headers
196
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
197
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
198
+ gapic_version: ::Google::Cloud::WebRisk::V1beta1::VERSION,
199
+ transports_version_send: [:rest]
200
+
201
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
202
+
203
+ options.apply_defaults timeout: @config.rpcs.compute_threat_list_diff.timeout,
204
+ metadata: call_metadata,
205
+ retry_policy: @config.rpcs.compute_threat_list_diff.retry_policy
206
+
207
+ options.apply_defaults timeout: @config.timeout,
208
+ metadata: @config.metadata,
209
+ retry_policy: @config.retry_policy
210
+
211
+ @web_risk_service_stub.compute_threat_list_diff request, options do |result, operation|
212
+ yield result, operation if block_given?
213
+ return result
214
+ end
215
+ rescue ::Gapic::Rest::Error => e
216
+ raise ::Google::Cloud::Error.from_error(e)
217
+ end
218
+
219
+ ##
220
+ # This method is used to check whether a URI is on a given threatList.
221
+ #
222
+ # @overload search_uris(request, options = nil)
223
+ # Pass arguments to `search_uris` via a request object, either of type
224
+ # {::Google::Cloud::WebRisk::V1beta1::SearchUrisRequest} or an equivalent Hash.
225
+ #
226
+ # @param request [::Google::Cloud::WebRisk::V1beta1::SearchUrisRequest, ::Hash]
227
+ # A request object representing the call parameters. Required. To specify no
228
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
229
+ # @param options [::Gapic::CallOptions, ::Hash]
230
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
231
+ #
232
+ # @overload search_uris(uri: nil, threat_types: nil)
233
+ # Pass arguments to `search_uris` via keyword arguments. Note that at
234
+ # least one keyword argument is required. To specify no parameters, or to keep all
235
+ # the default parameter values, pass an empty Hash as a request object (see above).
236
+ #
237
+ # @param uri [::String]
238
+ # Required. The URI to be checked for matches.
239
+ # @param threat_types [::Array<::Google::Cloud::WebRisk::V1beta1::ThreatType>]
240
+ # Required. The ThreatLists to search in.
241
+ # @yield [result, operation] Access the result along with the TransportOperation object
242
+ # @yieldparam result [::Google::Cloud::WebRisk::V1beta1::SearchUrisResponse]
243
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
244
+ #
245
+ # @return [::Google::Cloud::WebRisk::V1beta1::SearchUrisResponse]
246
+ #
247
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
248
+ def search_uris request, options = nil
249
+ raise ::ArgumentError, "request must be provided" if request.nil?
250
+
251
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebRisk::V1beta1::SearchUrisRequest
252
+
253
+ # Converts hash and nil to an options object
254
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
255
+
256
+ # Customize the options with defaults
257
+ call_metadata = @config.rpcs.search_uris.metadata.to_h
258
+
259
+ # Set x-goog-api-client and x-goog-user-project headers
260
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
261
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
262
+ gapic_version: ::Google::Cloud::WebRisk::V1beta1::VERSION,
263
+ transports_version_send: [:rest]
264
+
265
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
266
+
267
+ options.apply_defaults timeout: @config.rpcs.search_uris.timeout,
268
+ metadata: call_metadata,
269
+ retry_policy: @config.rpcs.search_uris.retry_policy
270
+
271
+ options.apply_defaults timeout: @config.timeout,
272
+ metadata: @config.metadata,
273
+ retry_policy: @config.retry_policy
274
+
275
+ @web_risk_service_stub.search_uris request, options do |result, operation|
276
+ yield result, operation if block_given?
277
+ return result
278
+ end
279
+ rescue ::Gapic::Rest::Error => e
280
+ raise ::Google::Cloud::Error.from_error(e)
281
+ end
282
+
283
+ ##
284
+ # Gets the full hashes that match the requested hash prefix.
285
+ # This is used after a hash prefix is looked up in a threatList
286
+ # and there is a match. The client side threatList only holds partial hashes
287
+ # so the client must query this method to determine if there is a full
288
+ # hash match of a threat.
289
+ #
290
+ # @overload search_hashes(request, options = nil)
291
+ # Pass arguments to `search_hashes` via a request object, either of type
292
+ # {::Google::Cloud::WebRisk::V1beta1::SearchHashesRequest} or an equivalent Hash.
293
+ #
294
+ # @param request [::Google::Cloud::WebRisk::V1beta1::SearchHashesRequest, ::Hash]
295
+ # A request object representing the call parameters. Required. To specify no
296
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
297
+ # @param options [::Gapic::CallOptions, ::Hash]
298
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
299
+ #
300
+ # @overload search_hashes(hash_prefix: nil, threat_types: nil)
301
+ # Pass arguments to `search_hashes` via keyword arguments. Note that at
302
+ # least one keyword argument is required. To specify no parameters, or to keep all
303
+ # the default parameter values, pass an empty Hash as a request object (see above).
304
+ #
305
+ # @param hash_prefix [::String]
306
+ # A hash prefix, consisting of the most significant 4-32 bytes of a SHA256
307
+ # hash. For JSON requests, this field is base64-encoded.
308
+ # @param threat_types [::Array<::Google::Cloud::WebRisk::V1beta1::ThreatType>]
309
+ # Required. The ThreatLists to search in.
310
+ # @yield [result, operation] Access the result along with the TransportOperation object
311
+ # @yieldparam result [::Google::Cloud::WebRisk::V1beta1::SearchHashesResponse]
312
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
313
+ #
314
+ # @return [::Google::Cloud::WebRisk::V1beta1::SearchHashesResponse]
315
+ #
316
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
317
+ def search_hashes request, options = nil
318
+ raise ::ArgumentError, "request must be provided" if request.nil?
319
+
320
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebRisk::V1beta1::SearchHashesRequest
321
+
322
+ # Converts hash and nil to an options object
323
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
324
+
325
+ # Customize the options with defaults
326
+ call_metadata = @config.rpcs.search_hashes.metadata.to_h
327
+
328
+ # Set x-goog-api-client and x-goog-user-project headers
329
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
330
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
331
+ gapic_version: ::Google::Cloud::WebRisk::V1beta1::VERSION,
332
+ transports_version_send: [:rest]
333
+
334
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
335
+
336
+ options.apply_defaults timeout: @config.rpcs.search_hashes.timeout,
337
+ metadata: call_metadata,
338
+ retry_policy: @config.rpcs.search_hashes.retry_policy
339
+
340
+ options.apply_defaults timeout: @config.timeout,
341
+ metadata: @config.metadata,
342
+ retry_policy: @config.retry_policy
343
+
344
+ @web_risk_service_stub.search_hashes request, options do |result, operation|
345
+ yield result, operation if block_given?
346
+ return result
347
+ end
348
+ rescue ::Gapic::Rest::Error => e
349
+ raise ::Google::Cloud::Error.from_error(e)
350
+ end
351
+
352
+ ##
353
+ # Configuration class for the WebRiskService REST API.
354
+ #
355
+ # This class represents the configuration for WebRiskService REST,
356
+ # providing control over timeouts, retry behavior, logging, transport
357
+ # parameters, and other low-level controls. Certain parameters can also be
358
+ # applied individually to specific RPCs. See
359
+ # {::Google::Cloud::WebRisk::V1beta1::WebRiskService::Rest::Client::Configuration::Rpcs}
360
+ # for a list of RPCs that can be configured independently.
361
+ #
362
+ # Configuration can be applied globally to all clients, or to a single client
363
+ # on construction.
364
+ #
365
+ # @example
366
+ #
367
+ # # Modify the global config, setting the timeout for
368
+ # # compute_threat_list_diff to 20 seconds,
369
+ # # and all remaining timeouts to 10 seconds.
370
+ # ::Google::Cloud::WebRisk::V1beta1::WebRiskService::Rest::Client.configure do |config|
371
+ # config.timeout = 10.0
372
+ # config.rpcs.compute_threat_list_diff.timeout = 20.0
373
+ # end
374
+ #
375
+ # # Apply the above configuration only to a new client.
376
+ # client = ::Google::Cloud::WebRisk::V1beta1::WebRiskService::Rest::Client.new do |config|
377
+ # config.timeout = 10.0
378
+ # config.rpcs.compute_threat_list_diff.timeout = 20.0
379
+ # end
380
+ #
381
+ # @!attribute [rw] endpoint
382
+ # The hostname or hostname:port of the service endpoint.
383
+ # Defaults to `"webrisk.googleapis.com"`.
384
+ # @return [::String]
385
+ # @!attribute [rw] credentials
386
+ # Credentials to send with calls. You may provide any of the following types:
387
+ # * (`String`) The path to a service account key file in JSON format
388
+ # * (`Hash`) A service account key as a Hash
389
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
390
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
391
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
392
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
393
+ # * (`nil`) indicating no credentials
394
+ # @return [::Object]
395
+ # @!attribute [rw] scope
396
+ # The OAuth scopes
397
+ # @return [::Array<::String>]
398
+ # @!attribute [rw] lib_name
399
+ # The library name as recorded in instrumentation and logging
400
+ # @return [::String]
401
+ # @!attribute [rw] lib_version
402
+ # The library version as recorded in instrumentation and logging
403
+ # @return [::String]
404
+ # @!attribute [rw] timeout
405
+ # The call timeout in seconds.
406
+ # @return [::Numeric]
407
+ # @!attribute [rw] metadata
408
+ # Additional headers to be sent with the call.
409
+ # @return [::Hash{::Symbol=>::String}]
410
+ # @!attribute [rw] retry_policy
411
+ # The retry policy. The value is a hash with the following keys:
412
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
413
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
414
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
415
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
416
+ # trigger a retry.
417
+ # @return [::Hash]
418
+ # @!attribute [rw] quota_project
419
+ # A separate project against which to charge quota.
420
+ # @return [::String]
421
+ #
422
+ class Configuration
423
+ extend ::Gapic::Config
424
+
425
+ config_attr :endpoint, "webrisk.googleapis.com", ::String
426
+ config_attr :credentials, nil do |value|
427
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
428
+ allowed.any? { |klass| klass === value }
429
+ end
430
+ config_attr :scope, nil, ::String, ::Array, nil
431
+ config_attr :lib_name, nil, ::String, nil
432
+ config_attr :lib_version, nil, ::String, nil
433
+ config_attr :timeout, nil, ::Numeric, nil
434
+ config_attr :metadata, nil, ::Hash, nil
435
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
436
+ config_attr :quota_project, nil, ::String, nil
437
+
438
+ # @private
439
+ def initialize parent_config = nil
440
+ @parent_config = parent_config unless parent_config.nil?
441
+
442
+ yield self if block_given?
443
+ end
444
+
445
+ ##
446
+ # Configurations for individual RPCs
447
+ # @return [Rpcs]
448
+ #
449
+ def rpcs
450
+ @rpcs ||= begin
451
+ parent_rpcs = nil
452
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
453
+ Rpcs.new parent_rpcs
454
+ end
455
+ end
456
+
457
+ ##
458
+ # Configuration RPC class for the WebRiskService API.
459
+ #
460
+ # Includes fields providing the configuration for each RPC in this service.
461
+ # Each configuration object is of type `Gapic::Config::Method` and includes
462
+ # the following configuration fields:
463
+ #
464
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
465
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
466
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
467
+ # include the following keys:
468
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
469
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
470
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
471
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
472
+ # trigger a retry.
473
+ #
474
+ class Rpcs
475
+ ##
476
+ # RPC-specific configuration for `compute_threat_list_diff`
477
+ # @return [::Gapic::Config::Method]
478
+ #
479
+ attr_reader :compute_threat_list_diff
480
+ ##
481
+ # RPC-specific configuration for `search_uris`
482
+ # @return [::Gapic::Config::Method]
483
+ #
484
+ attr_reader :search_uris
485
+ ##
486
+ # RPC-specific configuration for `search_hashes`
487
+ # @return [::Gapic::Config::Method]
488
+ #
489
+ attr_reader :search_hashes
490
+
491
+ # @private
492
+ def initialize parent_rpcs = nil
493
+ compute_threat_list_diff_config = parent_rpcs.compute_threat_list_diff if parent_rpcs.respond_to? :compute_threat_list_diff
494
+ @compute_threat_list_diff = ::Gapic::Config::Method.new compute_threat_list_diff_config
495
+ search_uris_config = parent_rpcs.search_uris if parent_rpcs.respond_to? :search_uris
496
+ @search_uris = ::Gapic::Config::Method.new search_uris_config
497
+ search_hashes_config = parent_rpcs.search_hashes if parent_rpcs.respond_to? :search_hashes
498
+ @search_hashes = ::Gapic::Config::Method.new search_hashes_config
499
+
500
+ yield self if block_given?
501
+ end
502
+ end
503
+ end
504
+ end
505
+ end
506
+ end
507
+ end
508
+ end
509
+ end
510
+ end