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