google-cloud-web_security_scanner-v1beta 0.4.0 → 0.6.0

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