google_cloud_webrisk_v1/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate lazy_static;
25extern crate 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/// Describes an API diff request.
40#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct ComputeThreatListDiffRequest {
43    /// Required. The threat list to update. Only a single ThreatType should be
44    /// specified per request. If you want to handle multiple ThreatTypes, you must
45    /// make one request per ThreatType.
46    pub threat_type: crate::model::ThreatType,
47
48    /// The current version token of the client for the requested list (the
49    /// client version that was received from the last successful diff).
50    /// If the client does not have a version token (this is the first time calling
51    /// ComputeThreatListDiff), this may be left empty and a full database
52    /// snapshot will be returned.
53    pub version_token: ::bytes::Bytes,
54
55    /// Required. The constraints associated with this request.
56    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    /// Sets the value of [threat_type][crate::model::ComputeThreatListDiffRequest::threat_type].
68    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    /// Sets the value of [version_token][crate::model::ComputeThreatListDiffRequest::version_token].
77    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    /// Sets the value of [constraints][crate::model::ComputeThreatListDiffRequest::constraints].
83    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    /// Sets or clears the value of [constraints][crate::model::ComputeThreatListDiffRequest::constraints].
92    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
107/// Defines additional types related to [ComputeThreatListDiffRequest].
108pub mod compute_threat_list_diff_request {
109    #[allow(unused_imports)]
110    use super::*;
111
112    /// The constraints for this diff.
113    #[derive(Clone, Default, PartialEq)]
114    #[non_exhaustive]
115    pub struct Constraints {
116        /// The maximum size in number of entries. The diff will not contain more
117        /// entries than this value.  This should be a power of 2 between 2**10 and
118        /// 2**20.  If zero, no diff size limit is set.
119        pub max_diff_entries: i32,
120
121        /// Sets the maximum number of entries that the client is willing to have
122        /// in the local database. This should be a power of 2 between 2**10 and
123        /// 2**20. If zero, no database size limit is set.
124        pub max_database_entries: i32,
125
126        /// The compression types supported by the client.
127        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        /// Sets the value of [max_diff_entries][crate::model::compute_threat_list_diff_request::Constraints::max_diff_entries].
138        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        /// Sets the value of [max_database_entries][crate::model::compute_threat_list_diff_request::Constraints::max_database_entries].
144        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        /// Sets the value of [supported_compressions][crate::model::compute_threat_list_diff_request::Constraints::supported_compressions].
150        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    /// The type of response. This may indicate that an action must be taken by the
172    /// client when the response is received.
173    pub response_type: crate::model::compute_threat_list_diff_response::ResponseType,
174
175    /// A set of entries to add to a local threat type's list.
176    pub additions: std::option::Option<crate::model::ThreatEntryAdditions>,
177
178    /// A set of entries to remove from a local threat type's list.
179    /// This field may be empty.
180    pub removals: std::option::Option<crate::model::ThreatEntryRemovals>,
181
182    /// The new opaque client version token. This should be retained by the client
183    /// and passed into the next call of ComputeThreatListDiff as 'version_token'.
184    /// A separate version token should be stored and used for each threatList.
185    pub new_version_token: ::bytes::Bytes,
186
187    /// The expected SHA256 hash of the client state; that is, of the sorted list
188    /// of all hashes present in the database after applying the provided diff.
189    /// If the client state doesn't match the expected state, the client must
190    /// discard this diff and retry later.
191    pub checksum: std::option::Option<crate::model::compute_threat_list_diff_response::Checksum>,
192
193    /// The soonest the client should wait before issuing any diff
194    /// request. Querying sooner is unlikely to produce a meaningful diff.
195    /// Waiting longer is acceptable considering the use case.
196    /// If this field is not set clients may update as soon as they want.
197    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    /// Sets the value of [response_type][crate::model::ComputeThreatListDiffResponse::response_type].
208    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    /// Sets the value of [additions][crate::model::ComputeThreatListDiffResponse::additions].
219    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    /// Sets or clears the value of [additions][crate::model::ComputeThreatListDiffResponse::additions].
228    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    /// Sets the value of [removals][crate::model::ComputeThreatListDiffResponse::removals].
237    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    /// Sets or clears the value of [removals][crate::model::ComputeThreatListDiffResponse::removals].
246    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    /// Sets the value of [new_version_token][crate::model::ComputeThreatListDiffResponse::new_version_token].
255    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    /// Sets the value of [checksum][crate::model::ComputeThreatListDiffResponse::checksum].
261    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    /// Sets or clears the value of [checksum][crate::model::ComputeThreatListDiffResponse::checksum].
270    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    /// Sets the value of [recommended_next_diff][crate::model::ComputeThreatListDiffResponse::recommended_next_diff].
279    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    /// Sets or clears the value of [recommended_next_diff][crate::model::ComputeThreatListDiffResponse::recommended_next_diff].
288    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
303/// Defines additional types related to [ComputeThreatListDiffResponse].
304pub mod compute_threat_list_diff_response {
305    #[allow(unused_imports)]
306    use super::*;
307
308    /// The expected state of a client's local database.
309    #[derive(Clone, Default, PartialEq)]
310    #[non_exhaustive]
311    pub struct Checksum {
312        /// The SHA256 hash of the client state; that is, of the sorted list of all
313        /// hashes present in the database.
314        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        /// Sets the value of [sha256][crate::model::compute_threat_list_diff_response::Checksum::sha256].
325        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    /// The type of response sent to the client.
338    ///
339    /// # Working with unknown values
340    ///
341    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
342    /// additional enum variants at any time. Adding new variants is not considered
343    /// a breaking change. Applications should write their code in anticipation of:
344    ///
345    /// - New values appearing in future releases of the client library, **and**
346    /// - New values received dynamically, without application changes.
347    ///
348    /// Please consult the [Working with enums] section in the user guide for some
349    /// guidelines.
350    ///
351    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
352    #[derive(Clone, Debug, PartialEq)]
353    #[non_exhaustive]
354    pub enum ResponseType {
355        /// Unknown.
356        Unspecified,
357        /// Partial updates are applied to the client's existing local database.
358        Diff,
359        /// Full updates resets the client's entire local database. This means
360        /// that either the client had no state, was seriously out-of-date,
361        /// or the client is believed to be corrupt.
362        Reset,
363        /// If set, the enum was initialized with an unknown value.
364        ///
365        /// Applications can examine the value using [ResponseType::value] or
366        /// [ResponseType::name].
367        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        /// Gets the enum value.
380        ///
381        /// Returns `None` if the enum contains an unknown value deserialized from
382        /// the string representation of enums.
383        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        /// Gets the enum value as a string.
393        ///
394        /// Returns `None` if the enum contains an unknown value deserialized from
395        /// the integer representation of enums.
396        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/// Request to check URI entries against threatLists.
473#[derive(Clone, Default, PartialEq)]
474#[non_exhaustive]
475pub struct SearchUrisRequest {
476    /// Required. The URI to be checked for matches.
477    pub uri: std::string::String,
478
479    /// Required. The ThreatLists to search in. Multiple ThreatLists may be
480    /// specified.
481    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    /// Sets the value of [uri][crate::model::SearchUrisRequest::uri].
492    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    /// Sets the value of [threat_types][crate::model::SearchUrisRequest::threat_types].
498    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    /// The threat list matches. This might be empty if the URI is on no list.
519    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    /// Sets the value of [threat][crate::model::SearchUrisResponse::threat].
530    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    /// Sets or clears the value of [threat][crate::model::SearchUrisResponse::threat].
539    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
554/// Defines additional types related to [SearchUrisResponse].
555pub mod search_uris_response {
556    #[allow(unused_imports)]
557    use super::*;
558
559    /// Contains threat information on a matching uri.
560    #[derive(Clone, Default, PartialEq)]
561    #[non_exhaustive]
562    pub struct ThreatUri {
563        /// The ThreatList this threat belongs to.
564        pub threat_types: std::vec::Vec<crate::model::ThreatType>,
565
566        /// The cache lifetime for the returned match. Clients must not cache this
567        /// response past this timestamp to avoid false positives.
568        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        /// Sets the value of [threat_types][crate::model::search_uris_response::ThreatUri::threat_types].
579        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        /// Sets the value of [expire_time][crate::model::search_uris_response::ThreatUri::expire_time].
590        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        /// Sets or clears the value of [expire_time][crate::model::search_uris_response::ThreatUri::expire_time].
599        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/// Request to return full hashes matched by the provided hash prefixes.
616#[derive(Clone, Default, PartialEq)]
617#[non_exhaustive]
618pub struct SearchHashesRequest {
619    /// A hash prefix, consisting of the most significant 4-32 bytes of a SHA256
620    /// hash. For JSON requests, this field is base64-encoded.
621    /// Note that if this parameter is provided by a URI, it must be encoded using
622    /// the web safe base64 variant (RFC 4648).
623    pub hash_prefix: ::bytes::Bytes,
624
625    /// Required. The ThreatLists to search in. Multiple ThreatLists may be
626    /// specified.
627    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    /// Sets the value of [hash_prefix][crate::model::SearchHashesRequest::hash_prefix].
638    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    /// Sets the value of [threat_types][crate::model::SearchHashesRequest::threat_types].
644    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    /// The full hashes that matched the requested prefixes.
665    /// The hash will be populated in the key.
666    pub threats: std::vec::Vec<crate::model::search_hashes_response::ThreatHash>,
667
668    /// For requested entities that did not match the threat list, how long to
669    /// cache the response until.
670    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    /// Sets the value of [threats][crate::model::SearchHashesResponse::threats].
681    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    /// Sets the value of [negative_expire_time][crate::model::SearchHashesResponse::negative_expire_time].
692    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    /// Sets or clears the value of [negative_expire_time][crate::model::SearchHashesResponse::negative_expire_time].
701    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
716/// Defines additional types related to [SearchHashesResponse].
717pub mod search_hashes_response {
718    #[allow(unused_imports)]
719    use super::*;
720
721    /// Contains threat information on a matching hash.
722    #[derive(Clone, Default, PartialEq)]
723    #[non_exhaustive]
724    pub struct ThreatHash {
725        /// The ThreatList this threat belongs to.
726        /// This must contain at least one entry.
727        pub threat_types: std::vec::Vec<crate::model::ThreatType>,
728
729        /// A 32 byte SHA256 hash. This field is in binary format. For JSON
730        /// requests, hashes are base64-encoded.
731        pub hash: ::bytes::Bytes,
732
733        /// The cache lifetime for the returned match. Clients must not cache this
734        /// response past this timestamp to avoid false positives.
735        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        /// Sets the value of [threat_types][crate::model::search_hashes_response::ThreatHash::threat_types].
746        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        /// Sets the value of [hash][crate::model::search_hashes_response::ThreatHash::hash].
757        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        /// Sets the value of [expire_time][crate::model::search_hashes_response::ThreatHash::expire_time].
763        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        /// Sets or clears the value of [expire_time][crate::model::search_hashes_response::ThreatHash::expire_time].
772        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/// Contains the set of entries to add to a local database.
789/// May contain a combination of compressed and raw data in a single response.
790#[derive(Clone, Default, PartialEq)]
791#[non_exhaustive]
792pub struct ThreatEntryAdditions {
793    /// The raw SHA256-formatted entries.
794    /// Repeated to allow returning sets of hashes with different prefix sizes.
795    pub raw_hashes: std::vec::Vec<crate::model::RawHashes>,
796
797    /// The encoded 4-byte prefixes of SHA256-formatted entries, using a
798    /// Golomb-Rice encoding. The hashes are converted to uint32, sorted in
799    /// ascending order, then delta encoded and stored as encoded_data.
800    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    /// Sets the value of [raw_hashes][crate::model::ThreatEntryAdditions::raw_hashes].
811    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    /// Sets the value of [rice_hashes][crate::model::ThreatEntryAdditions::rice_hashes].
822    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    /// Sets or clears the value of [rice_hashes][crate::model::ThreatEntryAdditions::rice_hashes].
831    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/// Contains the set of entries to remove from a local database.
847#[derive(Clone, Default, PartialEq)]
848#[non_exhaustive]
849pub struct ThreatEntryRemovals {
850    /// The raw removal indices for a local list.
851    pub raw_indices: std::option::Option<crate::model::RawIndices>,
852
853    /// The encoded local, lexicographically-sorted list indices, using a
854    /// Golomb-Rice encoding. Used for sending compressed removal indices. The
855    /// removal indices (uint32) are sorted in ascending order, then delta encoded
856    /// and stored as encoded_data.
857    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    /// Sets the value of [raw_indices][crate::model::ThreatEntryRemovals::raw_indices].
868    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    /// Sets or clears the value of [raw_indices][crate::model::ThreatEntryRemovals::raw_indices].
877    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    /// Sets the value of [rice_indices][crate::model::ThreatEntryRemovals::rice_indices].
886    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    /// Sets or clears the value of [rice_indices][crate::model::ThreatEntryRemovals::rice_indices].
895    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/// A set of raw indices to remove from a local list.
911#[derive(Clone, Default, PartialEq)]
912#[non_exhaustive]
913pub struct RawIndices {
914    /// The indices to remove from a lexicographically-sorted local list.
915    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    /// Sets the value of [indices][crate::model::RawIndices::indices].
926    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/// The uncompressed threat entries in hash format.
944/// Hashes can be anywhere from 4 to 32 bytes in size. A large majority are 4
945/// bytes, but some hashes are lengthened if they collide with the hash of a
946/// popular URI.
947///
948/// Used for sending ThreatEntryAdditons to clients that do not support
949/// compression, or when sending non-4-byte hashes to clients that do support
950/// compression.
951#[derive(Clone, Default, PartialEq)]
952#[non_exhaustive]
953pub struct RawHashes {
954    /// The number of bytes for each prefix encoded below.  This field can be
955    /// anywhere from 4 (shortest prefix) to 32 (full SHA256 hash).
956    /// In practice this is almost always 4, except in exceptional circumstances.
957    pub prefix_size: i32,
958
959    /// The hashes, in binary format, concatenated into one long string. Hashes are
960    /// sorted in lexicographic order. For JSON API users, hashes are
961    /// base64-encoded.
962    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    /// Sets the value of [prefix_size][crate::model::RawHashes::prefix_size].
973    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    /// Sets the value of [raw_hashes][crate::model::RawHashes::raw_hashes].
979    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/// The Rice-Golomb encoded data. Used for sending compressed 4-byte hashes or
992/// compressed removal indices.
993#[derive(Clone, Default, PartialEq)]
994#[non_exhaustive]
995pub struct RiceDeltaEncoding {
996    /// The offset of the first entry in the encoded data, or, if only a single
997    /// integer was encoded, that single integer's value. If the field is empty or
998    /// missing, assume zero.
999    pub first_value: i64,
1000
1001    /// The Golomb-Rice parameter, which is a number between 2 and 28. This field
1002    /// is missing (that is, zero) if `num_entries` is zero.
1003    pub rice_parameter: i32,
1004
1005    /// The number of entries that are delta encoded in the encoded data. If only a
1006    /// single integer was encoded, this will be zero and the single value will be
1007    /// stored in `first_value`.
1008    pub entry_count: i32,
1009
1010    /// The encoded deltas that are encoded using the Golomb-Rice coder.
1011    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    /// Sets the value of [first_value][crate::model::RiceDeltaEncoding::first_value].
1022    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    /// Sets the value of [rice_parameter][crate::model::RiceDeltaEncoding::rice_parameter].
1028    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    /// Sets the value of [entry_count][crate::model::RiceDeltaEncoding::entry_count].
1034    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    /// Sets the value of [encoded_data][crate::model::RiceDeltaEncoding::encoded_data].
1040    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/// Wraps a URI that might be displaying malicious content.
1053#[derive(Clone, Default, PartialEq)]
1054#[non_exhaustive]
1055pub struct Submission {
1056    /// Required. The URI that is being reported for malicious content to be
1057    /// analyzed.
1058    pub uri: std::string::String,
1059
1060    /// Output only. ThreatTypes found to be associated with the submitted URI
1061    /// after reviewing it. This might be empty if the URI was not added to any
1062    /// list.
1063    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    /// Sets the value of [uri][crate::model::Submission::uri].
1074    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    /// Sets the value of [threat_types][crate::model::Submission::threat_types].
1080    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/// Context about the submission including the type of abuse found on the URI and
1098/// supporting details.
1099#[derive(Clone, Default, PartialEq)]
1100#[non_exhaustive]
1101pub struct ThreatInfo {
1102    /// The type of abuse.
1103    pub abuse_type: crate::model::threat_info::AbuseType,
1104
1105    /// Confidence that the URI is unsafe.
1106    pub threat_confidence: std::option::Option<crate::model::threat_info::Confidence>,
1107
1108    /// Context about why the URI is unsafe.
1109    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    /// Sets the value of [abuse_type][crate::model::ThreatInfo::abuse_type].
1120    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    /// Sets the value of [threat_confidence][crate::model::ThreatInfo::threat_confidence].
1129    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    /// Sets or clears the value of [threat_confidence][crate::model::ThreatInfo::threat_confidence].
1138    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    /// Sets the value of [threat_justification][crate::model::ThreatInfo::threat_justification].
1147    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    /// Sets or clears the value of [threat_justification][crate::model::ThreatInfo::threat_justification].
1156    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
1171/// Defines additional types related to [ThreatInfo].
1172pub mod threat_info {
1173    #[allow(unused_imports)]
1174    use super::*;
1175
1176    /// Confidence that a URI is unsafe.
1177    #[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        /// Sets the value of [value][crate::model::threat_info::Confidence::value].
1191        ///
1192        /// Note that all the setters affecting `value` are mutually
1193        /// exclusive.
1194        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        /// The value of [value][crate::model::threat_info::Confidence::value]
1205        /// if it holds a `Score`, `None` if the field is not set or
1206        /// holds a different branch.
1207        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        /// Sets the value of [value][crate::model::threat_info::Confidence::value]
1218        /// to hold a `Score`.
1219        ///
1220        /// Note that all the setters affecting `value` are
1221        /// mutually exclusive.
1222        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        /// The value of [value][crate::model::threat_info::Confidence::value]
1230        /// if it holds a `Level`, `None` if the field is not set or
1231        /// holds a different branch.
1232        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        /// Sets the value of [value][crate::model::threat_info::Confidence::value]
1245        /// to hold a `Level`.
1246        ///
1247        /// Note that all the setters affecting `value` are
1248        /// mutually exclusive.
1249        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    /// Defines additional types related to [Confidence].
1269    pub mod confidence {
1270        #[allow(unused_imports)]
1271        use super::*;
1272
1273        /// Enum representation of confidence.
1274        ///
1275        /// # Working with unknown values
1276        ///
1277        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1278        /// additional enum variants at any time. Adding new variants is not considered
1279        /// a breaking change. Applications should write their code in anticipation of:
1280        ///
1281        /// - New values appearing in future releases of the client library, **and**
1282        /// - New values received dynamically, without application changes.
1283        ///
1284        /// Please consult the [Working with enums] section in the user guide for some
1285        /// guidelines.
1286        ///
1287        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1288        #[derive(Clone, Debug, PartialEq)]
1289        #[non_exhaustive]
1290        pub enum ConfidenceLevel {
1291            /// Default.
1292            Unspecified,
1293            /// Less than 60% confidence that the URI is unsafe.
1294            Low,
1295            /// Between 60% and 80% confidence that the URI is unsafe.
1296            Medium,
1297            /// Greater than 80% confidence that the URI is unsafe.
1298            High,
1299            /// If set, the enum was initialized with an unknown value.
1300            ///
1301            /// Applications can examine the value using [ConfidenceLevel::value] or
1302            /// [ConfidenceLevel::name].
1303            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            /// Gets the enum value.
1316            ///
1317            /// Returns `None` if the enum contains an unknown value deserialized from
1318            /// the string representation of enums.
1319            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            /// Gets the enum value as a string.
1330            ///
1331            /// Returns `None` if the enum contains an unknown value deserialized from
1332            /// the integer representation of enums.
1333            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            /// A decimal representation of confidence in the range of 0
1419            /// to 1 where 0 indicates no confidence and 1 indicates
1420            /// complete confidence.
1421            Score(f32),
1422            /// Enum representation of confidence.
1423            Level(crate::model::threat_info::confidence::ConfidenceLevel),
1424        }
1425    }
1426
1427    /// Context about why the URI is unsafe.
1428    #[derive(Clone, Default, PartialEq)]
1429    #[non_exhaustive]
1430    pub struct ThreatJustification {
1431        /// Labels associated with this URI that explain how it was classified.
1432        pub labels:
1433            std::vec::Vec<crate::model::threat_info::threat_justification::JustificationLabel>,
1434
1435        /// Free-form context on why this URI is unsafe.
1436        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        /// Sets the value of [labels][crate::model::threat_info::ThreatJustification::labels].
1447        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        /// Sets the value of [comments][crate::model::threat_info::ThreatJustification::comments].
1460        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    /// Defines additional types related to [ThreatJustification].
1478    pub mod threat_justification {
1479        #[allow(unused_imports)]
1480        use super::*;
1481
1482        /// Labels that explain how the URI was classified.
1483        ///
1484        /// # Working with unknown values
1485        ///
1486        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1487        /// additional enum variants at any time. Adding new variants is not considered
1488        /// a breaking change. Applications should write their code in anticipation of:
1489        ///
1490        /// - New values appearing in future releases of the client library, **and**
1491        /// - New values received dynamically, without application changes.
1492        ///
1493        /// Please consult the [Working with enums] section in the user guide for some
1494        /// guidelines.
1495        ///
1496        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1497        #[derive(Clone, Debug, PartialEq)]
1498        #[non_exhaustive]
1499        pub enum JustificationLabel {
1500            /// Default.
1501            Unspecified,
1502            /// The submitter manually verified that the submission is unsafe.
1503            ManualVerification,
1504            /// The submitter received the submission from an end user.
1505            UserReport,
1506            /// The submitter received the submission from an automated system.
1507            AutomatedReport,
1508            /// If set, the enum was initialized with an unknown value.
1509            ///
1510            /// Applications can examine the value using [JustificationLabel::value] or
1511            /// [JustificationLabel::name].
1512            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            /// Gets the enum value.
1525            ///
1526            /// Returns `None` if the enum contains an unknown value deserialized from
1527            /// the string representation of enums.
1528            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            /// Gets the enum value as a string.
1539            ///
1540            /// Returns `None` if the enum contains an unknown value deserialized from
1541            /// the integer representation of enums.
1542            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    /// The abuse type found on the URI.
1628    ///
1629    /// # Working with unknown values
1630    ///
1631    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1632    /// additional enum variants at any time. Adding new variants is not considered
1633    /// a breaking change. Applications should write their code in anticipation of:
1634    ///
1635    /// - New values appearing in future releases of the client library, **and**
1636    /// - New values received dynamically, without application changes.
1637    ///
1638    /// Please consult the [Working with enums] section in the user guide for some
1639    /// guidelines.
1640    ///
1641    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1642    #[derive(Clone, Debug, PartialEq)]
1643    #[non_exhaustive]
1644    pub enum AbuseType {
1645        /// Default.
1646        Unspecified,
1647        /// The URI contains malware.
1648        Malware,
1649        /// The URI contains social engineering.
1650        SocialEngineering,
1651        /// The URI contains unwanted software.
1652        UnwantedSoftware,
1653        /// If set, the enum was initialized with an unknown value.
1654        ///
1655        /// Applications can examine the value using [AbuseType::value] or
1656        /// [AbuseType::name].
1657        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        /// Gets the enum value.
1670        ///
1671        /// Returns `None` if the enum contains an unknown value deserialized from
1672        /// the string representation of enums.
1673        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        /// Gets the enum value as a string.
1684        ///
1685        /// Returns `None` if the enum contains an unknown value deserialized from
1686        /// the integer representation of enums.
1687        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/// Details about how the threat was discovered.
1768#[derive(Clone, Default, PartialEq)]
1769#[non_exhaustive]
1770pub struct ThreatDiscovery {
1771    /// Platform on which the threat was discovered.
1772    pub platform: crate::model::threat_discovery::Platform,
1773
1774    /// CLDR region code of the countries/regions the URI poses a threat ordered
1775    /// from most impact to least impact. Example: "US" for United States.
1776    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    /// Sets the value of [platform][crate::model::ThreatDiscovery::platform].
1787    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    /// Sets the value of [region_codes][crate::model::ThreatDiscovery::region_codes].
1796    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
1813/// Defines additional types related to [ThreatDiscovery].
1814pub mod threat_discovery {
1815    #[allow(unused_imports)]
1816    use super::*;
1817
1818    /// Platform types.
1819    ///
1820    /// # Working with unknown values
1821    ///
1822    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1823    /// additional enum variants at any time. Adding new variants is not considered
1824    /// a breaking change. Applications should write their code in anticipation of:
1825    ///
1826    /// - New values appearing in future releases of the client library, **and**
1827    /// - New values received dynamically, without application changes.
1828    ///
1829    /// Please consult the [Working with enums] section in the user guide for some
1830    /// guidelines.
1831    ///
1832    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1833    #[derive(Clone, Debug, PartialEq)]
1834    #[non_exhaustive]
1835    pub enum Platform {
1836        /// Default.
1837        Unspecified,
1838        /// General Android platform.
1839        Android,
1840        /// General iOS platform.
1841        Ios,
1842        /// General macOS platform.
1843        Macos,
1844        /// General Windows platform.
1845        Windows,
1846        /// If set, the enum was initialized with an unknown value.
1847        ///
1848        /// Applications can examine the value using [Platform::value] or
1849        /// [Platform::name].
1850        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        /// Gets the enum value.
1863        ///
1864        /// Returns `None` if the enum contains an unknown value deserialized from
1865        /// the string representation of enums.
1866        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        /// Gets the enum value as a string.
1878        ///
1879        /// Returns `None` if the enum contains an unknown value deserialized from
1880        /// the integer representation of enums.
1881        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/// Request to send a potentially phishy URI to WebRisk.
1966#[derive(Clone, Default, PartialEq)]
1967#[non_exhaustive]
1968pub struct CreateSubmissionRequest {
1969    /// Required. The name of the project that is making the submission. This
1970    /// string is in the format "projects/{project_number}".
1971    pub parent: std::string::String,
1972
1973    /// Required. The submission that contains the content of the phishing report.
1974    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    /// Sets the value of [parent][crate::model::CreateSubmissionRequest::parent].
1985    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    /// Sets the value of [submission][crate::model::CreateSubmissionRequest::submission].
1991    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    /// Sets or clears the value of [submission][crate::model::CreateSubmissionRequest::submission].
2000    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/// Request to send a potentially malicious URI to WebRisk.
2016#[derive(Clone, Default, PartialEq)]
2017#[non_exhaustive]
2018pub struct SubmitUriRequest {
2019    /// Required. The name of the project that is making the submission. This
2020    /// string is in the format "projects/{project_number}".
2021    pub parent: std::string::String,
2022
2023    /// Required. The submission that contains the URI to be scanned.
2024    pub submission: std::option::Option<crate::model::Submission>,
2025
2026    /// Provides additional information about the submission.
2027    pub threat_info: std::option::Option<crate::model::ThreatInfo>,
2028
2029    /// Provides additional information about how the submission was discovered.
2030    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    /// Sets the value of [parent][crate::model::SubmitUriRequest::parent].
2041    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    /// Sets the value of [submission][crate::model::SubmitUriRequest::submission].
2047    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    /// Sets or clears the value of [submission][crate::model::SubmitUriRequest::submission].
2056    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    /// Sets the value of [threat_info][crate::model::SubmitUriRequest::threat_info].
2065    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    /// Sets or clears the value of [threat_info][crate::model::SubmitUriRequest::threat_info].
2074    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    /// Sets the value of [threat_discovery][crate::model::SubmitUriRequest::threat_discovery].
2083    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    /// Sets or clears the value of [threat_discovery][crate::model::SubmitUriRequest::threat_discovery].
2092    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/// Metadata for the Submit URI long-running operation.
2108#[derive(Clone, Default, PartialEq)]
2109#[non_exhaustive]
2110pub struct SubmitUriMetadata {
2111    /// The state of the operation.
2112    pub state: crate::model::submit_uri_metadata::State,
2113
2114    /// Creation time of the operation.
2115    pub create_time: std::option::Option<wkt::Timestamp>,
2116
2117    /// Latest update time of the operation.
2118    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    /// Sets the value of [state][crate::model::SubmitUriMetadata::state].
2129    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    /// Sets the value of [create_time][crate::model::SubmitUriMetadata::create_time].
2138    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    /// Sets or clears the value of [create_time][crate::model::SubmitUriMetadata::create_time].
2147    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    /// Sets the value of [update_time][crate::model::SubmitUriMetadata::update_time].
2156    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    /// Sets or clears the value of [update_time][crate::model::SubmitUriMetadata::update_time].
2165    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
2180/// Defines additional types related to [SubmitUriMetadata].
2181pub mod submit_uri_metadata {
2182    #[allow(unused_imports)]
2183    use super::*;
2184
2185    /// Enum that represents the state of the long-running operation.
2186    ///
2187    /// # Working with unknown values
2188    ///
2189    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2190    /// additional enum variants at any time. Adding new variants is not considered
2191    /// a breaking change. Applications should write their code in anticipation of:
2192    ///
2193    /// - New values appearing in future releases of the client library, **and**
2194    /// - New values received dynamically, without application changes.
2195    ///
2196    /// Please consult the [Working with enums] section in the user guide for some
2197    /// guidelines.
2198    ///
2199    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2200    #[derive(Clone, Debug, PartialEq)]
2201    #[non_exhaustive]
2202    pub enum State {
2203        /// Default unspecified state.
2204        Unspecified,
2205        /// The operation is currently running.
2206        Running,
2207        /// The operation finished with a success status.
2208        Succeeded,
2209        /// The operation was cancelled.
2210        Cancelled,
2211        /// The operation finished with a failure status.
2212        Failed,
2213        /// The operation was closed with no action taken.
2214        Closed,
2215        /// If set, the enum was initialized with an unknown value.
2216        ///
2217        /// Applications can examine the value using [State::value] or
2218        /// [State::name].
2219        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        /// Gets the enum value.
2232        ///
2233        /// Returns `None` if the enum contains an unknown value deserialized from
2234        /// the string representation of enums.
2235        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        /// Gets the enum value as a string.
2248        ///
2249        /// Returns `None` if the enum contains an unknown value deserialized from
2250        /// the integer representation of enums.
2251        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/// The type of threat. This maps directly to the threat list a threat may
2340/// belong to.
2341///
2342/// # Working with unknown values
2343///
2344/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2345/// additional enum variants at any time. Adding new variants is not considered
2346/// a breaking change. Applications should write their code in anticipation of:
2347///
2348/// - New values appearing in future releases of the client library, **and**
2349/// - New values received dynamically, without application changes.
2350///
2351/// Please consult the [Working with enums] section in the user guide for some
2352/// guidelines.
2353///
2354/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2355#[derive(Clone, Debug, PartialEq)]
2356#[non_exhaustive]
2357pub enum ThreatType {
2358    /// No entries should match this threat type. This threat type is unused.
2359    Unspecified,
2360    /// Malware targeting any platform.
2361    Malware,
2362    /// Social engineering targeting any platform.
2363    SocialEngineering,
2364    /// Unwanted software targeting any platform.
2365    UnwantedSoftware,
2366    /// A list of extended coverage social engineering URIs targeting any
2367    /// platform.
2368    SocialEngineeringExtendedCoverage,
2369    /// If set, the enum was initialized with an unknown value.
2370    ///
2371    /// Applications can examine the value using [ThreatType::value] or
2372    /// [ThreatType::name].
2373    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    /// Gets the enum value.
2386    ///
2387    /// Returns `None` if the enum contains an unknown value deserialized from
2388    /// the string representation of enums.
2389    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    /// Gets the enum value as a string.
2401    ///
2402    /// Returns `None` if the enum contains an unknown value deserialized from
2403    /// the integer representation of enums.
2404    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/// The ways in which threat entry sets can be compressed.
2490///
2491/// # Working with unknown values
2492///
2493/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2494/// additional enum variants at any time. Adding new variants is not considered
2495/// a breaking change. Applications should write their code in anticipation of:
2496///
2497/// - New values appearing in future releases of the client library, **and**
2498/// - New values received dynamically, without application changes.
2499///
2500/// Please consult the [Working with enums] section in the user guide for some
2501/// guidelines.
2502///
2503/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2504#[derive(Clone, Debug, PartialEq)]
2505#[non_exhaustive]
2506pub enum CompressionType {
2507    /// Unknown.
2508    Unspecified,
2509    /// Raw, uncompressed data.
2510    Raw,
2511    /// Rice-Golomb encoded data.
2512    Rice,
2513    /// If set, the enum was initialized with an unknown value.
2514    ///
2515    /// Applications can examine the value using [CompressionType::value] or
2516    /// [CompressionType::name].
2517    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    /// Gets the enum value.
2530    ///
2531    /// Returns `None` if the enum contains an unknown value deserialized from
2532    /// the string representation of enums.
2533    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    /// Gets the enum value as a string.
2543    ///
2544    /// Returns `None` if the enum contains an unknown value deserialized from
2545    /// the integer representation of enums.
2546    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}