1#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate grafeas;
25extern crate iam_v1;
26extern crate lazy_static;
27extern crate reqwest;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35#[derive(Clone, Debug, Default, PartialEq)]
38#[non_exhaustive]
39pub struct ExportSBOMRequest {
40 pub name: std::string::String,
43
44 pub target: std::option::Option<crate::model::export_sbom_request::Target>,
46
47 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
48}
49
50impl ExportSBOMRequest {
51 pub fn new() -> Self {
52 std::default::Default::default()
53 }
54
55 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
57 self.name = v.into();
58 self
59 }
60
61 pub fn set_target<
66 T: std::convert::Into<std::option::Option<crate::model::export_sbom_request::Target>>,
67 >(
68 mut self,
69 v: T,
70 ) -> Self {
71 self.target = v.into();
72 self
73 }
74
75 pub fn cloud_storage_location(
79 &self,
80 ) -> std::option::Option<
81 &std::boxed::Box<crate::model::export_sbom_request::CloudStorageLocation>,
82 > {
83 #[allow(unreachable_patterns)]
84 self.target.as_ref().and_then(|v| match v {
85 crate::model::export_sbom_request::Target::CloudStorageLocation(v) => {
86 std::option::Option::Some(v)
87 }
88 _ => std::option::Option::None,
89 })
90 }
91
92 pub fn set_cloud_storage_location<
98 T: std::convert::Into<
99 std::boxed::Box<crate::model::export_sbom_request::CloudStorageLocation>,
100 >,
101 >(
102 mut self,
103 v: T,
104 ) -> Self {
105 self.target = std::option::Option::Some(
106 crate::model::export_sbom_request::Target::CloudStorageLocation(v.into()),
107 );
108 self
109 }
110}
111
112impl wkt::message::Message for ExportSBOMRequest {
113 fn typename() -> &'static str {
114 "type.googleapis.com/google.devtools.containeranalysis.v1.ExportSBOMRequest"
115 }
116}
117
118#[doc(hidden)]
119impl<'de> serde::de::Deserialize<'de> for ExportSBOMRequest {
120 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
121 where
122 D: serde::Deserializer<'de>,
123 {
124 #[allow(non_camel_case_types)]
125 #[doc(hidden)]
126 #[derive(PartialEq, Eq, Hash)]
127 enum __FieldTag {
128 __name,
129 __cloud_storage_location,
130 Unknown(std::string::String),
131 }
132 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
133 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
134 where
135 D: serde::Deserializer<'de>,
136 {
137 struct Visitor;
138 impl<'de> serde::de::Visitor<'de> for Visitor {
139 type Value = __FieldTag;
140 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
141 formatter.write_str("a field name for ExportSBOMRequest")
142 }
143 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
144 where
145 E: serde::de::Error,
146 {
147 use std::result::Result::Ok;
148 use std::string::ToString;
149 match value {
150 "name" => Ok(__FieldTag::__name),
151 "cloudStorageLocation" => Ok(__FieldTag::__cloud_storage_location),
152 "cloud_storage_location" => Ok(__FieldTag::__cloud_storage_location),
153 _ => Ok(__FieldTag::Unknown(value.to_string())),
154 }
155 }
156 }
157 deserializer.deserialize_identifier(Visitor)
158 }
159 }
160 struct Visitor;
161 impl<'de> serde::de::Visitor<'de> for Visitor {
162 type Value = ExportSBOMRequest;
163 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
164 formatter.write_str("struct ExportSBOMRequest")
165 }
166 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
167 where
168 A: serde::de::MapAccess<'de>,
169 {
170 #[allow(unused_imports)]
171 use serde::de::Error;
172 use std::option::Option::Some;
173 let mut fields = std::collections::HashSet::new();
174 let mut result = Self::Value::new();
175 while let Some(tag) = map.next_key::<__FieldTag>()? {
176 #[allow(clippy::match_single_binding)]
177 match tag {
178 __FieldTag::__name => {
179 if !fields.insert(__FieldTag::__name) {
180 return std::result::Result::Err(A::Error::duplicate_field(
181 "multiple values for name",
182 ));
183 }
184 result.name = map
185 .next_value::<std::option::Option<std::string::String>>()?
186 .unwrap_or_default();
187 }
188 __FieldTag::__cloud_storage_location => {
189 if !fields.insert(__FieldTag::__cloud_storage_location) {
190 return std::result::Result::Err(A::Error::duplicate_field(
191 "multiple values for cloud_storage_location",
192 ));
193 }
194 if result.target.is_some() {
195 return std::result::Result::Err(A::Error::duplicate_field(
196 "multiple values for `target`, a oneof with full ID .google.devtools.containeranalysis.v1.ExportSBOMRequest.cloud_storage_location, latest field was cloudStorageLocation",
197 ));
198 }
199 result.target = std::option::Option::Some(
200 crate::model::export_sbom_request::Target::CloudStorageLocation(
201 map.next_value::<std::option::Option<
202 std::boxed::Box<
203 crate::model::export_sbom_request::CloudStorageLocation,
204 >,
205 >>()?
206 .unwrap_or_default(),
207 ),
208 );
209 }
210 __FieldTag::Unknown(key) => {
211 let value = map.next_value::<serde_json::Value>()?;
212 result._unknown_fields.insert(key, value);
213 }
214 }
215 }
216 std::result::Result::Ok(result)
217 }
218 }
219 deserializer.deserialize_any(Visitor)
220 }
221}
222
223#[doc(hidden)]
224impl serde::ser::Serialize for ExportSBOMRequest {
225 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
226 where
227 S: serde::ser::Serializer,
228 {
229 use serde::ser::SerializeMap;
230 #[allow(unused_imports)]
231 use std::option::Option::Some;
232 let mut state = serializer.serialize_map(std::option::Option::None)?;
233 if !self.name.is_empty() {
234 state.serialize_entry("name", &self.name)?;
235 }
236 if let Some(value) = self.cloud_storage_location() {
237 state.serialize_entry("cloudStorageLocation", value)?;
238 }
239 if !self._unknown_fields.is_empty() {
240 for (key, value) in self._unknown_fields.iter() {
241 state.serialize_entry(key, &value)?;
242 }
243 }
244 state.end()
245 }
246}
247
248pub mod export_sbom_request {
250 #[allow(unused_imports)]
251 use super::*;
252
253 #[derive(Clone, Debug, Default, PartialEq)]
256 #[non_exhaustive]
257 pub struct CloudStorageLocation {
258 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
259 }
260
261 impl CloudStorageLocation {
262 pub fn new() -> Self {
263 std::default::Default::default()
264 }
265 }
266
267 impl wkt::message::Message for CloudStorageLocation {
268 fn typename() -> &'static str {
269 "type.googleapis.com/google.devtools.containeranalysis.v1.ExportSBOMRequest.CloudStorageLocation"
270 }
271 }
272
273 #[doc(hidden)]
274 impl<'de> serde::de::Deserialize<'de> for CloudStorageLocation {
275 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
276 where
277 D: serde::Deserializer<'de>,
278 {
279 #[allow(non_camel_case_types)]
280 #[doc(hidden)]
281 #[derive(PartialEq, Eq, Hash)]
282 enum __FieldTag {
283 Unknown(std::string::String),
284 }
285 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
286 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
287 where
288 D: serde::Deserializer<'de>,
289 {
290 struct Visitor;
291 impl<'de> serde::de::Visitor<'de> for Visitor {
292 type Value = __FieldTag;
293 fn expecting(
294 &self,
295 formatter: &mut std::fmt::Formatter,
296 ) -> std::fmt::Result {
297 formatter.write_str("a field name for CloudStorageLocation")
298 }
299 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
300 where
301 E: serde::de::Error,
302 {
303 use std::result::Result::Ok;
304 use std::string::ToString;
305 Ok(__FieldTag::Unknown(value.to_string()))
306 }
307 }
308 deserializer.deserialize_identifier(Visitor)
309 }
310 }
311 struct Visitor;
312 impl<'de> serde::de::Visitor<'de> for Visitor {
313 type Value = CloudStorageLocation;
314 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
315 formatter.write_str("struct CloudStorageLocation")
316 }
317 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
318 where
319 A: serde::de::MapAccess<'de>,
320 {
321 #[allow(unused_imports)]
322 use serde::de::Error;
323 use std::option::Option::Some;
324 let mut result = Self::Value::new();
325 while let Some(tag) = map.next_key::<__FieldTag>()? {
326 #[allow(clippy::match_single_binding)]
327 match tag {
328 __FieldTag::Unknown(key) => {
329 let value = map.next_value::<serde_json::Value>()?;
330 result._unknown_fields.insert(key, value);
331 }
332 }
333 }
334 std::result::Result::Ok(result)
335 }
336 }
337 deserializer.deserialize_any(Visitor)
338 }
339 }
340
341 #[doc(hidden)]
342 impl serde::ser::Serialize for CloudStorageLocation {
343 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
344 where
345 S: serde::ser::Serializer,
346 {
347 use serde::ser::SerializeMap;
348 #[allow(unused_imports)]
349 use std::option::Option::Some;
350 let mut state = serializer.serialize_map(std::option::Option::None)?;
351 if !self._unknown_fields.is_empty() {
352 for (key, value) in self._unknown_fields.iter() {
353 state.serialize_entry(key, &value)?;
354 }
355 }
356 state.end()
357 }
358 }
359
360 #[derive(Clone, Debug, PartialEq)]
362 #[non_exhaustive]
363 pub enum Target {
364 CloudStorageLocation(
367 std::boxed::Box<crate::model::export_sbom_request::CloudStorageLocation>,
368 ),
369 }
370}
371
372#[derive(Clone, Debug, Default, PartialEq)]
374#[non_exhaustive]
375pub struct ExportSBOMResponse {
376 pub discovery_occurrence: std::string::String,
380
381 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
382}
383
384impl ExportSBOMResponse {
385 pub fn new() -> Self {
386 std::default::Default::default()
387 }
388
389 pub fn set_discovery_occurrence<T: std::convert::Into<std::string::String>>(
391 mut self,
392 v: T,
393 ) -> Self {
394 self.discovery_occurrence = v.into();
395 self
396 }
397}
398
399impl wkt::message::Message for ExportSBOMResponse {
400 fn typename() -> &'static str {
401 "type.googleapis.com/google.devtools.containeranalysis.v1.ExportSBOMResponse"
402 }
403}
404
405#[doc(hidden)]
406impl<'de> serde::de::Deserialize<'de> for ExportSBOMResponse {
407 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
408 where
409 D: serde::Deserializer<'de>,
410 {
411 #[allow(non_camel_case_types)]
412 #[doc(hidden)]
413 #[derive(PartialEq, Eq, Hash)]
414 enum __FieldTag {
415 __discovery_occurrence,
416 Unknown(std::string::String),
417 }
418 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
419 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
420 where
421 D: serde::Deserializer<'de>,
422 {
423 struct Visitor;
424 impl<'de> serde::de::Visitor<'de> for Visitor {
425 type Value = __FieldTag;
426 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
427 formatter.write_str("a field name for ExportSBOMResponse")
428 }
429 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
430 where
431 E: serde::de::Error,
432 {
433 use std::result::Result::Ok;
434 use std::string::ToString;
435 match value {
436 "discoveryOccurrence" => Ok(__FieldTag::__discovery_occurrence),
437 "discovery_occurrence" => Ok(__FieldTag::__discovery_occurrence),
438 _ => Ok(__FieldTag::Unknown(value.to_string())),
439 }
440 }
441 }
442 deserializer.deserialize_identifier(Visitor)
443 }
444 }
445 struct Visitor;
446 impl<'de> serde::de::Visitor<'de> for Visitor {
447 type Value = ExportSBOMResponse;
448 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
449 formatter.write_str("struct ExportSBOMResponse")
450 }
451 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
452 where
453 A: serde::de::MapAccess<'de>,
454 {
455 #[allow(unused_imports)]
456 use serde::de::Error;
457 use std::option::Option::Some;
458 let mut fields = std::collections::HashSet::new();
459 let mut result = Self::Value::new();
460 while let Some(tag) = map.next_key::<__FieldTag>()? {
461 #[allow(clippy::match_single_binding)]
462 match tag {
463 __FieldTag::__discovery_occurrence => {
464 if !fields.insert(__FieldTag::__discovery_occurrence) {
465 return std::result::Result::Err(A::Error::duplicate_field(
466 "multiple values for discovery_occurrence",
467 ));
468 }
469 result.discovery_occurrence = map
470 .next_value::<std::option::Option<std::string::String>>()?
471 .unwrap_or_default();
472 }
473 __FieldTag::Unknown(key) => {
474 let value = map.next_value::<serde_json::Value>()?;
475 result._unknown_fields.insert(key, value);
476 }
477 }
478 }
479 std::result::Result::Ok(result)
480 }
481 }
482 deserializer.deserialize_any(Visitor)
483 }
484}
485
486#[doc(hidden)]
487impl serde::ser::Serialize for ExportSBOMResponse {
488 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
489 where
490 S: serde::ser::Serializer,
491 {
492 use serde::ser::SerializeMap;
493 #[allow(unused_imports)]
494 use std::option::Option::Some;
495 let mut state = serializer.serialize_map(std::option::Option::None)?;
496 if !self.discovery_occurrence.is_empty() {
497 state.serialize_entry("discoveryOccurrence", &self.discovery_occurrence)?;
498 }
499 if !self._unknown_fields.is_empty() {
500 for (key, value) in self._unknown_fields.iter() {
501 state.serialize_entry(key, &value)?;
502 }
503 }
504 state.end()
505 }
506}
507
508#[derive(Clone, Debug, Default, PartialEq)]
510#[non_exhaustive]
511pub struct GetVulnerabilityOccurrencesSummaryRequest {
512 pub parent: std::string::String,
515
516 pub filter: std::string::String,
518
519 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
520}
521
522impl GetVulnerabilityOccurrencesSummaryRequest {
523 pub fn new() -> Self {
524 std::default::Default::default()
525 }
526
527 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
529 self.parent = v.into();
530 self
531 }
532
533 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
535 self.filter = v.into();
536 self
537 }
538}
539
540impl wkt::message::Message for GetVulnerabilityOccurrencesSummaryRequest {
541 fn typename() -> &'static str {
542 "type.googleapis.com/google.devtools.containeranalysis.v1.GetVulnerabilityOccurrencesSummaryRequest"
543 }
544}
545
546#[doc(hidden)]
547impl<'de> serde::de::Deserialize<'de> for GetVulnerabilityOccurrencesSummaryRequest {
548 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
549 where
550 D: serde::Deserializer<'de>,
551 {
552 #[allow(non_camel_case_types)]
553 #[doc(hidden)]
554 #[derive(PartialEq, Eq, Hash)]
555 enum __FieldTag {
556 __parent,
557 __filter,
558 Unknown(std::string::String),
559 }
560 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
561 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
562 where
563 D: serde::Deserializer<'de>,
564 {
565 struct Visitor;
566 impl<'de> serde::de::Visitor<'de> for Visitor {
567 type Value = __FieldTag;
568 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
569 formatter
570 .write_str("a field name for GetVulnerabilityOccurrencesSummaryRequest")
571 }
572 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
573 where
574 E: serde::de::Error,
575 {
576 use std::result::Result::Ok;
577 use std::string::ToString;
578 match value {
579 "parent" => Ok(__FieldTag::__parent),
580 "filter" => Ok(__FieldTag::__filter),
581 _ => Ok(__FieldTag::Unknown(value.to_string())),
582 }
583 }
584 }
585 deserializer.deserialize_identifier(Visitor)
586 }
587 }
588 struct Visitor;
589 impl<'de> serde::de::Visitor<'de> for Visitor {
590 type Value = GetVulnerabilityOccurrencesSummaryRequest;
591 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
592 formatter.write_str("struct GetVulnerabilityOccurrencesSummaryRequest")
593 }
594 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
595 where
596 A: serde::de::MapAccess<'de>,
597 {
598 #[allow(unused_imports)]
599 use serde::de::Error;
600 use std::option::Option::Some;
601 let mut fields = std::collections::HashSet::new();
602 let mut result = Self::Value::new();
603 while let Some(tag) = map.next_key::<__FieldTag>()? {
604 #[allow(clippy::match_single_binding)]
605 match tag {
606 __FieldTag::__parent => {
607 if !fields.insert(__FieldTag::__parent) {
608 return std::result::Result::Err(A::Error::duplicate_field(
609 "multiple values for parent",
610 ));
611 }
612 result.parent = map
613 .next_value::<std::option::Option<std::string::String>>()?
614 .unwrap_or_default();
615 }
616 __FieldTag::__filter => {
617 if !fields.insert(__FieldTag::__filter) {
618 return std::result::Result::Err(A::Error::duplicate_field(
619 "multiple values for filter",
620 ));
621 }
622 result.filter = map
623 .next_value::<std::option::Option<std::string::String>>()?
624 .unwrap_or_default();
625 }
626 __FieldTag::Unknown(key) => {
627 let value = map.next_value::<serde_json::Value>()?;
628 result._unknown_fields.insert(key, value);
629 }
630 }
631 }
632 std::result::Result::Ok(result)
633 }
634 }
635 deserializer.deserialize_any(Visitor)
636 }
637}
638
639#[doc(hidden)]
640impl serde::ser::Serialize for GetVulnerabilityOccurrencesSummaryRequest {
641 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
642 where
643 S: serde::ser::Serializer,
644 {
645 use serde::ser::SerializeMap;
646 #[allow(unused_imports)]
647 use std::option::Option::Some;
648 let mut state = serializer.serialize_map(std::option::Option::None)?;
649 if !self.parent.is_empty() {
650 state.serialize_entry("parent", &self.parent)?;
651 }
652 if !self.filter.is_empty() {
653 state.serialize_entry("filter", &self.filter)?;
654 }
655 if !self._unknown_fields.is_empty() {
656 for (key, value) in self._unknown_fields.iter() {
657 state.serialize_entry(key, &value)?;
658 }
659 }
660 state.end()
661 }
662}
663
664#[derive(Clone, Debug, Default, PartialEq)]
667#[non_exhaustive]
668pub struct VulnerabilityOccurrencesSummary {
669 pub counts:
671 std::vec::Vec<crate::model::vulnerability_occurrences_summary::FixableTotalByDigest>,
672
673 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
674}
675
676impl VulnerabilityOccurrencesSummary {
677 pub fn new() -> Self {
678 std::default::Default::default()
679 }
680
681 pub fn set_counts<T, V>(mut self, v: T) -> Self
683 where
684 T: std::iter::IntoIterator<Item = V>,
685 V: std::convert::Into<
686 crate::model::vulnerability_occurrences_summary::FixableTotalByDigest,
687 >,
688 {
689 use std::iter::Iterator;
690 self.counts = v.into_iter().map(|i| i.into()).collect();
691 self
692 }
693}
694
695impl wkt::message::Message for VulnerabilityOccurrencesSummary {
696 fn typename() -> &'static str {
697 "type.googleapis.com/google.devtools.containeranalysis.v1.VulnerabilityOccurrencesSummary"
698 }
699}
700
701#[doc(hidden)]
702impl<'de> serde::de::Deserialize<'de> for VulnerabilityOccurrencesSummary {
703 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
704 where
705 D: serde::Deserializer<'de>,
706 {
707 #[allow(non_camel_case_types)]
708 #[doc(hidden)]
709 #[derive(PartialEq, Eq, Hash)]
710 enum __FieldTag {
711 __counts,
712 Unknown(std::string::String),
713 }
714 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
715 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
716 where
717 D: serde::Deserializer<'de>,
718 {
719 struct Visitor;
720 impl<'de> serde::de::Visitor<'de> for Visitor {
721 type Value = __FieldTag;
722 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
723 formatter.write_str("a field name for VulnerabilityOccurrencesSummary")
724 }
725 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
726 where
727 E: serde::de::Error,
728 {
729 use std::result::Result::Ok;
730 use std::string::ToString;
731 match value {
732 "counts" => Ok(__FieldTag::__counts),
733 _ => Ok(__FieldTag::Unknown(value.to_string())),
734 }
735 }
736 }
737 deserializer.deserialize_identifier(Visitor)
738 }
739 }
740 struct Visitor;
741 impl<'de> serde::de::Visitor<'de> for Visitor {
742 type Value = VulnerabilityOccurrencesSummary;
743 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
744 formatter.write_str("struct VulnerabilityOccurrencesSummary")
745 }
746 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
747 where
748 A: serde::de::MapAccess<'de>,
749 {
750 #[allow(unused_imports)]
751 use serde::de::Error;
752 use std::option::Option::Some;
753 let mut fields = std::collections::HashSet::new();
754 let mut result = Self::Value::new();
755 while let Some(tag) = map.next_key::<__FieldTag>()? {
756 #[allow(clippy::match_single_binding)]
757 match tag {
758 __FieldTag::__counts => {
759 if !fields.insert(__FieldTag::__counts) {
760 return std::result::Result::Err(A::Error::duplicate_field(
761 "multiple values for counts",
762 ));
763 }
764 result.counts = map.next_value::<std::option::Option<std::vec::Vec<crate::model::vulnerability_occurrences_summary::FixableTotalByDigest>>>()?.unwrap_or_default();
765 }
766 __FieldTag::Unknown(key) => {
767 let value = map.next_value::<serde_json::Value>()?;
768 result._unknown_fields.insert(key, value);
769 }
770 }
771 }
772 std::result::Result::Ok(result)
773 }
774 }
775 deserializer.deserialize_any(Visitor)
776 }
777}
778
779#[doc(hidden)]
780impl serde::ser::Serialize for VulnerabilityOccurrencesSummary {
781 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
782 where
783 S: serde::ser::Serializer,
784 {
785 use serde::ser::SerializeMap;
786 #[allow(unused_imports)]
787 use std::option::Option::Some;
788 let mut state = serializer.serialize_map(std::option::Option::None)?;
789 if !self.counts.is_empty() {
790 state.serialize_entry("counts", &self.counts)?;
791 }
792 if !self._unknown_fields.is_empty() {
793 for (key, value) in self._unknown_fields.iter() {
794 state.serialize_entry(key, &value)?;
795 }
796 }
797 state.end()
798 }
799}
800
801pub mod vulnerability_occurrences_summary {
803 #[allow(unused_imports)]
804 use super::*;
805
806 #[derive(Clone, Debug, Default, PartialEq)]
808 #[non_exhaustive]
809 pub struct FixableTotalByDigest {
810 pub resource_uri: std::string::String,
812
813 pub severity: grafeas::model::Severity,
816
817 pub fixable_count: i64,
819
820 pub total_count: i64,
822
823 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
824 }
825
826 impl FixableTotalByDigest {
827 pub fn new() -> Self {
828 std::default::Default::default()
829 }
830
831 pub fn set_resource_uri<T: std::convert::Into<std::string::String>>(
833 mut self,
834 v: T,
835 ) -> Self {
836 self.resource_uri = v.into();
837 self
838 }
839
840 pub fn set_severity<T: std::convert::Into<grafeas::model::Severity>>(
842 mut self,
843 v: T,
844 ) -> Self {
845 self.severity = v.into();
846 self
847 }
848
849 pub fn set_fixable_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
851 self.fixable_count = v.into();
852 self
853 }
854
855 pub fn set_total_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
857 self.total_count = v.into();
858 self
859 }
860 }
861
862 impl wkt::message::Message for FixableTotalByDigest {
863 fn typename() -> &'static str {
864 "type.googleapis.com/google.devtools.containeranalysis.v1.VulnerabilityOccurrencesSummary.FixableTotalByDigest"
865 }
866 }
867
868 #[doc(hidden)]
869 impl<'de> serde::de::Deserialize<'de> for FixableTotalByDigest {
870 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
871 where
872 D: serde::Deserializer<'de>,
873 {
874 #[allow(non_camel_case_types)]
875 #[doc(hidden)]
876 #[derive(PartialEq, Eq, Hash)]
877 enum __FieldTag {
878 __resource_uri,
879 __severity,
880 __fixable_count,
881 __total_count,
882 Unknown(std::string::String),
883 }
884 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
885 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
886 where
887 D: serde::Deserializer<'de>,
888 {
889 struct Visitor;
890 impl<'de> serde::de::Visitor<'de> for Visitor {
891 type Value = __FieldTag;
892 fn expecting(
893 &self,
894 formatter: &mut std::fmt::Formatter,
895 ) -> std::fmt::Result {
896 formatter.write_str("a field name for FixableTotalByDigest")
897 }
898 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
899 where
900 E: serde::de::Error,
901 {
902 use std::result::Result::Ok;
903 use std::string::ToString;
904 match value {
905 "resourceUri" => Ok(__FieldTag::__resource_uri),
906 "resource_uri" => Ok(__FieldTag::__resource_uri),
907 "severity" => Ok(__FieldTag::__severity),
908 "fixableCount" => Ok(__FieldTag::__fixable_count),
909 "fixable_count" => Ok(__FieldTag::__fixable_count),
910 "totalCount" => Ok(__FieldTag::__total_count),
911 "total_count" => Ok(__FieldTag::__total_count),
912 _ => Ok(__FieldTag::Unknown(value.to_string())),
913 }
914 }
915 }
916 deserializer.deserialize_identifier(Visitor)
917 }
918 }
919 struct Visitor;
920 impl<'de> serde::de::Visitor<'de> for Visitor {
921 type Value = FixableTotalByDigest;
922 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
923 formatter.write_str("struct FixableTotalByDigest")
924 }
925 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
926 where
927 A: serde::de::MapAccess<'de>,
928 {
929 #[allow(unused_imports)]
930 use serde::de::Error;
931 use std::option::Option::Some;
932 let mut fields = std::collections::HashSet::new();
933 let mut result = Self::Value::new();
934 while let Some(tag) = map.next_key::<__FieldTag>()? {
935 #[allow(clippy::match_single_binding)]
936 match tag {
937 __FieldTag::__resource_uri => {
938 if !fields.insert(__FieldTag::__resource_uri) {
939 return std::result::Result::Err(A::Error::duplicate_field(
940 "multiple values for resource_uri",
941 ));
942 }
943 result.resource_uri = map
944 .next_value::<std::option::Option<std::string::String>>()?
945 .unwrap_or_default();
946 }
947 __FieldTag::__severity => {
948 if !fields.insert(__FieldTag::__severity) {
949 return std::result::Result::Err(A::Error::duplicate_field(
950 "multiple values for severity",
951 ));
952 }
953 result.severity = map
954 .next_value::<std::option::Option<grafeas::model::Severity>>()?
955 .unwrap_or_default();
956 }
957 __FieldTag::__fixable_count => {
958 if !fields.insert(__FieldTag::__fixable_count) {
959 return std::result::Result::Err(A::Error::duplicate_field(
960 "multiple values for fixable_count",
961 ));
962 }
963 struct __With(std::option::Option<i64>);
964 impl<'de> serde::de::Deserialize<'de> for __With {
965 fn deserialize<D>(
966 deserializer: D,
967 ) -> std::result::Result<Self, D::Error>
968 where
969 D: serde::de::Deserializer<'de>,
970 {
971 serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
972 }
973 }
974 result.fixable_count =
975 map.next_value::<__With>()?.0.unwrap_or_default();
976 }
977 __FieldTag::__total_count => {
978 if !fields.insert(__FieldTag::__total_count) {
979 return std::result::Result::Err(A::Error::duplicate_field(
980 "multiple values for total_count",
981 ));
982 }
983 struct __With(std::option::Option<i64>);
984 impl<'de> serde::de::Deserialize<'de> for __With {
985 fn deserialize<D>(
986 deserializer: D,
987 ) -> std::result::Result<Self, D::Error>
988 where
989 D: serde::de::Deserializer<'de>,
990 {
991 serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
992 }
993 }
994 result.total_count =
995 map.next_value::<__With>()?.0.unwrap_or_default();
996 }
997 __FieldTag::Unknown(key) => {
998 let value = map.next_value::<serde_json::Value>()?;
999 result._unknown_fields.insert(key, value);
1000 }
1001 }
1002 }
1003 std::result::Result::Ok(result)
1004 }
1005 }
1006 deserializer.deserialize_any(Visitor)
1007 }
1008 }
1009
1010 #[doc(hidden)]
1011 impl serde::ser::Serialize for FixableTotalByDigest {
1012 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1013 where
1014 S: serde::ser::Serializer,
1015 {
1016 use serde::ser::SerializeMap;
1017 #[allow(unused_imports)]
1018 use std::option::Option::Some;
1019 let mut state = serializer.serialize_map(std::option::Option::None)?;
1020 if !self.resource_uri.is_empty() {
1021 state.serialize_entry("resourceUri", &self.resource_uri)?;
1022 }
1023 if !wkt::internal::is_default(&self.severity) {
1024 state.serialize_entry("severity", &self.severity)?;
1025 }
1026 if !wkt::internal::is_default(&self.fixable_count) {
1027 struct __With<'a>(&'a i64);
1028 impl<'a> serde::ser::Serialize for __With<'a> {
1029 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1030 where
1031 S: serde::ser::Serializer,
1032 {
1033 serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
1034 }
1035 }
1036 state.serialize_entry("fixableCount", &__With(&self.fixable_count))?;
1037 }
1038 if !wkt::internal::is_default(&self.total_count) {
1039 struct __With<'a>(&'a i64);
1040 impl<'a> serde::ser::Serialize for __With<'a> {
1041 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1042 where
1043 S: serde::ser::Serializer,
1044 {
1045 serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
1046 }
1047 }
1048 state.serialize_entry("totalCount", &__With(&self.total_count))?;
1049 }
1050 if !self._unknown_fields.is_empty() {
1051 for (key, value) in self._unknown_fields.iter() {
1052 state.serialize_entry(key, &value)?;
1053 }
1054 }
1055 state.end()
1056 }
1057 }
1058}