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