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