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 lazy_static;
25extern crate longrunning;
26extern crate lro;
27extern crate reqwest;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct ComputeThreatListDiffRequest {
43 pub threat_type: crate::model::ThreatType,
47
48 pub version_token: ::bytes::Bytes,
54
55 pub constraints:
57 std::option::Option<crate::model::compute_threat_list_diff_request::Constraints>,
58
59 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
60}
61
62impl ComputeThreatListDiffRequest {
63 pub fn new() -> Self {
64 std::default::Default::default()
65 }
66
67 pub fn set_threat_type<T: std::convert::Into<crate::model::ThreatType>>(
69 mut self,
70 v: T,
71 ) -> Self {
72 self.threat_type = v.into();
73 self
74 }
75
76 pub fn set_version_token<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
78 self.version_token = v.into();
79 self
80 }
81
82 pub fn set_constraints<T>(mut self, v: T) -> Self
84 where
85 T: std::convert::Into<crate::model::compute_threat_list_diff_request::Constraints>,
86 {
87 self.constraints = std::option::Option::Some(v.into());
88 self
89 }
90
91 pub fn set_or_clear_constraints<T>(mut self, v: std::option::Option<T>) -> Self
93 where
94 T: std::convert::Into<crate::model::compute_threat_list_diff_request::Constraints>,
95 {
96 self.constraints = v.map(|x| x.into());
97 self
98 }
99}
100
101impl wkt::message::Message for ComputeThreatListDiffRequest {
102 fn typename() -> &'static str {
103 "type.googleapis.com/google.cloud.webrisk.v1.ComputeThreatListDiffRequest"
104 }
105}
106
107pub mod compute_threat_list_diff_request {
109 #[allow(unused_imports)]
110 use super::*;
111
112 #[derive(Clone, Default, PartialEq)]
114 #[non_exhaustive]
115 pub struct Constraints {
116 pub max_diff_entries: i32,
120
121 pub max_database_entries: i32,
125
126 pub supported_compressions: std::vec::Vec<crate::model::CompressionType>,
128
129 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
130 }
131
132 impl Constraints {
133 pub fn new() -> Self {
134 std::default::Default::default()
135 }
136
137 pub fn set_max_diff_entries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
139 self.max_diff_entries = v.into();
140 self
141 }
142
143 pub fn set_max_database_entries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
145 self.max_database_entries = v.into();
146 self
147 }
148
149 pub fn set_supported_compressions<T, V>(mut self, v: T) -> Self
151 where
152 T: std::iter::IntoIterator<Item = V>,
153 V: std::convert::Into<crate::model::CompressionType>,
154 {
155 use std::iter::Iterator;
156 self.supported_compressions = v.into_iter().map(|i| i.into()).collect();
157 self
158 }
159 }
160
161 impl wkt::message::Message for Constraints {
162 fn typename() -> &'static str {
163 "type.googleapis.com/google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints"
164 }
165 }
166}
167
168#[derive(Clone, Default, PartialEq)]
169#[non_exhaustive]
170pub struct ComputeThreatListDiffResponse {
171 pub response_type: crate::model::compute_threat_list_diff_response::ResponseType,
174
175 pub additions: std::option::Option<crate::model::ThreatEntryAdditions>,
177
178 pub removals: std::option::Option<crate::model::ThreatEntryRemovals>,
181
182 pub new_version_token: ::bytes::Bytes,
186
187 pub checksum: std::option::Option<crate::model::compute_threat_list_diff_response::Checksum>,
192
193 pub recommended_next_diff: std::option::Option<wkt::Timestamp>,
198
199 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
200}
201
202impl ComputeThreatListDiffResponse {
203 pub fn new() -> Self {
204 std::default::Default::default()
205 }
206
207 pub fn set_response_type<
209 T: std::convert::Into<crate::model::compute_threat_list_diff_response::ResponseType>,
210 >(
211 mut self,
212 v: T,
213 ) -> Self {
214 self.response_type = v.into();
215 self
216 }
217
218 pub fn set_additions<T>(mut self, v: T) -> Self
220 where
221 T: std::convert::Into<crate::model::ThreatEntryAdditions>,
222 {
223 self.additions = std::option::Option::Some(v.into());
224 self
225 }
226
227 pub fn set_or_clear_additions<T>(mut self, v: std::option::Option<T>) -> Self
229 where
230 T: std::convert::Into<crate::model::ThreatEntryAdditions>,
231 {
232 self.additions = v.map(|x| x.into());
233 self
234 }
235
236 pub fn set_removals<T>(mut self, v: T) -> Self
238 where
239 T: std::convert::Into<crate::model::ThreatEntryRemovals>,
240 {
241 self.removals = std::option::Option::Some(v.into());
242 self
243 }
244
245 pub fn set_or_clear_removals<T>(mut self, v: std::option::Option<T>) -> Self
247 where
248 T: std::convert::Into<crate::model::ThreatEntryRemovals>,
249 {
250 self.removals = v.map(|x| x.into());
251 self
252 }
253
254 pub fn set_new_version_token<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
256 self.new_version_token = v.into();
257 self
258 }
259
260 pub fn set_checksum<T>(mut self, v: T) -> Self
262 where
263 T: std::convert::Into<crate::model::compute_threat_list_diff_response::Checksum>,
264 {
265 self.checksum = std::option::Option::Some(v.into());
266 self
267 }
268
269 pub fn set_or_clear_checksum<T>(mut self, v: std::option::Option<T>) -> Self
271 where
272 T: std::convert::Into<crate::model::compute_threat_list_diff_response::Checksum>,
273 {
274 self.checksum = v.map(|x| x.into());
275 self
276 }
277
278 pub fn set_recommended_next_diff<T>(mut self, v: T) -> Self
280 where
281 T: std::convert::Into<wkt::Timestamp>,
282 {
283 self.recommended_next_diff = std::option::Option::Some(v.into());
284 self
285 }
286
287 pub fn set_or_clear_recommended_next_diff<T>(mut self, v: std::option::Option<T>) -> Self
289 where
290 T: std::convert::Into<wkt::Timestamp>,
291 {
292 self.recommended_next_diff = v.map(|x| x.into());
293 self
294 }
295}
296
297impl wkt::message::Message for ComputeThreatListDiffResponse {
298 fn typename() -> &'static str {
299 "type.googleapis.com/google.cloud.webrisk.v1.ComputeThreatListDiffResponse"
300 }
301}
302
303pub mod compute_threat_list_diff_response {
305 #[allow(unused_imports)]
306 use super::*;
307
308 #[derive(Clone, Default, PartialEq)]
310 #[non_exhaustive]
311 pub struct Checksum {
312 pub sha256: ::bytes::Bytes,
315
316 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
317 }
318
319 impl Checksum {
320 pub fn new() -> Self {
321 std::default::Default::default()
322 }
323
324 pub fn set_sha256<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
326 self.sha256 = v.into();
327 self
328 }
329 }
330
331 impl wkt::message::Message for Checksum {
332 fn typename() -> &'static str {
333 "type.googleapis.com/google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum"
334 }
335 }
336
337 #[derive(Clone, Debug, PartialEq)]
353 #[non_exhaustive]
354 pub enum ResponseType {
355 Unspecified,
357 Diff,
359 Reset,
363 UnknownValue(response_type::UnknownValue),
368 }
369
370 #[doc(hidden)]
371 pub mod response_type {
372 #[allow(unused_imports)]
373 use super::*;
374 #[derive(Clone, Debug, PartialEq)]
375 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
376 }
377
378 impl ResponseType {
379 pub fn value(&self) -> std::option::Option<i32> {
384 match self {
385 Self::Unspecified => std::option::Option::Some(0),
386 Self::Diff => std::option::Option::Some(1),
387 Self::Reset => std::option::Option::Some(2),
388 Self::UnknownValue(u) => u.0.value(),
389 }
390 }
391
392 pub fn name(&self) -> std::option::Option<&str> {
397 match self {
398 Self::Unspecified => std::option::Option::Some("RESPONSE_TYPE_UNSPECIFIED"),
399 Self::Diff => std::option::Option::Some("DIFF"),
400 Self::Reset => std::option::Option::Some("RESET"),
401 Self::UnknownValue(u) => u.0.name(),
402 }
403 }
404 }
405
406 impl std::default::Default for ResponseType {
407 fn default() -> Self {
408 use std::convert::From;
409 Self::from(0)
410 }
411 }
412
413 impl std::fmt::Display for ResponseType {
414 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
415 wkt::internal::display_enum(f, self.name(), self.value())
416 }
417 }
418
419 impl std::convert::From<i32> for ResponseType {
420 fn from(value: i32) -> Self {
421 match value {
422 0 => Self::Unspecified,
423 1 => Self::Diff,
424 2 => Self::Reset,
425 _ => Self::UnknownValue(response_type::UnknownValue(
426 wkt::internal::UnknownEnumValue::Integer(value),
427 )),
428 }
429 }
430 }
431
432 impl std::convert::From<&str> for ResponseType {
433 fn from(value: &str) -> Self {
434 use std::string::ToString;
435 match value {
436 "RESPONSE_TYPE_UNSPECIFIED" => Self::Unspecified,
437 "DIFF" => Self::Diff,
438 "RESET" => Self::Reset,
439 _ => Self::UnknownValue(response_type::UnknownValue(
440 wkt::internal::UnknownEnumValue::String(value.to_string()),
441 )),
442 }
443 }
444 }
445
446 impl serde::ser::Serialize for ResponseType {
447 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
448 where
449 S: serde::Serializer,
450 {
451 match self {
452 Self::Unspecified => serializer.serialize_i32(0),
453 Self::Diff => serializer.serialize_i32(1),
454 Self::Reset => serializer.serialize_i32(2),
455 Self::UnknownValue(u) => u.0.serialize(serializer),
456 }
457 }
458 }
459
460 impl<'de> serde::de::Deserialize<'de> for ResponseType {
461 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
462 where
463 D: serde::Deserializer<'de>,
464 {
465 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ResponseType>::new(
466 ".google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType",
467 ))
468 }
469 }
470}
471
472#[derive(Clone, Default, PartialEq)]
474#[non_exhaustive]
475pub struct SearchUrisRequest {
476 pub uri: std::string::String,
478
479 pub threat_types: std::vec::Vec<crate::model::ThreatType>,
482
483 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
484}
485
486impl SearchUrisRequest {
487 pub fn new() -> Self {
488 std::default::Default::default()
489 }
490
491 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
493 self.uri = v.into();
494 self
495 }
496
497 pub fn set_threat_types<T, V>(mut self, v: T) -> Self
499 where
500 T: std::iter::IntoIterator<Item = V>,
501 V: std::convert::Into<crate::model::ThreatType>,
502 {
503 use std::iter::Iterator;
504 self.threat_types = v.into_iter().map(|i| i.into()).collect();
505 self
506 }
507}
508
509impl wkt::message::Message for SearchUrisRequest {
510 fn typename() -> &'static str {
511 "type.googleapis.com/google.cloud.webrisk.v1.SearchUrisRequest"
512 }
513}
514
515#[derive(Clone, Default, PartialEq)]
516#[non_exhaustive]
517pub struct SearchUrisResponse {
518 pub threat: std::option::Option<crate::model::search_uris_response::ThreatUri>,
520
521 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
522}
523
524impl SearchUrisResponse {
525 pub fn new() -> Self {
526 std::default::Default::default()
527 }
528
529 pub fn set_threat<T>(mut self, v: T) -> Self
531 where
532 T: std::convert::Into<crate::model::search_uris_response::ThreatUri>,
533 {
534 self.threat = std::option::Option::Some(v.into());
535 self
536 }
537
538 pub fn set_or_clear_threat<T>(mut self, v: std::option::Option<T>) -> Self
540 where
541 T: std::convert::Into<crate::model::search_uris_response::ThreatUri>,
542 {
543 self.threat = v.map(|x| x.into());
544 self
545 }
546}
547
548impl wkt::message::Message for SearchUrisResponse {
549 fn typename() -> &'static str {
550 "type.googleapis.com/google.cloud.webrisk.v1.SearchUrisResponse"
551 }
552}
553
554pub mod search_uris_response {
556 #[allow(unused_imports)]
557 use super::*;
558
559 #[derive(Clone, Default, PartialEq)]
561 #[non_exhaustive]
562 pub struct ThreatUri {
563 pub threat_types: std::vec::Vec<crate::model::ThreatType>,
565
566 pub expire_time: std::option::Option<wkt::Timestamp>,
569
570 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
571 }
572
573 impl ThreatUri {
574 pub fn new() -> Self {
575 std::default::Default::default()
576 }
577
578 pub fn set_threat_types<T, V>(mut self, v: T) -> Self
580 where
581 T: std::iter::IntoIterator<Item = V>,
582 V: std::convert::Into<crate::model::ThreatType>,
583 {
584 use std::iter::Iterator;
585 self.threat_types = v.into_iter().map(|i| i.into()).collect();
586 self
587 }
588
589 pub fn set_expire_time<T>(mut self, v: T) -> Self
591 where
592 T: std::convert::Into<wkt::Timestamp>,
593 {
594 self.expire_time = std::option::Option::Some(v.into());
595 self
596 }
597
598 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
600 where
601 T: std::convert::Into<wkt::Timestamp>,
602 {
603 self.expire_time = v.map(|x| x.into());
604 self
605 }
606 }
607
608 impl wkt::message::Message for ThreatUri {
609 fn typename() -> &'static str {
610 "type.googleapis.com/google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri"
611 }
612 }
613}
614
615#[derive(Clone, Default, PartialEq)]
617#[non_exhaustive]
618pub struct SearchHashesRequest {
619 pub hash_prefix: ::bytes::Bytes,
624
625 pub threat_types: std::vec::Vec<crate::model::ThreatType>,
628
629 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
630}
631
632impl SearchHashesRequest {
633 pub fn new() -> Self {
634 std::default::Default::default()
635 }
636
637 pub fn set_hash_prefix<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
639 self.hash_prefix = v.into();
640 self
641 }
642
643 pub fn set_threat_types<T, V>(mut self, v: T) -> Self
645 where
646 T: std::iter::IntoIterator<Item = V>,
647 V: std::convert::Into<crate::model::ThreatType>,
648 {
649 use std::iter::Iterator;
650 self.threat_types = v.into_iter().map(|i| i.into()).collect();
651 self
652 }
653}
654
655impl wkt::message::Message for SearchHashesRequest {
656 fn typename() -> &'static str {
657 "type.googleapis.com/google.cloud.webrisk.v1.SearchHashesRequest"
658 }
659}
660
661#[derive(Clone, Default, PartialEq)]
662#[non_exhaustive]
663pub struct SearchHashesResponse {
664 pub threats: std::vec::Vec<crate::model::search_hashes_response::ThreatHash>,
667
668 pub negative_expire_time: std::option::Option<wkt::Timestamp>,
671
672 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
673}
674
675impl SearchHashesResponse {
676 pub fn new() -> Self {
677 std::default::Default::default()
678 }
679
680 pub fn set_threats<T, V>(mut self, v: T) -> Self
682 where
683 T: std::iter::IntoIterator<Item = V>,
684 V: std::convert::Into<crate::model::search_hashes_response::ThreatHash>,
685 {
686 use std::iter::Iterator;
687 self.threats = v.into_iter().map(|i| i.into()).collect();
688 self
689 }
690
691 pub fn set_negative_expire_time<T>(mut self, v: T) -> Self
693 where
694 T: std::convert::Into<wkt::Timestamp>,
695 {
696 self.negative_expire_time = std::option::Option::Some(v.into());
697 self
698 }
699
700 pub fn set_or_clear_negative_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
702 where
703 T: std::convert::Into<wkt::Timestamp>,
704 {
705 self.negative_expire_time = v.map(|x| x.into());
706 self
707 }
708}
709
710impl wkt::message::Message for SearchHashesResponse {
711 fn typename() -> &'static str {
712 "type.googleapis.com/google.cloud.webrisk.v1.SearchHashesResponse"
713 }
714}
715
716pub mod search_hashes_response {
718 #[allow(unused_imports)]
719 use super::*;
720
721 #[derive(Clone, Default, PartialEq)]
723 #[non_exhaustive]
724 pub struct ThreatHash {
725 pub threat_types: std::vec::Vec<crate::model::ThreatType>,
728
729 pub hash: ::bytes::Bytes,
732
733 pub expire_time: std::option::Option<wkt::Timestamp>,
736
737 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
738 }
739
740 impl ThreatHash {
741 pub fn new() -> Self {
742 std::default::Default::default()
743 }
744
745 pub fn set_threat_types<T, V>(mut self, v: T) -> Self
747 where
748 T: std::iter::IntoIterator<Item = V>,
749 V: std::convert::Into<crate::model::ThreatType>,
750 {
751 use std::iter::Iterator;
752 self.threat_types = v.into_iter().map(|i| i.into()).collect();
753 self
754 }
755
756 pub fn set_hash<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
758 self.hash = v.into();
759 self
760 }
761
762 pub fn set_expire_time<T>(mut self, v: T) -> Self
764 where
765 T: std::convert::Into<wkt::Timestamp>,
766 {
767 self.expire_time = std::option::Option::Some(v.into());
768 self
769 }
770
771 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
773 where
774 T: std::convert::Into<wkt::Timestamp>,
775 {
776 self.expire_time = v.map(|x| x.into());
777 self
778 }
779 }
780
781 impl wkt::message::Message for ThreatHash {
782 fn typename() -> &'static str {
783 "type.googleapis.com/google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash"
784 }
785 }
786}
787
788#[derive(Clone, Default, PartialEq)]
791#[non_exhaustive]
792pub struct ThreatEntryAdditions {
793 pub raw_hashes: std::vec::Vec<crate::model::RawHashes>,
796
797 pub rice_hashes: std::option::Option<crate::model::RiceDeltaEncoding>,
801
802 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
803}
804
805impl ThreatEntryAdditions {
806 pub fn new() -> Self {
807 std::default::Default::default()
808 }
809
810 pub fn set_raw_hashes<T, V>(mut self, v: T) -> Self
812 where
813 T: std::iter::IntoIterator<Item = V>,
814 V: std::convert::Into<crate::model::RawHashes>,
815 {
816 use std::iter::Iterator;
817 self.raw_hashes = v.into_iter().map(|i| i.into()).collect();
818 self
819 }
820
821 pub fn set_rice_hashes<T>(mut self, v: T) -> Self
823 where
824 T: std::convert::Into<crate::model::RiceDeltaEncoding>,
825 {
826 self.rice_hashes = std::option::Option::Some(v.into());
827 self
828 }
829
830 pub fn set_or_clear_rice_hashes<T>(mut self, v: std::option::Option<T>) -> Self
832 where
833 T: std::convert::Into<crate::model::RiceDeltaEncoding>,
834 {
835 self.rice_hashes = v.map(|x| x.into());
836 self
837 }
838}
839
840impl wkt::message::Message for ThreatEntryAdditions {
841 fn typename() -> &'static str {
842 "type.googleapis.com/google.cloud.webrisk.v1.ThreatEntryAdditions"
843 }
844}
845
846#[derive(Clone, Default, PartialEq)]
848#[non_exhaustive]
849pub struct ThreatEntryRemovals {
850 pub raw_indices: std::option::Option<crate::model::RawIndices>,
852
853 pub rice_indices: std::option::Option<crate::model::RiceDeltaEncoding>,
858
859 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
860}
861
862impl ThreatEntryRemovals {
863 pub fn new() -> Self {
864 std::default::Default::default()
865 }
866
867 pub fn set_raw_indices<T>(mut self, v: T) -> Self
869 where
870 T: std::convert::Into<crate::model::RawIndices>,
871 {
872 self.raw_indices = std::option::Option::Some(v.into());
873 self
874 }
875
876 pub fn set_or_clear_raw_indices<T>(mut self, v: std::option::Option<T>) -> Self
878 where
879 T: std::convert::Into<crate::model::RawIndices>,
880 {
881 self.raw_indices = v.map(|x| x.into());
882 self
883 }
884
885 pub fn set_rice_indices<T>(mut self, v: T) -> Self
887 where
888 T: std::convert::Into<crate::model::RiceDeltaEncoding>,
889 {
890 self.rice_indices = std::option::Option::Some(v.into());
891 self
892 }
893
894 pub fn set_or_clear_rice_indices<T>(mut self, v: std::option::Option<T>) -> Self
896 where
897 T: std::convert::Into<crate::model::RiceDeltaEncoding>,
898 {
899 self.rice_indices = v.map(|x| x.into());
900 self
901 }
902}
903
904impl wkt::message::Message for ThreatEntryRemovals {
905 fn typename() -> &'static str {
906 "type.googleapis.com/google.cloud.webrisk.v1.ThreatEntryRemovals"
907 }
908}
909
910#[derive(Clone, Default, PartialEq)]
912#[non_exhaustive]
913pub struct RawIndices {
914 pub indices: std::vec::Vec<i32>,
916
917 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
918}
919
920impl RawIndices {
921 pub fn new() -> Self {
922 std::default::Default::default()
923 }
924
925 pub fn set_indices<T, V>(mut self, v: T) -> Self
927 where
928 T: std::iter::IntoIterator<Item = V>,
929 V: std::convert::Into<i32>,
930 {
931 use std::iter::Iterator;
932 self.indices = v.into_iter().map(|i| i.into()).collect();
933 self
934 }
935}
936
937impl wkt::message::Message for RawIndices {
938 fn typename() -> &'static str {
939 "type.googleapis.com/google.cloud.webrisk.v1.RawIndices"
940 }
941}
942
943#[derive(Clone, Default, PartialEq)]
952#[non_exhaustive]
953pub struct RawHashes {
954 pub prefix_size: i32,
958
959 pub raw_hashes: ::bytes::Bytes,
963
964 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
965}
966
967impl RawHashes {
968 pub fn new() -> Self {
969 std::default::Default::default()
970 }
971
972 pub fn set_prefix_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
974 self.prefix_size = v.into();
975 self
976 }
977
978 pub fn set_raw_hashes<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
980 self.raw_hashes = v.into();
981 self
982 }
983}
984
985impl wkt::message::Message for RawHashes {
986 fn typename() -> &'static str {
987 "type.googleapis.com/google.cloud.webrisk.v1.RawHashes"
988 }
989}
990
991#[derive(Clone, Default, PartialEq)]
994#[non_exhaustive]
995pub struct RiceDeltaEncoding {
996 pub first_value: i64,
1000
1001 pub rice_parameter: i32,
1004
1005 pub entry_count: i32,
1009
1010 pub encoded_data: ::bytes::Bytes,
1012
1013 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1014}
1015
1016impl RiceDeltaEncoding {
1017 pub fn new() -> Self {
1018 std::default::Default::default()
1019 }
1020
1021 pub fn set_first_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1023 self.first_value = v.into();
1024 self
1025 }
1026
1027 pub fn set_rice_parameter<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1029 self.rice_parameter = v.into();
1030 self
1031 }
1032
1033 pub fn set_entry_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1035 self.entry_count = v.into();
1036 self
1037 }
1038
1039 pub fn set_encoded_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1041 self.encoded_data = v.into();
1042 self
1043 }
1044}
1045
1046impl wkt::message::Message for RiceDeltaEncoding {
1047 fn typename() -> &'static str {
1048 "type.googleapis.com/google.cloud.webrisk.v1.RiceDeltaEncoding"
1049 }
1050}
1051
1052#[derive(Clone, Default, PartialEq)]
1054#[non_exhaustive]
1055pub struct Submission {
1056 pub uri: std::string::String,
1059
1060 pub threat_types: std::vec::Vec<crate::model::ThreatType>,
1064
1065 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1066}
1067
1068impl Submission {
1069 pub fn new() -> Self {
1070 std::default::Default::default()
1071 }
1072
1073 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1075 self.uri = v.into();
1076 self
1077 }
1078
1079 pub fn set_threat_types<T, V>(mut self, v: T) -> Self
1081 where
1082 T: std::iter::IntoIterator<Item = V>,
1083 V: std::convert::Into<crate::model::ThreatType>,
1084 {
1085 use std::iter::Iterator;
1086 self.threat_types = v.into_iter().map(|i| i.into()).collect();
1087 self
1088 }
1089}
1090
1091impl wkt::message::Message for Submission {
1092 fn typename() -> &'static str {
1093 "type.googleapis.com/google.cloud.webrisk.v1.Submission"
1094 }
1095}
1096
1097#[derive(Clone, Default, PartialEq)]
1100#[non_exhaustive]
1101pub struct ThreatInfo {
1102 pub abuse_type: crate::model::threat_info::AbuseType,
1104
1105 pub threat_confidence: std::option::Option<crate::model::threat_info::Confidence>,
1107
1108 pub threat_justification: std::option::Option<crate::model::threat_info::ThreatJustification>,
1110
1111 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1112}
1113
1114impl ThreatInfo {
1115 pub fn new() -> Self {
1116 std::default::Default::default()
1117 }
1118
1119 pub fn set_abuse_type<T: std::convert::Into<crate::model::threat_info::AbuseType>>(
1121 mut self,
1122 v: T,
1123 ) -> Self {
1124 self.abuse_type = v.into();
1125 self
1126 }
1127
1128 pub fn set_threat_confidence<T>(mut self, v: T) -> Self
1130 where
1131 T: std::convert::Into<crate::model::threat_info::Confidence>,
1132 {
1133 self.threat_confidence = std::option::Option::Some(v.into());
1134 self
1135 }
1136
1137 pub fn set_or_clear_threat_confidence<T>(mut self, v: std::option::Option<T>) -> Self
1139 where
1140 T: std::convert::Into<crate::model::threat_info::Confidence>,
1141 {
1142 self.threat_confidence = v.map(|x| x.into());
1143 self
1144 }
1145
1146 pub fn set_threat_justification<T>(mut self, v: T) -> Self
1148 where
1149 T: std::convert::Into<crate::model::threat_info::ThreatJustification>,
1150 {
1151 self.threat_justification = std::option::Option::Some(v.into());
1152 self
1153 }
1154
1155 pub fn set_or_clear_threat_justification<T>(mut self, v: std::option::Option<T>) -> Self
1157 where
1158 T: std::convert::Into<crate::model::threat_info::ThreatJustification>,
1159 {
1160 self.threat_justification = v.map(|x| x.into());
1161 self
1162 }
1163}
1164
1165impl wkt::message::Message for ThreatInfo {
1166 fn typename() -> &'static str {
1167 "type.googleapis.com/google.cloud.webrisk.v1.ThreatInfo"
1168 }
1169}
1170
1171pub mod threat_info {
1173 #[allow(unused_imports)]
1174 use super::*;
1175
1176 #[derive(Clone, Default, PartialEq)]
1178 #[non_exhaustive]
1179 pub struct Confidence {
1180 pub value: std::option::Option<crate::model::threat_info::confidence::Value>,
1181
1182 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1183 }
1184
1185 impl Confidence {
1186 pub fn new() -> Self {
1187 std::default::Default::default()
1188 }
1189
1190 pub fn set_value<
1195 T: std::convert::Into<std::option::Option<crate::model::threat_info::confidence::Value>>,
1196 >(
1197 mut self,
1198 v: T,
1199 ) -> Self {
1200 self.value = v.into();
1201 self
1202 }
1203
1204 pub fn score(&self) -> std::option::Option<&f32> {
1208 #[allow(unreachable_patterns)]
1209 self.value.as_ref().and_then(|v| match v {
1210 crate::model::threat_info::confidence::Value::Score(v) => {
1211 std::option::Option::Some(v)
1212 }
1213 _ => std::option::Option::None,
1214 })
1215 }
1216
1217 pub fn set_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1223 self.value = std::option::Option::Some(
1224 crate::model::threat_info::confidence::Value::Score(v.into()),
1225 );
1226 self
1227 }
1228
1229 pub fn level(
1233 &self,
1234 ) -> std::option::Option<&crate::model::threat_info::confidence::ConfidenceLevel> {
1235 #[allow(unreachable_patterns)]
1236 self.value.as_ref().and_then(|v| match v {
1237 crate::model::threat_info::confidence::Value::Level(v) => {
1238 std::option::Option::Some(v)
1239 }
1240 _ => std::option::Option::None,
1241 })
1242 }
1243
1244 pub fn set_level<
1250 T: std::convert::Into<crate::model::threat_info::confidence::ConfidenceLevel>,
1251 >(
1252 mut self,
1253 v: T,
1254 ) -> Self {
1255 self.value = std::option::Option::Some(
1256 crate::model::threat_info::confidence::Value::Level(v.into()),
1257 );
1258 self
1259 }
1260 }
1261
1262 impl wkt::message::Message for Confidence {
1263 fn typename() -> &'static str {
1264 "type.googleapis.com/google.cloud.webrisk.v1.ThreatInfo.Confidence"
1265 }
1266 }
1267
1268 pub mod confidence {
1270 #[allow(unused_imports)]
1271 use super::*;
1272
1273 #[derive(Clone, Debug, PartialEq)]
1289 #[non_exhaustive]
1290 pub enum ConfidenceLevel {
1291 Unspecified,
1293 Low,
1295 Medium,
1297 High,
1299 UnknownValue(confidence_level::UnknownValue),
1304 }
1305
1306 #[doc(hidden)]
1307 pub mod confidence_level {
1308 #[allow(unused_imports)]
1309 use super::*;
1310 #[derive(Clone, Debug, PartialEq)]
1311 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1312 }
1313
1314 impl ConfidenceLevel {
1315 pub fn value(&self) -> std::option::Option<i32> {
1320 match self {
1321 Self::Unspecified => std::option::Option::Some(0),
1322 Self::Low => std::option::Option::Some(1),
1323 Self::Medium => std::option::Option::Some(2),
1324 Self::High => std::option::Option::Some(3),
1325 Self::UnknownValue(u) => u.0.value(),
1326 }
1327 }
1328
1329 pub fn name(&self) -> std::option::Option<&str> {
1334 match self {
1335 Self::Unspecified => std::option::Option::Some("CONFIDENCE_LEVEL_UNSPECIFIED"),
1336 Self::Low => std::option::Option::Some("LOW"),
1337 Self::Medium => std::option::Option::Some("MEDIUM"),
1338 Self::High => std::option::Option::Some("HIGH"),
1339 Self::UnknownValue(u) => u.0.name(),
1340 }
1341 }
1342 }
1343
1344 impl std::default::Default for ConfidenceLevel {
1345 fn default() -> Self {
1346 use std::convert::From;
1347 Self::from(0)
1348 }
1349 }
1350
1351 impl std::fmt::Display for ConfidenceLevel {
1352 fn fmt(
1353 &self,
1354 f: &mut std::fmt::Formatter<'_>,
1355 ) -> std::result::Result<(), std::fmt::Error> {
1356 wkt::internal::display_enum(f, self.name(), self.value())
1357 }
1358 }
1359
1360 impl std::convert::From<i32> for ConfidenceLevel {
1361 fn from(value: i32) -> Self {
1362 match value {
1363 0 => Self::Unspecified,
1364 1 => Self::Low,
1365 2 => Self::Medium,
1366 3 => Self::High,
1367 _ => Self::UnknownValue(confidence_level::UnknownValue(
1368 wkt::internal::UnknownEnumValue::Integer(value),
1369 )),
1370 }
1371 }
1372 }
1373
1374 impl std::convert::From<&str> for ConfidenceLevel {
1375 fn from(value: &str) -> Self {
1376 use std::string::ToString;
1377 match value {
1378 "CONFIDENCE_LEVEL_UNSPECIFIED" => Self::Unspecified,
1379 "LOW" => Self::Low,
1380 "MEDIUM" => Self::Medium,
1381 "HIGH" => Self::High,
1382 _ => Self::UnknownValue(confidence_level::UnknownValue(
1383 wkt::internal::UnknownEnumValue::String(value.to_string()),
1384 )),
1385 }
1386 }
1387 }
1388
1389 impl serde::ser::Serialize for ConfidenceLevel {
1390 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1391 where
1392 S: serde::Serializer,
1393 {
1394 match self {
1395 Self::Unspecified => serializer.serialize_i32(0),
1396 Self::Low => serializer.serialize_i32(1),
1397 Self::Medium => serializer.serialize_i32(2),
1398 Self::High => serializer.serialize_i32(3),
1399 Self::UnknownValue(u) => u.0.serialize(serializer),
1400 }
1401 }
1402 }
1403
1404 impl<'de> serde::de::Deserialize<'de> for ConfidenceLevel {
1405 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1406 where
1407 D: serde::Deserializer<'de>,
1408 {
1409 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConfidenceLevel>::new(
1410 ".google.cloud.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel",
1411 ))
1412 }
1413 }
1414
1415 #[derive(Clone, Debug, PartialEq)]
1416 #[non_exhaustive]
1417 pub enum Value {
1418 Score(f32),
1422 Level(crate::model::threat_info::confidence::ConfidenceLevel),
1424 }
1425 }
1426
1427 #[derive(Clone, Default, PartialEq)]
1429 #[non_exhaustive]
1430 pub struct ThreatJustification {
1431 pub labels:
1433 std::vec::Vec<crate::model::threat_info::threat_justification::JustificationLabel>,
1434
1435 pub comments: std::vec::Vec<std::string::String>,
1437
1438 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1439 }
1440
1441 impl ThreatJustification {
1442 pub fn new() -> Self {
1443 std::default::Default::default()
1444 }
1445
1446 pub fn set_labels<T, V>(mut self, v: T) -> Self
1448 where
1449 T: std::iter::IntoIterator<Item = V>,
1450 V: std::convert::Into<
1451 crate::model::threat_info::threat_justification::JustificationLabel,
1452 >,
1453 {
1454 use std::iter::Iterator;
1455 self.labels = v.into_iter().map(|i| i.into()).collect();
1456 self
1457 }
1458
1459 pub fn set_comments<T, V>(mut self, v: T) -> Self
1461 where
1462 T: std::iter::IntoIterator<Item = V>,
1463 V: std::convert::Into<std::string::String>,
1464 {
1465 use std::iter::Iterator;
1466 self.comments = v.into_iter().map(|i| i.into()).collect();
1467 self
1468 }
1469 }
1470
1471 impl wkt::message::Message for ThreatJustification {
1472 fn typename() -> &'static str {
1473 "type.googleapis.com/google.cloud.webrisk.v1.ThreatInfo.ThreatJustification"
1474 }
1475 }
1476
1477 pub mod threat_justification {
1479 #[allow(unused_imports)]
1480 use super::*;
1481
1482 #[derive(Clone, Debug, PartialEq)]
1498 #[non_exhaustive]
1499 pub enum JustificationLabel {
1500 Unspecified,
1502 ManualVerification,
1504 UserReport,
1506 AutomatedReport,
1508 UnknownValue(justification_label::UnknownValue),
1513 }
1514
1515 #[doc(hidden)]
1516 pub mod justification_label {
1517 #[allow(unused_imports)]
1518 use super::*;
1519 #[derive(Clone, Debug, PartialEq)]
1520 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1521 }
1522
1523 impl JustificationLabel {
1524 pub fn value(&self) -> std::option::Option<i32> {
1529 match self {
1530 Self::Unspecified => std::option::Option::Some(0),
1531 Self::ManualVerification => std::option::Option::Some(1),
1532 Self::UserReport => std::option::Option::Some(2),
1533 Self::AutomatedReport => std::option::Option::Some(3),
1534 Self::UnknownValue(u) => u.0.value(),
1535 }
1536 }
1537
1538 pub fn name(&self) -> std::option::Option<&str> {
1543 match self {
1544 Self::Unspecified => {
1545 std::option::Option::Some("JUSTIFICATION_LABEL_UNSPECIFIED")
1546 }
1547 Self::ManualVerification => std::option::Option::Some("MANUAL_VERIFICATION"),
1548 Self::UserReport => std::option::Option::Some("USER_REPORT"),
1549 Self::AutomatedReport => std::option::Option::Some("AUTOMATED_REPORT"),
1550 Self::UnknownValue(u) => u.0.name(),
1551 }
1552 }
1553 }
1554
1555 impl std::default::Default for JustificationLabel {
1556 fn default() -> Self {
1557 use std::convert::From;
1558 Self::from(0)
1559 }
1560 }
1561
1562 impl std::fmt::Display for JustificationLabel {
1563 fn fmt(
1564 &self,
1565 f: &mut std::fmt::Formatter<'_>,
1566 ) -> std::result::Result<(), std::fmt::Error> {
1567 wkt::internal::display_enum(f, self.name(), self.value())
1568 }
1569 }
1570
1571 impl std::convert::From<i32> for JustificationLabel {
1572 fn from(value: i32) -> Self {
1573 match value {
1574 0 => Self::Unspecified,
1575 1 => Self::ManualVerification,
1576 2 => Self::UserReport,
1577 3 => Self::AutomatedReport,
1578 _ => Self::UnknownValue(justification_label::UnknownValue(
1579 wkt::internal::UnknownEnumValue::Integer(value),
1580 )),
1581 }
1582 }
1583 }
1584
1585 impl std::convert::From<&str> for JustificationLabel {
1586 fn from(value: &str) -> Self {
1587 use std::string::ToString;
1588 match value {
1589 "JUSTIFICATION_LABEL_UNSPECIFIED" => Self::Unspecified,
1590 "MANUAL_VERIFICATION" => Self::ManualVerification,
1591 "USER_REPORT" => Self::UserReport,
1592 "AUTOMATED_REPORT" => Self::AutomatedReport,
1593 _ => Self::UnknownValue(justification_label::UnknownValue(
1594 wkt::internal::UnknownEnumValue::String(value.to_string()),
1595 )),
1596 }
1597 }
1598 }
1599
1600 impl serde::ser::Serialize for JustificationLabel {
1601 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1602 where
1603 S: serde::Serializer,
1604 {
1605 match self {
1606 Self::Unspecified => serializer.serialize_i32(0),
1607 Self::ManualVerification => serializer.serialize_i32(1),
1608 Self::UserReport => serializer.serialize_i32(2),
1609 Self::AutomatedReport => serializer.serialize_i32(3),
1610 Self::UnknownValue(u) => u.0.serialize(serializer),
1611 }
1612 }
1613 }
1614
1615 impl<'de> serde::de::Deserialize<'de> for JustificationLabel {
1616 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1617 where
1618 D: serde::Deserializer<'de>,
1619 {
1620 deserializer.deserialize_any(wkt::internal::EnumVisitor::<JustificationLabel>::new(
1621 ".google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel",
1622 ))
1623 }
1624 }
1625 }
1626
1627 #[derive(Clone, Debug, PartialEq)]
1643 #[non_exhaustive]
1644 pub enum AbuseType {
1645 Unspecified,
1647 Malware,
1649 SocialEngineering,
1651 UnwantedSoftware,
1653 UnknownValue(abuse_type::UnknownValue),
1658 }
1659
1660 #[doc(hidden)]
1661 pub mod abuse_type {
1662 #[allow(unused_imports)]
1663 use super::*;
1664 #[derive(Clone, Debug, PartialEq)]
1665 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1666 }
1667
1668 impl AbuseType {
1669 pub fn value(&self) -> std::option::Option<i32> {
1674 match self {
1675 Self::Unspecified => std::option::Option::Some(0),
1676 Self::Malware => std::option::Option::Some(1),
1677 Self::SocialEngineering => std::option::Option::Some(2),
1678 Self::UnwantedSoftware => std::option::Option::Some(3),
1679 Self::UnknownValue(u) => u.0.value(),
1680 }
1681 }
1682
1683 pub fn name(&self) -> std::option::Option<&str> {
1688 match self {
1689 Self::Unspecified => std::option::Option::Some("ABUSE_TYPE_UNSPECIFIED"),
1690 Self::Malware => std::option::Option::Some("MALWARE"),
1691 Self::SocialEngineering => std::option::Option::Some("SOCIAL_ENGINEERING"),
1692 Self::UnwantedSoftware => std::option::Option::Some("UNWANTED_SOFTWARE"),
1693 Self::UnknownValue(u) => u.0.name(),
1694 }
1695 }
1696 }
1697
1698 impl std::default::Default for AbuseType {
1699 fn default() -> Self {
1700 use std::convert::From;
1701 Self::from(0)
1702 }
1703 }
1704
1705 impl std::fmt::Display for AbuseType {
1706 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1707 wkt::internal::display_enum(f, self.name(), self.value())
1708 }
1709 }
1710
1711 impl std::convert::From<i32> for AbuseType {
1712 fn from(value: i32) -> Self {
1713 match value {
1714 0 => Self::Unspecified,
1715 1 => Self::Malware,
1716 2 => Self::SocialEngineering,
1717 3 => Self::UnwantedSoftware,
1718 _ => Self::UnknownValue(abuse_type::UnknownValue(
1719 wkt::internal::UnknownEnumValue::Integer(value),
1720 )),
1721 }
1722 }
1723 }
1724
1725 impl std::convert::From<&str> for AbuseType {
1726 fn from(value: &str) -> Self {
1727 use std::string::ToString;
1728 match value {
1729 "ABUSE_TYPE_UNSPECIFIED" => Self::Unspecified,
1730 "MALWARE" => Self::Malware,
1731 "SOCIAL_ENGINEERING" => Self::SocialEngineering,
1732 "UNWANTED_SOFTWARE" => Self::UnwantedSoftware,
1733 _ => Self::UnknownValue(abuse_type::UnknownValue(
1734 wkt::internal::UnknownEnumValue::String(value.to_string()),
1735 )),
1736 }
1737 }
1738 }
1739
1740 impl serde::ser::Serialize for AbuseType {
1741 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1742 where
1743 S: serde::Serializer,
1744 {
1745 match self {
1746 Self::Unspecified => serializer.serialize_i32(0),
1747 Self::Malware => serializer.serialize_i32(1),
1748 Self::SocialEngineering => serializer.serialize_i32(2),
1749 Self::UnwantedSoftware => serializer.serialize_i32(3),
1750 Self::UnknownValue(u) => u.0.serialize(serializer),
1751 }
1752 }
1753 }
1754
1755 impl<'de> serde::de::Deserialize<'de> for AbuseType {
1756 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1757 where
1758 D: serde::Deserializer<'de>,
1759 {
1760 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AbuseType>::new(
1761 ".google.cloud.webrisk.v1.ThreatInfo.AbuseType",
1762 ))
1763 }
1764 }
1765}
1766
1767#[derive(Clone, Default, PartialEq)]
1769#[non_exhaustive]
1770pub struct ThreatDiscovery {
1771 pub platform: crate::model::threat_discovery::Platform,
1773
1774 pub region_codes: std::vec::Vec<std::string::String>,
1777
1778 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1779}
1780
1781impl ThreatDiscovery {
1782 pub fn new() -> Self {
1783 std::default::Default::default()
1784 }
1785
1786 pub fn set_platform<T: std::convert::Into<crate::model::threat_discovery::Platform>>(
1788 mut self,
1789 v: T,
1790 ) -> Self {
1791 self.platform = v.into();
1792 self
1793 }
1794
1795 pub fn set_region_codes<T, V>(mut self, v: T) -> Self
1797 where
1798 T: std::iter::IntoIterator<Item = V>,
1799 V: std::convert::Into<std::string::String>,
1800 {
1801 use std::iter::Iterator;
1802 self.region_codes = v.into_iter().map(|i| i.into()).collect();
1803 self
1804 }
1805}
1806
1807impl wkt::message::Message for ThreatDiscovery {
1808 fn typename() -> &'static str {
1809 "type.googleapis.com/google.cloud.webrisk.v1.ThreatDiscovery"
1810 }
1811}
1812
1813pub mod threat_discovery {
1815 #[allow(unused_imports)]
1816 use super::*;
1817
1818 #[derive(Clone, Debug, PartialEq)]
1834 #[non_exhaustive]
1835 pub enum Platform {
1836 Unspecified,
1838 Android,
1840 Ios,
1842 Macos,
1844 Windows,
1846 UnknownValue(platform::UnknownValue),
1851 }
1852
1853 #[doc(hidden)]
1854 pub mod platform {
1855 #[allow(unused_imports)]
1856 use super::*;
1857 #[derive(Clone, Debug, PartialEq)]
1858 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1859 }
1860
1861 impl Platform {
1862 pub fn value(&self) -> std::option::Option<i32> {
1867 match self {
1868 Self::Unspecified => std::option::Option::Some(0),
1869 Self::Android => std::option::Option::Some(1),
1870 Self::Ios => std::option::Option::Some(2),
1871 Self::Macos => std::option::Option::Some(3),
1872 Self::Windows => std::option::Option::Some(4),
1873 Self::UnknownValue(u) => u.0.value(),
1874 }
1875 }
1876
1877 pub fn name(&self) -> std::option::Option<&str> {
1882 match self {
1883 Self::Unspecified => std::option::Option::Some("PLATFORM_UNSPECIFIED"),
1884 Self::Android => std::option::Option::Some("ANDROID"),
1885 Self::Ios => std::option::Option::Some("IOS"),
1886 Self::Macos => std::option::Option::Some("MACOS"),
1887 Self::Windows => std::option::Option::Some("WINDOWS"),
1888 Self::UnknownValue(u) => u.0.name(),
1889 }
1890 }
1891 }
1892
1893 impl std::default::Default for Platform {
1894 fn default() -> Self {
1895 use std::convert::From;
1896 Self::from(0)
1897 }
1898 }
1899
1900 impl std::fmt::Display for Platform {
1901 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1902 wkt::internal::display_enum(f, self.name(), self.value())
1903 }
1904 }
1905
1906 impl std::convert::From<i32> for Platform {
1907 fn from(value: i32) -> Self {
1908 match value {
1909 0 => Self::Unspecified,
1910 1 => Self::Android,
1911 2 => Self::Ios,
1912 3 => Self::Macos,
1913 4 => Self::Windows,
1914 _ => Self::UnknownValue(platform::UnknownValue(
1915 wkt::internal::UnknownEnumValue::Integer(value),
1916 )),
1917 }
1918 }
1919 }
1920
1921 impl std::convert::From<&str> for Platform {
1922 fn from(value: &str) -> Self {
1923 use std::string::ToString;
1924 match value {
1925 "PLATFORM_UNSPECIFIED" => Self::Unspecified,
1926 "ANDROID" => Self::Android,
1927 "IOS" => Self::Ios,
1928 "MACOS" => Self::Macos,
1929 "WINDOWS" => Self::Windows,
1930 _ => Self::UnknownValue(platform::UnknownValue(
1931 wkt::internal::UnknownEnumValue::String(value.to_string()),
1932 )),
1933 }
1934 }
1935 }
1936
1937 impl serde::ser::Serialize for Platform {
1938 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1939 where
1940 S: serde::Serializer,
1941 {
1942 match self {
1943 Self::Unspecified => serializer.serialize_i32(0),
1944 Self::Android => serializer.serialize_i32(1),
1945 Self::Ios => serializer.serialize_i32(2),
1946 Self::Macos => serializer.serialize_i32(3),
1947 Self::Windows => serializer.serialize_i32(4),
1948 Self::UnknownValue(u) => u.0.serialize(serializer),
1949 }
1950 }
1951 }
1952
1953 impl<'de> serde::de::Deserialize<'de> for Platform {
1954 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1955 where
1956 D: serde::Deserializer<'de>,
1957 {
1958 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Platform>::new(
1959 ".google.cloud.webrisk.v1.ThreatDiscovery.Platform",
1960 ))
1961 }
1962 }
1963}
1964
1965#[derive(Clone, Default, PartialEq)]
1967#[non_exhaustive]
1968pub struct CreateSubmissionRequest {
1969 pub parent: std::string::String,
1972
1973 pub submission: std::option::Option<crate::model::Submission>,
1975
1976 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1977}
1978
1979impl CreateSubmissionRequest {
1980 pub fn new() -> Self {
1981 std::default::Default::default()
1982 }
1983
1984 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1986 self.parent = v.into();
1987 self
1988 }
1989
1990 pub fn set_submission<T>(mut self, v: T) -> Self
1992 where
1993 T: std::convert::Into<crate::model::Submission>,
1994 {
1995 self.submission = std::option::Option::Some(v.into());
1996 self
1997 }
1998
1999 pub fn set_or_clear_submission<T>(mut self, v: std::option::Option<T>) -> Self
2001 where
2002 T: std::convert::Into<crate::model::Submission>,
2003 {
2004 self.submission = v.map(|x| x.into());
2005 self
2006 }
2007}
2008
2009impl wkt::message::Message for CreateSubmissionRequest {
2010 fn typename() -> &'static str {
2011 "type.googleapis.com/google.cloud.webrisk.v1.CreateSubmissionRequest"
2012 }
2013}
2014
2015#[derive(Clone, Default, PartialEq)]
2017#[non_exhaustive]
2018pub struct SubmitUriRequest {
2019 pub parent: std::string::String,
2022
2023 pub submission: std::option::Option<crate::model::Submission>,
2025
2026 pub threat_info: std::option::Option<crate::model::ThreatInfo>,
2028
2029 pub threat_discovery: std::option::Option<crate::model::ThreatDiscovery>,
2031
2032 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2033}
2034
2035impl SubmitUriRequest {
2036 pub fn new() -> Self {
2037 std::default::Default::default()
2038 }
2039
2040 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2042 self.parent = v.into();
2043 self
2044 }
2045
2046 pub fn set_submission<T>(mut self, v: T) -> Self
2048 where
2049 T: std::convert::Into<crate::model::Submission>,
2050 {
2051 self.submission = std::option::Option::Some(v.into());
2052 self
2053 }
2054
2055 pub fn set_or_clear_submission<T>(mut self, v: std::option::Option<T>) -> Self
2057 where
2058 T: std::convert::Into<crate::model::Submission>,
2059 {
2060 self.submission = v.map(|x| x.into());
2061 self
2062 }
2063
2064 pub fn set_threat_info<T>(mut self, v: T) -> Self
2066 where
2067 T: std::convert::Into<crate::model::ThreatInfo>,
2068 {
2069 self.threat_info = std::option::Option::Some(v.into());
2070 self
2071 }
2072
2073 pub fn set_or_clear_threat_info<T>(mut self, v: std::option::Option<T>) -> Self
2075 where
2076 T: std::convert::Into<crate::model::ThreatInfo>,
2077 {
2078 self.threat_info = v.map(|x| x.into());
2079 self
2080 }
2081
2082 pub fn set_threat_discovery<T>(mut self, v: T) -> Self
2084 where
2085 T: std::convert::Into<crate::model::ThreatDiscovery>,
2086 {
2087 self.threat_discovery = std::option::Option::Some(v.into());
2088 self
2089 }
2090
2091 pub fn set_or_clear_threat_discovery<T>(mut self, v: std::option::Option<T>) -> Self
2093 where
2094 T: std::convert::Into<crate::model::ThreatDiscovery>,
2095 {
2096 self.threat_discovery = v.map(|x| x.into());
2097 self
2098 }
2099}
2100
2101impl wkt::message::Message for SubmitUriRequest {
2102 fn typename() -> &'static str {
2103 "type.googleapis.com/google.cloud.webrisk.v1.SubmitUriRequest"
2104 }
2105}
2106
2107#[derive(Clone, Default, PartialEq)]
2109#[non_exhaustive]
2110pub struct SubmitUriMetadata {
2111 pub state: crate::model::submit_uri_metadata::State,
2113
2114 pub create_time: std::option::Option<wkt::Timestamp>,
2116
2117 pub update_time: std::option::Option<wkt::Timestamp>,
2119
2120 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2121}
2122
2123impl SubmitUriMetadata {
2124 pub fn new() -> Self {
2125 std::default::Default::default()
2126 }
2127
2128 pub fn set_state<T: std::convert::Into<crate::model::submit_uri_metadata::State>>(
2130 mut self,
2131 v: T,
2132 ) -> Self {
2133 self.state = v.into();
2134 self
2135 }
2136
2137 pub fn set_create_time<T>(mut self, v: T) -> Self
2139 where
2140 T: std::convert::Into<wkt::Timestamp>,
2141 {
2142 self.create_time = std::option::Option::Some(v.into());
2143 self
2144 }
2145
2146 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2148 where
2149 T: std::convert::Into<wkt::Timestamp>,
2150 {
2151 self.create_time = v.map(|x| x.into());
2152 self
2153 }
2154
2155 pub fn set_update_time<T>(mut self, v: T) -> Self
2157 where
2158 T: std::convert::Into<wkt::Timestamp>,
2159 {
2160 self.update_time = std::option::Option::Some(v.into());
2161 self
2162 }
2163
2164 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2166 where
2167 T: std::convert::Into<wkt::Timestamp>,
2168 {
2169 self.update_time = v.map(|x| x.into());
2170 self
2171 }
2172}
2173
2174impl wkt::message::Message for SubmitUriMetadata {
2175 fn typename() -> &'static str {
2176 "type.googleapis.com/google.cloud.webrisk.v1.SubmitUriMetadata"
2177 }
2178}
2179
2180pub mod submit_uri_metadata {
2182 #[allow(unused_imports)]
2183 use super::*;
2184
2185 #[derive(Clone, Debug, PartialEq)]
2201 #[non_exhaustive]
2202 pub enum State {
2203 Unspecified,
2205 Running,
2207 Succeeded,
2209 Cancelled,
2211 Failed,
2213 Closed,
2215 UnknownValue(state::UnknownValue),
2220 }
2221
2222 #[doc(hidden)]
2223 pub mod state {
2224 #[allow(unused_imports)]
2225 use super::*;
2226 #[derive(Clone, Debug, PartialEq)]
2227 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2228 }
2229
2230 impl State {
2231 pub fn value(&self) -> std::option::Option<i32> {
2236 match self {
2237 Self::Unspecified => std::option::Option::Some(0),
2238 Self::Running => std::option::Option::Some(1),
2239 Self::Succeeded => std::option::Option::Some(2),
2240 Self::Cancelled => std::option::Option::Some(3),
2241 Self::Failed => std::option::Option::Some(4),
2242 Self::Closed => std::option::Option::Some(5),
2243 Self::UnknownValue(u) => u.0.value(),
2244 }
2245 }
2246
2247 pub fn name(&self) -> std::option::Option<&str> {
2252 match self {
2253 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2254 Self::Running => std::option::Option::Some("RUNNING"),
2255 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
2256 Self::Cancelled => std::option::Option::Some("CANCELLED"),
2257 Self::Failed => std::option::Option::Some("FAILED"),
2258 Self::Closed => std::option::Option::Some("CLOSED"),
2259 Self::UnknownValue(u) => u.0.name(),
2260 }
2261 }
2262 }
2263
2264 impl std::default::Default for State {
2265 fn default() -> Self {
2266 use std::convert::From;
2267 Self::from(0)
2268 }
2269 }
2270
2271 impl std::fmt::Display for State {
2272 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2273 wkt::internal::display_enum(f, self.name(), self.value())
2274 }
2275 }
2276
2277 impl std::convert::From<i32> for State {
2278 fn from(value: i32) -> Self {
2279 match value {
2280 0 => Self::Unspecified,
2281 1 => Self::Running,
2282 2 => Self::Succeeded,
2283 3 => Self::Cancelled,
2284 4 => Self::Failed,
2285 5 => Self::Closed,
2286 _ => Self::UnknownValue(state::UnknownValue(
2287 wkt::internal::UnknownEnumValue::Integer(value),
2288 )),
2289 }
2290 }
2291 }
2292
2293 impl std::convert::From<&str> for State {
2294 fn from(value: &str) -> Self {
2295 use std::string::ToString;
2296 match value {
2297 "STATE_UNSPECIFIED" => Self::Unspecified,
2298 "RUNNING" => Self::Running,
2299 "SUCCEEDED" => Self::Succeeded,
2300 "CANCELLED" => Self::Cancelled,
2301 "FAILED" => Self::Failed,
2302 "CLOSED" => Self::Closed,
2303 _ => Self::UnknownValue(state::UnknownValue(
2304 wkt::internal::UnknownEnumValue::String(value.to_string()),
2305 )),
2306 }
2307 }
2308 }
2309
2310 impl serde::ser::Serialize for State {
2311 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2312 where
2313 S: serde::Serializer,
2314 {
2315 match self {
2316 Self::Unspecified => serializer.serialize_i32(0),
2317 Self::Running => serializer.serialize_i32(1),
2318 Self::Succeeded => serializer.serialize_i32(2),
2319 Self::Cancelled => serializer.serialize_i32(3),
2320 Self::Failed => serializer.serialize_i32(4),
2321 Self::Closed => serializer.serialize_i32(5),
2322 Self::UnknownValue(u) => u.0.serialize(serializer),
2323 }
2324 }
2325 }
2326
2327 impl<'de> serde::de::Deserialize<'de> for State {
2328 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2329 where
2330 D: serde::Deserializer<'de>,
2331 {
2332 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2333 ".google.cloud.webrisk.v1.SubmitUriMetadata.State",
2334 ))
2335 }
2336 }
2337}
2338
2339#[derive(Clone, Debug, PartialEq)]
2356#[non_exhaustive]
2357pub enum ThreatType {
2358 Unspecified,
2360 Malware,
2362 SocialEngineering,
2364 UnwantedSoftware,
2366 SocialEngineeringExtendedCoverage,
2369 UnknownValue(threat_type::UnknownValue),
2374}
2375
2376#[doc(hidden)]
2377pub mod threat_type {
2378 #[allow(unused_imports)]
2379 use super::*;
2380 #[derive(Clone, Debug, PartialEq)]
2381 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2382}
2383
2384impl ThreatType {
2385 pub fn value(&self) -> std::option::Option<i32> {
2390 match self {
2391 Self::Unspecified => std::option::Option::Some(0),
2392 Self::Malware => std::option::Option::Some(1),
2393 Self::SocialEngineering => std::option::Option::Some(2),
2394 Self::UnwantedSoftware => std::option::Option::Some(3),
2395 Self::SocialEngineeringExtendedCoverage => std::option::Option::Some(4),
2396 Self::UnknownValue(u) => u.0.value(),
2397 }
2398 }
2399
2400 pub fn name(&self) -> std::option::Option<&str> {
2405 match self {
2406 Self::Unspecified => std::option::Option::Some("THREAT_TYPE_UNSPECIFIED"),
2407 Self::Malware => std::option::Option::Some("MALWARE"),
2408 Self::SocialEngineering => std::option::Option::Some("SOCIAL_ENGINEERING"),
2409 Self::UnwantedSoftware => std::option::Option::Some("UNWANTED_SOFTWARE"),
2410 Self::SocialEngineeringExtendedCoverage => {
2411 std::option::Option::Some("SOCIAL_ENGINEERING_EXTENDED_COVERAGE")
2412 }
2413 Self::UnknownValue(u) => u.0.name(),
2414 }
2415 }
2416}
2417
2418impl std::default::Default for ThreatType {
2419 fn default() -> Self {
2420 use std::convert::From;
2421 Self::from(0)
2422 }
2423}
2424
2425impl std::fmt::Display for ThreatType {
2426 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2427 wkt::internal::display_enum(f, self.name(), self.value())
2428 }
2429}
2430
2431impl std::convert::From<i32> for ThreatType {
2432 fn from(value: i32) -> Self {
2433 match value {
2434 0 => Self::Unspecified,
2435 1 => Self::Malware,
2436 2 => Self::SocialEngineering,
2437 3 => Self::UnwantedSoftware,
2438 4 => Self::SocialEngineeringExtendedCoverage,
2439 _ => Self::UnknownValue(threat_type::UnknownValue(
2440 wkt::internal::UnknownEnumValue::Integer(value),
2441 )),
2442 }
2443 }
2444}
2445
2446impl std::convert::From<&str> for ThreatType {
2447 fn from(value: &str) -> Self {
2448 use std::string::ToString;
2449 match value {
2450 "THREAT_TYPE_UNSPECIFIED" => Self::Unspecified,
2451 "MALWARE" => Self::Malware,
2452 "SOCIAL_ENGINEERING" => Self::SocialEngineering,
2453 "UNWANTED_SOFTWARE" => Self::UnwantedSoftware,
2454 "SOCIAL_ENGINEERING_EXTENDED_COVERAGE" => Self::SocialEngineeringExtendedCoverage,
2455 _ => Self::UnknownValue(threat_type::UnknownValue(
2456 wkt::internal::UnknownEnumValue::String(value.to_string()),
2457 )),
2458 }
2459 }
2460}
2461
2462impl serde::ser::Serialize for ThreatType {
2463 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2464 where
2465 S: serde::Serializer,
2466 {
2467 match self {
2468 Self::Unspecified => serializer.serialize_i32(0),
2469 Self::Malware => serializer.serialize_i32(1),
2470 Self::SocialEngineering => serializer.serialize_i32(2),
2471 Self::UnwantedSoftware => serializer.serialize_i32(3),
2472 Self::SocialEngineeringExtendedCoverage => serializer.serialize_i32(4),
2473 Self::UnknownValue(u) => u.0.serialize(serializer),
2474 }
2475 }
2476}
2477
2478impl<'de> serde::de::Deserialize<'de> for ThreatType {
2479 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2480 where
2481 D: serde::Deserializer<'de>,
2482 {
2483 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ThreatType>::new(
2484 ".google.cloud.webrisk.v1.ThreatType",
2485 ))
2486 }
2487}
2488
2489#[derive(Clone, Debug, PartialEq)]
2505#[non_exhaustive]
2506pub enum CompressionType {
2507 Unspecified,
2509 Raw,
2511 Rice,
2513 UnknownValue(compression_type::UnknownValue),
2518}
2519
2520#[doc(hidden)]
2521pub mod compression_type {
2522 #[allow(unused_imports)]
2523 use super::*;
2524 #[derive(Clone, Debug, PartialEq)]
2525 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2526}
2527
2528impl CompressionType {
2529 pub fn value(&self) -> std::option::Option<i32> {
2534 match self {
2535 Self::Unspecified => std::option::Option::Some(0),
2536 Self::Raw => std::option::Option::Some(1),
2537 Self::Rice => std::option::Option::Some(2),
2538 Self::UnknownValue(u) => u.0.value(),
2539 }
2540 }
2541
2542 pub fn name(&self) -> std::option::Option<&str> {
2547 match self {
2548 Self::Unspecified => std::option::Option::Some("COMPRESSION_TYPE_UNSPECIFIED"),
2549 Self::Raw => std::option::Option::Some("RAW"),
2550 Self::Rice => std::option::Option::Some("RICE"),
2551 Self::UnknownValue(u) => u.0.name(),
2552 }
2553 }
2554}
2555
2556impl std::default::Default for CompressionType {
2557 fn default() -> Self {
2558 use std::convert::From;
2559 Self::from(0)
2560 }
2561}
2562
2563impl std::fmt::Display for CompressionType {
2564 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2565 wkt::internal::display_enum(f, self.name(), self.value())
2566 }
2567}
2568
2569impl std::convert::From<i32> for CompressionType {
2570 fn from(value: i32) -> Self {
2571 match value {
2572 0 => Self::Unspecified,
2573 1 => Self::Raw,
2574 2 => Self::Rice,
2575 _ => Self::UnknownValue(compression_type::UnknownValue(
2576 wkt::internal::UnknownEnumValue::Integer(value),
2577 )),
2578 }
2579 }
2580}
2581
2582impl std::convert::From<&str> for CompressionType {
2583 fn from(value: &str) -> Self {
2584 use std::string::ToString;
2585 match value {
2586 "COMPRESSION_TYPE_UNSPECIFIED" => Self::Unspecified,
2587 "RAW" => Self::Raw,
2588 "RICE" => Self::Rice,
2589 _ => Self::UnknownValue(compression_type::UnknownValue(
2590 wkt::internal::UnknownEnumValue::String(value.to_string()),
2591 )),
2592 }
2593 }
2594}
2595
2596impl serde::ser::Serialize for CompressionType {
2597 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2598 where
2599 S: serde::Serializer,
2600 {
2601 match self {
2602 Self::Unspecified => serializer.serialize_i32(0),
2603 Self::Raw => serializer.serialize_i32(1),
2604 Self::Rice => serializer.serialize_i32(2),
2605 Self::UnknownValue(u) => u.0.serialize(serializer),
2606 }
2607 }
2608}
2609
2610impl<'de> serde::de::Deserialize<'de> for CompressionType {
2611 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2612 where
2613 D: serde::Deserializer<'de>,
2614 {
2615 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CompressionType>::new(
2616 ".google.cloud.webrisk.v1.CompressionType",
2617 ))
2618 }
2619}