google_cloud_websecurityscanner_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate serde;
25extern crate serde_json;
26extern crate serde_with;
27extern crate std;
28extern crate tracing;
29extern crate wkt;
30
31mod debug;
32mod deserialize;
33mod serialize;
34
35/// A CrawledUrl resource represents a URL that was crawled during a ScanRun. Web
36/// Security Scanner Service crawls the web applications, following all links
37/// within the scope of sites, to find the URLs to test against.
38#[derive(Clone, Default, PartialEq)]
39#[non_exhaustive]
40pub struct CrawledUrl {
41 /// Output only. The http method of the request that was used to visit the URL, in
42 /// uppercase.
43 pub http_method: std::string::String,
44
45 /// Output only. The URL that was crawled.
46 pub url: std::string::String,
47
48 /// Output only. The body of the request that was used to visit the URL.
49 pub body: std::string::String,
50
51 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
52}
53
54impl CrawledUrl {
55 /// Creates a new default instance.
56 pub fn new() -> Self {
57 std::default::Default::default()
58 }
59
60 /// Sets the value of [http_method][crate::model::CrawledUrl::http_method].
61 ///
62 /// # Example
63 /// ```ignore,no_run
64 /// # use google_cloud_websecurityscanner_v1::model::CrawledUrl;
65 /// let x = CrawledUrl::new().set_http_method("example");
66 /// ```
67 pub fn set_http_method<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
68 self.http_method = v.into();
69 self
70 }
71
72 /// Sets the value of [url][crate::model::CrawledUrl::url].
73 ///
74 /// # Example
75 /// ```ignore,no_run
76 /// # use google_cloud_websecurityscanner_v1::model::CrawledUrl;
77 /// let x = CrawledUrl::new().set_url("example");
78 /// ```
79 pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
80 self.url = v.into();
81 self
82 }
83
84 /// Sets the value of [body][crate::model::CrawledUrl::body].
85 ///
86 /// # Example
87 /// ```ignore,no_run
88 /// # use google_cloud_websecurityscanner_v1::model::CrawledUrl;
89 /// let x = CrawledUrl::new().set_body("example");
90 /// ```
91 pub fn set_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
92 self.body = v.into();
93 self
94 }
95}
96
97impl wkt::message::Message for CrawledUrl {
98 fn typename() -> &'static str {
99 "type.googleapis.com/google.cloud.websecurityscanner.v1.CrawledUrl"
100 }
101}
102
103/// A Finding resource represents a vulnerability instance identified during a
104/// ScanRun.
105#[derive(Clone, Default, PartialEq)]
106#[non_exhaustive]
107pub struct Finding {
108 /// Output only. The resource name of the Finding. The name follows the format of
109 /// 'projects/{projectId}/scanConfigs/{scanConfigId}/scanruns/{scanRunId}/findings/{findingId}'.
110 /// The finding IDs are generated by the system.
111 pub name: std::string::String,
112
113 /// Output only. The type of the Finding.
114 /// Detailed and up-to-date information on findings can be found here:
115 /// <https://cloud.google.com/security-command-center/docs/how-to-remediate-web-security-scanner-findings>
116 pub finding_type: std::string::String,
117
118 /// Output only. The severity level of the reported vulnerability.
119 pub severity: crate::model::finding::Severity,
120
121 /// Output only. The http method of the request that triggered the vulnerability, in
122 /// uppercase.
123 pub http_method: std::string::String,
124
125 /// Output only. The URL produced by the server-side fuzzer and used in the request that
126 /// triggered the vulnerability.
127 pub fuzzed_url: std::string::String,
128
129 /// Output only. The body of the request that triggered the vulnerability.
130 pub body: std::string::String,
131
132 /// Output only. The description of the vulnerability.
133 pub description: std::string::String,
134
135 /// Output only. The URL containing human-readable payload that user can leverage to
136 /// reproduce the vulnerability.
137 pub reproduction_url: std::string::String,
138
139 /// Output only. If the vulnerability was originated from nested IFrame, the immediate
140 /// parent IFrame is reported.
141 pub frame_url: std::string::String,
142
143 /// Output only. The URL where the browser lands when the vulnerability is detected.
144 pub final_url: std::string::String,
145
146 /// Output only. The tracking ID uniquely identifies a vulnerability instance across
147 /// multiple ScanRuns.
148 pub tracking_id: std::string::String,
149
150 /// Output only. An addon containing information reported for a vulnerability with an HTML
151 /// form, if any.
152 pub form: std::option::Option<crate::model::Form>,
153
154 /// Output only. An addon containing information about outdated libraries.
155 pub outdated_library: std::option::Option<crate::model::OutdatedLibrary>,
156
157 /// Output only. An addon containing detailed information regarding any resource causing the
158 /// vulnerability such as JavaScript sources, image, audio files, etc.
159 pub violating_resource: std::option::Option<crate::model::ViolatingResource>,
160
161 /// Output only. An addon containing information about vulnerable or missing HTTP headers.
162 pub vulnerable_headers: std::option::Option<crate::model::VulnerableHeaders>,
163
164 /// Output only. An addon containing information about request parameters which were found
165 /// to be vulnerable.
166 pub vulnerable_parameters: std::option::Option<crate::model::VulnerableParameters>,
167
168 /// Output only. An addon containing information reported for an XSS, if any.
169 pub xss: std::option::Option<crate::model::Xss>,
170
171 /// Output only. An addon containing information reported for an XXE, if any.
172 pub xxe: std::option::Option<crate::model::Xxe>,
173
174 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
175}
176
177impl Finding {
178 /// Creates a new default instance.
179 pub fn new() -> Self {
180 std::default::Default::default()
181 }
182
183 /// Sets the value of [name][crate::model::Finding::name].
184 ///
185 /// # Example
186 /// ```ignore,no_run
187 /// # use google_cloud_websecurityscanner_v1::model::Finding;
188 /// # let project_id = "project_id";
189 /// # let scan_config_id = "scan_config_id";
190 /// # let scan_run_id = "scan_run_id";
191 /// # let finding_id = "finding_id";
192 /// let x = Finding::new().set_name(format!("projects/{project_id}/scanConfigs/{scan_config_id}/scanRuns/{scan_run_id}/findings/{finding_id}"));
193 /// ```
194 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
195 self.name = v.into();
196 self
197 }
198
199 /// Sets the value of [finding_type][crate::model::Finding::finding_type].
200 ///
201 /// # Example
202 /// ```ignore,no_run
203 /// # use google_cloud_websecurityscanner_v1::model::Finding;
204 /// let x = Finding::new().set_finding_type("example");
205 /// ```
206 pub fn set_finding_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
207 self.finding_type = v.into();
208 self
209 }
210
211 /// Sets the value of [severity][crate::model::Finding::severity].
212 ///
213 /// # Example
214 /// ```ignore,no_run
215 /// # use google_cloud_websecurityscanner_v1::model::Finding;
216 /// use google_cloud_websecurityscanner_v1::model::finding::Severity;
217 /// let x0 = Finding::new().set_severity(Severity::Critical);
218 /// let x1 = Finding::new().set_severity(Severity::High);
219 /// let x2 = Finding::new().set_severity(Severity::Medium);
220 /// ```
221 pub fn set_severity<T: std::convert::Into<crate::model::finding::Severity>>(
222 mut self,
223 v: T,
224 ) -> Self {
225 self.severity = v.into();
226 self
227 }
228
229 /// Sets the value of [http_method][crate::model::Finding::http_method].
230 ///
231 /// # Example
232 /// ```ignore,no_run
233 /// # use google_cloud_websecurityscanner_v1::model::Finding;
234 /// let x = Finding::new().set_http_method("example");
235 /// ```
236 pub fn set_http_method<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
237 self.http_method = v.into();
238 self
239 }
240
241 /// Sets the value of [fuzzed_url][crate::model::Finding::fuzzed_url].
242 ///
243 /// # Example
244 /// ```ignore,no_run
245 /// # use google_cloud_websecurityscanner_v1::model::Finding;
246 /// let x = Finding::new().set_fuzzed_url("example");
247 /// ```
248 pub fn set_fuzzed_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
249 self.fuzzed_url = v.into();
250 self
251 }
252
253 /// Sets the value of [body][crate::model::Finding::body].
254 ///
255 /// # Example
256 /// ```ignore,no_run
257 /// # use google_cloud_websecurityscanner_v1::model::Finding;
258 /// let x = Finding::new().set_body("example");
259 /// ```
260 pub fn set_body<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
261 self.body = v.into();
262 self
263 }
264
265 /// Sets the value of [description][crate::model::Finding::description].
266 ///
267 /// # Example
268 /// ```ignore,no_run
269 /// # use google_cloud_websecurityscanner_v1::model::Finding;
270 /// let x = Finding::new().set_description("example");
271 /// ```
272 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
273 self.description = v.into();
274 self
275 }
276
277 /// Sets the value of [reproduction_url][crate::model::Finding::reproduction_url].
278 ///
279 /// # Example
280 /// ```ignore,no_run
281 /// # use google_cloud_websecurityscanner_v1::model::Finding;
282 /// let x = Finding::new().set_reproduction_url("example");
283 /// ```
284 pub fn set_reproduction_url<T: std::convert::Into<std::string::String>>(
285 mut self,
286 v: T,
287 ) -> Self {
288 self.reproduction_url = v.into();
289 self
290 }
291
292 /// Sets the value of [frame_url][crate::model::Finding::frame_url].
293 ///
294 /// # Example
295 /// ```ignore,no_run
296 /// # use google_cloud_websecurityscanner_v1::model::Finding;
297 /// let x = Finding::new().set_frame_url("example");
298 /// ```
299 pub fn set_frame_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
300 self.frame_url = v.into();
301 self
302 }
303
304 /// Sets the value of [final_url][crate::model::Finding::final_url].
305 ///
306 /// # Example
307 /// ```ignore,no_run
308 /// # use google_cloud_websecurityscanner_v1::model::Finding;
309 /// let x = Finding::new().set_final_url("example");
310 /// ```
311 pub fn set_final_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
312 self.final_url = v.into();
313 self
314 }
315
316 /// Sets the value of [tracking_id][crate::model::Finding::tracking_id].
317 ///
318 /// # Example
319 /// ```ignore,no_run
320 /// # use google_cloud_websecurityscanner_v1::model::Finding;
321 /// let x = Finding::new().set_tracking_id("example");
322 /// ```
323 pub fn set_tracking_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
324 self.tracking_id = v.into();
325 self
326 }
327
328 /// Sets the value of [form][crate::model::Finding::form].
329 ///
330 /// # Example
331 /// ```ignore,no_run
332 /// # use google_cloud_websecurityscanner_v1::model::Finding;
333 /// use google_cloud_websecurityscanner_v1::model::Form;
334 /// let x = Finding::new().set_form(Form::default()/* use setters */);
335 /// ```
336 pub fn set_form<T>(mut self, v: T) -> Self
337 where
338 T: std::convert::Into<crate::model::Form>,
339 {
340 self.form = std::option::Option::Some(v.into());
341 self
342 }
343
344 /// Sets or clears the value of [form][crate::model::Finding::form].
345 ///
346 /// # Example
347 /// ```ignore,no_run
348 /// # use google_cloud_websecurityscanner_v1::model::Finding;
349 /// use google_cloud_websecurityscanner_v1::model::Form;
350 /// let x = Finding::new().set_or_clear_form(Some(Form::default()/* use setters */));
351 /// let x = Finding::new().set_or_clear_form(None::<Form>);
352 /// ```
353 pub fn set_or_clear_form<T>(mut self, v: std::option::Option<T>) -> Self
354 where
355 T: std::convert::Into<crate::model::Form>,
356 {
357 self.form = v.map(|x| x.into());
358 self
359 }
360
361 /// Sets the value of [outdated_library][crate::model::Finding::outdated_library].
362 ///
363 /// # Example
364 /// ```ignore,no_run
365 /// # use google_cloud_websecurityscanner_v1::model::Finding;
366 /// use google_cloud_websecurityscanner_v1::model::OutdatedLibrary;
367 /// let x = Finding::new().set_outdated_library(OutdatedLibrary::default()/* use setters */);
368 /// ```
369 pub fn set_outdated_library<T>(mut self, v: T) -> Self
370 where
371 T: std::convert::Into<crate::model::OutdatedLibrary>,
372 {
373 self.outdated_library = std::option::Option::Some(v.into());
374 self
375 }
376
377 /// Sets or clears the value of [outdated_library][crate::model::Finding::outdated_library].
378 ///
379 /// # Example
380 /// ```ignore,no_run
381 /// # use google_cloud_websecurityscanner_v1::model::Finding;
382 /// use google_cloud_websecurityscanner_v1::model::OutdatedLibrary;
383 /// let x = Finding::new().set_or_clear_outdated_library(Some(OutdatedLibrary::default()/* use setters */));
384 /// let x = Finding::new().set_or_clear_outdated_library(None::<OutdatedLibrary>);
385 /// ```
386 pub fn set_or_clear_outdated_library<T>(mut self, v: std::option::Option<T>) -> Self
387 where
388 T: std::convert::Into<crate::model::OutdatedLibrary>,
389 {
390 self.outdated_library = v.map(|x| x.into());
391 self
392 }
393
394 /// Sets the value of [violating_resource][crate::model::Finding::violating_resource].
395 ///
396 /// # Example
397 /// ```ignore,no_run
398 /// # use google_cloud_websecurityscanner_v1::model::Finding;
399 /// use google_cloud_websecurityscanner_v1::model::ViolatingResource;
400 /// let x = Finding::new().set_violating_resource(ViolatingResource::default()/* use setters */);
401 /// ```
402 pub fn set_violating_resource<T>(mut self, v: T) -> Self
403 where
404 T: std::convert::Into<crate::model::ViolatingResource>,
405 {
406 self.violating_resource = std::option::Option::Some(v.into());
407 self
408 }
409
410 /// Sets or clears the value of [violating_resource][crate::model::Finding::violating_resource].
411 ///
412 /// # Example
413 /// ```ignore,no_run
414 /// # use google_cloud_websecurityscanner_v1::model::Finding;
415 /// use google_cloud_websecurityscanner_v1::model::ViolatingResource;
416 /// let x = Finding::new().set_or_clear_violating_resource(Some(ViolatingResource::default()/* use setters */));
417 /// let x = Finding::new().set_or_clear_violating_resource(None::<ViolatingResource>);
418 /// ```
419 pub fn set_or_clear_violating_resource<T>(mut self, v: std::option::Option<T>) -> Self
420 where
421 T: std::convert::Into<crate::model::ViolatingResource>,
422 {
423 self.violating_resource = v.map(|x| x.into());
424 self
425 }
426
427 /// Sets the value of [vulnerable_headers][crate::model::Finding::vulnerable_headers].
428 ///
429 /// # Example
430 /// ```ignore,no_run
431 /// # use google_cloud_websecurityscanner_v1::model::Finding;
432 /// use google_cloud_websecurityscanner_v1::model::VulnerableHeaders;
433 /// let x = Finding::new().set_vulnerable_headers(VulnerableHeaders::default()/* use setters */);
434 /// ```
435 pub fn set_vulnerable_headers<T>(mut self, v: T) -> Self
436 where
437 T: std::convert::Into<crate::model::VulnerableHeaders>,
438 {
439 self.vulnerable_headers = std::option::Option::Some(v.into());
440 self
441 }
442
443 /// Sets or clears the value of [vulnerable_headers][crate::model::Finding::vulnerable_headers].
444 ///
445 /// # Example
446 /// ```ignore,no_run
447 /// # use google_cloud_websecurityscanner_v1::model::Finding;
448 /// use google_cloud_websecurityscanner_v1::model::VulnerableHeaders;
449 /// let x = Finding::new().set_or_clear_vulnerable_headers(Some(VulnerableHeaders::default()/* use setters */));
450 /// let x = Finding::new().set_or_clear_vulnerable_headers(None::<VulnerableHeaders>);
451 /// ```
452 pub fn set_or_clear_vulnerable_headers<T>(mut self, v: std::option::Option<T>) -> Self
453 where
454 T: std::convert::Into<crate::model::VulnerableHeaders>,
455 {
456 self.vulnerable_headers = v.map(|x| x.into());
457 self
458 }
459
460 /// Sets the value of [vulnerable_parameters][crate::model::Finding::vulnerable_parameters].
461 ///
462 /// # Example
463 /// ```ignore,no_run
464 /// # use google_cloud_websecurityscanner_v1::model::Finding;
465 /// use google_cloud_websecurityscanner_v1::model::VulnerableParameters;
466 /// let x = Finding::new().set_vulnerable_parameters(VulnerableParameters::default()/* use setters */);
467 /// ```
468 pub fn set_vulnerable_parameters<T>(mut self, v: T) -> Self
469 where
470 T: std::convert::Into<crate::model::VulnerableParameters>,
471 {
472 self.vulnerable_parameters = std::option::Option::Some(v.into());
473 self
474 }
475
476 /// Sets or clears the value of [vulnerable_parameters][crate::model::Finding::vulnerable_parameters].
477 ///
478 /// # Example
479 /// ```ignore,no_run
480 /// # use google_cloud_websecurityscanner_v1::model::Finding;
481 /// use google_cloud_websecurityscanner_v1::model::VulnerableParameters;
482 /// let x = Finding::new().set_or_clear_vulnerable_parameters(Some(VulnerableParameters::default()/* use setters */));
483 /// let x = Finding::new().set_or_clear_vulnerable_parameters(None::<VulnerableParameters>);
484 /// ```
485 pub fn set_or_clear_vulnerable_parameters<T>(mut self, v: std::option::Option<T>) -> Self
486 where
487 T: std::convert::Into<crate::model::VulnerableParameters>,
488 {
489 self.vulnerable_parameters = v.map(|x| x.into());
490 self
491 }
492
493 /// Sets the value of [xss][crate::model::Finding::xss].
494 ///
495 /// # Example
496 /// ```ignore,no_run
497 /// # use google_cloud_websecurityscanner_v1::model::Finding;
498 /// use google_cloud_websecurityscanner_v1::model::Xss;
499 /// let x = Finding::new().set_xss(Xss::default()/* use setters */);
500 /// ```
501 pub fn set_xss<T>(mut self, v: T) -> Self
502 where
503 T: std::convert::Into<crate::model::Xss>,
504 {
505 self.xss = std::option::Option::Some(v.into());
506 self
507 }
508
509 /// Sets or clears the value of [xss][crate::model::Finding::xss].
510 ///
511 /// # Example
512 /// ```ignore,no_run
513 /// # use google_cloud_websecurityscanner_v1::model::Finding;
514 /// use google_cloud_websecurityscanner_v1::model::Xss;
515 /// let x = Finding::new().set_or_clear_xss(Some(Xss::default()/* use setters */));
516 /// let x = Finding::new().set_or_clear_xss(None::<Xss>);
517 /// ```
518 pub fn set_or_clear_xss<T>(mut self, v: std::option::Option<T>) -> Self
519 where
520 T: std::convert::Into<crate::model::Xss>,
521 {
522 self.xss = v.map(|x| x.into());
523 self
524 }
525
526 /// Sets the value of [xxe][crate::model::Finding::xxe].
527 ///
528 /// # Example
529 /// ```ignore,no_run
530 /// # use google_cloud_websecurityscanner_v1::model::Finding;
531 /// use google_cloud_websecurityscanner_v1::model::Xxe;
532 /// let x = Finding::new().set_xxe(Xxe::default()/* use setters */);
533 /// ```
534 pub fn set_xxe<T>(mut self, v: T) -> Self
535 where
536 T: std::convert::Into<crate::model::Xxe>,
537 {
538 self.xxe = std::option::Option::Some(v.into());
539 self
540 }
541
542 /// Sets or clears the value of [xxe][crate::model::Finding::xxe].
543 ///
544 /// # Example
545 /// ```ignore,no_run
546 /// # use google_cloud_websecurityscanner_v1::model::Finding;
547 /// use google_cloud_websecurityscanner_v1::model::Xxe;
548 /// let x = Finding::new().set_or_clear_xxe(Some(Xxe::default()/* use setters */));
549 /// let x = Finding::new().set_or_clear_xxe(None::<Xxe>);
550 /// ```
551 pub fn set_or_clear_xxe<T>(mut self, v: std::option::Option<T>) -> Self
552 where
553 T: std::convert::Into<crate::model::Xxe>,
554 {
555 self.xxe = v.map(|x| x.into());
556 self
557 }
558}
559
560impl wkt::message::Message for Finding {
561 fn typename() -> &'static str {
562 "type.googleapis.com/google.cloud.websecurityscanner.v1.Finding"
563 }
564}
565
566/// Defines additional types related to [Finding].
567pub mod finding {
568 #[allow(unused_imports)]
569 use super::*;
570
571 /// The severity level of a vulnerability.
572 ///
573 /// # Working with unknown values
574 ///
575 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
576 /// additional enum variants at any time. Adding new variants is not considered
577 /// a breaking change. Applications should write their code in anticipation of:
578 ///
579 /// - New values appearing in future releases of the client library, **and**
580 /// - New values received dynamically, without application changes.
581 ///
582 /// Please consult the [Working with enums] section in the user guide for some
583 /// guidelines.
584 ///
585 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
586 #[derive(Clone, Debug, PartialEq)]
587 #[non_exhaustive]
588 pub enum Severity {
589 /// No severity specified. The default value.
590 Unspecified,
591 /// Critical severity.
592 Critical,
593 /// High severity.
594 High,
595 /// Medium severity.
596 Medium,
597 /// Low severity.
598 Low,
599 /// If set, the enum was initialized with an unknown value.
600 ///
601 /// Applications can examine the value using [Severity::value] or
602 /// [Severity::name].
603 UnknownValue(severity::UnknownValue),
604 }
605
606 #[doc(hidden)]
607 pub mod severity {
608 #[allow(unused_imports)]
609 use super::*;
610 #[derive(Clone, Debug, PartialEq)]
611 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
612 }
613
614 impl Severity {
615 /// Gets the enum value.
616 ///
617 /// Returns `None` if the enum contains an unknown value deserialized from
618 /// the string representation of enums.
619 pub fn value(&self) -> std::option::Option<i32> {
620 match self {
621 Self::Unspecified => std::option::Option::Some(0),
622 Self::Critical => std::option::Option::Some(1),
623 Self::High => std::option::Option::Some(2),
624 Self::Medium => std::option::Option::Some(3),
625 Self::Low => std::option::Option::Some(4),
626 Self::UnknownValue(u) => u.0.value(),
627 }
628 }
629
630 /// Gets the enum value as a string.
631 ///
632 /// Returns `None` if the enum contains an unknown value deserialized from
633 /// the integer representation of enums.
634 pub fn name(&self) -> std::option::Option<&str> {
635 match self {
636 Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
637 Self::Critical => std::option::Option::Some("CRITICAL"),
638 Self::High => std::option::Option::Some("HIGH"),
639 Self::Medium => std::option::Option::Some("MEDIUM"),
640 Self::Low => std::option::Option::Some("LOW"),
641 Self::UnknownValue(u) => u.0.name(),
642 }
643 }
644 }
645
646 impl std::default::Default for Severity {
647 fn default() -> Self {
648 use std::convert::From;
649 Self::from(0)
650 }
651 }
652
653 impl std::fmt::Display for Severity {
654 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
655 wkt::internal::display_enum(f, self.name(), self.value())
656 }
657 }
658
659 impl std::convert::From<i32> for Severity {
660 fn from(value: i32) -> Self {
661 match value {
662 0 => Self::Unspecified,
663 1 => Self::Critical,
664 2 => Self::High,
665 3 => Self::Medium,
666 4 => Self::Low,
667 _ => Self::UnknownValue(severity::UnknownValue(
668 wkt::internal::UnknownEnumValue::Integer(value),
669 )),
670 }
671 }
672 }
673
674 impl std::convert::From<&str> for Severity {
675 fn from(value: &str) -> Self {
676 use std::string::ToString;
677 match value {
678 "SEVERITY_UNSPECIFIED" => Self::Unspecified,
679 "CRITICAL" => Self::Critical,
680 "HIGH" => Self::High,
681 "MEDIUM" => Self::Medium,
682 "LOW" => Self::Low,
683 _ => Self::UnknownValue(severity::UnknownValue(
684 wkt::internal::UnknownEnumValue::String(value.to_string()),
685 )),
686 }
687 }
688 }
689
690 impl serde::ser::Serialize for Severity {
691 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
692 where
693 S: serde::Serializer,
694 {
695 match self {
696 Self::Unspecified => serializer.serialize_i32(0),
697 Self::Critical => serializer.serialize_i32(1),
698 Self::High => serializer.serialize_i32(2),
699 Self::Medium => serializer.serialize_i32(3),
700 Self::Low => serializer.serialize_i32(4),
701 Self::UnknownValue(u) => u.0.serialize(serializer),
702 }
703 }
704 }
705
706 impl<'de> serde::de::Deserialize<'de> for Severity {
707 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
708 where
709 D: serde::Deserializer<'de>,
710 {
711 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
712 ".google.cloud.websecurityscanner.v1.Finding.Severity",
713 ))
714 }
715 }
716}
717
718/// ! Information about a vulnerability with an HTML.
719#[derive(Clone, Default, PartialEq)]
720#[non_exhaustive]
721pub struct Form {
722 /// ! The URI where to send the form when it's submitted.
723 pub action_uri: std::string::String,
724
725 /// ! The names of form fields related to the vulnerability.
726 pub fields: std::vec::Vec<std::string::String>,
727
728 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
729}
730
731impl Form {
732 /// Creates a new default instance.
733 pub fn new() -> Self {
734 std::default::Default::default()
735 }
736
737 /// Sets the value of [action_uri][crate::model::Form::action_uri].
738 ///
739 /// # Example
740 /// ```ignore,no_run
741 /// # use google_cloud_websecurityscanner_v1::model::Form;
742 /// let x = Form::new().set_action_uri("example");
743 /// ```
744 pub fn set_action_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
745 self.action_uri = v.into();
746 self
747 }
748
749 /// Sets the value of [fields][crate::model::Form::fields].
750 ///
751 /// # Example
752 /// ```ignore,no_run
753 /// # use google_cloud_websecurityscanner_v1::model::Form;
754 /// let x = Form::new().set_fields(["a", "b", "c"]);
755 /// ```
756 pub fn set_fields<T, V>(mut self, v: T) -> Self
757 where
758 T: std::iter::IntoIterator<Item = V>,
759 V: std::convert::Into<std::string::String>,
760 {
761 use std::iter::Iterator;
762 self.fields = v.into_iter().map(|i| i.into()).collect();
763 self
764 }
765}
766
767impl wkt::message::Message for Form {
768 fn typename() -> &'static str {
769 "type.googleapis.com/google.cloud.websecurityscanner.v1.Form"
770 }
771}
772
773/// Information reported for an outdated library.
774#[derive(Clone, Default, PartialEq)]
775#[non_exhaustive]
776pub struct OutdatedLibrary {
777 /// The name of the outdated library.
778 pub library_name: std::string::String,
779
780 /// The version number.
781 pub version: std::string::String,
782
783 /// URLs to learn more information about the vulnerabilities in the library.
784 pub learn_more_urls: std::vec::Vec<std::string::String>,
785
786 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
787}
788
789impl OutdatedLibrary {
790 /// Creates a new default instance.
791 pub fn new() -> Self {
792 std::default::Default::default()
793 }
794
795 /// Sets the value of [library_name][crate::model::OutdatedLibrary::library_name].
796 ///
797 /// # Example
798 /// ```ignore,no_run
799 /// # use google_cloud_websecurityscanner_v1::model::OutdatedLibrary;
800 /// let x = OutdatedLibrary::new().set_library_name("example");
801 /// ```
802 pub fn set_library_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
803 self.library_name = v.into();
804 self
805 }
806
807 /// Sets the value of [version][crate::model::OutdatedLibrary::version].
808 ///
809 /// # Example
810 /// ```ignore,no_run
811 /// # use google_cloud_websecurityscanner_v1::model::OutdatedLibrary;
812 /// let x = OutdatedLibrary::new().set_version("example");
813 /// ```
814 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
815 self.version = v.into();
816 self
817 }
818
819 /// Sets the value of [learn_more_urls][crate::model::OutdatedLibrary::learn_more_urls].
820 ///
821 /// # Example
822 /// ```ignore,no_run
823 /// # use google_cloud_websecurityscanner_v1::model::OutdatedLibrary;
824 /// let x = OutdatedLibrary::new().set_learn_more_urls(["a", "b", "c"]);
825 /// ```
826 pub fn set_learn_more_urls<T, V>(mut self, v: T) -> Self
827 where
828 T: std::iter::IntoIterator<Item = V>,
829 V: std::convert::Into<std::string::String>,
830 {
831 use std::iter::Iterator;
832 self.learn_more_urls = v.into_iter().map(|i| i.into()).collect();
833 self
834 }
835}
836
837impl wkt::message::Message for OutdatedLibrary {
838 fn typename() -> &'static str {
839 "type.googleapis.com/google.cloud.websecurityscanner.v1.OutdatedLibrary"
840 }
841}
842
843/// Information regarding any resource causing the vulnerability such
844/// as JavaScript sources, image, audio files, etc.
845#[derive(Clone, Default, PartialEq)]
846#[non_exhaustive]
847pub struct ViolatingResource {
848 /// The MIME type of this resource.
849 pub content_type: std::string::String,
850
851 /// URL of this violating resource.
852 pub resource_url: std::string::String,
853
854 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
855}
856
857impl ViolatingResource {
858 /// Creates a new default instance.
859 pub fn new() -> Self {
860 std::default::Default::default()
861 }
862
863 /// Sets the value of [content_type][crate::model::ViolatingResource::content_type].
864 ///
865 /// # Example
866 /// ```ignore,no_run
867 /// # use google_cloud_websecurityscanner_v1::model::ViolatingResource;
868 /// let x = ViolatingResource::new().set_content_type("example");
869 /// ```
870 pub fn set_content_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
871 self.content_type = v.into();
872 self
873 }
874
875 /// Sets the value of [resource_url][crate::model::ViolatingResource::resource_url].
876 ///
877 /// # Example
878 /// ```ignore,no_run
879 /// # use google_cloud_websecurityscanner_v1::model::ViolatingResource;
880 /// let x = ViolatingResource::new().set_resource_url("example");
881 /// ```
882 pub fn set_resource_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
883 self.resource_url = v.into();
884 self
885 }
886}
887
888impl wkt::message::Message for ViolatingResource {
889 fn typename() -> &'static str {
890 "type.googleapis.com/google.cloud.websecurityscanner.v1.ViolatingResource"
891 }
892}
893
894/// Information about vulnerable request parameters.
895#[derive(Clone, Default, PartialEq)]
896#[non_exhaustive]
897pub struct VulnerableParameters {
898 /// The vulnerable parameter names.
899 pub parameter_names: std::vec::Vec<std::string::String>,
900
901 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
902}
903
904impl VulnerableParameters {
905 /// Creates a new default instance.
906 pub fn new() -> Self {
907 std::default::Default::default()
908 }
909
910 /// Sets the value of [parameter_names][crate::model::VulnerableParameters::parameter_names].
911 ///
912 /// # Example
913 /// ```ignore,no_run
914 /// # use google_cloud_websecurityscanner_v1::model::VulnerableParameters;
915 /// let x = VulnerableParameters::new().set_parameter_names(["a", "b", "c"]);
916 /// ```
917 pub fn set_parameter_names<T, V>(mut self, v: T) -> Self
918 where
919 T: std::iter::IntoIterator<Item = V>,
920 V: std::convert::Into<std::string::String>,
921 {
922 use std::iter::Iterator;
923 self.parameter_names = v.into_iter().map(|i| i.into()).collect();
924 self
925 }
926}
927
928impl wkt::message::Message for VulnerableParameters {
929 fn typename() -> &'static str {
930 "type.googleapis.com/google.cloud.websecurityscanner.v1.VulnerableParameters"
931 }
932}
933
934/// Information about vulnerable or missing HTTP Headers.
935#[derive(Clone, Default, PartialEq)]
936#[non_exhaustive]
937pub struct VulnerableHeaders {
938 /// List of vulnerable headers.
939 pub headers: std::vec::Vec<crate::model::vulnerable_headers::Header>,
940
941 /// List of missing headers.
942 pub missing_headers: std::vec::Vec<crate::model::vulnerable_headers::Header>,
943
944 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
945}
946
947impl VulnerableHeaders {
948 /// Creates a new default instance.
949 pub fn new() -> Self {
950 std::default::Default::default()
951 }
952
953 /// Sets the value of [headers][crate::model::VulnerableHeaders::headers].
954 ///
955 /// # Example
956 /// ```ignore,no_run
957 /// # use google_cloud_websecurityscanner_v1::model::VulnerableHeaders;
958 /// use google_cloud_websecurityscanner_v1::model::vulnerable_headers::Header;
959 /// let x = VulnerableHeaders::new()
960 /// .set_headers([
961 /// Header::default()/* use setters */,
962 /// Header::default()/* use (different) setters */,
963 /// ]);
964 /// ```
965 pub fn set_headers<T, V>(mut self, v: T) -> Self
966 where
967 T: std::iter::IntoIterator<Item = V>,
968 V: std::convert::Into<crate::model::vulnerable_headers::Header>,
969 {
970 use std::iter::Iterator;
971 self.headers = v.into_iter().map(|i| i.into()).collect();
972 self
973 }
974
975 /// Sets the value of [missing_headers][crate::model::VulnerableHeaders::missing_headers].
976 ///
977 /// # Example
978 /// ```ignore,no_run
979 /// # use google_cloud_websecurityscanner_v1::model::VulnerableHeaders;
980 /// use google_cloud_websecurityscanner_v1::model::vulnerable_headers::Header;
981 /// let x = VulnerableHeaders::new()
982 /// .set_missing_headers([
983 /// Header::default()/* use setters */,
984 /// Header::default()/* use (different) setters */,
985 /// ]);
986 /// ```
987 pub fn set_missing_headers<T, V>(mut self, v: T) -> Self
988 where
989 T: std::iter::IntoIterator<Item = V>,
990 V: std::convert::Into<crate::model::vulnerable_headers::Header>,
991 {
992 use std::iter::Iterator;
993 self.missing_headers = v.into_iter().map(|i| i.into()).collect();
994 self
995 }
996}
997
998impl wkt::message::Message for VulnerableHeaders {
999 fn typename() -> &'static str {
1000 "type.googleapis.com/google.cloud.websecurityscanner.v1.VulnerableHeaders"
1001 }
1002}
1003
1004/// Defines additional types related to [VulnerableHeaders].
1005pub mod vulnerable_headers {
1006 #[allow(unused_imports)]
1007 use super::*;
1008
1009 /// Describes a HTTP Header.
1010 #[derive(Clone, Default, PartialEq)]
1011 #[non_exhaustive]
1012 pub struct Header {
1013 /// Header name.
1014 pub name: std::string::String,
1015
1016 /// Header value.
1017 pub value: std::string::String,
1018
1019 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1020 }
1021
1022 impl Header {
1023 /// Creates a new default instance.
1024 pub fn new() -> Self {
1025 std::default::Default::default()
1026 }
1027
1028 /// Sets the value of [name][crate::model::vulnerable_headers::Header::name].
1029 ///
1030 /// # Example
1031 /// ```ignore,no_run
1032 /// # use google_cloud_websecurityscanner_v1::model::vulnerable_headers::Header;
1033 /// let x = Header::new().set_name("example");
1034 /// ```
1035 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1036 self.name = v.into();
1037 self
1038 }
1039
1040 /// Sets the value of [value][crate::model::vulnerable_headers::Header::value].
1041 ///
1042 /// # Example
1043 /// ```ignore,no_run
1044 /// # use google_cloud_websecurityscanner_v1::model::vulnerable_headers::Header;
1045 /// let x = Header::new().set_value("example");
1046 /// ```
1047 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1048 self.value = v.into();
1049 self
1050 }
1051 }
1052
1053 impl wkt::message::Message for Header {
1054 fn typename() -> &'static str {
1055 "type.googleapis.com/google.cloud.websecurityscanner.v1.VulnerableHeaders.Header"
1056 }
1057 }
1058}
1059
1060/// Information reported for an XSS.
1061#[derive(Clone, Default, PartialEq)]
1062#[non_exhaustive]
1063pub struct Xss {
1064 /// Stack traces leading to the point where the XSS occurred.
1065 pub stack_traces: std::vec::Vec<std::string::String>,
1066
1067 /// An error message generated by a javascript breakage.
1068 pub error_message: std::string::String,
1069
1070 /// The attack vector of the payload triggering this XSS.
1071 pub attack_vector: crate::model::xss::AttackVector,
1072
1073 /// The reproduction url for the seeding POST request of a Stored XSS.
1074 pub stored_xss_seeding_url: std::string::String,
1075
1076 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1077}
1078
1079impl Xss {
1080 /// Creates a new default instance.
1081 pub fn new() -> Self {
1082 std::default::Default::default()
1083 }
1084
1085 /// Sets the value of [stack_traces][crate::model::Xss::stack_traces].
1086 ///
1087 /// # Example
1088 /// ```ignore,no_run
1089 /// # use google_cloud_websecurityscanner_v1::model::Xss;
1090 /// let x = Xss::new().set_stack_traces(["a", "b", "c"]);
1091 /// ```
1092 pub fn set_stack_traces<T, V>(mut self, v: T) -> Self
1093 where
1094 T: std::iter::IntoIterator<Item = V>,
1095 V: std::convert::Into<std::string::String>,
1096 {
1097 use std::iter::Iterator;
1098 self.stack_traces = v.into_iter().map(|i| i.into()).collect();
1099 self
1100 }
1101
1102 /// Sets the value of [error_message][crate::model::Xss::error_message].
1103 ///
1104 /// # Example
1105 /// ```ignore,no_run
1106 /// # use google_cloud_websecurityscanner_v1::model::Xss;
1107 /// let x = Xss::new().set_error_message("example");
1108 /// ```
1109 pub fn set_error_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1110 self.error_message = v.into();
1111 self
1112 }
1113
1114 /// Sets the value of [attack_vector][crate::model::Xss::attack_vector].
1115 ///
1116 /// # Example
1117 /// ```ignore,no_run
1118 /// # use google_cloud_websecurityscanner_v1::model::Xss;
1119 /// use google_cloud_websecurityscanner_v1::model::xss::AttackVector;
1120 /// let x0 = Xss::new().set_attack_vector(AttackVector::LocalStorage);
1121 /// let x1 = Xss::new().set_attack_vector(AttackVector::SessionStorage);
1122 /// let x2 = Xss::new().set_attack_vector(AttackVector::WindowName);
1123 /// ```
1124 pub fn set_attack_vector<T: std::convert::Into<crate::model::xss::AttackVector>>(
1125 mut self,
1126 v: T,
1127 ) -> Self {
1128 self.attack_vector = v.into();
1129 self
1130 }
1131
1132 /// Sets the value of [stored_xss_seeding_url][crate::model::Xss::stored_xss_seeding_url].
1133 ///
1134 /// # Example
1135 /// ```ignore,no_run
1136 /// # use google_cloud_websecurityscanner_v1::model::Xss;
1137 /// let x = Xss::new().set_stored_xss_seeding_url("example");
1138 /// ```
1139 pub fn set_stored_xss_seeding_url<T: std::convert::Into<std::string::String>>(
1140 mut self,
1141 v: T,
1142 ) -> Self {
1143 self.stored_xss_seeding_url = v.into();
1144 self
1145 }
1146}
1147
1148impl wkt::message::Message for Xss {
1149 fn typename() -> &'static str {
1150 "type.googleapis.com/google.cloud.websecurityscanner.v1.Xss"
1151 }
1152}
1153
1154/// Defines additional types related to [Xss].
1155pub mod xss {
1156 #[allow(unused_imports)]
1157 use super::*;
1158
1159 /// Types of XSS attack vector.
1160 ///
1161 /// # Working with unknown values
1162 ///
1163 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1164 /// additional enum variants at any time. Adding new variants is not considered
1165 /// a breaking change. Applications should write their code in anticipation of:
1166 ///
1167 /// - New values appearing in future releases of the client library, **and**
1168 /// - New values received dynamically, without application changes.
1169 ///
1170 /// Please consult the [Working with enums] section in the user guide for some
1171 /// guidelines.
1172 ///
1173 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1174 #[derive(Clone, Debug, PartialEq)]
1175 #[non_exhaustive]
1176 pub enum AttackVector {
1177 /// Unknown attack vector.
1178 Unspecified,
1179 /// The attack comes from fuzzing the browser's localStorage.
1180 LocalStorage,
1181 /// The attack comes from fuzzing the browser's sessionStorage.
1182 SessionStorage,
1183 /// The attack comes from fuzzing the window's name property.
1184 WindowName,
1185 /// The attack comes from fuzzing the referrer property.
1186 Referrer,
1187 /// The attack comes from fuzzing an input element.
1188 FormInput,
1189 /// The attack comes from fuzzing the browser's cookies.
1190 Cookie,
1191 /// The attack comes from hijacking the post messaging mechanism.
1192 PostMessage,
1193 /// The attack comes from fuzzing parameters in the url.
1194 GetParameters,
1195 /// The attack comes from fuzzing the fragment in the url.
1196 UrlFragment,
1197 /// The attack comes from fuzzing the HTML comments.
1198 HtmlComment,
1199 /// The attack comes from fuzzing the POST parameters.
1200 PostParameters,
1201 /// The attack comes from fuzzing the protocol.
1202 Protocol,
1203 /// The attack comes from the server side and is stored.
1204 StoredXss,
1205 /// The attack is a Same-Origin Method Execution attack via a GET parameter.
1206 SameOrigin,
1207 /// The attack payload is received from a third-party host via a URL that is
1208 /// user-controllable
1209 UserControllableUrl,
1210 /// If set, the enum was initialized with an unknown value.
1211 ///
1212 /// Applications can examine the value using [AttackVector::value] or
1213 /// [AttackVector::name].
1214 UnknownValue(attack_vector::UnknownValue),
1215 }
1216
1217 #[doc(hidden)]
1218 pub mod attack_vector {
1219 #[allow(unused_imports)]
1220 use super::*;
1221 #[derive(Clone, Debug, PartialEq)]
1222 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1223 }
1224
1225 impl AttackVector {
1226 /// Gets the enum value.
1227 ///
1228 /// Returns `None` if the enum contains an unknown value deserialized from
1229 /// the string representation of enums.
1230 pub fn value(&self) -> std::option::Option<i32> {
1231 match self {
1232 Self::Unspecified => std::option::Option::Some(0),
1233 Self::LocalStorage => std::option::Option::Some(1),
1234 Self::SessionStorage => std::option::Option::Some(2),
1235 Self::WindowName => std::option::Option::Some(3),
1236 Self::Referrer => std::option::Option::Some(4),
1237 Self::FormInput => std::option::Option::Some(5),
1238 Self::Cookie => std::option::Option::Some(6),
1239 Self::PostMessage => std::option::Option::Some(7),
1240 Self::GetParameters => std::option::Option::Some(8),
1241 Self::UrlFragment => std::option::Option::Some(9),
1242 Self::HtmlComment => std::option::Option::Some(10),
1243 Self::PostParameters => std::option::Option::Some(11),
1244 Self::Protocol => std::option::Option::Some(12),
1245 Self::StoredXss => std::option::Option::Some(13),
1246 Self::SameOrigin => std::option::Option::Some(14),
1247 Self::UserControllableUrl => std::option::Option::Some(15),
1248 Self::UnknownValue(u) => u.0.value(),
1249 }
1250 }
1251
1252 /// Gets the enum value as a string.
1253 ///
1254 /// Returns `None` if the enum contains an unknown value deserialized from
1255 /// the integer representation of enums.
1256 pub fn name(&self) -> std::option::Option<&str> {
1257 match self {
1258 Self::Unspecified => std::option::Option::Some("ATTACK_VECTOR_UNSPECIFIED"),
1259 Self::LocalStorage => std::option::Option::Some("LOCAL_STORAGE"),
1260 Self::SessionStorage => std::option::Option::Some("SESSION_STORAGE"),
1261 Self::WindowName => std::option::Option::Some("WINDOW_NAME"),
1262 Self::Referrer => std::option::Option::Some("REFERRER"),
1263 Self::FormInput => std::option::Option::Some("FORM_INPUT"),
1264 Self::Cookie => std::option::Option::Some("COOKIE"),
1265 Self::PostMessage => std::option::Option::Some("POST_MESSAGE"),
1266 Self::GetParameters => std::option::Option::Some("GET_PARAMETERS"),
1267 Self::UrlFragment => std::option::Option::Some("URL_FRAGMENT"),
1268 Self::HtmlComment => std::option::Option::Some("HTML_COMMENT"),
1269 Self::PostParameters => std::option::Option::Some("POST_PARAMETERS"),
1270 Self::Protocol => std::option::Option::Some("PROTOCOL"),
1271 Self::StoredXss => std::option::Option::Some("STORED_XSS"),
1272 Self::SameOrigin => std::option::Option::Some("SAME_ORIGIN"),
1273 Self::UserControllableUrl => std::option::Option::Some("USER_CONTROLLABLE_URL"),
1274 Self::UnknownValue(u) => u.0.name(),
1275 }
1276 }
1277 }
1278
1279 impl std::default::Default for AttackVector {
1280 fn default() -> Self {
1281 use std::convert::From;
1282 Self::from(0)
1283 }
1284 }
1285
1286 impl std::fmt::Display for AttackVector {
1287 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1288 wkt::internal::display_enum(f, self.name(), self.value())
1289 }
1290 }
1291
1292 impl std::convert::From<i32> for AttackVector {
1293 fn from(value: i32) -> Self {
1294 match value {
1295 0 => Self::Unspecified,
1296 1 => Self::LocalStorage,
1297 2 => Self::SessionStorage,
1298 3 => Self::WindowName,
1299 4 => Self::Referrer,
1300 5 => Self::FormInput,
1301 6 => Self::Cookie,
1302 7 => Self::PostMessage,
1303 8 => Self::GetParameters,
1304 9 => Self::UrlFragment,
1305 10 => Self::HtmlComment,
1306 11 => Self::PostParameters,
1307 12 => Self::Protocol,
1308 13 => Self::StoredXss,
1309 14 => Self::SameOrigin,
1310 15 => Self::UserControllableUrl,
1311 _ => Self::UnknownValue(attack_vector::UnknownValue(
1312 wkt::internal::UnknownEnumValue::Integer(value),
1313 )),
1314 }
1315 }
1316 }
1317
1318 impl std::convert::From<&str> for AttackVector {
1319 fn from(value: &str) -> Self {
1320 use std::string::ToString;
1321 match value {
1322 "ATTACK_VECTOR_UNSPECIFIED" => Self::Unspecified,
1323 "LOCAL_STORAGE" => Self::LocalStorage,
1324 "SESSION_STORAGE" => Self::SessionStorage,
1325 "WINDOW_NAME" => Self::WindowName,
1326 "REFERRER" => Self::Referrer,
1327 "FORM_INPUT" => Self::FormInput,
1328 "COOKIE" => Self::Cookie,
1329 "POST_MESSAGE" => Self::PostMessage,
1330 "GET_PARAMETERS" => Self::GetParameters,
1331 "URL_FRAGMENT" => Self::UrlFragment,
1332 "HTML_COMMENT" => Self::HtmlComment,
1333 "POST_PARAMETERS" => Self::PostParameters,
1334 "PROTOCOL" => Self::Protocol,
1335 "STORED_XSS" => Self::StoredXss,
1336 "SAME_ORIGIN" => Self::SameOrigin,
1337 "USER_CONTROLLABLE_URL" => Self::UserControllableUrl,
1338 _ => Self::UnknownValue(attack_vector::UnknownValue(
1339 wkt::internal::UnknownEnumValue::String(value.to_string()),
1340 )),
1341 }
1342 }
1343 }
1344
1345 impl serde::ser::Serialize for AttackVector {
1346 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1347 where
1348 S: serde::Serializer,
1349 {
1350 match self {
1351 Self::Unspecified => serializer.serialize_i32(0),
1352 Self::LocalStorage => serializer.serialize_i32(1),
1353 Self::SessionStorage => serializer.serialize_i32(2),
1354 Self::WindowName => serializer.serialize_i32(3),
1355 Self::Referrer => serializer.serialize_i32(4),
1356 Self::FormInput => serializer.serialize_i32(5),
1357 Self::Cookie => serializer.serialize_i32(6),
1358 Self::PostMessage => serializer.serialize_i32(7),
1359 Self::GetParameters => serializer.serialize_i32(8),
1360 Self::UrlFragment => serializer.serialize_i32(9),
1361 Self::HtmlComment => serializer.serialize_i32(10),
1362 Self::PostParameters => serializer.serialize_i32(11),
1363 Self::Protocol => serializer.serialize_i32(12),
1364 Self::StoredXss => serializer.serialize_i32(13),
1365 Self::SameOrigin => serializer.serialize_i32(14),
1366 Self::UserControllableUrl => serializer.serialize_i32(15),
1367 Self::UnknownValue(u) => u.0.serialize(serializer),
1368 }
1369 }
1370 }
1371
1372 impl<'de> serde::de::Deserialize<'de> for AttackVector {
1373 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1374 where
1375 D: serde::Deserializer<'de>,
1376 {
1377 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttackVector>::new(
1378 ".google.cloud.websecurityscanner.v1.Xss.AttackVector",
1379 ))
1380 }
1381 }
1382}
1383
1384/// Information reported for an XXE.
1385#[derive(Clone, Default, PartialEq)]
1386#[non_exhaustive]
1387pub struct Xxe {
1388 /// The XML string that triggered the XXE vulnerability. Non-payload values
1389 /// might be redacted.
1390 pub payload_value: std::string::String,
1391
1392 /// Location within the request where the payload was placed.
1393 pub payload_location: crate::model::xxe::Location,
1394
1395 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1396}
1397
1398impl Xxe {
1399 /// Creates a new default instance.
1400 pub fn new() -> Self {
1401 std::default::Default::default()
1402 }
1403
1404 /// Sets the value of [payload_value][crate::model::Xxe::payload_value].
1405 ///
1406 /// # Example
1407 /// ```ignore,no_run
1408 /// # use google_cloud_websecurityscanner_v1::model::Xxe;
1409 /// let x = Xxe::new().set_payload_value("example");
1410 /// ```
1411 pub fn set_payload_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1412 self.payload_value = v.into();
1413 self
1414 }
1415
1416 /// Sets the value of [payload_location][crate::model::Xxe::payload_location].
1417 ///
1418 /// # Example
1419 /// ```ignore,no_run
1420 /// # use google_cloud_websecurityscanner_v1::model::Xxe;
1421 /// use google_cloud_websecurityscanner_v1::model::xxe::Location;
1422 /// let x0 = Xxe::new().set_payload_location(Location::CompleteRequestBody);
1423 /// ```
1424 pub fn set_payload_location<T: std::convert::Into<crate::model::xxe::Location>>(
1425 mut self,
1426 v: T,
1427 ) -> Self {
1428 self.payload_location = v.into();
1429 self
1430 }
1431}
1432
1433impl wkt::message::Message for Xxe {
1434 fn typename() -> &'static str {
1435 "type.googleapis.com/google.cloud.websecurityscanner.v1.Xxe"
1436 }
1437}
1438
1439/// Defines additional types related to [Xxe].
1440pub mod xxe {
1441 #[allow(unused_imports)]
1442 use super::*;
1443
1444 /// Locations within a request where XML was substituted.
1445 ///
1446 /// # Working with unknown values
1447 ///
1448 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1449 /// additional enum variants at any time. Adding new variants is not considered
1450 /// a breaking change. Applications should write their code in anticipation of:
1451 ///
1452 /// - New values appearing in future releases of the client library, **and**
1453 /// - New values received dynamically, without application changes.
1454 ///
1455 /// Please consult the [Working with enums] section in the user guide for some
1456 /// guidelines.
1457 ///
1458 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1459 #[derive(Clone, Debug, PartialEq)]
1460 #[non_exhaustive]
1461 pub enum Location {
1462 /// Unknown Location.
1463 Unspecified,
1464 /// The XML payload replaced the complete request body.
1465 CompleteRequestBody,
1466 /// If set, the enum was initialized with an unknown value.
1467 ///
1468 /// Applications can examine the value using [Location::value] or
1469 /// [Location::name].
1470 UnknownValue(location::UnknownValue),
1471 }
1472
1473 #[doc(hidden)]
1474 pub mod location {
1475 #[allow(unused_imports)]
1476 use super::*;
1477 #[derive(Clone, Debug, PartialEq)]
1478 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1479 }
1480
1481 impl Location {
1482 /// Gets the enum value.
1483 ///
1484 /// Returns `None` if the enum contains an unknown value deserialized from
1485 /// the string representation of enums.
1486 pub fn value(&self) -> std::option::Option<i32> {
1487 match self {
1488 Self::Unspecified => std::option::Option::Some(0),
1489 Self::CompleteRequestBody => std::option::Option::Some(1),
1490 Self::UnknownValue(u) => u.0.value(),
1491 }
1492 }
1493
1494 /// Gets the enum value as a string.
1495 ///
1496 /// Returns `None` if the enum contains an unknown value deserialized from
1497 /// the integer representation of enums.
1498 pub fn name(&self) -> std::option::Option<&str> {
1499 match self {
1500 Self::Unspecified => std::option::Option::Some("LOCATION_UNSPECIFIED"),
1501 Self::CompleteRequestBody => std::option::Option::Some("COMPLETE_REQUEST_BODY"),
1502 Self::UnknownValue(u) => u.0.name(),
1503 }
1504 }
1505 }
1506
1507 impl std::default::Default for Location {
1508 fn default() -> Self {
1509 use std::convert::From;
1510 Self::from(0)
1511 }
1512 }
1513
1514 impl std::fmt::Display for Location {
1515 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1516 wkt::internal::display_enum(f, self.name(), self.value())
1517 }
1518 }
1519
1520 impl std::convert::From<i32> for Location {
1521 fn from(value: i32) -> Self {
1522 match value {
1523 0 => Self::Unspecified,
1524 1 => Self::CompleteRequestBody,
1525 _ => Self::UnknownValue(location::UnknownValue(
1526 wkt::internal::UnknownEnumValue::Integer(value),
1527 )),
1528 }
1529 }
1530 }
1531
1532 impl std::convert::From<&str> for Location {
1533 fn from(value: &str) -> Self {
1534 use std::string::ToString;
1535 match value {
1536 "LOCATION_UNSPECIFIED" => Self::Unspecified,
1537 "COMPLETE_REQUEST_BODY" => Self::CompleteRequestBody,
1538 _ => Self::UnknownValue(location::UnknownValue(
1539 wkt::internal::UnknownEnumValue::String(value.to_string()),
1540 )),
1541 }
1542 }
1543 }
1544
1545 impl serde::ser::Serialize for Location {
1546 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1547 where
1548 S: serde::Serializer,
1549 {
1550 match self {
1551 Self::Unspecified => serializer.serialize_i32(0),
1552 Self::CompleteRequestBody => serializer.serialize_i32(1),
1553 Self::UnknownValue(u) => u.0.serialize(serializer),
1554 }
1555 }
1556 }
1557
1558 impl<'de> serde::de::Deserialize<'de> for Location {
1559 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1560 where
1561 D: serde::Deserializer<'de>,
1562 {
1563 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Location>::new(
1564 ".google.cloud.websecurityscanner.v1.Xxe.Location",
1565 ))
1566 }
1567 }
1568}
1569
1570/// A FindingTypeStats resource represents stats regarding a specific FindingType
1571/// of Findings under a given ScanRun.
1572#[derive(Clone, Default, PartialEq)]
1573#[non_exhaustive]
1574pub struct FindingTypeStats {
1575 /// Output only. The finding type associated with the stats.
1576 pub finding_type: std::string::String,
1577
1578 /// Output only. The count of findings belonging to this finding type.
1579 pub finding_count: i32,
1580
1581 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1582}
1583
1584impl FindingTypeStats {
1585 /// Creates a new default instance.
1586 pub fn new() -> Self {
1587 std::default::Default::default()
1588 }
1589
1590 /// Sets the value of [finding_type][crate::model::FindingTypeStats::finding_type].
1591 ///
1592 /// # Example
1593 /// ```ignore,no_run
1594 /// # use google_cloud_websecurityscanner_v1::model::FindingTypeStats;
1595 /// let x = FindingTypeStats::new().set_finding_type("example");
1596 /// ```
1597 pub fn set_finding_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1598 self.finding_type = v.into();
1599 self
1600 }
1601
1602 /// Sets the value of [finding_count][crate::model::FindingTypeStats::finding_count].
1603 ///
1604 /// # Example
1605 /// ```ignore,no_run
1606 /// # use google_cloud_websecurityscanner_v1::model::FindingTypeStats;
1607 /// let x = FindingTypeStats::new().set_finding_count(42);
1608 /// ```
1609 pub fn set_finding_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1610 self.finding_count = v.into();
1611 self
1612 }
1613}
1614
1615impl wkt::message::Message for FindingTypeStats {
1616 fn typename() -> &'static str {
1617 "type.googleapis.com/google.cloud.websecurityscanner.v1.FindingTypeStats"
1618 }
1619}
1620
1621/// A ScanConfig resource contains the configurations to launch a scan.
1622#[derive(Clone, Default, PartialEq)]
1623#[non_exhaustive]
1624pub struct ScanConfig {
1625 /// The resource name of the ScanConfig. The name follows the format of
1626 /// 'projects/{projectId}/scanConfigs/{scanConfigId}'. The ScanConfig IDs are
1627 /// generated by the system.
1628 pub name: std::string::String,
1629
1630 /// Required. The user provided display name of the ScanConfig.
1631 pub display_name: std::string::String,
1632
1633 /// The maximum QPS during scanning. A valid value ranges from 5 to 20
1634 /// inclusively. If the field is unspecified or its value is set 0, server will
1635 /// default to 15. Other values outside of [5, 20] range will be rejected with
1636 /// INVALID_ARGUMENT error.
1637 pub max_qps: i32,
1638
1639 /// Required. The starting URLs from which the scanner finds site pages.
1640 pub starting_urls: std::vec::Vec<std::string::String>,
1641
1642 /// The authentication configuration. If specified, service will use the
1643 /// authentication configuration during scanning.
1644 pub authentication: std::option::Option<crate::model::scan_config::Authentication>,
1645
1646 /// The user agent used during scanning.
1647 pub user_agent: crate::model::scan_config::UserAgent,
1648
1649 /// The excluded URL patterns as described in
1650 /// <https://cloud.google.com/security-command-center/docs/how-to-use-web-security-scanner#excluding_urls>
1651 pub blacklist_patterns: std::vec::Vec<std::string::String>,
1652
1653 /// The schedule of the ScanConfig.
1654 pub schedule: std::option::Option<crate::model::scan_config::Schedule>,
1655
1656 /// Controls export of scan configurations and results to Security
1657 /// Command Center.
1658 pub export_to_security_command_center: crate::model::scan_config::ExportToSecurityCommandCenter,
1659
1660 /// The risk level selected for the scan
1661 pub risk_level: crate::model::scan_config::RiskLevel,
1662
1663 /// Whether the scan config is managed by Web Security Scanner, output
1664 /// only.
1665 pub managed_scan: bool,
1666
1667 /// Whether the scan configuration has enabled static IP address scan feature.
1668 /// If enabled, the scanner will access applications from static IP addresses.
1669 pub static_ip_scan: bool,
1670
1671 /// Whether to keep scanning even if most requests return HTTP error codes.
1672 pub ignore_http_status_errors: bool,
1673
1674 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1675}
1676
1677impl ScanConfig {
1678 /// Creates a new default instance.
1679 pub fn new() -> Self {
1680 std::default::Default::default()
1681 }
1682
1683 /// Sets the value of [name][crate::model::ScanConfig::name].
1684 ///
1685 /// # Example
1686 /// ```ignore,no_run
1687 /// # use google_cloud_websecurityscanner_v1::model::ScanConfig;
1688 /// let x = ScanConfig::new().set_name("example");
1689 /// ```
1690 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1691 self.name = v.into();
1692 self
1693 }
1694
1695 /// Sets the value of [display_name][crate::model::ScanConfig::display_name].
1696 ///
1697 /// # Example
1698 /// ```ignore,no_run
1699 /// # use google_cloud_websecurityscanner_v1::model::ScanConfig;
1700 /// let x = ScanConfig::new().set_display_name("example");
1701 /// ```
1702 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1703 self.display_name = v.into();
1704 self
1705 }
1706
1707 /// Sets the value of [max_qps][crate::model::ScanConfig::max_qps].
1708 ///
1709 /// # Example
1710 /// ```ignore,no_run
1711 /// # use google_cloud_websecurityscanner_v1::model::ScanConfig;
1712 /// let x = ScanConfig::new().set_max_qps(42);
1713 /// ```
1714 pub fn set_max_qps<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1715 self.max_qps = v.into();
1716 self
1717 }
1718
1719 /// Sets the value of [starting_urls][crate::model::ScanConfig::starting_urls].
1720 ///
1721 /// # Example
1722 /// ```ignore,no_run
1723 /// # use google_cloud_websecurityscanner_v1::model::ScanConfig;
1724 /// let x = ScanConfig::new().set_starting_urls(["a", "b", "c"]);
1725 /// ```
1726 pub fn set_starting_urls<T, V>(mut self, v: T) -> Self
1727 where
1728 T: std::iter::IntoIterator<Item = V>,
1729 V: std::convert::Into<std::string::String>,
1730 {
1731 use std::iter::Iterator;
1732 self.starting_urls = v.into_iter().map(|i| i.into()).collect();
1733 self
1734 }
1735
1736 /// Sets the value of [authentication][crate::model::ScanConfig::authentication].
1737 ///
1738 /// # Example
1739 /// ```ignore,no_run
1740 /// # use google_cloud_websecurityscanner_v1::model::ScanConfig;
1741 /// use google_cloud_websecurityscanner_v1::model::scan_config::Authentication;
1742 /// let x = ScanConfig::new().set_authentication(Authentication::default()/* use setters */);
1743 /// ```
1744 pub fn set_authentication<T>(mut self, v: T) -> Self
1745 where
1746 T: std::convert::Into<crate::model::scan_config::Authentication>,
1747 {
1748 self.authentication = std::option::Option::Some(v.into());
1749 self
1750 }
1751
1752 /// Sets or clears the value of [authentication][crate::model::ScanConfig::authentication].
1753 ///
1754 /// # Example
1755 /// ```ignore,no_run
1756 /// # use google_cloud_websecurityscanner_v1::model::ScanConfig;
1757 /// use google_cloud_websecurityscanner_v1::model::scan_config::Authentication;
1758 /// let x = ScanConfig::new().set_or_clear_authentication(Some(Authentication::default()/* use setters */));
1759 /// let x = ScanConfig::new().set_or_clear_authentication(None::<Authentication>);
1760 /// ```
1761 pub fn set_or_clear_authentication<T>(mut self, v: std::option::Option<T>) -> Self
1762 where
1763 T: std::convert::Into<crate::model::scan_config::Authentication>,
1764 {
1765 self.authentication = v.map(|x| x.into());
1766 self
1767 }
1768
1769 /// Sets the value of [user_agent][crate::model::ScanConfig::user_agent].
1770 ///
1771 /// # Example
1772 /// ```ignore,no_run
1773 /// # use google_cloud_websecurityscanner_v1::model::ScanConfig;
1774 /// use google_cloud_websecurityscanner_v1::model::scan_config::UserAgent;
1775 /// let x0 = ScanConfig::new().set_user_agent(UserAgent::ChromeLinux);
1776 /// let x1 = ScanConfig::new().set_user_agent(UserAgent::ChromeAndroid);
1777 /// let x2 = ScanConfig::new().set_user_agent(UserAgent::SafariIphone);
1778 /// ```
1779 pub fn set_user_agent<T: std::convert::Into<crate::model::scan_config::UserAgent>>(
1780 mut self,
1781 v: T,
1782 ) -> Self {
1783 self.user_agent = v.into();
1784 self
1785 }
1786
1787 /// Sets the value of [blacklist_patterns][crate::model::ScanConfig::blacklist_patterns].
1788 ///
1789 /// # Example
1790 /// ```ignore,no_run
1791 /// # use google_cloud_websecurityscanner_v1::model::ScanConfig;
1792 /// let x = ScanConfig::new().set_blacklist_patterns(["a", "b", "c"]);
1793 /// ```
1794 pub fn set_blacklist_patterns<T, V>(mut self, v: T) -> Self
1795 where
1796 T: std::iter::IntoIterator<Item = V>,
1797 V: std::convert::Into<std::string::String>,
1798 {
1799 use std::iter::Iterator;
1800 self.blacklist_patterns = v.into_iter().map(|i| i.into()).collect();
1801 self
1802 }
1803
1804 /// Sets the value of [schedule][crate::model::ScanConfig::schedule].
1805 ///
1806 /// # Example
1807 /// ```ignore,no_run
1808 /// # use google_cloud_websecurityscanner_v1::model::ScanConfig;
1809 /// use google_cloud_websecurityscanner_v1::model::scan_config::Schedule;
1810 /// let x = ScanConfig::new().set_schedule(Schedule::default()/* use setters */);
1811 /// ```
1812 pub fn set_schedule<T>(mut self, v: T) -> Self
1813 where
1814 T: std::convert::Into<crate::model::scan_config::Schedule>,
1815 {
1816 self.schedule = std::option::Option::Some(v.into());
1817 self
1818 }
1819
1820 /// Sets or clears the value of [schedule][crate::model::ScanConfig::schedule].
1821 ///
1822 /// # Example
1823 /// ```ignore,no_run
1824 /// # use google_cloud_websecurityscanner_v1::model::ScanConfig;
1825 /// use google_cloud_websecurityscanner_v1::model::scan_config::Schedule;
1826 /// let x = ScanConfig::new().set_or_clear_schedule(Some(Schedule::default()/* use setters */));
1827 /// let x = ScanConfig::new().set_or_clear_schedule(None::<Schedule>);
1828 /// ```
1829 pub fn set_or_clear_schedule<T>(mut self, v: std::option::Option<T>) -> Self
1830 where
1831 T: std::convert::Into<crate::model::scan_config::Schedule>,
1832 {
1833 self.schedule = v.map(|x| x.into());
1834 self
1835 }
1836
1837 /// Sets the value of [export_to_security_command_center][crate::model::ScanConfig::export_to_security_command_center].
1838 ///
1839 /// # Example
1840 /// ```ignore,no_run
1841 /// # use google_cloud_websecurityscanner_v1::model::ScanConfig;
1842 /// use google_cloud_websecurityscanner_v1::model::scan_config::ExportToSecurityCommandCenter;
1843 /// let x0 = ScanConfig::new().set_export_to_security_command_center(ExportToSecurityCommandCenter::Enabled);
1844 /// let x1 = ScanConfig::new().set_export_to_security_command_center(ExportToSecurityCommandCenter::Disabled);
1845 /// ```
1846 pub fn set_export_to_security_command_center<
1847 T: std::convert::Into<crate::model::scan_config::ExportToSecurityCommandCenter>,
1848 >(
1849 mut self,
1850 v: T,
1851 ) -> Self {
1852 self.export_to_security_command_center = v.into();
1853 self
1854 }
1855
1856 /// Sets the value of [risk_level][crate::model::ScanConfig::risk_level].
1857 ///
1858 /// # Example
1859 /// ```ignore,no_run
1860 /// # use google_cloud_websecurityscanner_v1::model::ScanConfig;
1861 /// use google_cloud_websecurityscanner_v1::model::scan_config::RiskLevel;
1862 /// let x0 = ScanConfig::new().set_risk_level(RiskLevel::Normal);
1863 /// let x1 = ScanConfig::new().set_risk_level(RiskLevel::Low);
1864 /// ```
1865 pub fn set_risk_level<T: std::convert::Into<crate::model::scan_config::RiskLevel>>(
1866 mut self,
1867 v: T,
1868 ) -> Self {
1869 self.risk_level = v.into();
1870 self
1871 }
1872
1873 /// Sets the value of [managed_scan][crate::model::ScanConfig::managed_scan].
1874 ///
1875 /// # Example
1876 /// ```ignore,no_run
1877 /// # use google_cloud_websecurityscanner_v1::model::ScanConfig;
1878 /// let x = ScanConfig::new().set_managed_scan(true);
1879 /// ```
1880 pub fn set_managed_scan<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1881 self.managed_scan = v.into();
1882 self
1883 }
1884
1885 /// Sets the value of [static_ip_scan][crate::model::ScanConfig::static_ip_scan].
1886 ///
1887 /// # Example
1888 /// ```ignore,no_run
1889 /// # use google_cloud_websecurityscanner_v1::model::ScanConfig;
1890 /// let x = ScanConfig::new().set_static_ip_scan(true);
1891 /// ```
1892 pub fn set_static_ip_scan<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1893 self.static_ip_scan = v.into();
1894 self
1895 }
1896
1897 /// Sets the value of [ignore_http_status_errors][crate::model::ScanConfig::ignore_http_status_errors].
1898 ///
1899 /// # Example
1900 /// ```ignore,no_run
1901 /// # use google_cloud_websecurityscanner_v1::model::ScanConfig;
1902 /// let x = ScanConfig::new().set_ignore_http_status_errors(true);
1903 /// ```
1904 pub fn set_ignore_http_status_errors<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1905 self.ignore_http_status_errors = v.into();
1906 self
1907 }
1908}
1909
1910impl wkt::message::Message for ScanConfig {
1911 fn typename() -> &'static str {
1912 "type.googleapis.com/google.cloud.websecurityscanner.v1.ScanConfig"
1913 }
1914}
1915
1916/// Defines additional types related to [ScanConfig].
1917pub mod scan_config {
1918 #[allow(unused_imports)]
1919 use super::*;
1920
1921 /// Scan authentication configuration.
1922 #[derive(Clone, Default, PartialEq)]
1923 #[non_exhaustive]
1924 pub struct Authentication {
1925 /// Required.
1926 /// Authentication configuration
1927 pub authentication:
1928 std::option::Option<crate::model::scan_config::authentication::Authentication>,
1929
1930 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1931 }
1932
1933 impl Authentication {
1934 /// Creates a new default instance.
1935 pub fn new() -> Self {
1936 std::default::Default::default()
1937 }
1938
1939 /// Sets the value of [authentication][crate::model::scan_config::Authentication::authentication].
1940 ///
1941 /// Note that all the setters affecting `authentication` are mutually
1942 /// exclusive.
1943 ///
1944 /// # Example
1945 /// ```ignore,no_run
1946 /// # use google_cloud_websecurityscanner_v1::model::scan_config::Authentication;
1947 /// use google_cloud_websecurityscanner_v1::model::scan_config::authentication::CustomAccount;
1948 /// let x = Authentication::new().set_authentication(Some(
1949 /// google_cloud_websecurityscanner_v1::model::scan_config::authentication::Authentication::CustomAccount(CustomAccount::default().into())));
1950 /// ```
1951 pub fn set_authentication<
1952 T: std::convert::Into<
1953 std::option::Option<crate::model::scan_config::authentication::Authentication>,
1954 >,
1955 >(
1956 mut self,
1957 v: T,
1958 ) -> Self {
1959 self.authentication = v.into();
1960 self
1961 }
1962
1963 /// The value of [authentication][crate::model::scan_config::Authentication::authentication]
1964 /// if it holds a `GoogleAccount`, `None` if the field is not set or
1965 /// holds a different branch.
1966 #[deprecated]
1967 pub fn google_account(
1968 &self,
1969 ) -> std::option::Option<
1970 &std::boxed::Box<crate::model::scan_config::authentication::GoogleAccount>,
1971 > {
1972 #[allow(unreachable_patterns)]
1973 self.authentication.as_ref().and_then(|v| match v {
1974 crate::model::scan_config::authentication::Authentication::GoogleAccount(v) => {
1975 std::option::Option::Some(v)
1976 }
1977 _ => std::option::Option::None,
1978 })
1979 }
1980
1981 /// Sets the value of [authentication][crate::model::scan_config::Authentication::authentication]
1982 /// to hold a `GoogleAccount`.
1983 ///
1984 /// Note that all the setters affecting `authentication` are
1985 /// mutually exclusive.
1986 ///
1987 /// # Example
1988 /// ```ignore,no_run
1989 /// # use google_cloud_websecurityscanner_v1::model::scan_config::Authentication;
1990 /// use google_cloud_websecurityscanner_v1::model::scan_config::authentication::GoogleAccount;
1991 /// let x = Authentication::new().set_google_account(GoogleAccount::default()/* use setters */);
1992 /// assert!(x.google_account().is_some());
1993 /// assert!(x.custom_account().is_none());
1994 /// assert!(x.iap_credential().is_none());
1995 /// ```
1996 #[deprecated]
1997 pub fn set_google_account<
1998 T: std::convert::Into<
1999 std::boxed::Box<crate::model::scan_config::authentication::GoogleAccount>,
2000 >,
2001 >(
2002 mut self,
2003 v: T,
2004 ) -> Self {
2005 self.authentication = std::option::Option::Some(
2006 crate::model::scan_config::authentication::Authentication::GoogleAccount(v.into()),
2007 );
2008 self
2009 }
2010
2011 /// The value of [authentication][crate::model::scan_config::Authentication::authentication]
2012 /// if it holds a `CustomAccount`, `None` if the field is not set or
2013 /// holds a different branch.
2014 pub fn custom_account(
2015 &self,
2016 ) -> std::option::Option<
2017 &std::boxed::Box<crate::model::scan_config::authentication::CustomAccount>,
2018 > {
2019 #[allow(unreachable_patterns)]
2020 self.authentication.as_ref().and_then(|v| match v {
2021 crate::model::scan_config::authentication::Authentication::CustomAccount(v) => {
2022 std::option::Option::Some(v)
2023 }
2024 _ => std::option::Option::None,
2025 })
2026 }
2027
2028 /// Sets the value of [authentication][crate::model::scan_config::Authentication::authentication]
2029 /// to hold a `CustomAccount`.
2030 ///
2031 /// Note that all the setters affecting `authentication` are
2032 /// mutually exclusive.
2033 ///
2034 /// # Example
2035 /// ```ignore,no_run
2036 /// # use google_cloud_websecurityscanner_v1::model::scan_config::Authentication;
2037 /// use google_cloud_websecurityscanner_v1::model::scan_config::authentication::CustomAccount;
2038 /// let x = Authentication::new().set_custom_account(CustomAccount::default()/* use setters */);
2039 /// assert!(x.custom_account().is_some());
2040 /// assert!(x.google_account().is_none());
2041 /// assert!(x.iap_credential().is_none());
2042 /// ```
2043 pub fn set_custom_account<
2044 T: std::convert::Into<
2045 std::boxed::Box<crate::model::scan_config::authentication::CustomAccount>,
2046 >,
2047 >(
2048 mut self,
2049 v: T,
2050 ) -> Self {
2051 self.authentication = std::option::Option::Some(
2052 crate::model::scan_config::authentication::Authentication::CustomAccount(v.into()),
2053 );
2054 self
2055 }
2056
2057 /// The value of [authentication][crate::model::scan_config::Authentication::authentication]
2058 /// if it holds a `IapCredential`, `None` if the field is not set or
2059 /// holds a different branch.
2060 pub fn iap_credential(
2061 &self,
2062 ) -> std::option::Option<
2063 &std::boxed::Box<crate::model::scan_config::authentication::IapCredential>,
2064 > {
2065 #[allow(unreachable_patterns)]
2066 self.authentication.as_ref().and_then(|v| match v {
2067 crate::model::scan_config::authentication::Authentication::IapCredential(v) => {
2068 std::option::Option::Some(v)
2069 }
2070 _ => std::option::Option::None,
2071 })
2072 }
2073
2074 /// Sets the value of [authentication][crate::model::scan_config::Authentication::authentication]
2075 /// to hold a `IapCredential`.
2076 ///
2077 /// Note that all the setters affecting `authentication` are
2078 /// mutually exclusive.
2079 ///
2080 /// # Example
2081 /// ```ignore,no_run
2082 /// # use google_cloud_websecurityscanner_v1::model::scan_config::Authentication;
2083 /// use google_cloud_websecurityscanner_v1::model::scan_config::authentication::IapCredential;
2084 /// let x = Authentication::new().set_iap_credential(IapCredential::default()/* use setters */);
2085 /// assert!(x.iap_credential().is_some());
2086 /// assert!(x.google_account().is_none());
2087 /// assert!(x.custom_account().is_none());
2088 /// ```
2089 pub fn set_iap_credential<
2090 T: std::convert::Into<
2091 std::boxed::Box<crate::model::scan_config::authentication::IapCredential>,
2092 >,
2093 >(
2094 mut self,
2095 v: T,
2096 ) -> Self {
2097 self.authentication = std::option::Option::Some(
2098 crate::model::scan_config::authentication::Authentication::IapCredential(v.into()),
2099 );
2100 self
2101 }
2102 }
2103
2104 impl wkt::message::Message for Authentication {
2105 fn typename() -> &'static str {
2106 "type.googleapis.com/google.cloud.websecurityscanner.v1.ScanConfig.Authentication"
2107 }
2108 }
2109
2110 /// Defines additional types related to [Authentication].
2111 pub mod authentication {
2112 #[allow(unused_imports)]
2113 use super::*;
2114
2115 /// Describes authentication configuration that uses a Google account.
2116 #[derive(Clone, Default, PartialEq)]
2117 #[non_exhaustive]
2118 #[deprecated]
2119 pub struct GoogleAccount {
2120 /// Required. The user name of the Google account.
2121 pub username: std::string::String,
2122
2123 /// Required. Input only. The password of the Google account. The credential is stored encrypted
2124 /// and not returned in any response nor included in audit logs.
2125 pub password: std::string::String,
2126
2127 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2128 }
2129
2130 impl GoogleAccount {
2131 /// Creates a new default instance.
2132 pub fn new() -> Self {
2133 std::default::Default::default()
2134 }
2135
2136 /// Sets the value of [username][crate::model::scan_config::authentication::GoogleAccount::username].
2137 ///
2138 /// # Example
2139 /// ```ignore,no_run
2140 /// # use google_cloud_websecurityscanner_v1::model::scan_config::authentication::GoogleAccount;
2141 /// let x = GoogleAccount::new().set_username("example");
2142 /// ```
2143 pub fn set_username<T: std::convert::Into<std::string::String>>(
2144 mut self,
2145 v: T,
2146 ) -> Self {
2147 self.username = v.into();
2148 self
2149 }
2150
2151 /// Sets the value of [password][crate::model::scan_config::authentication::GoogleAccount::password].
2152 ///
2153 /// # Example
2154 /// ```ignore,no_run
2155 /// # use google_cloud_websecurityscanner_v1::model::scan_config::authentication::GoogleAccount;
2156 /// let x = GoogleAccount::new().set_password("example");
2157 /// ```
2158 pub fn set_password<T: std::convert::Into<std::string::String>>(
2159 mut self,
2160 v: T,
2161 ) -> Self {
2162 self.password = v.into();
2163 self
2164 }
2165 }
2166
2167 impl wkt::message::Message for GoogleAccount {
2168 fn typename() -> &'static str {
2169 "type.googleapis.com/google.cloud.websecurityscanner.v1.ScanConfig.Authentication.GoogleAccount"
2170 }
2171 }
2172
2173 /// Describes authentication configuration that uses a custom account.
2174 #[derive(Clone, Default, PartialEq)]
2175 #[non_exhaustive]
2176 pub struct CustomAccount {
2177 /// Required. The user name of the custom account.
2178 pub username: std::string::String,
2179
2180 /// Required. Input only. The password of the custom account. The credential is stored encrypted
2181 /// and not returned in any response nor included in audit logs.
2182 pub password: std::string::String,
2183
2184 /// Required. The login form URL of the website.
2185 pub login_url: std::string::String,
2186
2187 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2188 }
2189
2190 impl CustomAccount {
2191 /// Creates a new default instance.
2192 pub fn new() -> Self {
2193 std::default::Default::default()
2194 }
2195
2196 /// Sets the value of [username][crate::model::scan_config::authentication::CustomAccount::username].
2197 ///
2198 /// # Example
2199 /// ```ignore,no_run
2200 /// # use google_cloud_websecurityscanner_v1::model::scan_config::authentication::CustomAccount;
2201 /// let x = CustomAccount::new().set_username("example");
2202 /// ```
2203 pub fn set_username<T: std::convert::Into<std::string::String>>(
2204 mut self,
2205 v: T,
2206 ) -> Self {
2207 self.username = v.into();
2208 self
2209 }
2210
2211 /// Sets the value of [password][crate::model::scan_config::authentication::CustomAccount::password].
2212 ///
2213 /// # Example
2214 /// ```ignore,no_run
2215 /// # use google_cloud_websecurityscanner_v1::model::scan_config::authentication::CustomAccount;
2216 /// let x = CustomAccount::new().set_password("example");
2217 /// ```
2218 pub fn set_password<T: std::convert::Into<std::string::String>>(
2219 mut self,
2220 v: T,
2221 ) -> Self {
2222 self.password = v.into();
2223 self
2224 }
2225
2226 /// Sets the value of [login_url][crate::model::scan_config::authentication::CustomAccount::login_url].
2227 ///
2228 /// # Example
2229 /// ```ignore,no_run
2230 /// # use google_cloud_websecurityscanner_v1::model::scan_config::authentication::CustomAccount;
2231 /// let x = CustomAccount::new().set_login_url("example");
2232 /// ```
2233 pub fn set_login_url<T: std::convert::Into<std::string::String>>(
2234 mut self,
2235 v: T,
2236 ) -> Self {
2237 self.login_url = v.into();
2238 self
2239 }
2240 }
2241
2242 impl wkt::message::Message for CustomAccount {
2243 fn typename() -> &'static str {
2244 "type.googleapis.com/google.cloud.websecurityscanner.v1.ScanConfig.Authentication.CustomAccount"
2245 }
2246 }
2247
2248 /// Describes authentication configuration for Identity-Aware-Proxy (IAP).
2249 #[derive(Clone, Default, PartialEq)]
2250 #[non_exhaustive]
2251 pub struct IapCredential {
2252 /// Identity-Aware-Proxy (IAP) Authentication Configuration
2253 pub iap_credentials: std::option::Option<
2254 crate::model::scan_config::authentication::iap_credential::IapCredentials,
2255 >,
2256
2257 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2258 }
2259
2260 impl IapCredential {
2261 /// Creates a new default instance.
2262 pub fn new() -> Self {
2263 std::default::Default::default()
2264 }
2265
2266 /// Sets the value of [iap_credentials][crate::model::scan_config::authentication::IapCredential::iap_credentials].
2267 ///
2268 /// Note that all the setters affecting `iap_credentials` are mutually
2269 /// exclusive.
2270 ///
2271 /// # Example
2272 /// ```ignore,no_run
2273 /// # use google_cloud_websecurityscanner_v1::model::scan_config::authentication::IapCredential;
2274 /// use google_cloud_websecurityscanner_v1::model::scan_config::authentication::iap_credential::IapTestServiceAccountInfo;
2275 /// let x = IapCredential::new().set_iap_credentials(Some(
2276 /// google_cloud_websecurityscanner_v1::model::scan_config::authentication::iap_credential::IapCredentials::IapTestServiceAccountInfo(IapTestServiceAccountInfo::default().into())));
2277 /// ```
2278 pub fn set_iap_credentials<T: std::convert::Into<std::option::Option<crate::model::scan_config::authentication::iap_credential::IapCredentials>>>(mut self, v: T) -> Self
2279 {
2280 self.iap_credentials = v.into();
2281 self
2282 }
2283
2284 /// The value of [iap_credentials][crate::model::scan_config::authentication::IapCredential::iap_credentials]
2285 /// if it holds a `IapTestServiceAccountInfo`, `None` if the field is not set or
2286 /// holds a different branch.
2287 pub fn iap_test_service_account_info(&self) -> std::option::Option<&std::boxed::Box<crate::model::scan_config::authentication::iap_credential::IapTestServiceAccountInfo>>{
2288 #[allow(unreachable_patterns)]
2289 self.iap_credentials.as_ref().and_then(|v| match v {
2290 crate::model::scan_config::authentication::iap_credential::IapCredentials::IapTestServiceAccountInfo(v) => std::option::Option::Some(v),
2291 _ => std::option::Option::None,
2292 })
2293 }
2294
2295 /// Sets the value of [iap_credentials][crate::model::scan_config::authentication::IapCredential::iap_credentials]
2296 /// to hold a `IapTestServiceAccountInfo`.
2297 ///
2298 /// Note that all the setters affecting `iap_credentials` are
2299 /// mutually exclusive.
2300 ///
2301 /// # Example
2302 /// ```ignore,no_run
2303 /// # use google_cloud_websecurityscanner_v1::model::scan_config::authentication::IapCredential;
2304 /// use google_cloud_websecurityscanner_v1::model::scan_config::authentication::iap_credential::IapTestServiceAccountInfo;
2305 /// let x = IapCredential::new().set_iap_test_service_account_info(IapTestServiceAccountInfo::default()/* use setters */);
2306 /// assert!(x.iap_test_service_account_info().is_some());
2307 /// ```
2308 pub fn set_iap_test_service_account_info<T: std::convert::Into<std::boxed::Box<crate::model::scan_config::authentication::iap_credential::IapTestServiceAccountInfo>>>(mut self, v: T) -> Self{
2309 self.iap_credentials = std::option::Option::Some(
2310 crate::model::scan_config::authentication::iap_credential::IapCredentials::IapTestServiceAccountInfo(
2311 v.into()
2312 )
2313 );
2314 self
2315 }
2316 }
2317
2318 impl wkt::message::Message for IapCredential {
2319 fn typename() -> &'static str {
2320 "type.googleapis.com/google.cloud.websecurityscanner.v1.ScanConfig.Authentication.IapCredential"
2321 }
2322 }
2323
2324 /// Defines additional types related to [IapCredential].
2325 pub mod iap_credential {
2326 #[allow(unused_imports)]
2327 use super::*;
2328
2329 /// Describes authentication configuration when Web-Security-Scanner
2330 /// service account is added in Identity-Aware-Proxy (IAP) access policies.
2331 #[derive(Clone, Default, PartialEq)]
2332 #[non_exhaustive]
2333 pub struct IapTestServiceAccountInfo {
2334 /// Required. Describes OAuth2 client id of resources protected by
2335 /// Identity-Aware-Proxy (IAP).
2336 pub target_audience_client_id: std::string::String,
2337
2338 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2339 }
2340
2341 impl IapTestServiceAccountInfo {
2342 /// Creates a new default instance.
2343 pub fn new() -> Self {
2344 std::default::Default::default()
2345 }
2346
2347 /// Sets the value of [target_audience_client_id][crate::model::scan_config::authentication::iap_credential::IapTestServiceAccountInfo::target_audience_client_id].
2348 ///
2349 /// # Example
2350 /// ```ignore,no_run
2351 /// # use google_cloud_websecurityscanner_v1::model::scan_config::authentication::iap_credential::IapTestServiceAccountInfo;
2352 /// let x = IapTestServiceAccountInfo::new().set_target_audience_client_id("example");
2353 /// ```
2354 pub fn set_target_audience_client_id<T: std::convert::Into<std::string::String>>(
2355 mut self,
2356 v: T,
2357 ) -> Self {
2358 self.target_audience_client_id = v.into();
2359 self
2360 }
2361 }
2362
2363 impl wkt::message::Message for IapTestServiceAccountInfo {
2364 fn typename() -> &'static str {
2365 "type.googleapis.com/google.cloud.websecurityscanner.v1.ScanConfig.Authentication.IapCredential.IapTestServiceAccountInfo"
2366 }
2367 }
2368
2369 /// Identity-Aware-Proxy (IAP) Authentication Configuration
2370 #[derive(Clone, Debug, PartialEq)]
2371 #[non_exhaustive]
2372 pub enum IapCredentials {
2373 /// Authentication configuration when Web-Security-Scanner service
2374 /// account is added in Identity-Aware-Proxy (IAP) access policies.
2375 IapTestServiceAccountInfo(std::boxed::Box<crate::model::scan_config::authentication::iap_credential::IapTestServiceAccountInfo>),
2376 }
2377 }
2378
2379 /// Required.
2380 /// Authentication configuration
2381 #[derive(Clone, Debug, PartialEq)]
2382 #[non_exhaustive]
2383 pub enum Authentication {
2384 /// Authentication using a Google account.
2385 #[deprecated]
2386 GoogleAccount(
2387 std::boxed::Box<crate::model::scan_config::authentication::GoogleAccount>,
2388 ),
2389 /// Authentication using a custom account.
2390 CustomAccount(
2391 std::boxed::Box<crate::model::scan_config::authentication::CustomAccount>,
2392 ),
2393 /// Authentication using Identity-Aware-Proxy (IAP).
2394 IapCredential(
2395 std::boxed::Box<crate::model::scan_config::authentication::IapCredential>,
2396 ),
2397 }
2398 }
2399
2400 /// Scan schedule configuration.
2401 #[derive(Clone, Default, PartialEq)]
2402 #[non_exhaustive]
2403 pub struct Schedule {
2404 /// A timestamp indicates when the next run will be scheduled. The value is
2405 /// refreshed by the server after each run. If unspecified, it will default
2406 /// to current server time, which means the scan will be scheduled to start
2407 /// immediately.
2408 pub schedule_time: std::option::Option<wkt::Timestamp>,
2409
2410 /// Required. The duration of time between executions in days.
2411 pub interval_duration_days: i32,
2412
2413 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2414 }
2415
2416 impl Schedule {
2417 /// Creates a new default instance.
2418 pub fn new() -> Self {
2419 std::default::Default::default()
2420 }
2421
2422 /// Sets the value of [schedule_time][crate::model::scan_config::Schedule::schedule_time].
2423 ///
2424 /// # Example
2425 /// ```ignore,no_run
2426 /// # use google_cloud_websecurityscanner_v1::model::scan_config::Schedule;
2427 /// use wkt::Timestamp;
2428 /// let x = Schedule::new().set_schedule_time(Timestamp::default()/* use setters */);
2429 /// ```
2430 pub fn set_schedule_time<T>(mut self, v: T) -> Self
2431 where
2432 T: std::convert::Into<wkt::Timestamp>,
2433 {
2434 self.schedule_time = std::option::Option::Some(v.into());
2435 self
2436 }
2437
2438 /// Sets or clears the value of [schedule_time][crate::model::scan_config::Schedule::schedule_time].
2439 ///
2440 /// # Example
2441 /// ```ignore,no_run
2442 /// # use google_cloud_websecurityscanner_v1::model::scan_config::Schedule;
2443 /// use wkt::Timestamp;
2444 /// let x = Schedule::new().set_or_clear_schedule_time(Some(Timestamp::default()/* use setters */));
2445 /// let x = Schedule::new().set_or_clear_schedule_time(None::<Timestamp>);
2446 /// ```
2447 pub fn set_or_clear_schedule_time<T>(mut self, v: std::option::Option<T>) -> Self
2448 where
2449 T: std::convert::Into<wkt::Timestamp>,
2450 {
2451 self.schedule_time = v.map(|x| x.into());
2452 self
2453 }
2454
2455 /// Sets the value of [interval_duration_days][crate::model::scan_config::Schedule::interval_duration_days].
2456 ///
2457 /// # Example
2458 /// ```ignore,no_run
2459 /// # use google_cloud_websecurityscanner_v1::model::scan_config::Schedule;
2460 /// let x = Schedule::new().set_interval_duration_days(42);
2461 /// ```
2462 pub fn set_interval_duration_days<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2463 self.interval_duration_days = v.into();
2464 self
2465 }
2466 }
2467
2468 impl wkt::message::Message for Schedule {
2469 fn typename() -> &'static str {
2470 "type.googleapis.com/google.cloud.websecurityscanner.v1.ScanConfig.Schedule"
2471 }
2472 }
2473
2474 /// Type of user agents used for scanning.
2475 ///
2476 /// # Working with unknown values
2477 ///
2478 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2479 /// additional enum variants at any time. Adding new variants is not considered
2480 /// a breaking change. Applications should write their code in anticipation of:
2481 ///
2482 /// - New values appearing in future releases of the client library, **and**
2483 /// - New values received dynamically, without application changes.
2484 ///
2485 /// Please consult the [Working with enums] section in the user guide for some
2486 /// guidelines.
2487 ///
2488 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2489 #[derive(Clone, Debug, PartialEq)]
2490 #[non_exhaustive]
2491 pub enum UserAgent {
2492 /// The user agent is unknown. Service will default to CHROME_LINUX.
2493 Unspecified,
2494 /// Chrome on Linux. This is the service default if unspecified.
2495 ChromeLinux,
2496 /// Chrome on Android.
2497 ChromeAndroid,
2498 /// Safari on IPhone.
2499 SafariIphone,
2500 /// If set, the enum was initialized with an unknown value.
2501 ///
2502 /// Applications can examine the value using [UserAgent::value] or
2503 /// [UserAgent::name].
2504 UnknownValue(user_agent::UnknownValue),
2505 }
2506
2507 #[doc(hidden)]
2508 pub mod user_agent {
2509 #[allow(unused_imports)]
2510 use super::*;
2511 #[derive(Clone, Debug, PartialEq)]
2512 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2513 }
2514
2515 impl UserAgent {
2516 /// Gets the enum value.
2517 ///
2518 /// Returns `None` if the enum contains an unknown value deserialized from
2519 /// the string representation of enums.
2520 pub fn value(&self) -> std::option::Option<i32> {
2521 match self {
2522 Self::Unspecified => std::option::Option::Some(0),
2523 Self::ChromeLinux => std::option::Option::Some(1),
2524 Self::ChromeAndroid => std::option::Option::Some(2),
2525 Self::SafariIphone => std::option::Option::Some(3),
2526 Self::UnknownValue(u) => u.0.value(),
2527 }
2528 }
2529
2530 /// Gets the enum value as a string.
2531 ///
2532 /// Returns `None` if the enum contains an unknown value deserialized from
2533 /// the integer representation of enums.
2534 pub fn name(&self) -> std::option::Option<&str> {
2535 match self {
2536 Self::Unspecified => std::option::Option::Some("USER_AGENT_UNSPECIFIED"),
2537 Self::ChromeLinux => std::option::Option::Some("CHROME_LINUX"),
2538 Self::ChromeAndroid => std::option::Option::Some("CHROME_ANDROID"),
2539 Self::SafariIphone => std::option::Option::Some("SAFARI_IPHONE"),
2540 Self::UnknownValue(u) => u.0.name(),
2541 }
2542 }
2543 }
2544
2545 impl std::default::Default for UserAgent {
2546 fn default() -> Self {
2547 use std::convert::From;
2548 Self::from(0)
2549 }
2550 }
2551
2552 impl std::fmt::Display for UserAgent {
2553 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2554 wkt::internal::display_enum(f, self.name(), self.value())
2555 }
2556 }
2557
2558 impl std::convert::From<i32> for UserAgent {
2559 fn from(value: i32) -> Self {
2560 match value {
2561 0 => Self::Unspecified,
2562 1 => Self::ChromeLinux,
2563 2 => Self::ChromeAndroid,
2564 3 => Self::SafariIphone,
2565 _ => Self::UnknownValue(user_agent::UnknownValue(
2566 wkt::internal::UnknownEnumValue::Integer(value),
2567 )),
2568 }
2569 }
2570 }
2571
2572 impl std::convert::From<&str> for UserAgent {
2573 fn from(value: &str) -> Self {
2574 use std::string::ToString;
2575 match value {
2576 "USER_AGENT_UNSPECIFIED" => Self::Unspecified,
2577 "CHROME_LINUX" => Self::ChromeLinux,
2578 "CHROME_ANDROID" => Self::ChromeAndroid,
2579 "SAFARI_IPHONE" => Self::SafariIphone,
2580 _ => Self::UnknownValue(user_agent::UnknownValue(
2581 wkt::internal::UnknownEnumValue::String(value.to_string()),
2582 )),
2583 }
2584 }
2585 }
2586
2587 impl serde::ser::Serialize for UserAgent {
2588 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2589 where
2590 S: serde::Serializer,
2591 {
2592 match self {
2593 Self::Unspecified => serializer.serialize_i32(0),
2594 Self::ChromeLinux => serializer.serialize_i32(1),
2595 Self::ChromeAndroid => serializer.serialize_i32(2),
2596 Self::SafariIphone => serializer.serialize_i32(3),
2597 Self::UnknownValue(u) => u.0.serialize(serializer),
2598 }
2599 }
2600 }
2601
2602 impl<'de> serde::de::Deserialize<'de> for UserAgent {
2603 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2604 where
2605 D: serde::Deserializer<'de>,
2606 {
2607 deserializer.deserialize_any(wkt::internal::EnumVisitor::<UserAgent>::new(
2608 ".google.cloud.websecurityscanner.v1.ScanConfig.UserAgent",
2609 ))
2610 }
2611 }
2612
2613 /// Scan risk levels supported by Web Security Scanner. LOW impact
2614 /// scanning will minimize requests with the potential to modify data. To
2615 /// achieve the maximum scan coverage, NORMAL risk level is recommended.
2616 ///
2617 /// # Working with unknown values
2618 ///
2619 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2620 /// additional enum variants at any time. Adding new variants is not considered
2621 /// a breaking change. Applications should write their code in anticipation of:
2622 ///
2623 /// - New values appearing in future releases of the client library, **and**
2624 /// - New values received dynamically, without application changes.
2625 ///
2626 /// Please consult the [Working with enums] section in the user guide for some
2627 /// guidelines.
2628 ///
2629 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2630 #[derive(Clone, Debug, PartialEq)]
2631 #[non_exhaustive]
2632 pub enum RiskLevel {
2633 /// Use default, which is NORMAL.
2634 Unspecified,
2635 /// Normal scanning (Recommended)
2636 Normal,
2637 /// Lower impact scanning
2638 Low,
2639 /// If set, the enum was initialized with an unknown value.
2640 ///
2641 /// Applications can examine the value using [RiskLevel::value] or
2642 /// [RiskLevel::name].
2643 UnknownValue(risk_level::UnknownValue),
2644 }
2645
2646 #[doc(hidden)]
2647 pub mod risk_level {
2648 #[allow(unused_imports)]
2649 use super::*;
2650 #[derive(Clone, Debug, PartialEq)]
2651 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2652 }
2653
2654 impl RiskLevel {
2655 /// Gets the enum value.
2656 ///
2657 /// Returns `None` if the enum contains an unknown value deserialized from
2658 /// the string representation of enums.
2659 pub fn value(&self) -> std::option::Option<i32> {
2660 match self {
2661 Self::Unspecified => std::option::Option::Some(0),
2662 Self::Normal => std::option::Option::Some(1),
2663 Self::Low => std::option::Option::Some(2),
2664 Self::UnknownValue(u) => u.0.value(),
2665 }
2666 }
2667
2668 /// Gets the enum value as a string.
2669 ///
2670 /// Returns `None` if the enum contains an unknown value deserialized from
2671 /// the integer representation of enums.
2672 pub fn name(&self) -> std::option::Option<&str> {
2673 match self {
2674 Self::Unspecified => std::option::Option::Some("RISK_LEVEL_UNSPECIFIED"),
2675 Self::Normal => std::option::Option::Some("NORMAL"),
2676 Self::Low => std::option::Option::Some("LOW"),
2677 Self::UnknownValue(u) => u.0.name(),
2678 }
2679 }
2680 }
2681
2682 impl std::default::Default for RiskLevel {
2683 fn default() -> Self {
2684 use std::convert::From;
2685 Self::from(0)
2686 }
2687 }
2688
2689 impl std::fmt::Display for RiskLevel {
2690 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2691 wkt::internal::display_enum(f, self.name(), self.value())
2692 }
2693 }
2694
2695 impl std::convert::From<i32> for RiskLevel {
2696 fn from(value: i32) -> Self {
2697 match value {
2698 0 => Self::Unspecified,
2699 1 => Self::Normal,
2700 2 => Self::Low,
2701 _ => Self::UnknownValue(risk_level::UnknownValue(
2702 wkt::internal::UnknownEnumValue::Integer(value),
2703 )),
2704 }
2705 }
2706 }
2707
2708 impl std::convert::From<&str> for RiskLevel {
2709 fn from(value: &str) -> Self {
2710 use std::string::ToString;
2711 match value {
2712 "RISK_LEVEL_UNSPECIFIED" => Self::Unspecified,
2713 "NORMAL" => Self::Normal,
2714 "LOW" => Self::Low,
2715 _ => Self::UnknownValue(risk_level::UnknownValue(
2716 wkt::internal::UnknownEnumValue::String(value.to_string()),
2717 )),
2718 }
2719 }
2720 }
2721
2722 impl serde::ser::Serialize for RiskLevel {
2723 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2724 where
2725 S: serde::Serializer,
2726 {
2727 match self {
2728 Self::Unspecified => serializer.serialize_i32(0),
2729 Self::Normal => serializer.serialize_i32(1),
2730 Self::Low => serializer.serialize_i32(2),
2731 Self::UnknownValue(u) => u.0.serialize(serializer),
2732 }
2733 }
2734 }
2735
2736 impl<'de> serde::de::Deserialize<'de> for RiskLevel {
2737 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2738 where
2739 D: serde::Deserializer<'de>,
2740 {
2741 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RiskLevel>::new(
2742 ".google.cloud.websecurityscanner.v1.ScanConfig.RiskLevel",
2743 ))
2744 }
2745 }
2746
2747 /// Controls export of scan configurations and results to Security
2748 /// Command Center.
2749 ///
2750 /// # Working with unknown values
2751 ///
2752 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2753 /// additional enum variants at any time. Adding new variants is not considered
2754 /// a breaking change. Applications should write their code in anticipation of:
2755 ///
2756 /// - New values appearing in future releases of the client library, **and**
2757 /// - New values received dynamically, without application changes.
2758 ///
2759 /// Please consult the [Working with enums] section in the user guide for some
2760 /// guidelines.
2761 ///
2762 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2763 #[derive(Clone, Debug, PartialEq)]
2764 #[non_exhaustive]
2765 pub enum ExportToSecurityCommandCenter {
2766 /// Use default, which is ENABLED.
2767 Unspecified,
2768 /// Export results of this scan to Security Command Center.
2769 Enabled,
2770 /// Do not export results of this scan to Security Command Center.
2771 Disabled,
2772 /// If set, the enum was initialized with an unknown value.
2773 ///
2774 /// Applications can examine the value using [ExportToSecurityCommandCenter::value] or
2775 /// [ExportToSecurityCommandCenter::name].
2776 UnknownValue(export_to_security_command_center::UnknownValue),
2777 }
2778
2779 #[doc(hidden)]
2780 pub mod export_to_security_command_center {
2781 #[allow(unused_imports)]
2782 use super::*;
2783 #[derive(Clone, Debug, PartialEq)]
2784 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2785 }
2786
2787 impl ExportToSecurityCommandCenter {
2788 /// Gets the enum value.
2789 ///
2790 /// Returns `None` if the enum contains an unknown value deserialized from
2791 /// the string representation of enums.
2792 pub fn value(&self) -> std::option::Option<i32> {
2793 match self {
2794 Self::Unspecified => std::option::Option::Some(0),
2795 Self::Enabled => std::option::Option::Some(1),
2796 Self::Disabled => std::option::Option::Some(2),
2797 Self::UnknownValue(u) => u.0.value(),
2798 }
2799 }
2800
2801 /// Gets the enum value as a string.
2802 ///
2803 /// Returns `None` if the enum contains an unknown value deserialized from
2804 /// the integer representation of enums.
2805 pub fn name(&self) -> std::option::Option<&str> {
2806 match self {
2807 Self::Unspecified => {
2808 std::option::Option::Some("EXPORT_TO_SECURITY_COMMAND_CENTER_UNSPECIFIED")
2809 }
2810 Self::Enabled => std::option::Option::Some("ENABLED"),
2811 Self::Disabled => std::option::Option::Some("DISABLED"),
2812 Self::UnknownValue(u) => u.0.name(),
2813 }
2814 }
2815 }
2816
2817 impl std::default::Default for ExportToSecurityCommandCenter {
2818 fn default() -> Self {
2819 use std::convert::From;
2820 Self::from(0)
2821 }
2822 }
2823
2824 impl std::fmt::Display for ExportToSecurityCommandCenter {
2825 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2826 wkt::internal::display_enum(f, self.name(), self.value())
2827 }
2828 }
2829
2830 impl std::convert::From<i32> for ExportToSecurityCommandCenter {
2831 fn from(value: i32) -> Self {
2832 match value {
2833 0 => Self::Unspecified,
2834 1 => Self::Enabled,
2835 2 => Self::Disabled,
2836 _ => Self::UnknownValue(export_to_security_command_center::UnknownValue(
2837 wkt::internal::UnknownEnumValue::Integer(value),
2838 )),
2839 }
2840 }
2841 }
2842
2843 impl std::convert::From<&str> for ExportToSecurityCommandCenter {
2844 fn from(value: &str) -> Self {
2845 use std::string::ToString;
2846 match value {
2847 "EXPORT_TO_SECURITY_COMMAND_CENTER_UNSPECIFIED" => Self::Unspecified,
2848 "ENABLED" => Self::Enabled,
2849 "DISABLED" => Self::Disabled,
2850 _ => Self::UnknownValue(export_to_security_command_center::UnknownValue(
2851 wkt::internal::UnknownEnumValue::String(value.to_string()),
2852 )),
2853 }
2854 }
2855 }
2856
2857 impl serde::ser::Serialize for ExportToSecurityCommandCenter {
2858 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2859 where
2860 S: serde::Serializer,
2861 {
2862 match self {
2863 Self::Unspecified => serializer.serialize_i32(0),
2864 Self::Enabled => serializer.serialize_i32(1),
2865 Self::Disabled => serializer.serialize_i32(2),
2866 Self::UnknownValue(u) => u.0.serialize(serializer),
2867 }
2868 }
2869 }
2870
2871 impl<'de> serde::de::Deserialize<'de> for ExportToSecurityCommandCenter {
2872 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2873 where
2874 D: serde::Deserializer<'de>,
2875 {
2876 deserializer.deserialize_any(
2877 wkt::internal::EnumVisitor::<ExportToSecurityCommandCenter>::new(
2878 ".google.cloud.websecurityscanner.v1.ScanConfig.ExportToSecurityCommandCenter",
2879 ),
2880 )
2881 }
2882 }
2883}
2884
2885/// Defines a custom error message used by CreateScanConfig and UpdateScanConfig
2886/// APIs when scan configuration validation fails. It is also reported as part of
2887/// a ScanRunErrorTrace message if scan validation fails due to a scan
2888/// configuration error.
2889#[derive(Clone, Default, PartialEq)]
2890#[non_exhaustive]
2891pub struct ScanConfigError {
2892 /// Output only. Indicates the reason code for a configuration failure.
2893 pub code: crate::model::scan_config_error::Code,
2894
2895 /// Output only. Indicates the full name of the ScanConfig field that triggers this error,
2896 /// for example "scan_config.max_qps". This field is provided for
2897 /// troubleshooting purposes only and its actual value can change in the
2898 /// future.
2899 pub field_name: std::string::String,
2900
2901 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2902}
2903
2904impl ScanConfigError {
2905 /// Creates a new default instance.
2906 pub fn new() -> Self {
2907 std::default::Default::default()
2908 }
2909
2910 /// Sets the value of [code][crate::model::ScanConfigError::code].
2911 ///
2912 /// # Example
2913 /// ```ignore,no_run
2914 /// # use google_cloud_websecurityscanner_v1::model::ScanConfigError;
2915 /// use google_cloud_websecurityscanner_v1::model::scan_config_error::Code;
2916 /// let x0 = ScanConfigError::new().set_code(Code::InternalError);
2917 /// let x1 = ScanConfigError::new().set_code(Code::AppengineApiBackendError);
2918 /// let x2 = ScanConfigError::new().set_code(Code::AppengineApiNotAccessible);
2919 /// ```
2920 pub fn set_code<T: std::convert::Into<crate::model::scan_config_error::Code>>(
2921 mut self,
2922 v: T,
2923 ) -> Self {
2924 self.code = v.into();
2925 self
2926 }
2927
2928 /// Sets the value of [field_name][crate::model::ScanConfigError::field_name].
2929 ///
2930 /// # Example
2931 /// ```ignore,no_run
2932 /// # use google_cloud_websecurityscanner_v1::model::ScanConfigError;
2933 /// let x = ScanConfigError::new().set_field_name("example");
2934 /// ```
2935 pub fn set_field_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2936 self.field_name = v.into();
2937 self
2938 }
2939}
2940
2941impl wkt::message::Message for ScanConfigError {
2942 fn typename() -> &'static str {
2943 "type.googleapis.com/google.cloud.websecurityscanner.v1.ScanConfigError"
2944 }
2945}
2946
2947/// Defines additional types related to [ScanConfigError].
2948pub mod scan_config_error {
2949 #[allow(unused_imports)]
2950 use super::*;
2951
2952 /// Output only.
2953 /// Defines an error reason code.
2954 /// Next id: 44
2955 ///
2956 /// # Working with unknown values
2957 ///
2958 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2959 /// additional enum variants at any time. Adding new variants is not considered
2960 /// a breaking change. Applications should write their code in anticipation of:
2961 ///
2962 /// - New values appearing in future releases of the client library, **and**
2963 /// - New values received dynamically, without application changes.
2964 ///
2965 /// Please consult the [Working with enums] section in the user guide for some
2966 /// guidelines.
2967 ///
2968 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2969 #[derive(Clone, Debug, PartialEq)]
2970 #[non_exhaustive]
2971 pub enum Code {
2972 /// There is no error.
2973 Unspecified,
2974 /// There is no error.
2975 Ok,
2976 /// Indicates an internal server error.
2977 /// Please DO NOT USE THIS ERROR CODE unless the root cause is truly unknown.
2978 InternalError,
2979 /// One of the seed URLs is an App Engine URL but we cannot validate the scan
2980 /// settings due to an App Engine API backend error.
2981 AppengineApiBackendError,
2982 /// One of the seed URLs is an App Engine URL but we cannot access the
2983 /// App Engine API to validate scan settings.
2984 AppengineApiNotAccessible,
2985 /// One of the seed URLs is an App Engine URL but the Default Host of the
2986 /// App Engine is not set.
2987 AppengineDefaultHostMissing,
2988 /// Google corporate accounts can not be used for scanning.
2989 CannotUseGoogleComAccount,
2990 /// The account of the scan creator can not be used for scanning.
2991 CannotUseOwnerAccount,
2992 /// This scan targets Compute Engine, but we cannot validate scan settings
2993 /// due to a Compute Engine API backend error.
2994 ComputeApiBackendError,
2995 /// This scan targets Compute Engine, but we cannot access the Compute Engine
2996 /// API to validate the scan settings.
2997 ComputeApiNotAccessible,
2998 /// The Custom Login URL does not belong to the current project.
2999 CustomLoginUrlDoesNotBelongToCurrentProject,
3000 /// The Custom Login URL is malformed (can not be parsed).
3001 CustomLoginUrlMalformed,
3002 /// The Custom Login URL is mapped to a non-routable IP address in DNS.
3003 CustomLoginUrlMappedToNonRoutableAddress,
3004 /// The Custom Login URL is mapped to an IP address which is not reserved for
3005 /// the current project.
3006 CustomLoginUrlMappedToUnreservedAddress,
3007 /// The Custom Login URL has a non-routable IP address.
3008 CustomLoginUrlHasNonRoutableIpAddress,
3009 /// The Custom Login URL has an IP address which is not reserved for the
3010 /// current project.
3011 CustomLoginUrlHasUnreservedIpAddress,
3012 /// Another scan with the same name (case-sensitive) already exists.
3013 DuplicateScanName,
3014 /// A field is set to an invalid value.
3015 InvalidFieldValue,
3016 /// There was an error trying to authenticate to the scan target.
3017 FailedToAuthenticateToTarget,
3018 /// Finding type value is not specified in the list findings request.
3019 FindingTypeUnspecified,
3020 /// Scan targets Compute Engine, yet current project was not whitelisted for
3021 /// Google Compute Engine Scanning Alpha access.
3022 ForbiddenToScanCompute,
3023 /// User tries to update managed scan
3024 ForbiddenUpdateToManagedScan,
3025 /// The supplied filter is malformed. For example, it can not be parsed, does
3026 /// not have a filter type in expression, or the same filter type appears
3027 /// more than once.
3028 MalformedFilter,
3029 /// The supplied resource name is malformed (can not be parsed).
3030 MalformedResourceName,
3031 /// The current project is not in an active state.
3032 ProjectInactive,
3033 /// A required field is not set.
3034 RequiredField,
3035 /// Project id, scanconfig id, scanrun id, or finding id are not consistent
3036 /// with each other in resource name.
3037 ResourceNameInconsistent,
3038 /// The scan being requested to start is already running.
3039 ScanAlreadyRunning,
3040 /// The scan that was requested to be stopped is not running.
3041 ScanNotRunning,
3042 /// One of the seed URLs does not belong to the current project.
3043 SeedUrlDoesNotBelongToCurrentProject,
3044 /// One of the seed URLs is malformed (can not be parsed).
3045 SeedUrlMalformed,
3046 /// One of the seed URLs is mapped to a non-routable IP address in DNS.
3047 SeedUrlMappedToNonRoutableAddress,
3048 /// One of the seed URLs is mapped to an IP address which is not reserved
3049 /// for the current project.
3050 SeedUrlMappedToUnreservedAddress,
3051 /// One of the seed URLs has on-routable IP address.
3052 SeedUrlHasNonRoutableIpAddress,
3053 /// One of the seed URLs has an IP address that is not reserved
3054 /// for the current project.
3055 SeedUrlHasUnreservedIpAddress,
3056 /// The Web Security Scanner service account is not configured under the
3057 /// project.
3058 ServiceAccountNotConfigured,
3059 /// A project has reached the maximum number of scans.
3060 TooManyScans,
3061 /// Resolving the details of the current project fails.
3062 UnableToResolveProjectInfo,
3063 /// One or more blacklist patterns were in the wrong format.
3064 UnsupportedBlacklistPatternFormat,
3065 /// The supplied filter is not supported.
3066 UnsupportedFilter,
3067 /// The supplied finding type is not supported. For example, we do not
3068 /// provide findings of the given finding type.
3069 UnsupportedFindingType,
3070 /// The URL scheme of one or more of the supplied URLs is not supported.
3071 UnsupportedUrlScheme,
3072 /// If set, the enum was initialized with an unknown value.
3073 ///
3074 /// Applications can examine the value using [Code::value] or
3075 /// [Code::name].
3076 UnknownValue(code::UnknownValue),
3077 }
3078
3079 #[doc(hidden)]
3080 pub mod code {
3081 #[allow(unused_imports)]
3082 use super::*;
3083 #[derive(Clone, Debug, PartialEq)]
3084 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3085 }
3086
3087 impl Code {
3088 /// Gets the enum value.
3089 ///
3090 /// Returns `None` if the enum contains an unknown value deserialized from
3091 /// the string representation of enums.
3092 pub fn value(&self) -> std::option::Option<i32> {
3093 match self {
3094 Self::Unspecified => std::option::Option::Some(0),
3095 Self::Ok => std::option::Option::Some(0),
3096 Self::InternalError => std::option::Option::Some(1),
3097 Self::AppengineApiBackendError => std::option::Option::Some(2),
3098 Self::AppengineApiNotAccessible => std::option::Option::Some(3),
3099 Self::AppengineDefaultHostMissing => std::option::Option::Some(4),
3100 Self::CannotUseGoogleComAccount => std::option::Option::Some(6),
3101 Self::CannotUseOwnerAccount => std::option::Option::Some(7),
3102 Self::ComputeApiBackendError => std::option::Option::Some(8),
3103 Self::ComputeApiNotAccessible => std::option::Option::Some(9),
3104 Self::CustomLoginUrlDoesNotBelongToCurrentProject => std::option::Option::Some(10),
3105 Self::CustomLoginUrlMalformed => std::option::Option::Some(11),
3106 Self::CustomLoginUrlMappedToNonRoutableAddress => std::option::Option::Some(12),
3107 Self::CustomLoginUrlMappedToUnreservedAddress => std::option::Option::Some(13),
3108 Self::CustomLoginUrlHasNonRoutableIpAddress => std::option::Option::Some(14),
3109 Self::CustomLoginUrlHasUnreservedIpAddress => std::option::Option::Some(15),
3110 Self::DuplicateScanName => std::option::Option::Some(16),
3111 Self::InvalidFieldValue => std::option::Option::Some(18),
3112 Self::FailedToAuthenticateToTarget => std::option::Option::Some(19),
3113 Self::FindingTypeUnspecified => std::option::Option::Some(20),
3114 Self::ForbiddenToScanCompute => std::option::Option::Some(21),
3115 Self::ForbiddenUpdateToManagedScan => std::option::Option::Some(43),
3116 Self::MalformedFilter => std::option::Option::Some(22),
3117 Self::MalformedResourceName => std::option::Option::Some(23),
3118 Self::ProjectInactive => std::option::Option::Some(24),
3119 Self::RequiredField => std::option::Option::Some(25),
3120 Self::ResourceNameInconsistent => std::option::Option::Some(26),
3121 Self::ScanAlreadyRunning => std::option::Option::Some(27),
3122 Self::ScanNotRunning => std::option::Option::Some(28),
3123 Self::SeedUrlDoesNotBelongToCurrentProject => std::option::Option::Some(29),
3124 Self::SeedUrlMalformed => std::option::Option::Some(30),
3125 Self::SeedUrlMappedToNonRoutableAddress => std::option::Option::Some(31),
3126 Self::SeedUrlMappedToUnreservedAddress => std::option::Option::Some(32),
3127 Self::SeedUrlHasNonRoutableIpAddress => std::option::Option::Some(33),
3128 Self::SeedUrlHasUnreservedIpAddress => std::option::Option::Some(35),
3129 Self::ServiceAccountNotConfigured => std::option::Option::Some(36),
3130 Self::TooManyScans => std::option::Option::Some(37),
3131 Self::UnableToResolveProjectInfo => std::option::Option::Some(38),
3132 Self::UnsupportedBlacklistPatternFormat => std::option::Option::Some(39),
3133 Self::UnsupportedFilter => std::option::Option::Some(40),
3134 Self::UnsupportedFindingType => std::option::Option::Some(41),
3135 Self::UnsupportedUrlScheme => std::option::Option::Some(42),
3136 Self::UnknownValue(u) => u.0.value(),
3137 }
3138 }
3139
3140 /// Gets the enum value as a string.
3141 ///
3142 /// Returns `None` if the enum contains an unknown value deserialized from
3143 /// the integer representation of enums.
3144 pub fn name(&self) -> std::option::Option<&str> {
3145 match self {
3146 Self::Unspecified => std::option::Option::Some("CODE_UNSPECIFIED"),
3147 Self::Ok => std::option::Option::Some("OK"),
3148 Self::InternalError => std::option::Option::Some("INTERNAL_ERROR"),
3149 Self::AppengineApiBackendError => {
3150 std::option::Option::Some("APPENGINE_API_BACKEND_ERROR")
3151 }
3152 Self::AppengineApiNotAccessible => {
3153 std::option::Option::Some("APPENGINE_API_NOT_ACCESSIBLE")
3154 }
3155 Self::AppengineDefaultHostMissing => {
3156 std::option::Option::Some("APPENGINE_DEFAULT_HOST_MISSING")
3157 }
3158 Self::CannotUseGoogleComAccount => {
3159 std::option::Option::Some("CANNOT_USE_GOOGLE_COM_ACCOUNT")
3160 }
3161 Self::CannotUseOwnerAccount => {
3162 std::option::Option::Some("CANNOT_USE_OWNER_ACCOUNT")
3163 }
3164 Self::ComputeApiBackendError => {
3165 std::option::Option::Some("COMPUTE_API_BACKEND_ERROR")
3166 }
3167 Self::ComputeApiNotAccessible => {
3168 std::option::Option::Some("COMPUTE_API_NOT_ACCESSIBLE")
3169 }
3170 Self::CustomLoginUrlDoesNotBelongToCurrentProject => {
3171 std::option::Option::Some("CUSTOM_LOGIN_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT")
3172 }
3173 Self::CustomLoginUrlMalformed => {
3174 std::option::Option::Some("CUSTOM_LOGIN_URL_MALFORMED")
3175 }
3176 Self::CustomLoginUrlMappedToNonRoutableAddress => {
3177 std::option::Option::Some("CUSTOM_LOGIN_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS")
3178 }
3179 Self::CustomLoginUrlMappedToUnreservedAddress => {
3180 std::option::Option::Some("CUSTOM_LOGIN_URL_MAPPED_TO_UNRESERVED_ADDRESS")
3181 }
3182 Self::CustomLoginUrlHasNonRoutableIpAddress => {
3183 std::option::Option::Some("CUSTOM_LOGIN_URL_HAS_NON_ROUTABLE_IP_ADDRESS")
3184 }
3185 Self::CustomLoginUrlHasUnreservedIpAddress => {
3186 std::option::Option::Some("CUSTOM_LOGIN_URL_HAS_UNRESERVED_IP_ADDRESS")
3187 }
3188 Self::DuplicateScanName => std::option::Option::Some("DUPLICATE_SCAN_NAME"),
3189 Self::InvalidFieldValue => std::option::Option::Some("INVALID_FIELD_VALUE"),
3190 Self::FailedToAuthenticateToTarget => {
3191 std::option::Option::Some("FAILED_TO_AUTHENTICATE_TO_TARGET")
3192 }
3193 Self::FindingTypeUnspecified => {
3194 std::option::Option::Some("FINDING_TYPE_UNSPECIFIED")
3195 }
3196 Self::ForbiddenToScanCompute => {
3197 std::option::Option::Some("FORBIDDEN_TO_SCAN_COMPUTE")
3198 }
3199 Self::ForbiddenUpdateToManagedScan => {
3200 std::option::Option::Some("FORBIDDEN_UPDATE_TO_MANAGED_SCAN")
3201 }
3202 Self::MalformedFilter => std::option::Option::Some("MALFORMED_FILTER"),
3203 Self::MalformedResourceName => std::option::Option::Some("MALFORMED_RESOURCE_NAME"),
3204 Self::ProjectInactive => std::option::Option::Some("PROJECT_INACTIVE"),
3205 Self::RequiredField => std::option::Option::Some("REQUIRED_FIELD"),
3206 Self::ResourceNameInconsistent => {
3207 std::option::Option::Some("RESOURCE_NAME_INCONSISTENT")
3208 }
3209 Self::ScanAlreadyRunning => std::option::Option::Some("SCAN_ALREADY_RUNNING"),
3210 Self::ScanNotRunning => std::option::Option::Some("SCAN_NOT_RUNNING"),
3211 Self::SeedUrlDoesNotBelongToCurrentProject => {
3212 std::option::Option::Some("SEED_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT")
3213 }
3214 Self::SeedUrlMalformed => std::option::Option::Some("SEED_URL_MALFORMED"),
3215 Self::SeedUrlMappedToNonRoutableAddress => {
3216 std::option::Option::Some("SEED_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS")
3217 }
3218 Self::SeedUrlMappedToUnreservedAddress => {
3219 std::option::Option::Some("SEED_URL_MAPPED_TO_UNRESERVED_ADDRESS")
3220 }
3221 Self::SeedUrlHasNonRoutableIpAddress => {
3222 std::option::Option::Some("SEED_URL_HAS_NON_ROUTABLE_IP_ADDRESS")
3223 }
3224 Self::SeedUrlHasUnreservedIpAddress => {
3225 std::option::Option::Some("SEED_URL_HAS_UNRESERVED_IP_ADDRESS")
3226 }
3227 Self::ServiceAccountNotConfigured => {
3228 std::option::Option::Some("SERVICE_ACCOUNT_NOT_CONFIGURED")
3229 }
3230 Self::TooManyScans => std::option::Option::Some("TOO_MANY_SCANS"),
3231 Self::UnableToResolveProjectInfo => {
3232 std::option::Option::Some("UNABLE_TO_RESOLVE_PROJECT_INFO")
3233 }
3234 Self::UnsupportedBlacklistPatternFormat => {
3235 std::option::Option::Some("UNSUPPORTED_BLACKLIST_PATTERN_FORMAT")
3236 }
3237 Self::UnsupportedFilter => std::option::Option::Some("UNSUPPORTED_FILTER"),
3238 Self::UnsupportedFindingType => {
3239 std::option::Option::Some("UNSUPPORTED_FINDING_TYPE")
3240 }
3241 Self::UnsupportedUrlScheme => std::option::Option::Some("UNSUPPORTED_URL_SCHEME"),
3242 Self::UnknownValue(u) => u.0.name(),
3243 }
3244 }
3245 }
3246
3247 impl std::default::Default for Code {
3248 fn default() -> Self {
3249 use std::convert::From;
3250 Self::from(0)
3251 }
3252 }
3253
3254 impl std::fmt::Display for Code {
3255 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3256 wkt::internal::display_enum(f, self.name(), self.value())
3257 }
3258 }
3259
3260 impl std::convert::From<i32> for Code {
3261 fn from(value: i32) -> Self {
3262 match value {
3263 0 => Self::Ok,
3264 1 => Self::InternalError,
3265 2 => Self::AppengineApiBackendError,
3266 3 => Self::AppengineApiNotAccessible,
3267 4 => Self::AppengineDefaultHostMissing,
3268 6 => Self::CannotUseGoogleComAccount,
3269 7 => Self::CannotUseOwnerAccount,
3270 8 => Self::ComputeApiBackendError,
3271 9 => Self::ComputeApiNotAccessible,
3272 10 => Self::CustomLoginUrlDoesNotBelongToCurrentProject,
3273 11 => Self::CustomLoginUrlMalformed,
3274 12 => Self::CustomLoginUrlMappedToNonRoutableAddress,
3275 13 => Self::CustomLoginUrlMappedToUnreservedAddress,
3276 14 => Self::CustomLoginUrlHasNonRoutableIpAddress,
3277 15 => Self::CustomLoginUrlHasUnreservedIpAddress,
3278 16 => Self::DuplicateScanName,
3279 18 => Self::InvalidFieldValue,
3280 19 => Self::FailedToAuthenticateToTarget,
3281 20 => Self::FindingTypeUnspecified,
3282 21 => Self::ForbiddenToScanCompute,
3283 22 => Self::MalformedFilter,
3284 23 => Self::MalformedResourceName,
3285 24 => Self::ProjectInactive,
3286 25 => Self::RequiredField,
3287 26 => Self::ResourceNameInconsistent,
3288 27 => Self::ScanAlreadyRunning,
3289 28 => Self::ScanNotRunning,
3290 29 => Self::SeedUrlDoesNotBelongToCurrentProject,
3291 30 => Self::SeedUrlMalformed,
3292 31 => Self::SeedUrlMappedToNonRoutableAddress,
3293 32 => Self::SeedUrlMappedToUnreservedAddress,
3294 33 => Self::SeedUrlHasNonRoutableIpAddress,
3295 35 => Self::SeedUrlHasUnreservedIpAddress,
3296 36 => Self::ServiceAccountNotConfigured,
3297 37 => Self::TooManyScans,
3298 38 => Self::UnableToResolveProjectInfo,
3299 39 => Self::UnsupportedBlacklistPatternFormat,
3300 40 => Self::UnsupportedFilter,
3301 41 => Self::UnsupportedFindingType,
3302 42 => Self::UnsupportedUrlScheme,
3303 43 => Self::ForbiddenUpdateToManagedScan,
3304 _ => Self::UnknownValue(code::UnknownValue(
3305 wkt::internal::UnknownEnumValue::Integer(value),
3306 )),
3307 }
3308 }
3309 }
3310
3311 impl std::convert::From<&str> for Code {
3312 fn from(value: &str) -> Self {
3313 use std::string::ToString;
3314 match value {
3315 "CODE_UNSPECIFIED" => Self::Unspecified,
3316 "OK" => Self::Ok,
3317 "INTERNAL_ERROR" => Self::InternalError,
3318 "APPENGINE_API_BACKEND_ERROR" => Self::AppengineApiBackendError,
3319 "APPENGINE_API_NOT_ACCESSIBLE" => Self::AppengineApiNotAccessible,
3320 "APPENGINE_DEFAULT_HOST_MISSING" => Self::AppengineDefaultHostMissing,
3321 "CANNOT_USE_GOOGLE_COM_ACCOUNT" => Self::CannotUseGoogleComAccount,
3322 "CANNOT_USE_OWNER_ACCOUNT" => Self::CannotUseOwnerAccount,
3323 "COMPUTE_API_BACKEND_ERROR" => Self::ComputeApiBackendError,
3324 "COMPUTE_API_NOT_ACCESSIBLE" => Self::ComputeApiNotAccessible,
3325 "CUSTOM_LOGIN_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT" => {
3326 Self::CustomLoginUrlDoesNotBelongToCurrentProject
3327 }
3328 "CUSTOM_LOGIN_URL_MALFORMED" => Self::CustomLoginUrlMalformed,
3329 "CUSTOM_LOGIN_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS" => {
3330 Self::CustomLoginUrlMappedToNonRoutableAddress
3331 }
3332 "CUSTOM_LOGIN_URL_MAPPED_TO_UNRESERVED_ADDRESS" => {
3333 Self::CustomLoginUrlMappedToUnreservedAddress
3334 }
3335 "CUSTOM_LOGIN_URL_HAS_NON_ROUTABLE_IP_ADDRESS" => {
3336 Self::CustomLoginUrlHasNonRoutableIpAddress
3337 }
3338 "CUSTOM_LOGIN_URL_HAS_UNRESERVED_IP_ADDRESS" => {
3339 Self::CustomLoginUrlHasUnreservedIpAddress
3340 }
3341 "DUPLICATE_SCAN_NAME" => Self::DuplicateScanName,
3342 "INVALID_FIELD_VALUE" => Self::InvalidFieldValue,
3343 "FAILED_TO_AUTHENTICATE_TO_TARGET" => Self::FailedToAuthenticateToTarget,
3344 "FINDING_TYPE_UNSPECIFIED" => Self::FindingTypeUnspecified,
3345 "FORBIDDEN_TO_SCAN_COMPUTE" => Self::ForbiddenToScanCompute,
3346 "FORBIDDEN_UPDATE_TO_MANAGED_SCAN" => Self::ForbiddenUpdateToManagedScan,
3347 "MALFORMED_FILTER" => Self::MalformedFilter,
3348 "MALFORMED_RESOURCE_NAME" => Self::MalformedResourceName,
3349 "PROJECT_INACTIVE" => Self::ProjectInactive,
3350 "REQUIRED_FIELD" => Self::RequiredField,
3351 "RESOURCE_NAME_INCONSISTENT" => Self::ResourceNameInconsistent,
3352 "SCAN_ALREADY_RUNNING" => Self::ScanAlreadyRunning,
3353 "SCAN_NOT_RUNNING" => Self::ScanNotRunning,
3354 "SEED_URL_DOES_NOT_BELONG_TO_CURRENT_PROJECT" => {
3355 Self::SeedUrlDoesNotBelongToCurrentProject
3356 }
3357 "SEED_URL_MALFORMED" => Self::SeedUrlMalformed,
3358 "SEED_URL_MAPPED_TO_NON_ROUTABLE_ADDRESS" => {
3359 Self::SeedUrlMappedToNonRoutableAddress
3360 }
3361 "SEED_URL_MAPPED_TO_UNRESERVED_ADDRESS" => Self::SeedUrlMappedToUnreservedAddress,
3362 "SEED_URL_HAS_NON_ROUTABLE_IP_ADDRESS" => Self::SeedUrlHasNonRoutableIpAddress,
3363 "SEED_URL_HAS_UNRESERVED_IP_ADDRESS" => Self::SeedUrlHasUnreservedIpAddress,
3364 "SERVICE_ACCOUNT_NOT_CONFIGURED" => Self::ServiceAccountNotConfigured,
3365 "TOO_MANY_SCANS" => Self::TooManyScans,
3366 "UNABLE_TO_RESOLVE_PROJECT_INFO" => Self::UnableToResolveProjectInfo,
3367 "UNSUPPORTED_BLACKLIST_PATTERN_FORMAT" => Self::UnsupportedBlacklistPatternFormat,
3368 "UNSUPPORTED_FILTER" => Self::UnsupportedFilter,
3369 "UNSUPPORTED_FINDING_TYPE" => Self::UnsupportedFindingType,
3370 "UNSUPPORTED_URL_SCHEME" => Self::UnsupportedUrlScheme,
3371 _ => Self::UnknownValue(code::UnknownValue(
3372 wkt::internal::UnknownEnumValue::String(value.to_string()),
3373 )),
3374 }
3375 }
3376 }
3377
3378 impl serde::ser::Serialize for Code {
3379 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3380 where
3381 S: serde::Serializer,
3382 {
3383 match self {
3384 Self::Unspecified => serializer.serialize_i32(0),
3385 Self::Ok => serializer.serialize_i32(0),
3386 Self::InternalError => serializer.serialize_i32(1),
3387 Self::AppengineApiBackendError => serializer.serialize_i32(2),
3388 Self::AppengineApiNotAccessible => serializer.serialize_i32(3),
3389 Self::AppengineDefaultHostMissing => serializer.serialize_i32(4),
3390 Self::CannotUseGoogleComAccount => serializer.serialize_i32(6),
3391 Self::CannotUseOwnerAccount => serializer.serialize_i32(7),
3392 Self::ComputeApiBackendError => serializer.serialize_i32(8),
3393 Self::ComputeApiNotAccessible => serializer.serialize_i32(9),
3394 Self::CustomLoginUrlDoesNotBelongToCurrentProject => serializer.serialize_i32(10),
3395 Self::CustomLoginUrlMalformed => serializer.serialize_i32(11),
3396 Self::CustomLoginUrlMappedToNonRoutableAddress => serializer.serialize_i32(12),
3397 Self::CustomLoginUrlMappedToUnreservedAddress => serializer.serialize_i32(13),
3398 Self::CustomLoginUrlHasNonRoutableIpAddress => serializer.serialize_i32(14),
3399 Self::CustomLoginUrlHasUnreservedIpAddress => serializer.serialize_i32(15),
3400 Self::DuplicateScanName => serializer.serialize_i32(16),
3401 Self::InvalidFieldValue => serializer.serialize_i32(18),
3402 Self::FailedToAuthenticateToTarget => serializer.serialize_i32(19),
3403 Self::FindingTypeUnspecified => serializer.serialize_i32(20),
3404 Self::ForbiddenToScanCompute => serializer.serialize_i32(21),
3405 Self::ForbiddenUpdateToManagedScan => serializer.serialize_i32(43),
3406 Self::MalformedFilter => serializer.serialize_i32(22),
3407 Self::MalformedResourceName => serializer.serialize_i32(23),
3408 Self::ProjectInactive => serializer.serialize_i32(24),
3409 Self::RequiredField => serializer.serialize_i32(25),
3410 Self::ResourceNameInconsistent => serializer.serialize_i32(26),
3411 Self::ScanAlreadyRunning => serializer.serialize_i32(27),
3412 Self::ScanNotRunning => serializer.serialize_i32(28),
3413 Self::SeedUrlDoesNotBelongToCurrentProject => serializer.serialize_i32(29),
3414 Self::SeedUrlMalformed => serializer.serialize_i32(30),
3415 Self::SeedUrlMappedToNonRoutableAddress => serializer.serialize_i32(31),
3416 Self::SeedUrlMappedToUnreservedAddress => serializer.serialize_i32(32),
3417 Self::SeedUrlHasNonRoutableIpAddress => serializer.serialize_i32(33),
3418 Self::SeedUrlHasUnreservedIpAddress => serializer.serialize_i32(35),
3419 Self::ServiceAccountNotConfigured => serializer.serialize_i32(36),
3420 Self::TooManyScans => serializer.serialize_i32(37),
3421 Self::UnableToResolveProjectInfo => serializer.serialize_i32(38),
3422 Self::UnsupportedBlacklistPatternFormat => serializer.serialize_i32(39),
3423 Self::UnsupportedFilter => serializer.serialize_i32(40),
3424 Self::UnsupportedFindingType => serializer.serialize_i32(41),
3425 Self::UnsupportedUrlScheme => serializer.serialize_i32(42),
3426 Self::UnknownValue(u) => u.0.serialize(serializer),
3427 }
3428 }
3429 }
3430
3431 impl<'de> serde::de::Deserialize<'de> for Code {
3432 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3433 where
3434 D: serde::Deserializer<'de>,
3435 {
3436 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Code>::new(
3437 ".google.cloud.websecurityscanner.v1.ScanConfigError.Code",
3438 ))
3439 }
3440 }
3441}
3442
3443/// A ScanRun is a output-only resource representing an actual run of the scan.
3444/// Next id: 12
3445#[derive(Clone, Default, PartialEq)]
3446#[non_exhaustive]
3447pub struct ScanRun {
3448 /// Output only. The resource name of the ScanRun. The name follows the format of
3449 /// 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
3450 /// The ScanRun IDs are generated by the system.
3451 pub name: std::string::String,
3452
3453 /// Output only. The execution state of the ScanRun.
3454 pub execution_state: crate::model::scan_run::ExecutionState,
3455
3456 /// Output only. The result state of the ScanRun. This field is only available after the
3457 /// execution state reaches "FINISHED".
3458 pub result_state: crate::model::scan_run::ResultState,
3459
3460 /// Output only. The time at which the ScanRun started.
3461 pub start_time: std::option::Option<wkt::Timestamp>,
3462
3463 /// Output only. The time at which the ScanRun reached termination state - that the ScanRun
3464 /// is either finished or stopped by user.
3465 pub end_time: std::option::Option<wkt::Timestamp>,
3466
3467 /// Output only. The number of URLs crawled during this ScanRun. If the scan is in progress,
3468 /// the value represents the number of URLs crawled up to now.
3469 pub urls_crawled_count: i64,
3470
3471 /// Output only. The number of URLs tested during this ScanRun. If the scan is in progress,
3472 /// the value represents the number of URLs tested up to now. The number of
3473 /// URLs tested is usually larger than the number URLS crawled because
3474 /// typically a crawled URL is tested with multiple test payloads.
3475 pub urls_tested_count: i64,
3476
3477 /// Output only. Whether the scan run has found any vulnerabilities.
3478 pub has_vulnerabilities: bool,
3479
3480 /// Output only. The percentage of total completion ranging from 0 to 100.
3481 /// If the scan is in queue, the value is 0.
3482 /// If the scan is running, the value ranges from 0 to 100.
3483 /// If the scan is finished, the value is 100.
3484 pub progress_percent: i32,
3485
3486 /// Output only. If result_state is an ERROR, this field provides the primary reason for
3487 /// scan's termination and more details, if such are available.
3488 pub error_trace: std::option::Option<crate::model::ScanRunErrorTrace>,
3489
3490 /// Output only. A list of warnings, if such are encountered during this scan run.
3491 pub warning_traces: std::vec::Vec<crate::model::ScanRunWarningTrace>,
3492
3493 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3494}
3495
3496impl ScanRun {
3497 /// Creates a new default instance.
3498 pub fn new() -> Self {
3499 std::default::Default::default()
3500 }
3501
3502 /// Sets the value of [name][crate::model::ScanRun::name].
3503 ///
3504 /// # Example
3505 /// ```ignore,no_run
3506 /// # use google_cloud_websecurityscanner_v1::model::ScanRun;
3507 /// let x = ScanRun::new().set_name("example");
3508 /// ```
3509 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3510 self.name = v.into();
3511 self
3512 }
3513
3514 /// Sets the value of [execution_state][crate::model::ScanRun::execution_state].
3515 ///
3516 /// # Example
3517 /// ```ignore,no_run
3518 /// # use google_cloud_websecurityscanner_v1::model::ScanRun;
3519 /// use google_cloud_websecurityscanner_v1::model::scan_run::ExecutionState;
3520 /// let x0 = ScanRun::new().set_execution_state(ExecutionState::Queued);
3521 /// let x1 = ScanRun::new().set_execution_state(ExecutionState::Scanning);
3522 /// let x2 = ScanRun::new().set_execution_state(ExecutionState::Finished);
3523 /// ```
3524 pub fn set_execution_state<T: std::convert::Into<crate::model::scan_run::ExecutionState>>(
3525 mut self,
3526 v: T,
3527 ) -> Self {
3528 self.execution_state = v.into();
3529 self
3530 }
3531
3532 /// Sets the value of [result_state][crate::model::ScanRun::result_state].
3533 ///
3534 /// # Example
3535 /// ```ignore,no_run
3536 /// # use google_cloud_websecurityscanner_v1::model::ScanRun;
3537 /// use google_cloud_websecurityscanner_v1::model::scan_run::ResultState;
3538 /// let x0 = ScanRun::new().set_result_state(ResultState::Success);
3539 /// let x1 = ScanRun::new().set_result_state(ResultState::Error);
3540 /// let x2 = ScanRun::new().set_result_state(ResultState::Killed);
3541 /// ```
3542 pub fn set_result_state<T: std::convert::Into<crate::model::scan_run::ResultState>>(
3543 mut self,
3544 v: T,
3545 ) -> Self {
3546 self.result_state = v.into();
3547 self
3548 }
3549
3550 /// Sets the value of [start_time][crate::model::ScanRun::start_time].
3551 ///
3552 /// # Example
3553 /// ```ignore,no_run
3554 /// # use google_cloud_websecurityscanner_v1::model::ScanRun;
3555 /// use wkt::Timestamp;
3556 /// let x = ScanRun::new().set_start_time(Timestamp::default()/* use setters */);
3557 /// ```
3558 pub fn set_start_time<T>(mut self, v: T) -> Self
3559 where
3560 T: std::convert::Into<wkt::Timestamp>,
3561 {
3562 self.start_time = std::option::Option::Some(v.into());
3563 self
3564 }
3565
3566 /// Sets or clears the value of [start_time][crate::model::ScanRun::start_time].
3567 ///
3568 /// # Example
3569 /// ```ignore,no_run
3570 /// # use google_cloud_websecurityscanner_v1::model::ScanRun;
3571 /// use wkt::Timestamp;
3572 /// let x = ScanRun::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
3573 /// let x = ScanRun::new().set_or_clear_start_time(None::<Timestamp>);
3574 /// ```
3575 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3576 where
3577 T: std::convert::Into<wkt::Timestamp>,
3578 {
3579 self.start_time = v.map(|x| x.into());
3580 self
3581 }
3582
3583 /// Sets the value of [end_time][crate::model::ScanRun::end_time].
3584 ///
3585 /// # Example
3586 /// ```ignore,no_run
3587 /// # use google_cloud_websecurityscanner_v1::model::ScanRun;
3588 /// use wkt::Timestamp;
3589 /// let x = ScanRun::new().set_end_time(Timestamp::default()/* use setters */);
3590 /// ```
3591 pub fn set_end_time<T>(mut self, v: T) -> Self
3592 where
3593 T: std::convert::Into<wkt::Timestamp>,
3594 {
3595 self.end_time = std::option::Option::Some(v.into());
3596 self
3597 }
3598
3599 /// Sets or clears the value of [end_time][crate::model::ScanRun::end_time].
3600 ///
3601 /// # Example
3602 /// ```ignore,no_run
3603 /// # use google_cloud_websecurityscanner_v1::model::ScanRun;
3604 /// use wkt::Timestamp;
3605 /// let x = ScanRun::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
3606 /// let x = ScanRun::new().set_or_clear_end_time(None::<Timestamp>);
3607 /// ```
3608 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
3609 where
3610 T: std::convert::Into<wkt::Timestamp>,
3611 {
3612 self.end_time = v.map(|x| x.into());
3613 self
3614 }
3615
3616 /// Sets the value of [urls_crawled_count][crate::model::ScanRun::urls_crawled_count].
3617 ///
3618 /// # Example
3619 /// ```ignore,no_run
3620 /// # use google_cloud_websecurityscanner_v1::model::ScanRun;
3621 /// let x = ScanRun::new().set_urls_crawled_count(42);
3622 /// ```
3623 pub fn set_urls_crawled_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3624 self.urls_crawled_count = v.into();
3625 self
3626 }
3627
3628 /// Sets the value of [urls_tested_count][crate::model::ScanRun::urls_tested_count].
3629 ///
3630 /// # Example
3631 /// ```ignore,no_run
3632 /// # use google_cloud_websecurityscanner_v1::model::ScanRun;
3633 /// let x = ScanRun::new().set_urls_tested_count(42);
3634 /// ```
3635 pub fn set_urls_tested_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3636 self.urls_tested_count = v.into();
3637 self
3638 }
3639
3640 /// Sets the value of [has_vulnerabilities][crate::model::ScanRun::has_vulnerabilities].
3641 ///
3642 /// # Example
3643 /// ```ignore,no_run
3644 /// # use google_cloud_websecurityscanner_v1::model::ScanRun;
3645 /// let x = ScanRun::new().set_has_vulnerabilities(true);
3646 /// ```
3647 pub fn set_has_vulnerabilities<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3648 self.has_vulnerabilities = v.into();
3649 self
3650 }
3651
3652 /// Sets the value of [progress_percent][crate::model::ScanRun::progress_percent].
3653 ///
3654 /// # Example
3655 /// ```ignore,no_run
3656 /// # use google_cloud_websecurityscanner_v1::model::ScanRun;
3657 /// let x = ScanRun::new().set_progress_percent(42);
3658 /// ```
3659 pub fn set_progress_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3660 self.progress_percent = v.into();
3661 self
3662 }
3663
3664 /// Sets the value of [error_trace][crate::model::ScanRun::error_trace].
3665 ///
3666 /// # Example
3667 /// ```ignore,no_run
3668 /// # use google_cloud_websecurityscanner_v1::model::ScanRun;
3669 /// use google_cloud_websecurityscanner_v1::model::ScanRunErrorTrace;
3670 /// let x = ScanRun::new().set_error_trace(ScanRunErrorTrace::default()/* use setters */);
3671 /// ```
3672 pub fn set_error_trace<T>(mut self, v: T) -> Self
3673 where
3674 T: std::convert::Into<crate::model::ScanRunErrorTrace>,
3675 {
3676 self.error_trace = std::option::Option::Some(v.into());
3677 self
3678 }
3679
3680 /// Sets or clears the value of [error_trace][crate::model::ScanRun::error_trace].
3681 ///
3682 /// # Example
3683 /// ```ignore,no_run
3684 /// # use google_cloud_websecurityscanner_v1::model::ScanRun;
3685 /// use google_cloud_websecurityscanner_v1::model::ScanRunErrorTrace;
3686 /// let x = ScanRun::new().set_or_clear_error_trace(Some(ScanRunErrorTrace::default()/* use setters */));
3687 /// let x = ScanRun::new().set_or_clear_error_trace(None::<ScanRunErrorTrace>);
3688 /// ```
3689 pub fn set_or_clear_error_trace<T>(mut self, v: std::option::Option<T>) -> Self
3690 where
3691 T: std::convert::Into<crate::model::ScanRunErrorTrace>,
3692 {
3693 self.error_trace = v.map(|x| x.into());
3694 self
3695 }
3696
3697 /// Sets the value of [warning_traces][crate::model::ScanRun::warning_traces].
3698 ///
3699 /// # Example
3700 /// ```ignore,no_run
3701 /// # use google_cloud_websecurityscanner_v1::model::ScanRun;
3702 /// use google_cloud_websecurityscanner_v1::model::ScanRunWarningTrace;
3703 /// let x = ScanRun::new()
3704 /// .set_warning_traces([
3705 /// ScanRunWarningTrace::default()/* use setters */,
3706 /// ScanRunWarningTrace::default()/* use (different) setters */,
3707 /// ]);
3708 /// ```
3709 pub fn set_warning_traces<T, V>(mut self, v: T) -> Self
3710 where
3711 T: std::iter::IntoIterator<Item = V>,
3712 V: std::convert::Into<crate::model::ScanRunWarningTrace>,
3713 {
3714 use std::iter::Iterator;
3715 self.warning_traces = v.into_iter().map(|i| i.into()).collect();
3716 self
3717 }
3718}
3719
3720impl wkt::message::Message for ScanRun {
3721 fn typename() -> &'static str {
3722 "type.googleapis.com/google.cloud.websecurityscanner.v1.ScanRun"
3723 }
3724}
3725
3726/// Defines additional types related to [ScanRun].
3727pub mod scan_run {
3728 #[allow(unused_imports)]
3729 use super::*;
3730
3731 /// Types of ScanRun execution state.
3732 ///
3733 /// # Working with unknown values
3734 ///
3735 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3736 /// additional enum variants at any time. Adding new variants is not considered
3737 /// a breaking change. Applications should write their code in anticipation of:
3738 ///
3739 /// - New values appearing in future releases of the client library, **and**
3740 /// - New values received dynamically, without application changes.
3741 ///
3742 /// Please consult the [Working with enums] section in the user guide for some
3743 /// guidelines.
3744 ///
3745 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3746 #[derive(Clone, Debug, PartialEq)]
3747 #[non_exhaustive]
3748 pub enum ExecutionState {
3749 /// Represents an invalid state caused by internal server error. This value
3750 /// should never be returned.
3751 Unspecified,
3752 /// The scan is waiting in the queue.
3753 Queued,
3754 /// The scan is in progress.
3755 Scanning,
3756 /// The scan is either finished or stopped by user.
3757 Finished,
3758 /// If set, the enum was initialized with an unknown value.
3759 ///
3760 /// Applications can examine the value using [ExecutionState::value] or
3761 /// [ExecutionState::name].
3762 UnknownValue(execution_state::UnknownValue),
3763 }
3764
3765 #[doc(hidden)]
3766 pub mod execution_state {
3767 #[allow(unused_imports)]
3768 use super::*;
3769 #[derive(Clone, Debug, PartialEq)]
3770 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3771 }
3772
3773 impl ExecutionState {
3774 /// Gets the enum value.
3775 ///
3776 /// Returns `None` if the enum contains an unknown value deserialized from
3777 /// the string representation of enums.
3778 pub fn value(&self) -> std::option::Option<i32> {
3779 match self {
3780 Self::Unspecified => std::option::Option::Some(0),
3781 Self::Queued => std::option::Option::Some(1),
3782 Self::Scanning => std::option::Option::Some(2),
3783 Self::Finished => std::option::Option::Some(3),
3784 Self::UnknownValue(u) => u.0.value(),
3785 }
3786 }
3787
3788 /// Gets the enum value as a string.
3789 ///
3790 /// Returns `None` if the enum contains an unknown value deserialized from
3791 /// the integer representation of enums.
3792 pub fn name(&self) -> std::option::Option<&str> {
3793 match self {
3794 Self::Unspecified => std::option::Option::Some("EXECUTION_STATE_UNSPECIFIED"),
3795 Self::Queued => std::option::Option::Some("QUEUED"),
3796 Self::Scanning => std::option::Option::Some("SCANNING"),
3797 Self::Finished => std::option::Option::Some("FINISHED"),
3798 Self::UnknownValue(u) => u.0.name(),
3799 }
3800 }
3801 }
3802
3803 impl std::default::Default for ExecutionState {
3804 fn default() -> Self {
3805 use std::convert::From;
3806 Self::from(0)
3807 }
3808 }
3809
3810 impl std::fmt::Display for ExecutionState {
3811 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3812 wkt::internal::display_enum(f, self.name(), self.value())
3813 }
3814 }
3815
3816 impl std::convert::From<i32> for ExecutionState {
3817 fn from(value: i32) -> Self {
3818 match value {
3819 0 => Self::Unspecified,
3820 1 => Self::Queued,
3821 2 => Self::Scanning,
3822 3 => Self::Finished,
3823 _ => Self::UnknownValue(execution_state::UnknownValue(
3824 wkt::internal::UnknownEnumValue::Integer(value),
3825 )),
3826 }
3827 }
3828 }
3829
3830 impl std::convert::From<&str> for ExecutionState {
3831 fn from(value: &str) -> Self {
3832 use std::string::ToString;
3833 match value {
3834 "EXECUTION_STATE_UNSPECIFIED" => Self::Unspecified,
3835 "QUEUED" => Self::Queued,
3836 "SCANNING" => Self::Scanning,
3837 "FINISHED" => Self::Finished,
3838 _ => Self::UnknownValue(execution_state::UnknownValue(
3839 wkt::internal::UnknownEnumValue::String(value.to_string()),
3840 )),
3841 }
3842 }
3843 }
3844
3845 impl serde::ser::Serialize for ExecutionState {
3846 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3847 where
3848 S: serde::Serializer,
3849 {
3850 match self {
3851 Self::Unspecified => serializer.serialize_i32(0),
3852 Self::Queued => serializer.serialize_i32(1),
3853 Self::Scanning => serializer.serialize_i32(2),
3854 Self::Finished => serializer.serialize_i32(3),
3855 Self::UnknownValue(u) => u.0.serialize(serializer),
3856 }
3857 }
3858 }
3859
3860 impl<'de> serde::de::Deserialize<'de> for ExecutionState {
3861 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3862 where
3863 D: serde::Deserializer<'de>,
3864 {
3865 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExecutionState>::new(
3866 ".google.cloud.websecurityscanner.v1.ScanRun.ExecutionState",
3867 ))
3868 }
3869 }
3870
3871 /// Types of ScanRun result state.
3872 ///
3873 /// # Working with unknown values
3874 ///
3875 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3876 /// additional enum variants at any time. Adding new variants is not considered
3877 /// a breaking change. Applications should write their code in anticipation of:
3878 ///
3879 /// - New values appearing in future releases of the client library, **and**
3880 /// - New values received dynamically, without application changes.
3881 ///
3882 /// Please consult the [Working with enums] section in the user guide for some
3883 /// guidelines.
3884 ///
3885 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3886 #[derive(Clone, Debug, PartialEq)]
3887 #[non_exhaustive]
3888 pub enum ResultState {
3889 /// Default value. This value is returned when the ScanRun is not yet
3890 /// finished.
3891 Unspecified,
3892 /// The scan finished without errors.
3893 Success,
3894 /// The scan finished with errors.
3895 Error,
3896 /// The scan was terminated by user.
3897 Killed,
3898 /// If set, the enum was initialized with an unknown value.
3899 ///
3900 /// Applications can examine the value using [ResultState::value] or
3901 /// [ResultState::name].
3902 UnknownValue(result_state::UnknownValue),
3903 }
3904
3905 #[doc(hidden)]
3906 pub mod result_state {
3907 #[allow(unused_imports)]
3908 use super::*;
3909 #[derive(Clone, Debug, PartialEq)]
3910 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3911 }
3912
3913 impl ResultState {
3914 /// Gets the enum value.
3915 ///
3916 /// Returns `None` if the enum contains an unknown value deserialized from
3917 /// the string representation of enums.
3918 pub fn value(&self) -> std::option::Option<i32> {
3919 match self {
3920 Self::Unspecified => std::option::Option::Some(0),
3921 Self::Success => std::option::Option::Some(1),
3922 Self::Error => std::option::Option::Some(2),
3923 Self::Killed => std::option::Option::Some(3),
3924 Self::UnknownValue(u) => u.0.value(),
3925 }
3926 }
3927
3928 /// Gets the enum value as a string.
3929 ///
3930 /// Returns `None` if the enum contains an unknown value deserialized from
3931 /// the integer representation of enums.
3932 pub fn name(&self) -> std::option::Option<&str> {
3933 match self {
3934 Self::Unspecified => std::option::Option::Some("RESULT_STATE_UNSPECIFIED"),
3935 Self::Success => std::option::Option::Some("SUCCESS"),
3936 Self::Error => std::option::Option::Some("ERROR"),
3937 Self::Killed => std::option::Option::Some("KILLED"),
3938 Self::UnknownValue(u) => u.0.name(),
3939 }
3940 }
3941 }
3942
3943 impl std::default::Default for ResultState {
3944 fn default() -> Self {
3945 use std::convert::From;
3946 Self::from(0)
3947 }
3948 }
3949
3950 impl std::fmt::Display for ResultState {
3951 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3952 wkt::internal::display_enum(f, self.name(), self.value())
3953 }
3954 }
3955
3956 impl std::convert::From<i32> for ResultState {
3957 fn from(value: i32) -> Self {
3958 match value {
3959 0 => Self::Unspecified,
3960 1 => Self::Success,
3961 2 => Self::Error,
3962 3 => Self::Killed,
3963 _ => Self::UnknownValue(result_state::UnknownValue(
3964 wkt::internal::UnknownEnumValue::Integer(value),
3965 )),
3966 }
3967 }
3968 }
3969
3970 impl std::convert::From<&str> for ResultState {
3971 fn from(value: &str) -> Self {
3972 use std::string::ToString;
3973 match value {
3974 "RESULT_STATE_UNSPECIFIED" => Self::Unspecified,
3975 "SUCCESS" => Self::Success,
3976 "ERROR" => Self::Error,
3977 "KILLED" => Self::Killed,
3978 _ => Self::UnknownValue(result_state::UnknownValue(
3979 wkt::internal::UnknownEnumValue::String(value.to_string()),
3980 )),
3981 }
3982 }
3983 }
3984
3985 impl serde::ser::Serialize for ResultState {
3986 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3987 where
3988 S: serde::Serializer,
3989 {
3990 match self {
3991 Self::Unspecified => serializer.serialize_i32(0),
3992 Self::Success => serializer.serialize_i32(1),
3993 Self::Error => serializer.serialize_i32(2),
3994 Self::Killed => serializer.serialize_i32(3),
3995 Self::UnknownValue(u) => u.0.serialize(serializer),
3996 }
3997 }
3998 }
3999
4000 impl<'de> serde::de::Deserialize<'de> for ResultState {
4001 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4002 where
4003 D: serde::Deserializer<'de>,
4004 {
4005 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ResultState>::new(
4006 ".google.cloud.websecurityscanner.v1.ScanRun.ResultState",
4007 ))
4008 }
4009 }
4010}
4011
4012/// Output only.
4013/// Defines an error trace message for a ScanRun.
4014#[derive(Clone, Default, PartialEq)]
4015#[non_exhaustive]
4016pub struct ScanRunErrorTrace {
4017 /// Output only. Indicates the error reason code.
4018 pub code: crate::model::scan_run_error_trace::Code,
4019
4020 /// Output only. If the scan encounters SCAN_CONFIG_ISSUE error, this field has the error
4021 /// message encountered during scan configuration validation that is performed
4022 /// before each scan run.
4023 pub scan_config_error: std::option::Option<crate::model::ScanConfigError>,
4024
4025 /// Output only. If the scan encounters TOO_MANY_HTTP_ERRORS, this field indicates the most
4026 /// common HTTP error code, if such is available. For example, if this code is
4027 /// 404, the scan has encountered too many NOT_FOUND responses.
4028 pub most_common_http_error_code: i32,
4029
4030 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4031}
4032
4033impl ScanRunErrorTrace {
4034 /// Creates a new default instance.
4035 pub fn new() -> Self {
4036 std::default::Default::default()
4037 }
4038
4039 /// Sets the value of [code][crate::model::ScanRunErrorTrace::code].
4040 ///
4041 /// # Example
4042 /// ```ignore,no_run
4043 /// # use google_cloud_websecurityscanner_v1::model::ScanRunErrorTrace;
4044 /// use google_cloud_websecurityscanner_v1::model::scan_run_error_trace::Code;
4045 /// let x0 = ScanRunErrorTrace::new().set_code(Code::InternalError);
4046 /// let x1 = ScanRunErrorTrace::new().set_code(Code::ScanConfigIssue);
4047 /// let x2 = ScanRunErrorTrace::new().set_code(Code::AuthenticationConfigIssue);
4048 /// ```
4049 pub fn set_code<T: std::convert::Into<crate::model::scan_run_error_trace::Code>>(
4050 mut self,
4051 v: T,
4052 ) -> Self {
4053 self.code = v.into();
4054 self
4055 }
4056
4057 /// Sets the value of [scan_config_error][crate::model::ScanRunErrorTrace::scan_config_error].
4058 ///
4059 /// # Example
4060 /// ```ignore,no_run
4061 /// # use google_cloud_websecurityscanner_v1::model::ScanRunErrorTrace;
4062 /// use google_cloud_websecurityscanner_v1::model::ScanConfigError;
4063 /// let x = ScanRunErrorTrace::new().set_scan_config_error(ScanConfigError::default()/* use setters */);
4064 /// ```
4065 pub fn set_scan_config_error<T>(mut self, v: T) -> Self
4066 where
4067 T: std::convert::Into<crate::model::ScanConfigError>,
4068 {
4069 self.scan_config_error = std::option::Option::Some(v.into());
4070 self
4071 }
4072
4073 /// Sets or clears the value of [scan_config_error][crate::model::ScanRunErrorTrace::scan_config_error].
4074 ///
4075 /// # Example
4076 /// ```ignore,no_run
4077 /// # use google_cloud_websecurityscanner_v1::model::ScanRunErrorTrace;
4078 /// use google_cloud_websecurityscanner_v1::model::ScanConfigError;
4079 /// let x = ScanRunErrorTrace::new().set_or_clear_scan_config_error(Some(ScanConfigError::default()/* use setters */));
4080 /// let x = ScanRunErrorTrace::new().set_or_clear_scan_config_error(None::<ScanConfigError>);
4081 /// ```
4082 pub fn set_or_clear_scan_config_error<T>(mut self, v: std::option::Option<T>) -> Self
4083 where
4084 T: std::convert::Into<crate::model::ScanConfigError>,
4085 {
4086 self.scan_config_error = v.map(|x| x.into());
4087 self
4088 }
4089
4090 /// Sets the value of [most_common_http_error_code][crate::model::ScanRunErrorTrace::most_common_http_error_code].
4091 ///
4092 /// # Example
4093 /// ```ignore,no_run
4094 /// # use google_cloud_websecurityscanner_v1::model::ScanRunErrorTrace;
4095 /// let x = ScanRunErrorTrace::new().set_most_common_http_error_code(42);
4096 /// ```
4097 pub fn set_most_common_http_error_code<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4098 self.most_common_http_error_code = v.into();
4099 self
4100 }
4101}
4102
4103impl wkt::message::Message for ScanRunErrorTrace {
4104 fn typename() -> &'static str {
4105 "type.googleapis.com/google.cloud.websecurityscanner.v1.ScanRunErrorTrace"
4106 }
4107}
4108
4109/// Defines additional types related to [ScanRunErrorTrace].
4110pub mod scan_run_error_trace {
4111 #[allow(unused_imports)]
4112 use super::*;
4113
4114 /// Output only.
4115 /// Defines an error reason code.
4116 /// Next id: 8
4117 ///
4118 /// # Working with unknown values
4119 ///
4120 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4121 /// additional enum variants at any time. Adding new variants is not considered
4122 /// a breaking change. Applications should write their code in anticipation of:
4123 ///
4124 /// - New values appearing in future releases of the client library, **and**
4125 /// - New values received dynamically, without application changes.
4126 ///
4127 /// Please consult the [Working with enums] section in the user guide for some
4128 /// guidelines.
4129 ///
4130 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4131 #[derive(Clone, Debug, PartialEq)]
4132 #[non_exhaustive]
4133 pub enum Code {
4134 /// Default value is never used.
4135 Unspecified,
4136 /// Indicates that the scan run failed due to an internal server error.
4137 InternalError,
4138 /// Indicates a scan configuration error, usually due to outdated ScanConfig
4139 /// settings, such as starting_urls or the DNS configuration.
4140 ScanConfigIssue,
4141 /// Indicates an authentication error, usually due to outdated ScanConfig
4142 /// authentication settings.
4143 AuthenticationConfigIssue,
4144 /// Indicates a scan operation timeout, usually caused by a very large site.
4145 TimedOutWhileScanning,
4146 /// Indicates that a scan encountered excessive redirects, either to
4147 /// authentication or some other page outside of the scan scope.
4148 TooManyRedirects,
4149 /// Indicates that a scan encountered numerous errors from the web site
4150 /// pages. When available, most_common_http_error_code field indicates the
4151 /// most common HTTP error code encountered during the scan.
4152 TooManyHttpErrors,
4153 /// If set, the enum was initialized with an unknown value.
4154 ///
4155 /// Applications can examine the value using [Code::value] or
4156 /// [Code::name].
4157 UnknownValue(code::UnknownValue),
4158 }
4159
4160 #[doc(hidden)]
4161 pub mod code {
4162 #[allow(unused_imports)]
4163 use super::*;
4164 #[derive(Clone, Debug, PartialEq)]
4165 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4166 }
4167
4168 impl Code {
4169 /// Gets the enum value.
4170 ///
4171 /// Returns `None` if the enum contains an unknown value deserialized from
4172 /// the string representation of enums.
4173 pub fn value(&self) -> std::option::Option<i32> {
4174 match self {
4175 Self::Unspecified => std::option::Option::Some(0),
4176 Self::InternalError => std::option::Option::Some(1),
4177 Self::ScanConfigIssue => std::option::Option::Some(2),
4178 Self::AuthenticationConfigIssue => std::option::Option::Some(3),
4179 Self::TimedOutWhileScanning => std::option::Option::Some(4),
4180 Self::TooManyRedirects => std::option::Option::Some(5),
4181 Self::TooManyHttpErrors => std::option::Option::Some(6),
4182 Self::UnknownValue(u) => u.0.value(),
4183 }
4184 }
4185
4186 /// Gets the enum value as a string.
4187 ///
4188 /// Returns `None` if the enum contains an unknown value deserialized from
4189 /// the integer representation of enums.
4190 pub fn name(&self) -> std::option::Option<&str> {
4191 match self {
4192 Self::Unspecified => std::option::Option::Some("CODE_UNSPECIFIED"),
4193 Self::InternalError => std::option::Option::Some("INTERNAL_ERROR"),
4194 Self::ScanConfigIssue => std::option::Option::Some("SCAN_CONFIG_ISSUE"),
4195 Self::AuthenticationConfigIssue => {
4196 std::option::Option::Some("AUTHENTICATION_CONFIG_ISSUE")
4197 }
4198 Self::TimedOutWhileScanning => {
4199 std::option::Option::Some("TIMED_OUT_WHILE_SCANNING")
4200 }
4201 Self::TooManyRedirects => std::option::Option::Some("TOO_MANY_REDIRECTS"),
4202 Self::TooManyHttpErrors => std::option::Option::Some("TOO_MANY_HTTP_ERRORS"),
4203 Self::UnknownValue(u) => u.0.name(),
4204 }
4205 }
4206 }
4207
4208 impl std::default::Default for Code {
4209 fn default() -> Self {
4210 use std::convert::From;
4211 Self::from(0)
4212 }
4213 }
4214
4215 impl std::fmt::Display for Code {
4216 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4217 wkt::internal::display_enum(f, self.name(), self.value())
4218 }
4219 }
4220
4221 impl std::convert::From<i32> for Code {
4222 fn from(value: i32) -> Self {
4223 match value {
4224 0 => Self::Unspecified,
4225 1 => Self::InternalError,
4226 2 => Self::ScanConfigIssue,
4227 3 => Self::AuthenticationConfigIssue,
4228 4 => Self::TimedOutWhileScanning,
4229 5 => Self::TooManyRedirects,
4230 6 => Self::TooManyHttpErrors,
4231 _ => Self::UnknownValue(code::UnknownValue(
4232 wkt::internal::UnknownEnumValue::Integer(value),
4233 )),
4234 }
4235 }
4236 }
4237
4238 impl std::convert::From<&str> for Code {
4239 fn from(value: &str) -> Self {
4240 use std::string::ToString;
4241 match value {
4242 "CODE_UNSPECIFIED" => Self::Unspecified,
4243 "INTERNAL_ERROR" => Self::InternalError,
4244 "SCAN_CONFIG_ISSUE" => Self::ScanConfigIssue,
4245 "AUTHENTICATION_CONFIG_ISSUE" => Self::AuthenticationConfigIssue,
4246 "TIMED_OUT_WHILE_SCANNING" => Self::TimedOutWhileScanning,
4247 "TOO_MANY_REDIRECTS" => Self::TooManyRedirects,
4248 "TOO_MANY_HTTP_ERRORS" => Self::TooManyHttpErrors,
4249 _ => Self::UnknownValue(code::UnknownValue(
4250 wkt::internal::UnknownEnumValue::String(value.to_string()),
4251 )),
4252 }
4253 }
4254 }
4255
4256 impl serde::ser::Serialize for Code {
4257 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4258 where
4259 S: serde::Serializer,
4260 {
4261 match self {
4262 Self::Unspecified => serializer.serialize_i32(0),
4263 Self::InternalError => serializer.serialize_i32(1),
4264 Self::ScanConfigIssue => serializer.serialize_i32(2),
4265 Self::AuthenticationConfigIssue => serializer.serialize_i32(3),
4266 Self::TimedOutWhileScanning => serializer.serialize_i32(4),
4267 Self::TooManyRedirects => serializer.serialize_i32(5),
4268 Self::TooManyHttpErrors => serializer.serialize_i32(6),
4269 Self::UnknownValue(u) => u.0.serialize(serializer),
4270 }
4271 }
4272 }
4273
4274 impl<'de> serde::de::Deserialize<'de> for Code {
4275 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4276 where
4277 D: serde::Deserializer<'de>,
4278 {
4279 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Code>::new(
4280 ".google.cloud.websecurityscanner.v1.ScanRunErrorTrace.Code",
4281 ))
4282 }
4283 }
4284}
4285
4286/// A ScanRunLog is an output-only proto used for Stackdriver customer logging.
4287/// It is used for logs covering the start and end of scan pipelines.
4288/// Other than an added summary, this is a subset of the ScanRun.
4289/// Representation in logs is either a proto Struct, or converted to JSON.
4290/// Next id: 9
4291#[derive(Clone, Default, PartialEq)]
4292#[non_exhaustive]
4293pub struct ScanRunLog {
4294 /// Human friendly message about the event.
4295 pub summary: std::string::String,
4296
4297 /// The resource name of the ScanRun being logged.
4298 pub name: std::string::String,
4299
4300 /// The execution state of the ScanRun.
4301 pub execution_state: crate::model::scan_run::ExecutionState,
4302
4303 /// The result state of the ScanRun.
4304 pub result_state: crate::model::scan_run::ResultState,
4305
4306 #[allow(missing_docs)]
4307 pub urls_crawled_count: i64,
4308
4309 #[allow(missing_docs)]
4310 pub urls_tested_count: i64,
4311
4312 #[allow(missing_docs)]
4313 pub has_findings: bool,
4314
4315 #[allow(missing_docs)]
4316 pub error_trace: std::option::Option<crate::model::ScanRunErrorTrace>,
4317
4318 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4319}
4320
4321impl ScanRunLog {
4322 /// Creates a new default instance.
4323 pub fn new() -> Self {
4324 std::default::Default::default()
4325 }
4326
4327 /// Sets the value of [summary][crate::model::ScanRunLog::summary].
4328 ///
4329 /// # Example
4330 /// ```ignore,no_run
4331 /// # use google_cloud_websecurityscanner_v1::model::ScanRunLog;
4332 /// let x = ScanRunLog::new().set_summary("example");
4333 /// ```
4334 pub fn set_summary<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4335 self.summary = v.into();
4336 self
4337 }
4338
4339 /// Sets the value of [name][crate::model::ScanRunLog::name].
4340 ///
4341 /// # Example
4342 /// ```ignore,no_run
4343 /// # use google_cloud_websecurityscanner_v1::model::ScanRunLog;
4344 /// let x = ScanRunLog::new().set_name("example");
4345 /// ```
4346 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4347 self.name = v.into();
4348 self
4349 }
4350
4351 /// Sets the value of [execution_state][crate::model::ScanRunLog::execution_state].
4352 ///
4353 /// # Example
4354 /// ```ignore,no_run
4355 /// # use google_cloud_websecurityscanner_v1::model::ScanRunLog;
4356 /// use google_cloud_websecurityscanner_v1::model::scan_run::ExecutionState;
4357 /// let x0 = ScanRunLog::new().set_execution_state(ExecutionState::Queued);
4358 /// let x1 = ScanRunLog::new().set_execution_state(ExecutionState::Scanning);
4359 /// let x2 = ScanRunLog::new().set_execution_state(ExecutionState::Finished);
4360 /// ```
4361 pub fn set_execution_state<T: std::convert::Into<crate::model::scan_run::ExecutionState>>(
4362 mut self,
4363 v: T,
4364 ) -> Self {
4365 self.execution_state = v.into();
4366 self
4367 }
4368
4369 /// Sets the value of [result_state][crate::model::ScanRunLog::result_state].
4370 ///
4371 /// # Example
4372 /// ```ignore,no_run
4373 /// # use google_cloud_websecurityscanner_v1::model::ScanRunLog;
4374 /// use google_cloud_websecurityscanner_v1::model::scan_run::ResultState;
4375 /// let x0 = ScanRunLog::new().set_result_state(ResultState::Success);
4376 /// let x1 = ScanRunLog::new().set_result_state(ResultState::Error);
4377 /// let x2 = ScanRunLog::new().set_result_state(ResultState::Killed);
4378 /// ```
4379 pub fn set_result_state<T: std::convert::Into<crate::model::scan_run::ResultState>>(
4380 mut self,
4381 v: T,
4382 ) -> Self {
4383 self.result_state = v.into();
4384 self
4385 }
4386
4387 /// Sets the value of [urls_crawled_count][crate::model::ScanRunLog::urls_crawled_count].
4388 ///
4389 /// # Example
4390 /// ```ignore,no_run
4391 /// # use google_cloud_websecurityscanner_v1::model::ScanRunLog;
4392 /// let x = ScanRunLog::new().set_urls_crawled_count(42);
4393 /// ```
4394 pub fn set_urls_crawled_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4395 self.urls_crawled_count = v.into();
4396 self
4397 }
4398
4399 /// Sets the value of [urls_tested_count][crate::model::ScanRunLog::urls_tested_count].
4400 ///
4401 /// # Example
4402 /// ```ignore,no_run
4403 /// # use google_cloud_websecurityscanner_v1::model::ScanRunLog;
4404 /// let x = ScanRunLog::new().set_urls_tested_count(42);
4405 /// ```
4406 pub fn set_urls_tested_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4407 self.urls_tested_count = v.into();
4408 self
4409 }
4410
4411 /// Sets the value of [has_findings][crate::model::ScanRunLog::has_findings].
4412 ///
4413 /// # Example
4414 /// ```ignore,no_run
4415 /// # use google_cloud_websecurityscanner_v1::model::ScanRunLog;
4416 /// let x = ScanRunLog::new().set_has_findings(true);
4417 /// ```
4418 pub fn set_has_findings<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4419 self.has_findings = v.into();
4420 self
4421 }
4422
4423 /// Sets the value of [error_trace][crate::model::ScanRunLog::error_trace].
4424 ///
4425 /// # Example
4426 /// ```ignore,no_run
4427 /// # use google_cloud_websecurityscanner_v1::model::ScanRunLog;
4428 /// use google_cloud_websecurityscanner_v1::model::ScanRunErrorTrace;
4429 /// let x = ScanRunLog::new().set_error_trace(ScanRunErrorTrace::default()/* use setters */);
4430 /// ```
4431 pub fn set_error_trace<T>(mut self, v: T) -> Self
4432 where
4433 T: std::convert::Into<crate::model::ScanRunErrorTrace>,
4434 {
4435 self.error_trace = std::option::Option::Some(v.into());
4436 self
4437 }
4438
4439 /// Sets or clears the value of [error_trace][crate::model::ScanRunLog::error_trace].
4440 ///
4441 /// # Example
4442 /// ```ignore,no_run
4443 /// # use google_cloud_websecurityscanner_v1::model::ScanRunLog;
4444 /// use google_cloud_websecurityscanner_v1::model::ScanRunErrorTrace;
4445 /// let x = ScanRunLog::new().set_or_clear_error_trace(Some(ScanRunErrorTrace::default()/* use setters */));
4446 /// let x = ScanRunLog::new().set_or_clear_error_trace(None::<ScanRunErrorTrace>);
4447 /// ```
4448 pub fn set_or_clear_error_trace<T>(mut self, v: std::option::Option<T>) -> Self
4449 where
4450 T: std::convert::Into<crate::model::ScanRunErrorTrace>,
4451 {
4452 self.error_trace = v.map(|x| x.into());
4453 self
4454 }
4455}
4456
4457impl wkt::message::Message for ScanRunLog {
4458 fn typename() -> &'static str {
4459 "type.googleapis.com/google.cloud.websecurityscanner.v1.ScanRunLog"
4460 }
4461}
4462
4463/// Output only.
4464/// Defines a warning trace message for ScanRun. Warning traces provide customers
4465/// with useful information that helps make the scanning process more effective.
4466#[derive(Clone, Default, PartialEq)]
4467#[non_exhaustive]
4468pub struct ScanRunWarningTrace {
4469 /// Output only. Indicates the warning code.
4470 pub code: crate::model::scan_run_warning_trace::Code,
4471
4472 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4473}
4474
4475impl ScanRunWarningTrace {
4476 /// Creates a new default instance.
4477 pub fn new() -> Self {
4478 std::default::Default::default()
4479 }
4480
4481 /// Sets the value of [code][crate::model::ScanRunWarningTrace::code].
4482 ///
4483 /// # Example
4484 /// ```ignore,no_run
4485 /// # use google_cloud_websecurityscanner_v1::model::ScanRunWarningTrace;
4486 /// use google_cloud_websecurityscanner_v1::model::scan_run_warning_trace::Code;
4487 /// let x0 = ScanRunWarningTrace::new().set_code(Code::InsufficientCrawlResults);
4488 /// let x1 = ScanRunWarningTrace::new().set_code(Code::TooManyCrawlResults);
4489 /// let x2 = ScanRunWarningTrace::new().set_code(Code::TooManyFuzzTasks);
4490 /// ```
4491 pub fn set_code<T: std::convert::Into<crate::model::scan_run_warning_trace::Code>>(
4492 mut self,
4493 v: T,
4494 ) -> Self {
4495 self.code = v.into();
4496 self
4497 }
4498}
4499
4500impl wkt::message::Message for ScanRunWarningTrace {
4501 fn typename() -> &'static str {
4502 "type.googleapis.com/google.cloud.websecurityscanner.v1.ScanRunWarningTrace"
4503 }
4504}
4505
4506/// Defines additional types related to [ScanRunWarningTrace].
4507pub mod scan_run_warning_trace {
4508 #[allow(unused_imports)]
4509 use super::*;
4510
4511 /// Output only.
4512 /// Defines a warning message code.
4513 /// Next id: 6
4514 ///
4515 /// # Working with unknown values
4516 ///
4517 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4518 /// additional enum variants at any time. Adding new variants is not considered
4519 /// a breaking change. Applications should write their code in anticipation of:
4520 ///
4521 /// - New values appearing in future releases of the client library, **and**
4522 /// - New values received dynamically, without application changes.
4523 ///
4524 /// Please consult the [Working with enums] section in the user guide for some
4525 /// guidelines.
4526 ///
4527 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4528 #[derive(Clone, Debug, PartialEq)]
4529 #[non_exhaustive]
4530 pub enum Code {
4531 /// Default value is never used.
4532 Unspecified,
4533 /// Indicates that a scan discovered an unexpectedly low number of URLs. This
4534 /// is sometimes caused by complex navigation features or by using a single
4535 /// URL for numerous pages.
4536 InsufficientCrawlResults,
4537 /// Indicates that a scan discovered too many URLs to test, or excessive
4538 /// redundant URLs.
4539 TooManyCrawlResults,
4540 /// Indicates that too many tests have been generated for the scan. Customer
4541 /// should try reducing the number of starting URLs, increasing the QPS rate,
4542 /// or narrowing down the scope of the scan using the excluded patterns.
4543 TooManyFuzzTasks,
4544 /// Indicates that a scan is blocked by IAP.
4545 BlockedByIap,
4546 /// Indicates that no seeds is found for a scan
4547 NoStartingUrlFoundForManagedScan,
4548 /// If set, the enum was initialized with an unknown value.
4549 ///
4550 /// Applications can examine the value using [Code::value] or
4551 /// [Code::name].
4552 UnknownValue(code::UnknownValue),
4553 }
4554
4555 #[doc(hidden)]
4556 pub mod code {
4557 #[allow(unused_imports)]
4558 use super::*;
4559 #[derive(Clone, Debug, PartialEq)]
4560 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4561 }
4562
4563 impl Code {
4564 /// Gets the enum value.
4565 ///
4566 /// Returns `None` if the enum contains an unknown value deserialized from
4567 /// the string representation of enums.
4568 pub fn value(&self) -> std::option::Option<i32> {
4569 match self {
4570 Self::Unspecified => std::option::Option::Some(0),
4571 Self::InsufficientCrawlResults => std::option::Option::Some(1),
4572 Self::TooManyCrawlResults => std::option::Option::Some(2),
4573 Self::TooManyFuzzTasks => std::option::Option::Some(3),
4574 Self::BlockedByIap => std::option::Option::Some(4),
4575 Self::NoStartingUrlFoundForManagedScan => std::option::Option::Some(5),
4576 Self::UnknownValue(u) => u.0.value(),
4577 }
4578 }
4579
4580 /// Gets the enum value as a string.
4581 ///
4582 /// Returns `None` if the enum contains an unknown value deserialized from
4583 /// the integer representation of enums.
4584 pub fn name(&self) -> std::option::Option<&str> {
4585 match self {
4586 Self::Unspecified => std::option::Option::Some("CODE_UNSPECIFIED"),
4587 Self::InsufficientCrawlResults => {
4588 std::option::Option::Some("INSUFFICIENT_CRAWL_RESULTS")
4589 }
4590 Self::TooManyCrawlResults => std::option::Option::Some("TOO_MANY_CRAWL_RESULTS"),
4591 Self::TooManyFuzzTasks => std::option::Option::Some("TOO_MANY_FUZZ_TASKS"),
4592 Self::BlockedByIap => std::option::Option::Some("BLOCKED_BY_IAP"),
4593 Self::NoStartingUrlFoundForManagedScan => {
4594 std::option::Option::Some("NO_STARTING_URL_FOUND_FOR_MANAGED_SCAN")
4595 }
4596 Self::UnknownValue(u) => u.0.name(),
4597 }
4598 }
4599 }
4600
4601 impl std::default::Default for Code {
4602 fn default() -> Self {
4603 use std::convert::From;
4604 Self::from(0)
4605 }
4606 }
4607
4608 impl std::fmt::Display for Code {
4609 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4610 wkt::internal::display_enum(f, self.name(), self.value())
4611 }
4612 }
4613
4614 impl std::convert::From<i32> for Code {
4615 fn from(value: i32) -> Self {
4616 match value {
4617 0 => Self::Unspecified,
4618 1 => Self::InsufficientCrawlResults,
4619 2 => Self::TooManyCrawlResults,
4620 3 => Self::TooManyFuzzTasks,
4621 4 => Self::BlockedByIap,
4622 5 => Self::NoStartingUrlFoundForManagedScan,
4623 _ => Self::UnknownValue(code::UnknownValue(
4624 wkt::internal::UnknownEnumValue::Integer(value),
4625 )),
4626 }
4627 }
4628 }
4629
4630 impl std::convert::From<&str> for Code {
4631 fn from(value: &str) -> Self {
4632 use std::string::ToString;
4633 match value {
4634 "CODE_UNSPECIFIED" => Self::Unspecified,
4635 "INSUFFICIENT_CRAWL_RESULTS" => Self::InsufficientCrawlResults,
4636 "TOO_MANY_CRAWL_RESULTS" => Self::TooManyCrawlResults,
4637 "TOO_MANY_FUZZ_TASKS" => Self::TooManyFuzzTasks,
4638 "BLOCKED_BY_IAP" => Self::BlockedByIap,
4639 "NO_STARTING_URL_FOUND_FOR_MANAGED_SCAN" => Self::NoStartingUrlFoundForManagedScan,
4640 _ => Self::UnknownValue(code::UnknownValue(
4641 wkt::internal::UnknownEnumValue::String(value.to_string()),
4642 )),
4643 }
4644 }
4645 }
4646
4647 impl serde::ser::Serialize for Code {
4648 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4649 where
4650 S: serde::Serializer,
4651 {
4652 match self {
4653 Self::Unspecified => serializer.serialize_i32(0),
4654 Self::InsufficientCrawlResults => serializer.serialize_i32(1),
4655 Self::TooManyCrawlResults => serializer.serialize_i32(2),
4656 Self::TooManyFuzzTasks => serializer.serialize_i32(3),
4657 Self::BlockedByIap => serializer.serialize_i32(4),
4658 Self::NoStartingUrlFoundForManagedScan => serializer.serialize_i32(5),
4659 Self::UnknownValue(u) => u.0.serialize(serializer),
4660 }
4661 }
4662 }
4663
4664 impl<'de> serde::de::Deserialize<'de> for Code {
4665 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4666 where
4667 D: serde::Deserializer<'de>,
4668 {
4669 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Code>::new(
4670 ".google.cloud.websecurityscanner.v1.ScanRunWarningTrace.Code",
4671 ))
4672 }
4673 }
4674}
4675
4676/// Request for the `CreateScanConfig` method.
4677#[derive(Clone, Default, PartialEq)]
4678#[non_exhaustive]
4679pub struct CreateScanConfigRequest {
4680 /// Required. The parent resource name where the scan is created, which should be a
4681 /// project resource name in the format 'projects/{projectId}'.
4682 pub parent: std::string::String,
4683
4684 /// Required. The ScanConfig to be created.
4685 pub scan_config: std::option::Option<crate::model::ScanConfig>,
4686
4687 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4688}
4689
4690impl CreateScanConfigRequest {
4691 /// Creates a new default instance.
4692 pub fn new() -> Self {
4693 std::default::Default::default()
4694 }
4695
4696 /// Sets the value of [parent][crate::model::CreateScanConfigRequest::parent].
4697 ///
4698 /// # Example
4699 /// ```ignore,no_run
4700 /// # use google_cloud_websecurityscanner_v1::model::CreateScanConfigRequest;
4701 /// let x = CreateScanConfigRequest::new().set_parent("example");
4702 /// ```
4703 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4704 self.parent = v.into();
4705 self
4706 }
4707
4708 /// Sets the value of [scan_config][crate::model::CreateScanConfigRequest::scan_config].
4709 ///
4710 /// # Example
4711 /// ```ignore,no_run
4712 /// # use google_cloud_websecurityscanner_v1::model::CreateScanConfigRequest;
4713 /// use google_cloud_websecurityscanner_v1::model::ScanConfig;
4714 /// let x = CreateScanConfigRequest::new().set_scan_config(ScanConfig::default()/* use setters */);
4715 /// ```
4716 pub fn set_scan_config<T>(mut self, v: T) -> Self
4717 where
4718 T: std::convert::Into<crate::model::ScanConfig>,
4719 {
4720 self.scan_config = std::option::Option::Some(v.into());
4721 self
4722 }
4723
4724 /// Sets or clears the value of [scan_config][crate::model::CreateScanConfigRequest::scan_config].
4725 ///
4726 /// # Example
4727 /// ```ignore,no_run
4728 /// # use google_cloud_websecurityscanner_v1::model::CreateScanConfigRequest;
4729 /// use google_cloud_websecurityscanner_v1::model::ScanConfig;
4730 /// let x = CreateScanConfigRequest::new().set_or_clear_scan_config(Some(ScanConfig::default()/* use setters */));
4731 /// let x = CreateScanConfigRequest::new().set_or_clear_scan_config(None::<ScanConfig>);
4732 /// ```
4733 pub fn set_or_clear_scan_config<T>(mut self, v: std::option::Option<T>) -> Self
4734 where
4735 T: std::convert::Into<crate::model::ScanConfig>,
4736 {
4737 self.scan_config = v.map(|x| x.into());
4738 self
4739 }
4740}
4741
4742impl wkt::message::Message for CreateScanConfigRequest {
4743 fn typename() -> &'static str {
4744 "type.googleapis.com/google.cloud.websecurityscanner.v1.CreateScanConfigRequest"
4745 }
4746}
4747
4748/// Request for the `DeleteScanConfig` method.
4749#[derive(Clone, Default, PartialEq)]
4750#[non_exhaustive]
4751pub struct DeleteScanConfigRequest {
4752 /// Required. The resource name of the ScanConfig to be deleted. The name follows the
4753 /// format of 'projects/{projectId}/scanConfigs/{scanConfigId}'.
4754 pub name: std::string::String,
4755
4756 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4757}
4758
4759impl DeleteScanConfigRequest {
4760 /// Creates a new default instance.
4761 pub fn new() -> Self {
4762 std::default::Default::default()
4763 }
4764
4765 /// Sets the value of [name][crate::model::DeleteScanConfigRequest::name].
4766 ///
4767 /// # Example
4768 /// ```ignore,no_run
4769 /// # use google_cloud_websecurityscanner_v1::model::DeleteScanConfigRequest;
4770 /// let x = DeleteScanConfigRequest::new().set_name("example");
4771 /// ```
4772 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4773 self.name = v.into();
4774 self
4775 }
4776}
4777
4778impl wkt::message::Message for DeleteScanConfigRequest {
4779 fn typename() -> &'static str {
4780 "type.googleapis.com/google.cloud.websecurityscanner.v1.DeleteScanConfigRequest"
4781 }
4782}
4783
4784/// Request for the `GetScanConfig` method.
4785#[derive(Clone, Default, PartialEq)]
4786#[non_exhaustive]
4787pub struct GetScanConfigRequest {
4788 /// Required. The resource name of the ScanConfig to be returned. The name follows the
4789 /// format of 'projects/{projectId}/scanConfigs/{scanConfigId}'.
4790 pub name: std::string::String,
4791
4792 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4793}
4794
4795impl GetScanConfigRequest {
4796 /// Creates a new default instance.
4797 pub fn new() -> Self {
4798 std::default::Default::default()
4799 }
4800
4801 /// Sets the value of [name][crate::model::GetScanConfigRequest::name].
4802 ///
4803 /// # Example
4804 /// ```ignore,no_run
4805 /// # use google_cloud_websecurityscanner_v1::model::GetScanConfigRequest;
4806 /// let x = GetScanConfigRequest::new().set_name("example");
4807 /// ```
4808 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4809 self.name = v.into();
4810 self
4811 }
4812}
4813
4814impl wkt::message::Message for GetScanConfigRequest {
4815 fn typename() -> &'static str {
4816 "type.googleapis.com/google.cloud.websecurityscanner.v1.GetScanConfigRequest"
4817 }
4818}
4819
4820/// Request for the `ListScanConfigs` method.
4821#[derive(Clone, Default, PartialEq)]
4822#[non_exhaustive]
4823pub struct ListScanConfigsRequest {
4824 /// Required. The parent resource name, which should be a project resource name in the
4825 /// format 'projects/{projectId}'.
4826 pub parent: std::string::String,
4827
4828 /// A token identifying a page of results to be returned. This should be a
4829 /// `next_page_token` value returned from a previous List request.
4830 /// If unspecified, the first page of results is returned.
4831 pub page_token: std::string::String,
4832
4833 /// The maximum number of ScanConfigs to return, can be limited by server.
4834 /// If not specified or not positive, the implementation will select a
4835 /// reasonable value.
4836 pub page_size: i32,
4837
4838 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4839}
4840
4841impl ListScanConfigsRequest {
4842 /// Creates a new default instance.
4843 pub fn new() -> Self {
4844 std::default::Default::default()
4845 }
4846
4847 /// Sets the value of [parent][crate::model::ListScanConfigsRequest::parent].
4848 ///
4849 /// # Example
4850 /// ```ignore,no_run
4851 /// # use google_cloud_websecurityscanner_v1::model::ListScanConfigsRequest;
4852 /// let x = ListScanConfigsRequest::new().set_parent("example");
4853 /// ```
4854 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4855 self.parent = v.into();
4856 self
4857 }
4858
4859 /// Sets the value of [page_token][crate::model::ListScanConfigsRequest::page_token].
4860 ///
4861 /// # Example
4862 /// ```ignore,no_run
4863 /// # use google_cloud_websecurityscanner_v1::model::ListScanConfigsRequest;
4864 /// let x = ListScanConfigsRequest::new().set_page_token("example");
4865 /// ```
4866 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4867 self.page_token = v.into();
4868 self
4869 }
4870
4871 /// Sets the value of [page_size][crate::model::ListScanConfigsRequest::page_size].
4872 ///
4873 /// # Example
4874 /// ```ignore,no_run
4875 /// # use google_cloud_websecurityscanner_v1::model::ListScanConfigsRequest;
4876 /// let x = ListScanConfigsRequest::new().set_page_size(42);
4877 /// ```
4878 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4879 self.page_size = v.into();
4880 self
4881 }
4882}
4883
4884impl wkt::message::Message for ListScanConfigsRequest {
4885 fn typename() -> &'static str {
4886 "type.googleapis.com/google.cloud.websecurityscanner.v1.ListScanConfigsRequest"
4887 }
4888}
4889
4890/// Request for the `UpdateScanConfigRequest` method.
4891#[derive(Clone, Default, PartialEq)]
4892#[non_exhaustive]
4893pub struct UpdateScanConfigRequest {
4894 /// Required. The ScanConfig to be updated. The name field must be set to identify the
4895 /// resource to be updated. The values of fields not covered by the mask
4896 /// will be ignored.
4897 pub scan_config: std::option::Option<crate::model::ScanConfig>,
4898
4899 /// Required. The update mask applies to the resource. For the `FieldMask` definition,
4900 /// see
4901 /// <https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask>
4902 pub update_mask: std::option::Option<wkt::FieldMask>,
4903
4904 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4905}
4906
4907impl UpdateScanConfigRequest {
4908 /// Creates a new default instance.
4909 pub fn new() -> Self {
4910 std::default::Default::default()
4911 }
4912
4913 /// Sets the value of [scan_config][crate::model::UpdateScanConfigRequest::scan_config].
4914 ///
4915 /// # Example
4916 /// ```ignore,no_run
4917 /// # use google_cloud_websecurityscanner_v1::model::UpdateScanConfigRequest;
4918 /// use google_cloud_websecurityscanner_v1::model::ScanConfig;
4919 /// let x = UpdateScanConfigRequest::new().set_scan_config(ScanConfig::default()/* use setters */);
4920 /// ```
4921 pub fn set_scan_config<T>(mut self, v: T) -> Self
4922 where
4923 T: std::convert::Into<crate::model::ScanConfig>,
4924 {
4925 self.scan_config = std::option::Option::Some(v.into());
4926 self
4927 }
4928
4929 /// Sets or clears the value of [scan_config][crate::model::UpdateScanConfigRequest::scan_config].
4930 ///
4931 /// # Example
4932 /// ```ignore,no_run
4933 /// # use google_cloud_websecurityscanner_v1::model::UpdateScanConfigRequest;
4934 /// use google_cloud_websecurityscanner_v1::model::ScanConfig;
4935 /// let x = UpdateScanConfigRequest::new().set_or_clear_scan_config(Some(ScanConfig::default()/* use setters */));
4936 /// let x = UpdateScanConfigRequest::new().set_or_clear_scan_config(None::<ScanConfig>);
4937 /// ```
4938 pub fn set_or_clear_scan_config<T>(mut self, v: std::option::Option<T>) -> Self
4939 where
4940 T: std::convert::Into<crate::model::ScanConfig>,
4941 {
4942 self.scan_config = v.map(|x| x.into());
4943 self
4944 }
4945
4946 /// Sets the value of [update_mask][crate::model::UpdateScanConfigRequest::update_mask].
4947 ///
4948 /// # Example
4949 /// ```ignore,no_run
4950 /// # use google_cloud_websecurityscanner_v1::model::UpdateScanConfigRequest;
4951 /// use wkt::FieldMask;
4952 /// let x = UpdateScanConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4953 /// ```
4954 pub fn set_update_mask<T>(mut self, v: T) -> Self
4955 where
4956 T: std::convert::Into<wkt::FieldMask>,
4957 {
4958 self.update_mask = std::option::Option::Some(v.into());
4959 self
4960 }
4961
4962 /// Sets or clears the value of [update_mask][crate::model::UpdateScanConfigRequest::update_mask].
4963 ///
4964 /// # Example
4965 /// ```ignore,no_run
4966 /// # use google_cloud_websecurityscanner_v1::model::UpdateScanConfigRequest;
4967 /// use wkt::FieldMask;
4968 /// let x = UpdateScanConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4969 /// let x = UpdateScanConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4970 /// ```
4971 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4972 where
4973 T: std::convert::Into<wkt::FieldMask>,
4974 {
4975 self.update_mask = v.map(|x| x.into());
4976 self
4977 }
4978}
4979
4980impl wkt::message::Message for UpdateScanConfigRequest {
4981 fn typename() -> &'static str {
4982 "type.googleapis.com/google.cloud.websecurityscanner.v1.UpdateScanConfigRequest"
4983 }
4984}
4985
4986/// Response for the `ListScanConfigs` method.
4987#[derive(Clone, Default, PartialEq)]
4988#[non_exhaustive]
4989pub struct ListScanConfigsResponse {
4990 /// The list of ScanConfigs returned.
4991 pub scan_configs: std::vec::Vec<crate::model::ScanConfig>,
4992
4993 /// Token to retrieve the next page of results, or empty if there are no
4994 /// more results in the list.
4995 pub next_page_token: std::string::String,
4996
4997 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4998}
4999
5000impl ListScanConfigsResponse {
5001 /// Creates a new default instance.
5002 pub fn new() -> Self {
5003 std::default::Default::default()
5004 }
5005
5006 /// Sets the value of [scan_configs][crate::model::ListScanConfigsResponse::scan_configs].
5007 ///
5008 /// # Example
5009 /// ```ignore,no_run
5010 /// # use google_cloud_websecurityscanner_v1::model::ListScanConfigsResponse;
5011 /// use google_cloud_websecurityscanner_v1::model::ScanConfig;
5012 /// let x = ListScanConfigsResponse::new()
5013 /// .set_scan_configs([
5014 /// ScanConfig::default()/* use setters */,
5015 /// ScanConfig::default()/* use (different) setters */,
5016 /// ]);
5017 /// ```
5018 pub fn set_scan_configs<T, V>(mut self, v: T) -> Self
5019 where
5020 T: std::iter::IntoIterator<Item = V>,
5021 V: std::convert::Into<crate::model::ScanConfig>,
5022 {
5023 use std::iter::Iterator;
5024 self.scan_configs = v.into_iter().map(|i| i.into()).collect();
5025 self
5026 }
5027
5028 /// Sets the value of [next_page_token][crate::model::ListScanConfigsResponse::next_page_token].
5029 ///
5030 /// # Example
5031 /// ```ignore,no_run
5032 /// # use google_cloud_websecurityscanner_v1::model::ListScanConfigsResponse;
5033 /// let x = ListScanConfigsResponse::new().set_next_page_token("example");
5034 /// ```
5035 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5036 self.next_page_token = v.into();
5037 self
5038 }
5039}
5040
5041impl wkt::message::Message for ListScanConfigsResponse {
5042 fn typename() -> &'static str {
5043 "type.googleapis.com/google.cloud.websecurityscanner.v1.ListScanConfigsResponse"
5044 }
5045}
5046
5047#[doc(hidden)]
5048impl google_cloud_gax::paginator::internal::PageableResponse for ListScanConfigsResponse {
5049 type PageItem = crate::model::ScanConfig;
5050
5051 fn items(self) -> std::vec::Vec<Self::PageItem> {
5052 self.scan_configs
5053 }
5054
5055 fn next_page_token(&self) -> std::string::String {
5056 use std::clone::Clone;
5057 self.next_page_token.clone()
5058 }
5059}
5060
5061/// Request for the `StartScanRun` method.
5062#[derive(Clone, Default, PartialEq)]
5063#[non_exhaustive]
5064pub struct StartScanRunRequest {
5065 /// Required. The resource name of the ScanConfig to be used. The name follows the
5066 /// format of 'projects/{projectId}/scanConfigs/{scanConfigId}'.
5067 pub name: std::string::String,
5068
5069 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5070}
5071
5072impl StartScanRunRequest {
5073 /// Creates a new default instance.
5074 pub fn new() -> Self {
5075 std::default::Default::default()
5076 }
5077
5078 /// Sets the value of [name][crate::model::StartScanRunRequest::name].
5079 ///
5080 /// # Example
5081 /// ```ignore,no_run
5082 /// # use google_cloud_websecurityscanner_v1::model::StartScanRunRequest;
5083 /// let x = StartScanRunRequest::new().set_name("example");
5084 /// ```
5085 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5086 self.name = v.into();
5087 self
5088 }
5089}
5090
5091impl wkt::message::Message for StartScanRunRequest {
5092 fn typename() -> &'static str {
5093 "type.googleapis.com/google.cloud.websecurityscanner.v1.StartScanRunRequest"
5094 }
5095}
5096
5097/// Request for the `GetScanRun` method.
5098#[derive(Clone, Default, PartialEq)]
5099#[non_exhaustive]
5100pub struct GetScanRunRequest {
5101 /// Required. The resource name of the ScanRun to be returned. The name follows the
5102 /// format of
5103 /// 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
5104 pub name: std::string::String,
5105
5106 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5107}
5108
5109impl GetScanRunRequest {
5110 /// Creates a new default instance.
5111 pub fn new() -> Self {
5112 std::default::Default::default()
5113 }
5114
5115 /// Sets the value of [name][crate::model::GetScanRunRequest::name].
5116 ///
5117 /// # Example
5118 /// ```ignore,no_run
5119 /// # use google_cloud_websecurityscanner_v1::model::GetScanRunRequest;
5120 /// let x = GetScanRunRequest::new().set_name("example");
5121 /// ```
5122 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5123 self.name = v.into();
5124 self
5125 }
5126}
5127
5128impl wkt::message::Message for GetScanRunRequest {
5129 fn typename() -> &'static str {
5130 "type.googleapis.com/google.cloud.websecurityscanner.v1.GetScanRunRequest"
5131 }
5132}
5133
5134/// Request for the `ListScanRuns` method.
5135#[derive(Clone, Default, PartialEq)]
5136#[non_exhaustive]
5137pub struct ListScanRunsRequest {
5138 /// Required. The parent resource name, which should be a scan resource name in the
5139 /// format 'projects/{projectId}/scanConfigs/{scanConfigId}'.
5140 pub parent: std::string::String,
5141
5142 /// A token identifying a page of results to be returned. This should be a
5143 /// `next_page_token` value returned from a previous List request.
5144 /// If unspecified, the first page of results is returned.
5145 pub page_token: std::string::String,
5146
5147 /// The maximum number of ScanRuns to return, can be limited by server.
5148 /// If not specified or not positive, the implementation will select a
5149 /// reasonable value.
5150 pub page_size: i32,
5151
5152 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5153}
5154
5155impl ListScanRunsRequest {
5156 /// Creates a new default instance.
5157 pub fn new() -> Self {
5158 std::default::Default::default()
5159 }
5160
5161 /// Sets the value of [parent][crate::model::ListScanRunsRequest::parent].
5162 ///
5163 /// # Example
5164 /// ```ignore,no_run
5165 /// # use google_cloud_websecurityscanner_v1::model::ListScanRunsRequest;
5166 /// let x = ListScanRunsRequest::new().set_parent("example");
5167 /// ```
5168 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5169 self.parent = v.into();
5170 self
5171 }
5172
5173 /// Sets the value of [page_token][crate::model::ListScanRunsRequest::page_token].
5174 ///
5175 /// # Example
5176 /// ```ignore,no_run
5177 /// # use google_cloud_websecurityscanner_v1::model::ListScanRunsRequest;
5178 /// let x = ListScanRunsRequest::new().set_page_token("example");
5179 /// ```
5180 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5181 self.page_token = v.into();
5182 self
5183 }
5184
5185 /// Sets the value of [page_size][crate::model::ListScanRunsRequest::page_size].
5186 ///
5187 /// # Example
5188 /// ```ignore,no_run
5189 /// # use google_cloud_websecurityscanner_v1::model::ListScanRunsRequest;
5190 /// let x = ListScanRunsRequest::new().set_page_size(42);
5191 /// ```
5192 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5193 self.page_size = v.into();
5194 self
5195 }
5196}
5197
5198impl wkt::message::Message for ListScanRunsRequest {
5199 fn typename() -> &'static str {
5200 "type.googleapis.com/google.cloud.websecurityscanner.v1.ListScanRunsRequest"
5201 }
5202}
5203
5204/// Response for the `ListScanRuns` method.
5205#[derive(Clone, Default, PartialEq)]
5206#[non_exhaustive]
5207pub struct ListScanRunsResponse {
5208 /// The list of ScanRuns returned.
5209 pub scan_runs: std::vec::Vec<crate::model::ScanRun>,
5210
5211 /// Token to retrieve the next page of results, or empty if there are no
5212 /// more results in the list.
5213 pub next_page_token: std::string::String,
5214
5215 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5216}
5217
5218impl ListScanRunsResponse {
5219 /// Creates a new default instance.
5220 pub fn new() -> Self {
5221 std::default::Default::default()
5222 }
5223
5224 /// Sets the value of [scan_runs][crate::model::ListScanRunsResponse::scan_runs].
5225 ///
5226 /// # Example
5227 /// ```ignore,no_run
5228 /// # use google_cloud_websecurityscanner_v1::model::ListScanRunsResponse;
5229 /// use google_cloud_websecurityscanner_v1::model::ScanRun;
5230 /// let x = ListScanRunsResponse::new()
5231 /// .set_scan_runs([
5232 /// ScanRun::default()/* use setters */,
5233 /// ScanRun::default()/* use (different) setters */,
5234 /// ]);
5235 /// ```
5236 pub fn set_scan_runs<T, V>(mut self, v: T) -> Self
5237 where
5238 T: std::iter::IntoIterator<Item = V>,
5239 V: std::convert::Into<crate::model::ScanRun>,
5240 {
5241 use std::iter::Iterator;
5242 self.scan_runs = v.into_iter().map(|i| i.into()).collect();
5243 self
5244 }
5245
5246 /// Sets the value of [next_page_token][crate::model::ListScanRunsResponse::next_page_token].
5247 ///
5248 /// # Example
5249 /// ```ignore,no_run
5250 /// # use google_cloud_websecurityscanner_v1::model::ListScanRunsResponse;
5251 /// let x = ListScanRunsResponse::new().set_next_page_token("example");
5252 /// ```
5253 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5254 self.next_page_token = v.into();
5255 self
5256 }
5257}
5258
5259impl wkt::message::Message for ListScanRunsResponse {
5260 fn typename() -> &'static str {
5261 "type.googleapis.com/google.cloud.websecurityscanner.v1.ListScanRunsResponse"
5262 }
5263}
5264
5265#[doc(hidden)]
5266impl google_cloud_gax::paginator::internal::PageableResponse for ListScanRunsResponse {
5267 type PageItem = crate::model::ScanRun;
5268
5269 fn items(self) -> std::vec::Vec<Self::PageItem> {
5270 self.scan_runs
5271 }
5272
5273 fn next_page_token(&self) -> std::string::String {
5274 use std::clone::Clone;
5275 self.next_page_token.clone()
5276 }
5277}
5278
5279/// Request for the `StopScanRun` method.
5280#[derive(Clone, Default, PartialEq)]
5281#[non_exhaustive]
5282pub struct StopScanRunRequest {
5283 /// Required. The resource name of the ScanRun to be stopped. The name follows the
5284 /// format of
5285 /// 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
5286 pub name: std::string::String,
5287
5288 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5289}
5290
5291impl StopScanRunRequest {
5292 /// Creates a new default instance.
5293 pub fn new() -> Self {
5294 std::default::Default::default()
5295 }
5296
5297 /// Sets the value of [name][crate::model::StopScanRunRequest::name].
5298 ///
5299 /// # Example
5300 /// ```ignore,no_run
5301 /// # use google_cloud_websecurityscanner_v1::model::StopScanRunRequest;
5302 /// let x = StopScanRunRequest::new().set_name("example");
5303 /// ```
5304 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5305 self.name = v.into();
5306 self
5307 }
5308}
5309
5310impl wkt::message::Message for StopScanRunRequest {
5311 fn typename() -> &'static str {
5312 "type.googleapis.com/google.cloud.websecurityscanner.v1.StopScanRunRequest"
5313 }
5314}
5315
5316/// Request for the `ListCrawledUrls` method.
5317#[derive(Clone, Default, PartialEq)]
5318#[non_exhaustive]
5319pub struct ListCrawledUrlsRequest {
5320 /// Required. The parent resource name, which should be a scan run resource name in the
5321 /// format
5322 /// 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
5323 pub parent: std::string::String,
5324
5325 /// A token identifying a page of results to be returned. This should be a
5326 /// `next_page_token` value returned from a previous List request.
5327 /// If unspecified, the first page of results is returned.
5328 pub page_token: std::string::String,
5329
5330 /// The maximum number of CrawledUrls to return, can be limited by server.
5331 /// If not specified or not positive, the implementation will select a
5332 /// reasonable value.
5333 pub page_size: i32,
5334
5335 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5336}
5337
5338impl ListCrawledUrlsRequest {
5339 /// Creates a new default instance.
5340 pub fn new() -> Self {
5341 std::default::Default::default()
5342 }
5343
5344 /// Sets the value of [parent][crate::model::ListCrawledUrlsRequest::parent].
5345 ///
5346 /// # Example
5347 /// ```ignore,no_run
5348 /// # use google_cloud_websecurityscanner_v1::model::ListCrawledUrlsRequest;
5349 /// let x = ListCrawledUrlsRequest::new().set_parent("example");
5350 /// ```
5351 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5352 self.parent = v.into();
5353 self
5354 }
5355
5356 /// Sets the value of [page_token][crate::model::ListCrawledUrlsRequest::page_token].
5357 ///
5358 /// # Example
5359 /// ```ignore,no_run
5360 /// # use google_cloud_websecurityscanner_v1::model::ListCrawledUrlsRequest;
5361 /// let x = ListCrawledUrlsRequest::new().set_page_token("example");
5362 /// ```
5363 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5364 self.page_token = v.into();
5365 self
5366 }
5367
5368 /// Sets the value of [page_size][crate::model::ListCrawledUrlsRequest::page_size].
5369 ///
5370 /// # Example
5371 /// ```ignore,no_run
5372 /// # use google_cloud_websecurityscanner_v1::model::ListCrawledUrlsRequest;
5373 /// let x = ListCrawledUrlsRequest::new().set_page_size(42);
5374 /// ```
5375 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5376 self.page_size = v.into();
5377 self
5378 }
5379}
5380
5381impl wkt::message::Message for ListCrawledUrlsRequest {
5382 fn typename() -> &'static str {
5383 "type.googleapis.com/google.cloud.websecurityscanner.v1.ListCrawledUrlsRequest"
5384 }
5385}
5386
5387/// Response for the `ListCrawledUrls` method.
5388#[derive(Clone, Default, PartialEq)]
5389#[non_exhaustive]
5390pub struct ListCrawledUrlsResponse {
5391 /// The list of CrawledUrls returned.
5392 pub crawled_urls: std::vec::Vec<crate::model::CrawledUrl>,
5393
5394 /// Token to retrieve the next page of results, or empty if there are no
5395 /// more results in the list.
5396 pub next_page_token: std::string::String,
5397
5398 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5399}
5400
5401impl ListCrawledUrlsResponse {
5402 /// Creates a new default instance.
5403 pub fn new() -> Self {
5404 std::default::Default::default()
5405 }
5406
5407 /// Sets the value of [crawled_urls][crate::model::ListCrawledUrlsResponse::crawled_urls].
5408 ///
5409 /// # Example
5410 /// ```ignore,no_run
5411 /// # use google_cloud_websecurityscanner_v1::model::ListCrawledUrlsResponse;
5412 /// use google_cloud_websecurityscanner_v1::model::CrawledUrl;
5413 /// let x = ListCrawledUrlsResponse::new()
5414 /// .set_crawled_urls([
5415 /// CrawledUrl::default()/* use setters */,
5416 /// CrawledUrl::default()/* use (different) setters */,
5417 /// ]);
5418 /// ```
5419 pub fn set_crawled_urls<T, V>(mut self, v: T) -> Self
5420 where
5421 T: std::iter::IntoIterator<Item = V>,
5422 V: std::convert::Into<crate::model::CrawledUrl>,
5423 {
5424 use std::iter::Iterator;
5425 self.crawled_urls = v.into_iter().map(|i| i.into()).collect();
5426 self
5427 }
5428
5429 /// Sets the value of [next_page_token][crate::model::ListCrawledUrlsResponse::next_page_token].
5430 ///
5431 /// # Example
5432 /// ```ignore,no_run
5433 /// # use google_cloud_websecurityscanner_v1::model::ListCrawledUrlsResponse;
5434 /// let x = ListCrawledUrlsResponse::new().set_next_page_token("example");
5435 /// ```
5436 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5437 self.next_page_token = v.into();
5438 self
5439 }
5440}
5441
5442impl wkt::message::Message for ListCrawledUrlsResponse {
5443 fn typename() -> &'static str {
5444 "type.googleapis.com/google.cloud.websecurityscanner.v1.ListCrawledUrlsResponse"
5445 }
5446}
5447
5448#[doc(hidden)]
5449impl google_cloud_gax::paginator::internal::PageableResponse for ListCrawledUrlsResponse {
5450 type PageItem = crate::model::CrawledUrl;
5451
5452 fn items(self) -> std::vec::Vec<Self::PageItem> {
5453 self.crawled_urls
5454 }
5455
5456 fn next_page_token(&self) -> std::string::String {
5457 use std::clone::Clone;
5458 self.next_page_token.clone()
5459 }
5460}
5461
5462/// Request for the `GetFinding` method.
5463#[derive(Clone, Default, PartialEq)]
5464#[non_exhaustive]
5465pub struct GetFindingRequest {
5466 /// Required. The resource name of the Finding to be returned. The name follows the
5467 /// format of
5468 /// 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'.
5469 pub name: std::string::String,
5470
5471 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5472}
5473
5474impl GetFindingRequest {
5475 /// Creates a new default instance.
5476 pub fn new() -> Self {
5477 std::default::Default::default()
5478 }
5479
5480 /// Sets the value of [name][crate::model::GetFindingRequest::name].
5481 ///
5482 /// # Example
5483 /// ```ignore,no_run
5484 /// # use google_cloud_websecurityscanner_v1::model::GetFindingRequest;
5485 /// let x = GetFindingRequest::new().set_name("example");
5486 /// ```
5487 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5488 self.name = v.into();
5489 self
5490 }
5491}
5492
5493impl wkt::message::Message for GetFindingRequest {
5494 fn typename() -> &'static str {
5495 "type.googleapis.com/google.cloud.websecurityscanner.v1.GetFindingRequest"
5496 }
5497}
5498
5499/// Request for the `ListFindings` method.
5500#[derive(Clone, Default, PartialEq)]
5501#[non_exhaustive]
5502pub struct ListFindingsRequest {
5503 /// Required. The parent resource name, which should be a scan run resource name in the
5504 /// format
5505 /// 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
5506 pub parent: std::string::String,
5507
5508 /// The filter expression. The expression must be in the format: \<field\>
5509 /// \<operator\> \<value\>.
5510 /// Supported field: 'finding_type'.
5511 /// Supported operator: '='.
5512 pub filter: std::string::String,
5513
5514 /// A token identifying a page of results to be returned. This should be a
5515 /// `next_page_token` value returned from a previous List request.
5516 /// If unspecified, the first page of results is returned.
5517 pub page_token: std::string::String,
5518
5519 /// The maximum number of Findings to return, can be limited by server.
5520 /// If not specified or not positive, the implementation will select a
5521 /// reasonable value.
5522 pub page_size: i32,
5523
5524 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5525}
5526
5527impl ListFindingsRequest {
5528 /// Creates a new default instance.
5529 pub fn new() -> Self {
5530 std::default::Default::default()
5531 }
5532
5533 /// Sets the value of [parent][crate::model::ListFindingsRequest::parent].
5534 ///
5535 /// # Example
5536 /// ```ignore,no_run
5537 /// # use google_cloud_websecurityscanner_v1::model::ListFindingsRequest;
5538 /// let x = ListFindingsRequest::new().set_parent("example");
5539 /// ```
5540 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5541 self.parent = v.into();
5542 self
5543 }
5544
5545 /// Sets the value of [filter][crate::model::ListFindingsRequest::filter].
5546 ///
5547 /// # Example
5548 /// ```ignore,no_run
5549 /// # use google_cloud_websecurityscanner_v1::model::ListFindingsRequest;
5550 /// let x = ListFindingsRequest::new().set_filter("example");
5551 /// ```
5552 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5553 self.filter = v.into();
5554 self
5555 }
5556
5557 /// Sets the value of [page_token][crate::model::ListFindingsRequest::page_token].
5558 ///
5559 /// # Example
5560 /// ```ignore,no_run
5561 /// # use google_cloud_websecurityscanner_v1::model::ListFindingsRequest;
5562 /// let x = ListFindingsRequest::new().set_page_token("example");
5563 /// ```
5564 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5565 self.page_token = v.into();
5566 self
5567 }
5568
5569 /// Sets the value of [page_size][crate::model::ListFindingsRequest::page_size].
5570 ///
5571 /// # Example
5572 /// ```ignore,no_run
5573 /// # use google_cloud_websecurityscanner_v1::model::ListFindingsRequest;
5574 /// let x = ListFindingsRequest::new().set_page_size(42);
5575 /// ```
5576 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5577 self.page_size = v.into();
5578 self
5579 }
5580}
5581
5582impl wkt::message::Message for ListFindingsRequest {
5583 fn typename() -> &'static str {
5584 "type.googleapis.com/google.cloud.websecurityscanner.v1.ListFindingsRequest"
5585 }
5586}
5587
5588/// Response for the `ListFindings` method.
5589#[derive(Clone, Default, PartialEq)]
5590#[non_exhaustive]
5591pub struct ListFindingsResponse {
5592 /// The list of Findings returned.
5593 pub findings: std::vec::Vec<crate::model::Finding>,
5594
5595 /// Token to retrieve the next page of results, or empty if there are no
5596 /// more results in the list.
5597 pub next_page_token: std::string::String,
5598
5599 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5600}
5601
5602impl ListFindingsResponse {
5603 /// Creates a new default instance.
5604 pub fn new() -> Self {
5605 std::default::Default::default()
5606 }
5607
5608 /// Sets the value of [findings][crate::model::ListFindingsResponse::findings].
5609 ///
5610 /// # Example
5611 /// ```ignore,no_run
5612 /// # use google_cloud_websecurityscanner_v1::model::ListFindingsResponse;
5613 /// use google_cloud_websecurityscanner_v1::model::Finding;
5614 /// let x = ListFindingsResponse::new()
5615 /// .set_findings([
5616 /// Finding::default()/* use setters */,
5617 /// Finding::default()/* use (different) setters */,
5618 /// ]);
5619 /// ```
5620 pub fn set_findings<T, V>(mut self, v: T) -> Self
5621 where
5622 T: std::iter::IntoIterator<Item = V>,
5623 V: std::convert::Into<crate::model::Finding>,
5624 {
5625 use std::iter::Iterator;
5626 self.findings = v.into_iter().map(|i| i.into()).collect();
5627 self
5628 }
5629
5630 /// Sets the value of [next_page_token][crate::model::ListFindingsResponse::next_page_token].
5631 ///
5632 /// # Example
5633 /// ```ignore,no_run
5634 /// # use google_cloud_websecurityscanner_v1::model::ListFindingsResponse;
5635 /// let x = ListFindingsResponse::new().set_next_page_token("example");
5636 /// ```
5637 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5638 self.next_page_token = v.into();
5639 self
5640 }
5641}
5642
5643impl wkt::message::Message for ListFindingsResponse {
5644 fn typename() -> &'static str {
5645 "type.googleapis.com/google.cloud.websecurityscanner.v1.ListFindingsResponse"
5646 }
5647}
5648
5649#[doc(hidden)]
5650impl google_cloud_gax::paginator::internal::PageableResponse for ListFindingsResponse {
5651 type PageItem = crate::model::Finding;
5652
5653 fn items(self) -> std::vec::Vec<Self::PageItem> {
5654 self.findings
5655 }
5656
5657 fn next_page_token(&self) -> std::string::String {
5658 use std::clone::Clone;
5659 self.next_page_token.clone()
5660 }
5661}
5662
5663/// Request for the `ListFindingTypeStats` method.
5664#[derive(Clone, Default, PartialEq)]
5665#[non_exhaustive]
5666pub struct ListFindingTypeStatsRequest {
5667 /// Required. The parent resource name, which should be a scan run resource name in the
5668 /// format
5669 /// 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
5670 pub parent: std::string::String,
5671
5672 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5673}
5674
5675impl ListFindingTypeStatsRequest {
5676 /// Creates a new default instance.
5677 pub fn new() -> Self {
5678 std::default::Default::default()
5679 }
5680
5681 /// Sets the value of [parent][crate::model::ListFindingTypeStatsRequest::parent].
5682 ///
5683 /// # Example
5684 /// ```ignore,no_run
5685 /// # use google_cloud_websecurityscanner_v1::model::ListFindingTypeStatsRequest;
5686 /// let x = ListFindingTypeStatsRequest::new().set_parent("example");
5687 /// ```
5688 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5689 self.parent = v.into();
5690 self
5691 }
5692}
5693
5694impl wkt::message::Message for ListFindingTypeStatsRequest {
5695 fn typename() -> &'static str {
5696 "type.googleapis.com/google.cloud.websecurityscanner.v1.ListFindingTypeStatsRequest"
5697 }
5698}
5699
5700/// Response for the `ListFindingTypeStats` method.
5701#[derive(Clone, Default, PartialEq)]
5702#[non_exhaustive]
5703pub struct ListFindingTypeStatsResponse {
5704 /// The list of FindingTypeStats returned.
5705 pub finding_type_stats: std::vec::Vec<crate::model::FindingTypeStats>,
5706
5707 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5708}
5709
5710impl ListFindingTypeStatsResponse {
5711 /// Creates a new default instance.
5712 pub fn new() -> Self {
5713 std::default::Default::default()
5714 }
5715
5716 /// Sets the value of [finding_type_stats][crate::model::ListFindingTypeStatsResponse::finding_type_stats].
5717 ///
5718 /// # Example
5719 /// ```ignore,no_run
5720 /// # use google_cloud_websecurityscanner_v1::model::ListFindingTypeStatsResponse;
5721 /// use google_cloud_websecurityscanner_v1::model::FindingTypeStats;
5722 /// let x = ListFindingTypeStatsResponse::new()
5723 /// .set_finding_type_stats([
5724 /// FindingTypeStats::default()/* use setters */,
5725 /// FindingTypeStats::default()/* use (different) setters */,
5726 /// ]);
5727 /// ```
5728 pub fn set_finding_type_stats<T, V>(mut self, v: T) -> Self
5729 where
5730 T: std::iter::IntoIterator<Item = V>,
5731 V: std::convert::Into<crate::model::FindingTypeStats>,
5732 {
5733 use std::iter::Iterator;
5734 self.finding_type_stats = v.into_iter().map(|i| i.into()).collect();
5735 self
5736 }
5737}
5738
5739impl wkt::message::Message for ListFindingTypeStatsResponse {
5740 fn typename() -> &'static str {
5741 "type.googleapis.com/google.cloud.websecurityscanner.v1.ListFindingTypeStatsResponse"
5742 }
5743}