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