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