google-cloud-web_security_scanner-v1 0.5.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/lib/google/cloud/web_security_scanner/v1/rest.rb +37 -0
  4. data/lib/google/cloud/web_security_scanner/v1/version.rb +1 -1
  5. data/lib/google/cloud/web_security_scanner/v1/web_security_scanner/client.rb +18 -26
  6. data/lib/google/cloud/web_security_scanner/v1/web_security_scanner/rest/client.rb +1293 -0
  7. data/lib/google/cloud/web_security_scanner/v1/web_security_scanner/rest/service_stub.rb +819 -0
  8. data/lib/google/cloud/web_security_scanner/v1/web_security_scanner/rest.rb +53 -0
  9. data/lib/google/cloud/web_security_scanner/v1/web_security_scanner.rb +7 -1
  10. data/lib/google/cloud/web_security_scanner/v1.rb +7 -2
  11. data/lib/google/cloud/websecurityscanner/v1/crawled_url_pb.rb +24 -6
  12. data/lib/google/cloud/websecurityscanner/v1/finding_addon_pb.rb +24 -57
  13. data/lib/google/cloud/websecurityscanner/v1/finding_pb.rb +25 -28
  14. data/lib/google/cloud/websecurityscanner/v1/finding_type_stats_pb.rb +24 -5
  15. data/lib/google/cloud/websecurityscanner/v1/scan_config_error_pb.rb +24 -49
  16. data/lib/google/cloud/websecurityscanner/v1/scan_config_pb.rb +25 -60
  17. data/lib/google/cloud/websecurityscanner/v1/scan_run_error_trace_pb.rb +25 -15
  18. data/lib/google/cloud/websecurityscanner/v1/scan_run_log_pb.rb +25 -11
  19. data/lib/google/cloud/websecurityscanner/v1/scan_run_pb.rb +27 -26
  20. data/lib/google/cloud/websecurityscanner/v1/scan_run_warning_trace_pb.rb +24 -12
  21. data/lib/google/cloud/websecurityscanner/v1/web_security_scanner_pb.rb +30 -70
  22. data/proto_docs/google/api/client.rb +381 -0
  23. data/proto_docs/google/api/launch_stage.rb +71 -0
  24. data/proto_docs/google/protobuf/duration.rb +98 -0
  25. data/proto_docs/google/protobuf/timestamp.rb +1 -3
  26. metadata +15 -8
@@ -0,0 +1,1293 @@
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/websecurityscanner/v1/web_security_scanner_pb"
21
+ require "google/cloud/web_security_scanner/v1/web_security_scanner/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module WebSecurityScanner
26
+ module V1
27
+ module WebSecurityScanner
28
+ module Rest
29
+ ##
30
+ # REST client for the WebSecurityScanner service.
31
+ #
32
+ # Web Security Scanner Service identifies security vulnerabilities in web
33
+ # applications hosted on Google Cloud. It crawls your application, and
34
+ # attempts to exercise as many user inputs and event handlers as possible.
35
+ #
36
+ class Client
37
+ # @private
38
+ attr_reader :web_security_scanner_stub
39
+
40
+ ##
41
+ # Configure the WebSecurityScanner Client class.
42
+ #
43
+ # See {::Google::Cloud::WebSecurityScanner::V1::WebSecurityScanner::Rest::Client::Configuration}
44
+ # for a description of the configuration fields.
45
+ #
46
+ # @example
47
+ #
48
+ # # Modify the configuration for all WebSecurityScanner clients
49
+ # ::Google::Cloud::WebSecurityScanner::V1::WebSecurityScanner::Rest::Client.configure do |config|
50
+ # config.timeout = 10.0
51
+ # end
52
+ #
53
+ # @yield [config] Configure the Client client.
54
+ # @yieldparam config [Client::Configuration]
55
+ #
56
+ # @return [Client::Configuration]
57
+ #
58
+ def self.configure
59
+ @configure ||= begin
60
+ namespace = ["Google", "Cloud", "WebSecurityScanner", "V1"]
61
+ parent_config = while namespace.any?
62
+ parent_name = namespace.join "::"
63
+ parent_const = const_get parent_name
64
+ break parent_const.configure if parent_const.respond_to? :configure
65
+ namespace.pop
66
+ end
67
+ default_config = Client::Configuration.new parent_config
68
+
69
+ default_config.rpcs.create_scan_config.timeout = 600.0
70
+
71
+ default_config.rpcs.delete_scan_config.timeout = 600.0
72
+ default_config.rpcs.delete_scan_config.retry_policy = {
73
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
74
+ }
75
+
76
+ default_config.rpcs.get_scan_config.timeout = 600.0
77
+ default_config.rpcs.get_scan_config.retry_policy = {
78
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
79
+ }
80
+
81
+ default_config.rpcs.list_scan_configs.timeout = 600.0
82
+ default_config.rpcs.list_scan_configs.retry_policy = {
83
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
84
+ }
85
+
86
+ default_config.rpcs.update_scan_config.timeout = 600.0
87
+
88
+ default_config.rpcs.start_scan_run.timeout = 600.0
89
+
90
+ default_config.rpcs.get_scan_run.timeout = 600.0
91
+ default_config.rpcs.get_scan_run.retry_policy = {
92
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
93
+ }
94
+
95
+ default_config.rpcs.list_scan_runs.timeout = 600.0
96
+ default_config.rpcs.list_scan_runs.retry_policy = {
97
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
98
+ }
99
+
100
+ default_config.rpcs.stop_scan_run.timeout = 600.0
101
+
102
+ default_config.rpcs.list_crawled_urls.timeout = 600.0
103
+ default_config.rpcs.list_crawled_urls.retry_policy = {
104
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
105
+ }
106
+
107
+ default_config.rpcs.get_finding.timeout = 600.0
108
+ default_config.rpcs.get_finding.retry_policy = {
109
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
110
+ }
111
+
112
+ default_config.rpcs.list_findings.timeout = 600.0
113
+ default_config.rpcs.list_findings.retry_policy = {
114
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
115
+ }
116
+
117
+ default_config.rpcs.list_finding_type_stats.timeout = 600.0
118
+ default_config.rpcs.list_finding_type_stats.retry_policy = {
119
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
120
+ }
121
+
122
+ default_config
123
+ end
124
+ yield @configure if block_given?
125
+ @configure
126
+ end
127
+
128
+ ##
129
+ # Configure the WebSecurityScanner Client instance.
130
+ #
131
+ # The configuration is set to the derived mode, meaning that values can be changed,
132
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
133
+ # should be made on {Client.configure}.
134
+ #
135
+ # See {::Google::Cloud::WebSecurityScanner::V1::WebSecurityScanner::Rest::Client::Configuration}
136
+ # for a description of the configuration fields.
137
+ #
138
+ # @yield [config] Configure the Client client.
139
+ # @yieldparam config [Client::Configuration]
140
+ #
141
+ # @return [Client::Configuration]
142
+ #
143
+ def configure
144
+ yield @config if block_given?
145
+ @config
146
+ end
147
+
148
+ ##
149
+ # Create a new WebSecurityScanner REST client object.
150
+ #
151
+ # @example
152
+ #
153
+ # # Create a client using the default configuration
154
+ # client = ::Google::Cloud::WebSecurityScanner::V1::WebSecurityScanner::Rest::Client.new
155
+ #
156
+ # # Create a client using a custom configuration
157
+ # client = ::Google::Cloud::WebSecurityScanner::V1::WebSecurityScanner::Rest::Client.new do |config|
158
+ # config.timeout = 10.0
159
+ # end
160
+ #
161
+ # @yield [config] Configure the WebSecurityScanner client.
162
+ # @yieldparam config [Client::Configuration]
163
+ #
164
+ def initialize
165
+ # Create the configuration object
166
+ @config = Configuration.new Client.configure
167
+
168
+ # Yield the configuration if needed
169
+ yield @config if block_given?
170
+
171
+ # Create credentials
172
+ credentials = @config.credentials
173
+ # Use self-signed JWT if the endpoint is unchanged from default,
174
+ # but only if the default endpoint does not have a region prefix.
175
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
176
+ !@config.endpoint.split(".").first.include?("-")
177
+ credentials ||= Credentials.default scope: @config.scope,
178
+ enable_self_signed_jwt: enable_self_signed_jwt
179
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
180
+ credentials = Credentials.new credentials, scope: @config.scope
181
+ end
182
+
183
+ @quota_project_id = @config.quota_project
184
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
185
+
186
+ @web_security_scanner_stub = ::Google::Cloud::WebSecurityScanner::V1::WebSecurityScanner::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
187
+ end
188
+
189
+ # Service calls
190
+
191
+ ##
192
+ # Creates a new ScanConfig.
193
+ #
194
+ # @overload create_scan_config(request, options = nil)
195
+ # Pass arguments to `create_scan_config` via a request object, either of type
196
+ # {::Google::Cloud::WebSecurityScanner::V1::CreateScanConfigRequest} or an equivalent Hash.
197
+ #
198
+ # @param request [::Google::Cloud::WebSecurityScanner::V1::CreateScanConfigRequest, ::Hash]
199
+ # A request object representing the call parameters. Required. To specify no
200
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
201
+ # @param options [::Gapic::CallOptions, ::Hash]
202
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
203
+ #
204
+ # @overload create_scan_config(parent: nil, scan_config: nil)
205
+ # Pass arguments to `create_scan_config` via keyword arguments. Note that at
206
+ # least one keyword argument is required. To specify no parameters, or to keep all
207
+ # the default parameter values, pass an empty Hash as a request object (see above).
208
+ #
209
+ # @param parent [::String]
210
+ # Required. The parent resource name where the scan is created, which should be a
211
+ # project resource name in the format 'projects/\\{projectId}'.
212
+ # @param scan_config [::Google::Cloud::WebSecurityScanner::V1::ScanConfig, ::Hash]
213
+ # Required. The ScanConfig to be created.
214
+ # @yield [result, operation] Access the result along with the TransportOperation object
215
+ # @yieldparam result [::Google::Cloud::WebSecurityScanner::V1::ScanConfig]
216
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
217
+ #
218
+ # @return [::Google::Cloud::WebSecurityScanner::V1::ScanConfig]
219
+ #
220
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
221
+ def create_scan_config request, options = nil
222
+ raise ::ArgumentError, "request must be provided" if request.nil?
223
+
224
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1::CreateScanConfigRequest
225
+
226
+ # Converts hash and nil to an options object
227
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
228
+
229
+ # Customize the options with defaults
230
+ call_metadata = @config.rpcs.create_scan_config.metadata.to_h
231
+
232
+ # Set x-goog-api-client and x-goog-user-project headers
233
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
234
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
235
+ gapic_version: ::Google::Cloud::WebSecurityScanner::V1::VERSION,
236
+ transports_version_send: [:rest]
237
+
238
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
239
+
240
+ options.apply_defaults timeout: @config.rpcs.create_scan_config.timeout,
241
+ metadata: call_metadata,
242
+ retry_policy: @config.rpcs.create_scan_config.retry_policy
243
+
244
+ options.apply_defaults timeout: @config.timeout,
245
+ metadata: @config.metadata,
246
+ retry_policy: @config.retry_policy
247
+
248
+ @web_security_scanner_stub.create_scan_config request, options do |result, operation|
249
+ yield result, operation if block_given?
250
+ return result
251
+ end
252
+ rescue ::Gapic::Rest::Error => e
253
+ raise ::Google::Cloud::Error.from_error(e)
254
+ end
255
+
256
+ ##
257
+ # Deletes an existing ScanConfig and its child resources.
258
+ #
259
+ # @overload delete_scan_config(request, options = nil)
260
+ # Pass arguments to `delete_scan_config` via a request object, either of type
261
+ # {::Google::Cloud::WebSecurityScanner::V1::DeleteScanConfigRequest} or an equivalent Hash.
262
+ #
263
+ # @param request [::Google::Cloud::WebSecurityScanner::V1::DeleteScanConfigRequest, ::Hash]
264
+ # A request object representing the call parameters. Required. To specify no
265
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
266
+ # @param options [::Gapic::CallOptions, ::Hash]
267
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
268
+ #
269
+ # @overload delete_scan_config(name: nil)
270
+ # Pass arguments to `delete_scan_config` via keyword arguments. Note that at
271
+ # least one keyword argument is required. To specify no parameters, or to keep all
272
+ # the default parameter values, pass an empty Hash as a request object (see above).
273
+ #
274
+ # @param name [::String]
275
+ # Required. The resource name of the ScanConfig to be deleted. The name follows the
276
+ # format of 'projects/\\{projectId}/scanConfigs/\\{scanConfigId}'.
277
+ # @yield [result, operation] Access the result along with the TransportOperation object
278
+ # @yieldparam result [::Google::Protobuf::Empty]
279
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
280
+ #
281
+ # @return [::Google::Protobuf::Empty]
282
+ #
283
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
284
+ def delete_scan_config request, options = nil
285
+ raise ::ArgumentError, "request must be provided" if request.nil?
286
+
287
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1::DeleteScanConfigRequest
288
+
289
+ # Converts hash and nil to an options object
290
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
291
+
292
+ # Customize the options with defaults
293
+ call_metadata = @config.rpcs.delete_scan_config.metadata.to_h
294
+
295
+ # Set x-goog-api-client and x-goog-user-project headers
296
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
297
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
298
+ gapic_version: ::Google::Cloud::WebSecurityScanner::V1::VERSION,
299
+ transports_version_send: [:rest]
300
+
301
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
302
+
303
+ options.apply_defaults timeout: @config.rpcs.delete_scan_config.timeout,
304
+ metadata: call_metadata,
305
+ retry_policy: @config.rpcs.delete_scan_config.retry_policy
306
+
307
+ options.apply_defaults timeout: @config.timeout,
308
+ metadata: @config.metadata,
309
+ retry_policy: @config.retry_policy
310
+
311
+ @web_security_scanner_stub.delete_scan_config request, options do |result, operation|
312
+ yield result, operation if block_given?
313
+ return result
314
+ end
315
+ rescue ::Gapic::Rest::Error => e
316
+ raise ::Google::Cloud::Error.from_error(e)
317
+ end
318
+
319
+ ##
320
+ # Gets a ScanConfig.
321
+ #
322
+ # @overload get_scan_config(request, options = nil)
323
+ # Pass arguments to `get_scan_config` via a request object, either of type
324
+ # {::Google::Cloud::WebSecurityScanner::V1::GetScanConfigRequest} or an equivalent Hash.
325
+ #
326
+ # @param request [::Google::Cloud::WebSecurityScanner::V1::GetScanConfigRequest, ::Hash]
327
+ # A request object representing the call parameters. Required. To specify no
328
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
329
+ # @param options [::Gapic::CallOptions, ::Hash]
330
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
331
+ #
332
+ # @overload get_scan_config(name: nil)
333
+ # Pass arguments to `get_scan_config` via keyword arguments. Note that at
334
+ # least one keyword argument is required. To specify no parameters, or to keep all
335
+ # the default parameter values, pass an empty Hash as a request object (see above).
336
+ #
337
+ # @param name [::String]
338
+ # Required. The resource name of the ScanConfig to be returned. The name follows the
339
+ # format of 'projects/\\{projectId}/scanConfigs/\\{scanConfigId}'.
340
+ # @yield [result, operation] Access the result along with the TransportOperation object
341
+ # @yieldparam result [::Google::Cloud::WebSecurityScanner::V1::ScanConfig]
342
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
343
+ #
344
+ # @return [::Google::Cloud::WebSecurityScanner::V1::ScanConfig]
345
+ #
346
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
347
+ def get_scan_config request, options = nil
348
+ raise ::ArgumentError, "request must be provided" if request.nil?
349
+
350
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1::GetScanConfigRequest
351
+
352
+ # Converts hash and nil to an options object
353
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
354
+
355
+ # Customize the options with defaults
356
+ call_metadata = @config.rpcs.get_scan_config.metadata.to_h
357
+
358
+ # Set x-goog-api-client and x-goog-user-project headers
359
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
360
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
361
+ gapic_version: ::Google::Cloud::WebSecurityScanner::V1::VERSION,
362
+ transports_version_send: [:rest]
363
+
364
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
365
+
366
+ options.apply_defaults timeout: @config.rpcs.get_scan_config.timeout,
367
+ metadata: call_metadata,
368
+ retry_policy: @config.rpcs.get_scan_config.retry_policy
369
+
370
+ options.apply_defaults timeout: @config.timeout,
371
+ metadata: @config.metadata,
372
+ retry_policy: @config.retry_policy
373
+
374
+ @web_security_scanner_stub.get_scan_config request, options do |result, operation|
375
+ yield result, operation if block_given?
376
+ return result
377
+ end
378
+ rescue ::Gapic::Rest::Error => e
379
+ raise ::Google::Cloud::Error.from_error(e)
380
+ end
381
+
382
+ ##
383
+ # Lists ScanConfigs under a given project.
384
+ #
385
+ # @overload list_scan_configs(request, options = nil)
386
+ # Pass arguments to `list_scan_configs` via a request object, either of type
387
+ # {::Google::Cloud::WebSecurityScanner::V1::ListScanConfigsRequest} or an equivalent Hash.
388
+ #
389
+ # @param request [::Google::Cloud::WebSecurityScanner::V1::ListScanConfigsRequest, ::Hash]
390
+ # A request object representing the call parameters. Required. To specify no
391
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
392
+ # @param options [::Gapic::CallOptions, ::Hash]
393
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
394
+ #
395
+ # @overload list_scan_configs(parent: nil, page_token: nil, page_size: nil)
396
+ # Pass arguments to `list_scan_configs` via keyword arguments. Note that at
397
+ # least one keyword argument is required. To specify no parameters, or to keep all
398
+ # the default parameter values, pass an empty Hash as a request object (see above).
399
+ #
400
+ # @param parent [::String]
401
+ # Required. The parent resource name, which should be a project resource name in the
402
+ # format 'projects/\\{projectId}'.
403
+ # @param page_token [::String]
404
+ # A token identifying a page of results to be returned. This should be a
405
+ # `next_page_token` value returned from a previous List request.
406
+ # If unspecified, the first page of results is returned.
407
+ # @param page_size [::Integer]
408
+ # The maximum number of ScanConfigs to return, can be limited by server.
409
+ # If not specified or not positive, the implementation will select a
410
+ # reasonable value.
411
+ # @yield [result, operation] Access the result along with the TransportOperation object
412
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::WebSecurityScanner::V1::ScanConfig>]
413
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
414
+ #
415
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::WebSecurityScanner::V1::ScanConfig>]
416
+ #
417
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
418
+ def list_scan_configs request, options = nil
419
+ raise ::ArgumentError, "request must be provided" if request.nil?
420
+
421
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1::ListScanConfigsRequest
422
+
423
+ # Converts hash and nil to an options object
424
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
425
+
426
+ # Customize the options with defaults
427
+ call_metadata = @config.rpcs.list_scan_configs.metadata.to_h
428
+
429
+ # Set x-goog-api-client and x-goog-user-project headers
430
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
431
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
432
+ gapic_version: ::Google::Cloud::WebSecurityScanner::V1::VERSION,
433
+ transports_version_send: [:rest]
434
+
435
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
436
+
437
+ options.apply_defaults timeout: @config.rpcs.list_scan_configs.timeout,
438
+ metadata: call_metadata,
439
+ retry_policy: @config.rpcs.list_scan_configs.retry_policy
440
+
441
+ options.apply_defaults timeout: @config.timeout,
442
+ metadata: @config.metadata,
443
+ retry_policy: @config.retry_policy
444
+
445
+ @web_security_scanner_stub.list_scan_configs request, options do |result, operation|
446
+ result = ::Gapic::Rest::PagedEnumerable.new @web_security_scanner_stub, :list_scan_configs, "scan_configs", request, result, options
447
+ yield result, operation if block_given?
448
+ return result
449
+ end
450
+ rescue ::Gapic::Rest::Error => e
451
+ raise ::Google::Cloud::Error.from_error(e)
452
+ end
453
+
454
+ ##
455
+ # Updates a ScanConfig. This method support partial update of a ScanConfig.
456
+ #
457
+ # @overload update_scan_config(request, options = nil)
458
+ # Pass arguments to `update_scan_config` via a request object, either of type
459
+ # {::Google::Cloud::WebSecurityScanner::V1::UpdateScanConfigRequest} or an equivalent Hash.
460
+ #
461
+ # @param request [::Google::Cloud::WebSecurityScanner::V1::UpdateScanConfigRequest, ::Hash]
462
+ # A request object representing the call parameters. Required. To specify no
463
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
464
+ # @param options [::Gapic::CallOptions, ::Hash]
465
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
466
+ #
467
+ # @overload update_scan_config(scan_config: nil, update_mask: nil)
468
+ # Pass arguments to `update_scan_config` via keyword arguments. Note that at
469
+ # least one keyword argument is required. To specify no parameters, or to keep all
470
+ # the default parameter values, pass an empty Hash as a request object (see above).
471
+ #
472
+ # @param scan_config [::Google::Cloud::WebSecurityScanner::V1::ScanConfig, ::Hash]
473
+ # Required. The ScanConfig to be updated. The name field must be set to identify the
474
+ # resource to be updated. The values of fields not covered by the mask
475
+ # will be ignored.
476
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
477
+ # Required. The update mask applies to the resource. For the `FieldMask` definition,
478
+ # see
479
+ # https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
480
+ # @yield [result, operation] Access the result along with the TransportOperation object
481
+ # @yieldparam result [::Google::Cloud::WebSecurityScanner::V1::ScanConfig]
482
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
483
+ #
484
+ # @return [::Google::Cloud::WebSecurityScanner::V1::ScanConfig]
485
+ #
486
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
487
+ def update_scan_config request, options = nil
488
+ raise ::ArgumentError, "request must be provided" if request.nil?
489
+
490
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1::UpdateScanConfigRequest
491
+
492
+ # Converts hash and nil to an options object
493
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
494
+
495
+ # Customize the options with defaults
496
+ call_metadata = @config.rpcs.update_scan_config.metadata.to_h
497
+
498
+ # Set x-goog-api-client and x-goog-user-project headers
499
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
500
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
501
+ gapic_version: ::Google::Cloud::WebSecurityScanner::V1::VERSION,
502
+ transports_version_send: [:rest]
503
+
504
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
505
+
506
+ options.apply_defaults timeout: @config.rpcs.update_scan_config.timeout,
507
+ metadata: call_metadata,
508
+ retry_policy: @config.rpcs.update_scan_config.retry_policy
509
+
510
+ options.apply_defaults timeout: @config.timeout,
511
+ metadata: @config.metadata,
512
+ retry_policy: @config.retry_policy
513
+
514
+ @web_security_scanner_stub.update_scan_config request, options do |result, operation|
515
+ yield result, operation if block_given?
516
+ return result
517
+ end
518
+ rescue ::Gapic::Rest::Error => e
519
+ raise ::Google::Cloud::Error.from_error(e)
520
+ end
521
+
522
+ ##
523
+ # Start a ScanRun according to the given ScanConfig.
524
+ #
525
+ # @overload start_scan_run(request, options = nil)
526
+ # Pass arguments to `start_scan_run` via a request object, either of type
527
+ # {::Google::Cloud::WebSecurityScanner::V1::StartScanRunRequest} or an equivalent Hash.
528
+ #
529
+ # @param request [::Google::Cloud::WebSecurityScanner::V1::StartScanRunRequest, ::Hash]
530
+ # A request object representing the call parameters. Required. To specify no
531
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
532
+ # @param options [::Gapic::CallOptions, ::Hash]
533
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
534
+ #
535
+ # @overload start_scan_run(name: nil)
536
+ # Pass arguments to `start_scan_run` via keyword arguments. Note that at
537
+ # least one keyword argument is required. To specify no parameters, or to keep all
538
+ # the default parameter values, pass an empty Hash as a request object (see above).
539
+ #
540
+ # @param name [::String]
541
+ # Required. The resource name of the ScanConfig to be used. The name follows the
542
+ # format of 'projects/\\{projectId}/scanConfigs/\\{scanConfigId}'.
543
+ # @yield [result, operation] Access the result along with the TransportOperation object
544
+ # @yieldparam result [::Google::Cloud::WebSecurityScanner::V1::ScanRun]
545
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
546
+ #
547
+ # @return [::Google::Cloud::WebSecurityScanner::V1::ScanRun]
548
+ #
549
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
550
+ def start_scan_run request, options = nil
551
+ raise ::ArgumentError, "request must be provided" if request.nil?
552
+
553
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1::StartScanRunRequest
554
+
555
+ # Converts hash and nil to an options object
556
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
557
+
558
+ # Customize the options with defaults
559
+ call_metadata = @config.rpcs.start_scan_run.metadata.to_h
560
+
561
+ # Set x-goog-api-client and x-goog-user-project headers
562
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
563
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
564
+ gapic_version: ::Google::Cloud::WebSecurityScanner::V1::VERSION,
565
+ transports_version_send: [:rest]
566
+
567
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
568
+
569
+ options.apply_defaults timeout: @config.rpcs.start_scan_run.timeout,
570
+ metadata: call_metadata,
571
+ retry_policy: @config.rpcs.start_scan_run.retry_policy
572
+
573
+ options.apply_defaults timeout: @config.timeout,
574
+ metadata: @config.metadata,
575
+ retry_policy: @config.retry_policy
576
+
577
+ @web_security_scanner_stub.start_scan_run request, options do |result, operation|
578
+ yield result, operation if block_given?
579
+ return result
580
+ end
581
+ rescue ::Gapic::Rest::Error => e
582
+ raise ::Google::Cloud::Error.from_error(e)
583
+ end
584
+
585
+ ##
586
+ # Gets a ScanRun.
587
+ #
588
+ # @overload get_scan_run(request, options = nil)
589
+ # Pass arguments to `get_scan_run` via a request object, either of type
590
+ # {::Google::Cloud::WebSecurityScanner::V1::GetScanRunRequest} or an equivalent Hash.
591
+ #
592
+ # @param request [::Google::Cloud::WebSecurityScanner::V1::GetScanRunRequest, ::Hash]
593
+ # A request object representing the call parameters. Required. To specify no
594
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
595
+ # @param options [::Gapic::CallOptions, ::Hash]
596
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
597
+ #
598
+ # @overload get_scan_run(name: nil)
599
+ # Pass arguments to `get_scan_run` via keyword arguments. Note that at
600
+ # least one keyword argument is required. To specify no parameters, or to keep all
601
+ # the default parameter values, pass an empty Hash as a request object (see above).
602
+ #
603
+ # @param name [::String]
604
+ # Required. The resource name of the ScanRun to be returned. The name follows the
605
+ # format of
606
+ # 'projects/\\{projectId}/scanConfigs/\\{scanConfigId}/scanRuns/\\{scanRunId}'.
607
+ # @yield [result, operation] Access the result along with the TransportOperation object
608
+ # @yieldparam result [::Google::Cloud::WebSecurityScanner::V1::ScanRun]
609
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
610
+ #
611
+ # @return [::Google::Cloud::WebSecurityScanner::V1::ScanRun]
612
+ #
613
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
614
+ def get_scan_run request, options = nil
615
+ raise ::ArgumentError, "request must be provided" if request.nil?
616
+
617
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1::GetScanRunRequest
618
+
619
+ # Converts hash and nil to an options object
620
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
621
+
622
+ # Customize the options with defaults
623
+ call_metadata = @config.rpcs.get_scan_run.metadata.to_h
624
+
625
+ # Set x-goog-api-client and x-goog-user-project headers
626
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
627
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
628
+ gapic_version: ::Google::Cloud::WebSecurityScanner::V1::VERSION,
629
+ transports_version_send: [:rest]
630
+
631
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
632
+
633
+ options.apply_defaults timeout: @config.rpcs.get_scan_run.timeout,
634
+ metadata: call_metadata,
635
+ retry_policy: @config.rpcs.get_scan_run.retry_policy
636
+
637
+ options.apply_defaults timeout: @config.timeout,
638
+ metadata: @config.metadata,
639
+ retry_policy: @config.retry_policy
640
+
641
+ @web_security_scanner_stub.get_scan_run request, options do |result, operation|
642
+ yield result, operation if block_given?
643
+ return result
644
+ end
645
+ rescue ::Gapic::Rest::Error => e
646
+ raise ::Google::Cloud::Error.from_error(e)
647
+ end
648
+
649
+ ##
650
+ # Lists ScanRuns under a given ScanConfig, in descending order of ScanRun
651
+ # stop time.
652
+ #
653
+ # @overload list_scan_runs(request, options = nil)
654
+ # Pass arguments to `list_scan_runs` via a request object, either of type
655
+ # {::Google::Cloud::WebSecurityScanner::V1::ListScanRunsRequest} or an equivalent Hash.
656
+ #
657
+ # @param request [::Google::Cloud::WebSecurityScanner::V1::ListScanRunsRequest, ::Hash]
658
+ # A request object representing the call parameters. Required. To specify no
659
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
660
+ # @param options [::Gapic::CallOptions, ::Hash]
661
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
662
+ #
663
+ # @overload list_scan_runs(parent: nil, page_token: nil, page_size: nil)
664
+ # Pass arguments to `list_scan_runs` via keyword arguments. Note that at
665
+ # least one keyword argument is required. To specify no parameters, or to keep all
666
+ # the default parameter values, pass an empty Hash as a request object (see above).
667
+ #
668
+ # @param parent [::String]
669
+ # Required. The parent resource name, which should be a scan resource name in the
670
+ # format 'projects/\\{projectId}/scanConfigs/\\{scanConfigId}'.
671
+ # @param page_token [::String]
672
+ # A token identifying a page of results to be returned. This should be a
673
+ # `next_page_token` value returned from a previous List request.
674
+ # If unspecified, the first page of results is returned.
675
+ # @param page_size [::Integer]
676
+ # The maximum number of ScanRuns to return, can be limited by server.
677
+ # If not specified or not positive, the implementation will select a
678
+ # reasonable value.
679
+ # @yield [result, operation] Access the result along with the TransportOperation object
680
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::WebSecurityScanner::V1::ScanRun>]
681
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
682
+ #
683
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::WebSecurityScanner::V1::ScanRun>]
684
+ #
685
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
686
+ def list_scan_runs request, options = nil
687
+ raise ::ArgumentError, "request must be provided" if request.nil?
688
+
689
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1::ListScanRunsRequest
690
+
691
+ # Converts hash and nil to an options object
692
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
693
+
694
+ # Customize the options with defaults
695
+ call_metadata = @config.rpcs.list_scan_runs.metadata.to_h
696
+
697
+ # Set x-goog-api-client and x-goog-user-project headers
698
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
699
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
700
+ gapic_version: ::Google::Cloud::WebSecurityScanner::V1::VERSION,
701
+ transports_version_send: [:rest]
702
+
703
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
704
+
705
+ options.apply_defaults timeout: @config.rpcs.list_scan_runs.timeout,
706
+ metadata: call_metadata,
707
+ retry_policy: @config.rpcs.list_scan_runs.retry_policy
708
+
709
+ options.apply_defaults timeout: @config.timeout,
710
+ metadata: @config.metadata,
711
+ retry_policy: @config.retry_policy
712
+
713
+ @web_security_scanner_stub.list_scan_runs request, options do |result, operation|
714
+ result = ::Gapic::Rest::PagedEnumerable.new @web_security_scanner_stub, :list_scan_runs, "scan_runs", request, result, options
715
+ yield result, operation if block_given?
716
+ return result
717
+ end
718
+ rescue ::Gapic::Rest::Error => e
719
+ raise ::Google::Cloud::Error.from_error(e)
720
+ end
721
+
722
+ ##
723
+ # Stops a ScanRun. The stopped ScanRun is returned.
724
+ #
725
+ # @overload stop_scan_run(request, options = nil)
726
+ # Pass arguments to `stop_scan_run` via a request object, either of type
727
+ # {::Google::Cloud::WebSecurityScanner::V1::StopScanRunRequest} or an equivalent Hash.
728
+ #
729
+ # @param request [::Google::Cloud::WebSecurityScanner::V1::StopScanRunRequest, ::Hash]
730
+ # A request object representing the call parameters. Required. To specify no
731
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
732
+ # @param options [::Gapic::CallOptions, ::Hash]
733
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
734
+ #
735
+ # @overload stop_scan_run(name: nil)
736
+ # Pass arguments to `stop_scan_run` via keyword arguments. Note that at
737
+ # least one keyword argument is required. To specify no parameters, or to keep all
738
+ # the default parameter values, pass an empty Hash as a request object (see above).
739
+ #
740
+ # @param name [::String]
741
+ # Required. The resource name of the ScanRun to be stopped. The name follows the
742
+ # format of
743
+ # 'projects/\\{projectId}/scanConfigs/\\{scanConfigId}/scanRuns/\\{scanRunId}'.
744
+ # @yield [result, operation] Access the result along with the TransportOperation object
745
+ # @yieldparam result [::Google::Cloud::WebSecurityScanner::V1::ScanRun]
746
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
747
+ #
748
+ # @return [::Google::Cloud::WebSecurityScanner::V1::ScanRun]
749
+ #
750
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
751
+ def stop_scan_run request, options = nil
752
+ raise ::ArgumentError, "request must be provided" if request.nil?
753
+
754
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1::StopScanRunRequest
755
+
756
+ # Converts hash and nil to an options object
757
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
758
+
759
+ # Customize the options with defaults
760
+ call_metadata = @config.rpcs.stop_scan_run.metadata.to_h
761
+
762
+ # Set x-goog-api-client and x-goog-user-project headers
763
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
764
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
765
+ gapic_version: ::Google::Cloud::WebSecurityScanner::V1::VERSION,
766
+ transports_version_send: [:rest]
767
+
768
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
769
+
770
+ options.apply_defaults timeout: @config.rpcs.stop_scan_run.timeout,
771
+ metadata: call_metadata,
772
+ retry_policy: @config.rpcs.stop_scan_run.retry_policy
773
+
774
+ options.apply_defaults timeout: @config.timeout,
775
+ metadata: @config.metadata,
776
+ retry_policy: @config.retry_policy
777
+
778
+ @web_security_scanner_stub.stop_scan_run request, options do |result, operation|
779
+ yield result, operation if block_given?
780
+ return result
781
+ end
782
+ rescue ::Gapic::Rest::Error => e
783
+ raise ::Google::Cloud::Error.from_error(e)
784
+ end
785
+
786
+ ##
787
+ # List CrawledUrls under a given ScanRun.
788
+ #
789
+ # @overload list_crawled_urls(request, options = nil)
790
+ # Pass arguments to `list_crawled_urls` via a request object, either of type
791
+ # {::Google::Cloud::WebSecurityScanner::V1::ListCrawledUrlsRequest} or an equivalent Hash.
792
+ #
793
+ # @param request [::Google::Cloud::WebSecurityScanner::V1::ListCrawledUrlsRequest, ::Hash]
794
+ # A request object representing the call parameters. Required. To specify no
795
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
796
+ # @param options [::Gapic::CallOptions, ::Hash]
797
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
798
+ #
799
+ # @overload list_crawled_urls(parent: nil, page_token: nil, page_size: nil)
800
+ # Pass arguments to `list_crawled_urls` via keyword arguments. Note that at
801
+ # least one keyword argument is required. To specify no parameters, or to keep all
802
+ # the default parameter values, pass an empty Hash as a request object (see above).
803
+ #
804
+ # @param parent [::String]
805
+ # Required. The parent resource name, which should be a scan run resource name in the
806
+ # format
807
+ # 'projects/\\{projectId}/scanConfigs/\\{scanConfigId}/scanRuns/\\{scanRunId}'.
808
+ # @param page_token [::String]
809
+ # A token identifying a page of results to be returned. This should be a
810
+ # `next_page_token` value returned from a previous List request.
811
+ # If unspecified, the first page of results is returned.
812
+ # @param page_size [::Integer]
813
+ # The maximum number of CrawledUrls to return, can be limited by server.
814
+ # If not specified or not positive, the implementation will select a
815
+ # reasonable value.
816
+ # @yield [result, operation] Access the result along with the TransportOperation object
817
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::WebSecurityScanner::V1::CrawledUrl>]
818
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
819
+ #
820
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::WebSecurityScanner::V1::CrawledUrl>]
821
+ #
822
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
823
+ def list_crawled_urls request, options = nil
824
+ raise ::ArgumentError, "request must be provided" if request.nil?
825
+
826
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1::ListCrawledUrlsRequest
827
+
828
+ # Converts hash and nil to an options object
829
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
830
+
831
+ # Customize the options with defaults
832
+ call_metadata = @config.rpcs.list_crawled_urls.metadata.to_h
833
+
834
+ # Set x-goog-api-client and x-goog-user-project headers
835
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
836
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
837
+ gapic_version: ::Google::Cloud::WebSecurityScanner::V1::VERSION,
838
+ transports_version_send: [:rest]
839
+
840
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
841
+
842
+ options.apply_defaults timeout: @config.rpcs.list_crawled_urls.timeout,
843
+ metadata: call_metadata,
844
+ retry_policy: @config.rpcs.list_crawled_urls.retry_policy
845
+
846
+ options.apply_defaults timeout: @config.timeout,
847
+ metadata: @config.metadata,
848
+ retry_policy: @config.retry_policy
849
+
850
+ @web_security_scanner_stub.list_crawled_urls request, options do |result, operation|
851
+ result = ::Gapic::Rest::PagedEnumerable.new @web_security_scanner_stub, :list_crawled_urls, "crawled_urls", request, result, options
852
+ yield result, operation if block_given?
853
+ return result
854
+ end
855
+ rescue ::Gapic::Rest::Error => e
856
+ raise ::Google::Cloud::Error.from_error(e)
857
+ end
858
+
859
+ ##
860
+ # Gets a Finding.
861
+ #
862
+ # @overload get_finding(request, options = nil)
863
+ # Pass arguments to `get_finding` via a request object, either of type
864
+ # {::Google::Cloud::WebSecurityScanner::V1::GetFindingRequest} or an equivalent Hash.
865
+ #
866
+ # @param request [::Google::Cloud::WebSecurityScanner::V1::GetFindingRequest, ::Hash]
867
+ # A request object representing the call parameters. Required. To specify no
868
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
869
+ # @param options [::Gapic::CallOptions, ::Hash]
870
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
871
+ #
872
+ # @overload get_finding(name: nil)
873
+ # Pass arguments to `get_finding` via keyword arguments. Note that at
874
+ # least one keyword argument is required. To specify no parameters, or to keep all
875
+ # the default parameter values, pass an empty Hash as a request object (see above).
876
+ #
877
+ # @param name [::String]
878
+ # Required. The resource name of the Finding to be returned. The name follows the
879
+ # format of
880
+ # 'projects/\\{projectId}/scanConfigs/\\{scanConfigId}/scanRuns/\\{scanRunId}/findings/\\{findingId}'.
881
+ # @yield [result, operation] Access the result along with the TransportOperation object
882
+ # @yieldparam result [::Google::Cloud::WebSecurityScanner::V1::Finding]
883
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
884
+ #
885
+ # @return [::Google::Cloud::WebSecurityScanner::V1::Finding]
886
+ #
887
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
888
+ def get_finding request, options = nil
889
+ raise ::ArgumentError, "request must be provided" if request.nil?
890
+
891
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1::GetFindingRequest
892
+
893
+ # Converts hash and nil to an options object
894
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
895
+
896
+ # Customize the options with defaults
897
+ call_metadata = @config.rpcs.get_finding.metadata.to_h
898
+
899
+ # Set x-goog-api-client and x-goog-user-project headers
900
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
901
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
902
+ gapic_version: ::Google::Cloud::WebSecurityScanner::V1::VERSION,
903
+ transports_version_send: [:rest]
904
+
905
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
906
+
907
+ options.apply_defaults timeout: @config.rpcs.get_finding.timeout,
908
+ metadata: call_metadata,
909
+ retry_policy: @config.rpcs.get_finding.retry_policy
910
+
911
+ options.apply_defaults timeout: @config.timeout,
912
+ metadata: @config.metadata,
913
+ retry_policy: @config.retry_policy
914
+
915
+ @web_security_scanner_stub.get_finding request, options do |result, operation|
916
+ yield result, operation if block_given?
917
+ return result
918
+ end
919
+ rescue ::Gapic::Rest::Error => e
920
+ raise ::Google::Cloud::Error.from_error(e)
921
+ end
922
+
923
+ ##
924
+ # List Findings under a given ScanRun.
925
+ #
926
+ # @overload list_findings(request, options = nil)
927
+ # Pass arguments to `list_findings` via a request object, either of type
928
+ # {::Google::Cloud::WebSecurityScanner::V1::ListFindingsRequest} or an equivalent Hash.
929
+ #
930
+ # @param request [::Google::Cloud::WebSecurityScanner::V1::ListFindingsRequest, ::Hash]
931
+ # A request object representing the call parameters. Required. To specify no
932
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
933
+ # @param options [::Gapic::CallOptions, ::Hash]
934
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
935
+ #
936
+ # @overload list_findings(parent: nil, filter: nil, page_token: nil, page_size: nil)
937
+ # Pass arguments to `list_findings` via keyword arguments. Note that at
938
+ # least one keyword argument is required. To specify no parameters, or to keep all
939
+ # the default parameter values, pass an empty Hash as a request object (see above).
940
+ #
941
+ # @param parent [::String]
942
+ # Required. The parent resource name, which should be a scan run resource name in the
943
+ # format
944
+ # 'projects/\\{projectId}/scanConfigs/\\{scanConfigId}/scanRuns/\\{scanRunId}'.
945
+ # @param filter [::String]
946
+ # The filter expression. The expression must be in the format: <field>
947
+ # <operator> <value>.
948
+ # Supported field: 'finding_type'.
949
+ # Supported operator: '='.
950
+ # @param page_token [::String]
951
+ # A token identifying a page of results to be returned. This should be a
952
+ # `next_page_token` value returned from a previous List request.
953
+ # If unspecified, the first page of results is returned.
954
+ # @param page_size [::Integer]
955
+ # The maximum number of Findings to return, can be limited by server.
956
+ # If not specified or not positive, the implementation will select a
957
+ # reasonable value.
958
+ # @yield [result, operation] Access the result along with the TransportOperation object
959
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::WebSecurityScanner::V1::Finding>]
960
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
961
+ #
962
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::WebSecurityScanner::V1::Finding>]
963
+ #
964
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
965
+ def list_findings request, options = nil
966
+ raise ::ArgumentError, "request must be provided" if request.nil?
967
+
968
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1::ListFindingsRequest
969
+
970
+ # Converts hash and nil to an options object
971
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
972
+
973
+ # Customize the options with defaults
974
+ call_metadata = @config.rpcs.list_findings.metadata.to_h
975
+
976
+ # Set x-goog-api-client and x-goog-user-project headers
977
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
978
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
979
+ gapic_version: ::Google::Cloud::WebSecurityScanner::V1::VERSION,
980
+ transports_version_send: [:rest]
981
+
982
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
983
+
984
+ options.apply_defaults timeout: @config.rpcs.list_findings.timeout,
985
+ metadata: call_metadata,
986
+ retry_policy: @config.rpcs.list_findings.retry_policy
987
+
988
+ options.apply_defaults timeout: @config.timeout,
989
+ metadata: @config.metadata,
990
+ retry_policy: @config.retry_policy
991
+
992
+ @web_security_scanner_stub.list_findings request, options do |result, operation|
993
+ result = ::Gapic::Rest::PagedEnumerable.new @web_security_scanner_stub, :list_findings, "findings", request, result, options
994
+ yield result, operation if block_given?
995
+ return result
996
+ end
997
+ rescue ::Gapic::Rest::Error => e
998
+ raise ::Google::Cloud::Error.from_error(e)
999
+ end
1000
+
1001
+ ##
1002
+ # List all FindingTypeStats under a given ScanRun.
1003
+ #
1004
+ # @overload list_finding_type_stats(request, options = nil)
1005
+ # Pass arguments to `list_finding_type_stats` via a request object, either of type
1006
+ # {::Google::Cloud::WebSecurityScanner::V1::ListFindingTypeStatsRequest} or an equivalent Hash.
1007
+ #
1008
+ # @param request [::Google::Cloud::WebSecurityScanner::V1::ListFindingTypeStatsRequest, ::Hash]
1009
+ # A request object representing the call parameters. Required. To specify no
1010
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1011
+ # @param options [::Gapic::CallOptions, ::Hash]
1012
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1013
+ #
1014
+ # @overload list_finding_type_stats(parent: nil)
1015
+ # Pass arguments to `list_finding_type_stats` via keyword arguments. Note that at
1016
+ # least one keyword argument is required. To specify no parameters, or to keep all
1017
+ # the default parameter values, pass an empty Hash as a request object (see above).
1018
+ #
1019
+ # @param parent [::String]
1020
+ # Required. The parent resource name, which should be a scan run resource name in the
1021
+ # format
1022
+ # 'projects/\\{projectId}/scanConfigs/\\{scanConfigId}/scanRuns/\\{scanRunId}'.
1023
+ # @yield [result, operation] Access the result along with the TransportOperation object
1024
+ # @yieldparam result [::Google::Cloud::WebSecurityScanner::V1::ListFindingTypeStatsResponse]
1025
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1026
+ #
1027
+ # @return [::Google::Cloud::WebSecurityScanner::V1::ListFindingTypeStatsResponse]
1028
+ #
1029
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1030
+ def list_finding_type_stats request, options = nil
1031
+ raise ::ArgumentError, "request must be provided" if request.nil?
1032
+
1033
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1::ListFindingTypeStatsRequest
1034
+
1035
+ # Converts hash and nil to an options object
1036
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1037
+
1038
+ # Customize the options with defaults
1039
+ call_metadata = @config.rpcs.list_finding_type_stats.metadata.to_h
1040
+
1041
+ # Set x-goog-api-client and x-goog-user-project headers
1042
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1043
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1044
+ gapic_version: ::Google::Cloud::WebSecurityScanner::V1::VERSION,
1045
+ transports_version_send: [:rest]
1046
+
1047
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1048
+
1049
+ options.apply_defaults timeout: @config.rpcs.list_finding_type_stats.timeout,
1050
+ metadata: call_metadata,
1051
+ retry_policy: @config.rpcs.list_finding_type_stats.retry_policy
1052
+
1053
+ options.apply_defaults timeout: @config.timeout,
1054
+ metadata: @config.metadata,
1055
+ retry_policy: @config.retry_policy
1056
+
1057
+ @web_security_scanner_stub.list_finding_type_stats request, options do |result, operation|
1058
+ yield result, operation if block_given?
1059
+ return result
1060
+ end
1061
+ rescue ::Gapic::Rest::Error => e
1062
+ raise ::Google::Cloud::Error.from_error(e)
1063
+ end
1064
+
1065
+ ##
1066
+ # Configuration class for the WebSecurityScanner REST API.
1067
+ #
1068
+ # This class represents the configuration for WebSecurityScanner REST,
1069
+ # providing control over timeouts, retry behavior, logging, transport
1070
+ # parameters, and other low-level controls. Certain parameters can also be
1071
+ # applied individually to specific RPCs. See
1072
+ # {::Google::Cloud::WebSecurityScanner::V1::WebSecurityScanner::Rest::Client::Configuration::Rpcs}
1073
+ # for a list of RPCs that can be configured independently.
1074
+ #
1075
+ # Configuration can be applied globally to all clients, or to a single client
1076
+ # on construction.
1077
+ #
1078
+ # @example
1079
+ #
1080
+ # # Modify the global config, setting the timeout for
1081
+ # # create_scan_config to 20 seconds,
1082
+ # # and all remaining timeouts to 10 seconds.
1083
+ # ::Google::Cloud::WebSecurityScanner::V1::WebSecurityScanner::Rest::Client.configure do |config|
1084
+ # config.timeout = 10.0
1085
+ # config.rpcs.create_scan_config.timeout = 20.0
1086
+ # end
1087
+ #
1088
+ # # Apply the above configuration only to a new client.
1089
+ # client = ::Google::Cloud::WebSecurityScanner::V1::WebSecurityScanner::Rest::Client.new do |config|
1090
+ # config.timeout = 10.0
1091
+ # config.rpcs.create_scan_config.timeout = 20.0
1092
+ # end
1093
+ #
1094
+ # @!attribute [rw] endpoint
1095
+ # The hostname or hostname:port of the service endpoint.
1096
+ # Defaults to `"websecurityscanner.googleapis.com"`.
1097
+ # @return [::String]
1098
+ # @!attribute [rw] credentials
1099
+ # Credentials to send with calls. You may provide any of the following types:
1100
+ # * (`String`) The path to a service account key file in JSON format
1101
+ # * (`Hash`) A service account key as a Hash
1102
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1103
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1104
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1105
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1106
+ # * (`nil`) indicating no credentials
1107
+ # @return [::Object]
1108
+ # @!attribute [rw] scope
1109
+ # The OAuth scopes
1110
+ # @return [::Array<::String>]
1111
+ # @!attribute [rw] lib_name
1112
+ # The library name as recorded in instrumentation and logging
1113
+ # @return [::String]
1114
+ # @!attribute [rw] lib_version
1115
+ # The library version as recorded in instrumentation and logging
1116
+ # @return [::String]
1117
+ # @!attribute [rw] timeout
1118
+ # The call timeout in seconds.
1119
+ # @return [::Numeric]
1120
+ # @!attribute [rw] metadata
1121
+ # Additional headers to be sent with the call.
1122
+ # @return [::Hash{::Symbol=>::String}]
1123
+ # @!attribute [rw] retry_policy
1124
+ # The retry policy. The value is a hash with the following keys:
1125
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1126
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1127
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1128
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1129
+ # trigger a retry.
1130
+ # @return [::Hash]
1131
+ # @!attribute [rw] quota_project
1132
+ # A separate project against which to charge quota.
1133
+ # @return [::String]
1134
+ #
1135
+ class Configuration
1136
+ extend ::Gapic::Config
1137
+
1138
+ config_attr :endpoint, "websecurityscanner.googleapis.com", ::String
1139
+ config_attr :credentials, nil do |value|
1140
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1141
+ allowed.any? { |klass| klass === value }
1142
+ end
1143
+ config_attr :scope, nil, ::String, ::Array, nil
1144
+ config_attr :lib_name, nil, ::String, nil
1145
+ config_attr :lib_version, nil, ::String, nil
1146
+ config_attr :timeout, nil, ::Numeric, nil
1147
+ config_attr :metadata, nil, ::Hash, nil
1148
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1149
+ config_attr :quota_project, nil, ::String, nil
1150
+
1151
+ # @private
1152
+ def initialize parent_config = nil
1153
+ @parent_config = parent_config unless parent_config.nil?
1154
+
1155
+ yield self if block_given?
1156
+ end
1157
+
1158
+ ##
1159
+ # Configurations for individual RPCs
1160
+ # @return [Rpcs]
1161
+ #
1162
+ def rpcs
1163
+ @rpcs ||= begin
1164
+ parent_rpcs = nil
1165
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1166
+ Rpcs.new parent_rpcs
1167
+ end
1168
+ end
1169
+
1170
+ ##
1171
+ # Configuration RPC class for the WebSecurityScanner API.
1172
+ #
1173
+ # Includes fields providing the configuration for each RPC in this service.
1174
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1175
+ # the following configuration fields:
1176
+ #
1177
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1178
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1179
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1180
+ # include the following keys:
1181
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1182
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1183
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1184
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1185
+ # trigger a retry.
1186
+ #
1187
+ class Rpcs
1188
+ ##
1189
+ # RPC-specific configuration for `create_scan_config`
1190
+ # @return [::Gapic::Config::Method]
1191
+ #
1192
+ attr_reader :create_scan_config
1193
+ ##
1194
+ # RPC-specific configuration for `delete_scan_config`
1195
+ # @return [::Gapic::Config::Method]
1196
+ #
1197
+ attr_reader :delete_scan_config
1198
+ ##
1199
+ # RPC-specific configuration for `get_scan_config`
1200
+ # @return [::Gapic::Config::Method]
1201
+ #
1202
+ attr_reader :get_scan_config
1203
+ ##
1204
+ # RPC-specific configuration for `list_scan_configs`
1205
+ # @return [::Gapic::Config::Method]
1206
+ #
1207
+ attr_reader :list_scan_configs
1208
+ ##
1209
+ # RPC-specific configuration for `update_scan_config`
1210
+ # @return [::Gapic::Config::Method]
1211
+ #
1212
+ attr_reader :update_scan_config
1213
+ ##
1214
+ # RPC-specific configuration for `start_scan_run`
1215
+ # @return [::Gapic::Config::Method]
1216
+ #
1217
+ attr_reader :start_scan_run
1218
+ ##
1219
+ # RPC-specific configuration for `get_scan_run`
1220
+ # @return [::Gapic::Config::Method]
1221
+ #
1222
+ attr_reader :get_scan_run
1223
+ ##
1224
+ # RPC-specific configuration for `list_scan_runs`
1225
+ # @return [::Gapic::Config::Method]
1226
+ #
1227
+ attr_reader :list_scan_runs
1228
+ ##
1229
+ # RPC-specific configuration for `stop_scan_run`
1230
+ # @return [::Gapic::Config::Method]
1231
+ #
1232
+ attr_reader :stop_scan_run
1233
+ ##
1234
+ # RPC-specific configuration for `list_crawled_urls`
1235
+ # @return [::Gapic::Config::Method]
1236
+ #
1237
+ attr_reader :list_crawled_urls
1238
+ ##
1239
+ # RPC-specific configuration for `get_finding`
1240
+ # @return [::Gapic::Config::Method]
1241
+ #
1242
+ attr_reader :get_finding
1243
+ ##
1244
+ # RPC-specific configuration for `list_findings`
1245
+ # @return [::Gapic::Config::Method]
1246
+ #
1247
+ attr_reader :list_findings
1248
+ ##
1249
+ # RPC-specific configuration for `list_finding_type_stats`
1250
+ # @return [::Gapic::Config::Method]
1251
+ #
1252
+ attr_reader :list_finding_type_stats
1253
+
1254
+ # @private
1255
+ def initialize parent_rpcs = nil
1256
+ create_scan_config_config = parent_rpcs.create_scan_config if parent_rpcs.respond_to? :create_scan_config
1257
+ @create_scan_config = ::Gapic::Config::Method.new create_scan_config_config
1258
+ delete_scan_config_config = parent_rpcs.delete_scan_config if parent_rpcs.respond_to? :delete_scan_config
1259
+ @delete_scan_config = ::Gapic::Config::Method.new delete_scan_config_config
1260
+ get_scan_config_config = parent_rpcs.get_scan_config if parent_rpcs.respond_to? :get_scan_config
1261
+ @get_scan_config = ::Gapic::Config::Method.new get_scan_config_config
1262
+ list_scan_configs_config = parent_rpcs.list_scan_configs if parent_rpcs.respond_to? :list_scan_configs
1263
+ @list_scan_configs = ::Gapic::Config::Method.new list_scan_configs_config
1264
+ update_scan_config_config = parent_rpcs.update_scan_config if parent_rpcs.respond_to? :update_scan_config
1265
+ @update_scan_config = ::Gapic::Config::Method.new update_scan_config_config
1266
+ start_scan_run_config = parent_rpcs.start_scan_run if parent_rpcs.respond_to? :start_scan_run
1267
+ @start_scan_run = ::Gapic::Config::Method.new start_scan_run_config
1268
+ get_scan_run_config = parent_rpcs.get_scan_run if parent_rpcs.respond_to? :get_scan_run
1269
+ @get_scan_run = ::Gapic::Config::Method.new get_scan_run_config
1270
+ list_scan_runs_config = parent_rpcs.list_scan_runs if parent_rpcs.respond_to? :list_scan_runs
1271
+ @list_scan_runs = ::Gapic::Config::Method.new list_scan_runs_config
1272
+ stop_scan_run_config = parent_rpcs.stop_scan_run if parent_rpcs.respond_to? :stop_scan_run
1273
+ @stop_scan_run = ::Gapic::Config::Method.new stop_scan_run_config
1274
+ list_crawled_urls_config = parent_rpcs.list_crawled_urls if parent_rpcs.respond_to? :list_crawled_urls
1275
+ @list_crawled_urls = ::Gapic::Config::Method.new list_crawled_urls_config
1276
+ get_finding_config = parent_rpcs.get_finding if parent_rpcs.respond_to? :get_finding
1277
+ @get_finding = ::Gapic::Config::Method.new get_finding_config
1278
+ list_findings_config = parent_rpcs.list_findings if parent_rpcs.respond_to? :list_findings
1279
+ @list_findings = ::Gapic::Config::Method.new list_findings_config
1280
+ list_finding_type_stats_config = parent_rpcs.list_finding_type_stats if parent_rpcs.respond_to? :list_finding_type_stats
1281
+ @list_finding_type_stats = ::Gapic::Config::Method.new list_finding_type_stats_config
1282
+
1283
+ yield self if block_given?
1284
+ end
1285
+ end
1286
+ end
1287
+ end
1288
+ end
1289
+ end
1290
+ end
1291
+ end
1292
+ end
1293
+ end