Skip to main content

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 gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_longrunning;
25extern crate google_cloud_lro;
26extern crate lazy_static;
27extern crate serde;
28extern crate serde_json;
29extern crate serde_with;
30extern crate std;
31extern crate tracing;
32extern crate wkt;
33
34mod debug;
35mod deserialize;
36mod serialize;
37
38/// Describes an API diff request.
39#[derive(Clone, Default, PartialEq)]
40#[non_exhaustive]
41pub struct ComputeThreatListDiffRequest {
42    /// Required. The threat list to update. Only a single ThreatType should be
43    /// specified per request. If you want to handle multiple ThreatTypes, you must
44    /// make one request per ThreatType.
45    pub threat_type: crate::model::ThreatType,
46
47    /// The current version token of the client for the requested list (the
48    /// client version that was received from the last successful diff).
49    /// If the client does not have a version token (this is the first time calling
50    /// ComputeThreatListDiff), this may be left empty and a full database
51    /// snapshot will be returned.
52    pub version_token: ::bytes::Bytes,
53
54    /// Required. The constraints associated with this request.
55    pub constraints:
56        std::option::Option<crate::model::compute_threat_list_diff_request::Constraints>,
57
58    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
59}
60
61impl ComputeThreatListDiffRequest {
62    pub fn new() -> Self {
63        std::default::Default::default()
64    }
65
66    /// Sets the value of [threat_type][crate::model::ComputeThreatListDiffRequest::threat_type].
67    ///
68    /// # Example
69    /// ```ignore,no_run
70    /// # use google_cloud_webrisk_v1::model::ComputeThreatListDiffRequest;
71    /// use google_cloud_webrisk_v1::model::ThreatType;
72    /// let x0 = ComputeThreatListDiffRequest::new().set_threat_type(ThreatType::Malware);
73    /// let x1 = ComputeThreatListDiffRequest::new().set_threat_type(ThreatType::SocialEngineering);
74    /// let x2 = ComputeThreatListDiffRequest::new().set_threat_type(ThreatType::UnwantedSoftware);
75    /// ```
76    pub fn set_threat_type<T: std::convert::Into<crate::model::ThreatType>>(
77        mut self,
78        v: T,
79    ) -> Self {
80        self.threat_type = v.into();
81        self
82    }
83
84    /// Sets the value of [version_token][crate::model::ComputeThreatListDiffRequest::version_token].
85    ///
86    /// # Example
87    /// ```ignore,no_run
88    /// # use google_cloud_webrisk_v1::model::ComputeThreatListDiffRequest;
89    /// let x = ComputeThreatListDiffRequest::new().set_version_token(bytes::Bytes::from_static(b"example"));
90    /// ```
91    pub fn set_version_token<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
92        self.version_token = v.into();
93        self
94    }
95
96    /// Sets the value of [constraints][crate::model::ComputeThreatListDiffRequest::constraints].
97    ///
98    /// # Example
99    /// ```ignore,no_run
100    /// # use google_cloud_webrisk_v1::model::ComputeThreatListDiffRequest;
101    /// use google_cloud_webrisk_v1::model::compute_threat_list_diff_request::Constraints;
102    /// let x = ComputeThreatListDiffRequest::new().set_constraints(Constraints::default()/* use setters */);
103    /// ```
104    pub fn set_constraints<T>(mut self, v: T) -> Self
105    where
106        T: std::convert::Into<crate::model::compute_threat_list_diff_request::Constraints>,
107    {
108        self.constraints = std::option::Option::Some(v.into());
109        self
110    }
111
112    /// Sets or clears the value of [constraints][crate::model::ComputeThreatListDiffRequest::constraints].
113    ///
114    /// # Example
115    /// ```ignore,no_run
116    /// # use google_cloud_webrisk_v1::model::ComputeThreatListDiffRequest;
117    /// use google_cloud_webrisk_v1::model::compute_threat_list_diff_request::Constraints;
118    /// let x = ComputeThreatListDiffRequest::new().set_or_clear_constraints(Some(Constraints::default()/* use setters */));
119    /// let x = ComputeThreatListDiffRequest::new().set_or_clear_constraints(None::<Constraints>);
120    /// ```
121    pub fn set_or_clear_constraints<T>(mut self, v: std::option::Option<T>) -> Self
122    where
123        T: std::convert::Into<crate::model::compute_threat_list_diff_request::Constraints>,
124    {
125        self.constraints = v.map(|x| x.into());
126        self
127    }
128}
129
130impl wkt::message::Message for ComputeThreatListDiffRequest {
131    fn typename() -> &'static str {
132        "type.googleapis.com/google.cloud.webrisk.v1.ComputeThreatListDiffRequest"
133    }
134}
135
136/// Defines additional types related to [ComputeThreatListDiffRequest].
137pub mod compute_threat_list_diff_request {
138    #[allow(unused_imports)]
139    use super::*;
140
141    /// The constraints for this diff.
142    #[derive(Clone, Default, PartialEq)]
143    #[non_exhaustive]
144    pub struct Constraints {
145        /// The maximum size in number of entries. The diff will not contain more
146        /// entries than this value.  This should be a power of 2 between 2**10 and
147        /// 2**20.  If zero, no diff size limit is set.
148        pub max_diff_entries: i32,
149
150        /// Sets the maximum number of entries that the client is willing to have
151        /// in the local database. This should be a power of 2 between 2**10 and
152        /// 2**20. If zero, no database size limit is set.
153        pub max_database_entries: i32,
154
155        /// The compression types supported by the client.
156        pub supported_compressions: std::vec::Vec<crate::model::CompressionType>,
157
158        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
159    }
160
161    impl Constraints {
162        pub fn new() -> Self {
163            std::default::Default::default()
164        }
165
166        /// Sets the value of [max_diff_entries][crate::model::compute_threat_list_diff_request::Constraints::max_diff_entries].
167        ///
168        /// # Example
169        /// ```ignore,no_run
170        /// # use google_cloud_webrisk_v1::model::compute_threat_list_diff_request::Constraints;
171        /// let x = Constraints::new().set_max_diff_entries(42);
172        /// ```
173        pub fn set_max_diff_entries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
174            self.max_diff_entries = v.into();
175            self
176        }
177
178        /// Sets the value of [max_database_entries][crate::model::compute_threat_list_diff_request::Constraints::max_database_entries].
179        ///
180        /// # Example
181        /// ```ignore,no_run
182        /// # use google_cloud_webrisk_v1::model::compute_threat_list_diff_request::Constraints;
183        /// let x = Constraints::new().set_max_database_entries(42);
184        /// ```
185        pub fn set_max_database_entries<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
186            self.max_database_entries = v.into();
187            self
188        }
189
190        /// Sets the value of [supported_compressions][crate::model::compute_threat_list_diff_request::Constraints::supported_compressions].
191        ///
192        /// # Example
193        /// ```ignore,no_run
194        /// # use google_cloud_webrisk_v1::model::compute_threat_list_diff_request::Constraints;
195        /// use google_cloud_webrisk_v1::model::CompressionType;
196        /// let x = Constraints::new().set_supported_compressions([
197        ///     CompressionType::Raw,
198        ///     CompressionType::Rice,
199        /// ]);
200        /// ```
201        pub fn set_supported_compressions<T, V>(mut self, v: T) -> Self
202        where
203            T: std::iter::IntoIterator<Item = V>,
204            V: std::convert::Into<crate::model::CompressionType>,
205        {
206            use std::iter::Iterator;
207            self.supported_compressions = v.into_iter().map(|i| i.into()).collect();
208            self
209        }
210    }
211
212    impl wkt::message::Message for Constraints {
213        fn typename() -> &'static str {
214            "type.googleapis.com/google.cloud.webrisk.v1.ComputeThreatListDiffRequest.Constraints"
215        }
216    }
217}
218
219#[derive(Clone, Default, PartialEq)]
220#[non_exhaustive]
221pub struct ComputeThreatListDiffResponse {
222    /// The type of response. This may indicate that an action must be taken by the
223    /// client when the response is received.
224    pub response_type: crate::model::compute_threat_list_diff_response::ResponseType,
225
226    /// A set of entries to add to a local threat type's list.
227    pub additions: std::option::Option<crate::model::ThreatEntryAdditions>,
228
229    /// A set of entries to remove from a local threat type's list.
230    /// This field may be empty.
231    pub removals: std::option::Option<crate::model::ThreatEntryRemovals>,
232
233    /// The new opaque client version token. This should be retained by the client
234    /// and passed into the next call of ComputeThreatListDiff as 'version_token'.
235    /// A separate version token should be stored and used for each threatList.
236    pub new_version_token: ::bytes::Bytes,
237
238    /// The expected SHA256 hash of the client state; that is, of the sorted list
239    /// of all hashes present in the database after applying the provided diff.
240    /// If the client state doesn't match the expected state, the client must
241    /// discard this diff and retry later.
242    pub checksum: std::option::Option<crate::model::compute_threat_list_diff_response::Checksum>,
243
244    /// The soonest the client should wait before issuing any diff
245    /// request. Querying sooner is unlikely to produce a meaningful diff.
246    /// Waiting longer is acceptable considering the use case.
247    /// If this field is not set clients may update as soon as they want.
248    pub recommended_next_diff: std::option::Option<wkt::Timestamp>,
249
250    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
251}
252
253impl ComputeThreatListDiffResponse {
254    pub fn new() -> Self {
255        std::default::Default::default()
256    }
257
258    /// Sets the value of [response_type][crate::model::ComputeThreatListDiffResponse::response_type].
259    ///
260    /// # Example
261    /// ```ignore,no_run
262    /// # use google_cloud_webrisk_v1::model::ComputeThreatListDiffResponse;
263    /// use google_cloud_webrisk_v1::model::compute_threat_list_diff_response::ResponseType;
264    /// let x0 = ComputeThreatListDiffResponse::new().set_response_type(ResponseType::Diff);
265    /// let x1 = ComputeThreatListDiffResponse::new().set_response_type(ResponseType::Reset);
266    /// ```
267    pub fn set_response_type<
268        T: std::convert::Into<crate::model::compute_threat_list_diff_response::ResponseType>,
269    >(
270        mut self,
271        v: T,
272    ) -> Self {
273        self.response_type = v.into();
274        self
275    }
276
277    /// Sets the value of [additions][crate::model::ComputeThreatListDiffResponse::additions].
278    ///
279    /// # Example
280    /// ```ignore,no_run
281    /// # use google_cloud_webrisk_v1::model::ComputeThreatListDiffResponse;
282    /// use google_cloud_webrisk_v1::model::ThreatEntryAdditions;
283    /// let x = ComputeThreatListDiffResponse::new().set_additions(ThreatEntryAdditions::default()/* use setters */);
284    /// ```
285    pub fn set_additions<T>(mut self, v: T) -> Self
286    where
287        T: std::convert::Into<crate::model::ThreatEntryAdditions>,
288    {
289        self.additions = std::option::Option::Some(v.into());
290        self
291    }
292
293    /// Sets or clears the value of [additions][crate::model::ComputeThreatListDiffResponse::additions].
294    ///
295    /// # Example
296    /// ```ignore,no_run
297    /// # use google_cloud_webrisk_v1::model::ComputeThreatListDiffResponse;
298    /// use google_cloud_webrisk_v1::model::ThreatEntryAdditions;
299    /// let x = ComputeThreatListDiffResponse::new().set_or_clear_additions(Some(ThreatEntryAdditions::default()/* use setters */));
300    /// let x = ComputeThreatListDiffResponse::new().set_or_clear_additions(None::<ThreatEntryAdditions>);
301    /// ```
302    pub fn set_or_clear_additions<T>(mut self, v: std::option::Option<T>) -> Self
303    where
304        T: std::convert::Into<crate::model::ThreatEntryAdditions>,
305    {
306        self.additions = v.map(|x| x.into());
307        self
308    }
309
310    /// Sets the value of [removals][crate::model::ComputeThreatListDiffResponse::removals].
311    ///
312    /// # Example
313    /// ```ignore,no_run
314    /// # use google_cloud_webrisk_v1::model::ComputeThreatListDiffResponse;
315    /// use google_cloud_webrisk_v1::model::ThreatEntryRemovals;
316    /// let x = ComputeThreatListDiffResponse::new().set_removals(ThreatEntryRemovals::default()/* use setters */);
317    /// ```
318    pub fn set_removals<T>(mut self, v: T) -> Self
319    where
320        T: std::convert::Into<crate::model::ThreatEntryRemovals>,
321    {
322        self.removals = std::option::Option::Some(v.into());
323        self
324    }
325
326    /// Sets or clears the value of [removals][crate::model::ComputeThreatListDiffResponse::removals].
327    ///
328    /// # Example
329    /// ```ignore,no_run
330    /// # use google_cloud_webrisk_v1::model::ComputeThreatListDiffResponse;
331    /// use google_cloud_webrisk_v1::model::ThreatEntryRemovals;
332    /// let x = ComputeThreatListDiffResponse::new().set_or_clear_removals(Some(ThreatEntryRemovals::default()/* use setters */));
333    /// let x = ComputeThreatListDiffResponse::new().set_or_clear_removals(None::<ThreatEntryRemovals>);
334    /// ```
335    pub fn set_or_clear_removals<T>(mut self, v: std::option::Option<T>) -> Self
336    where
337        T: std::convert::Into<crate::model::ThreatEntryRemovals>,
338    {
339        self.removals = v.map(|x| x.into());
340        self
341    }
342
343    /// Sets the value of [new_version_token][crate::model::ComputeThreatListDiffResponse::new_version_token].
344    ///
345    /// # Example
346    /// ```ignore,no_run
347    /// # use google_cloud_webrisk_v1::model::ComputeThreatListDiffResponse;
348    /// let x = ComputeThreatListDiffResponse::new().set_new_version_token(bytes::Bytes::from_static(b"example"));
349    /// ```
350    pub fn set_new_version_token<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
351        self.new_version_token = v.into();
352        self
353    }
354
355    /// Sets the value of [checksum][crate::model::ComputeThreatListDiffResponse::checksum].
356    ///
357    /// # Example
358    /// ```ignore,no_run
359    /// # use google_cloud_webrisk_v1::model::ComputeThreatListDiffResponse;
360    /// use google_cloud_webrisk_v1::model::compute_threat_list_diff_response::Checksum;
361    /// let x = ComputeThreatListDiffResponse::new().set_checksum(Checksum::default()/* use setters */);
362    /// ```
363    pub fn set_checksum<T>(mut self, v: T) -> Self
364    where
365        T: std::convert::Into<crate::model::compute_threat_list_diff_response::Checksum>,
366    {
367        self.checksum = std::option::Option::Some(v.into());
368        self
369    }
370
371    /// Sets or clears the value of [checksum][crate::model::ComputeThreatListDiffResponse::checksum].
372    ///
373    /// # Example
374    /// ```ignore,no_run
375    /// # use google_cloud_webrisk_v1::model::ComputeThreatListDiffResponse;
376    /// use google_cloud_webrisk_v1::model::compute_threat_list_diff_response::Checksum;
377    /// let x = ComputeThreatListDiffResponse::new().set_or_clear_checksum(Some(Checksum::default()/* use setters */));
378    /// let x = ComputeThreatListDiffResponse::new().set_or_clear_checksum(None::<Checksum>);
379    /// ```
380    pub fn set_or_clear_checksum<T>(mut self, v: std::option::Option<T>) -> Self
381    where
382        T: std::convert::Into<crate::model::compute_threat_list_diff_response::Checksum>,
383    {
384        self.checksum = v.map(|x| x.into());
385        self
386    }
387
388    /// Sets the value of [recommended_next_diff][crate::model::ComputeThreatListDiffResponse::recommended_next_diff].
389    ///
390    /// # Example
391    /// ```ignore,no_run
392    /// # use google_cloud_webrisk_v1::model::ComputeThreatListDiffResponse;
393    /// use wkt::Timestamp;
394    /// let x = ComputeThreatListDiffResponse::new().set_recommended_next_diff(Timestamp::default()/* use setters */);
395    /// ```
396    pub fn set_recommended_next_diff<T>(mut self, v: T) -> Self
397    where
398        T: std::convert::Into<wkt::Timestamp>,
399    {
400        self.recommended_next_diff = std::option::Option::Some(v.into());
401        self
402    }
403
404    /// Sets or clears the value of [recommended_next_diff][crate::model::ComputeThreatListDiffResponse::recommended_next_diff].
405    ///
406    /// # Example
407    /// ```ignore,no_run
408    /// # use google_cloud_webrisk_v1::model::ComputeThreatListDiffResponse;
409    /// use wkt::Timestamp;
410    /// let x = ComputeThreatListDiffResponse::new().set_or_clear_recommended_next_diff(Some(Timestamp::default()/* use setters */));
411    /// let x = ComputeThreatListDiffResponse::new().set_or_clear_recommended_next_diff(None::<Timestamp>);
412    /// ```
413    pub fn set_or_clear_recommended_next_diff<T>(mut self, v: std::option::Option<T>) -> Self
414    where
415        T: std::convert::Into<wkt::Timestamp>,
416    {
417        self.recommended_next_diff = v.map(|x| x.into());
418        self
419    }
420}
421
422impl wkt::message::Message for ComputeThreatListDiffResponse {
423    fn typename() -> &'static str {
424        "type.googleapis.com/google.cloud.webrisk.v1.ComputeThreatListDiffResponse"
425    }
426}
427
428/// Defines additional types related to [ComputeThreatListDiffResponse].
429pub mod compute_threat_list_diff_response {
430    #[allow(unused_imports)]
431    use super::*;
432
433    /// The expected state of a client's local database.
434    #[derive(Clone, Default, PartialEq)]
435    #[non_exhaustive]
436    pub struct Checksum {
437        /// The SHA256 hash of the client state; that is, of the sorted list of all
438        /// hashes present in the database.
439        pub sha256: ::bytes::Bytes,
440
441        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
442    }
443
444    impl Checksum {
445        pub fn new() -> Self {
446            std::default::Default::default()
447        }
448
449        /// Sets the value of [sha256][crate::model::compute_threat_list_diff_response::Checksum::sha256].
450        ///
451        /// # Example
452        /// ```ignore,no_run
453        /// # use google_cloud_webrisk_v1::model::compute_threat_list_diff_response::Checksum;
454        /// let x = Checksum::new().set_sha256(bytes::Bytes::from_static(b"example"));
455        /// ```
456        pub fn set_sha256<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
457            self.sha256 = v.into();
458            self
459        }
460    }
461
462    impl wkt::message::Message for Checksum {
463        fn typename() -> &'static str {
464            "type.googleapis.com/google.cloud.webrisk.v1.ComputeThreatListDiffResponse.Checksum"
465        }
466    }
467
468    /// The type of response sent to the client.
469    ///
470    /// # Working with unknown values
471    ///
472    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
473    /// additional enum variants at any time. Adding new variants is not considered
474    /// a breaking change. Applications should write their code in anticipation of:
475    ///
476    /// - New values appearing in future releases of the client library, **and**
477    /// - New values received dynamically, without application changes.
478    ///
479    /// Please consult the [Working with enums] section in the user guide for some
480    /// guidelines.
481    ///
482    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
483    #[derive(Clone, Debug, PartialEq)]
484    #[non_exhaustive]
485    pub enum ResponseType {
486        /// Unknown.
487        Unspecified,
488        /// Partial updates are applied to the client's existing local database.
489        Diff,
490        /// Full updates resets the client's entire local database. This means
491        /// that either the client had no state, was seriously out-of-date,
492        /// or the client is believed to be corrupt.
493        Reset,
494        /// If set, the enum was initialized with an unknown value.
495        ///
496        /// Applications can examine the value using [ResponseType::value] or
497        /// [ResponseType::name].
498        UnknownValue(response_type::UnknownValue),
499    }
500
501    #[doc(hidden)]
502    pub mod response_type {
503        #[allow(unused_imports)]
504        use super::*;
505        #[derive(Clone, Debug, PartialEq)]
506        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
507    }
508
509    impl ResponseType {
510        /// Gets the enum value.
511        ///
512        /// Returns `None` if the enum contains an unknown value deserialized from
513        /// the string representation of enums.
514        pub fn value(&self) -> std::option::Option<i32> {
515            match self {
516                Self::Unspecified => std::option::Option::Some(0),
517                Self::Diff => std::option::Option::Some(1),
518                Self::Reset => std::option::Option::Some(2),
519                Self::UnknownValue(u) => u.0.value(),
520            }
521        }
522
523        /// Gets the enum value as a string.
524        ///
525        /// Returns `None` if the enum contains an unknown value deserialized from
526        /// the integer representation of enums.
527        pub fn name(&self) -> std::option::Option<&str> {
528            match self {
529                Self::Unspecified => std::option::Option::Some("RESPONSE_TYPE_UNSPECIFIED"),
530                Self::Diff => std::option::Option::Some("DIFF"),
531                Self::Reset => std::option::Option::Some("RESET"),
532                Self::UnknownValue(u) => u.0.name(),
533            }
534        }
535    }
536
537    impl std::default::Default for ResponseType {
538        fn default() -> Self {
539            use std::convert::From;
540            Self::from(0)
541        }
542    }
543
544    impl std::fmt::Display for ResponseType {
545        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
546            wkt::internal::display_enum(f, self.name(), self.value())
547        }
548    }
549
550    impl std::convert::From<i32> for ResponseType {
551        fn from(value: i32) -> Self {
552            match value {
553                0 => Self::Unspecified,
554                1 => Self::Diff,
555                2 => Self::Reset,
556                _ => Self::UnknownValue(response_type::UnknownValue(
557                    wkt::internal::UnknownEnumValue::Integer(value),
558                )),
559            }
560        }
561    }
562
563    impl std::convert::From<&str> for ResponseType {
564        fn from(value: &str) -> Self {
565            use std::string::ToString;
566            match value {
567                "RESPONSE_TYPE_UNSPECIFIED" => Self::Unspecified,
568                "DIFF" => Self::Diff,
569                "RESET" => Self::Reset,
570                _ => Self::UnknownValue(response_type::UnknownValue(
571                    wkt::internal::UnknownEnumValue::String(value.to_string()),
572                )),
573            }
574        }
575    }
576
577    impl serde::ser::Serialize for ResponseType {
578        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
579        where
580            S: serde::Serializer,
581        {
582            match self {
583                Self::Unspecified => serializer.serialize_i32(0),
584                Self::Diff => serializer.serialize_i32(1),
585                Self::Reset => serializer.serialize_i32(2),
586                Self::UnknownValue(u) => u.0.serialize(serializer),
587            }
588        }
589    }
590
591    impl<'de> serde::de::Deserialize<'de> for ResponseType {
592        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
593        where
594            D: serde::Deserializer<'de>,
595        {
596            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ResponseType>::new(
597                ".google.cloud.webrisk.v1.ComputeThreatListDiffResponse.ResponseType",
598            ))
599        }
600    }
601}
602
603/// Request to check URI entries against threatLists.
604#[derive(Clone, Default, PartialEq)]
605#[non_exhaustive]
606pub struct SearchUrisRequest {
607    /// Required. The URI to be checked for matches.
608    pub uri: std::string::String,
609
610    /// Required. The ThreatLists to search in. Multiple ThreatLists may be
611    /// specified.
612    pub threat_types: std::vec::Vec<crate::model::ThreatType>,
613
614    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
615}
616
617impl SearchUrisRequest {
618    pub fn new() -> Self {
619        std::default::Default::default()
620    }
621
622    /// Sets the value of [uri][crate::model::SearchUrisRequest::uri].
623    ///
624    /// # Example
625    /// ```ignore,no_run
626    /// # use google_cloud_webrisk_v1::model::SearchUrisRequest;
627    /// let x = SearchUrisRequest::new().set_uri("example");
628    /// ```
629    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
630        self.uri = v.into();
631        self
632    }
633
634    /// Sets the value of [threat_types][crate::model::SearchUrisRequest::threat_types].
635    ///
636    /// # Example
637    /// ```ignore,no_run
638    /// # use google_cloud_webrisk_v1::model::SearchUrisRequest;
639    /// use google_cloud_webrisk_v1::model::ThreatType;
640    /// let x = SearchUrisRequest::new().set_threat_types([
641    ///     ThreatType::Malware,
642    ///     ThreatType::SocialEngineering,
643    ///     ThreatType::UnwantedSoftware,
644    /// ]);
645    /// ```
646    pub fn set_threat_types<T, V>(mut self, v: T) -> Self
647    where
648        T: std::iter::IntoIterator<Item = V>,
649        V: std::convert::Into<crate::model::ThreatType>,
650    {
651        use std::iter::Iterator;
652        self.threat_types = v.into_iter().map(|i| i.into()).collect();
653        self
654    }
655}
656
657impl wkt::message::Message for SearchUrisRequest {
658    fn typename() -> &'static str {
659        "type.googleapis.com/google.cloud.webrisk.v1.SearchUrisRequest"
660    }
661}
662
663#[derive(Clone, Default, PartialEq)]
664#[non_exhaustive]
665pub struct SearchUrisResponse {
666    /// The threat list matches. This might be empty if the URI is on no list.
667    pub threat: std::option::Option<crate::model::search_uris_response::ThreatUri>,
668
669    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
670}
671
672impl SearchUrisResponse {
673    pub fn new() -> Self {
674        std::default::Default::default()
675    }
676
677    /// Sets the value of [threat][crate::model::SearchUrisResponse::threat].
678    ///
679    /// # Example
680    /// ```ignore,no_run
681    /// # use google_cloud_webrisk_v1::model::SearchUrisResponse;
682    /// use google_cloud_webrisk_v1::model::search_uris_response::ThreatUri;
683    /// let x = SearchUrisResponse::new().set_threat(ThreatUri::default()/* use setters */);
684    /// ```
685    pub fn set_threat<T>(mut self, v: T) -> Self
686    where
687        T: std::convert::Into<crate::model::search_uris_response::ThreatUri>,
688    {
689        self.threat = std::option::Option::Some(v.into());
690        self
691    }
692
693    /// Sets or clears the value of [threat][crate::model::SearchUrisResponse::threat].
694    ///
695    /// # Example
696    /// ```ignore,no_run
697    /// # use google_cloud_webrisk_v1::model::SearchUrisResponse;
698    /// use google_cloud_webrisk_v1::model::search_uris_response::ThreatUri;
699    /// let x = SearchUrisResponse::new().set_or_clear_threat(Some(ThreatUri::default()/* use setters */));
700    /// let x = SearchUrisResponse::new().set_or_clear_threat(None::<ThreatUri>);
701    /// ```
702    pub fn set_or_clear_threat<T>(mut self, v: std::option::Option<T>) -> Self
703    where
704        T: std::convert::Into<crate::model::search_uris_response::ThreatUri>,
705    {
706        self.threat = v.map(|x| x.into());
707        self
708    }
709}
710
711impl wkt::message::Message for SearchUrisResponse {
712    fn typename() -> &'static str {
713        "type.googleapis.com/google.cloud.webrisk.v1.SearchUrisResponse"
714    }
715}
716
717/// Defines additional types related to [SearchUrisResponse].
718pub mod search_uris_response {
719    #[allow(unused_imports)]
720    use super::*;
721
722    /// Contains threat information on a matching uri.
723    #[derive(Clone, Default, PartialEq)]
724    #[non_exhaustive]
725    pub struct ThreatUri {
726        /// The ThreatList this threat belongs to.
727        pub threat_types: std::vec::Vec<crate::model::ThreatType>,
728
729        /// The cache lifetime for the returned match. Clients must not cache this
730        /// response past this timestamp to avoid false positives.
731        pub expire_time: std::option::Option<wkt::Timestamp>,
732
733        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
734    }
735
736    impl ThreatUri {
737        pub fn new() -> Self {
738            std::default::Default::default()
739        }
740
741        /// Sets the value of [threat_types][crate::model::search_uris_response::ThreatUri::threat_types].
742        ///
743        /// # Example
744        /// ```ignore,no_run
745        /// # use google_cloud_webrisk_v1::model::search_uris_response::ThreatUri;
746        /// use google_cloud_webrisk_v1::model::ThreatType;
747        /// let x = ThreatUri::new().set_threat_types([
748        ///     ThreatType::Malware,
749        ///     ThreatType::SocialEngineering,
750        ///     ThreatType::UnwantedSoftware,
751        /// ]);
752        /// ```
753        pub fn set_threat_types<T, V>(mut self, v: T) -> Self
754        where
755            T: std::iter::IntoIterator<Item = V>,
756            V: std::convert::Into<crate::model::ThreatType>,
757        {
758            use std::iter::Iterator;
759            self.threat_types = v.into_iter().map(|i| i.into()).collect();
760            self
761        }
762
763        /// Sets the value of [expire_time][crate::model::search_uris_response::ThreatUri::expire_time].
764        ///
765        /// # Example
766        /// ```ignore,no_run
767        /// # use google_cloud_webrisk_v1::model::search_uris_response::ThreatUri;
768        /// use wkt::Timestamp;
769        /// let x = ThreatUri::new().set_expire_time(Timestamp::default()/* use setters */);
770        /// ```
771        pub fn set_expire_time<T>(mut self, v: T) -> Self
772        where
773            T: std::convert::Into<wkt::Timestamp>,
774        {
775            self.expire_time = std::option::Option::Some(v.into());
776            self
777        }
778
779        /// Sets or clears the value of [expire_time][crate::model::search_uris_response::ThreatUri::expire_time].
780        ///
781        /// # Example
782        /// ```ignore,no_run
783        /// # use google_cloud_webrisk_v1::model::search_uris_response::ThreatUri;
784        /// use wkt::Timestamp;
785        /// let x = ThreatUri::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
786        /// let x = ThreatUri::new().set_or_clear_expire_time(None::<Timestamp>);
787        /// ```
788        pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
789        where
790            T: std::convert::Into<wkt::Timestamp>,
791        {
792            self.expire_time = v.map(|x| x.into());
793            self
794        }
795    }
796
797    impl wkt::message::Message for ThreatUri {
798        fn typename() -> &'static str {
799            "type.googleapis.com/google.cloud.webrisk.v1.SearchUrisResponse.ThreatUri"
800        }
801    }
802}
803
804/// Request to return full hashes matched by the provided hash prefixes.
805#[derive(Clone, Default, PartialEq)]
806#[non_exhaustive]
807pub struct SearchHashesRequest {
808    /// A hash prefix, consisting of the most significant 4-32 bytes of a SHA256
809    /// hash. For JSON requests, this field is base64-encoded.
810    /// Note that if this parameter is provided by a URI, it must be encoded using
811    /// the web safe base64 variant (RFC 4648).
812    pub hash_prefix: ::bytes::Bytes,
813
814    /// Required. The ThreatLists to search in. Multiple ThreatLists may be
815    /// specified.
816    pub threat_types: std::vec::Vec<crate::model::ThreatType>,
817
818    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
819}
820
821impl SearchHashesRequest {
822    pub fn new() -> Self {
823        std::default::Default::default()
824    }
825
826    /// Sets the value of [hash_prefix][crate::model::SearchHashesRequest::hash_prefix].
827    ///
828    /// # Example
829    /// ```ignore,no_run
830    /// # use google_cloud_webrisk_v1::model::SearchHashesRequest;
831    /// let x = SearchHashesRequest::new().set_hash_prefix(bytes::Bytes::from_static(b"example"));
832    /// ```
833    pub fn set_hash_prefix<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
834        self.hash_prefix = v.into();
835        self
836    }
837
838    /// Sets the value of [threat_types][crate::model::SearchHashesRequest::threat_types].
839    ///
840    /// # Example
841    /// ```ignore,no_run
842    /// # use google_cloud_webrisk_v1::model::SearchHashesRequest;
843    /// use google_cloud_webrisk_v1::model::ThreatType;
844    /// let x = SearchHashesRequest::new().set_threat_types([
845    ///     ThreatType::Malware,
846    ///     ThreatType::SocialEngineering,
847    ///     ThreatType::UnwantedSoftware,
848    /// ]);
849    /// ```
850    pub fn set_threat_types<T, V>(mut self, v: T) -> Self
851    where
852        T: std::iter::IntoIterator<Item = V>,
853        V: std::convert::Into<crate::model::ThreatType>,
854    {
855        use std::iter::Iterator;
856        self.threat_types = v.into_iter().map(|i| i.into()).collect();
857        self
858    }
859}
860
861impl wkt::message::Message for SearchHashesRequest {
862    fn typename() -> &'static str {
863        "type.googleapis.com/google.cloud.webrisk.v1.SearchHashesRequest"
864    }
865}
866
867#[derive(Clone, Default, PartialEq)]
868#[non_exhaustive]
869pub struct SearchHashesResponse {
870    /// The full hashes that matched the requested prefixes.
871    /// The hash will be populated in the key.
872    pub threats: std::vec::Vec<crate::model::search_hashes_response::ThreatHash>,
873
874    /// For requested entities that did not match the threat list, how long to
875    /// cache the response until.
876    pub negative_expire_time: std::option::Option<wkt::Timestamp>,
877
878    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
879}
880
881impl SearchHashesResponse {
882    pub fn new() -> Self {
883        std::default::Default::default()
884    }
885
886    /// Sets the value of [threats][crate::model::SearchHashesResponse::threats].
887    ///
888    /// # Example
889    /// ```ignore,no_run
890    /// # use google_cloud_webrisk_v1::model::SearchHashesResponse;
891    /// use google_cloud_webrisk_v1::model::search_hashes_response::ThreatHash;
892    /// let x = SearchHashesResponse::new()
893    ///     .set_threats([
894    ///         ThreatHash::default()/* use setters */,
895    ///         ThreatHash::default()/* use (different) setters */,
896    ///     ]);
897    /// ```
898    pub fn set_threats<T, V>(mut self, v: T) -> Self
899    where
900        T: std::iter::IntoIterator<Item = V>,
901        V: std::convert::Into<crate::model::search_hashes_response::ThreatHash>,
902    {
903        use std::iter::Iterator;
904        self.threats = v.into_iter().map(|i| i.into()).collect();
905        self
906    }
907
908    /// Sets the value of [negative_expire_time][crate::model::SearchHashesResponse::negative_expire_time].
909    ///
910    /// # Example
911    /// ```ignore,no_run
912    /// # use google_cloud_webrisk_v1::model::SearchHashesResponse;
913    /// use wkt::Timestamp;
914    /// let x = SearchHashesResponse::new().set_negative_expire_time(Timestamp::default()/* use setters */);
915    /// ```
916    pub fn set_negative_expire_time<T>(mut self, v: T) -> Self
917    where
918        T: std::convert::Into<wkt::Timestamp>,
919    {
920        self.negative_expire_time = std::option::Option::Some(v.into());
921        self
922    }
923
924    /// Sets or clears the value of [negative_expire_time][crate::model::SearchHashesResponse::negative_expire_time].
925    ///
926    /// # Example
927    /// ```ignore,no_run
928    /// # use google_cloud_webrisk_v1::model::SearchHashesResponse;
929    /// use wkt::Timestamp;
930    /// let x = SearchHashesResponse::new().set_or_clear_negative_expire_time(Some(Timestamp::default()/* use setters */));
931    /// let x = SearchHashesResponse::new().set_or_clear_negative_expire_time(None::<Timestamp>);
932    /// ```
933    pub fn set_or_clear_negative_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
934    where
935        T: std::convert::Into<wkt::Timestamp>,
936    {
937        self.negative_expire_time = v.map(|x| x.into());
938        self
939    }
940}
941
942impl wkt::message::Message for SearchHashesResponse {
943    fn typename() -> &'static str {
944        "type.googleapis.com/google.cloud.webrisk.v1.SearchHashesResponse"
945    }
946}
947
948/// Defines additional types related to [SearchHashesResponse].
949pub mod search_hashes_response {
950    #[allow(unused_imports)]
951    use super::*;
952
953    /// Contains threat information on a matching hash.
954    #[derive(Clone, Default, PartialEq)]
955    #[non_exhaustive]
956    pub struct ThreatHash {
957        /// The ThreatList this threat belongs to.
958        /// This must contain at least one entry.
959        pub threat_types: std::vec::Vec<crate::model::ThreatType>,
960
961        /// A 32 byte SHA256 hash. This field is in binary format. For JSON
962        /// requests, hashes are base64-encoded.
963        pub hash: ::bytes::Bytes,
964
965        /// The cache lifetime for the returned match. Clients must not cache this
966        /// response past this timestamp to avoid false positives.
967        pub expire_time: std::option::Option<wkt::Timestamp>,
968
969        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
970    }
971
972    impl ThreatHash {
973        pub fn new() -> Self {
974            std::default::Default::default()
975        }
976
977        /// Sets the value of [threat_types][crate::model::search_hashes_response::ThreatHash::threat_types].
978        ///
979        /// # Example
980        /// ```ignore,no_run
981        /// # use google_cloud_webrisk_v1::model::search_hashes_response::ThreatHash;
982        /// use google_cloud_webrisk_v1::model::ThreatType;
983        /// let x = ThreatHash::new().set_threat_types([
984        ///     ThreatType::Malware,
985        ///     ThreatType::SocialEngineering,
986        ///     ThreatType::UnwantedSoftware,
987        /// ]);
988        /// ```
989        pub fn set_threat_types<T, V>(mut self, v: T) -> Self
990        where
991            T: std::iter::IntoIterator<Item = V>,
992            V: std::convert::Into<crate::model::ThreatType>,
993        {
994            use std::iter::Iterator;
995            self.threat_types = v.into_iter().map(|i| i.into()).collect();
996            self
997        }
998
999        /// Sets the value of [hash][crate::model::search_hashes_response::ThreatHash::hash].
1000        ///
1001        /// # Example
1002        /// ```ignore,no_run
1003        /// # use google_cloud_webrisk_v1::model::search_hashes_response::ThreatHash;
1004        /// let x = ThreatHash::new().set_hash(bytes::Bytes::from_static(b"example"));
1005        /// ```
1006        pub fn set_hash<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1007            self.hash = v.into();
1008            self
1009        }
1010
1011        /// Sets the value of [expire_time][crate::model::search_hashes_response::ThreatHash::expire_time].
1012        ///
1013        /// # Example
1014        /// ```ignore,no_run
1015        /// # use google_cloud_webrisk_v1::model::search_hashes_response::ThreatHash;
1016        /// use wkt::Timestamp;
1017        /// let x = ThreatHash::new().set_expire_time(Timestamp::default()/* use setters */);
1018        /// ```
1019        pub fn set_expire_time<T>(mut self, v: T) -> Self
1020        where
1021            T: std::convert::Into<wkt::Timestamp>,
1022        {
1023            self.expire_time = std::option::Option::Some(v.into());
1024            self
1025        }
1026
1027        /// Sets or clears the value of [expire_time][crate::model::search_hashes_response::ThreatHash::expire_time].
1028        ///
1029        /// # Example
1030        /// ```ignore,no_run
1031        /// # use google_cloud_webrisk_v1::model::search_hashes_response::ThreatHash;
1032        /// use wkt::Timestamp;
1033        /// let x = ThreatHash::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
1034        /// let x = ThreatHash::new().set_or_clear_expire_time(None::<Timestamp>);
1035        /// ```
1036        pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
1037        where
1038            T: std::convert::Into<wkt::Timestamp>,
1039        {
1040            self.expire_time = v.map(|x| x.into());
1041            self
1042        }
1043    }
1044
1045    impl wkt::message::Message for ThreatHash {
1046        fn typename() -> &'static str {
1047            "type.googleapis.com/google.cloud.webrisk.v1.SearchHashesResponse.ThreatHash"
1048        }
1049    }
1050}
1051
1052/// Contains the set of entries to add to a local database.
1053/// May contain a combination of compressed and raw data in a single response.
1054#[derive(Clone, Default, PartialEq)]
1055#[non_exhaustive]
1056pub struct ThreatEntryAdditions {
1057    /// The raw SHA256-formatted entries.
1058    /// Repeated to allow returning sets of hashes with different prefix sizes.
1059    pub raw_hashes: std::vec::Vec<crate::model::RawHashes>,
1060
1061    /// The encoded 4-byte prefixes of SHA256-formatted entries, using a
1062    /// Golomb-Rice encoding. The hashes are converted to uint32, sorted in
1063    /// ascending order, then delta encoded and stored as encoded_data.
1064    pub rice_hashes: std::option::Option<crate::model::RiceDeltaEncoding>,
1065
1066    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1067}
1068
1069impl ThreatEntryAdditions {
1070    pub fn new() -> Self {
1071        std::default::Default::default()
1072    }
1073
1074    /// Sets the value of [raw_hashes][crate::model::ThreatEntryAdditions::raw_hashes].
1075    ///
1076    /// # Example
1077    /// ```ignore,no_run
1078    /// # use google_cloud_webrisk_v1::model::ThreatEntryAdditions;
1079    /// use google_cloud_webrisk_v1::model::RawHashes;
1080    /// let x = ThreatEntryAdditions::new()
1081    ///     .set_raw_hashes([
1082    ///         RawHashes::default()/* use setters */,
1083    ///         RawHashes::default()/* use (different) setters */,
1084    ///     ]);
1085    /// ```
1086    pub fn set_raw_hashes<T, V>(mut self, v: T) -> Self
1087    where
1088        T: std::iter::IntoIterator<Item = V>,
1089        V: std::convert::Into<crate::model::RawHashes>,
1090    {
1091        use std::iter::Iterator;
1092        self.raw_hashes = v.into_iter().map(|i| i.into()).collect();
1093        self
1094    }
1095
1096    /// Sets the value of [rice_hashes][crate::model::ThreatEntryAdditions::rice_hashes].
1097    ///
1098    /// # Example
1099    /// ```ignore,no_run
1100    /// # use google_cloud_webrisk_v1::model::ThreatEntryAdditions;
1101    /// use google_cloud_webrisk_v1::model::RiceDeltaEncoding;
1102    /// let x = ThreatEntryAdditions::new().set_rice_hashes(RiceDeltaEncoding::default()/* use setters */);
1103    /// ```
1104    pub fn set_rice_hashes<T>(mut self, v: T) -> Self
1105    where
1106        T: std::convert::Into<crate::model::RiceDeltaEncoding>,
1107    {
1108        self.rice_hashes = std::option::Option::Some(v.into());
1109        self
1110    }
1111
1112    /// Sets or clears the value of [rice_hashes][crate::model::ThreatEntryAdditions::rice_hashes].
1113    ///
1114    /// # Example
1115    /// ```ignore,no_run
1116    /// # use google_cloud_webrisk_v1::model::ThreatEntryAdditions;
1117    /// use google_cloud_webrisk_v1::model::RiceDeltaEncoding;
1118    /// let x = ThreatEntryAdditions::new().set_or_clear_rice_hashes(Some(RiceDeltaEncoding::default()/* use setters */));
1119    /// let x = ThreatEntryAdditions::new().set_or_clear_rice_hashes(None::<RiceDeltaEncoding>);
1120    /// ```
1121    pub fn set_or_clear_rice_hashes<T>(mut self, v: std::option::Option<T>) -> Self
1122    where
1123        T: std::convert::Into<crate::model::RiceDeltaEncoding>,
1124    {
1125        self.rice_hashes = v.map(|x| x.into());
1126        self
1127    }
1128}
1129
1130impl wkt::message::Message for ThreatEntryAdditions {
1131    fn typename() -> &'static str {
1132        "type.googleapis.com/google.cloud.webrisk.v1.ThreatEntryAdditions"
1133    }
1134}
1135
1136/// Contains the set of entries to remove from a local database.
1137#[derive(Clone, Default, PartialEq)]
1138#[non_exhaustive]
1139pub struct ThreatEntryRemovals {
1140    /// The raw removal indices for a local list.
1141    pub raw_indices: std::option::Option<crate::model::RawIndices>,
1142
1143    /// The encoded local, lexicographically-sorted list indices, using a
1144    /// Golomb-Rice encoding. Used for sending compressed removal indices. The
1145    /// removal indices (uint32) are sorted in ascending order, then delta encoded
1146    /// and stored as encoded_data.
1147    pub rice_indices: std::option::Option<crate::model::RiceDeltaEncoding>,
1148
1149    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1150}
1151
1152impl ThreatEntryRemovals {
1153    pub fn new() -> Self {
1154        std::default::Default::default()
1155    }
1156
1157    /// Sets the value of [raw_indices][crate::model::ThreatEntryRemovals::raw_indices].
1158    ///
1159    /// # Example
1160    /// ```ignore,no_run
1161    /// # use google_cloud_webrisk_v1::model::ThreatEntryRemovals;
1162    /// use google_cloud_webrisk_v1::model::RawIndices;
1163    /// let x = ThreatEntryRemovals::new().set_raw_indices(RawIndices::default()/* use setters */);
1164    /// ```
1165    pub fn set_raw_indices<T>(mut self, v: T) -> Self
1166    where
1167        T: std::convert::Into<crate::model::RawIndices>,
1168    {
1169        self.raw_indices = std::option::Option::Some(v.into());
1170        self
1171    }
1172
1173    /// Sets or clears the value of [raw_indices][crate::model::ThreatEntryRemovals::raw_indices].
1174    ///
1175    /// # Example
1176    /// ```ignore,no_run
1177    /// # use google_cloud_webrisk_v1::model::ThreatEntryRemovals;
1178    /// use google_cloud_webrisk_v1::model::RawIndices;
1179    /// let x = ThreatEntryRemovals::new().set_or_clear_raw_indices(Some(RawIndices::default()/* use setters */));
1180    /// let x = ThreatEntryRemovals::new().set_or_clear_raw_indices(None::<RawIndices>);
1181    /// ```
1182    pub fn set_or_clear_raw_indices<T>(mut self, v: std::option::Option<T>) -> Self
1183    where
1184        T: std::convert::Into<crate::model::RawIndices>,
1185    {
1186        self.raw_indices = v.map(|x| x.into());
1187        self
1188    }
1189
1190    /// Sets the value of [rice_indices][crate::model::ThreatEntryRemovals::rice_indices].
1191    ///
1192    /// # Example
1193    /// ```ignore,no_run
1194    /// # use google_cloud_webrisk_v1::model::ThreatEntryRemovals;
1195    /// use google_cloud_webrisk_v1::model::RiceDeltaEncoding;
1196    /// let x = ThreatEntryRemovals::new().set_rice_indices(RiceDeltaEncoding::default()/* use setters */);
1197    /// ```
1198    pub fn set_rice_indices<T>(mut self, v: T) -> Self
1199    where
1200        T: std::convert::Into<crate::model::RiceDeltaEncoding>,
1201    {
1202        self.rice_indices = std::option::Option::Some(v.into());
1203        self
1204    }
1205
1206    /// Sets or clears the value of [rice_indices][crate::model::ThreatEntryRemovals::rice_indices].
1207    ///
1208    /// # Example
1209    /// ```ignore,no_run
1210    /// # use google_cloud_webrisk_v1::model::ThreatEntryRemovals;
1211    /// use google_cloud_webrisk_v1::model::RiceDeltaEncoding;
1212    /// let x = ThreatEntryRemovals::new().set_or_clear_rice_indices(Some(RiceDeltaEncoding::default()/* use setters */));
1213    /// let x = ThreatEntryRemovals::new().set_or_clear_rice_indices(None::<RiceDeltaEncoding>);
1214    /// ```
1215    pub fn set_or_clear_rice_indices<T>(mut self, v: std::option::Option<T>) -> Self
1216    where
1217        T: std::convert::Into<crate::model::RiceDeltaEncoding>,
1218    {
1219        self.rice_indices = v.map(|x| x.into());
1220        self
1221    }
1222}
1223
1224impl wkt::message::Message for ThreatEntryRemovals {
1225    fn typename() -> &'static str {
1226        "type.googleapis.com/google.cloud.webrisk.v1.ThreatEntryRemovals"
1227    }
1228}
1229
1230/// A set of raw indices to remove from a local list.
1231#[derive(Clone, Default, PartialEq)]
1232#[non_exhaustive]
1233pub struct RawIndices {
1234    /// The indices to remove from a lexicographically-sorted local list.
1235    pub indices: std::vec::Vec<i32>,
1236
1237    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1238}
1239
1240impl RawIndices {
1241    pub fn new() -> Self {
1242        std::default::Default::default()
1243    }
1244
1245    /// Sets the value of [indices][crate::model::RawIndices::indices].
1246    ///
1247    /// # Example
1248    /// ```ignore,no_run
1249    /// # use google_cloud_webrisk_v1::model::RawIndices;
1250    /// let x = RawIndices::new().set_indices([1, 2, 3]);
1251    /// ```
1252    pub fn set_indices<T, V>(mut self, v: T) -> Self
1253    where
1254        T: std::iter::IntoIterator<Item = V>,
1255        V: std::convert::Into<i32>,
1256    {
1257        use std::iter::Iterator;
1258        self.indices = v.into_iter().map(|i| i.into()).collect();
1259        self
1260    }
1261}
1262
1263impl wkt::message::Message for RawIndices {
1264    fn typename() -> &'static str {
1265        "type.googleapis.com/google.cloud.webrisk.v1.RawIndices"
1266    }
1267}
1268
1269/// The uncompressed threat entries in hash format.
1270/// Hashes can be anywhere from 4 to 32 bytes in size. A large majority are 4
1271/// bytes, but some hashes are lengthened if they collide with the hash of a
1272/// popular URI.
1273///
1274/// Used for sending ThreatEntryAdditons to clients that do not support
1275/// compression, or when sending non-4-byte hashes to clients that do support
1276/// compression.
1277#[derive(Clone, Default, PartialEq)]
1278#[non_exhaustive]
1279pub struct RawHashes {
1280    /// The number of bytes for each prefix encoded below.  This field can be
1281    /// anywhere from 4 (shortest prefix) to 32 (full SHA256 hash).
1282    /// In practice this is almost always 4, except in exceptional circumstances.
1283    pub prefix_size: i32,
1284
1285    /// The hashes, in binary format, concatenated into one long string. Hashes are
1286    /// sorted in lexicographic order. For JSON API users, hashes are
1287    /// base64-encoded.
1288    pub raw_hashes: ::bytes::Bytes,
1289
1290    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1291}
1292
1293impl RawHashes {
1294    pub fn new() -> Self {
1295        std::default::Default::default()
1296    }
1297
1298    /// Sets the value of [prefix_size][crate::model::RawHashes::prefix_size].
1299    ///
1300    /// # Example
1301    /// ```ignore,no_run
1302    /// # use google_cloud_webrisk_v1::model::RawHashes;
1303    /// let x = RawHashes::new().set_prefix_size(42);
1304    /// ```
1305    pub fn set_prefix_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1306        self.prefix_size = v.into();
1307        self
1308    }
1309
1310    /// Sets the value of [raw_hashes][crate::model::RawHashes::raw_hashes].
1311    ///
1312    /// # Example
1313    /// ```ignore,no_run
1314    /// # use google_cloud_webrisk_v1::model::RawHashes;
1315    /// let x = RawHashes::new().set_raw_hashes(bytes::Bytes::from_static(b"example"));
1316    /// ```
1317    pub fn set_raw_hashes<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1318        self.raw_hashes = v.into();
1319        self
1320    }
1321}
1322
1323impl wkt::message::Message for RawHashes {
1324    fn typename() -> &'static str {
1325        "type.googleapis.com/google.cloud.webrisk.v1.RawHashes"
1326    }
1327}
1328
1329/// The Rice-Golomb encoded data. Used for sending compressed 4-byte hashes or
1330/// compressed removal indices.
1331#[derive(Clone, Default, PartialEq)]
1332#[non_exhaustive]
1333pub struct RiceDeltaEncoding {
1334    /// The offset of the first entry in the encoded data, or, if only a single
1335    /// integer was encoded, that single integer's value. If the field is empty or
1336    /// missing, assume zero.
1337    pub first_value: i64,
1338
1339    /// The Golomb-Rice parameter, which is a number between 2 and 28. This field
1340    /// is missing (that is, zero) if `num_entries` is zero.
1341    pub rice_parameter: i32,
1342
1343    /// The number of entries that are delta encoded in the encoded data. If only a
1344    /// single integer was encoded, this will be zero and the single value will be
1345    /// stored in `first_value`.
1346    pub entry_count: i32,
1347
1348    /// The encoded deltas that are encoded using the Golomb-Rice coder.
1349    pub encoded_data: ::bytes::Bytes,
1350
1351    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1352}
1353
1354impl RiceDeltaEncoding {
1355    pub fn new() -> Self {
1356        std::default::Default::default()
1357    }
1358
1359    /// Sets the value of [first_value][crate::model::RiceDeltaEncoding::first_value].
1360    ///
1361    /// # Example
1362    /// ```ignore,no_run
1363    /// # use google_cloud_webrisk_v1::model::RiceDeltaEncoding;
1364    /// let x = RiceDeltaEncoding::new().set_first_value(42);
1365    /// ```
1366    pub fn set_first_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
1367        self.first_value = v.into();
1368        self
1369    }
1370
1371    /// Sets the value of [rice_parameter][crate::model::RiceDeltaEncoding::rice_parameter].
1372    ///
1373    /// # Example
1374    /// ```ignore,no_run
1375    /// # use google_cloud_webrisk_v1::model::RiceDeltaEncoding;
1376    /// let x = RiceDeltaEncoding::new().set_rice_parameter(42);
1377    /// ```
1378    pub fn set_rice_parameter<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1379        self.rice_parameter = v.into();
1380        self
1381    }
1382
1383    /// Sets the value of [entry_count][crate::model::RiceDeltaEncoding::entry_count].
1384    ///
1385    /// # Example
1386    /// ```ignore,no_run
1387    /// # use google_cloud_webrisk_v1::model::RiceDeltaEncoding;
1388    /// let x = RiceDeltaEncoding::new().set_entry_count(42);
1389    /// ```
1390    pub fn set_entry_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1391        self.entry_count = v.into();
1392        self
1393    }
1394
1395    /// Sets the value of [encoded_data][crate::model::RiceDeltaEncoding::encoded_data].
1396    ///
1397    /// # Example
1398    /// ```ignore,no_run
1399    /// # use google_cloud_webrisk_v1::model::RiceDeltaEncoding;
1400    /// let x = RiceDeltaEncoding::new().set_encoded_data(bytes::Bytes::from_static(b"example"));
1401    /// ```
1402    pub fn set_encoded_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1403        self.encoded_data = v.into();
1404        self
1405    }
1406}
1407
1408impl wkt::message::Message for RiceDeltaEncoding {
1409    fn typename() -> &'static str {
1410        "type.googleapis.com/google.cloud.webrisk.v1.RiceDeltaEncoding"
1411    }
1412}
1413
1414/// Wraps a URI that might be displaying malicious content.
1415#[derive(Clone, Default, PartialEq)]
1416#[non_exhaustive]
1417pub struct Submission {
1418    /// Required. The URI that is being reported for malicious content to be
1419    /// analyzed.
1420    pub uri: std::string::String,
1421
1422    /// Output only. ThreatTypes found to be associated with the submitted URI
1423    /// after reviewing it. This might be empty if the URI was not added to any
1424    /// list.
1425    pub threat_types: std::vec::Vec<crate::model::ThreatType>,
1426
1427    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1428}
1429
1430impl Submission {
1431    pub fn new() -> Self {
1432        std::default::Default::default()
1433    }
1434
1435    /// Sets the value of [uri][crate::model::Submission::uri].
1436    ///
1437    /// # Example
1438    /// ```ignore,no_run
1439    /// # use google_cloud_webrisk_v1::model::Submission;
1440    /// let x = Submission::new().set_uri("example");
1441    /// ```
1442    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1443        self.uri = v.into();
1444        self
1445    }
1446
1447    /// Sets the value of [threat_types][crate::model::Submission::threat_types].
1448    ///
1449    /// # Example
1450    /// ```ignore,no_run
1451    /// # use google_cloud_webrisk_v1::model::Submission;
1452    /// use google_cloud_webrisk_v1::model::ThreatType;
1453    /// let x = Submission::new().set_threat_types([
1454    ///     ThreatType::Malware,
1455    ///     ThreatType::SocialEngineering,
1456    ///     ThreatType::UnwantedSoftware,
1457    /// ]);
1458    /// ```
1459    pub fn set_threat_types<T, V>(mut self, v: T) -> Self
1460    where
1461        T: std::iter::IntoIterator<Item = V>,
1462        V: std::convert::Into<crate::model::ThreatType>,
1463    {
1464        use std::iter::Iterator;
1465        self.threat_types = v.into_iter().map(|i| i.into()).collect();
1466        self
1467    }
1468}
1469
1470impl wkt::message::Message for Submission {
1471    fn typename() -> &'static str {
1472        "type.googleapis.com/google.cloud.webrisk.v1.Submission"
1473    }
1474}
1475
1476/// Context about the submission including the type of abuse found on the URI and
1477/// supporting details.
1478#[derive(Clone, Default, PartialEq)]
1479#[non_exhaustive]
1480pub struct ThreatInfo {
1481    /// The type of abuse.
1482    pub abuse_type: crate::model::threat_info::AbuseType,
1483
1484    /// Confidence that the URI is unsafe.
1485    pub threat_confidence: std::option::Option<crate::model::threat_info::Confidence>,
1486
1487    /// Context about why the URI is unsafe.
1488    pub threat_justification: std::option::Option<crate::model::threat_info::ThreatJustification>,
1489
1490    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1491}
1492
1493impl ThreatInfo {
1494    pub fn new() -> Self {
1495        std::default::Default::default()
1496    }
1497
1498    /// Sets the value of [abuse_type][crate::model::ThreatInfo::abuse_type].
1499    ///
1500    /// # Example
1501    /// ```ignore,no_run
1502    /// # use google_cloud_webrisk_v1::model::ThreatInfo;
1503    /// use google_cloud_webrisk_v1::model::threat_info::AbuseType;
1504    /// let x0 = ThreatInfo::new().set_abuse_type(AbuseType::Malware);
1505    /// let x1 = ThreatInfo::new().set_abuse_type(AbuseType::SocialEngineering);
1506    /// let x2 = ThreatInfo::new().set_abuse_type(AbuseType::UnwantedSoftware);
1507    /// ```
1508    pub fn set_abuse_type<T: std::convert::Into<crate::model::threat_info::AbuseType>>(
1509        mut self,
1510        v: T,
1511    ) -> Self {
1512        self.abuse_type = v.into();
1513        self
1514    }
1515
1516    /// Sets the value of [threat_confidence][crate::model::ThreatInfo::threat_confidence].
1517    ///
1518    /// # Example
1519    /// ```ignore,no_run
1520    /// # use google_cloud_webrisk_v1::model::ThreatInfo;
1521    /// use google_cloud_webrisk_v1::model::threat_info::Confidence;
1522    /// let x = ThreatInfo::new().set_threat_confidence(Confidence::default()/* use setters */);
1523    /// ```
1524    pub fn set_threat_confidence<T>(mut self, v: T) -> Self
1525    where
1526        T: std::convert::Into<crate::model::threat_info::Confidence>,
1527    {
1528        self.threat_confidence = std::option::Option::Some(v.into());
1529        self
1530    }
1531
1532    /// Sets or clears the value of [threat_confidence][crate::model::ThreatInfo::threat_confidence].
1533    ///
1534    /// # Example
1535    /// ```ignore,no_run
1536    /// # use google_cloud_webrisk_v1::model::ThreatInfo;
1537    /// use google_cloud_webrisk_v1::model::threat_info::Confidence;
1538    /// let x = ThreatInfo::new().set_or_clear_threat_confidence(Some(Confidence::default()/* use setters */));
1539    /// let x = ThreatInfo::new().set_or_clear_threat_confidence(None::<Confidence>);
1540    /// ```
1541    pub fn set_or_clear_threat_confidence<T>(mut self, v: std::option::Option<T>) -> Self
1542    where
1543        T: std::convert::Into<crate::model::threat_info::Confidence>,
1544    {
1545        self.threat_confidence = v.map(|x| x.into());
1546        self
1547    }
1548
1549    /// Sets the value of [threat_justification][crate::model::ThreatInfo::threat_justification].
1550    ///
1551    /// # Example
1552    /// ```ignore,no_run
1553    /// # use google_cloud_webrisk_v1::model::ThreatInfo;
1554    /// use google_cloud_webrisk_v1::model::threat_info::ThreatJustification;
1555    /// let x = ThreatInfo::new().set_threat_justification(ThreatJustification::default()/* use setters */);
1556    /// ```
1557    pub fn set_threat_justification<T>(mut self, v: T) -> Self
1558    where
1559        T: std::convert::Into<crate::model::threat_info::ThreatJustification>,
1560    {
1561        self.threat_justification = std::option::Option::Some(v.into());
1562        self
1563    }
1564
1565    /// Sets or clears the value of [threat_justification][crate::model::ThreatInfo::threat_justification].
1566    ///
1567    /// # Example
1568    /// ```ignore,no_run
1569    /// # use google_cloud_webrisk_v1::model::ThreatInfo;
1570    /// use google_cloud_webrisk_v1::model::threat_info::ThreatJustification;
1571    /// let x = ThreatInfo::new().set_or_clear_threat_justification(Some(ThreatJustification::default()/* use setters */));
1572    /// let x = ThreatInfo::new().set_or_clear_threat_justification(None::<ThreatJustification>);
1573    /// ```
1574    pub fn set_or_clear_threat_justification<T>(mut self, v: std::option::Option<T>) -> Self
1575    where
1576        T: std::convert::Into<crate::model::threat_info::ThreatJustification>,
1577    {
1578        self.threat_justification = v.map(|x| x.into());
1579        self
1580    }
1581}
1582
1583impl wkt::message::Message for ThreatInfo {
1584    fn typename() -> &'static str {
1585        "type.googleapis.com/google.cloud.webrisk.v1.ThreatInfo"
1586    }
1587}
1588
1589/// Defines additional types related to [ThreatInfo].
1590pub mod threat_info {
1591    #[allow(unused_imports)]
1592    use super::*;
1593
1594    /// Confidence that a URI is unsafe.
1595    #[derive(Clone, Default, PartialEq)]
1596    #[non_exhaustive]
1597    pub struct Confidence {
1598        pub value: std::option::Option<crate::model::threat_info::confidence::Value>,
1599
1600        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1601    }
1602
1603    impl Confidence {
1604        pub fn new() -> Self {
1605            std::default::Default::default()
1606        }
1607
1608        /// Sets the value of [value][crate::model::threat_info::Confidence::value].
1609        ///
1610        /// Note that all the setters affecting `value` are mutually
1611        /// exclusive.
1612        ///
1613        /// # Example
1614        /// ```ignore,no_run
1615        /// # use google_cloud_webrisk_v1::model::threat_info::Confidence;
1616        /// use google_cloud_webrisk_v1::model::threat_info::confidence::Value;
1617        /// let x = Confidence::new().set_value(Some(Value::Score(42.0)));
1618        /// ```
1619        pub fn set_value<
1620            T: std::convert::Into<std::option::Option<crate::model::threat_info::confidence::Value>>,
1621        >(
1622            mut self,
1623            v: T,
1624        ) -> Self {
1625            self.value = v.into();
1626            self
1627        }
1628
1629        /// The value of [value][crate::model::threat_info::Confidence::value]
1630        /// if it holds a `Score`, `None` if the field is not set or
1631        /// holds a different branch.
1632        pub fn score(&self) -> std::option::Option<&f32> {
1633            #[allow(unreachable_patterns)]
1634            self.value.as_ref().and_then(|v| match v {
1635                crate::model::threat_info::confidence::Value::Score(v) => {
1636                    std::option::Option::Some(v)
1637                }
1638                _ => std::option::Option::None,
1639            })
1640        }
1641
1642        /// Sets the value of [value][crate::model::threat_info::Confidence::value]
1643        /// to hold a `Score`.
1644        ///
1645        /// Note that all the setters affecting `value` are
1646        /// mutually exclusive.
1647        ///
1648        /// # Example
1649        /// ```ignore,no_run
1650        /// # use google_cloud_webrisk_v1::model::threat_info::Confidence;
1651        /// let x = Confidence::new().set_score(42.0);
1652        /// assert!(x.score().is_some());
1653        /// assert!(x.level().is_none());
1654        /// ```
1655        pub fn set_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1656            self.value = std::option::Option::Some(
1657                crate::model::threat_info::confidence::Value::Score(v.into()),
1658            );
1659            self
1660        }
1661
1662        /// The value of [value][crate::model::threat_info::Confidence::value]
1663        /// if it holds a `Level`, `None` if the field is not set or
1664        /// holds a different branch.
1665        pub fn level(
1666            &self,
1667        ) -> std::option::Option<&crate::model::threat_info::confidence::ConfidenceLevel> {
1668            #[allow(unreachable_patterns)]
1669            self.value.as_ref().and_then(|v| match v {
1670                crate::model::threat_info::confidence::Value::Level(v) => {
1671                    std::option::Option::Some(v)
1672                }
1673                _ => std::option::Option::None,
1674            })
1675        }
1676
1677        /// Sets the value of [value][crate::model::threat_info::Confidence::value]
1678        /// to hold a `Level`.
1679        ///
1680        /// Note that all the setters affecting `value` are
1681        /// mutually exclusive.
1682        ///
1683        /// # Example
1684        /// ```ignore,no_run
1685        /// # use google_cloud_webrisk_v1::model::threat_info::Confidence;
1686        /// use google_cloud_webrisk_v1::model::threat_info::confidence::ConfidenceLevel;
1687        /// let x0 = Confidence::new().set_level(ConfidenceLevel::Low);
1688        /// let x1 = Confidence::new().set_level(ConfidenceLevel::Medium);
1689        /// let x2 = Confidence::new().set_level(ConfidenceLevel::High);
1690        /// assert!(x0.level().is_some());
1691        /// assert!(x0.score().is_none());
1692        /// assert!(x1.level().is_some());
1693        /// assert!(x1.score().is_none());
1694        /// assert!(x2.level().is_some());
1695        /// assert!(x2.score().is_none());
1696        /// ```
1697        pub fn set_level<
1698            T: std::convert::Into<crate::model::threat_info::confidence::ConfidenceLevel>,
1699        >(
1700            mut self,
1701            v: T,
1702        ) -> Self {
1703            self.value = std::option::Option::Some(
1704                crate::model::threat_info::confidence::Value::Level(v.into()),
1705            );
1706            self
1707        }
1708    }
1709
1710    impl wkt::message::Message for Confidence {
1711        fn typename() -> &'static str {
1712            "type.googleapis.com/google.cloud.webrisk.v1.ThreatInfo.Confidence"
1713        }
1714    }
1715
1716    /// Defines additional types related to [Confidence].
1717    pub mod confidence {
1718        #[allow(unused_imports)]
1719        use super::*;
1720
1721        /// Enum representation of confidence.
1722        ///
1723        /// # Working with unknown values
1724        ///
1725        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1726        /// additional enum variants at any time. Adding new variants is not considered
1727        /// a breaking change. Applications should write their code in anticipation of:
1728        ///
1729        /// - New values appearing in future releases of the client library, **and**
1730        /// - New values received dynamically, without application changes.
1731        ///
1732        /// Please consult the [Working with enums] section in the user guide for some
1733        /// guidelines.
1734        ///
1735        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1736        #[derive(Clone, Debug, PartialEq)]
1737        #[non_exhaustive]
1738        pub enum ConfidenceLevel {
1739            /// Default.
1740            Unspecified,
1741            /// Less than 60% confidence that the URI is unsafe.
1742            Low,
1743            /// Between 60% and 80% confidence that the URI is unsafe.
1744            Medium,
1745            /// Greater than 80% confidence that the URI is unsafe.
1746            High,
1747            /// If set, the enum was initialized with an unknown value.
1748            ///
1749            /// Applications can examine the value using [ConfidenceLevel::value] or
1750            /// [ConfidenceLevel::name].
1751            UnknownValue(confidence_level::UnknownValue),
1752        }
1753
1754        #[doc(hidden)]
1755        pub mod confidence_level {
1756            #[allow(unused_imports)]
1757            use super::*;
1758            #[derive(Clone, Debug, PartialEq)]
1759            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1760        }
1761
1762        impl ConfidenceLevel {
1763            /// Gets the enum value.
1764            ///
1765            /// Returns `None` if the enum contains an unknown value deserialized from
1766            /// the string representation of enums.
1767            pub fn value(&self) -> std::option::Option<i32> {
1768                match self {
1769                    Self::Unspecified => std::option::Option::Some(0),
1770                    Self::Low => std::option::Option::Some(1),
1771                    Self::Medium => std::option::Option::Some(2),
1772                    Self::High => std::option::Option::Some(3),
1773                    Self::UnknownValue(u) => u.0.value(),
1774                }
1775            }
1776
1777            /// Gets the enum value as a string.
1778            ///
1779            /// Returns `None` if the enum contains an unknown value deserialized from
1780            /// the integer representation of enums.
1781            pub fn name(&self) -> std::option::Option<&str> {
1782                match self {
1783                    Self::Unspecified => std::option::Option::Some("CONFIDENCE_LEVEL_UNSPECIFIED"),
1784                    Self::Low => std::option::Option::Some("LOW"),
1785                    Self::Medium => std::option::Option::Some("MEDIUM"),
1786                    Self::High => std::option::Option::Some("HIGH"),
1787                    Self::UnknownValue(u) => u.0.name(),
1788                }
1789            }
1790        }
1791
1792        impl std::default::Default for ConfidenceLevel {
1793            fn default() -> Self {
1794                use std::convert::From;
1795                Self::from(0)
1796            }
1797        }
1798
1799        impl std::fmt::Display for ConfidenceLevel {
1800            fn fmt(
1801                &self,
1802                f: &mut std::fmt::Formatter<'_>,
1803            ) -> std::result::Result<(), std::fmt::Error> {
1804                wkt::internal::display_enum(f, self.name(), self.value())
1805            }
1806        }
1807
1808        impl std::convert::From<i32> for ConfidenceLevel {
1809            fn from(value: i32) -> Self {
1810                match value {
1811                    0 => Self::Unspecified,
1812                    1 => Self::Low,
1813                    2 => Self::Medium,
1814                    3 => Self::High,
1815                    _ => Self::UnknownValue(confidence_level::UnknownValue(
1816                        wkt::internal::UnknownEnumValue::Integer(value),
1817                    )),
1818                }
1819            }
1820        }
1821
1822        impl std::convert::From<&str> for ConfidenceLevel {
1823            fn from(value: &str) -> Self {
1824                use std::string::ToString;
1825                match value {
1826                    "CONFIDENCE_LEVEL_UNSPECIFIED" => Self::Unspecified,
1827                    "LOW" => Self::Low,
1828                    "MEDIUM" => Self::Medium,
1829                    "HIGH" => Self::High,
1830                    _ => Self::UnknownValue(confidence_level::UnknownValue(
1831                        wkt::internal::UnknownEnumValue::String(value.to_string()),
1832                    )),
1833                }
1834            }
1835        }
1836
1837        impl serde::ser::Serialize for ConfidenceLevel {
1838            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1839            where
1840                S: serde::Serializer,
1841            {
1842                match self {
1843                    Self::Unspecified => serializer.serialize_i32(0),
1844                    Self::Low => serializer.serialize_i32(1),
1845                    Self::Medium => serializer.serialize_i32(2),
1846                    Self::High => serializer.serialize_i32(3),
1847                    Self::UnknownValue(u) => u.0.serialize(serializer),
1848                }
1849            }
1850        }
1851
1852        impl<'de> serde::de::Deserialize<'de> for ConfidenceLevel {
1853            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1854            where
1855                D: serde::Deserializer<'de>,
1856            {
1857                deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConfidenceLevel>::new(
1858                    ".google.cloud.webrisk.v1.ThreatInfo.Confidence.ConfidenceLevel",
1859                ))
1860            }
1861        }
1862
1863        #[derive(Clone, Debug, PartialEq)]
1864        #[non_exhaustive]
1865        pub enum Value {
1866            /// A decimal representation of confidence in the range of 0
1867            /// to 1 where 0 indicates no confidence and 1 indicates
1868            /// complete confidence.
1869            Score(f32),
1870            /// Enum representation of confidence.
1871            Level(crate::model::threat_info::confidence::ConfidenceLevel),
1872        }
1873    }
1874
1875    /// Context about why the URI is unsafe.
1876    #[derive(Clone, Default, PartialEq)]
1877    #[non_exhaustive]
1878    pub struct ThreatJustification {
1879        /// Labels associated with this URI that explain how it was classified.
1880        pub labels:
1881            std::vec::Vec<crate::model::threat_info::threat_justification::JustificationLabel>,
1882
1883        /// Free-form context on why this URI is unsafe.
1884        pub comments: std::vec::Vec<std::string::String>,
1885
1886        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1887    }
1888
1889    impl ThreatJustification {
1890        pub fn new() -> Self {
1891            std::default::Default::default()
1892        }
1893
1894        /// Sets the value of [labels][crate::model::threat_info::ThreatJustification::labels].
1895        ///
1896        /// # Example
1897        /// ```ignore,no_run
1898        /// # use google_cloud_webrisk_v1::model::threat_info::ThreatJustification;
1899        /// use google_cloud_webrisk_v1::model::threat_info::threat_justification::JustificationLabel;
1900        /// let x = ThreatJustification::new().set_labels([
1901        ///     JustificationLabel::ManualVerification,
1902        ///     JustificationLabel::UserReport,
1903        ///     JustificationLabel::AutomatedReport,
1904        /// ]);
1905        /// ```
1906        pub fn set_labels<T, V>(mut self, v: T) -> Self
1907        where
1908            T: std::iter::IntoIterator<Item = V>,
1909            V: std::convert::Into<
1910                    crate::model::threat_info::threat_justification::JustificationLabel,
1911                >,
1912        {
1913            use std::iter::Iterator;
1914            self.labels = v.into_iter().map(|i| i.into()).collect();
1915            self
1916        }
1917
1918        /// Sets the value of [comments][crate::model::threat_info::ThreatJustification::comments].
1919        ///
1920        /// # Example
1921        /// ```ignore,no_run
1922        /// # use google_cloud_webrisk_v1::model::threat_info::ThreatJustification;
1923        /// let x = ThreatJustification::new().set_comments(["a", "b", "c"]);
1924        /// ```
1925        pub fn set_comments<T, V>(mut self, v: T) -> Self
1926        where
1927            T: std::iter::IntoIterator<Item = V>,
1928            V: std::convert::Into<std::string::String>,
1929        {
1930            use std::iter::Iterator;
1931            self.comments = v.into_iter().map(|i| i.into()).collect();
1932            self
1933        }
1934    }
1935
1936    impl wkt::message::Message for ThreatJustification {
1937        fn typename() -> &'static str {
1938            "type.googleapis.com/google.cloud.webrisk.v1.ThreatInfo.ThreatJustification"
1939        }
1940    }
1941
1942    /// Defines additional types related to [ThreatJustification].
1943    pub mod threat_justification {
1944        #[allow(unused_imports)]
1945        use super::*;
1946
1947        /// Labels that explain how the URI was classified.
1948        ///
1949        /// # Working with unknown values
1950        ///
1951        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1952        /// additional enum variants at any time. Adding new variants is not considered
1953        /// a breaking change. Applications should write their code in anticipation of:
1954        ///
1955        /// - New values appearing in future releases of the client library, **and**
1956        /// - New values received dynamically, without application changes.
1957        ///
1958        /// Please consult the [Working with enums] section in the user guide for some
1959        /// guidelines.
1960        ///
1961        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1962        #[derive(Clone, Debug, PartialEq)]
1963        #[non_exhaustive]
1964        pub enum JustificationLabel {
1965            /// Default.
1966            Unspecified,
1967            /// The submitter manually verified that the submission is unsafe.
1968            ManualVerification,
1969            /// The submitter received the submission from an end user.
1970            UserReport,
1971            /// The submitter received the submission from an automated system.
1972            AutomatedReport,
1973            /// If set, the enum was initialized with an unknown value.
1974            ///
1975            /// Applications can examine the value using [JustificationLabel::value] or
1976            /// [JustificationLabel::name].
1977            UnknownValue(justification_label::UnknownValue),
1978        }
1979
1980        #[doc(hidden)]
1981        pub mod justification_label {
1982            #[allow(unused_imports)]
1983            use super::*;
1984            #[derive(Clone, Debug, PartialEq)]
1985            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1986        }
1987
1988        impl JustificationLabel {
1989            /// Gets the enum value.
1990            ///
1991            /// Returns `None` if the enum contains an unknown value deserialized from
1992            /// the string representation of enums.
1993            pub fn value(&self) -> std::option::Option<i32> {
1994                match self {
1995                    Self::Unspecified => std::option::Option::Some(0),
1996                    Self::ManualVerification => std::option::Option::Some(1),
1997                    Self::UserReport => std::option::Option::Some(2),
1998                    Self::AutomatedReport => std::option::Option::Some(3),
1999                    Self::UnknownValue(u) => u.0.value(),
2000                }
2001            }
2002
2003            /// Gets the enum value as a string.
2004            ///
2005            /// Returns `None` if the enum contains an unknown value deserialized from
2006            /// the integer representation of enums.
2007            pub fn name(&self) -> std::option::Option<&str> {
2008                match self {
2009                    Self::Unspecified => {
2010                        std::option::Option::Some("JUSTIFICATION_LABEL_UNSPECIFIED")
2011                    }
2012                    Self::ManualVerification => std::option::Option::Some("MANUAL_VERIFICATION"),
2013                    Self::UserReport => std::option::Option::Some("USER_REPORT"),
2014                    Self::AutomatedReport => std::option::Option::Some("AUTOMATED_REPORT"),
2015                    Self::UnknownValue(u) => u.0.name(),
2016                }
2017            }
2018        }
2019
2020        impl std::default::Default for JustificationLabel {
2021            fn default() -> Self {
2022                use std::convert::From;
2023                Self::from(0)
2024            }
2025        }
2026
2027        impl std::fmt::Display for JustificationLabel {
2028            fn fmt(
2029                &self,
2030                f: &mut std::fmt::Formatter<'_>,
2031            ) -> std::result::Result<(), std::fmt::Error> {
2032                wkt::internal::display_enum(f, self.name(), self.value())
2033            }
2034        }
2035
2036        impl std::convert::From<i32> for JustificationLabel {
2037            fn from(value: i32) -> Self {
2038                match value {
2039                    0 => Self::Unspecified,
2040                    1 => Self::ManualVerification,
2041                    2 => Self::UserReport,
2042                    3 => Self::AutomatedReport,
2043                    _ => Self::UnknownValue(justification_label::UnknownValue(
2044                        wkt::internal::UnknownEnumValue::Integer(value),
2045                    )),
2046                }
2047            }
2048        }
2049
2050        impl std::convert::From<&str> for JustificationLabel {
2051            fn from(value: &str) -> Self {
2052                use std::string::ToString;
2053                match value {
2054                    "JUSTIFICATION_LABEL_UNSPECIFIED" => Self::Unspecified,
2055                    "MANUAL_VERIFICATION" => Self::ManualVerification,
2056                    "USER_REPORT" => Self::UserReport,
2057                    "AUTOMATED_REPORT" => Self::AutomatedReport,
2058                    _ => Self::UnknownValue(justification_label::UnknownValue(
2059                        wkt::internal::UnknownEnumValue::String(value.to_string()),
2060                    )),
2061                }
2062            }
2063        }
2064
2065        impl serde::ser::Serialize for JustificationLabel {
2066            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2067            where
2068                S: serde::Serializer,
2069            {
2070                match self {
2071                    Self::Unspecified => serializer.serialize_i32(0),
2072                    Self::ManualVerification => serializer.serialize_i32(1),
2073                    Self::UserReport => serializer.serialize_i32(2),
2074                    Self::AutomatedReport => serializer.serialize_i32(3),
2075                    Self::UnknownValue(u) => u.0.serialize(serializer),
2076                }
2077            }
2078        }
2079
2080        impl<'de> serde::de::Deserialize<'de> for JustificationLabel {
2081            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2082            where
2083                D: serde::Deserializer<'de>,
2084            {
2085                deserializer.deserialize_any(wkt::internal::EnumVisitor::<JustificationLabel>::new(
2086                    ".google.cloud.webrisk.v1.ThreatInfo.ThreatJustification.JustificationLabel",
2087                ))
2088            }
2089        }
2090    }
2091
2092    /// The abuse type found on the URI.
2093    ///
2094    /// # Working with unknown values
2095    ///
2096    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2097    /// additional enum variants at any time. Adding new variants is not considered
2098    /// a breaking change. Applications should write their code in anticipation of:
2099    ///
2100    /// - New values appearing in future releases of the client library, **and**
2101    /// - New values received dynamically, without application changes.
2102    ///
2103    /// Please consult the [Working with enums] section in the user guide for some
2104    /// guidelines.
2105    ///
2106    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2107    #[derive(Clone, Debug, PartialEq)]
2108    #[non_exhaustive]
2109    pub enum AbuseType {
2110        /// Default.
2111        Unspecified,
2112        /// The URI contains malware.
2113        Malware,
2114        /// The URI contains social engineering.
2115        SocialEngineering,
2116        /// The URI contains unwanted software.
2117        UnwantedSoftware,
2118        /// If set, the enum was initialized with an unknown value.
2119        ///
2120        /// Applications can examine the value using [AbuseType::value] or
2121        /// [AbuseType::name].
2122        UnknownValue(abuse_type::UnknownValue),
2123    }
2124
2125    #[doc(hidden)]
2126    pub mod abuse_type {
2127        #[allow(unused_imports)]
2128        use super::*;
2129        #[derive(Clone, Debug, PartialEq)]
2130        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2131    }
2132
2133    impl AbuseType {
2134        /// Gets the enum value.
2135        ///
2136        /// Returns `None` if the enum contains an unknown value deserialized from
2137        /// the string representation of enums.
2138        pub fn value(&self) -> std::option::Option<i32> {
2139            match self {
2140                Self::Unspecified => std::option::Option::Some(0),
2141                Self::Malware => std::option::Option::Some(1),
2142                Self::SocialEngineering => std::option::Option::Some(2),
2143                Self::UnwantedSoftware => std::option::Option::Some(3),
2144                Self::UnknownValue(u) => u.0.value(),
2145            }
2146        }
2147
2148        /// Gets the enum value as a string.
2149        ///
2150        /// Returns `None` if the enum contains an unknown value deserialized from
2151        /// the integer representation of enums.
2152        pub fn name(&self) -> std::option::Option<&str> {
2153            match self {
2154                Self::Unspecified => std::option::Option::Some("ABUSE_TYPE_UNSPECIFIED"),
2155                Self::Malware => std::option::Option::Some("MALWARE"),
2156                Self::SocialEngineering => std::option::Option::Some("SOCIAL_ENGINEERING"),
2157                Self::UnwantedSoftware => std::option::Option::Some("UNWANTED_SOFTWARE"),
2158                Self::UnknownValue(u) => u.0.name(),
2159            }
2160        }
2161    }
2162
2163    impl std::default::Default for AbuseType {
2164        fn default() -> Self {
2165            use std::convert::From;
2166            Self::from(0)
2167        }
2168    }
2169
2170    impl std::fmt::Display for AbuseType {
2171        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2172            wkt::internal::display_enum(f, self.name(), self.value())
2173        }
2174    }
2175
2176    impl std::convert::From<i32> for AbuseType {
2177        fn from(value: i32) -> Self {
2178            match value {
2179                0 => Self::Unspecified,
2180                1 => Self::Malware,
2181                2 => Self::SocialEngineering,
2182                3 => Self::UnwantedSoftware,
2183                _ => Self::UnknownValue(abuse_type::UnknownValue(
2184                    wkt::internal::UnknownEnumValue::Integer(value),
2185                )),
2186            }
2187        }
2188    }
2189
2190    impl std::convert::From<&str> for AbuseType {
2191        fn from(value: &str) -> Self {
2192            use std::string::ToString;
2193            match value {
2194                "ABUSE_TYPE_UNSPECIFIED" => Self::Unspecified,
2195                "MALWARE" => Self::Malware,
2196                "SOCIAL_ENGINEERING" => Self::SocialEngineering,
2197                "UNWANTED_SOFTWARE" => Self::UnwantedSoftware,
2198                _ => Self::UnknownValue(abuse_type::UnknownValue(
2199                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2200                )),
2201            }
2202        }
2203    }
2204
2205    impl serde::ser::Serialize for AbuseType {
2206        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2207        where
2208            S: serde::Serializer,
2209        {
2210            match self {
2211                Self::Unspecified => serializer.serialize_i32(0),
2212                Self::Malware => serializer.serialize_i32(1),
2213                Self::SocialEngineering => serializer.serialize_i32(2),
2214                Self::UnwantedSoftware => serializer.serialize_i32(3),
2215                Self::UnknownValue(u) => u.0.serialize(serializer),
2216            }
2217        }
2218    }
2219
2220    impl<'de> serde::de::Deserialize<'de> for AbuseType {
2221        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2222        where
2223            D: serde::Deserializer<'de>,
2224        {
2225            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AbuseType>::new(
2226                ".google.cloud.webrisk.v1.ThreatInfo.AbuseType",
2227            ))
2228        }
2229    }
2230}
2231
2232/// Details about how the threat was discovered.
2233#[derive(Clone, Default, PartialEq)]
2234#[non_exhaustive]
2235pub struct ThreatDiscovery {
2236    /// Platform on which the threat was discovered.
2237    pub platform: crate::model::threat_discovery::Platform,
2238
2239    /// CLDR region code of the countries/regions the URI poses a threat ordered
2240    /// from most impact to least impact. Example: "US" for United States.
2241    pub region_codes: std::vec::Vec<std::string::String>,
2242
2243    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2244}
2245
2246impl ThreatDiscovery {
2247    pub fn new() -> Self {
2248        std::default::Default::default()
2249    }
2250
2251    /// Sets the value of [platform][crate::model::ThreatDiscovery::platform].
2252    ///
2253    /// # Example
2254    /// ```ignore,no_run
2255    /// # use google_cloud_webrisk_v1::model::ThreatDiscovery;
2256    /// use google_cloud_webrisk_v1::model::threat_discovery::Platform;
2257    /// let x0 = ThreatDiscovery::new().set_platform(Platform::Android);
2258    /// let x1 = ThreatDiscovery::new().set_platform(Platform::Ios);
2259    /// let x2 = ThreatDiscovery::new().set_platform(Platform::Macos);
2260    /// ```
2261    pub fn set_platform<T: std::convert::Into<crate::model::threat_discovery::Platform>>(
2262        mut self,
2263        v: T,
2264    ) -> Self {
2265        self.platform = v.into();
2266        self
2267    }
2268
2269    /// Sets the value of [region_codes][crate::model::ThreatDiscovery::region_codes].
2270    ///
2271    /// # Example
2272    /// ```ignore,no_run
2273    /// # use google_cloud_webrisk_v1::model::ThreatDiscovery;
2274    /// let x = ThreatDiscovery::new().set_region_codes(["a", "b", "c"]);
2275    /// ```
2276    pub fn set_region_codes<T, V>(mut self, v: T) -> Self
2277    where
2278        T: std::iter::IntoIterator<Item = V>,
2279        V: std::convert::Into<std::string::String>,
2280    {
2281        use std::iter::Iterator;
2282        self.region_codes = v.into_iter().map(|i| i.into()).collect();
2283        self
2284    }
2285}
2286
2287impl wkt::message::Message for ThreatDiscovery {
2288    fn typename() -> &'static str {
2289        "type.googleapis.com/google.cloud.webrisk.v1.ThreatDiscovery"
2290    }
2291}
2292
2293/// Defines additional types related to [ThreatDiscovery].
2294pub mod threat_discovery {
2295    #[allow(unused_imports)]
2296    use super::*;
2297
2298    /// Platform types.
2299    ///
2300    /// # Working with unknown values
2301    ///
2302    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2303    /// additional enum variants at any time. Adding new variants is not considered
2304    /// a breaking change. Applications should write their code in anticipation of:
2305    ///
2306    /// - New values appearing in future releases of the client library, **and**
2307    /// - New values received dynamically, without application changes.
2308    ///
2309    /// Please consult the [Working with enums] section in the user guide for some
2310    /// guidelines.
2311    ///
2312    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2313    #[derive(Clone, Debug, PartialEq)]
2314    #[non_exhaustive]
2315    pub enum Platform {
2316        /// Default.
2317        Unspecified,
2318        /// General Android platform.
2319        Android,
2320        /// General iOS platform.
2321        Ios,
2322        /// General macOS platform.
2323        Macos,
2324        /// General Windows platform.
2325        Windows,
2326        /// If set, the enum was initialized with an unknown value.
2327        ///
2328        /// Applications can examine the value using [Platform::value] or
2329        /// [Platform::name].
2330        UnknownValue(platform::UnknownValue),
2331    }
2332
2333    #[doc(hidden)]
2334    pub mod platform {
2335        #[allow(unused_imports)]
2336        use super::*;
2337        #[derive(Clone, Debug, PartialEq)]
2338        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2339    }
2340
2341    impl Platform {
2342        /// Gets the enum value.
2343        ///
2344        /// Returns `None` if the enum contains an unknown value deserialized from
2345        /// the string representation of enums.
2346        pub fn value(&self) -> std::option::Option<i32> {
2347            match self {
2348                Self::Unspecified => std::option::Option::Some(0),
2349                Self::Android => std::option::Option::Some(1),
2350                Self::Ios => std::option::Option::Some(2),
2351                Self::Macos => std::option::Option::Some(3),
2352                Self::Windows => std::option::Option::Some(4),
2353                Self::UnknownValue(u) => u.0.value(),
2354            }
2355        }
2356
2357        /// Gets the enum value as a string.
2358        ///
2359        /// Returns `None` if the enum contains an unknown value deserialized from
2360        /// the integer representation of enums.
2361        pub fn name(&self) -> std::option::Option<&str> {
2362            match self {
2363                Self::Unspecified => std::option::Option::Some("PLATFORM_UNSPECIFIED"),
2364                Self::Android => std::option::Option::Some("ANDROID"),
2365                Self::Ios => std::option::Option::Some("IOS"),
2366                Self::Macos => std::option::Option::Some("MACOS"),
2367                Self::Windows => std::option::Option::Some("WINDOWS"),
2368                Self::UnknownValue(u) => u.0.name(),
2369            }
2370        }
2371    }
2372
2373    impl std::default::Default for Platform {
2374        fn default() -> Self {
2375            use std::convert::From;
2376            Self::from(0)
2377        }
2378    }
2379
2380    impl std::fmt::Display for Platform {
2381        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2382            wkt::internal::display_enum(f, self.name(), self.value())
2383        }
2384    }
2385
2386    impl std::convert::From<i32> for Platform {
2387        fn from(value: i32) -> Self {
2388            match value {
2389                0 => Self::Unspecified,
2390                1 => Self::Android,
2391                2 => Self::Ios,
2392                3 => Self::Macos,
2393                4 => Self::Windows,
2394                _ => Self::UnknownValue(platform::UnknownValue(
2395                    wkt::internal::UnknownEnumValue::Integer(value),
2396                )),
2397            }
2398        }
2399    }
2400
2401    impl std::convert::From<&str> for Platform {
2402        fn from(value: &str) -> Self {
2403            use std::string::ToString;
2404            match value {
2405                "PLATFORM_UNSPECIFIED" => Self::Unspecified,
2406                "ANDROID" => Self::Android,
2407                "IOS" => Self::Ios,
2408                "MACOS" => Self::Macos,
2409                "WINDOWS" => Self::Windows,
2410                _ => Self::UnknownValue(platform::UnknownValue(
2411                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2412                )),
2413            }
2414        }
2415    }
2416
2417    impl serde::ser::Serialize for Platform {
2418        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2419        where
2420            S: serde::Serializer,
2421        {
2422            match self {
2423                Self::Unspecified => serializer.serialize_i32(0),
2424                Self::Android => serializer.serialize_i32(1),
2425                Self::Ios => serializer.serialize_i32(2),
2426                Self::Macos => serializer.serialize_i32(3),
2427                Self::Windows => serializer.serialize_i32(4),
2428                Self::UnknownValue(u) => u.0.serialize(serializer),
2429            }
2430        }
2431    }
2432
2433    impl<'de> serde::de::Deserialize<'de> for Platform {
2434        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2435        where
2436            D: serde::Deserializer<'de>,
2437        {
2438            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Platform>::new(
2439                ".google.cloud.webrisk.v1.ThreatDiscovery.Platform",
2440            ))
2441        }
2442    }
2443}
2444
2445/// Request to send a potentially phishy URI to WebRisk.
2446#[derive(Clone, Default, PartialEq)]
2447#[non_exhaustive]
2448pub struct CreateSubmissionRequest {
2449    /// Required. The name of the project that is making the submission. This
2450    /// string is in the format "projects/{project_number}".
2451    pub parent: std::string::String,
2452
2453    /// Required. The submission that contains the content of the phishing report.
2454    pub submission: std::option::Option<crate::model::Submission>,
2455
2456    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2457}
2458
2459impl CreateSubmissionRequest {
2460    pub fn new() -> Self {
2461        std::default::Default::default()
2462    }
2463
2464    /// Sets the value of [parent][crate::model::CreateSubmissionRequest::parent].
2465    ///
2466    /// # Example
2467    /// ```ignore,no_run
2468    /// # use google_cloud_webrisk_v1::model::CreateSubmissionRequest;
2469    /// let x = CreateSubmissionRequest::new().set_parent("example");
2470    /// ```
2471    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2472        self.parent = v.into();
2473        self
2474    }
2475
2476    /// Sets the value of [submission][crate::model::CreateSubmissionRequest::submission].
2477    ///
2478    /// # Example
2479    /// ```ignore,no_run
2480    /// # use google_cloud_webrisk_v1::model::CreateSubmissionRequest;
2481    /// use google_cloud_webrisk_v1::model::Submission;
2482    /// let x = CreateSubmissionRequest::new().set_submission(Submission::default()/* use setters */);
2483    /// ```
2484    pub fn set_submission<T>(mut self, v: T) -> Self
2485    where
2486        T: std::convert::Into<crate::model::Submission>,
2487    {
2488        self.submission = std::option::Option::Some(v.into());
2489        self
2490    }
2491
2492    /// Sets or clears the value of [submission][crate::model::CreateSubmissionRequest::submission].
2493    ///
2494    /// # Example
2495    /// ```ignore,no_run
2496    /// # use google_cloud_webrisk_v1::model::CreateSubmissionRequest;
2497    /// use google_cloud_webrisk_v1::model::Submission;
2498    /// let x = CreateSubmissionRequest::new().set_or_clear_submission(Some(Submission::default()/* use setters */));
2499    /// let x = CreateSubmissionRequest::new().set_or_clear_submission(None::<Submission>);
2500    /// ```
2501    pub fn set_or_clear_submission<T>(mut self, v: std::option::Option<T>) -> Self
2502    where
2503        T: std::convert::Into<crate::model::Submission>,
2504    {
2505        self.submission = v.map(|x| x.into());
2506        self
2507    }
2508}
2509
2510impl wkt::message::Message for CreateSubmissionRequest {
2511    fn typename() -> &'static str {
2512        "type.googleapis.com/google.cloud.webrisk.v1.CreateSubmissionRequest"
2513    }
2514}
2515
2516/// Request to send a potentially malicious URI to WebRisk.
2517#[derive(Clone, Default, PartialEq)]
2518#[non_exhaustive]
2519pub struct SubmitUriRequest {
2520    /// Required. The name of the project that is making the submission. This
2521    /// string is in the format "projects/{project_number}".
2522    pub parent: std::string::String,
2523
2524    /// Required. The submission that contains the URI to be scanned.
2525    pub submission: std::option::Option<crate::model::Submission>,
2526
2527    /// Provides additional information about the submission.
2528    pub threat_info: std::option::Option<crate::model::ThreatInfo>,
2529
2530    /// Provides additional information about how the submission was discovered.
2531    pub threat_discovery: std::option::Option<crate::model::ThreatDiscovery>,
2532
2533    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2534}
2535
2536impl SubmitUriRequest {
2537    pub fn new() -> Self {
2538        std::default::Default::default()
2539    }
2540
2541    /// Sets the value of [parent][crate::model::SubmitUriRequest::parent].
2542    ///
2543    /// # Example
2544    /// ```ignore,no_run
2545    /// # use google_cloud_webrisk_v1::model::SubmitUriRequest;
2546    /// let x = SubmitUriRequest::new().set_parent("example");
2547    /// ```
2548    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2549        self.parent = v.into();
2550        self
2551    }
2552
2553    /// Sets the value of [submission][crate::model::SubmitUriRequest::submission].
2554    ///
2555    /// # Example
2556    /// ```ignore,no_run
2557    /// # use google_cloud_webrisk_v1::model::SubmitUriRequest;
2558    /// use google_cloud_webrisk_v1::model::Submission;
2559    /// let x = SubmitUriRequest::new().set_submission(Submission::default()/* use setters */);
2560    /// ```
2561    pub fn set_submission<T>(mut self, v: T) -> Self
2562    where
2563        T: std::convert::Into<crate::model::Submission>,
2564    {
2565        self.submission = std::option::Option::Some(v.into());
2566        self
2567    }
2568
2569    /// Sets or clears the value of [submission][crate::model::SubmitUriRequest::submission].
2570    ///
2571    /// # Example
2572    /// ```ignore,no_run
2573    /// # use google_cloud_webrisk_v1::model::SubmitUriRequest;
2574    /// use google_cloud_webrisk_v1::model::Submission;
2575    /// let x = SubmitUriRequest::new().set_or_clear_submission(Some(Submission::default()/* use setters */));
2576    /// let x = SubmitUriRequest::new().set_or_clear_submission(None::<Submission>);
2577    /// ```
2578    pub fn set_or_clear_submission<T>(mut self, v: std::option::Option<T>) -> Self
2579    where
2580        T: std::convert::Into<crate::model::Submission>,
2581    {
2582        self.submission = v.map(|x| x.into());
2583        self
2584    }
2585
2586    /// Sets the value of [threat_info][crate::model::SubmitUriRequest::threat_info].
2587    ///
2588    /// # Example
2589    /// ```ignore,no_run
2590    /// # use google_cloud_webrisk_v1::model::SubmitUriRequest;
2591    /// use google_cloud_webrisk_v1::model::ThreatInfo;
2592    /// let x = SubmitUriRequest::new().set_threat_info(ThreatInfo::default()/* use setters */);
2593    /// ```
2594    pub fn set_threat_info<T>(mut self, v: T) -> Self
2595    where
2596        T: std::convert::Into<crate::model::ThreatInfo>,
2597    {
2598        self.threat_info = std::option::Option::Some(v.into());
2599        self
2600    }
2601
2602    /// Sets or clears the value of [threat_info][crate::model::SubmitUriRequest::threat_info].
2603    ///
2604    /// # Example
2605    /// ```ignore,no_run
2606    /// # use google_cloud_webrisk_v1::model::SubmitUriRequest;
2607    /// use google_cloud_webrisk_v1::model::ThreatInfo;
2608    /// let x = SubmitUriRequest::new().set_or_clear_threat_info(Some(ThreatInfo::default()/* use setters */));
2609    /// let x = SubmitUriRequest::new().set_or_clear_threat_info(None::<ThreatInfo>);
2610    /// ```
2611    pub fn set_or_clear_threat_info<T>(mut self, v: std::option::Option<T>) -> Self
2612    where
2613        T: std::convert::Into<crate::model::ThreatInfo>,
2614    {
2615        self.threat_info = v.map(|x| x.into());
2616        self
2617    }
2618
2619    /// Sets the value of [threat_discovery][crate::model::SubmitUriRequest::threat_discovery].
2620    ///
2621    /// # Example
2622    /// ```ignore,no_run
2623    /// # use google_cloud_webrisk_v1::model::SubmitUriRequest;
2624    /// use google_cloud_webrisk_v1::model::ThreatDiscovery;
2625    /// let x = SubmitUriRequest::new().set_threat_discovery(ThreatDiscovery::default()/* use setters */);
2626    /// ```
2627    pub fn set_threat_discovery<T>(mut self, v: T) -> Self
2628    where
2629        T: std::convert::Into<crate::model::ThreatDiscovery>,
2630    {
2631        self.threat_discovery = std::option::Option::Some(v.into());
2632        self
2633    }
2634
2635    /// Sets or clears the value of [threat_discovery][crate::model::SubmitUriRequest::threat_discovery].
2636    ///
2637    /// # Example
2638    /// ```ignore,no_run
2639    /// # use google_cloud_webrisk_v1::model::SubmitUriRequest;
2640    /// use google_cloud_webrisk_v1::model::ThreatDiscovery;
2641    /// let x = SubmitUriRequest::new().set_or_clear_threat_discovery(Some(ThreatDiscovery::default()/* use setters */));
2642    /// let x = SubmitUriRequest::new().set_or_clear_threat_discovery(None::<ThreatDiscovery>);
2643    /// ```
2644    pub fn set_or_clear_threat_discovery<T>(mut self, v: std::option::Option<T>) -> Self
2645    where
2646        T: std::convert::Into<crate::model::ThreatDiscovery>,
2647    {
2648        self.threat_discovery = v.map(|x| x.into());
2649        self
2650    }
2651}
2652
2653impl wkt::message::Message for SubmitUriRequest {
2654    fn typename() -> &'static str {
2655        "type.googleapis.com/google.cloud.webrisk.v1.SubmitUriRequest"
2656    }
2657}
2658
2659/// Metadata for the Submit URI long-running operation.
2660#[derive(Clone, Default, PartialEq)]
2661#[non_exhaustive]
2662pub struct SubmitUriMetadata {
2663    /// The state of the operation.
2664    pub state: crate::model::submit_uri_metadata::State,
2665
2666    /// Creation time of the operation.
2667    pub create_time: std::option::Option<wkt::Timestamp>,
2668
2669    /// Latest update time of the operation.
2670    pub update_time: std::option::Option<wkt::Timestamp>,
2671
2672    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2673}
2674
2675impl SubmitUriMetadata {
2676    pub fn new() -> Self {
2677        std::default::Default::default()
2678    }
2679
2680    /// Sets the value of [state][crate::model::SubmitUriMetadata::state].
2681    ///
2682    /// # Example
2683    /// ```ignore,no_run
2684    /// # use google_cloud_webrisk_v1::model::SubmitUriMetadata;
2685    /// use google_cloud_webrisk_v1::model::submit_uri_metadata::State;
2686    /// let x0 = SubmitUriMetadata::new().set_state(State::Running);
2687    /// let x1 = SubmitUriMetadata::new().set_state(State::Succeeded);
2688    /// let x2 = SubmitUriMetadata::new().set_state(State::Cancelled);
2689    /// ```
2690    pub fn set_state<T: std::convert::Into<crate::model::submit_uri_metadata::State>>(
2691        mut self,
2692        v: T,
2693    ) -> Self {
2694        self.state = v.into();
2695        self
2696    }
2697
2698    /// Sets the value of [create_time][crate::model::SubmitUriMetadata::create_time].
2699    ///
2700    /// # Example
2701    /// ```ignore,no_run
2702    /// # use google_cloud_webrisk_v1::model::SubmitUriMetadata;
2703    /// use wkt::Timestamp;
2704    /// let x = SubmitUriMetadata::new().set_create_time(Timestamp::default()/* use setters */);
2705    /// ```
2706    pub fn set_create_time<T>(mut self, v: T) -> Self
2707    where
2708        T: std::convert::Into<wkt::Timestamp>,
2709    {
2710        self.create_time = std::option::Option::Some(v.into());
2711        self
2712    }
2713
2714    /// Sets or clears the value of [create_time][crate::model::SubmitUriMetadata::create_time].
2715    ///
2716    /// # Example
2717    /// ```ignore,no_run
2718    /// # use google_cloud_webrisk_v1::model::SubmitUriMetadata;
2719    /// use wkt::Timestamp;
2720    /// let x = SubmitUriMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2721    /// let x = SubmitUriMetadata::new().set_or_clear_create_time(None::<Timestamp>);
2722    /// ```
2723    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2724    where
2725        T: std::convert::Into<wkt::Timestamp>,
2726    {
2727        self.create_time = v.map(|x| x.into());
2728        self
2729    }
2730
2731    /// Sets the value of [update_time][crate::model::SubmitUriMetadata::update_time].
2732    ///
2733    /// # Example
2734    /// ```ignore,no_run
2735    /// # use google_cloud_webrisk_v1::model::SubmitUriMetadata;
2736    /// use wkt::Timestamp;
2737    /// let x = SubmitUriMetadata::new().set_update_time(Timestamp::default()/* use setters */);
2738    /// ```
2739    pub fn set_update_time<T>(mut self, v: T) -> Self
2740    where
2741        T: std::convert::Into<wkt::Timestamp>,
2742    {
2743        self.update_time = std::option::Option::Some(v.into());
2744        self
2745    }
2746
2747    /// Sets or clears the value of [update_time][crate::model::SubmitUriMetadata::update_time].
2748    ///
2749    /// # Example
2750    /// ```ignore,no_run
2751    /// # use google_cloud_webrisk_v1::model::SubmitUriMetadata;
2752    /// use wkt::Timestamp;
2753    /// let x = SubmitUriMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2754    /// let x = SubmitUriMetadata::new().set_or_clear_update_time(None::<Timestamp>);
2755    /// ```
2756    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2757    where
2758        T: std::convert::Into<wkt::Timestamp>,
2759    {
2760        self.update_time = v.map(|x| x.into());
2761        self
2762    }
2763}
2764
2765impl wkt::message::Message for SubmitUriMetadata {
2766    fn typename() -> &'static str {
2767        "type.googleapis.com/google.cloud.webrisk.v1.SubmitUriMetadata"
2768    }
2769}
2770
2771/// Defines additional types related to [SubmitUriMetadata].
2772pub mod submit_uri_metadata {
2773    #[allow(unused_imports)]
2774    use super::*;
2775
2776    /// Enum that represents the state of the long-running operation.
2777    ///
2778    /// # Working with unknown values
2779    ///
2780    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2781    /// additional enum variants at any time. Adding new variants is not considered
2782    /// a breaking change. Applications should write their code in anticipation of:
2783    ///
2784    /// - New values appearing in future releases of the client library, **and**
2785    /// - New values received dynamically, without application changes.
2786    ///
2787    /// Please consult the [Working with enums] section in the user guide for some
2788    /// guidelines.
2789    ///
2790    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2791    #[derive(Clone, Debug, PartialEq)]
2792    #[non_exhaustive]
2793    pub enum State {
2794        /// Default unspecified state.
2795        Unspecified,
2796        /// The operation is currently running.
2797        Running,
2798        /// The operation finished with a success status.
2799        Succeeded,
2800        /// The operation was cancelled.
2801        Cancelled,
2802        /// The operation finished with a failure status.
2803        Failed,
2804        /// The operation was closed with no action taken.
2805        Closed,
2806        /// If set, the enum was initialized with an unknown value.
2807        ///
2808        /// Applications can examine the value using [State::value] or
2809        /// [State::name].
2810        UnknownValue(state::UnknownValue),
2811    }
2812
2813    #[doc(hidden)]
2814    pub mod state {
2815        #[allow(unused_imports)]
2816        use super::*;
2817        #[derive(Clone, Debug, PartialEq)]
2818        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2819    }
2820
2821    impl State {
2822        /// Gets the enum value.
2823        ///
2824        /// Returns `None` if the enum contains an unknown value deserialized from
2825        /// the string representation of enums.
2826        pub fn value(&self) -> std::option::Option<i32> {
2827            match self {
2828                Self::Unspecified => std::option::Option::Some(0),
2829                Self::Running => std::option::Option::Some(1),
2830                Self::Succeeded => std::option::Option::Some(2),
2831                Self::Cancelled => std::option::Option::Some(3),
2832                Self::Failed => std::option::Option::Some(4),
2833                Self::Closed => std::option::Option::Some(5),
2834                Self::UnknownValue(u) => u.0.value(),
2835            }
2836        }
2837
2838        /// Gets the enum value as a string.
2839        ///
2840        /// Returns `None` if the enum contains an unknown value deserialized from
2841        /// the integer representation of enums.
2842        pub fn name(&self) -> std::option::Option<&str> {
2843            match self {
2844                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2845                Self::Running => std::option::Option::Some("RUNNING"),
2846                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
2847                Self::Cancelled => std::option::Option::Some("CANCELLED"),
2848                Self::Failed => std::option::Option::Some("FAILED"),
2849                Self::Closed => std::option::Option::Some("CLOSED"),
2850                Self::UnknownValue(u) => u.0.name(),
2851            }
2852        }
2853    }
2854
2855    impl std::default::Default for State {
2856        fn default() -> Self {
2857            use std::convert::From;
2858            Self::from(0)
2859        }
2860    }
2861
2862    impl std::fmt::Display for State {
2863        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2864            wkt::internal::display_enum(f, self.name(), self.value())
2865        }
2866    }
2867
2868    impl std::convert::From<i32> for State {
2869        fn from(value: i32) -> Self {
2870            match value {
2871                0 => Self::Unspecified,
2872                1 => Self::Running,
2873                2 => Self::Succeeded,
2874                3 => Self::Cancelled,
2875                4 => Self::Failed,
2876                5 => Self::Closed,
2877                _ => Self::UnknownValue(state::UnknownValue(
2878                    wkt::internal::UnknownEnumValue::Integer(value),
2879                )),
2880            }
2881        }
2882    }
2883
2884    impl std::convert::From<&str> for State {
2885        fn from(value: &str) -> Self {
2886            use std::string::ToString;
2887            match value {
2888                "STATE_UNSPECIFIED" => Self::Unspecified,
2889                "RUNNING" => Self::Running,
2890                "SUCCEEDED" => Self::Succeeded,
2891                "CANCELLED" => Self::Cancelled,
2892                "FAILED" => Self::Failed,
2893                "CLOSED" => Self::Closed,
2894                _ => Self::UnknownValue(state::UnknownValue(
2895                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2896                )),
2897            }
2898        }
2899    }
2900
2901    impl serde::ser::Serialize for State {
2902        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2903        where
2904            S: serde::Serializer,
2905        {
2906            match self {
2907                Self::Unspecified => serializer.serialize_i32(0),
2908                Self::Running => serializer.serialize_i32(1),
2909                Self::Succeeded => serializer.serialize_i32(2),
2910                Self::Cancelled => serializer.serialize_i32(3),
2911                Self::Failed => serializer.serialize_i32(4),
2912                Self::Closed => serializer.serialize_i32(5),
2913                Self::UnknownValue(u) => u.0.serialize(serializer),
2914            }
2915        }
2916    }
2917
2918    impl<'de> serde::de::Deserialize<'de> for State {
2919        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2920        where
2921            D: serde::Deserializer<'de>,
2922        {
2923            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2924                ".google.cloud.webrisk.v1.SubmitUriMetadata.State",
2925            ))
2926        }
2927    }
2928}
2929
2930/// The type of threat. This maps directly to the threat list a threat may
2931/// belong to.
2932///
2933/// # Working with unknown values
2934///
2935/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2936/// additional enum variants at any time. Adding new variants is not considered
2937/// a breaking change. Applications should write their code in anticipation of:
2938///
2939/// - New values appearing in future releases of the client library, **and**
2940/// - New values received dynamically, without application changes.
2941///
2942/// Please consult the [Working with enums] section in the user guide for some
2943/// guidelines.
2944///
2945/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2946#[derive(Clone, Debug, PartialEq)]
2947#[non_exhaustive]
2948pub enum ThreatType {
2949    /// No entries should match this threat type. This threat type is unused.
2950    Unspecified,
2951    /// Malware targeting any platform.
2952    Malware,
2953    /// Social engineering targeting any platform.
2954    SocialEngineering,
2955    /// Unwanted software targeting any platform.
2956    UnwantedSoftware,
2957    /// A list of extended coverage social engineering URIs targeting any
2958    /// platform.
2959    SocialEngineeringExtendedCoverage,
2960    /// If set, the enum was initialized with an unknown value.
2961    ///
2962    /// Applications can examine the value using [ThreatType::value] or
2963    /// [ThreatType::name].
2964    UnknownValue(threat_type::UnknownValue),
2965}
2966
2967#[doc(hidden)]
2968pub mod threat_type {
2969    #[allow(unused_imports)]
2970    use super::*;
2971    #[derive(Clone, Debug, PartialEq)]
2972    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2973}
2974
2975impl ThreatType {
2976    /// Gets the enum value.
2977    ///
2978    /// Returns `None` if the enum contains an unknown value deserialized from
2979    /// the string representation of enums.
2980    pub fn value(&self) -> std::option::Option<i32> {
2981        match self {
2982            Self::Unspecified => std::option::Option::Some(0),
2983            Self::Malware => std::option::Option::Some(1),
2984            Self::SocialEngineering => std::option::Option::Some(2),
2985            Self::UnwantedSoftware => std::option::Option::Some(3),
2986            Self::SocialEngineeringExtendedCoverage => std::option::Option::Some(4),
2987            Self::UnknownValue(u) => u.0.value(),
2988        }
2989    }
2990
2991    /// Gets the enum value as a string.
2992    ///
2993    /// Returns `None` if the enum contains an unknown value deserialized from
2994    /// the integer representation of enums.
2995    pub fn name(&self) -> std::option::Option<&str> {
2996        match self {
2997            Self::Unspecified => std::option::Option::Some("THREAT_TYPE_UNSPECIFIED"),
2998            Self::Malware => std::option::Option::Some("MALWARE"),
2999            Self::SocialEngineering => std::option::Option::Some("SOCIAL_ENGINEERING"),
3000            Self::UnwantedSoftware => std::option::Option::Some("UNWANTED_SOFTWARE"),
3001            Self::SocialEngineeringExtendedCoverage => {
3002                std::option::Option::Some("SOCIAL_ENGINEERING_EXTENDED_COVERAGE")
3003            }
3004            Self::UnknownValue(u) => u.0.name(),
3005        }
3006    }
3007}
3008
3009impl std::default::Default for ThreatType {
3010    fn default() -> Self {
3011        use std::convert::From;
3012        Self::from(0)
3013    }
3014}
3015
3016impl std::fmt::Display for ThreatType {
3017    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3018        wkt::internal::display_enum(f, self.name(), self.value())
3019    }
3020}
3021
3022impl std::convert::From<i32> for ThreatType {
3023    fn from(value: i32) -> Self {
3024        match value {
3025            0 => Self::Unspecified,
3026            1 => Self::Malware,
3027            2 => Self::SocialEngineering,
3028            3 => Self::UnwantedSoftware,
3029            4 => Self::SocialEngineeringExtendedCoverage,
3030            _ => Self::UnknownValue(threat_type::UnknownValue(
3031                wkt::internal::UnknownEnumValue::Integer(value),
3032            )),
3033        }
3034    }
3035}
3036
3037impl std::convert::From<&str> for ThreatType {
3038    fn from(value: &str) -> Self {
3039        use std::string::ToString;
3040        match value {
3041            "THREAT_TYPE_UNSPECIFIED" => Self::Unspecified,
3042            "MALWARE" => Self::Malware,
3043            "SOCIAL_ENGINEERING" => Self::SocialEngineering,
3044            "UNWANTED_SOFTWARE" => Self::UnwantedSoftware,
3045            "SOCIAL_ENGINEERING_EXTENDED_COVERAGE" => Self::SocialEngineeringExtendedCoverage,
3046            _ => Self::UnknownValue(threat_type::UnknownValue(
3047                wkt::internal::UnknownEnumValue::String(value.to_string()),
3048            )),
3049        }
3050    }
3051}
3052
3053impl serde::ser::Serialize for ThreatType {
3054    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3055    where
3056        S: serde::Serializer,
3057    {
3058        match self {
3059            Self::Unspecified => serializer.serialize_i32(0),
3060            Self::Malware => serializer.serialize_i32(1),
3061            Self::SocialEngineering => serializer.serialize_i32(2),
3062            Self::UnwantedSoftware => serializer.serialize_i32(3),
3063            Self::SocialEngineeringExtendedCoverage => serializer.serialize_i32(4),
3064            Self::UnknownValue(u) => u.0.serialize(serializer),
3065        }
3066    }
3067}
3068
3069impl<'de> serde::de::Deserialize<'de> for ThreatType {
3070    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3071    where
3072        D: serde::Deserializer<'de>,
3073    {
3074        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ThreatType>::new(
3075            ".google.cloud.webrisk.v1.ThreatType",
3076        ))
3077    }
3078}
3079
3080/// The ways in which threat entry sets can be compressed.
3081///
3082/// # Working with unknown values
3083///
3084/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3085/// additional enum variants at any time. Adding new variants is not considered
3086/// a breaking change. Applications should write their code in anticipation of:
3087///
3088/// - New values appearing in future releases of the client library, **and**
3089/// - New values received dynamically, without application changes.
3090///
3091/// Please consult the [Working with enums] section in the user guide for some
3092/// guidelines.
3093///
3094/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3095#[derive(Clone, Debug, PartialEq)]
3096#[non_exhaustive]
3097pub enum CompressionType {
3098    /// Unknown.
3099    Unspecified,
3100    /// Raw, uncompressed data.
3101    Raw,
3102    /// Rice-Golomb encoded data.
3103    Rice,
3104    /// If set, the enum was initialized with an unknown value.
3105    ///
3106    /// Applications can examine the value using [CompressionType::value] or
3107    /// [CompressionType::name].
3108    UnknownValue(compression_type::UnknownValue),
3109}
3110
3111#[doc(hidden)]
3112pub mod compression_type {
3113    #[allow(unused_imports)]
3114    use super::*;
3115    #[derive(Clone, Debug, PartialEq)]
3116    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3117}
3118
3119impl CompressionType {
3120    /// Gets the enum value.
3121    ///
3122    /// Returns `None` if the enum contains an unknown value deserialized from
3123    /// the string representation of enums.
3124    pub fn value(&self) -> std::option::Option<i32> {
3125        match self {
3126            Self::Unspecified => std::option::Option::Some(0),
3127            Self::Raw => std::option::Option::Some(1),
3128            Self::Rice => std::option::Option::Some(2),
3129            Self::UnknownValue(u) => u.0.value(),
3130        }
3131    }
3132
3133    /// Gets the enum value as a string.
3134    ///
3135    /// Returns `None` if the enum contains an unknown value deserialized from
3136    /// the integer representation of enums.
3137    pub fn name(&self) -> std::option::Option<&str> {
3138        match self {
3139            Self::Unspecified => std::option::Option::Some("COMPRESSION_TYPE_UNSPECIFIED"),
3140            Self::Raw => std::option::Option::Some("RAW"),
3141            Self::Rice => std::option::Option::Some("RICE"),
3142            Self::UnknownValue(u) => u.0.name(),
3143        }
3144    }
3145}
3146
3147impl std::default::Default for CompressionType {
3148    fn default() -> Self {
3149        use std::convert::From;
3150        Self::from(0)
3151    }
3152}
3153
3154impl std::fmt::Display for CompressionType {
3155    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3156        wkt::internal::display_enum(f, self.name(), self.value())
3157    }
3158}
3159
3160impl std::convert::From<i32> for CompressionType {
3161    fn from(value: i32) -> Self {
3162        match value {
3163            0 => Self::Unspecified,
3164            1 => Self::Raw,
3165            2 => Self::Rice,
3166            _ => Self::UnknownValue(compression_type::UnknownValue(
3167                wkt::internal::UnknownEnumValue::Integer(value),
3168            )),
3169        }
3170    }
3171}
3172
3173impl std::convert::From<&str> for CompressionType {
3174    fn from(value: &str) -> Self {
3175        use std::string::ToString;
3176        match value {
3177            "COMPRESSION_TYPE_UNSPECIFIED" => Self::Unspecified,
3178            "RAW" => Self::Raw,
3179            "RICE" => Self::Rice,
3180            _ => Self::UnknownValue(compression_type::UnknownValue(
3181                wkt::internal::UnknownEnumValue::String(value.to_string()),
3182            )),
3183        }
3184    }
3185}
3186
3187impl serde::ser::Serialize for CompressionType {
3188    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3189    where
3190        S: serde::Serializer,
3191    {
3192        match self {
3193            Self::Unspecified => serializer.serialize_i32(0),
3194            Self::Raw => serializer.serialize_i32(1),
3195            Self::Rice => serializer.serialize_i32(2),
3196            Self::UnknownValue(u) => u.0.serialize(serializer),
3197        }
3198    }
3199}
3200
3201impl<'de> serde::de::Deserialize<'de> for CompressionType {
3202    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3203    where
3204        D: serde::Deserializer<'de>,
3205    {
3206        deserializer.deserialize_any(wkt::internal::EnumVisitor::<CompressionType>::new(
3207            ".google.cloud.webrisk.v1.CompressionType",
3208        ))
3209    }
3210}