1#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate lazy_static;
25extern crate location;
26extern crate reqwest;
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#[derive(Clone, Default, PartialEq)]
40#[non_exhaustive]
41pub struct Template {
42 pub name: std::string::String,
44
45 pub create_time: std::option::Option<wkt::Timestamp>,
47
48 pub update_time: std::option::Option<wkt::Timestamp>,
50
51 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
53
54 pub filter_config: std::option::Option<crate::model::FilterConfig>,
56
57 pub template_metadata: std::option::Option<crate::model::template::TemplateMetadata>,
59
60 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
61}
62
63impl Template {
64 pub fn new() -> Self {
65 std::default::Default::default()
66 }
67
68 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
70 self.name = v.into();
71 self
72 }
73
74 pub fn set_create_time<T>(mut self, v: T) -> Self
76 where
77 T: std::convert::Into<wkt::Timestamp>,
78 {
79 self.create_time = std::option::Option::Some(v.into());
80 self
81 }
82
83 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
85 where
86 T: std::convert::Into<wkt::Timestamp>,
87 {
88 self.create_time = v.map(|x| x.into());
89 self
90 }
91
92 pub fn set_update_time<T>(mut self, v: T) -> Self
94 where
95 T: std::convert::Into<wkt::Timestamp>,
96 {
97 self.update_time = std::option::Option::Some(v.into());
98 self
99 }
100
101 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
103 where
104 T: std::convert::Into<wkt::Timestamp>,
105 {
106 self.update_time = v.map(|x| x.into());
107 self
108 }
109
110 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
112 where
113 T: std::iter::IntoIterator<Item = (K, V)>,
114 K: std::convert::Into<std::string::String>,
115 V: std::convert::Into<std::string::String>,
116 {
117 use std::iter::Iterator;
118 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
119 self
120 }
121
122 pub fn set_filter_config<T>(mut self, v: T) -> Self
124 where
125 T: std::convert::Into<crate::model::FilterConfig>,
126 {
127 self.filter_config = std::option::Option::Some(v.into());
128 self
129 }
130
131 pub fn set_or_clear_filter_config<T>(mut self, v: std::option::Option<T>) -> Self
133 where
134 T: std::convert::Into<crate::model::FilterConfig>,
135 {
136 self.filter_config = v.map(|x| x.into());
137 self
138 }
139
140 pub fn set_template_metadata<T>(mut self, v: T) -> Self
142 where
143 T: std::convert::Into<crate::model::template::TemplateMetadata>,
144 {
145 self.template_metadata = std::option::Option::Some(v.into());
146 self
147 }
148
149 pub fn set_or_clear_template_metadata<T>(mut self, v: std::option::Option<T>) -> Self
151 where
152 T: std::convert::Into<crate::model::template::TemplateMetadata>,
153 {
154 self.template_metadata = v.map(|x| x.into());
155 self
156 }
157}
158
159impl wkt::message::Message for Template {
160 fn typename() -> &'static str {
161 "type.googleapis.com/google.cloud.modelarmor.v1.Template"
162 }
163}
164
165pub mod template {
167 #[allow(unused_imports)]
168 use super::*;
169
170 #[derive(Clone, Default, PartialEq)]
172 #[non_exhaustive]
173 pub struct TemplateMetadata {
174 pub ignore_partial_invocation_failures: bool,
176
177 pub custom_prompt_safety_error_code: i32,
181
182 pub custom_prompt_safety_error_message: std::string::String,
185
186 pub custom_llm_response_safety_error_code: i32,
189
190 pub custom_llm_response_safety_error_message: std::string::String,
193
194 pub log_template_operations: bool,
196
197 pub log_sanitize_operations: bool,
199
200 pub enforcement_type: crate::model::template::template_metadata::EnforcementType,
202
203 pub multi_language_detection:
205 std::option::Option<crate::model::template::template_metadata::MultiLanguageDetection>,
206
207 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
208 }
209
210 impl TemplateMetadata {
211 pub fn new() -> Self {
212 std::default::Default::default()
213 }
214
215 pub fn set_ignore_partial_invocation_failures<T: std::convert::Into<bool>>(
217 mut self,
218 v: T,
219 ) -> Self {
220 self.ignore_partial_invocation_failures = v.into();
221 self
222 }
223
224 pub fn set_custom_prompt_safety_error_code<T: std::convert::Into<i32>>(
226 mut self,
227 v: T,
228 ) -> Self {
229 self.custom_prompt_safety_error_code = v.into();
230 self
231 }
232
233 pub fn set_custom_prompt_safety_error_message<
235 T: std::convert::Into<std::string::String>,
236 >(
237 mut self,
238 v: T,
239 ) -> Self {
240 self.custom_prompt_safety_error_message = v.into();
241 self
242 }
243
244 pub fn set_custom_llm_response_safety_error_code<T: std::convert::Into<i32>>(
246 mut self,
247 v: T,
248 ) -> Self {
249 self.custom_llm_response_safety_error_code = v.into();
250 self
251 }
252
253 pub fn set_custom_llm_response_safety_error_message<
255 T: std::convert::Into<std::string::String>,
256 >(
257 mut self,
258 v: T,
259 ) -> Self {
260 self.custom_llm_response_safety_error_message = v.into();
261 self
262 }
263
264 pub fn set_log_template_operations<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
266 self.log_template_operations = v.into();
267 self
268 }
269
270 pub fn set_log_sanitize_operations<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
272 self.log_sanitize_operations = v.into();
273 self
274 }
275
276 pub fn set_enforcement_type<
278 T: std::convert::Into<crate::model::template::template_metadata::EnforcementType>,
279 >(
280 mut self,
281 v: T,
282 ) -> Self {
283 self.enforcement_type = v.into();
284 self
285 }
286
287 pub fn set_multi_language_detection<T>(mut self, v: T) -> Self
289 where
290 T: std::convert::Into<
291 crate::model::template::template_metadata::MultiLanguageDetection,
292 >,
293 {
294 self.multi_language_detection = std::option::Option::Some(v.into());
295 self
296 }
297
298 pub fn set_or_clear_multi_language_detection<T>(mut self, v: std::option::Option<T>) -> Self
300 where
301 T: std::convert::Into<
302 crate::model::template::template_metadata::MultiLanguageDetection,
303 >,
304 {
305 self.multi_language_detection = v.map(|x| x.into());
306 self
307 }
308 }
309
310 impl wkt::message::Message for TemplateMetadata {
311 fn typename() -> &'static str {
312 "type.googleapis.com/google.cloud.modelarmor.v1.Template.TemplateMetadata"
313 }
314 }
315
316 pub mod template_metadata {
318 #[allow(unused_imports)]
319 use super::*;
320
321 #[derive(Clone, Default, PartialEq)]
323 #[non_exhaustive]
324 pub struct MultiLanguageDetection {
325 pub enable_multi_language_detection: bool,
327
328 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
329 }
330
331 impl MultiLanguageDetection {
332 pub fn new() -> Self {
333 std::default::Default::default()
334 }
335
336 pub fn set_enable_multi_language_detection<T: std::convert::Into<bool>>(
338 mut self,
339 v: T,
340 ) -> Self {
341 self.enable_multi_language_detection = v.into();
342 self
343 }
344 }
345
346 impl wkt::message::Message for MultiLanguageDetection {
347 fn typename() -> &'static str {
348 "type.googleapis.com/google.cloud.modelarmor.v1.Template.TemplateMetadata.MultiLanguageDetection"
349 }
350 }
351
352 #[derive(Clone, Debug, PartialEq)]
368 #[non_exhaustive]
369 pub enum EnforcementType {
370 Unspecified,
372 InspectOnly,
375 InspectAndBlock,
378 UnknownValue(enforcement_type::UnknownValue),
383 }
384
385 #[doc(hidden)]
386 pub mod enforcement_type {
387 #[allow(unused_imports)]
388 use super::*;
389 #[derive(Clone, Debug, PartialEq)]
390 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
391 }
392
393 impl EnforcementType {
394 pub fn value(&self) -> std::option::Option<i32> {
399 match self {
400 Self::Unspecified => std::option::Option::Some(0),
401 Self::InspectOnly => std::option::Option::Some(1),
402 Self::InspectAndBlock => std::option::Option::Some(2),
403 Self::UnknownValue(u) => u.0.value(),
404 }
405 }
406
407 pub fn name(&self) -> std::option::Option<&str> {
412 match self {
413 Self::Unspecified => std::option::Option::Some("ENFORCEMENT_TYPE_UNSPECIFIED"),
414 Self::InspectOnly => std::option::Option::Some("INSPECT_ONLY"),
415 Self::InspectAndBlock => std::option::Option::Some("INSPECT_AND_BLOCK"),
416 Self::UnknownValue(u) => u.0.name(),
417 }
418 }
419 }
420
421 impl std::default::Default for EnforcementType {
422 fn default() -> Self {
423 use std::convert::From;
424 Self::from(0)
425 }
426 }
427
428 impl std::fmt::Display for EnforcementType {
429 fn fmt(
430 &self,
431 f: &mut std::fmt::Formatter<'_>,
432 ) -> std::result::Result<(), std::fmt::Error> {
433 wkt::internal::display_enum(f, self.name(), self.value())
434 }
435 }
436
437 impl std::convert::From<i32> for EnforcementType {
438 fn from(value: i32) -> Self {
439 match value {
440 0 => Self::Unspecified,
441 1 => Self::InspectOnly,
442 2 => Self::InspectAndBlock,
443 _ => Self::UnknownValue(enforcement_type::UnknownValue(
444 wkt::internal::UnknownEnumValue::Integer(value),
445 )),
446 }
447 }
448 }
449
450 impl std::convert::From<&str> for EnforcementType {
451 fn from(value: &str) -> Self {
452 use std::string::ToString;
453 match value {
454 "ENFORCEMENT_TYPE_UNSPECIFIED" => Self::Unspecified,
455 "INSPECT_ONLY" => Self::InspectOnly,
456 "INSPECT_AND_BLOCK" => Self::InspectAndBlock,
457 _ => Self::UnknownValue(enforcement_type::UnknownValue(
458 wkt::internal::UnknownEnumValue::String(value.to_string()),
459 )),
460 }
461 }
462 }
463
464 impl serde::ser::Serialize for EnforcementType {
465 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
466 where
467 S: serde::Serializer,
468 {
469 match self {
470 Self::Unspecified => serializer.serialize_i32(0),
471 Self::InspectOnly => serializer.serialize_i32(1),
472 Self::InspectAndBlock => serializer.serialize_i32(2),
473 Self::UnknownValue(u) => u.0.serialize(serializer),
474 }
475 }
476 }
477
478 impl<'de> serde::de::Deserialize<'de> for EnforcementType {
479 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
480 where
481 D: serde::Deserializer<'de>,
482 {
483 deserializer.deserialize_any(wkt::internal::EnumVisitor::<EnforcementType>::new(
484 ".google.cloud.modelarmor.v1.Template.TemplateMetadata.EnforcementType",
485 ))
486 }
487 }
488 }
489}
490
491#[derive(Clone, Default, PartialEq)]
493#[non_exhaustive]
494pub struct FloorSetting {
495 pub name: std::string::String,
497
498 pub create_time: std::option::Option<wkt::Timestamp>,
500
501 pub update_time: std::option::Option<wkt::Timestamp>,
503
504 pub filter_config: std::option::Option<crate::model::FilterConfig>,
506
507 pub enable_floor_setting_enforcement: std::option::Option<bool>,
509
510 pub integrated_services: std::vec::Vec<crate::model::floor_setting::IntegratedService>,
513
514 pub ai_platform_floor_setting: std::option::Option<crate::model::AiPlatformFloorSetting>,
516
517 pub floor_setting_metadata:
519 std::option::Option<crate::model::floor_setting::FloorSettingMetadata>,
520
521 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
522}
523
524impl FloorSetting {
525 pub fn new() -> Self {
526 std::default::Default::default()
527 }
528
529 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
531 self.name = v.into();
532 self
533 }
534
535 pub fn set_create_time<T>(mut self, v: T) -> Self
537 where
538 T: std::convert::Into<wkt::Timestamp>,
539 {
540 self.create_time = std::option::Option::Some(v.into());
541 self
542 }
543
544 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
546 where
547 T: std::convert::Into<wkt::Timestamp>,
548 {
549 self.create_time = v.map(|x| x.into());
550 self
551 }
552
553 pub fn set_update_time<T>(mut self, v: T) -> Self
555 where
556 T: std::convert::Into<wkt::Timestamp>,
557 {
558 self.update_time = std::option::Option::Some(v.into());
559 self
560 }
561
562 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
564 where
565 T: std::convert::Into<wkt::Timestamp>,
566 {
567 self.update_time = v.map(|x| x.into());
568 self
569 }
570
571 pub fn set_filter_config<T>(mut self, v: T) -> Self
573 where
574 T: std::convert::Into<crate::model::FilterConfig>,
575 {
576 self.filter_config = std::option::Option::Some(v.into());
577 self
578 }
579
580 pub fn set_or_clear_filter_config<T>(mut self, v: std::option::Option<T>) -> Self
582 where
583 T: std::convert::Into<crate::model::FilterConfig>,
584 {
585 self.filter_config = v.map(|x| x.into());
586 self
587 }
588
589 pub fn set_enable_floor_setting_enforcement<T>(mut self, v: T) -> Self
591 where
592 T: std::convert::Into<bool>,
593 {
594 self.enable_floor_setting_enforcement = std::option::Option::Some(v.into());
595 self
596 }
597
598 pub fn set_or_clear_enable_floor_setting_enforcement<T>(
600 mut self,
601 v: std::option::Option<T>,
602 ) -> Self
603 where
604 T: std::convert::Into<bool>,
605 {
606 self.enable_floor_setting_enforcement = v.map(|x| x.into());
607 self
608 }
609
610 pub fn set_integrated_services<T, V>(mut self, v: T) -> Self
612 where
613 T: std::iter::IntoIterator<Item = V>,
614 V: std::convert::Into<crate::model::floor_setting::IntegratedService>,
615 {
616 use std::iter::Iterator;
617 self.integrated_services = v.into_iter().map(|i| i.into()).collect();
618 self
619 }
620
621 pub fn set_ai_platform_floor_setting<T>(mut self, v: T) -> Self
623 where
624 T: std::convert::Into<crate::model::AiPlatformFloorSetting>,
625 {
626 self.ai_platform_floor_setting = std::option::Option::Some(v.into());
627 self
628 }
629
630 pub fn set_or_clear_ai_platform_floor_setting<T>(mut self, v: std::option::Option<T>) -> Self
632 where
633 T: std::convert::Into<crate::model::AiPlatformFloorSetting>,
634 {
635 self.ai_platform_floor_setting = v.map(|x| x.into());
636 self
637 }
638
639 pub fn set_floor_setting_metadata<T>(mut self, v: T) -> Self
641 where
642 T: std::convert::Into<crate::model::floor_setting::FloorSettingMetadata>,
643 {
644 self.floor_setting_metadata = std::option::Option::Some(v.into());
645 self
646 }
647
648 pub fn set_or_clear_floor_setting_metadata<T>(mut self, v: std::option::Option<T>) -> Self
650 where
651 T: std::convert::Into<crate::model::floor_setting::FloorSettingMetadata>,
652 {
653 self.floor_setting_metadata = v.map(|x| x.into());
654 self
655 }
656}
657
658impl wkt::message::Message for FloorSetting {
659 fn typename() -> &'static str {
660 "type.googleapis.com/google.cloud.modelarmor.v1.FloorSetting"
661 }
662}
663
664pub mod floor_setting {
666 #[allow(unused_imports)]
667 use super::*;
668
669 #[derive(Clone, Default, PartialEq)]
671 #[non_exhaustive]
672 pub struct FloorSettingMetadata {
673 pub multi_language_detection: std::option::Option<
675 crate::model::floor_setting::floor_setting_metadata::MultiLanguageDetection,
676 >,
677
678 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
679 }
680
681 impl FloorSettingMetadata {
682 pub fn new() -> Self {
683 std::default::Default::default()
684 }
685
686 pub fn set_multi_language_detection<T>(mut self, v: T) -> Self
688 where
689 T: std::convert::Into<
690 crate::model::floor_setting::floor_setting_metadata::MultiLanguageDetection,
691 >,
692 {
693 self.multi_language_detection = std::option::Option::Some(v.into());
694 self
695 }
696
697 pub fn set_or_clear_multi_language_detection<T>(mut self, v: std::option::Option<T>) -> Self
699 where
700 T: std::convert::Into<
701 crate::model::floor_setting::floor_setting_metadata::MultiLanguageDetection,
702 >,
703 {
704 self.multi_language_detection = v.map(|x| x.into());
705 self
706 }
707 }
708
709 impl wkt::message::Message for FloorSettingMetadata {
710 fn typename() -> &'static str {
711 "type.googleapis.com/google.cloud.modelarmor.v1.FloorSetting.FloorSettingMetadata"
712 }
713 }
714
715 pub mod floor_setting_metadata {
717 #[allow(unused_imports)]
718 use super::*;
719
720 #[derive(Clone, Default, PartialEq)]
722 #[non_exhaustive]
723 pub struct MultiLanguageDetection {
724 pub enable_multi_language_detection: bool,
726
727 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
728 }
729
730 impl MultiLanguageDetection {
731 pub fn new() -> Self {
732 std::default::Default::default()
733 }
734
735 pub fn set_enable_multi_language_detection<T: std::convert::Into<bool>>(
737 mut self,
738 v: T,
739 ) -> Self {
740 self.enable_multi_language_detection = v.into();
741 self
742 }
743 }
744
745 impl wkt::message::Message for MultiLanguageDetection {
746 fn typename() -> &'static str {
747 "type.googleapis.com/google.cloud.modelarmor.v1.FloorSetting.FloorSettingMetadata.MultiLanguageDetection"
748 }
749 }
750 }
751
752 #[derive(Clone, Debug, PartialEq)]
768 #[non_exhaustive]
769 pub enum IntegratedService {
770 Unspecified,
772 AiPlatform,
774 UnknownValue(integrated_service::UnknownValue),
779 }
780
781 #[doc(hidden)]
782 pub mod integrated_service {
783 #[allow(unused_imports)]
784 use super::*;
785 #[derive(Clone, Debug, PartialEq)]
786 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
787 }
788
789 impl IntegratedService {
790 pub fn value(&self) -> std::option::Option<i32> {
795 match self {
796 Self::Unspecified => std::option::Option::Some(0),
797 Self::AiPlatform => std::option::Option::Some(1),
798 Self::UnknownValue(u) => u.0.value(),
799 }
800 }
801
802 pub fn name(&self) -> std::option::Option<&str> {
807 match self {
808 Self::Unspecified => std::option::Option::Some("INTEGRATED_SERVICE_UNSPECIFIED"),
809 Self::AiPlatform => std::option::Option::Some("AI_PLATFORM"),
810 Self::UnknownValue(u) => u.0.name(),
811 }
812 }
813 }
814
815 impl std::default::Default for IntegratedService {
816 fn default() -> Self {
817 use std::convert::From;
818 Self::from(0)
819 }
820 }
821
822 impl std::fmt::Display for IntegratedService {
823 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
824 wkt::internal::display_enum(f, self.name(), self.value())
825 }
826 }
827
828 impl std::convert::From<i32> for IntegratedService {
829 fn from(value: i32) -> Self {
830 match value {
831 0 => Self::Unspecified,
832 1 => Self::AiPlatform,
833 _ => Self::UnknownValue(integrated_service::UnknownValue(
834 wkt::internal::UnknownEnumValue::Integer(value),
835 )),
836 }
837 }
838 }
839
840 impl std::convert::From<&str> for IntegratedService {
841 fn from(value: &str) -> Self {
842 use std::string::ToString;
843 match value {
844 "INTEGRATED_SERVICE_UNSPECIFIED" => Self::Unspecified,
845 "AI_PLATFORM" => Self::AiPlatform,
846 _ => Self::UnknownValue(integrated_service::UnknownValue(
847 wkt::internal::UnknownEnumValue::String(value.to_string()),
848 )),
849 }
850 }
851 }
852
853 impl serde::ser::Serialize for IntegratedService {
854 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
855 where
856 S: serde::Serializer,
857 {
858 match self {
859 Self::Unspecified => serializer.serialize_i32(0),
860 Self::AiPlatform => serializer.serialize_i32(1),
861 Self::UnknownValue(u) => u.0.serialize(serializer),
862 }
863 }
864 }
865
866 impl<'de> serde::de::Deserialize<'de> for IntegratedService {
867 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
868 where
869 D: serde::Deserializer<'de>,
870 {
871 deserializer.deserialize_any(wkt::internal::EnumVisitor::<IntegratedService>::new(
872 ".google.cloud.modelarmor.v1.FloorSetting.IntegratedService",
873 ))
874 }
875 }
876}
877
878#[derive(Clone, Default, PartialEq)]
880#[non_exhaustive]
881pub struct AiPlatformFloorSetting {
882 pub enable_cloud_logging: bool,
884
885 pub enforcement_type:
887 std::option::Option<crate::model::ai_platform_floor_setting::EnforcementType>,
888
889 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
890}
891
892impl AiPlatformFloorSetting {
893 pub fn new() -> Self {
894 std::default::Default::default()
895 }
896
897 pub fn set_enable_cloud_logging<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
899 self.enable_cloud_logging = v.into();
900 self
901 }
902
903 pub fn set_enforcement_type<
908 T: std::convert::Into<
909 std::option::Option<crate::model::ai_platform_floor_setting::EnforcementType>,
910 >,
911 >(
912 mut self,
913 v: T,
914 ) -> Self {
915 self.enforcement_type = v.into();
916 self
917 }
918
919 pub fn inspect_only(&self) -> std::option::Option<&bool> {
923 #[allow(unreachable_patterns)]
924 self.enforcement_type.as_ref().and_then(|v| match v {
925 crate::model::ai_platform_floor_setting::EnforcementType::InspectOnly(v) => {
926 std::option::Option::Some(v)
927 }
928 _ => std::option::Option::None,
929 })
930 }
931
932 pub fn set_inspect_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
938 self.enforcement_type = std::option::Option::Some(
939 crate::model::ai_platform_floor_setting::EnforcementType::InspectOnly(v.into()),
940 );
941 self
942 }
943
944 pub fn inspect_and_block(&self) -> std::option::Option<&bool> {
948 #[allow(unreachable_patterns)]
949 self.enforcement_type.as_ref().and_then(|v| match v {
950 crate::model::ai_platform_floor_setting::EnforcementType::InspectAndBlock(v) => {
951 std::option::Option::Some(v)
952 }
953 _ => std::option::Option::None,
954 })
955 }
956
957 pub fn set_inspect_and_block<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
963 self.enforcement_type = std::option::Option::Some(
964 crate::model::ai_platform_floor_setting::EnforcementType::InspectAndBlock(v.into()),
965 );
966 self
967 }
968}
969
970impl wkt::message::Message for AiPlatformFloorSetting {
971 fn typename() -> &'static str {
972 "type.googleapis.com/google.cloud.modelarmor.v1.AiPlatformFloorSetting"
973 }
974}
975
976pub mod ai_platform_floor_setting {
978 #[allow(unused_imports)]
979 use super::*;
980
981 #[derive(Clone, Debug, PartialEq)]
983 #[non_exhaustive]
984 pub enum EnforcementType {
985 InspectOnly(bool),
988 InspectAndBlock(bool),
991 }
992}
993
994#[derive(Clone, Default, PartialEq)]
996#[non_exhaustive]
997pub struct ListTemplatesRequest {
998 pub parent: std::string::String,
1000
1001 pub page_size: i32,
1004
1005 pub page_token: std::string::String,
1007
1008 pub filter: std::string::String,
1010
1011 pub order_by: std::string::String,
1013
1014 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1015}
1016
1017impl ListTemplatesRequest {
1018 pub fn new() -> Self {
1019 std::default::Default::default()
1020 }
1021
1022 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1024 self.parent = v.into();
1025 self
1026 }
1027
1028 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1030 self.page_size = v.into();
1031 self
1032 }
1033
1034 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1036 self.page_token = v.into();
1037 self
1038 }
1039
1040 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1042 self.filter = v.into();
1043 self
1044 }
1045
1046 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1048 self.order_by = v.into();
1049 self
1050 }
1051}
1052
1053impl wkt::message::Message for ListTemplatesRequest {
1054 fn typename() -> &'static str {
1055 "type.googleapis.com/google.cloud.modelarmor.v1.ListTemplatesRequest"
1056 }
1057}
1058
1059#[derive(Clone, Default, PartialEq)]
1061#[non_exhaustive]
1062pub struct ListTemplatesResponse {
1063 pub templates: std::vec::Vec<crate::model::Template>,
1065
1066 pub next_page_token: std::string::String,
1068
1069 pub unreachable: std::vec::Vec<std::string::String>,
1071
1072 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1073}
1074
1075impl ListTemplatesResponse {
1076 pub fn new() -> Self {
1077 std::default::Default::default()
1078 }
1079
1080 pub fn set_templates<T, V>(mut self, v: T) -> Self
1082 where
1083 T: std::iter::IntoIterator<Item = V>,
1084 V: std::convert::Into<crate::model::Template>,
1085 {
1086 use std::iter::Iterator;
1087 self.templates = v.into_iter().map(|i| i.into()).collect();
1088 self
1089 }
1090
1091 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1093 self.next_page_token = v.into();
1094 self
1095 }
1096
1097 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1099 where
1100 T: std::iter::IntoIterator<Item = V>,
1101 V: std::convert::Into<std::string::String>,
1102 {
1103 use std::iter::Iterator;
1104 self.unreachable = v.into_iter().map(|i| i.into()).collect();
1105 self
1106 }
1107}
1108
1109impl wkt::message::Message for ListTemplatesResponse {
1110 fn typename() -> &'static str {
1111 "type.googleapis.com/google.cloud.modelarmor.v1.ListTemplatesResponse"
1112 }
1113}
1114
1115#[doc(hidden)]
1116impl gax::paginator::internal::PageableResponse for ListTemplatesResponse {
1117 type PageItem = crate::model::Template;
1118
1119 fn items(self) -> std::vec::Vec<Self::PageItem> {
1120 self.templates
1121 }
1122
1123 fn next_page_token(&self) -> std::string::String {
1124 use std::clone::Clone;
1125 self.next_page_token.clone()
1126 }
1127}
1128
1129#[derive(Clone, Default, PartialEq)]
1131#[non_exhaustive]
1132pub struct GetTemplateRequest {
1133 pub name: std::string::String,
1135
1136 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1137}
1138
1139impl GetTemplateRequest {
1140 pub fn new() -> Self {
1141 std::default::Default::default()
1142 }
1143
1144 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1146 self.name = v.into();
1147 self
1148 }
1149}
1150
1151impl wkt::message::Message for GetTemplateRequest {
1152 fn typename() -> &'static str {
1153 "type.googleapis.com/google.cloud.modelarmor.v1.GetTemplateRequest"
1154 }
1155}
1156
1157#[derive(Clone, Default, PartialEq)]
1159#[non_exhaustive]
1160pub struct CreateTemplateRequest {
1161 pub parent: std::string::String,
1163
1164 pub template_id: std::string::String,
1168
1169 pub template: std::option::Option<crate::model::Template>,
1171
1172 pub request_id: std::string::String,
1186
1187 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1188}
1189
1190impl CreateTemplateRequest {
1191 pub fn new() -> Self {
1192 std::default::Default::default()
1193 }
1194
1195 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1197 self.parent = v.into();
1198 self
1199 }
1200
1201 pub fn set_template_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1203 self.template_id = v.into();
1204 self
1205 }
1206
1207 pub fn set_template<T>(mut self, v: T) -> Self
1209 where
1210 T: std::convert::Into<crate::model::Template>,
1211 {
1212 self.template = std::option::Option::Some(v.into());
1213 self
1214 }
1215
1216 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
1218 where
1219 T: std::convert::Into<crate::model::Template>,
1220 {
1221 self.template = v.map(|x| x.into());
1222 self
1223 }
1224
1225 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1227 self.request_id = v.into();
1228 self
1229 }
1230}
1231
1232impl wkt::message::Message for CreateTemplateRequest {
1233 fn typename() -> &'static str {
1234 "type.googleapis.com/google.cloud.modelarmor.v1.CreateTemplateRequest"
1235 }
1236}
1237
1238#[derive(Clone, Default, PartialEq)]
1240#[non_exhaustive]
1241pub struct UpdateTemplateRequest {
1242 pub update_mask: std::option::Option<wkt::FieldMask>,
1248
1249 pub template: std::option::Option<crate::model::Template>,
1251
1252 pub request_id: std::string::String,
1266
1267 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1268}
1269
1270impl UpdateTemplateRequest {
1271 pub fn new() -> Self {
1272 std::default::Default::default()
1273 }
1274
1275 pub fn set_update_mask<T>(mut self, v: T) -> Self
1277 where
1278 T: std::convert::Into<wkt::FieldMask>,
1279 {
1280 self.update_mask = std::option::Option::Some(v.into());
1281 self
1282 }
1283
1284 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1286 where
1287 T: std::convert::Into<wkt::FieldMask>,
1288 {
1289 self.update_mask = v.map(|x| x.into());
1290 self
1291 }
1292
1293 pub fn set_template<T>(mut self, v: T) -> Self
1295 where
1296 T: std::convert::Into<crate::model::Template>,
1297 {
1298 self.template = std::option::Option::Some(v.into());
1299 self
1300 }
1301
1302 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
1304 where
1305 T: std::convert::Into<crate::model::Template>,
1306 {
1307 self.template = v.map(|x| x.into());
1308 self
1309 }
1310
1311 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1313 self.request_id = v.into();
1314 self
1315 }
1316}
1317
1318impl wkt::message::Message for UpdateTemplateRequest {
1319 fn typename() -> &'static str {
1320 "type.googleapis.com/google.cloud.modelarmor.v1.UpdateTemplateRequest"
1321 }
1322}
1323
1324#[derive(Clone, Default, PartialEq)]
1326#[non_exhaustive]
1327pub struct DeleteTemplateRequest {
1328 pub name: std::string::String,
1330
1331 pub request_id: std::string::String,
1345
1346 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1347}
1348
1349impl DeleteTemplateRequest {
1350 pub fn new() -> Self {
1351 std::default::Default::default()
1352 }
1353
1354 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1356 self.name = v.into();
1357 self
1358 }
1359
1360 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1362 self.request_id = v.into();
1363 self
1364 }
1365}
1366
1367impl wkt::message::Message for DeleteTemplateRequest {
1368 fn typename() -> &'static str {
1369 "type.googleapis.com/google.cloud.modelarmor.v1.DeleteTemplateRequest"
1370 }
1371}
1372
1373#[derive(Clone, Default, PartialEq)]
1375#[non_exhaustive]
1376pub struct GetFloorSettingRequest {
1377 pub name: std::string::String,
1380
1381 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1382}
1383
1384impl GetFloorSettingRequest {
1385 pub fn new() -> Self {
1386 std::default::Default::default()
1387 }
1388
1389 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1391 self.name = v.into();
1392 self
1393 }
1394}
1395
1396impl wkt::message::Message for GetFloorSettingRequest {
1397 fn typename() -> &'static str {
1398 "type.googleapis.com/google.cloud.modelarmor.v1.GetFloorSettingRequest"
1399 }
1400}
1401
1402#[derive(Clone, Default, PartialEq)]
1404#[non_exhaustive]
1405pub struct UpdateFloorSettingRequest {
1406 pub floor_setting: std::option::Option<crate::model::FloorSetting>,
1408
1409 pub update_mask: std::option::Option<wkt::FieldMask>,
1415
1416 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1417}
1418
1419impl UpdateFloorSettingRequest {
1420 pub fn new() -> Self {
1421 std::default::Default::default()
1422 }
1423
1424 pub fn set_floor_setting<T>(mut self, v: T) -> Self
1426 where
1427 T: std::convert::Into<crate::model::FloorSetting>,
1428 {
1429 self.floor_setting = std::option::Option::Some(v.into());
1430 self
1431 }
1432
1433 pub fn set_or_clear_floor_setting<T>(mut self, v: std::option::Option<T>) -> Self
1435 where
1436 T: std::convert::Into<crate::model::FloorSetting>,
1437 {
1438 self.floor_setting = v.map(|x| x.into());
1439 self
1440 }
1441
1442 pub fn set_update_mask<T>(mut self, v: T) -> Self
1444 where
1445 T: std::convert::Into<wkt::FieldMask>,
1446 {
1447 self.update_mask = std::option::Option::Some(v.into());
1448 self
1449 }
1450
1451 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1453 where
1454 T: std::convert::Into<wkt::FieldMask>,
1455 {
1456 self.update_mask = v.map(|x| x.into());
1457 self
1458 }
1459}
1460
1461impl wkt::message::Message for UpdateFloorSettingRequest {
1462 fn typename() -> &'static str {
1463 "type.googleapis.com/google.cloud.modelarmor.v1.UpdateFloorSettingRequest"
1464 }
1465}
1466
1467#[derive(Clone, Default, PartialEq)]
1469#[non_exhaustive]
1470pub struct FilterConfig {
1471 pub rai_settings: std::option::Option<crate::model::RaiFilterSettings>,
1473
1474 pub sdp_settings: std::option::Option<crate::model::SdpFilterSettings>,
1476
1477 pub pi_and_jailbreak_filter_settings:
1479 std::option::Option<crate::model::PiAndJailbreakFilterSettings>,
1480
1481 pub malicious_uri_filter_settings:
1483 std::option::Option<crate::model::MaliciousUriFilterSettings>,
1484
1485 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1486}
1487
1488impl FilterConfig {
1489 pub fn new() -> Self {
1490 std::default::Default::default()
1491 }
1492
1493 pub fn set_rai_settings<T>(mut self, v: T) -> Self
1495 where
1496 T: std::convert::Into<crate::model::RaiFilterSettings>,
1497 {
1498 self.rai_settings = std::option::Option::Some(v.into());
1499 self
1500 }
1501
1502 pub fn set_or_clear_rai_settings<T>(mut self, v: std::option::Option<T>) -> Self
1504 where
1505 T: std::convert::Into<crate::model::RaiFilterSettings>,
1506 {
1507 self.rai_settings = v.map(|x| x.into());
1508 self
1509 }
1510
1511 pub fn set_sdp_settings<T>(mut self, v: T) -> Self
1513 where
1514 T: std::convert::Into<crate::model::SdpFilterSettings>,
1515 {
1516 self.sdp_settings = std::option::Option::Some(v.into());
1517 self
1518 }
1519
1520 pub fn set_or_clear_sdp_settings<T>(mut self, v: std::option::Option<T>) -> Self
1522 where
1523 T: std::convert::Into<crate::model::SdpFilterSettings>,
1524 {
1525 self.sdp_settings = v.map(|x| x.into());
1526 self
1527 }
1528
1529 pub fn set_pi_and_jailbreak_filter_settings<T>(mut self, v: T) -> Self
1531 where
1532 T: std::convert::Into<crate::model::PiAndJailbreakFilterSettings>,
1533 {
1534 self.pi_and_jailbreak_filter_settings = std::option::Option::Some(v.into());
1535 self
1536 }
1537
1538 pub fn set_or_clear_pi_and_jailbreak_filter_settings<T>(
1540 mut self,
1541 v: std::option::Option<T>,
1542 ) -> Self
1543 where
1544 T: std::convert::Into<crate::model::PiAndJailbreakFilterSettings>,
1545 {
1546 self.pi_and_jailbreak_filter_settings = v.map(|x| x.into());
1547 self
1548 }
1549
1550 pub fn set_malicious_uri_filter_settings<T>(mut self, v: T) -> Self
1552 where
1553 T: std::convert::Into<crate::model::MaliciousUriFilterSettings>,
1554 {
1555 self.malicious_uri_filter_settings = std::option::Option::Some(v.into());
1556 self
1557 }
1558
1559 pub fn set_or_clear_malicious_uri_filter_settings<T>(
1561 mut self,
1562 v: std::option::Option<T>,
1563 ) -> Self
1564 where
1565 T: std::convert::Into<crate::model::MaliciousUriFilterSettings>,
1566 {
1567 self.malicious_uri_filter_settings = v.map(|x| x.into());
1568 self
1569 }
1570}
1571
1572impl wkt::message::Message for FilterConfig {
1573 fn typename() -> &'static str {
1574 "type.googleapis.com/google.cloud.modelarmor.v1.FilterConfig"
1575 }
1576}
1577
1578#[derive(Clone, Default, PartialEq)]
1580#[non_exhaustive]
1581pub struct PiAndJailbreakFilterSettings {
1582 pub filter_enforcement:
1585 crate::model::pi_and_jailbreak_filter_settings::PiAndJailbreakFilterEnforcement,
1586
1587 pub confidence_level: crate::model::DetectionConfidenceLevel,
1593
1594 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1595}
1596
1597impl PiAndJailbreakFilterSettings {
1598 pub fn new() -> Self {
1599 std::default::Default::default()
1600 }
1601
1602 pub fn set_filter_enforcement<
1604 T: std::convert::Into<
1605 crate::model::pi_and_jailbreak_filter_settings::PiAndJailbreakFilterEnforcement,
1606 >,
1607 >(
1608 mut self,
1609 v: T,
1610 ) -> Self {
1611 self.filter_enforcement = v.into();
1612 self
1613 }
1614
1615 pub fn set_confidence_level<T: std::convert::Into<crate::model::DetectionConfidenceLevel>>(
1617 mut self,
1618 v: T,
1619 ) -> Self {
1620 self.confidence_level = v.into();
1621 self
1622 }
1623}
1624
1625impl wkt::message::Message for PiAndJailbreakFilterSettings {
1626 fn typename() -> &'static str {
1627 "type.googleapis.com/google.cloud.modelarmor.v1.PiAndJailbreakFilterSettings"
1628 }
1629}
1630
1631pub mod pi_and_jailbreak_filter_settings {
1633 #[allow(unused_imports)]
1634 use super::*;
1635
1636 #[derive(Clone, Debug, PartialEq)]
1653 #[non_exhaustive]
1654 pub enum PiAndJailbreakFilterEnforcement {
1655 Unspecified,
1657 Enabled,
1659 Disabled,
1661 UnknownValue(pi_and_jailbreak_filter_enforcement::UnknownValue),
1666 }
1667
1668 #[doc(hidden)]
1669 pub mod pi_and_jailbreak_filter_enforcement {
1670 #[allow(unused_imports)]
1671 use super::*;
1672 #[derive(Clone, Debug, PartialEq)]
1673 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1674 }
1675
1676 impl PiAndJailbreakFilterEnforcement {
1677 pub fn value(&self) -> std::option::Option<i32> {
1682 match self {
1683 Self::Unspecified => std::option::Option::Some(0),
1684 Self::Enabled => std::option::Option::Some(1),
1685 Self::Disabled => std::option::Option::Some(2),
1686 Self::UnknownValue(u) => u.0.value(),
1687 }
1688 }
1689
1690 pub fn name(&self) -> std::option::Option<&str> {
1695 match self {
1696 Self::Unspecified => {
1697 std::option::Option::Some("PI_AND_JAILBREAK_FILTER_ENFORCEMENT_UNSPECIFIED")
1698 }
1699 Self::Enabled => std::option::Option::Some("ENABLED"),
1700 Self::Disabled => std::option::Option::Some("DISABLED"),
1701 Self::UnknownValue(u) => u.0.name(),
1702 }
1703 }
1704 }
1705
1706 impl std::default::Default for PiAndJailbreakFilterEnforcement {
1707 fn default() -> Self {
1708 use std::convert::From;
1709 Self::from(0)
1710 }
1711 }
1712
1713 impl std::fmt::Display for PiAndJailbreakFilterEnforcement {
1714 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1715 wkt::internal::display_enum(f, self.name(), self.value())
1716 }
1717 }
1718
1719 impl std::convert::From<i32> for PiAndJailbreakFilterEnforcement {
1720 fn from(value: i32) -> Self {
1721 match value {
1722 0 => Self::Unspecified,
1723 1 => Self::Enabled,
1724 2 => Self::Disabled,
1725 _ => Self::UnknownValue(pi_and_jailbreak_filter_enforcement::UnknownValue(
1726 wkt::internal::UnknownEnumValue::Integer(value),
1727 )),
1728 }
1729 }
1730 }
1731
1732 impl std::convert::From<&str> for PiAndJailbreakFilterEnforcement {
1733 fn from(value: &str) -> Self {
1734 use std::string::ToString;
1735 match value {
1736 "PI_AND_JAILBREAK_FILTER_ENFORCEMENT_UNSPECIFIED" => Self::Unspecified,
1737 "ENABLED" => Self::Enabled,
1738 "DISABLED" => Self::Disabled,
1739 _ => Self::UnknownValue(pi_and_jailbreak_filter_enforcement::UnknownValue(
1740 wkt::internal::UnknownEnumValue::String(value.to_string()),
1741 )),
1742 }
1743 }
1744 }
1745
1746 impl serde::ser::Serialize for PiAndJailbreakFilterEnforcement {
1747 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1748 where
1749 S: serde::Serializer,
1750 {
1751 match self {
1752 Self::Unspecified => serializer.serialize_i32(0),
1753 Self::Enabled => serializer.serialize_i32(1),
1754 Self::Disabled => serializer.serialize_i32(2),
1755 Self::UnknownValue(u) => u.0.serialize(serializer),
1756 }
1757 }
1758 }
1759
1760 impl<'de> serde::de::Deserialize<'de> for PiAndJailbreakFilterEnforcement {
1761 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1762 where
1763 D: serde::Deserializer<'de>,
1764 {
1765 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PiAndJailbreakFilterEnforcement>::new(
1766 ".google.cloud.modelarmor.v1.PiAndJailbreakFilterSettings.PiAndJailbreakFilterEnforcement"))
1767 }
1768 }
1769}
1770
1771#[derive(Clone, Default, PartialEq)]
1773#[non_exhaustive]
1774pub struct MaliciousUriFilterSettings {
1775 pub filter_enforcement:
1777 crate::model::malicious_uri_filter_settings::MaliciousUriFilterEnforcement,
1778
1779 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1780}
1781
1782impl MaliciousUriFilterSettings {
1783 pub fn new() -> Self {
1784 std::default::Default::default()
1785 }
1786
1787 pub fn set_filter_enforcement<
1789 T: std::convert::Into<
1790 crate::model::malicious_uri_filter_settings::MaliciousUriFilterEnforcement,
1791 >,
1792 >(
1793 mut self,
1794 v: T,
1795 ) -> Self {
1796 self.filter_enforcement = v.into();
1797 self
1798 }
1799}
1800
1801impl wkt::message::Message for MaliciousUriFilterSettings {
1802 fn typename() -> &'static str {
1803 "type.googleapis.com/google.cloud.modelarmor.v1.MaliciousUriFilterSettings"
1804 }
1805}
1806
1807pub mod malicious_uri_filter_settings {
1809 #[allow(unused_imports)]
1810 use super::*;
1811
1812 #[derive(Clone, Debug, PartialEq)]
1828 #[non_exhaustive]
1829 pub enum MaliciousUriFilterEnforcement {
1830 Unspecified,
1832 Enabled,
1834 Disabled,
1836 UnknownValue(malicious_uri_filter_enforcement::UnknownValue),
1841 }
1842
1843 #[doc(hidden)]
1844 pub mod malicious_uri_filter_enforcement {
1845 #[allow(unused_imports)]
1846 use super::*;
1847 #[derive(Clone, Debug, PartialEq)]
1848 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1849 }
1850
1851 impl MaliciousUriFilterEnforcement {
1852 pub fn value(&self) -> std::option::Option<i32> {
1857 match self {
1858 Self::Unspecified => std::option::Option::Some(0),
1859 Self::Enabled => std::option::Option::Some(1),
1860 Self::Disabled => std::option::Option::Some(2),
1861 Self::UnknownValue(u) => u.0.value(),
1862 }
1863 }
1864
1865 pub fn name(&self) -> std::option::Option<&str> {
1870 match self {
1871 Self::Unspecified => {
1872 std::option::Option::Some("MALICIOUS_URI_FILTER_ENFORCEMENT_UNSPECIFIED")
1873 }
1874 Self::Enabled => std::option::Option::Some("ENABLED"),
1875 Self::Disabled => std::option::Option::Some("DISABLED"),
1876 Self::UnknownValue(u) => u.0.name(),
1877 }
1878 }
1879 }
1880
1881 impl std::default::Default for MaliciousUriFilterEnforcement {
1882 fn default() -> Self {
1883 use std::convert::From;
1884 Self::from(0)
1885 }
1886 }
1887
1888 impl std::fmt::Display for MaliciousUriFilterEnforcement {
1889 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1890 wkt::internal::display_enum(f, self.name(), self.value())
1891 }
1892 }
1893
1894 impl std::convert::From<i32> for MaliciousUriFilterEnforcement {
1895 fn from(value: i32) -> Self {
1896 match value {
1897 0 => Self::Unspecified,
1898 1 => Self::Enabled,
1899 2 => Self::Disabled,
1900 _ => Self::UnknownValue(malicious_uri_filter_enforcement::UnknownValue(
1901 wkt::internal::UnknownEnumValue::Integer(value),
1902 )),
1903 }
1904 }
1905 }
1906
1907 impl std::convert::From<&str> for MaliciousUriFilterEnforcement {
1908 fn from(value: &str) -> Self {
1909 use std::string::ToString;
1910 match value {
1911 "MALICIOUS_URI_FILTER_ENFORCEMENT_UNSPECIFIED" => Self::Unspecified,
1912 "ENABLED" => Self::Enabled,
1913 "DISABLED" => Self::Disabled,
1914 _ => Self::UnknownValue(malicious_uri_filter_enforcement::UnknownValue(
1915 wkt::internal::UnknownEnumValue::String(value.to_string()),
1916 )),
1917 }
1918 }
1919 }
1920
1921 impl serde::ser::Serialize for MaliciousUriFilterEnforcement {
1922 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1923 where
1924 S: serde::Serializer,
1925 {
1926 match self {
1927 Self::Unspecified => serializer.serialize_i32(0),
1928 Self::Enabled => serializer.serialize_i32(1),
1929 Self::Disabled => serializer.serialize_i32(2),
1930 Self::UnknownValue(u) => u.0.serialize(serializer),
1931 }
1932 }
1933 }
1934
1935 impl<'de> serde::de::Deserialize<'de> for MaliciousUriFilterEnforcement {
1936 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1937 where
1938 D: serde::Deserializer<'de>,
1939 {
1940 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MaliciousUriFilterEnforcement>::new(
1941 ".google.cloud.modelarmor.v1.MaliciousUriFilterSettings.MaliciousUriFilterEnforcement"))
1942 }
1943 }
1944}
1945
1946#[derive(Clone, Default, PartialEq)]
1948#[non_exhaustive]
1949pub struct RaiFilterSettings {
1950 pub rai_filters: std::vec::Vec<crate::model::rai_filter_settings::RaiFilter>,
1952
1953 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1954}
1955
1956impl RaiFilterSettings {
1957 pub fn new() -> Self {
1958 std::default::Default::default()
1959 }
1960
1961 pub fn set_rai_filters<T, V>(mut self, v: T) -> Self
1963 where
1964 T: std::iter::IntoIterator<Item = V>,
1965 V: std::convert::Into<crate::model::rai_filter_settings::RaiFilter>,
1966 {
1967 use std::iter::Iterator;
1968 self.rai_filters = v.into_iter().map(|i| i.into()).collect();
1969 self
1970 }
1971}
1972
1973impl wkt::message::Message for RaiFilterSettings {
1974 fn typename() -> &'static str {
1975 "type.googleapis.com/google.cloud.modelarmor.v1.RaiFilterSettings"
1976 }
1977}
1978
1979pub mod rai_filter_settings {
1981 #[allow(unused_imports)]
1982 use super::*;
1983
1984 #[derive(Clone, Default, PartialEq)]
1986 #[non_exhaustive]
1987 pub struct RaiFilter {
1988 pub filter_type: crate::model::RaiFilterType,
1990
1991 pub confidence_level: crate::model::DetectionConfidenceLevel,
1997
1998 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1999 }
2000
2001 impl RaiFilter {
2002 pub fn new() -> Self {
2003 std::default::Default::default()
2004 }
2005
2006 pub fn set_filter_type<T: std::convert::Into<crate::model::RaiFilterType>>(
2008 mut self,
2009 v: T,
2010 ) -> Self {
2011 self.filter_type = v.into();
2012 self
2013 }
2014
2015 pub fn set_confidence_level<
2017 T: std::convert::Into<crate::model::DetectionConfidenceLevel>,
2018 >(
2019 mut self,
2020 v: T,
2021 ) -> Self {
2022 self.confidence_level = v.into();
2023 self
2024 }
2025 }
2026
2027 impl wkt::message::Message for RaiFilter {
2028 fn typename() -> &'static str {
2029 "type.googleapis.com/google.cloud.modelarmor.v1.RaiFilterSettings.RaiFilter"
2030 }
2031 }
2032}
2033
2034#[derive(Clone, Default, PartialEq)]
2036#[non_exhaustive]
2037pub struct SdpFilterSettings {
2038 pub sdp_configuration: std::option::Option<crate::model::sdp_filter_settings::SdpConfiguration>,
2040
2041 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2042}
2043
2044impl SdpFilterSettings {
2045 pub fn new() -> Self {
2046 std::default::Default::default()
2047 }
2048
2049 pub fn set_sdp_configuration<
2054 T: std::convert::Into<
2055 std::option::Option<crate::model::sdp_filter_settings::SdpConfiguration>,
2056 >,
2057 >(
2058 mut self,
2059 v: T,
2060 ) -> Self {
2061 self.sdp_configuration = v.into();
2062 self
2063 }
2064
2065 pub fn basic_config(
2069 &self,
2070 ) -> std::option::Option<&std::boxed::Box<crate::model::SdpBasicConfig>> {
2071 #[allow(unreachable_patterns)]
2072 self.sdp_configuration.as_ref().and_then(|v| match v {
2073 crate::model::sdp_filter_settings::SdpConfiguration::BasicConfig(v) => {
2074 std::option::Option::Some(v)
2075 }
2076 _ => std::option::Option::None,
2077 })
2078 }
2079
2080 pub fn set_basic_config<
2086 T: std::convert::Into<std::boxed::Box<crate::model::SdpBasicConfig>>,
2087 >(
2088 mut self,
2089 v: T,
2090 ) -> Self {
2091 self.sdp_configuration = std::option::Option::Some(
2092 crate::model::sdp_filter_settings::SdpConfiguration::BasicConfig(v.into()),
2093 );
2094 self
2095 }
2096
2097 pub fn advanced_config(
2101 &self,
2102 ) -> std::option::Option<&std::boxed::Box<crate::model::SdpAdvancedConfig>> {
2103 #[allow(unreachable_patterns)]
2104 self.sdp_configuration.as_ref().and_then(|v| match v {
2105 crate::model::sdp_filter_settings::SdpConfiguration::AdvancedConfig(v) => {
2106 std::option::Option::Some(v)
2107 }
2108 _ => std::option::Option::None,
2109 })
2110 }
2111
2112 pub fn set_advanced_config<
2118 T: std::convert::Into<std::boxed::Box<crate::model::SdpAdvancedConfig>>,
2119 >(
2120 mut self,
2121 v: T,
2122 ) -> Self {
2123 self.sdp_configuration = std::option::Option::Some(
2124 crate::model::sdp_filter_settings::SdpConfiguration::AdvancedConfig(v.into()),
2125 );
2126 self
2127 }
2128}
2129
2130impl wkt::message::Message for SdpFilterSettings {
2131 fn typename() -> &'static str {
2132 "type.googleapis.com/google.cloud.modelarmor.v1.SdpFilterSettings"
2133 }
2134}
2135
2136pub mod sdp_filter_settings {
2138 #[allow(unused_imports)]
2139 use super::*;
2140
2141 #[derive(Clone, Debug, PartialEq)]
2143 #[non_exhaustive]
2144 pub enum SdpConfiguration {
2145 BasicConfig(std::boxed::Box<crate::model::SdpBasicConfig>),
2151 AdvancedConfig(std::boxed::Box<crate::model::SdpAdvancedConfig>),
2155 }
2156}
2157
2158#[derive(Clone, Default, PartialEq)]
2160#[non_exhaustive]
2161pub struct SdpBasicConfig {
2162 pub filter_enforcement: crate::model::sdp_basic_config::SdpBasicConfigEnforcement,
2165
2166 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2167}
2168
2169impl SdpBasicConfig {
2170 pub fn new() -> Self {
2171 std::default::Default::default()
2172 }
2173
2174 pub fn set_filter_enforcement<
2176 T: std::convert::Into<crate::model::sdp_basic_config::SdpBasicConfigEnforcement>,
2177 >(
2178 mut self,
2179 v: T,
2180 ) -> Self {
2181 self.filter_enforcement = v.into();
2182 self
2183 }
2184}
2185
2186impl wkt::message::Message for SdpBasicConfig {
2187 fn typename() -> &'static str {
2188 "type.googleapis.com/google.cloud.modelarmor.v1.SdpBasicConfig"
2189 }
2190}
2191
2192pub mod sdp_basic_config {
2194 #[allow(unused_imports)]
2195 use super::*;
2196
2197 #[derive(Clone, Debug, PartialEq)]
2214 #[non_exhaustive]
2215 pub enum SdpBasicConfigEnforcement {
2216 Unspecified,
2218 Enabled,
2220 Disabled,
2222 UnknownValue(sdp_basic_config_enforcement::UnknownValue),
2227 }
2228
2229 #[doc(hidden)]
2230 pub mod sdp_basic_config_enforcement {
2231 #[allow(unused_imports)]
2232 use super::*;
2233 #[derive(Clone, Debug, PartialEq)]
2234 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2235 }
2236
2237 impl SdpBasicConfigEnforcement {
2238 pub fn value(&self) -> std::option::Option<i32> {
2243 match self {
2244 Self::Unspecified => std::option::Option::Some(0),
2245 Self::Enabled => std::option::Option::Some(1),
2246 Self::Disabled => std::option::Option::Some(2),
2247 Self::UnknownValue(u) => u.0.value(),
2248 }
2249 }
2250
2251 pub fn name(&self) -> std::option::Option<&str> {
2256 match self {
2257 Self::Unspecified => {
2258 std::option::Option::Some("SDP_BASIC_CONFIG_ENFORCEMENT_UNSPECIFIED")
2259 }
2260 Self::Enabled => std::option::Option::Some("ENABLED"),
2261 Self::Disabled => std::option::Option::Some("DISABLED"),
2262 Self::UnknownValue(u) => u.0.name(),
2263 }
2264 }
2265 }
2266
2267 impl std::default::Default for SdpBasicConfigEnforcement {
2268 fn default() -> Self {
2269 use std::convert::From;
2270 Self::from(0)
2271 }
2272 }
2273
2274 impl std::fmt::Display for SdpBasicConfigEnforcement {
2275 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2276 wkt::internal::display_enum(f, self.name(), self.value())
2277 }
2278 }
2279
2280 impl std::convert::From<i32> for SdpBasicConfigEnforcement {
2281 fn from(value: i32) -> Self {
2282 match value {
2283 0 => Self::Unspecified,
2284 1 => Self::Enabled,
2285 2 => Self::Disabled,
2286 _ => Self::UnknownValue(sdp_basic_config_enforcement::UnknownValue(
2287 wkt::internal::UnknownEnumValue::Integer(value),
2288 )),
2289 }
2290 }
2291 }
2292
2293 impl std::convert::From<&str> for SdpBasicConfigEnforcement {
2294 fn from(value: &str) -> Self {
2295 use std::string::ToString;
2296 match value {
2297 "SDP_BASIC_CONFIG_ENFORCEMENT_UNSPECIFIED" => Self::Unspecified,
2298 "ENABLED" => Self::Enabled,
2299 "DISABLED" => Self::Disabled,
2300 _ => Self::UnknownValue(sdp_basic_config_enforcement::UnknownValue(
2301 wkt::internal::UnknownEnumValue::String(value.to_string()),
2302 )),
2303 }
2304 }
2305 }
2306
2307 impl serde::ser::Serialize for SdpBasicConfigEnforcement {
2308 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2309 where
2310 S: serde::Serializer,
2311 {
2312 match self {
2313 Self::Unspecified => serializer.serialize_i32(0),
2314 Self::Enabled => serializer.serialize_i32(1),
2315 Self::Disabled => serializer.serialize_i32(2),
2316 Self::UnknownValue(u) => u.0.serialize(serializer),
2317 }
2318 }
2319 }
2320
2321 impl<'de> serde::de::Deserialize<'de> for SdpBasicConfigEnforcement {
2322 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2323 where
2324 D: serde::Deserializer<'de>,
2325 {
2326 deserializer.deserialize_any(
2327 wkt::internal::EnumVisitor::<SdpBasicConfigEnforcement>::new(
2328 ".google.cloud.modelarmor.v1.SdpBasicConfig.SdpBasicConfigEnforcement",
2329 ),
2330 )
2331 }
2332 }
2333}
2334
2335#[derive(Clone, Default, PartialEq)]
2337#[non_exhaustive]
2338pub struct SdpAdvancedConfig {
2339 pub inspect_template: std::string::String,
2349
2350 pub deidentify_template: std::string::String,
2362
2363 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2364}
2365
2366impl SdpAdvancedConfig {
2367 pub fn new() -> Self {
2368 std::default::Default::default()
2369 }
2370
2371 pub fn set_inspect_template<T: std::convert::Into<std::string::String>>(
2373 mut self,
2374 v: T,
2375 ) -> Self {
2376 self.inspect_template = v.into();
2377 self
2378 }
2379
2380 pub fn set_deidentify_template<T: std::convert::Into<std::string::String>>(
2382 mut self,
2383 v: T,
2384 ) -> Self {
2385 self.deidentify_template = v.into();
2386 self
2387 }
2388}
2389
2390impl wkt::message::Message for SdpAdvancedConfig {
2391 fn typename() -> &'static str {
2392 "type.googleapis.com/google.cloud.modelarmor.v1.SdpAdvancedConfig"
2393 }
2394}
2395
2396#[derive(Clone, Default, PartialEq)]
2398#[non_exhaustive]
2399pub struct SanitizeUserPromptRequest {
2400 pub name: std::string::String,
2403
2404 pub user_prompt_data: std::option::Option<crate::model::DataItem>,
2406
2407 pub multi_language_detection_metadata:
2409 std::option::Option<crate::model::MultiLanguageDetectionMetadata>,
2410
2411 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2412}
2413
2414impl SanitizeUserPromptRequest {
2415 pub fn new() -> Self {
2416 std::default::Default::default()
2417 }
2418
2419 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2421 self.name = v.into();
2422 self
2423 }
2424
2425 pub fn set_user_prompt_data<T>(mut self, v: T) -> Self
2427 where
2428 T: std::convert::Into<crate::model::DataItem>,
2429 {
2430 self.user_prompt_data = std::option::Option::Some(v.into());
2431 self
2432 }
2433
2434 pub fn set_or_clear_user_prompt_data<T>(mut self, v: std::option::Option<T>) -> Self
2436 where
2437 T: std::convert::Into<crate::model::DataItem>,
2438 {
2439 self.user_prompt_data = v.map(|x| x.into());
2440 self
2441 }
2442
2443 pub fn set_multi_language_detection_metadata<T>(mut self, v: T) -> Self
2445 where
2446 T: std::convert::Into<crate::model::MultiLanguageDetectionMetadata>,
2447 {
2448 self.multi_language_detection_metadata = std::option::Option::Some(v.into());
2449 self
2450 }
2451
2452 pub fn set_or_clear_multi_language_detection_metadata<T>(
2454 mut self,
2455 v: std::option::Option<T>,
2456 ) -> Self
2457 where
2458 T: std::convert::Into<crate::model::MultiLanguageDetectionMetadata>,
2459 {
2460 self.multi_language_detection_metadata = v.map(|x| x.into());
2461 self
2462 }
2463}
2464
2465impl wkt::message::Message for SanitizeUserPromptRequest {
2466 fn typename() -> &'static str {
2467 "type.googleapis.com/google.cloud.modelarmor.v1.SanitizeUserPromptRequest"
2468 }
2469}
2470
2471#[derive(Clone, Default, PartialEq)]
2473#[non_exhaustive]
2474pub struct SanitizeModelResponseRequest {
2475 pub name: std::string::String,
2478
2479 pub model_response_data: std::option::Option<crate::model::DataItem>,
2481
2482 pub user_prompt: std::string::String,
2484
2485 pub multi_language_detection_metadata:
2487 std::option::Option<crate::model::MultiLanguageDetectionMetadata>,
2488
2489 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2490}
2491
2492impl SanitizeModelResponseRequest {
2493 pub fn new() -> Self {
2494 std::default::Default::default()
2495 }
2496
2497 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2499 self.name = v.into();
2500 self
2501 }
2502
2503 pub fn set_model_response_data<T>(mut self, v: T) -> Self
2505 where
2506 T: std::convert::Into<crate::model::DataItem>,
2507 {
2508 self.model_response_data = std::option::Option::Some(v.into());
2509 self
2510 }
2511
2512 pub fn set_or_clear_model_response_data<T>(mut self, v: std::option::Option<T>) -> Self
2514 where
2515 T: std::convert::Into<crate::model::DataItem>,
2516 {
2517 self.model_response_data = v.map(|x| x.into());
2518 self
2519 }
2520
2521 pub fn set_user_prompt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2523 self.user_prompt = v.into();
2524 self
2525 }
2526
2527 pub fn set_multi_language_detection_metadata<T>(mut self, v: T) -> Self
2529 where
2530 T: std::convert::Into<crate::model::MultiLanguageDetectionMetadata>,
2531 {
2532 self.multi_language_detection_metadata = std::option::Option::Some(v.into());
2533 self
2534 }
2535
2536 pub fn set_or_clear_multi_language_detection_metadata<T>(
2538 mut self,
2539 v: std::option::Option<T>,
2540 ) -> Self
2541 where
2542 T: std::convert::Into<crate::model::MultiLanguageDetectionMetadata>,
2543 {
2544 self.multi_language_detection_metadata = v.map(|x| x.into());
2545 self
2546 }
2547}
2548
2549impl wkt::message::Message for SanitizeModelResponseRequest {
2550 fn typename() -> &'static str {
2551 "type.googleapis.com/google.cloud.modelarmor.v1.SanitizeModelResponseRequest"
2552 }
2553}
2554
2555#[derive(Clone, Default, PartialEq)]
2557#[non_exhaustive]
2558pub struct SanitizeUserPromptResponse {
2559 pub sanitization_result: std::option::Option<crate::model::SanitizationResult>,
2561
2562 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2563}
2564
2565impl SanitizeUserPromptResponse {
2566 pub fn new() -> Self {
2567 std::default::Default::default()
2568 }
2569
2570 pub fn set_sanitization_result<T>(mut self, v: T) -> Self
2572 where
2573 T: std::convert::Into<crate::model::SanitizationResult>,
2574 {
2575 self.sanitization_result = std::option::Option::Some(v.into());
2576 self
2577 }
2578
2579 pub fn set_or_clear_sanitization_result<T>(mut self, v: std::option::Option<T>) -> Self
2581 where
2582 T: std::convert::Into<crate::model::SanitizationResult>,
2583 {
2584 self.sanitization_result = v.map(|x| x.into());
2585 self
2586 }
2587}
2588
2589impl wkt::message::Message for SanitizeUserPromptResponse {
2590 fn typename() -> &'static str {
2591 "type.googleapis.com/google.cloud.modelarmor.v1.SanitizeUserPromptResponse"
2592 }
2593}
2594
2595#[derive(Clone, Default, PartialEq)]
2597#[non_exhaustive]
2598pub struct SanitizeModelResponseResponse {
2599 pub sanitization_result: std::option::Option<crate::model::SanitizationResult>,
2601
2602 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2603}
2604
2605impl SanitizeModelResponseResponse {
2606 pub fn new() -> Self {
2607 std::default::Default::default()
2608 }
2609
2610 pub fn set_sanitization_result<T>(mut self, v: T) -> Self
2612 where
2613 T: std::convert::Into<crate::model::SanitizationResult>,
2614 {
2615 self.sanitization_result = std::option::Option::Some(v.into());
2616 self
2617 }
2618
2619 pub fn set_or_clear_sanitization_result<T>(mut self, v: std::option::Option<T>) -> Self
2621 where
2622 T: std::convert::Into<crate::model::SanitizationResult>,
2623 {
2624 self.sanitization_result = v.map(|x| x.into());
2625 self
2626 }
2627}
2628
2629impl wkt::message::Message for SanitizeModelResponseResponse {
2630 fn typename() -> &'static str {
2631 "type.googleapis.com/google.cloud.modelarmor.v1.SanitizeModelResponseResponse"
2632 }
2633}
2634
2635#[derive(Clone, Default, PartialEq)]
2637#[non_exhaustive]
2638pub struct SanitizationResult {
2639 pub filter_match_state: crate::model::FilterMatchState,
2649
2650 pub filter_results: std::collections::HashMap<std::string::String, crate::model::FilterResult>,
2653
2654 pub invocation_result: crate::model::InvocationResult,
2659
2660 pub sanitization_metadata:
2662 std::option::Option<crate::model::sanitization_result::SanitizationMetadata>,
2663
2664 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2665}
2666
2667impl SanitizationResult {
2668 pub fn new() -> Self {
2669 std::default::Default::default()
2670 }
2671
2672 pub fn set_filter_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
2674 mut self,
2675 v: T,
2676 ) -> Self {
2677 self.filter_match_state = v.into();
2678 self
2679 }
2680
2681 pub fn set_filter_results<T, K, V>(mut self, v: T) -> Self
2683 where
2684 T: std::iter::IntoIterator<Item = (K, V)>,
2685 K: std::convert::Into<std::string::String>,
2686 V: std::convert::Into<crate::model::FilterResult>,
2687 {
2688 use std::iter::Iterator;
2689 self.filter_results = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2690 self
2691 }
2692
2693 pub fn set_invocation_result<T: std::convert::Into<crate::model::InvocationResult>>(
2695 mut self,
2696 v: T,
2697 ) -> Self {
2698 self.invocation_result = v.into();
2699 self
2700 }
2701
2702 pub fn set_sanitization_metadata<T>(mut self, v: T) -> Self
2704 where
2705 T: std::convert::Into<crate::model::sanitization_result::SanitizationMetadata>,
2706 {
2707 self.sanitization_metadata = std::option::Option::Some(v.into());
2708 self
2709 }
2710
2711 pub fn set_or_clear_sanitization_metadata<T>(mut self, v: std::option::Option<T>) -> Self
2713 where
2714 T: std::convert::Into<crate::model::sanitization_result::SanitizationMetadata>,
2715 {
2716 self.sanitization_metadata = v.map(|x| x.into());
2717 self
2718 }
2719}
2720
2721impl wkt::message::Message for SanitizationResult {
2722 fn typename() -> &'static str {
2723 "type.googleapis.com/google.cloud.modelarmor.v1.SanitizationResult"
2724 }
2725}
2726
2727pub mod sanitization_result {
2729 #[allow(unused_imports)]
2730 use super::*;
2731
2732 #[derive(Clone, Default, PartialEq)]
2734 #[non_exhaustive]
2735 pub struct SanitizationMetadata {
2736 pub error_code: i64,
2738
2739 pub error_message: std::string::String,
2741
2742 pub ignore_partial_invocation_failures: bool,
2745
2746 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2747 }
2748
2749 impl SanitizationMetadata {
2750 pub fn new() -> Self {
2751 std::default::Default::default()
2752 }
2753
2754 pub fn set_error_code<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
2756 self.error_code = v.into();
2757 self
2758 }
2759
2760 pub fn set_error_message<T: std::convert::Into<std::string::String>>(
2762 mut self,
2763 v: T,
2764 ) -> Self {
2765 self.error_message = v.into();
2766 self
2767 }
2768
2769 pub fn set_ignore_partial_invocation_failures<T: std::convert::Into<bool>>(
2771 mut self,
2772 v: T,
2773 ) -> Self {
2774 self.ignore_partial_invocation_failures = v.into();
2775 self
2776 }
2777 }
2778
2779 impl wkt::message::Message for SanitizationMetadata {
2780 fn typename() -> &'static str {
2781 "type.googleapis.com/google.cloud.modelarmor.v1.SanitizationResult.SanitizationMetadata"
2782 }
2783 }
2784}
2785
2786#[derive(Clone, Default, PartialEq)]
2788#[non_exhaustive]
2789pub struct MultiLanguageDetectionMetadata {
2790 pub source_language: std::string::String,
2795
2796 pub enable_multi_language_detection: bool,
2798
2799 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2800}
2801
2802impl MultiLanguageDetectionMetadata {
2803 pub fn new() -> Self {
2804 std::default::Default::default()
2805 }
2806
2807 pub fn set_source_language<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2809 self.source_language = v.into();
2810 self
2811 }
2812
2813 pub fn set_enable_multi_language_detection<T: std::convert::Into<bool>>(
2815 mut self,
2816 v: T,
2817 ) -> Self {
2818 self.enable_multi_language_detection = v.into();
2819 self
2820 }
2821}
2822
2823impl wkt::message::Message for MultiLanguageDetectionMetadata {
2824 fn typename() -> &'static str {
2825 "type.googleapis.com/google.cloud.modelarmor.v1.MultiLanguageDetectionMetadata"
2826 }
2827}
2828
2829#[derive(Clone, Default, PartialEq)]
2831#[non_exhaustive]
2832pub struct FilterResult {
2833 pub filter_result: std::option::Option<crate::model::filter_result::FilterResult>,
2837
2838 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2839}
2840
2841impl FilterResult {
2842 pub fn new() -> Self {
2843 std::default::Default::default()
2844 }
2845
2846 pub fn set_filter_result<
2851 T: std::convert::Into<std::option::Option<crate::model::filter_result::FilterResult>>,
2852 >(
2853 mut self,
2854 v: T,
2855 ) -> Self {
2856 self.filter_result = v.into();
2857 self
2858 }
2859
2860 pub fn rai_filter_result(
2864 &self,
2865 ) -> std::option::Option<&std::boxed::Box<crate::model::RaiFilterResult>> {
2866 #[allow(unreachable_patterns)]
2867 self.filter_result.as_ref().and_then(|v| match v {
2868 crate::model::filter_result::FilterResult::RaiFilterResult(v) => {
2869 std::option::Option::Some(v)
2870 }
2871 _ => std::option::Option::None,
2872 })
2873 }
2874
2875 pub fn set_rai_filter_result<
2881 T: std::convert::Into<std::boxed::Box<crate::model::RaiFilterResult>>,
2882 >(
2883 mut self,
2884 v: T,
2885 ) -> Self {
2886 self.filter_result = std::option::Option::Some(
2887 crate::model::filter_result::FilterResult::RaiFilterResult(v.into()),
2888 );
2889 self
2890 }
2891
2892 pub fn sdp_filter_result(
2896 &self,
2897 ) -> std::option::Option<&std::boxed::Box<crate::model::SdpFilterResult>> {
2898 #[allow(unreachable_patterns)]
2899 self.filter_result.as_ref().and_then(|v| match v {
2900 crate::model::filter_result::FilterResult::SdpFilterResult(v) => {
2901 std::option::Option::Some(v)
2902 }
2903 _ => std::option::Option::None,
2904 })
2905 }
2906
2907 pub fn set_sdp_filter_result<
2913 T: std::convert::Into<std::boxed::Box<crate::model::SdpFilterResult>>,
2914 >(
2915 mut self,
2916 v: T,
2917 ) -> Self {
2918 self.filter_result = std::option::Option::Some(
2919 crate::model::filter_result::FilterResult::SdpFilterResult(v.into()),
2920 );
2921 self
2922 }
2923
2924 pub fn pi_and_jailbreak_filter_result(
2928 &self,
2929 ) -> std::option::Option<&std::boxed::Box<crate::model::PiAndJailbreakFilterResult>> {
2930 #[allow(unreachable_patterns)]
2931 self.filter_result.as_ref().and_then(|v| match v {
2932 crate::model::filter_result::FilterResult::PiAndJailbreakFilterResult(v) => {
2933 std::option::Option::Some(v)
2934 }
2935 _ => std::option::Option::None,
2936 })
2937 }
2938
2939 pub fn set_pi_and_jailbreak_filter_result<
2945 T: std::convert::Into<std::boxed::Box<crate::model::PiAndJailbreakFilterResult>>,
2946 >(
2947 mut self,
2948 v: T,
2949 ) -> Self {
2950 self.filter_result = std::option::Option::Some(
2951 crate::model::filter_result::FilterResult::PiAndJailbreakFilterResult(v.into()),
2952 );
2953 self
2954 }
2955
2956 pub fn malicious_uri_filter_result(
2960 &self,
2961 ) -> std::option::Option<&std::boxed::Box<crate::model::MaliciousUriFilterResult>> {
2962 #[allow(unreachable_patterns)]
2963 self.filter_result.as_ref().and_then(|v| match v {
2964 crate::model::filter_result::FilterResult::MaliciousUriFilterResult(v) => {
2965 std::option::Option::Some(v)
2966 }
2967 _ => std::option::Option::None,
2968 })
2969 }
2970
2971 pub fn set_malicious_uri_filter_result<
2977 T: std::convert::Into<std::boxed::Box<crate::model::MaliciousUriFilterResult>>,
2978 >(
2979 mut self,
2980 v: T,
2981 ) -> Self {
2982 self.filter_result = std::option::Option::Some(
2983 crate::model::filter_result::FilterResult::MaliciousUriFilterResult(v.into()),
2984 );
2985 self
2986 }
2987
2988 pub fn csam_filter_filter_result(
2992 &self,
2993 ) -> std::option::Option<&std::boxed::Box<crate::model::CsamFilterResult>> {
2994 #[allow(unreachable_patterns)]
2995 self.filter_result.as_ref().and_then(|v| match v {
2996 crate::model::filter_result::FilterResult::CsamFilterFilterResult(v) => {
2997 std::option::Option::Some(v)
2998 }
2999 _ => std::option::Option::None,
3000 })
3001 }
3002
3003 pub fn set_csam_filter_filter_result<
3009 T: std::convert::Into<std::boxed::Box<crate::model::CsamFilterResult>>,
3010 >(
3011 mut self,
3012 v: T,
3013 ) -> Self {
3014 self.filter_result = std::option::Option::Some(
3015 crate::model::filter_result::FilterResult::CsamFilterFilterResult(v.into()),
3016 );
3017 self
3018 }
3019
3020 pub fn virus_scan_filter_result(
3024 &self,
3025 ) -> std::option::Option<&std::boxed::Box<crate::model::VirusScanFilterResult>> {
3026 #[allow(unreachable_patterns)]
3027 self.filter_result.as_ref().and_then(|v| match v {
3028 crate::model::filter_result::FilterResult::VirusScanFilterResult(v) => {
3029 std::option::Option::Some(v)
3030 }
3031 _ => std::option::Option::None,
3032 })
3033 }
3034
3035 pub fn set_virus_scan_filter_result<
3041 T: std::convert::Into<std::boxed::Box<crate::model::VirusScanFilterResult>>,
3042 >(
3043 mut self,
3044 v: T,
3045 ) -> Self {
3046 self.filter_result = std::option::Option::Some(
3047 crate::model::filter_result::FilterResult::VirusScanFilterResult(v.into()),
3048 );
3049 self
3050 }
3051}
3052
3053impl wkt::message::Message for FilterResult {
3054 fn typename() -> &'static str {
3055 "type.googleapis.com/google.cloud.modelarmor.v1.FilterResult"
3056 }
3057}
3058
3059pub mod filter_result {
3061 #[allow(unused_imports)]
3062 use super::*;
3063
3064 #[derive(Clone, Debug, PartialEq)]
3068 #[non_exhaustive]
3069 pub enum FilterResult {
3070 RaiFilterResult(std::boxed::Box<crate::model::RaiFilterResult>),
3072 SdpFilterResult(std::boxed::Box<crate::model::SdpFilterResult>),
3074 PiAndJailbreakFilterResult(std::boxed::Box<crate::model::PiAndJailbreakFilterResult>),
3076 MaliciousUriFilterResult(std::boxed::Box<crate::model::MaliciousUriFilterResult>),
3078 CsamFilterFilterResult(std::boxed::Box<crate::model::CsamFilterResult>),
3080 VirusScanFilterResult(std::boxed::Box<crate::model::VirusScanFilterResult>),
3082 }
3083}
3084
3085#[derive(Clone, Default, PartialEq)]
3087#[non_exhaustive]
3088pub struct RaiFilterResult {
3089 pub execution_state: crate::model::FilterExecutionState,
3092
3093 pub message_items: std::vec::Vec<crate::model::MessageItem>,
3098
3099 pub match_state: crate::model::FilterMatchState,
3103
3104 pub rai_filter_type_results: std::collections::HashMap<
3107 std::string::String,
3108 crate::model::rai_filter_result::RaiFilterTypeResult,
3109 >,
3110
3111 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3112}
3113
3114impl RaiFilterResult {
3115 pub fn new() -> Self {
3116 std::default::Default::default()
3117 }
3118
3119 pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
3121 mut self,
3122 v: T,
3123 ) -> Self {
3124 self.execution_state = v.into();
3125 self
3126 }
3127
3128 pub fn set_message_items<T, V>(mut self, v: T) -> Self
3130 where
3131 T: std::iter::IntoIterator<Item = V>,
3132 V: std::convert::Into<crate::model::MessageItem>,
3133 {
3134 use std::iter::Iterator;
3135 self.message_items = v.into_iter().map(|i| i.into()).collect();
3136 self
3137 }
3138
3139 pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
3141 mut self,
3142 v: T,
3143 ) -> Self {
3144 self.match_state = v.into();
3145 self
3146 }
3147
3148 pub fn set_rai_filter_type_results<T, K, V>(mut self, v: T) -> Self
3150 where
3151 T: std::iter::IntoIterator<Item = (K, V)>,
3152 K: std::convert::Into<std::string::String>,
3153 V: std::convert::Into<crate::model::rai_filter_result::RaiFilterTypeResult>,
3154 {
3155 use std::iter::Iterator;
3156 self.rai_filter_type_results = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3157 self
3158 }
3159}
3160
3161impl wkt::message::Message for RaiFilterResult {
3162 fn typename() -> &'static str {
3163 "type.googleapis.com/google.cloud.modelarmor.v1.RaiFilterResult"
3164 }
3165}
3166
3167pub mod rai_filter_result {
3169 #[allow(unused_imports)]
3170 use super::*;
3171
3172 #[derive(Clone, Default, PartialEq)]
3174 #[non_exhaustive]
3175 pub struct RaiFilterTypeResult {
3176 pub filter_type: crate::model::RaiFilterType,
3178
3179 pub confidence_level: crate::model::DetectionConfidenceLevel,
3181
3182 pub match_state: crate::model::FilterMatchState,
3184
3185 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3186 }
3187
3188 impl RaiFilterTypeResult {
3189 pub fn new() -> Self {
3190 std::default::Default::default()
3191 }
3192
3193 pub fn set_filter_type<T: std::convert::Into<crate::model::RaiFilterType>>(
3195 mut self,
3196 v: T,
3197 ) -> Self {
3198 self.filter_type = v.into();
3199 self
3200 }
3201
3202 pub fn set_confidence_level<
3204 T: std::convert::Into<crate::model::DetectionConfidenceLevel>,
3205 >(
3206 mut self,
3207 v: T,
3208 ) -> Self {
3209 self.confidence_level = v.into();
3210 self
3211 }
3212
3213 pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
3215 mut self,
3216 v: T,
3217 ) -> Self {
3218 self.match_state = v.into();
3219 self
3220 }
3221 }
3222
3223 impl wkt::message::Message for RaiFilterTypeResult {
3224 fn typename() -> &'static str {
3225 "type.googleapis.com/google.cloud.modelarmor.v1.RaiFilterResult.RaiFilterTypeResult"
3226 }
3227 }
3228}
3229
3230#[derive(Clone, Default, PartialEq)]
3232#[non_exhaustive]
3233pub struct SdpFilterResult {
3234 pub result: std::option::Option<crate::model::sdp_filter_result::Result>,
3236
3237 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3238}
3239
3240impl SdpFilterResult {
3241 pub fn new() -> Self {
3242 std::default::Default::default()
3243 }
3244
3245 pub fn set_result<
3250 T: std::convert::Into<std::option::Option<crate::model::sdp_filter_result::Result>>,
3251 >(
3252 mut self,
3253 v: T,
3254 ) -> Self {
3255 self.result = v.into();
3256 self
3257 }
3258
3259 pub fn inspect_result(
3263 &self,
3264 ) -> std::option::Option<&std::boxed::Box<crate::model::SdpInspectResult>> {
3265 #[allow(unreachable_patterns)]
3266 self.result.as_ref().and_then(|v| match v {
3267 crate::model::sdp_filter_result::Result::InspectResult(v) => {
3268 std::option::Option::Some(v)
3269 }
3270 _ => std::option::Option::None,
3271 })
3272 }
3273
3274 pub fn set_inspect_result<
3280 T: std::convert::Into<std::boxed::Box<crate::model::SdpInspectResult>>,
3281 >(
3282 mut self,
3283 v: T,
3284 ) -> Self {
3285 self.result = std::option::Option::Some(
3286 crate::model::sdp_filter_result::Result::InspectResult(v.into()),
3287 );
3288 self
3289 }
3290
3291 pub fn deidentify_result(
3295 &self,
3296 ) -> std::option::Option<&std::boxed::Box<crate::model::SdpDeidentifyResult>> {
3297 #[allow(unreachable_patterns)]
3298 self.result.as_ref().and_then(|v| match v {
3299 crate::model::sdp_filter_result::Result::DeidentifyResult(v) => {
3300 std::option::Option::Some(v)
3301 }
3302 _ => std::option::Option::None,
3303 })
3304 }
3305
3306 pub fn set_deidentify_result<
3312 T: std::convert::Into<std::boxed::Box<crate::model::SdpDeidentifyResult>>,
3313 >(
3314 mut self,
3315 v: T,
3316 ) -> Self {
3317 self.result = std::option::Option::Some(
3318 crate::model::sdp_filter_result::Result::DeidentifyResult(v.into()),
3319 );
3320 self
3321 }
3322}
3323
3324impl wkt::message::Message for SdpFilterResult {
3325 fn typename() -> &'static str {
3326 "type.googleapis.com/google.cloud.modelarmor.v1.SdpFilterResult"
3327 }
3328}
3329
3330pub mod sdp_filter_result {
3332 #[allow(unused_imports)]
3333 use super::*;
3334
3335 #[derive(Clone, Debug, PartialEq)]
3337 #[non_exhaustive]
3338 pub enum Result {
3339 InspectResult(std::boxed::Box<crate::model::SdpInspectResult>),
3341 DeidentifyResult(std::boxed::Box<crate::model::SdpDeidentifyResult>),
3344 }
3345}
3346
3347#[derive(Clone, Default, PartialEq)]
3349#[non_exhaustive]
3350pub struct SdpInspectResult {
3351 pub execution_state: crate::model::FilterExecutionState,
3354
3355 pub message_items: std::vec::Vec<crate::model::MessageItem>,
3360
3361 pub match_state: crate::model::FilterMatchState,
3365
3366 pub findings: std::vec::Vec<crate::model::SdpFinding>,
3368
3369 pub findings_truncated: bool,
3375
3376 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3377}
3378
3379impl SdpInspectResult {
3380 pub fn new() -> Self {
3381 std::default::Default::default()
3382 }
3383
3384 pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
3386 mut self,
3387 v: T,
3388 ) -> Self {
3389 self.execution_state = v.into();
3390 self
3391 }
3392
3393 pub fn set_message_items<T, V>(mut self, v: T) -> Self
3395 where
3396 T: std::iter::IntoIterator<Item = V>,
3397 V: std::convert::Into<crate::model::MessageItem>,
3398 {
3399 use std::iter::Iterator;
3400 self.message_items = v.into_iter().map(|i| i.into()).collect();
3401 self
3402 }
3403
3404 pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
3406 mut self,
3407 v: T,
3408 ) -> Self {
3409 self.match_state = v.into();
3410 self
3411 }
3412
3413 pub fn set_findings<T, V>(mut self, v: T) -> Self
3415 where
3416 T: std::iter::IntoIterator<Item = V>,
3417 V: std::convert::Into<crate::model::SdpFinding>,
3418 {
3419 use std::iter::Iterator;
3420 self.findings = v.into_iter().map(|i| i.into()).collect();
3421 self
3422 }
3423
3424 pub fn set_findings_truncated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3426 self.findings_truncated = v.into();
3427 self
3428 }
3429}
3430
3431impl wkt::message::Message for SdpInspectResult {
3432 fn typename() -> &'static str {
3433 "type.googleapis.com/google.cloud.modelarmor.v1.SdpInspectResult"
3434 }
3435}
3436
3437#[derive(Clone, Default, PartialEq)]
3439#[non_exhaustive]
3440pub struct DataItem {
3441 pub data_item: std::option::Option<crate::model::data_item::DataItem>,
3443
3444 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3445}
3446
3447impl DataItem {
3448 pub fn new() -> Self {
3449 std::default::Default::default()
3450 }
3451
3452 pub fn set_data_item<
3457 T: std::convert::Into<std::option::Option<crate::model::data_item::DataItem>>,
3458 >(
3459 mut self,
3460 v: T,
3461 ) -> Self {
3462 self.data_item = v.into();
3463 self
3464 }
3465
3466 pub fn text(&self) -> std::option::Option<&std::string::String> {
3470 #[allow(unreachable_patterns)]
3471 self.data_item.as_ref().and_then(|v| match v {
3472 crate::model::data_item::DataItem::Text(v) => std::option::Option::Some(v),
3473 _ => std::option::Option::None,
3474 })
3475 }
3476
3477 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3483 self.data_item =
3484 std::option::Option::Some(crate::model::data_item::DataItem::Text(v.into()));
3485 self
3486 }
3487
3488 pub fn byte_item(&self) -> std::option::Option<&std::boxed::Box<crate::model::ByteDataItem>> {
3492 #[allow(unreachable_patterns)]
3493 self.data_item.as_ref().and_then(|v| match v {
3494 crate::model::data_item::DataItem::ByteItem(v) => std::option::Option::Some(v),
3495 _ => std::option::Option::None,
3496 })
3497 }
3498
3499 pub fn set_byte_item<T: std::convert::Into<std::boxed::Box<crate::model::ByteDataItem>>>(
3505 mut self,
3506 v: T,
3507 ) -> Self {
3508 self.data_item =
3509 std::option::Option::Some(crate::model::data_item::DataItem::ByteItem(v.into()));
3510 self
3511 }
3512}
3513
3514impl wkt::message::Message for DataItem {
3515 fn typename() -> &'static str {
3516 "type.googleapis.com/google.cloud.modelarmor.v1.DataItem"
3517 }
3518}
3519
3520pub mod data_item {
3522 #[allow(unused_imports)]
3523 use super::*;
3524
3525 #[derive(Clone, Debug, PartialEq)]
3527 #[non_exhaustive]
3528 pub enum DataItem {
3529 Text(std::string::String),
3531 ByteItem(std::boxed::Box<crate::model::ByteDataItem>),
3533 }
3534}
3535
3536#[derive(Clone, Default, PartialEq)]
3538#[non_exhaustive]
3539pub struct ByteDataItem {
3540 pub byte_data_type: crate::model::byte_data_item::ByteItemType,
3542
3543 pub byte_data: ::bytes::Bytes,
3545
3546 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3547}
3548
3549impl ByteDataItem {
3550 pub fn new() -> Self {
3551 std::default::Default::default()
3552 }
3553
3554 pub fn set_byte_data_type<T: std::convert::Into<crate::model::byte_data_item::ByteItemType>>(
3556 mut self,
3557 v: T,
3558 ) -> Self {
3559 self.byte_data_type = v.into();
3560 self
3561 }
3562
3563 pub fn set_byte_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
3565 self.byte_data = v.into();
3566 self
3567 }
3568}
3569
3570impl wkt::message::Message for ByteDataItem {
3571 fn typename() -> &'static str {
3572 "type.googleapis.com/google.cloud.modelarmor.v1.ByteDataItem"
3573 }
3574}
3575
3576pub mod byte_data_item {
3578 #[allow(unused_imports)]
3579 use super::*;
3580
3581 #[derive(Clone, Debug, PartialEq)]
3597 #[non_exhaustive]
3598 pub enum ByteItemType {
3599 Unspecified,
3601 PlaintextUtf8,
3603 Pdf,
3605 WordDocument,
3607 ExcelDocument,
3609 PowerpointDocument,
3611 Txt,
3613 Csv,
3615 UnknownValue(byte_item_type::UnknownValue),
3620 }
3621
3622 #[doc(hidden)]
3623 pub mod byte_item_type {
3624 #[allow(unused_imports)]
3625 use super::*;
3626 #[derive(Clone, Debug, PartialEq)]
3627 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3628 }
3629
3630 impl ByteItemType {
3631 pub fn value(&self) -> std::option::Option<i32> {
3636 match self {
3637 Self::Unspecified => std::option::Option::Some(0),
3638 Self::PlaintextUtf8 => std::option::Option::Some(1),
3639 Self::Pdf => std::option::Option::Some(2),
3640 Self::WordDocument => std::option::Option::Some(3),
3641 Self::ExcelDocument => std::option::Option::Some(4),
3642 Self::PowerpointDocument => std::option::Option::Some(5),
3643 Self::Txt => std::option::Option::Some(6),
3644 Self::Csv => std::option::Option::Some(7),
3645 Self::UnknownValue(u) => u.0.value(),
3646 }
3647 }
3648
3649 pub fn name(&self) -> std::option::Option<&str> {
3654 match self {
3655 Self::Unspecified => std::option::Option::Some("BYTE_ITEM_TYPE_UNSPECIFIED"),
3656 Self::PlaintextUtf8 => std::option::Option::Some("PLAINTEXT_UTF8"),
3657 Self::Pdf => std::option::Option::Some("PDF"),
3658 Self::WordDocument => std::option::Option::Some("WORD_DOCUMENT"),
3659 Self::ExcelDocument => std::option::Option::Some("EXCEL_DOCUMENT"),
3660 Self::PowerpointDocument => std::option::Option::Some("POWERPOINT_DOCUMENT"),
3661 Self::Txt => std::option::Option::Some("TXT"),
3662 Self::Csv => std::option::Option::Some("CSV"),
3663 Self::UnknownValue(u) => u.0.name(),
3664 }
3665 }
3666 }
3667
3668 impl std::default::Default for ByteItemType {
3669 fn default() -> Self {
3670 use std::convert::From;
3671 Self::from(0)
3672 }
3673 }
3674
3675 impl std::fmt::Display for ByteItemType {
3676 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3677 wkt::internal::display_enum(f, self.name(), self.value())
3678 }
3679 }
3680
3681 impl std::convert::From<i32> for ByteItemType {
3682 fn from(value: i32) -> Self {
3683 match value {
3684 0 => Self::Unspecified,
3685 1 => Self::PlaintextUtf8,
3686 2 => Self::Pdf,
3687 3 => Self::WordDocument,
3688 4 => Self::ExcelDocument,
3689 5 => Self::PowerpointDocument,
3690 6 => Self::Txt,
3691 7 => Self::Csv,
3692 _ => Self::UnknownValue(byte_item_type::UnknownValue(
3693 wkt::internal::UnknownEnumValue::Integer(value),
3694 )),
3695 }
3696 }
3697 }
3698
3699 impl std::convert::From<&str> for ByteItemType {
3700 fn from(value: &str) -> Self {
3701 use std::string::ToString;
3702 match value {
3703 "BYTE_ITEM_TYPE_UNSPECIFIED" => Self::Unspecified,
3704 "PLAINTEXT_UTF8" => Self::PlaintextUtf8,
3705 "PDF" => Self::Pdf,
3706 "WORD_DOCUMENT" => Self::WordDocument,
3707 "EXCEL_DOCUMENT" => Self::ExcelDocument,
3708 "POWERPOINT_DOCUMENT" => Self::PowerpointDocument,
3709 "TXT" => Self::Txt,
3710 "CSV" => Self::Csv,
3711 _ => Self::UnknownValue(byte_item_type::UnknownValue(
3712 wkt::internal::UnknownEnumValue::String(value.to_string()),
3713 )),
3714 }
3715 }
3716 }
3717
3718 impl serde::ser::Serialize for ByteItemType {
3719 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3720 where
3721 S: serde::Serializer,
3722 {
3723 match self {
3724 Self::Unspecified => serializer.serialize_i32(0),
3725 Self::PlaintextUtf8 => serializer.serialize_i32(1),
3726 Self::Pdf => serializer.serialize_i32(2),
3727 Self::WordDocument => serializer.serialize_i32(3),
3728 Self::ExcelDocument => serializer.serialize_i32(4),
3729 Self::PowerpointDocument => serializer.serialize_i32(5),
3730 Self::Txt => serializer.serialize_i32(6),
3731 Self::Csv => serializer.serialize_i32(7),
3732 Self::UnknownValue(u) => u.0.serialize(serializer),
3733 }
3734 }
3735 }
3736
3737 impl<'de> serde::de::Deserialize<'de> for ByteItemType {
3738 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3739 where
3740 D: serde::Deserializer<'de>,
3741 {
3742 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ByteItemType>::new(
3743 ".google.cloud.modelarmor.v1.ByteDataItem.ByteItemType",
3744 ))
3745 }
3746 }
3747}
3748
3749#[derive(Clone, Default, PartialEq)]
3751#[non_exhaustive]
3752pub struct SdpDeidentifyResult {
3753 pub execution_state: crate::model::FilterExecutionState,
3756
3757 pub message_items: std::vec::Vec<crate::model::MessageItem>,
3762
3763 pub match_state: crate::model::FilterMatchState,
3766
3767 pub data: std::option::Option<crate::model::DataItem>,
3769
3770 pub transformed_bytes: i64,
3772
3773 pub info_types: std::vec::Vec<std::string::String>,
3775
3776 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3777}
3778
3779impl SdpDeidentifyResult {
3780 pub fn new() -> Self {
3781 std::default::Default::default()
3782 }
3783
3784 pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
3786 mut self,
3787 v: T,
3788 ) -> Self {
3789 self.execution_state = v.into();
3790 self
3791 }
3792
3793 pub fn set_message_items<T, V>(mut self, v: T) -> Self
3795 where
3796 T: std::iter::IntoIterator<Item = V>,
3797 V: std::convert::Into<crate::model::MessageItem>,
3798 {
3799 use std::iter::Iterator;
3800 self.message_items = v.into_iter().map(|i| i.into()).collect();
3801 self
3802 }
3803
3804 pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
3806 mut self,
3807 v: T,
3808 ) -> Self {
3809 self.match_state = v.into();
3810 self
3811 }
3812
3813 pub fn set_data<T>(mut self, v: T) -> Self
3815 where
3816 T: std::convert::Into<crate::model::DataItem>,
3817 {
3818 self.data = std::option::Option::Some(v.into());
3819 self
3820 }
3821
3822 pub fn set_or_clear_data<T>(mut self, v: std::option::Option<T>) -> Self
3824 where
3825 T: std::convert::Into<crate::model::DataItem>,
3826 {
3827 self.data = v.map(|x| x.into());
3828 self
3829 }
3830
3831 pub fn set_transformed_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3833 self.transformed_bytes = v.into();
3834 self
3835 }
3836
3837 pub fn set_info_types<T, V>(mut self, v: T) -> Self
3839 where
3840 T: std::iter::IntoIterator<Item = V>,
3841 V: std::convert::Into<std::string::String>,
3842 {
3843 use std::iter::Iterator;
3844 self.info_types = v.into_iter().map(|i| i.into()).collect();
3845 self
3846 }
3847}
3848
3849impl wkt::message::Message for SdpDeidentifyResult {
3850 fn typename() -> &'static str {
3851 "type.googleapis.com/google.cloud.modelarmor.v1.SdpDeidentifyResult"
3852 }
3853}
3854
3855#[derive(Clone, Default, PartialEq)]
3857#[non_exhaustive]
3858pub struct SdpFinding {
3859 pub info_type: std::string::String,
3861
3862 pub likelihood: crate::model::SdpFindingLikelihood,
3864
3865 pub location: std::option::Option<crate::model::sdp_finding::SdpFindingLocation>,
3867
3868 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3869}
3870
3871impl SdpFinding {
3872 pub fn new() -> Self {
3873 std::default::Default::default()
3874 }
3875
3876 pub fn set_info_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3878 self.info_type = v.into();
3879 self
3880 }
3881
3882 pub fn set_likelihood<T: std::convert::Into<crate::model::SdpFindingLikelihood>>(
3884 mut self,
3885 v: T,
3886 ) -> Self {
3887 self.likelihood = v.into();
3888 self
3889 }
3890
3891 pub fn set_location<T>(mut self, v: T) -> Self
3893 where
3894 T: std::convert::Into<crate::model::sdp_finding::SdpFindingLocation>,
3895 {
3896 self.location = std::option::Option::Some(v.into());
3897 self
3898 }
3899
3900 pub fn set_or_clear_location<T>(mut self, v: std::option::Option<T>) -> Self
3902 where
3903 T: std::convert::Into<crate::model::sdp_finding::SdpFindingLocation>,
3904 {
3905 self.location = v.map(|x| x.into());
3906 self
3907 }
3908}
3909
3910impl wkt::message::Message for SdpFinding {
3911 fn typename() -> &'static str {
3912 "type.googleapis.com/google.cloud.modelarmor.v1.SdpFinding"
3913 }
3914}
3915
3916pub mod sdp_finding {
3918 #[allow(unused_imports)]
3919 use super::*;
3920
3921 #[derive(Clone, Default, PartialEq)]
3923 #[non_exhaustive]
3924 pub struct SdpFindingLocation {
3925 pub byte_range: std::option::Option<crate::model::RangeInfo>,
3930
3931 pub codepoint_range: std::option::Option<crate::model::RangeInfo>,
3935
3936 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3937 }
3938
3939 impl SdpFindingLocation {
3940 pub fn new() -> Self {
3941 std::default::Default::default()
3942 }
3943
3944 pub fn set_byte_range<T>(mut self, v: T) -> Self
3946 where
3947 T: std::convert::Into<crate::model::RangeInfo>,
3948 {
3949 self.byte_range = std::option::Option::Some(v.into());
3950 self
3951 }
3952
3953 pub fn set_or_clear_byte_range<T>(mut self, v: std::option::Option<T>) -> Self
3955 where
3956 T: std::convert::Into<crate::model::RangeInfo>,
3957 {
3958 self.byte_range = v.map(|x| x.into());
3959 self
3960 }
3961
3962 pub fn set_codepoint_range<T>(mut self, v: T) -> Self
3964 where
3965 T: std::convert::Into<crate::model::RangeInfo>,
3966 {
3967 self.codepoint_range = std::option::Option::Some(v.into());
3968 self
3969 }
3970
3971 pub fn set_or_clear_codepoint_range<T>(mut self, v: std::option::Option<T>) -> Self
3973 where
3974 T: std::convert::Into<crate::model::RangeInfo>,
3975 {
3976 self.codepoint_range = v.map(|x| x.into());
3977 self
3978 }
3979 }
3980
3981 impl wkt::message::Message for SdpFindingLocation {
3982 fn typename() -> &'static str {
3983 "type.googleapis.com/google.cloud.modelarmor.v1.SdpFinding.SdpFindingLocation"
3984 }
3985 }
3986}
3987
3988#[derive(Clone, Default, PartialEq)]
3990#[non_exhaustive]
3991pub struct PiAndJailbreakFilterResult {
3992 pub execution_state: crate::model::FilterExecutionState,
3995
3996 pub message_items: std::vec::Vec<crate::model::MessageItem>,
4001
4002 pub match_state: crate::model::FilterMatchState,
4004
4005 pub confidence_level: crate::model::DetectionConfidenceLevel,
4007
4008 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4009}
4010
4011impl PiAndJailbreakFilterResult {
4012 pub fn new() -> Self {
4013 std::default::Default::default()
4014 }
4015
4016 pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
4018 mut self,
4019 v: T,
4020 ) -> Self {
4021 self.execution_state = v.into();
4022 self
4023 }
4024
4025 pub fn set_message_items<T, V>(mut self, v: T) -> Self
4027 where
4028 T: std::iter::IntoIterator<Item = V>,
4029 V: std::convert::Into<crate::model::MessageItem>,
4030 {
4031 use std::iter::Iterator;
4032 self.message_items = v.into_iter().map(|i| i.into()).collect();
4033 self
4034 }
4035
4036 pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
4038 mut self,
4039 v: T,
4040 ) -> Self {
4041 self.match_state = v.into();
4042 self
4043 }
4044
4045 pub fn set_confidence_level<T: std::convert::Into<crate::model::DetectionConfidenceLevel>>(
4047 mut self,
4048 v: T,
4049 ) -> Self {
4050 self.confidence_level = v.into();
4051 self
4052 }
4053}
4054
4055impl wkt::message::Message for PiAndJailbreakFilterResult {
4056 fn typename() -> &'static str {
4057 "type.googleapis.com/google.cloud.modelarmor.v1.PiAndJailbreakFilterResult"
4058 }
4059}
4060
4061#[derive(Clone, Default, PartialEq)]
4063#[non_exhaustive]
4064pub struct MaliciousUriFilterResult {
4065 pub execution_state: crate::model::FilterExecutionState,
4068
4069 pub message_items: std::vec::Vec<crate::model::MessageItem>,
4074
4075 pub match_state: crate::model::FilterMatchState,
4078
4079 pub malicious_uri_matched_items:
4081 std::vec::Vec<crate::model::malicious_uri_filter_result::MaliciousUriMatchedItem>,
4082
4083 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4084}
4085
4086impl MaliciousUriFilterResult {
4087 pub fn new() -> Self {
4088 std::default::Default::default()
4089 }
4090
4091 pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
4093 mut self,
4094 v: T,
4095 ) -> Self {
4096 self.execution_state = v.into();
4097 self
4098 }
4099
4100 pub fn set_message_items<T, V>(mut self, v: T) -> Self
4102 where
4103 T: std::iter::IntoIterator<Item = V>,
4104 V: std::convert::Into<crate::model::MessageItem>,
4105 {
4106 use std::iter::Iterator;
4107 self.message_items = v.into_iter().map(|i| i.into()).collect();
4108 self
4109 }
4110
4111 pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
4113 mut self,
4114 v: T,
4115 ) -> Self {
4116 self.match_state = v.into();
4117 self
4118 }
4119
4120 pub fn set_malicious_uri_matched_items<T, V>(mut self, v: T) -> Self
4122 where
4123 T: std::iter::IntoIterator<Item = V>,
4124 V: std::convert::Into<crate::model::malicious_uri_filter_result::MaliciousUriMatchedItem>,
4125 {
4126 use std::iter::Iterator;
4127 self.malicious_uri_matched_items = v.into_iter().map(|i| i.into()).collect();
4128 self
4129 }
4130}
4131
4132impl wkt::message::Message for MaliciousUriFilterResult {
4133 fn typename() -> &'static str {
4134 "type.googleapis.com/google.cloud.modelarmor.v1.MaliciousUriFilterResult"
4135 }
4136}
4137
4138pub mod malicious_uri_filter_result {
4140 #[allow(unused_imports)]
4141 use super::*;
4142
4143 #[derive(Clone, Default, PartialEq)]
4146 #[non_exhaustive]
4147 pub struct MaliciousUriMatchedItem {
4148 pub uri: std::string::String,
4150
4151 pub locations: std::vec::Vec<crate::model::RangeInfo>,
4155
4156 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4157 }
4158
4159 impl MaliciousUriMatchedItem {
4160 pub fn new() -> Self {
4161 std::default::Default::default()
4162 }
4163
4164 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4166 self.uri = v.into();
4167 self
4168 }
4169
4170 pub fn set_locations<T, V>(mut self, v: T) -> Self
4172 where
4173 T: std::iter::IntoIterator<Item = V>,
4174 V: std::convert::Into<crate::model::RangeInfo>,
4175 {
4176 use std::iter::Iterator;
4177 self.locations = v.into_iter().map(|i| i.into()).collect();
4178 self
4179 }
4180 }
4181
4182 impl wkt::message::Message for MaliciousUriMatchedItem {
4183 fn typename() -> &'static str {
4184 "type.googleapis.com/google.cloud.modelarmor.v1.MaliciousUriFilterResult.MaliciousUriMatchedItem"
4185 }
4186 }
4187}
4188
4189#[derive(Clone, Default, PartialEq)]
4191#[non_exhaustive]
4192pub struct VirusScanFilterResult {
4193 pub execution_state: crate::model::FilterExecutionState,
4195
4196 pub message_items: std::vec::Vec<crate::model::MessageItem>,
4201
4202 pub match_state: crate::model::FilterMatchState,
4205
4206 pub scanned_content_type: crate::model::virus_scan_filter_result::ScannedContentType,
4208
4209 pub scanned_size: std::option::Option<i64>,
4211
4212 pub virus_details: std::vec::Vec<crate::model::VirusDetail>,
4215
4216 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4217}
4218
4219impl VirusScanFilterResult {
4220 pub fn new() -> Self {
4221 std::default::Default::default()
4222 }
4223
4224 pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
4226 mut self,
4227 v: T,
4228 ) -> Self {
4229 self.execution_state = v.into();
4230 self
4231 }
4232
4233 pub fn set_message_items<T, V>(mut self, v: T) -> Self
4235 where
4236 T: std::iter::IntoIterator<Item = V>,
4237 V: std::convert::Into<crate::model::MessageItem>,
4238 {
4239 use std::iter::Iterator;
4240 self.message_items = v.into_iter().map(|i| i.into()).collect();
4241 self
4242 }
4243
4244 pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
4246 mut self,
4247 v: T,
4248 ) -> Self {
4249 self.match_state = v.into();
4250 self
4251 }
4252
4253 pub fn set_scanned_content_type<
4255 T: std::convert::Into<crate::model::virus_scan_filter_result::ScannedContentType>,
4256 >(
4257 mut self,
4258 v: T,
4259 ) -> Self {
4260 self.scanned_content_type = v.into();
4261 self
4262 }
4263
4264 pub fn set_scanned_size<T>(mut self, v: T) -> Self
4266 where
4267 T: std::convert::Into<i64>,
4268 {
4269 self.scanned_size = std::option::Option::Some(v.into());
4270 self
4271 }
4272
4273 pub fn set_or_clear_scanned_size<T>(mut self, v: std::option::Option<T>) -> Self
4275 where
4276 T: std::convert::Into<i64>,
4277 {
4278 self.scanned_size = v.map(|x| x.into());
4279 self
4280 }
4281
4282 pub fn set_virus_details<T, V>(mut self, v: T) -> Self
4284 where
4285 T: std::iter::IntoIterator<Item = V>,
4286 V: std::convert::Into<crate::model::VirusDetail>,
4287 {
4288 use std::iter::Iterator;
4289 self.virus_details = v.into_iter().map(|i| i.into()).collect();
4290 self
4291 }
4292}
4293
4294impl wkt::message::Message for VirusScanFilterResult {
4295 fn typename() -> &'static str {
4296 "type.googleapis.com/google.cloud.modelarmor.v1.VirusScanFilterResult"
4297 }
4298}
4299
4300pub mod virus_scan_filter_result {
4302 #[allow(unused_imports)]
4303 use super::*;
4304
4305 #[derive(Clone, Debug, PartialEq)]
4321 #[non_exhaustive]
4322 pub enum ScannedContentType {
4323 Unspecified,
4325 Unknown,
4327 Plaintext,
4329 Pdf,
4332 UnknownValue(scanned_content_type::UnknownValue),
4337 }
4338
4339 #[doc(hidden)]
4340 pub mod scanned_content_type {
4341 #[allow(unused_imports)]
4342 use super::*;
4343 #[derive(Clone, Debug, PartialEq)]
4344 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4345 }
4346
4347 impl ScannedContentType {
4348 pub fn value(&self) -> std::option::Option<i32> {
4353 match self {
4354 Self::Unspecified => std::option::Option::Some(0),
4355 Self::Unknown => std::option::Option::Some(1),
4356 Self::Plaintext => std::option::Option::Some(2),
4357 Self::Pdf => std::option::Option::Some(3),
4358 Self::UnknownValue(u) => u.0.value(),
4359 }
4360 }
4361
4362 pub fn name(&self) -> std::option::Option<&str> {
4367 match self {
4368 Self::Unspecified => std::option::Option::Some("SCANNED_CONTENT_TYPE_UNSPECIFIED"),
4369 Self::Unknown => std::option::Option::Some("UNKNOWN"),
4370 Self::Plaintext => std::option::Option::Some("PLAINTEXT"),
4371 Self::Pdf => std::option::Option::Some("PDF"),
4372 Self::UnknownValue(u) => u.0.name(),
4373 }
4374 }
4375 }
4376
4377 impl std::default::Default for ScannedContentType {
4378 fn default() -> Self {
4379 use std::convert::From;
4380 Self::from(0)
4381 }
4382 }
4383
4384 impl std::fmt::Display for ScannedContentType {
4385 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4386 wkt::internal::display_enum(f, self.name(), self.value())
4387 }
4388 }
4389
4390 impl std::convert::From<i32> for ScannedContentType {
4391 fn from(value: i32) -> Self {
4392 match value {
4393 0 => Self::Unspecified,
4394 1 => Self::Unknown,
4395 2 => Self::Plaintext,
4396 3 => Self::Pdf,
4397 _ => Self::UnknownValue(scanned_content_type::UnknownValue(
4398 wkt::internal::UnknownEnumValue::Integer(value),
4399 )),
4400 }
4401 }
4402 }
4403
4404 impl std::convert::From<&str> for ScannedContentType {
4405 fn from(value: &str) -> Self {
4406 use std::string::ToString;
4407 match value {
4408 "SCANNED_CONTENT_TYPE_UNSPECIFIED" => Self::Unspecified,
4409 "UNKNOWN" => Self::Unknown,
4410 "PLAINTEXT" => Self::Plaintext,
4411 "PDF" => Self::Pdf,
4412 _ => Self::UnknownValue(scanned_content_type::UnknownValue(
4413 wkt::internal::UnknownEnumValue::String(value.to_string()),
4414 )),
4415 }
4416 }
4417 }
4418
4419 impl serde::ser::Serialize for ScannedContentType {
4420 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4421 where
4422 S: serde::Serializer,
4423 {
4424 match self {
4425 Self::Unspecified => serializer.serialize_i32(0),
4426 Self::Unknown => serializer.serialize_i32(1),
4427 Self::Plaintext => serializer.serialize_i32(2),
4428 Self::Pdf => serializer.serialize_i32(3),
4429 Self::UnknownValue(u) => u.0.serialize(serializer),
4430 }
4431 }
4432 }
4433
4434 impl<'de> serde::de::Deserialize<'de> for ScannedContentType {
4435 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4436 where
4437 D: serde::Deserializer<'de>,
4438 {
4439 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ScannedContentType>::new(
4440 ".google.cloud.modelarmor.v1.VirusScanFilterResult.ScannedContentType",
4441 ))
4442 }
4443 }
4444}
4445
4446#[derive(Clone, Default, PartialEq)]
4448#[non_exhaustive]
4449pub struct VirusDetail {
4450 pub vendor: std::string::String,
4452
4453 pub names: std::vec::Vec<std::string::String>,
4455
4456 pub threat_type: crate::model::virus_detail::ThreatType,
4458
4459 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4460}
4461
4462impl VirusDetail {
4463 pub fn new() -> Self {
4464 std::default::Default::default()
4465 }
4466
4467 pub fn set_vendor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4469 self.vendor = v.into();
4470 self
4471 }
4472
4473 pub fn set_names<T, V>(mut self, v: T) -> Self
4475 where
4476 T: std::iter::IntoIterator<Item = V>,
4477 V: std::convert::Into<std::string::String>,
4478 {
4479 use std::iter::Iterator;
4480 self.names = v.into_iter().map(|i| i.into()).collect();
4481 self
4482 }
4483
4484 pub fn set_threat_type<T: std::convert::Into<crate::model::virus_detail::ThreatType>>(
4486 mut self,
4487 v: T,
4488 ) -> Self {
4489 self.threat_type = v.into();
4490 self
4491 }
4492}
4493
4494impl wkt::message::Message for VirusDetail {
4495 fn typename() -> &'static str {
4496 "type.googleapis.com/google.cloud.modelarmor.v1.VirusDetail"
4497 }
4498}
4499
4500pub mod virus_detail {
4502 #[allow(unused_imports)]
4503 use super::*;
4504
4505 #[derive(Clone, Debug, PartialEq)]
4521 #[non_exhaustive]
4522 pub enum ThreatType {
4523 Unspecified,
4525 Unknown,
4527 VirusOrWorm,
4529 MaliciousProgram,
4531 PotentiallyHarmfulContent,
4533 PotentiallyUnwantedContent,
4535 UnknownValue(threat_type::UnknownValue),
4540 }
4541
4542 #[doc(hidden)]
4543 pub mod threat_type {
4544 #[allow(unused_imports)]
4545 use super::*;
4546 #[derive(Clone, Debug, PartialEq)]
4547 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4548 }
4549
4550 impl ThreatType {
4551 pub fn value(&self) -> std::option::Option<i32> {
4556 match self {
4557 Self::Unspecified => std::option::Option::Some(0),
4558 Self::Unknown => std::option::Option::Some(1),
4559 Self::VirusOrWorm => std::option::Option::Some(2),
4560 Self::MaliciousProgram => std::option::Option::Some(3),
4561 Self::PotentiallyHarmfulContent => std::option::Option::Some(4),
4562 Self::PotentiallyUnwantedContent => std::option::Option::Some(5),
4563 Self::UnknownValue(u) => u.0.value(),
4564 }
4565 }
4566
4567 pub fn name(&self) -> std::option::Option<&str> {
4572 match self {
4573 Self::Unspecified => std::option::Option::Some("THREAT_TYPE_UNSPECIFIED"),
4574 Self::Unknown => std::option::Option::Some("UNKNOWN"),
4575 Self::VirusOrWorm => std::option::Option::Some("VIRUS_OR_WORM"),
4576 Self::MaliciousProgram => std::option::Option::Some("MALICIOUS_PROGRAM"),
4577 Self::PotentiallyHarmfulContent => {
4578 std::option::Option::Some("POTENTIALLY_HARMFUL_CONTENT")
4579 }
4580 Self::PotentiallyUnwantedContent => {
4581 std::option::Option::Some("POTENTIALLY_UNWANTED_CONTENT")
4582 }
4583 Self::UnknownValue(u) => u.0.name(),
4584 }
4585 }
4586 }
4587
4588 impl std::default::Default for ThreatType {
4589 fn default() -> Self {
4590 use std::convert::From;
4591 Self::from(0)
4592 }
4593 }
4594
4595 impl std::fmt::Display for ThreatType {
4596 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4597 wkt::internal::display_enum(f, self.name(), self.value())
4598 }
4599 }
4600
4601 impl std::convert::From<i32> for ThreatType {
4602 fn from(value: i32) -> Self {
4603 match value {
4604 0 => Self::Unspecified,
4605 1 => Self::Unknown,
4606 2 => Self::VirusOrWorm,
4607 3 => Self::MaliciousProgram,
4608 4 => Self::PotentiallyHarmfulContent,
4609 5 => Self::PotentiallyUnwantedContent,
4610 _ => Self::UnknownValue(threat_type::UnknownValue(
4611 wkt::internal::UnknownEnumValue::Integer(value),
4612 )),
4613 }
4614 }
4615 }
4616
4617 impl std::convert::From<&str> for ThreatType {
4618 fn from(value: &str) -> Self {
4619 use std::string::ToString;
4620 match value {
4621 "THREAT_TYPE_UNSPECIFIED" => Self::Unspecified,
4622 "UNKNOWN" => Self::Unknown,
4623 "VIRUS_OR_WORM" => Self::VirusOrWorm,
4624 "MALICIOUS_PROGRAM" => Self::MaliciousProgram,
4625 "POTENTIALLY_HARMFUL_CONTENT" => Self::PotentiallyHarmfulContent,
4626 "POTENTIALLY_UNWANTED_CONTENT" => Self::PotentiallyUnwantedContent,
4627 _ => Self::UnknownValue(threat_type::UnknownValue(
4628 wkt::internal::UnknownEnumValue::String(value.to_string()),
4629 )),
4630 }
4631 }
4632 }
4633
4634 impl serde::ser::Serialize for ThreatType {
4635 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4636 where
4637 S: serde::Serializer,
4638 {
4639 match self {
4640 Self::Unspecified => serializer.serialize_i32(0),
4641 Self::Unknown => serializer.serialize_i32(1),
4642 Self::VirusOrWorm => serializer.serialize_i32(2),
4643 Self::MaliciousProgram => serializer.serialize_i32(3),
4644 Self::PotentiallyHarmfulContent => serializer.serialize_i32(4),
4645 Self::PotentiallyUnwantedContent => serializer.serialize_i32(5),
4646 Self::UnknownValue(u) => u.0.serialize(serializer),
4647 }
4648 }
4649 }
4650
4651 impl<'de> serde::de::Deserialize<'de> for ThreatType {
4652 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4653 where
4654 D: serde::Deserializer<'de>,
4655 {
4656 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ThreatType>::new(
4657 ".google.cloud.modelarmor.v1.VirusDetail.ThreatType",
4658 ))
4659 }
4660 }
4661}
4662
4663#[derive(Clone, Default, PartialEq)]
4665#[non_exhaustive]
4666pub struct CsamFilterResult {
4667 pub execution_state: crate::model::FilterExecutionState,
4670
4671 pub message_items: std::vec::Vec<crate::model::MessageItem>,
4676
4677 pub match_state: crate::model::FilterMatchState,
4679
4680 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4681}
4682
4683impl CsamFilterResult {
4684 pub fn new() -> Self {
4685 std::default::Default::default()
4686 }
4687
4688 pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
4690 mut self,
4691 v: T,
4692 ) -> Self {
4693 self.execution_state = v.into();
4694 self
4695 }
4696
4697 pub fn set_message_items<T, V>(mut self, v: T) -> Self
4699 where
4700 T: std::iter::IntoIterator<Item = V>,
4701 V: std::convert::Into<crate::model::MessageItem>,
4702 {
4703 use std::iter::Iterator;
4704 self.message_items = v.into_iter().map(|i| i.into()).collect();
4705 self
4706 }
4707
4708 pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
4710 mut self,
4711 v: T,
4712 ) -> Self {
4713 self.match_state = v.into();
4714 self
4715 }
4716}
4717
4718impl wkt::message::Message for CsamFilterResult {
4719 fn typename() -> &'static str {
4720 "type.googleapis.com/google.cloud.modelarmor.v1.CsamFilterResult"
4721 }
4722}
4723
4724#[derive(Clone, Default, PartialEq)]
4726#[non_exhaustive]
4727pub struct MessageItem {
4728 pub message_type: crate::model::message_item::MessageType,
4730
4731 pub message: std::string::String,
4733
4734 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4735}
4736
4737impl MessageItem {
4738 pub fn new() -> Self {
4739 std::default::Default::default()
4740 }
4741
4742 pub fn set_message_type<T: std::convert::Into<crate::model::message_item::MessageType>>(
4744 mut self,
4745 v: T,
4746 ) -> Self {
4747 self.message_type = v.into();
4748 self
4749 }
4750
4751 pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4753 self.message = v.into();
4754 self
4755 }
4756}
4757
4758impl wkt::message::Message for MessageItem {
4759 fn typename() -> &'static str {
4760 "type.googleapis.com/google.cloud.modelarmor.v1.MessageItem"
4761 }
4762}
4763
4764pub mod message_item {
4766 #[allow(unused_imports)]
4767 use super::*;
4768
4769 #[derive(Clone, Debug, PartialEq)]
4785 #[non_exhaustive]
4786 pub enum MessageType {
4787 Unspecified,
4789 Info,
4791 Warning,
4793 Error,
4795 UnknownValue(message_type::UnknownValue),
4800 }
4801
4802 #[doc(hidden)]
4803 pub mod message_type {
4804 #[allow(unused_imports)]
4805 use super::*;
4806 #[derive(Clone, Debug, PartialEq)]
4807 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4808 }
4809
4810 impl MessageType {
4811 pub fn value(&self) -> std::option::Option<i32> {
4816 match self {
4817 Self::Unspecified => std::option::Option::Some(0),
4818 Self::Info => std::option::Option::Some(1),
4819 Self::Warning => std::option::Option::Some(2),
4820 Self::Error => std::option::Option::Some(3),
4821 Self::UnknownValue(u) => u.0.value(),
4822 }
4823 }
4824
4825 pub fn name(&self) -> std::option::Option<&str> {
4830 match self {
4831 Self::Unspecified => std::option::Option::Some("MESSAGE_TYPE_UNSPECIFIED"),
4832 Self::Info => std::option::Option::Some("INFO"),
4833 Self::Warning => std::option::Option::Some("WARNING"),
4834 Self::Error => std::option::Option::Some("ERROR"),
4835 Self::UnknownValue(u) => u.0.name(),
4836 }
4837 }
4838 }
4839
4840 impl std::default::Default for MessageType {
4841 fn default() -> Self {
4842 use std::convert::From;
4843 Self::from(0)
4844 }
4845 }
4846
4847 impl std::fmt::Display for MessageType {
4848 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4849 wkt::internal::display_enum(f, self.name(), self.value())
4850 }
4851 }
4852
4853 impl std::convert::From<i32> for MessageType {
4854 fn from(value: i32) -> Self {
4855 match value {
4856 0 => Self::Unspecified,
4857 1 => Self::Info,
4858 2 => Self::Warning,
4859 3 => Self::Error,
4860 _ => Self::UnknownValue(message_type::UnknownValue(
4861 wkt::internal::UnknownEnumValue::Integer(value),
4862 )),
4863 }
4864 }
4865 }
4866
4867 impl std::convert::From<&str> for MessageType {
4868 fn from(value: &str) -> Self {
4869 use std::string::ToString;
4870 match value {
4871 "MESSAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
4872 "INFO" => Self::Info,
4873 "WARNING" => Self::Warning,
4874 "ERROR" => Self::Error,
4875 _ => Self::UnknownValue(message_type::UnknownValue(
4876 wkt::internal::UnknownEnumValue::String(value.to_string()),
4877 )),
4878 }
4879 }
4880 }
4881
4882 impl serde::ser::Serialize for MessageType {
4883 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4884 where
4885 S: serde::Serializer,
4886 {
4887 match self {
4888 Self::Unspecified => serializer.serialize_i32(0),
4889 Self::Info => serializer.serialize_i32(1),
4890 Self::Warning => serializer.serialize_i32(2),
4891 Self::Error => serializer.serialize_i32(3),
4892 Self::UnknownValue(u) => u.0.serialize(serializer),
4893 }
4894 }
4895 }
4896
4897 impl<'de> serde::de::Deserialize<'de> for MessageType {
4898 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4899 where
4900 D: serde::Deserializer<'de>,
4901 {
4902 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MessageType>::new(
4903 ".google.cloud.modelarmor.v1.MessageItem.MessageType",
4904 ))
4905 }
4906 }
4907}
4908
4909#[derive(Clone, Default, PartialEq)]
4911#[non_exhaustive]
4912pub struct RangeInfo {
4913 pub start: std::option::Option<i64>,
4917
4918 pub end: std::option::Option<i64>,
4920
4921 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4922}
4923
4924impl RangeInfo {
4925 pub fn new() -> Self {
4926 std::default::Default::default()
4927 }
4928
4929 pub fn set_start<T>(mut self, v: T) -> Self
4931 where
4932 T: std::convert::Into<i64>,
4933 {
4934 self.start = std::option::Option::Some(v.into());
4935 self
4936 }
4937
4938 pub fn set_or_clear_start<T>(mut self, v: std::option::Option<T>) -> Self
4940 where
4941 T: std::convert::Into<i64>,
4942 {
4943 self.start = v.map(|x| x.into());
4944 self
4945 }
4946
4947 pub fn set_end<T>(mut self, v: T) -> Self
4949 where
4950 T: std::convert::Into<i64>,
4951 {
4952 self.end = std::option::Option::Some(v.into());
4953 self
4954 }
4955
4956 pub fn set_or_clear_end<T>(mut self, v: std::option::Option<T>) -> Self
4958 where
4959 T: std::convert::Into<i64>,
4960 {
4961 self.end = v.map(|x| x.into());
4962 self
4963 }
4964}
4965
4966impl wkt::message::Message for RangeInfo {
4967 fn typename() -> &'static str {
4968 "type.googleapis.com/google.cloud.modelarmor.v1.RangeInfo"
4969 }
4970}
4971
4972#[derive(Clone, Debug, PartialEq)]
4988#[non_exhaustive]
4989pub enum FilterMatchState {
4990 Unspecified,
4992 NoMatchFound,
4994 MatchFound,
4996 UnknownValue(filter_match_state::UnknownValue),
5001}
5002
5003#[doc(hidden)]
5004pub mod filter_match_state {
5005 #[allow(unused_imports)]
5006 use super::*;
5007 #[derive(Clone, Debug, PartialEq)]
5008 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5009}
5010
5011impl FilterMatchState {
5012 pub fn value(&self) -> std::option::Option<i32> {
5017 match self {
5018 Self::Unspecified => std::option::Option::Some(0),
5019 Self::NoMatchFound => std::option::Option::Some(1),
5020 Self::MatchFound => std::option::Option::Some(2),
5021 Self::UnknownValue(u) => u.0.value(),
5022 }
5023 }
5024
5025 pub fn name(&self) -> std::option::Option<&str> {
5030 match self {
5031 Self::Unspecified => std::option::Option::Some("FILTER_MATCH_STATE_UNSPECIFIED"),
5032 Self::NoMatchFound => std::option::Option::Some("NO_MATCH_FOUND"),
5033 Self::MatchFound => std::option::Option::Some("MATCH_FOUND"),
5034 Self::UnknownValue(u) => u.0.name(),
5035 }
5036 }
5037}
5038
5039impl std::default::Default for FilterMatchState {
5040 fn default() -> Self {
5041 use std::convert::From;
5042 Self::from(0)
5043 }
5044}
5045
5046impl std::fmt::Display for FilterMatchState {
5047 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5048 wkt::internal::display_enum(f, self.name(), self.value())
5049 }
5050}
5051
5052impl std::convert::From<i32> for FilterMatchState {
5053 fn from(value: i32) -> Self {
5054 match value {
5055 0 => Self::Unspecified,
5056 1 => Self::NoMatchFound,
5057 2 => Self::MatchFound,
5058 _ => Self::UnknownValue(filter_match_state::UnknownValue(
5059 wkt::internal::UnknownEnumValue::Integer(value),
5060 )),
5061 }
5062 }
5063}
5064
5065impl std::convert::From<&str> for FilterMatchState {
5066 fn from(value: &str) -> Self {
5067 use std::string::ToString;
5068 match value {
5069 "FILTER_MATCH_STATE_UNSPECIFIED" => Self::Unspecified,
5070 "NO_MATCH_FOUND" => Self::NoMatchFound,
5071 "MATCH_FOUND" => Self::MatchFound,
5072 _ => Self::UnknownValue(filter_match_state::UnknownValue(
5073 wkt::internal::UnknownEnumValue::String(value.to_string()),
5074 )),
5075 }
5076 }
5077}
5078
5079impl serde::ser::Serialize for FilterMatchState {
5080 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5081 where
5082 S: serde::Serializer,
5083 {
5084 match self {
5085 Self::Unspecified => serializer.serialize_i32(0),
5086 Self::NoMatchFound => serializer.serialize_i32(1),
5087 Self::MatchFound => serializer.serialize_i32(2),
5088 Self::UnknownValue(u) => u.0.serialize(serializer),
5089 }
5090 }
5091}
5092
5093impl<'de> serde::de::Deserialize<'de> for FilterMatchState {
5094 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5095 where
5096 D: serde::Deserializer<'de>,
5097 {
5098 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FilterMatchState>::new(
5099 ".google.cloud.modelarmor.v1.FilterMatchState",
5100 ))
5101 }
5102}
5103
5104#[derive(Clone, Debug, PartialEq)]
5120#[non_exhaustive]
5121pub enum FilterExecutionState {
5122 Unspecified,
5124 ExecutionSuccess,
5126 ExecutionSkipped,
5129 UnknownValue(filter_execution_state::UnknownValue),
5134}
5135
5136#[doc(hidden)]
5137pub mod filter_execution_state {
5138 #[allow(unused_imports)]
5139 use super::*;
5140 #[derive(Clone, Debug, PartialEq)]
5141 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5142}
5143
5144impl FilterExecutionState {
5145 pub fn value(&self) -> std::option::Option<i32> {
5150 match self {
5151 Self::Unspecified => std::option::Option::Some(0),
5152 Self::ExecutionSuccess => std::option::Option::Some(1),
5153 Self::ExecutionSkipped => std::option::Option::Some(2),
5154 Self::UnknownValue(u) => u.0.value(),
5155 }
5156 }
5157
5158 pub fn name(&self) -> std::option::Option<&str> {
5163 match self {
5164 Self::Unspecified => std::option::Option::Some("FILTER_EXECUTION_STATE_UNSPECIFIED"),
5165 Self::ExecutionSuccess => std::option::Option::Some("EXECUTION_SUCCESS"),
5166 Self::ExecutionSkipped => std::option::Option::Some("EXECUTION_SKIPPED"),
5167 Self::UnknownValue(u) => u.0.name(),
5168 }
5169 }
5170}
5171
5172impl std::default::Default for FilterExecutionState {
5173 fn default() -> Self {
5174 use std::convert::From;
5175 Self::from(0)
5176 }
5177}
5178
5179impl std::fmt::Display for FilterExecutionState {
5180 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5181 wkt::internal::display_enum(f, self.name(), self.value())
5182 }
5183}
5184
5185impl std::convert::From<i32> for FilterExecutionState {
5186 fn from(value: i32) -> Self {
5187 match value {
5188 0 => Self::Unspecified,
5189 1 => Self::ExecutionSuccess,
5190 2 => Self::ExecutionSkipped,
5191 _ => Self::UnknownValue(filter_execution_state::UnknownValue(
5192 wkt::internal::UnknownEnumValue::Integer(value),
5193 )),
5194 }
5195 }
5196}
5197
5198impl std::convert::From<&str> for FilterExecutionState {
5199 fn from(value: &str) -> Self {
5200 use std::string::ToString;
5201 match value {
5202 "FILTER_EXECUTION_STATE_UNSPECIFIED" => Self::Unspecified,
5203 "EXECUTION_SUCCESS" => Self::ExecutionSuccess,
5204 "EXECUTION_SKIPPED" => Self::ExecutionSkipped,
5205 _ => Self::UnknownValue(filter_execution_state::UnknownValue(
5206 wkt::internal::UnknownEnumValue::String(value.to_string()),
5207 )),
5208 }
5209 }
5210}
5211
5212impl serde::ser::Serialize for FilterExecutionState {
5213 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5214 where
5215 S: serde::Serializer,
5216 {
5217 match self {
5218 Self::Unspecified => serializer.serialize_i32(0),
5219 Self::ExecutionSuccess => serializer.serialize_i32(1),
5220 Self::ExecutionSkipped => serializer.serialize_i32(2),
5221 Self::UnknownValue(u) => u.0.serialize(serializer),
5222 }
5223 }
5224}
5225
5226impl<'de> serde::de::Deserialize<'de> for FilterExecutionState {
5227 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5228 where
5229 D: serde::Deserializer<'de>,
5230 {
5231 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FilterExecutionState>::new(
5232 ".google.cloud.modelarmor.v1.FilterExecutionState",
5233 ))
5234 }
5235}
5236
5237#[derive(Clone, Debug, PartialEq)]
5253#[non_exhaustive]
5254pub enum RaiFilterType {
5255 Unspecified,
5257 SexuallyExplicit,
5259 HateSpeech,
5261 Harassment,
5263 Dangerous,
5265 UnknownValue(rai_filter_type::UnknownValue),
5270}
5271
5272#[doc(hidden)]
5273pub mod rai_filter_type {
5274 #[allow(unused_imports)]
5275 use super::*;
5276 #[derive(Clone, Debug, PartialEq)]
5277 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5278}
5279
5280impl RaiFilterType {
5281 pub fn value(&self) -> std::option::Option<i32> {
5286 match self {
5287 Self::Unspecified => std::option::Option::Some(0),
5288 Self::SexuallyExplicit => std::option::Option::Some(2),
5289 Self::HateSpeech => std::option::Option::Some(3),
5290 Self::Harassment => std::option::Option::Some(6),
5291 Self::Dangerous => std::option::Option::Some(17),
5292 Self::UnknownValue(u) => u.0.value(),
5293 }
5294 }
5295
5296 pub fn name(&self) -> std::option::Option<&str> {
5301 match self {
5302 Self::Unspecified => std::option::Option::Some("RAI_FILTER_TYPE_UNSPECIFIED"),
5303 Self::SexuallyExplicit => std::option::Option::Some("SEXUALLY_EXPLICIT"),
5304 Self::HateSpeech => std::option::Option::Some("HATE_SPEECH"),
5305 Self::Harassment => std::option::Option::Some("HARASSMENT"),
5306 Self::Dangerous => std::option::Option::Some("DANGEROUS"),
5307 Self::UnknownValue(u) => u.0.name(),
5308 }
5309 }
5310}
5311
5312impl std::default::Default for RaiFilterType {
5313 fn default() -> Self {
5314 use std::convert::From;
5315 Self::from(0)
5316 }
5317}
5318
5319impl std::fmt::Display for RaiFilterType {
5320 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5321 wkt::internal::display_enum(f, self.name(), self.value())
5322 }
5323}
5324
5325impl std::convert::From<i32> for RaiFilterType {
5326 fn from(value: i32) -> Self {
5327 match value {
5328 0 => Self::Unspecified,
5329 2 => Self::SexuallyExplicit,
5330 3 => Self::HateSpeech,
5331 6 => Self::Harassment,
5332 17 => Self::Dangerous,
5333 _ => Self::UnknownValue(rai_filter_type::UnknownValue(
5334 wkt::internal::UnknownEnumValue::Integer(value),
5335 )),
5336 }
5337 }
5338}
5339
5340impl std::convert::From<&str> for RaiFilterType {
5341 fn from(value: &str) -> Self {
5342 use std::string::ToString;
5343 match value {
5344 "RAI_FILTER_TYPE_UNSPECIFIED" => Self::Unspecified,
5345 "SEXUALLY_EXPLICIT" => Self::SexuallyExplicit,
5346 "HATE_SPEECH" => Self::HateSpeech,
5347 "HARASSMENT" => Self::Harassment,
5348 "DANGEROUS" => Self::Dangerous,
5349 _ => Self::UnknownValue(rai_filter_type::UnknownValue(
5350 wkt::internal::UnknownEnumValue::String(value.to_string()),
5351 )),
5352 }
5353 }
5354}
5355
5356impl serde::ser::Serialize for RaiFilterType {
5357 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5358 where
5359 S: serde::Serializer,
5360 {
5361 match self {
5362 Self::Unspecified => serializer.serialize_i32(0),
5363 Self::SexuallyExplicit => serializer.serialize_i32(2),
5364 Self::HateSpeech => serializer.serialize_i32(3),
5365 Self::Harassment => serializer.serialize_i32(6),
5366 Self::Dangerous => serializer.serialize_i32(17),
5367 Self::UnknownValue(u) => u.0.serialize(serializer),
5368 }
5369 }
5370}
5371
5372impl<'de> serde::de::Deserialize<'de> for RaiFilterType {
5373 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5374 where
5375 D: serde::Deserializer<'de>,
5376 {
5377 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RaiFilterType>::new(
5378 ".google.cloud.modelarmor.v1.RaiFilterType",
5379 ))
5380 }
5381}
5382
5383#[derive(Clone, Debug, PartialEq)]
5401#[non_exhaustive]
5402pub enum DetectionConfidenceLevel {
5403 Unspecified,
5405 LowAndAbove,
5407 MediumAndAbove,
5409 High,
5411 UnknownValue(detection_confidence_level::UnknownValue),
5416}
5417
5418#[doc(hidden)]
5419pub mod detection_confidence_level {
5420 #[allow(unused_imports)]
5421 use super::*;
5422 #[derive(Clone, Debug, PartialEq)]
5423 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5424}
5425
5426impl DetectionConfidenceLevel {
5427 pub fn value(&self) -> std::option::Option<i32> {
5432 match self {
5433 Self::Unspecified => std::option::Option::Some(0),
5434 Self::LowAndAbove => std::option::Option::Some(1),
5435 Self::MediumAndAbove => std::option::Option::Some(2),
5436 Self::High => std::option::Option::Some(3),
5437 Self::UnknownValue(u) => u.0.value(),
5438 }
5439 }
5440
5441 pub fn name(&self) -> std::option::Option<&str> {
5446 match self {
5447 Self::Unspecified => {
5448 std::option::Option::Some("DETECTION_CONFIDENCE_LEVEL_UNSPECIFIED")
5449 }
5450 Self::LowAndAbove => std::option::Option::Some("LOW_AND_ABOVE"),
5451 Self::MediumAndAbove => std::option::Option::Some("MEDIUM_AND_ABOVE"),
5452 Self::High => std::option::Option::Some("HIGH"),
5453 Self::UnknownValue(u) => u.0.name(),
5454 }
5455 }
5456}
5457
5458impl std::default::Default for DetectionConfidenceLevel {
5459 fn default() -> Self {
5460 use std::convert::From;
5461 Self::from(0)
5462 }
5463}
5464
5465impl std::fmt::Display for DetectionConfidenceLevel {
5466 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5467 wkt::internal::display_enum(f, self.name(), self.value())
5468 }
5469}
5470
5471impl std::convert::From<i32> for DetectionConfidenceLevel {
5472 fn from(value: i32) -> Self {
5473 match value {
5474 0 => Self::Unspecified,
5475 1 => Self::LowAndAbove,
5476 2 => Self::MediumAndAbove,
5477 3 => Self::High,
5478 _ => Self::UnknownValue(detection_confidence_level::UnknownValue(
5479 wkt::internal::UnknownEnumValue::Integer(value),
5480 )),
5481 }
5482 }
5483}
5484
5485impl std::convert::From<&str> for DetectionConfidenceLevel {
5486 fn from(value: &str) -> Self {
5487 use std::string::ToString;
5488 match value {
5489 "DETECTION_CONFIDENCE_LEVEL_UNSPECIFIED" => Self::Unspecified,
5490 "LOW_AND_ABOVE" => Self::LowAndAbove,
5491 "MEDIUM_AND_ABOVE" => Self::MediumAndAbove,
5492 "HIGH" => Self::High,
5493 _ => Self::UnknownValue(detection_confidence_level::UnknownValue(
5494 wkt::internal::UnknownEnumValue::String(value.to_string()),
5495 )),
5496 }
5497 }
5498}
5499
5500impl serde::ser::Serialize for DetectionConfidenceLevel {
5501 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5502 where
5503 S: serde::Serializer,
5504 {
5505 match self {
5506 Self::Unspecified => serializer.serialize_i32(0),
5507 Self::LowAndAbove => serializer.serialize_i32(1),
5508 Self::MediumAndAbove => serializer.serialize_i32(2),
5509 Self::High => serializer.serialize_i32(3),
5510 Self::UnknownValue(u) => u.0.serialize(serializer),
5511 }
5512 }
5513}
5514
5515impl<'de> serde::de::Deserialize<'de> for DetectionConfidenceLevel {
5516 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5517 where
5518 D: serde::Deserializer<'de>,
5519 {
5520 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DetectionConfidenceLevel>::new(
5521 ".google.cloud.modelarmor.v1.DetectionConfidenceLevel",
5522 ))
5523 }
5524}
5525
5526#[derive(Clone, Debug, PartialEq)]
5543#[non_exhaustive]
5544pub enum SdpFindingLikelihood {
5545 Unspecified,
5547 VeryUnlikely,
5549 Unlikely,
5551 Possible,
5553 Likely,
5555 VeryLikely,
5557 UnknownValue(sdp_finding_likelihood::UnknownValue),
5562}
5563
5564#[doc(hidden)]
5565pub mod sdp_finding_likelihood {
5566 #[allow(unused_imports)]
5567 use super::*;
5568 #[derive(Clone, Debug, PartialEq)]
5569 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5570}
5571
5572impl SdpFindingLikelihood {
5573 pub fn value(&self) -> std::option::Option<i32> {
5578 match self {
5579 Self::Unspecified => std::option::Option::Some(0),
5580 Self::VeryUnlikely => std::option::Option::Some(1),
5581 Self::Unlikely => std::option::Option::Some(2),
5582 Self::Possible => std::option::Option::Some(3),
5583 Self::Likely => std::option::Option::Some(4),
5584 Self::VeryLikely => std::option::Option::Some(5),
5585 Self::UnknownValue(u) => u.0.value(),
5586 }
5587 }
5588
5589 pub fn name(&self) -> std::option::Option<&str> {
5594 match self {
5595 Self::Unspecified => std::option::Option::Some("SDP_FINDING_LIKELIHOOD_UNSPECIFIED"),
5596 Self::VeryUnlikely => std::option::Option::Some("VERY_UNLIKELY"),
5597 Self::Unlikely => std::option::Option::Some("UNLIKELY"),
5598 Self::Possible => std::option::Option::Some("POSSIBLE"),
5599 Self::Likely => std::option::Option::Some("LIKELY"),
5600 Self::VeryLikely => std::option::Option::Some("VERY_LIKELY"),
5601 Self::UnknownValue(u) => u.0.name(),
5602 }
5603 }
5604}
5605
5606impl std::default::Default for SdpFindingLikelihood {
5607 fn default() -> Self {
5608 use std::convert::From;
5609 Self::from(0)
5610 }
5611}
5612
5613impl std::fmt::Display for SdpFindingLikelihood {
5614 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5615 wkt::internal::display_enum(f, self.name(), self.value())
5616 }
5617}
5618
5619impl std::convert::From<i32> for SdpFindingLikelihood {
5620 fn from(value: i32) -> Self {
5621 match value {
5622 0 => Self::Unspecified,
5623 1 => Self::VeryUnlikely,
5624 2 => Self::Unlikely,
5625 3 => Self::Possible,
5626 4 => Self::Likely,
5627 5 => Self::VeryLikely,
5628 _ => Self::UnknownValue(sdp_finding_likelihood::UnknownValue(
5629 wkt::internal::UnknownEnumValue::Integer(value),
5630 )),
5631 }
5632 }
5633}
5634
5635impl std::convert::From<&str> for SdpFindingLikelihood {
5636 fn from(value: &str) -> Self {
5637 use std::string::ToString;
5638 match value {
5639 "SDP_FINDING_LIKELIHOOD_UNSPECIFIED" => Self::Unspecified,
5640 "VERY_UNLIKELY" => Self::VeryUnlikely,
5641 "UNLIKELY" => Self::Unlikely,
5642 "POSSIBLE" => Self::Possible,
5643 "LIKELY" => Self::Likely,
5644 "VERY_LIKELY" => Self::VeryLikely,
5645 _ => Self::UnknownValue(sdp_finding_likelihood::UnknownValue(
5646 wkt::internal::UnknownEnumValue::String(value.to_string()),
5647 )),
5648 }
5649 }
5650}
5651
5652impl serde::ser::Serialize for SdpFindingLikelihood {
5653 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5654 where
5655 S: serde::Serializer,
5656 {
5657 match self {
5658 Self::Unspecified => serializer.serialize_i32(0),
5659 Self::VeryUnlikely => serializer.serialize_i32(1),
5660 Self::Unlikely => serializer.serialize_i32(2),
5661 Self::Possible => serializer.serialize_i32(3),
5662 Self::Likely => serializer.serialize_i32(4),
5663 Self::VeryLikely => serializer.serialize_i32(5),
5664 Self::UnknownValue(u) => u.0.serialize(serializer),
5665 }
5666 }
5667}
5668
5669impl<'de> serde::de::Deserialize<'de> for SdpFindingLikelihood {
5670 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5671 where
5672 D: serde::Deserializer<'de>,
5673 {
5674 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SdpFindingLikelihood>::new(
5675 ".google.cloud.modelarmor.v1.SdpFindingLikelihood",
5676 ))
5677 }
5678}
5679
5680#[derive(Clone, Debug, PartialEq)]
5697#[non_exhaustive]
5698pub enum InvocationResult {
5699 Unspecified,
5701 Success,
5703 Partial,
5705 Failure,
5707 UnknownValue(invocation_result::UnknownValue),
5712}
5713
5714#[doc(hidden)]
5715pub mod invocation_result {
5716 #[allow(unused_imports)]
5717 use super::*;
5718 #[derive(Clone, Debug, PartialEq)]
5719 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5720}
5721
5722impl InvocationResult {
5723 pub fn value(&self) -> std::option::Option<i32> {
5728 match self {
5729 Self::Unspecified => std::option::Option::Some(0),
5730 Self::Success => std::option::Option::Some(1),
5731 Self::Partial => std::option::Option::Some(2),
5732 Self::Failure => std::option::Option::Some(3),
5733 Self::UnknownValue(u) => u.0.value(),
5734 }
5735 }
5736
5737 pub fn name(&self) -> std::option::Option<&str> {
5742 match self {
5743 Self::Unspecified => std::option::Option::Some("INVOCATION_RESULT_UNSPECIFIED"),
5744 Self::Success => std::option::Option::Some("SUCCESS"),
5745 Self::Partial => std::option::Option::Some("PARTIAL"),
5746 Self::Failure => std::option::Option::Some("FAILURE"),
5747 Self::UnknownValue(u) => u.0.name(),
5748 }
5749 }
5750}
5751
5752impl std::default::Default for InvocationResult {
5753 fn default() -> Self {
5754 use std::convert::From;
5755 Self::from(0)
5756 }
5757}
5758
5759impl std::fmt::Display for InvocationResult {
5760 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5761 wkt::internal::display_enum(f, self.name(), self.value())
5762 }
5763}
5764
5765impl std::convert::From<i32> for InvocationResult {
5766 fn from(value: i32) -> Self {
5767 match value {
5768 0 => Self::Unspecified,
5769 1 => Self::Success,
5770 2 => Self::Partial,
5771 3 => Self::Failure,
5772 _ => Self::UnknownValue(invocation_result::UnknownValue(
5773 wkt::internal::UnknownEnumValue::Integer(value),
5774 )),
5775 }
5776 }
5777}
5778
5779impl std::convert::From<&str> for InvocationResult {
5780 fn from(value: &str) -> Self {
5781 use std::string::ToString;
5782 match value {
5783 "INVOCATION_RESULT_UNSPECIFIED" => Self::Unspecified,
5784 "SUCCESS" => Self::Success,
5785 "PARTIAL" => Self::Partial,
5786 "FAILURE" => Self::Failure,
5787 _ => Self::UnknownValue(invocation_result::UnknownValue(
5788 wkt::internal::UnknownEnumValue::String(value.to_string()),
5789 )),
5790 }
5791 }
5792}
5793
5794impl serde::ser::Serialize for InvocationResult {
5795 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5796 where
5797 S: serde::Serializer,
5798 {
5799 match self {
5800 Self::Unspecified => serializer.serialize_i32(0),
5801 Self::Success => serializer.serialize_i32(1),
5802 Self::Partial => serializer.serialize_i32(2),
5803 Self::Failure => serializer.serialize_i32(3),
5804 Self::UnknownValue(u) => u.0.serialize(serializer),
5805 }
5806 }
5807}
5808
5809impl<'de> serde::de::Deserialize<'de> for InvocationResult {
5810 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5811 where
5812 D: serde::Deserializer<'de>,
5813 {
5814 deserializer.deserialize_any(wkt::internal::EnumVisitor::<InvocationResult>::new(
5815 ".google.cloud.modelarmor.v1.InvocationResult",
5816 ))
5817 }
5818}