google_cloud_modelarmor_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_location;
25extern crate lazy_static;
26extern crate serde;
27extern crate serde_json;
28extern crate serde_with;
29extern crate std;
30extern crate tracing;
31extern crate wkt;
32
33mod debug;
34mod deserialize;
35mod serialize;
36
37/// Message describing Template resource
38#[derive(Clone, Default, PartialEq)]
39#[non_exhaustive]
40pub struct Template {
41 /// Identifier. name of resource
42 pub name: std::string::String,
43
44 /// Output only. [Output only] Create time stamp
45 pub create_time: std::option::Option<wkt::Timestamp>,
46
47 /// Output only. [Output only] Update time stamp
48 pub update_time: std::option::Option<wkt::Timestamp>,
49
50 /// Optional. Labels as key value pairs
51 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
52
53 /// Required. filter configuration for this template
54 pub filter_config: std::option::Option<crate::model::FilterConfig>,
55
56 /// Optional. metadata for this template
57 pub template_metadata: std::option::Option<crate::model::template::TemplateMetadata>,
58
59 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
60}
61
62impl Template {
63 pub fn new() -> Self {
64 std::default::Default::default()
65 }
66
67 /// Sets the value of [name][crate::model::Template::name].
68 ///
69 /// # Example
70 /// ```ignore,no_run
71 /// # use google_cloud_modelarmor_v1::model::Template;
72 /// let x = Template::new().set_name("example");
73 /// ```
74 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
75 self.name = v.into();
76 self
77 }
78
79 /// Sets the value of [create_time][crate::model::Template::create_time].
80 ///
81 /// # Example
82 /// ```ignore,no_run
83 /// # use google_cloud_modelarmor_v1::model::Template;
84 /// use wkt::Timestamp;
85 /// let x = Template::new().set_create_time(Timestamp::default()/* use setters */);
86 /// ```
87 pub fn set_create_time<T>(mut self, v: T) -> Self
88 where
89 T: std::convert::Into<wkt::Timestamp>,
90 {
91 self.create_time = std::option::Option::Some(v.into());
92 self
93 }
94
95 /// Sets or clears the value of [create_time][crate::model::Template::create_time].
96 ///
97 /// # Example
98 /// ```ignore,no_run
99 /// # use google_cloud_modelarmor_v1::model::Template;
100 /// use wkt::Timestamp;
101 /// let x = Template::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
102 /// let x = Template::new().set_or_clear_create_time(None::<Timestamp>);
103 /// ```
104 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
105 where
106 T: std::convert::Into<wkt::Timestamp>,
107 {
108 self.create_time = v.map(|x| x.into());
109 self
110 }
111
112 /// Sets the value of [update_time][crate::model::Template::update_time].
113 ///
114 /// # Example
115 /// ```ignore,no_run
116 /// # use google_cloud_modelarmor_v1::model::Template;
117 /// use wkt::Timestamp;
118 /// let x = Template::new().set_update_time(Timestamp::default()/* use setters */);
119 /// ```
120 pub fn set_update_time<T>(mut self, v: T) -> Self
121 where
122 T: std::convert::Into<wkt::Timestamp>,
123 {
124 self.update_time = std::option::Option::Some(v.into());
125 self
126 }
127
128 /// Sets or clears the value of [update_time][crate::model::Template::update_time].
129 ///
130 /// # Example
131 /// ```ignore,no_run
132 /// # use google_cloud_modelarmor_v1::model::Template;
133 /// use wkt::Timestamp;
134 /// let x = Template::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
135 /// let x = Template::new().set_or_clear_update_time(None::<Timestamp>);
136 /// ```
137 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
138 where
139 T: std::convert::Into<wkt::Timestamp>,
140 {
141 self.update_time = v.map(|x| x.into());
142 self
143 }
144
145 /// Sets the value of [labels][crate::model::Template::labels].
146 ///
147 /// # Example
148 /// ```ignore,no_run
149 /// # use google_cloud_modelarmor_v1::model::Template;
150 /// let x = Template::new().set_labels([
151 /// ("key0", "abc"),
152 /// ("key1", "xyz"),
153 /// ]);
154 /// ```
155 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
156 where
157 T: std::iter::IntoIterator<Item = (K, V)>,
158 K: std::convert::Into<std::string::String>,
159 V: std::convert::Into<std::string::String>,
160 {
161 use std::iter::Iterator;
162 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
163 self
164 }
165
166 /// Sets the value of [filter_config][crate::model::Template::filter_config].
167 ///
168 /// # Example
169 /// ```ignore,no_run
170 /// # use google_cloud_modelarmor_v1::model::Template;
171 /// use google_cloud_modelarmor_v1::model::FilterConfig;
172 /// let x = Template::new().set_filter_config(FilterConfig::default()/* use setters */);
173 /// ```
174 pub fn set_filter_config<T>(mut self, v: T) -> Self
175 where
176 T: std::convert::Into<crate::model::FilterConfig>,
177 {
178 self.filter_config = std::option::Option::Some(v.into());
179 self
180 }
181
182 /// Sets or clears the value of [filter_config][crate::model::Template::filter_config].
183 ///
184 /// # Example
185 /// ```ignore,no_run
186 /// # use google_cloud_modelarmor_v1::model::Template;
187 /// use google_cloud_modelarmor_v1::model::FilterConfig;
188 /// let x = Template::new().set_or_clear_filter_config(Some(FilterConfig::default()/* use setters */));
189 /// let x = Template::new().set_or_clear_filter_config(None::<FilterConfig>);
190 /// ```
191 pub fn set_or_clear_filter_config<T>(mut self, v: std::option::Option<T>) -> Self
192 where
193 T: std::convert::Into<crate::model::FilterConfig>,
194 {
195 self.filter_config = v.map(|x| x.into());
196 self
197 }
198
199 /// Sets the value of [template_metadata][crate::model::Template::template_metadata].
200 ///
201 /// # Example
202 /// ```ignore,no_run
203 /// # use google_cloud_modelarmor_v1::model::Template;
204 /// use google_cloud_modelarmor_v1::model::template::TemplateMetadata;
205 /// let x = Template::new().set_template_metadata(TemplateMetadata::default()/* use setters */);
206 /// ```
207 pub fn set_template_metadata<T>(mut self, v: T) -> Self
208 where
209 T: std::convert::Into<crate::model::template::TemplateMetadata>,
210 {
211 self.template_metadata = std::option::Option::Some(v.into());
212 self
213 }
214
215 /// Sets or clears the value of [template_metadata][crate::model::Template::template_metadata].
216 ///
217 /// # Example
218 /// ```ignore,no_run
219 /// # use google_cloud_modelarmor_v1::model::Template;
220 /// use google_cloud_modelarmor_v1::model::template::TemplateMetadata;
221 /// let x = Template::new().set_or_clear_template_metadata(Some(TemplateMetadata::default()/* use setters */));
222 /// let x = Template::new().set_or_clear_template_metadata(None::<TemplateMetadata>);
223 /// ```
224 pub fn set_or_clear_template_metadata<T>(mut self, v: std::option::Option<T>) -> Self
225 where
226 T: std::convert::Into<crate::model::template::TemplateMetadata>,
227 {
228 self.template_metadata = v.map(|x| x.into());
229 self
230 }
231}
232
233impl wkt::message::Message for Template {
234 fn typename() -> &'static str {
235 "type.googleapis.com/google.cloud.modelarmor.v1.Template"
236 }
237}
238
239/// Defines additional types related to [Template].
240pub mod template {
241 #[allow(unused_imports)]
242 use super::*;
243
244 /// Message describing TemplateMetadata
245 #[derive(Clone, Default, PartialEq)]
246 #[non_exhaustive]
247 pub struct TemplateMetadata {
248 /// Optional. If true, partial detector failures should be ignored.
249 pub ignore_partial_invocation_failures: bool,
250
251 /// Optional. Indicates the custom error code set by the user to be returned
252 /// to the end user by the service extension if the prompt trips Model Armor
253 /// filters.
254 pub custom_prompt_safety_error_code: i32,
255
256 /// Optional. Indicates the custom error message set by the user to be
257 /// returned to the end user if the prompt trips Model Armor filters.
258 pub custom_prompt_safety_error_message: std::string::String,
259
260 /// Optional. Indicates the custom error code set by the user to be returned
261 /// to the end user if the LLM response trips Model Armor filters.
262 pub custom_llm_response_safety_error_code: i32,
263
264 /// Optional. Indicates the custom error message set by the user to be
265 /// returned to the end user if the LLM response trips Model Armor filters.
266 pub custom_llm_response_safety_error_message: std::string::String,
267
268 /// Optional. If true, log template crud operations.
269 pub log_template_operations: bool,
270
271 /// Optional. If true, log sanitize operations.
272 pub log_sanitize_operations: bool,
273
274 /// Optional. Enforcement type for Model Armor filters.
275 pub enforcement_type: crate::model::template::template_metadata::EnforcementType,
276
277 /// Optional. Metadata for multi language detection.
278 pub multi_language_detection:
279 std::option::Option<crate::model::template::template_metadata::MultiLanguageDetection>,
280
281 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
282 }
283
284 impl TemplateMetadata {
285 pub fn new() -> Self {
286 std::default::Default::default()
287 }
288
289 /// Sets the value of [ignore_partial_invocation_failures][crate::model::template::TemplateMetadata::ignore_partial_invocation_failures].
290 ///
291 /// # Example
292 /// ```ignore,no_run
293 /// # use google_cloud_modelarmor_v1::model::template::TemplateMetadata;
294 /// let x = TemplateMetadata::new().set_ignore_partial_invocation_failures(true);
295 /// ```
296 pub fn set_ignore_partial_invocation_failures<T: std::convert::Into<bool>>(
297 mut self,
298 v: T,
299 ) -> Self {
300 self.ignore_partial_invocation_failures = v.into();
301 self
302 }
303
304 /// Sets the value of [custom_prompt_safety_error_code][crate::model::template::TemplateMetadata::custom_prompt_safety_error_code].
305 ///
306 /// # Example
307 /// ```ignore,no_run
308 /// # use google_cloud_modelarmor_v1::model::template::TemplateMetadata;
309 /// let x = TemplateMetadata::new().set_custom_prompt_safety_error_code(42);
310 /// ```
311 pub fn set_custom_prompt_safety_error_code<T: std::convert::Into<i32>>(
312 mut self,
313 v: T,
314 ) -> Self {
315 self.custom_prompt_safety_error_code = v.into();
316 self
317 }
318
319 /// Sets the value of [custom_prompt_safety_error_message][crate::model::template::TemplateMetadata::custom_prompt_safety_error_message].
320 ///
321 /// # Example
322 /// ```ignore,no_run
323 /// # use google_cloud_modelarmor_v1::model::template::TemplateMetadata;
324 /// let x = TemplateMetadata::new().set_custom_prompt_safety_error_message("example");
325 /// ```
326 pub fn set_custom_prompt_safety_error_message<
327 T: std::convert::Into<std::string::String>,
328 >(
329 mut self,
330 v: T,
331 ) -> Self {
332 self.custom_prompt_safety_error_message = v.into();
333 self
334 }
335
336 /// Sets the value of [custom_llm_response_safety_error_code][crate::model::template::TemplateMetadata::custom_llm_response_safety_error_code].
337 ///
338 /// # Example
339 /// ```ignore,no_run
340 /// # use google_cloud_modelarmor_v1::model::template::TemplateMetadata;
341 /// let x = TemplateMetadata::new().set_custom_llm_response_safety_error_code(42);
342 /// ```
343 pub fn set_custom_llm_response_safety_error_code<T: std::convert::Into<i32>>(
344 mut self,
345 v: T,
346 ) -> Self {
347 self.custom_llm_response_safety_error_code = v.into();
348 self
349 }
350
351 /// Sets the value of [custom_llm_response_safety_error_message][crate::model::template::TemplateMetadata::custom_llm_response_safety_error_message].
352 ///
353 /// # Example
354 /// ```ignore,no_run
355 /// # use google_cloud_modelarmor_v1::model::template::TemplateMetadata;
356 /// let x = TemplateMetadata::new().set_custom_llm_response_safety_error_message("example");
357 /// ```
358 pub fn set_custom_llm_response_safety_error_message<
359 T: std::convert::Into<std::string::String>,
360 >(
361 mut self,
362 v: T,
363 ) -> Self {
364 self.custom_llm_response_safety_error_message = v.into();
365 self
366 }
367
368 /// Sets the value of [log_template_operations][crate::model::template::TemplateMetadata::log_template_operations].
369 ///
370 /// # Example
371 /// ```ignore,no_run
372 /// # use google_cloud_modelarmor_v1::model::template::TemplateMetadata;
373 /// let x = TemplateMetadata::new().set_log_template_operations(true);
374 /// ```
375 pub fn set_log_template_operations<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
376 self.log_template_operations = v.into();
377 self
378 }
379
380 /// Sets the value of [log_sanitize_operations][crate::model::template::TemplateMetadata::log_sanitize_operations].
381 ///
382 /// # Example
383 /// ```ignore,no_run
384 /// # use google_cloud_modelarmor_v1::model::template::TemplateMetadata;
385 /// let x = TemplateMetadata::new().set_log_sanitize_operations(true);
386 /// ```
387 pub fn set_log_sanitize_operations<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
388 self.log_sanitize_operations = v.into();
389 self
390 }
391
392 /// Sets the value of [enforcement_type][crate::model::template::TemplateMetadata::enforcement_type].
393 ///
394 /// # Example
395 /// ```ignore,no_run
396 /// # use google_cloud_modelarmor_v1::model::template::TemplateMetadata;
397 /// use google_cloud_modelarmor_v1::model::template::template_metadata::EnforcementType;
398 /// let x0 = TemplateMetadata::new().set_enforcement_type(EnforcementType::InspectOnly);
399 /// let x1 = TemplateMetadata::new().set_enforcement_type(EnforcementType::InspectAndBlock);
400 /// ```
401 pub fn set_enforcement_type<
402 T: std::convert::Into<crate::model::template::template_metadata::EnforcementType>,
403 >(
404 mut self,
405 v: T,
406 ) -> Self {
407 self.enforcement_type = v.into();
408 self
409 }
410
411 /// Sets the value of [multi_language_detection][crate::model::template::TemplateMetadata::multi_language_detection].
412 ///
413 /// # Example
414 /// ```ignore,no_run
415 /// # use google_cloud_modelarmor_v1::model::template::TemplateMetadata;
416 /// use google_cloud_modelarmor_v1::model::template::template_metadata::MultiLanguageDetection;
417 /// let x = TemplateMetadata::new().set_multi_language_detection(MultiLanguageDetection::default()/* use setters */);
418 /// ```
419 pub fn set_multi_language_detection<T>(mut self, v: T) -> Self
420 where
421 T: std::convert::Into<
422 crate::model::template::template_metadata::MultiLanguageDetection,
423 >,
424 {
425 self.multi_language_detection = std::option::Option::Some(v.into());
426 self
427 }
428
429 /// Sets or clears the value of [multi_language_detection][crate::model::template::TemplateMetadata::multi_language_detection].
430 ///
431 /// # Example
432 /// ```ignore,no_run
433 /// # use google_cloud_modelarmor_v1::model::template::TemplateMetadata;
434 /// use google_cloud_modelarmor_v1::model::template::template_metadata::MultiLanguageDetection;
435 /// let x = TemplateMetadata::new().set_or_clear_multi_language_detection(Some(MultiLanguageDetection::default()/* use setters */));
436 /// let x = TemplateMetadata::new().set_or_clear_multi_language_detection(None::<MultiLanguageDetection>);
437 /// ```
438 pub fn set_or_clear_multi_language_detection<T>(mut self, v: std::option::Option<T>) -> Self
439 where
440 T: std::convert::Into<
441 crate::model::template::template_metadata::MultiLanguageDetection,
442 >,
443 {
444 self.multi_language_detection = v.map(|x| x.into());
445 self
446 }
447 }
448
449 impl wkt::message::Message for TemplateMetadata {
450 fn typename() -> &'static str {
451 "type.googleapis.com/google.cloud.modelarmor.v1.Template.TemplateMetadata"
452 }
453 }
454
455 /// Defines additional types related to [TemplateMetadata].
456 pub mod template_metadata {
457 #[allow(unused_imports)]
458 use super::*;
459
460 /// Metadata to enable multi language detection via template.
461 #[derive(Clone, Default, PartialEq)]
462 #[non_exhaustive]
463 pub struct MultiLanguageDetection {
464 /// Required. If true, multi language detection will be enabled.
465 pub enable_multi_language_detection: bool,
466
467 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
468 }
469
470 impl MultiLanguageDetection {
471 pub fn new() -> Self {
472 std::default::Default::default()
473 }
474
475 /// Sets the value of [enable_multi_language_detection][crate::model::template::template_metadata::MultiLanguageDetection::enable_multi_language_detection].
476 ///
477 /// # Example
478 /// ```ignore,no_run
479 /// # use google_cloud_modelarmor_v1::model::template::template_metadata::MultiLanguageDetection;
480 /// let x = MultiLanguageDetection::new().set_enable_multi_language_detection(true);
481 /// ```
482 pub fn set_enable_multi_language_detection<T: std::convert::Into<bool>>(
483 mut self,
484 v: T,
485 ) -> Self {
486 self.enable_multi_language_detection = v.into();
487 self
488 }
489 }
490
491 impl wkt::message::Message for MultiLanguageDetection {
492 fn typename() -> &'static str {
493 "type.googleapis.com/google.cloud.modelarmor.v1.Template.TemplateMetadata.MultiLanguageDetection"
494 }
495 }
496
497 /// Enforcement type for Model Armor filters.
498 ///
499 /// # Working with unknown values
500 ///
501 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
502 /// additional enum variants at any time. Adding new variants is not considered
503 /// a breaking change. Applications should write their code in anticipation of:
504 ///
505 /// - New values appearing in future releases of the client library, **and**
506 /// - New values received dynamically, without application changes.
507 ///
508 /// Please consult the [Working with enums] section in the user guide for some
509 /// guidelines.
510 ///
511 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
512 #[derive(Clone, Debug, PartialEq)]
513 #[non_exhaustive]
514 pub enum EnforcementType {
515 /// Default value. Same as INSPECT_AND_BLOCK.
516 Unspecified,
517 /// Model Armor filters will run in inspect only mode. No action will be
518 /// taken on the request.
519 InspectOnly,
520 /// Model Armor filters will run in inspect and block mode. Requests
521 /// that trip Model Armor filters will be blocked.
522 InspectAndBlock,
523 /// If set, the enum was initialized with an unknown value.
524 ///
525 /// Applications can examine the value using [EnforcementType::value] or
526 /// [EnforcementType::name].
527 UnknownValue(enforcement_type::UnknownValue),
528 }
529
530 #[doc(hidden)]
531 pub mod enforcement_type {
532 #[allow(unused_imports)]
533 use super::*;
534 #[derive(Clone, Debug, PartialEq)]
535 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
536 }
537
538 impl EnforcementType {
539 /// Gets the enum value.
540 ///
541 /// Returns `None` if the enum contains an unknown value deserialized from
542 /// the string representation of enums.
543 pub fn value(&self) -> std::option::Option<i32> {
544 match self {
545 Self::Unspecified => std::option::Option::Some(0),
546 Self::InspectOnly => std::option::Option::Some(1),
547 Self::InspectAndBlock => std::option::Option::Some(2),
548 Self::UnknownValue(u) => u.0.value(),
549 }
550 }
551
552 /// Gets the enum value as a string.
553 ///
554 /// Returns `None` if the enum contains an unknown value deserialized from
555 /// the integer representation of enums.
556 pub fn name(&self) -> std::option::Option<&str> {
557 match self {
558 Self::Unspecified => std::option::Option::Some("ENFORCEMENT_TYPE_UNSPECIFIED"),
559 Self::InspectOnly => std::option::Option::Some("INSPECT_ONLY"),
560 Self::InspectAndBlock => std::option::Option::Some("INSPECT_AND_BLOCK"),
561 Self::UnknownValue(u) => u.0.name(),
562 }
563 }
564 }
565
566 impl std::default::Default for EnforcementType {
567 fn default() -> Self {
568 use std::convert::From;
569 Self::from(0)
570 }
571 }
572
573 impl std::fmt::Display for EnforcementType {
574 fn fmt(
575 &self,
576 f: &mut std::fmt::Formatter<'_>,
577 ) -> std::result::Result<(), std::fmt::Error> {
578 wkt::internal::display_enum(f, self.name(), self.value())
579 }
580 }
581
582 impl std::convert::From<i32> for EnforcementType {
583 fn from(value: i32) -> Self {
584 match value {
585 0 => Self::Unspecified,
586 1 => Self::InspectOnly,
587 2 => Self::InspectAndBlock,
588 _ => Self::UnknownValue(enforcement_type::UnknownValue(
589 wkt::internal::UnknownEnumValue::Integer(value),
590 )),
591 }
592 }
593 }
594
595 impl std::convert::From<&str> for EnforcementType {
596 fn from(value: &str) -> Self {
597 use std::string::ToString;
598 match value {
599 "ENFORCEMENT_TYPE_UNSPECIFIED" => Self::Unspecified,
600 "INSPECT_ONLY" => Self::InspectOnly,
601 "INSPECT_AND_BLOCK" => Self::InspectAndBlock,
602 _ => Self::UnknownValue(enforcement_type::UnknownValue(
603 wkt::internal::UnknownEnumValue::String(value.to_string()),
604 )),
605 }
606 }
607 }
608
609 impl serde::ser::Serialize for EnforcementType {
610 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
611 where
612 S: serde::Serializer,
613 {
614 match self {
615 Self::Unspecified => serializer.serialize_i32(0),
616 Self::InspectOnly => serializer.serialize_i32(1),
617 Self::InspectAndBlock => serializer.serialize_i32(2),
618 Self::UnknownValue(u) => u.0.serialize(serializer),
619 }
620 }
621 }
622
623 impl<'de> serde::de::Deserialize<'de> for EnforcementType {
624 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
625 where
626 D: serde::Deserializer<'de>,
627 {
628 deserializer.deserialize_any(wkt::internal::EnumVisitor::<EnforcementType>::new(
629 ".google.cloud.modelarmor.v1.Template.TemplateMetadata.EnforcementType",
630 ))
631 }
632 }
633 }
634}
635
636/// Message describing FloorSetting resource
637#[derive(Clone, Default, PartialEq)]
638#[non_exhaustive]
639pub struct FloorSetting {
640 /// Identifier. The resource name.
641 pub name: std::string::String,
642
643 /// Output only. [Output only] Create timestamp
644 pub create_time: std::option::Option<wkt::Timestamp>,
645
646 /// Output only. [Output only] Update timestamp
647 pub update_time: std::option::Option<wkt::Timestamp>,
648
649 /// Required. ModelArmor filter configuration.
650 pub filter_config: std::option::Option<crate::model::FilterConfig>,
651
652 /// Optional. Floor Settings enforcement status.
653 pub enable_floor_setting_enforcement: std::option::Option<bool>,
654
655 /// Optional. List of integrated services for which the floor setting is
656 /// applicable.
657 pub integrated_services: std::vec::Vec<crate::model::floor_setting::IntegratedService>,
658
659 /// Optional. AI Platform floor setting.
660 pub ai_platform_floor_setting: std::option::Option<crate::model::AiPlatformFloorSetting>,
661
662 /// Optional. Metadata for FloorSetting
663 pub floor_setting_metadata:
664 std::option::Option<crate::model::floor_setting::FloorSettingMetadata>,
665
666 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
667}
668
669impl FloorSetting {
670 pub fn new() -> Self {
671 std::default::Default::default()
672 }
673
674 /// Sets the value of [name][crate::model::FloorSetting::name].
675 ///
676 /// # Example
677 /// ```ignore,no_run
678 /// # use google_cloud_modelarmor_v1::model::FloorSetting;
679 /// let x = FloorSetting::new().set_name("example");
680 /// ```
681 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
682 self.name = v.into();
683 self
684 }
685
686 /// Sets the value of [create_time][crate::model::FloorSetting::create_time].
687 ///
688 /// # Example
689 /// ```ignore,no_run
690 /// # use google_cloud_modelarmor_v1::model::FloorSetting;
691 /// use wkt::Timestamp;
692 /// let x = FloorSetting::new().set_create_time(Timestamp::default()/* use setters */);
693 /// ```
694 pub fn set_create_time<T>(mut self, v: T) -> Self
695 where
696 T: std::convert::Into<wkt::Timestamp>,
697 {
698 self.create_time = std::option::Option::Some(v.into());
699 self
700 }
701
702 /// Sets or clears the value of [create_time][crate::model::FloorSetting::create_time].
703 ///
704 /// # Example
705 /// ```ignore,no_run
706 /// # use google_cloud_modelarmor_v1::model::FloorSetting;
707 /// use wkt::Timestamp;
708 /// let x = FloorSetting::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
709 /// let x = FloorSetting::new().set_or_clear_create_time(None::<Timestamp>);
710 /// ```
711 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
712 where
713 T: std::convert::Into<wkt::Timestamp>,
714 {
715 self.create_time = v.map(|x| x.into());
716 self
717 }
718
719 /// Sets the value of [update_time][crate::model::FloorSetting::update_time].
720 ///
721 /// # Example
722 /// ```ignore,no_run
723 /// # use google_cloud_modelarmor_v1::model::FloorSetting;
724 /// use wkt::Timestamp;
725 /// let x = FloorSetting::new().set_update_time(Timestamp::default()/* use setters */);
726 /// ```
727 pub fn set_update_time<T>(mut self, v: T) -> Self
728 where
729 T: std::convert::Into<wkt::Timestamp>,
730 {
731 self.update_time = std::option::Option::Some(v.into());
732 self
733 }
734
735 /// Sets or clears the value of [update_time][crate::model::FloorSetting::update_time].
736 ///
737 /// # Example
738 /// ```ignore,no_run
739 /// # use google_cloud_modelarmor_v1::model::FloorSetting;
740 /// use wkt::Timestamp;
741 /// let x = FloorSetting::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
742 /// let x = FloorSetting::new().set_or_clear_update_time(None::<Timestamp>);
743 /// ```
744 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
745 where
746 T: std::convert::Into<wkt::Timestamp>,
747 {
748 self.update_time = v.map(|x| x.into());
749 self
750 }
751
752 /// Sets the value of [filter_config][crate::model::FloorSetting::filter_config].
753 ///
754 /// # Example
755 /// ```ignore,no_run
756 /// # use google_cloud_modelarmor_v1::model::FloorSetting;
757 /// use google_cloud_modelarmor_v1::model::FilterConfig;
758 /// let x = FloorSetting::new().set_filter_config(FilterConfig::default()/* use setters */);
759 /// ```
760 pub fn set_filter_config<T>(mut self, v: T) -> Self
761 where
762 T: std::convert::Into<crate::model::FilterConfig>,
763 {
764 self.filter_config = std::option::Option::Some(v.into());
765 self
766 }
767
768 /// Sets or clears the value of [filter_config][crate::model::FloorSetting::filter_config].
769 ///
770 /// # Example
771 /// ```ignore,no_run
772 /// # use google_cloud_modelarmor_v1::model::FloorSetting;
773 /// use google_cloud_modelarmor_v1::model::FilterConfig;
774 /// let x = FloorSetting::new().set_or_clear_filter_config(Some(FilterConfig::default()/* use setters */));
775 /// let x = FloorSetting::new().set_or_clear_filter_config(None::<FilterConfig>);
776 /// ```
777 pub fn set_or_clear_filter_config<T>(mut self, v: std::option::Option<T>) -> Self
778 where
779 T: std::convert::Into<crate::model::FilterConfig>,
780 {
781 self.filter_config = v.map(|x| x.into());
782 self
783 }
784
785 /// Sets the value of [enable_floor_setting_enforcement][crate::model::FloorSetting::enable_floor_setting_enforcement].
786 ///
787 /// # Example
788 /// ```ignore,no_run
789 /// # use google_cloud_modelarmor_v1::model::FloorSetting;
790 /// let x = FloorSetting::new().set_enable_floor_setting_enforcement(true);
791 /// ```
792 pub fn set_enable_floor_setting_enforcement<T>(mut self, v: T) -> Self
793 where
794 T: std::convert::Into<bool>,
795 {
796 self.enable_floor_setting_enforcement = std::option::Option::Some(v.into());
797 self
798 }
799
800 /// Sets or clears the value of [enable_floor_setting_enforcement][crate::model::FloorSetting::enable_floor_setting_enforcement].
801 ///
802 /// # Example
803 /// ```ignore,no_run
804 /// # use google_cloud_modelarmor_v1::model::FloorSetting;
805 /// let x = FloorSetting::new().set_or_clear_enable_floor_setting_enforcement(Some(false));
806 /// let x = FloorSetting::new().set_or_clear_enable_floor_setting_enforcement(None::<bool>);
807 /// ```
808 pub fn set_or_clear_enable_floor_setting_enforcement<T>(
809 mut self,
810 v: std::option::Option<T>,
811 ) -> Self
812 where
813 T: std::convert::Into<bool>,
814 {
815 self.enable_floor_setting_enforcement = v.map(|x| x.into());
816 self
817 }
818
819 /// Sets the value of [integrated_services][crate::model::FloorSetting::integrated_services].
820 ///
821 /// # Example
822 /// ```ignore,no_run
823 /// # use google_cloud_modelarmor_v1::model::FloorSetting;
824 /// use google_cloud_modelarmor_v1::model::floor_setting::IntegratedService;
825 /// let x = FloorSetting::new().set_integrated_services([
826 /// IntegratedService::AiPlatform,
827 /// ]);
828 /// ```
829 pub fn set_integrated_services<T, V>(mut self, v: T) -> Self
830 where
831 T: std::iter::IntoIterator<Item = V>,
832 V: std::convert::Into<crate::model::floor_setting::IntegratedService>,
833 {
834 use std::iter::Iterator;
835 self.integrated_services = v.into_iter().map(|i| i.into()).collect();
836 self
837 }
838
839 /// Sets the value of [ai_platform_floor_setting][crate::model::FloorSetting::ai_platform_floor_setting].
840 ///
841 /// # Example
842 /// ```ignore,no_run
843 /// # use google_cloud_modelarmor_v1::model::FloorSetting;
844 /// use google_cloud_modelarmor_v1::model::AiPlatformFloorSetting;
845 /// let x = FloorSetting::new().set_ai_platform_floor_setting(AiPlatformFloorSetting::default()/* use setters */);
846 /// ```
847 pub fn set_ai_platform_floor_setting<T>(mut self, v: T) -> Self
848 where
849 T: std::convert::Into<crate::model::AiPlatformFloorSetting>,
850 {
851 self.ai_platform_floor_setting = std::option::Option::Some(v.into());
852 self
853 }
854
855 /// Sets or clears the value of [ai_platform_floor_setting][crate::model::FloorSetting::ai_platform_floor_setting].
856 ///
857 /// # Example
858 /// ```ignore,no_run
859 /// # use google_cloud_modelarmor_v1::model::FloorSetting;
860 /// use google_cloud_modelarmor_v1::model::AiPlatformFloorSetting;
861 /// let x = FloorSetting::new().set_or_clear_ai_platform_floor_setting(Some(AiPlatformFloorSetting::default()/* use setters */));
862 /// let x = FloorSetting::new().set_or_clear_ai_platform_floor_setting(None::<AiPlatformFloorSetting>);
863 /// ```
864 pub fn set_or_clear_ai_platform_floor_setting<T>(mut self, v: std::option::Option<T>) -> Self
865 where
866 T: std::convert::Into<crate::model::AiPlatformFloorSetting>,
867 {
868 self.ai_platform_floor_setting = v.map(|x| x.into());
869 self
870 }
871
872 /// Sets the value of [floor_setting_metadata][crate::model::FloorSetting::floor_setting_metadata].
873 ///
874 /// # Example
875 /// ```ignore,no_run
876 /// # use google_cloud_modelarmor_v1::model::FloorSetting;
877 /// use google_cloud_modelarmor_v1::model::floor_setting::FloorSettingMetadata;
878 /// let x = FloorSetting::new().set_floor_setting_metadata(FloorSettingMetadata::default()/* use setters */);
879 /// ```
880 pub fn set_floor_setting_metadata<T>(mut self, v: T) -> Self
881 where
882 T: std::convert::Into<crate::model::floor_setting::FloorSettingMetadata>,
883 {
884 self.floor_setting_metadata = std::option::Option::Some(v.into());
885 self
886 }
887
888 /// Sets or clears the value of [floor_setting_metadata][crate::model::FloorSetting::floor_setting_metadata].
889 ///
890 /// # Example
891 /// ```ignore,no_run
892 /// # use google_cloud_modelarmor_v1::model::FloorSetting;
893 /// use google_cloud_modelarmor_v1::model::floor_setting::FloorSettingMetadata;
894 /// let x = FloorSetting::new().set_or_clear_floor_setting_metadata(Some(FloorSettingMetadata::default()/* use setters */));
895 /// let x = FloorSetting::new().set_or_clear_floor_setting_metadata(None::<FloorSettingMetadata>);
896 /// ```
897 pub fn set_or_clear_floor_setting_metadata<T>(mut self, v: std::option::Option<T>) -> Self
898 where
899 T: std::convert::Into<crate::model::floor_setting::FloorSettingMetadata>,
900 {
901 self.floor_setting_metadata = v.map(|x| x.into());
902 self
903 }
904}
905
906impl wkt::message::Message for FloorSetting {
907 fn typename() -> &'static str {
908 "type.googleapis.com/google.cloud.modelarmor.v1.FloorSetting"
909 }
910}
911
912/// Defines additional types related to [FloorSetting].
913pub mod floor_setting {
914 #[allow(unused_imports)]
915 use super::*;
916
917 /// message describing FloorSetting Metadata
918 #[derive(Clone, Default, PartialEq)]
919 #[non_exhaustive]
920 pub struct FloorSettingMetadata {
921 /// Optional. Metadata for multi language detection.
922 pub multi_language_detection: std::option::Option<
923 crate::model::floor_setting::floor_setting_metadata::MultiLanguageDetection,
924 >,
925
926 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
927 }
928
929 impl FloorSettingMetadata {
930 pub fn new() -> Self {
931 std::default::Default::default()
932 }
933
934 /// Sets the value of [multi_language_detection][crate::model::floor_setting::FloorSettingMetadata::multi_language_detection].
935 ///
936 /// # Example
937 /// ```ignore,no_run
938 /// # use google_cloud_modelarmor_v1::model::floor_setting::FloorSettingMetadata;
939 /// use google_cloud_modelarmor_v1::model::floor_setting::floor_setting_metadata::MultiLanguageDetection;
940 /// let x = FloorSettingMetadata::new().set_multi_language_detection(MultiLanguageDetection::default()/* use setters */);
941 /// ```
942 pub fn set_multi_language_detection<T>(mut self, v: T) -> Self
943 where
944 T: std::convert::Into<
945 crate::model::floor_setting::floor_setting_metadata::MultiLanguageDetection,
946 >,
947 {
948 self.multi_language_detection = std::option::Option::Some(v.into());
949 self
950 }
951
952 /// Sets or clears the value of [multi_language_detection][crate::model::floor_setting::FloorSettingMetadata::multi_language_detection].
953 ///
954 /// # Example
955 /// ```ignore,no_run
956 /// # use google_cloud_modelarmor_v1::model::floor_setting::FloorSettingMetadata;
957 /// use google_cloud_modelarmor_v1::model::floor_setting::floor_setting_metadata::MultiLanguageDetection;
958 /// let x = FloorSettingMetadata::new().set_or_clear_multi_language_detection(Some(MultiLanguageDetection::default()/* use setters */));
959 /// let x = FloorSettingMetadata::new().set_or_clear_multi_language_detection(None::<MultiLanguageDetection>);
960 /// ```
961 pub fn set_or_clear_multi_language_detection<T>(mut self, v: std::option::Option<T>) -> Self
962 where
963 T: std::convert::Into<
964 crate::model::floor_setting::floor_setting_metadata::MultiLanguageDetection,
965 >,
966 {
967 self.multi_language_detection = v.map(|x| x.into());
968 self
969 }
970 }
971
972 impl wkt::message::Message for FloorSettingMetadata {
973 fn typename() -> &'static str {
974 "type.googleapis.com/google.cloud.modelarmor.v1.FloorSetting.FloorSettingMetadata"
975 }
976 }
977
978 /// Defines additional types related to [FloorSettingMetadata].
979 pub mod floor_setting_metadata {
980 #[allow(unused_imports)]
981 use super::*;
982
983 /// Metadata to enable multi language detection via floor setting.
984 #[derive(Clone, Default, PartialEq)]
985 #[non_exhaustive]
986 pub struct MultiLanguageDetection {
987 /// Required. If true, multi language detection will be enabled.
988 pub enable_multi_language_detection: bool,
989
990 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
991 }
992
993 impl MultiLanguageDetection {
994 pub fn new() -> Self {
995 std::default::Default::default()
996 }
997
998 /// Sets the value of [enable_multi_language_detection][crate::model::floor_setting::floor_setting_metadata::MultiLanguageDetection::enable_multi_language_detection].
999 ///
1000 /// # Example
1001 /// ```ignore,no_run
1002 /// # use google_cloud_modelarmor_v1::model::floor_setting::floor_setting_metadata::MultiLanguageDetection;
1003 /// let x = MultiLanguageDetection::new().set_enable_multi_language_detection(true);
1004 /// ```
1005 pub fn set_enable_multi_language_detection<T: std::convert::Into<bool>>(
1006 mut self,
1007 v: T,
1008 ) -> Self {
1009 self.enable_multi_language_detection = v.into();
1010 self
1011 }
1012 }
1013
1014 impl wkt::message::Message for MultiLanguageDetection {
1015 fn typename() -> &'static str {
1016 "type.googleapis.com/google.cloud.modelarmor.v1.FloorSetting.FloorSettingMetadata.MultiLanguageDetection"
1017 }
1018 }
1019 }
1020
1021 /// Integrated service for which the floor setting is applicable.
1022 ///
1023 /// # Working with unknown values
1024 ///
1025 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1026 /// additional enum variants at any time. Adding new variants is not considered
1027 /// a breaking change. Applications should write their code in anticipation of:
1028 ///
1029 /// - New values appearing in future releases of the client library, **and**
1030 /// - New values received dynamically, without application changes.
1031 ///
1032 /// Please consult the [Working with enums] section in the user guide for some
1033 /// guidelines.
1034 ///
1035 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1036 #[derive(Clone, Debug, PartialEq)]
1037 #[non_exhaustive]
1038 pub enum IntegratedService {
1039 /// Unspecified integrated service.
1040 Unspecified,
1041 /// AI Platform.
1042 AiPlatform,
1043 /// If set, the enum was initialized with an unknown value.
1044 ///
1045 /// Applications can examine the value using [IntegratedService::value] or
1046 /// [IntegratedService::name].
1047 UnknownValue(integrated_service::UnknownValue),
1048 }
1049
1050 #[doc(hidden)]
1051 pub mod integrated_service {
1052 #[allow(unused_imports)]
1053 use super::*;
1054 #[derive(Clone, Debug, PartialEq)]
1055 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1056 }
1057
1058 impl IntegratedService {
1059 /// Gets the enum value.
1060 ///
1061 /// Returns `None` if the enum contains an unknown value deserialized from
1062 /// the string representation of enums.
1063 pub fn value(&self) -> std::option::Option<i32> {
1064 match self {
1065 Self::Unspecified => std::option::Option::Some(0),
1066 Self::AiPlatform => std::option::Option::Some(1),
1067 Self::UnknownValue(u) => u.0.value(),
1068 }
1069 }
1070
1071 /// Gets the enum value as a string.
1072 ///
1073 /// Returns `None` if the enum contains an unknown value deserialized from
1074 /// the integer representation of enums.
1075 pub fn name(&self) -> std::option::Option<&str> {
1076 match self {
1077 Self::Unspecified => std::option::Option::Some("INTEGRATED_SERVICE_UNSPECIFIED"),
1078 Self::AiPlatform => std::option::Option::Some("AI_PLATFORM"),
1079 Self::UnknownValue(u) => u.0.name(),
1080 }
1081 }
1082 }
1083
1084 impl std::default::Default for IntegratedService {
1085 fn default() -> Self {
1086 use std::convert::From;
1087 Self::from(0)
1088 }
1089 }
1090
1091 impl std::fmt::Display for IntegratedService {
1092 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1093 wkt::internal::display_enum(f, self.name(), self.value())
1094 }
1095 }
1096
1097 impl std::convert::From<i32> for IntegratedService {
1098 fn from(value: i32) -> Self {
1099 match value {
1100 0 => Self::Unspecified,
1101 1 => Self::AiPlatform,
1102 _ => Self::UnknownValue(integrated_service::UnknownValue(
1103 wkt::internal::UnknownEnumValue::Integer(value),
1104 )),
1105 }
1106 }
1107 }
1108
1109 impl std::convert::From<&str> for IntegratedService {
1110 fn from(value: &str) -> Self {
1111 use std::string::ToString;
1112 match value {
1113 "INTEGRATED_SERVICE_UNSPECIFIED" => Self::Unspecified,
1114 "AI_PLATFORM" => Self::AiPlatform,
1115 _ => Self::UnknownValue(integrated_service::UnknownValue(
1116 wkt::internal::UnknownEnumValue::String(value.to_string()),
1117 )),
1118 }
1119 }
1120 }
1121
1122 impl serde::ser::Serialize for IntegratedService {
1123 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1124 where
1125 S: serde::Serializer,
1126 {
1127 match self {
1128 Self::Unspecified => serializer.serialize_i32(0),
1129 Self::AiPlatform => serializer.serialize_i32(1),
1130 Self::UnknownValue(u) => u.0.serialize(serializer),
1131 }
1132 }
1133 }
1134
1135 impl<'de> serde::de::Deserialize<'de> for IntegratedService {
1136 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1137 where
1138 D: serde::Deserializer<'de>,
1139 {
1140 deserializer.deserialize_any(wkt::internal::EnumVisitor::<IntegratedService>::new(
1141 ".google.cloud.modelarmor.v1.FloorSetting.IntegratedService",
1142 ))
1143 }
1144 }
1145}
1146
1147/// message describing AiPlatformFloorSetting
1148#[derive(Clone, Default, PartialEq)]
1149#[non_exhaustive]
1150pub struct AiPlatformFloorSetting {
1151 /// Optional. If true, log Model Armor filter results to Cloud Logging.
1152 pub enable_cloud_logging: bool,
1153
1154 /// enforcement type for Model Armor filters.
1155 pub enforcement_type:
1156 std::option::Option<crate::model::ai_platform_floor_setting::EnforcementType>,
1157
1158 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1159}
1160
1161impl AiPlatformFloorSetting {
1162 pub fn new() -> Self {
1163 std::default::Default::default()
1164 }
1165
1166 /// Sets the value of [enable_cloud_logging][crate::model::AiPlatformFloorSetting::enable_cloud_logging].
1167 ///
1168 /// # Example
1169 /// ```ignore,no_run
1170 /// # use google_cloud_modelarmor_v1::model::AiPlatformFloorSetting;
1171 /// let x = AiPlatformFloorSetting::new().set_enable_cloud_logging(true);
1172 /// ```
1173 pub fn set_enable_cloud_logging<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1174 self.enable_cloud_logging = v.into();
1175 self
1176 }
1177
1178 /// Sets the value of [enforcement_type][crate::model::AiPlatformFloorSetting::enforcement_type].
1179 ///
1180 /// Note that all the setters affecting `enforcement_type` are mutually
1181 /// exclusive.
1182 ///
1183 /// # Example
1184 /// ```ignore,no_run
1185 /// # use google_cloud_modelarmor_v1::model::AiPlatformFloorSetting;
1186 /// use google_cloud_modelarmor_v1::model::ai_platform_floor_setting::EnforcementType;
1187 /// let x = AiPlatformFloorSetting::new().set_enforcement_type(Some(EnforcementType::InspectOnly(true)));
1188 /// ```
1189 pub fn set_enforcement_type<
1190 T: std::convert::Into<
1191 std::option::Option<crate::model::ai_platform_floor_setting::EnforcementType>,
1192 >,
1193 >(
1194 mut self,
1195 v: T,
1196 ) -> Self {
1197 self.enforcement_type = v.into();
1198 self
1199 }
1200
1201 /// The value of [enforcement_type][crate::model::AiPlatformFloorSetting::enforcement_type]
1202 /// if it holds a `InspectOnly`, `None` if the field is not set or
1203 /// holds a different branch.
1204 pub fn inspect_only(&self) -> std::option::Option<&bool> {
1205 #[allow(unreachable_patterns)]
1206 self.enforcement_type.as_ref().and_then(|v| match v {
1207 crate::model::ai_platform_floor_setting::EnforcementType::InspectOnly(v) => {
1208 std::option::Option::Some(v)
1209 }
1210 _ => std::option::Option::None,
1211 })
1212 }
1213
1214 /// Sets the value of [enforcement_type][crate::model::AiPlatformFloorSetting::enforcement_type]
1215 /// to hold a `InspectOnly`.
1216 ///
1217 /// Note that all the setters affecting `enforcement_type` are
1218 /// mutually exclusive.
1219 ///
1220 /// # Example
1221 /// ```ignore,no_run
1222 /// # use google_cloud_modelarmor_v1::model::AiPlatformFloorSetting;
1223 /// let x = AiPlatformFloorSetting::new().set_inspect_only(true);
1224 /// assert!(x.inspect_only().is_some());
1225 /// assert!(x.inspect_and_block().is_none());
1226 /// ```
1227 pub fn set_inspect_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1228 self.enforcement_type = std::option::Option::Some(
1229 crate::model::ai_platform_floor_setting::EnforcementType::InspectOnly(v.into()),
1230 );
1231 self
1232 }
1233
1234 /// The value of [enforcement_type][crate::model::AiPlatformFloorSetting::enforcement_type]
1235 /// if it holds a `InspectAndBlock`, `None` if the field is not set or
1236 /// holds a different branch.
1237 pub fn inspect_and_block(&self) -> std::option::Option<&bool> {
1238 #[allow(unreachable_patterns)]
1239 self.enforcement_type.as_ref().and_then(|v| match v {
1240 crate::model::ai_platform_floor_setting::EnforcementType::InspectAndBlock(v) => {
1241 std::option::Option::Some(v)
1242 }
1243 _ => std::option::Option::None,
1244 })
1245 }
1246
1247 /// Sets the value of [enforcement_type][crate::model::AiPlatformFloorSetting::enforcement_type]
1248 /// to hold a `InspectAndBlock`.
1249 ///
1250 /// Note that all the setters affecting `enforcement_type` are
1251 /// mutually exclusive.
1252 ///
1253 /// # Example
1254 /// ```ignore,no_run
1255 /// # use google_cloud_modelarmor_v1::model::AiPlatformFloorSetting;
1256 /// let x = AiPlatformFloorSetting::new().set_inspect_and_block(true);
1257 /// assert!(x.inspect_and_block().is_some());
1258 /// assert!(x.inspect_only().is_none());
1259 /// ```
1260 pub fn set_inspect_and_block<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1261 self.enforcement_type = std::option::Option::Some(
1262 crate::model::ai_platform_floor_setting::EnforcementType::InspectAndBlock(v.into()),
1263 );
1264 self
1265 }
1266}
1267
1268impl wkt::message::Message for AiPlatformFloorSetting {
1269 fn typename() -> &'static str {
1270 "type.googleapis.com/google.cloud.modelarmor.v1.AiPlatformFloorSetting"
1271 }
1272}
1273
1274/// Defines additional types related to [AiPlatformFloorSetting].
1275pub mod ai_platform_floor_setting {
1276 #[allow(unused_imports)]
1277 use super::*;
1278
1279 /// enforcement type for Model Armor filters.
1280 #[derive(Clone, Debug, PartialEq)]
1281 #[non_exhaustive]
1282 pub enum EnforcementType {
1283 /// Optional. If true, Model Armor filters will be run in inspect only mode.
1284 /// No action will be taken on the request.
1285 InspectOnly(bool),
1286 /// Optional. If true, Model Armor filters will be run in inspect and block
1287 /// mode. Requests that trip Model Armor filters will be blocked.
1288 InspectAndBlock(bool),
1289 }
1290}
1291
1292/// Message for requesting list of Templates
1293#[derive(Clone, Default, PartialEq)]
1294#[non_exhaustive]
1295pub struct ListTemplatesRequest {
1296 /// Required. Parent value for ListTemplatesRequest
1297 pub parent: std::string::String,
1298
1299 /// Optional. Requested page size. Server may return fewer items than
1300 /// requested. If unspecified, server will pick an appropriate default.
1301 pub page_size: i32,
1302
1303 /// Optional. A token identifying a page of results the server should return.
1304 pub page_token: std::string::String,
1305
1306 /// Optional. Filtering results
1307 pub filter: std::string::String,
1308
1309 /// Optional. Hint for how to order the results
1310 pub order_by: std::string::String,
1311
1312 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1313}
1314
1315impl ListTemplatesRequest {
1316 pub fn new() -> Self {
1317 std::default::Default::default()
1318 }
1319
1320 /// Sets the value of [parent][crate::model::ListTemplatesRequest::parent].
1321 ///
1322 /// # Example
1323 /// ```ignore,no_run
1324 /// # use google_cloud_modelarmor_v1::model::ListTemplatesRequest;
1325 /// let x = ListTemplatesRequest::new().set_parent("example");
1326 /// ```
1327 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1328 self.parent = v.into();
1329 self
1330 }
1331
1332 /// Sets the value of [page_size][crate::model::ListTemplatesRequest::page_size].
1333 ///
1334 /// # Example
1335 /// ```ignore,no_run
1336 /// # use google_cloud_modelarmor_v1::model::ListTemplatesRequest;
1337 /// let x = ListTemplatesRequest::new().set_page_size(42);
1338 /// ```
1339 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1340 self.page_size = v.into();
1341 self
1342 }
1343
1344 /// Sets the value of [page_token][crate::model::ListTemplatesRequest::page_token].
1345 ///
1346 /// # Example
1347 /// ```ignore,no_run
1348 /// # use google_cloud_modelarmor_v1::model::ListTemplatesRequest;
1349 /// let x = ListTemplatesRequest::new().set_page_token("example");
1350 /// ```
1351 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1352 self.page_token = v.into();
1353 self
1354 }
1355
1356 /// Sets the value of [filter][crate::model::ListTemplatesRequest::filter].
1357 ///
1358 /// # Example
1359 /// ```ignore,no_run
1360 /// # use google_cloud_modelarmor_v1::model::ListTemplatesRequest;
1361 /// let x = ListTemplatesRequest::new().set_filter("example");
1362 /// ```
1363 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1364 self.filter = v.into();
1365 self
1366 }
1367
1368 /// Sets the value of [order_by][crate::model::ListTemplatesRequest::order_by].
1369 ///
1370 /// # Example
1371 /// ```ignore,no_run
1372 /// # use google_cloud_modelarmor_v1::model::ListTemplatesRequest;
1373 /// let x = ListTemplatesRequest::new().set_order_by("example");
1374 /// ```
1375 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1376 self.order_by = v.into();
1377 self
1378 }
1379}
1380
1381impl wkt::message::Message for ListTemplatesRequest {
1382 fn typename() -> &'static str {
1383 "type.googleapis.com/google.cloud.modelarmor.v1.ListTemplatesRequest"
1384 }
1385}
1386
1387/// Message for response to listing Templates
1388#[derive(Clone, Default, PartialEq)]
1389#[non_exhaustive]
1390pub struct ListTemplatesResponse {
1391 /// The list of Template
1392 pub templates: std::vec::Vec<crate::model::Template>,
1393
1394 /// A token identifying a page of results the server should return.
1395 pub next_page_token: std::string::String,
1396
1397 /// Locations that could not be reached.
1398 pub unreachable: std::vec::Vec<std::string::String>,
1399
1400 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1401}
1402
1403impl ListTemplatesResponse {
1404 pub fn new() -> Self {
1405 std::default::Default::default()
1406 }
1407
1408 /// Sets the value of [templates][crate::model::ListTemplatesResponse::templates].
1409 ///
1410 /// # Example
1411 /// ```ignore,no_run
1412 /// # use google_cloud_modelarmor_v1::model::ListTemplatesResponse;
1413 /// use google_cloud_modelarmor_v1::model::Template;
1414 /// let x = ListTemplatesResponse::new()
1415 /// .set_templates([
1416 /// Template::default()/* use setters */,
1417 /// Template::default()/* use (different) setters */,
1418 /// ]);
1419 /// ```
1420 pub fn set_templates<T, V>(mut self, v: T) -> Self
1421 where
1422 T: std::iter::IntoIterator<Item = V>,
1423 V: std::convert::Into<crate::model::Template>,
1424 {
1425 use std::iter::Iterator;
1426 self.templates = v.into_iter().map(|i| i.into()).collect();
1427 self
1428 }
1429
1430 /// Sets the value of [next_page_token][crate::model::ListTemplatesResponse::next_page_token].
1431 ///
1432 /// # Example
1433 /// ```ignore,no_run
1434 /// # use google_cloud_modelarmor_v1::model::ListTemplatesResponse;
1435 /// let x = ListTemplatesResponse::new().set_next_page_token("example");
1436 /// ```
1437 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1438 self.next_page_token = v.into();
1439 self
1440 }
1441
1442 /// Sets the value of [unreachable][crate::model::ListTemplatesResponse::unreachable].
1443 ///
1444 /// # Example
1445 /// ```ignore,no_run
1446 /// # use google_cloud_modelarmor_v1::model::ListTemplatesResponse;
1447 /// let x = ListTemplatesResponse::new().set_unreachable(["a", "b", "c"]);
1448 /// ```
1449 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
1450 where
1451 T: std::iter::IntoIterator<Item = V>,
1452 V: std::convert::Into<std::string::String>,
1453 {
1454 use std::iter::Iterator;
1455 self.unreachable = v.into_iter().map(|i| i.into()).collect();
1456 self
1457 }
1458}
1459
1460impl wkt::message::Message for ListTemplatesResponse {
1461 fn typename() -> &'static str {
1462 "type.googleapis.com/google.cloud.modelarmor.v1.ListTemplatesResponse"
1463 }
1464}
1465
1466#[doc(hidden)]
1467impl google_cloud_gax::paginator::internal::PageableResponse for ListTemplatesResponse {
1468 type PageItem = crate::model::Template;
1469
1470 fn items(self) -> std::vec::Vec<Self::PageItem> {
1471 self.templates
1472 }
1473
1474 fn next_page_token(&self) -> std::string::String {
1475 use std::clone::Clone;
1476 self.next_page_token.clone()
1477 }
1478}
1479
1480/// Message for getting a Template
1481#[derive(Clone, Default, PartialEq)]
1482#[non_exhaustive]
1483pub struct GetTemplateRequest {
1484 /// Required. Name of the resource
1485 pub name: std::string::String,
1486
1487 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1488}
1489
1490impl GetTemplateRequest {
1491 pub fn new() -> Self {
1492 std::default::Default::default()
1493 }
1494
1495 /// Sets the value of [name][crate::model::GetTemplateRequest::name].
1496 ///
1497 /// # Example
1498 /// ```ignore,no_run
1499 /// # use google_cloud_modelarmor_v1::model::GetTemplateRequest;
1500 /// let x = GetTemplateRequest::new().set_name("example");
1501 /// ```
1502 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1503 self.name = v.into();
1504 self
1505 }
1506}
1507
1508impl wkt::message::Message for GetTemplateRequest {
1509 fn typename() -> &'static str {
1510 "type.googleapis.com/google.cloud.modelarmor.v1.GetTemplateRequest"
1511 }
1512}
1513
1514/// Message for creating a Template
1515#[derive(Clone, Default, PartialEq)]
1516#[non_exhaustive]
1517pub struct CreateTemplateRequest {
1518 /// Required. Value for parent.
1519 pub parent: std::string::String,
1520
1521 /// Required. Id of the requesting object
1522 /// If auto-generating Id server-side, remove this field and
1523 /// template_id from the method_signature of Create RPC
1524 pub template_id: std::string::String,
1525
1526 /// Required. The resource being created
1527 pub template: std::option::Option<crate::model::Template>,
1528
1529 /// Optional. An optional request ID to identify requests. Specify a unique
1530 /// request ID so that if you must retry your request, the server will know to
1531 /// ignore the request if it has already been completed. The server stores the
1532 /// request ID for 60 minutes after the first request.
1533 ///
1534 /// For example, consider a situation where you make an initial request and the
1535 /// request times out. If you make the request again with the same request
1536 /// ID, the server can check if original operation with the same request ID
1537 /// was received, and if so, will ignore the second request. This prevents
1538 /// clients from accidentally creating duplicate commitments.
1539 ///
1540 /// The request ID must be a valid UUID with the exception that zero UUID is
1541 /// not supported (00000000-0000-0000-0000-000000000000).
1542 pub request_id: std::string::String,
1543
1544 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1545}
1546
1547impl CreateTemplateRequest {
1548 pub fn new() -> Self {
1549 std::default::Default::default()
1550 }
1551
1552 /// Sets the value of [parent][crate::model::CreateTemplateRequest::parent].
1553 ///
1554 /// # Example
1555 /// ```ignore,no_run
1556 /// # use google_cloud_modelarmor_v1::model::CreateTemplateRequest;
1557 /// let x = CreateTemplateRequest::new().set_parent("example");
1558 /// ```
1559 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1560 self.parent = v.into();
1561 self
1562 }
1563
1564 /// Sets the value of [template_id][crate::model::CreateTemplateRequest::template_id].
1565 ///
1566 /// # Example
1567 /// ```ignore,no_run
1568 /// # use google_cloud_modelarmor_v1::model::CreateTemplateRequest;
1569 /// let x = CreateTemplateRequest::new().set_template_id("example");
1570 /// ```
1571 pub fn set_template_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1572 self.template_id = v.into();
1573 self
1574 }
1575
1576 /// Sets the value of [template][crate::model::CreateTemplateRequest::template].
1577 ///
1578 /// # Example
1579 /// ```ignore,no_run
1580 /// # use google_cloud_modelarmor_v1::model::CreateTemplateRequest;
1581 /// use google_cloud_modelarmor_v1::model::Template;
1582 /// let x = CreateTemplateRequest::new().set_template(Template::default()/* use setters */);
1583 /// ```
1584 pub fn set_template<T>(mut self, v: T) -> Self
1585 where
1586 T: std::convert::Into<crate::model::Template>,
1587 {
1588 self.template = std::option::Option::Some(v.into());
1589 self
1590 }
1591
1592 /// Sets or clears the value of [template][crate::model::CreateTemplateRequest::template].
1593 ///
1594 /// # Example
1595 /// ```ignore,no_run
1596 /// # use google_cloud_modelarmor_v1::model::CreateTemplateRequest;
1597 /// use google_cloud_modelarmor_v1::model::Template;
1598 /// let x = CreateTemplateRequest::new().set_or_clear_template(Some(Template::default()/* use setters */));
1599 /// let x = CreateTemplateRequest::new().set_or_clear_template(None::<Template>);
1600 /// ```
1601 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
1602 where
1603 T: std::convert::Into<crate::model::Template>,
1604 {
1605 self.template = v.map(|x| x.into());
1606 self
1607 }
1608
1609 /// Sets the value of [request_id][crate::model::CreateTemplateRequest::request_id].
1610 ///
1611 /// # Example
1612 /// ```ignore,no_run
1613 /// # use google_cloud_modelarmor_v1::model::CreateTemplateRequest;
1614 /// let x = CreateTemplateRequest::new().set_request_id("example");
1615 /// ```
1616 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1617 self.request_id = v.into();
1618 self
1619 }
1620}
1621
1622impl wkt::message::Message for CreateTemplateRequest {
1623 fn typename() -> &'static str {
1624 "type.googleapis.com/google.cloud.modelarmor.v1.CreateTemplateRequest"
1625 }
1626}
1627
1628/// Message for updating a Template
1629#[derive(Clone, Default, PartialEq)]
1630#[non_exhaustive]
1631pub struct UpdateTemplateRequest {
1632 /// Required. Field mask is used to specify the fields to be overwritten in the
1633 /// Template resource by the update.
1634 /// The fields specified in the update_mask are relative to the resource, not
1635 /// the full request. A field will be overwritten if it is in the mask. If the
1636 /// user does not provide a mask then all fields will be overwritten.
1637 pub update_mask: std::option::Option<wkt::FieldMask>,
1638
1639 /// Required. The resource being updated
1640 pub template: std::option::Option<crate::model::Template>,
1641
1642 /// Optional. An optional request ID to identify requests. Specify a unique
1643 /// request ID so that if you must retry your request, the server will know to
1644 /// ignore the request if it has already been completed. The server stores the
1645 /// request ID for 60 minutes after the first request.
1646 ///
1647 /// For example, consider a situation where you make an initial request and the
1648 /// request times out. If you make the request again with the same request
1649 /// ID, the server can check if original operation with the same request ID
1650 /// was received, and if so, will ignore the second request. This prevents
1651 /// clients from accidentally creating duplicate commitments.
1652 ///
1653 /// The request ID must be a valid UUID with the exception that zero UUID is
1654 /// not supported (00000000-0000-0000-0000-000000000000).
1655 pub request_id: std::string::String,
1656
1657 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1658}
1659
1660impl UpdateTemplateRequest {
1661 pub fn new() -> Self {
1662 std::default::Default::default()
1663 }
1664
1665 /// Sets the value of [update_mask][crate::model::UpdateTemplateRequest::update_mask].
1666 ///
1667 /// # Example
1668 /// ```ignore,no_run
1669 /// # use google_cloud_modelarmor_v1::model::UpdateTemplateRequest;
1670 /// use wkt::FieldMask;
1671 /// let x = UpdateTemplateRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1672 /// ```
1673 pub fn set_update_mask<T>(mut self, v: T) -> Self
1674 where
1675 T: std::convert::Into<wkt::FieldMask>,
1676 {
1677 self.update_mask = std::option::Option::Some(v.into());
1678 self
1679 }
1680
1681 /// Sets or clears the value of [update_mask][crate::model::UpdateTemplateRequest::update_mask].
1682 ///
1683 /// # Example
1684 /// ```ignore,no_run
1685 /// # use google_cloud_modelarmor_v1::model::UpdateTemplateRequest;
1686 /// use wkt::FieldMask;
1687 /// let x = UpdateTemplateRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1688 /// let x = UpdateTemplateRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1689 /// ```
1690 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1691 where
1692 T: std::convert::Into<wkt::FieldMask>,
1693 {
1694 self.update_mask = v.map(|x| x.into());
1695 self
1696 }
1697
1698 /// Sets the value of [template][crate::model::UpdateTemplateRequest::template].
1699 ///
1700 /// # Example
1701 /// ```ignore,no_run
1702 /// # use google_cloud_modelarmor_v1::model::UpdateTemplateRequest;
1703 /// use google_cloud_modelarmor_v1::model::Template;
1704 /// let x = UpdateTemplateRequest::new().set_template(Template::default()/* use setters */);
1705 /// ```
1706 pub fn set_template<T>(mut self, v: T) -> Self
1707 where
1708 T: std::convert::Into<crate::model::Template>,
1709 {
1710 self.template = std::option::Option::Some(v.into());
1711 self
1712 }
1713
1714 /// Sets or clears the value of [template][crate::model::UpdateTemplateRequest::template].
1715 ///
1716 /// # Example
1717 /// ```ignore,no_run
1718 /// # use google_cloud_modelarmor_v1::model::UpdateTemplateRequest;
1719 /// use google_cloud_modelarmor_v1::model::Template;
1720 /// let x = UpdateTemplateRequest::new().set_or_clear_template(Some(Template::default()/* use setters */));
1721 /// let x = UpdateTemplateRequest::new().set_or_clear_template(None::<Template>);
1722 /// ```
1723 pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
1724 where
1725 T: std::convert::Into<crate::model::Template>,
1726 {
1727 self.template = v.map(|x| x.into());
1728 self
1729 }
1730
1731 /// Sets the value of [request_id][crate::model::UpdateTemplateRequest::request_id].
1732 ///
1733 /// # Example
1734 /// ```ignore,no_run
1735 /// # use google_cloud_modelarmor_v1::model::UpdateTemplateRequest;
1736 /// let x = UpdateTemplateRequest::new().set_request_id("example");
1737 /// ```
1738 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1739 self.request_id = v.into();
1740 self
1741 }
1742}
1743
1744impl wkt::message::Message for UpdateTemplateRequest {
1745 fn typename() -> &'static str {
1746 "type.googleapis.com/google.cloud.modelarmor.v1.UpdateTemplateRequest"
1747 }
1748}
1749
1750/// Message for deleting a Template
1751#[derive(Clone, Default, PartialEq)]
1752#[non_exhaustive]
1753pub struct DeleteTemplateRequest {
1754 /// Required. Name of the resource
1755 pub name: std::string::String,
1756
1757 /// Optional. An optional request ID to identify requests. Specify a unique
1758 /// request ID so that if you must retry your request, the server will know to
1759 /// ignore the request if it has already been completed. The server stores the
1760 /// request ID for 60 minutes after the first request.
1761 ///
1762 /// For example, consider a situation where you make an initial request and the
1763 /// request times out. If you make the request again with the same request
1764 /// ID, the server can check if original operation with the same request ID
1765 /// was received, and if so, will ignore the second request. This prevents
1766 /// clients from accidentally creating duplicate commitments.
1767 ///
1768 /// The request ID must be a valid UUID with the exception that zero UUID is
1769 /// not supported (00000000-0000-0000-0000-000000000000).
1770 pub request_id: std::string::String,
1771
1772 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1773}
1774
1775impl DeleteTemplateRequest {
1776 pub fn new() -> Self {
1777 std::default::Default::default()
1778 }
1779
1780 /// Sets the value of [name][crate::model::DeleteTemplateRequest::name].
1781 ///
1782 /// # Example
1783 /// ```ignore,no_run
1784 /// # use google_cloud_modelarmor_v1::model::DeleteTemplateRequest;
1785 /// let x = DeleteTemplateRequest::new().set_name("example");
1786 /// ```
1787 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1788 self.name = v.into();
1789 self
1790 }
1791
1792 /// Sets the value of [request_id][crate::model::DeleteTemplateRequest::request_id].
1793 ///
1794 /// # Example
1795 /// ```ignore,no_run
1796 /// # use google_cloud_modelarmor_v1::model::DeleteTemplateRequest;
1797 /// let x = DeleteTemplateRequest::new().set_request_id("example");
1798 /// ```
1799 pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1800 self.request_id = v.into();
1801 self
1802 }
1803}
1804
1805impl wkt::message::Message for DeleteTemplateRequest {
1806 fn typename() -> &'static str {
1807 "type.googleapis.com/google.cloud.modelarmor.v1.DeleteTemplateRequest"
1808 }
1809}
1810
1811/// Message for getting a Floor Setting
1812#[derive(Clone, Default, PartialEq)]
1813#[non_exhaustive]
1814pub struct GetFloorSettingRequest {
1815 /// Required. The name of the floor setting to get, example
1816 /// projects/123/floorsetting.
1817 pub name: std::string::String,
1818
1819 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1820}
1821
1822impl GetFloorSettingRequest {
1823 pub fn new() -> Self {
1824 std::default::Default::default()
1825 }
1826
1827 /// Sets the value of [name][crate::model::GetFloorSettingRequest::name].
1828 ///
1829 /// # Example
1830 /// ```ignore,no_run
1831 /// # use google_cloud_modelarmor_v1::model::GetFloorSettingRequest;
1832 /// let x = GetFloorSettingRequest::new().set_name("example");
1833 /// ```
1834 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1835 self.name = v.into();
1836 self
1837 }
1838}
1839
1840impl wkt::message::Message for GetFloorSettingRequest {
1841 fn typename() -> &'static str {
1842 "type.googleapis.com/google.cloud.modelarmor.v1.GetFloorSettingRequest"
1843 }
1844}
1845
1846/// Message for Updating a Floor Setting
1847#[derive(Clone, Default, PartialEq)]
1848#[non_exhaustive]
1849pub struct UpdateFloorSettingRequest {
1850 /// Required. The floor setting being updated.
1851 pub floor_setting: std::option::Option<crate::model::FloorSetting>,
1852
1853 /// Optional. Field mask is used to specify the fields to be overwritten in the
1854 /// FloorSetting resource by the update.
1855 /// The fields specified in the update_mask are relative to the resource, not
1856 /// the full request. A field will be overwritten if it is in the mask. If the
1857 /// user does not provide a mask then all fields will be overwritten.
1858 pub update_mask: std::option::Option<wkt::FieldMask>,
1859
1860 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1861}
1862
1863impl UpdateFloorSettingRequest {
1864 pub fn new() -> Self {
1865 std::default::Default::default()
1866 }
1867
1868 /// Sets the value of [floor_setting][crate::model::UpdateFloorSettingRequest::floor_setting].
1869 ///
1870 /// # Example
1871 /// ```ignore,no_run
1872 /// # use google_cloud_modelarmor_v1::model::UpdateFloorSettingRequest;
1873 /// use google_cloud_modelarmor_v1::model::FloorSetting;
1874 /// let x = UpdateFloorSettingRequest::new().set_floor_setting(FloorSetting::default()/* use setters */);
1875 /// ```
1876 pub fn set_floor_setting<T>(mut self, v: T) -> Self
1877 where
1878 T: std::convert::Into<crate::model::FloorSetting>,
1879 {
1880 self.floor_setting = std::option::Option::Some(v.into());
1881 self
1882 }
1883
1884 /// Sets or clears the value of [floor_setting][crate::model::UpdateFloorSettingRequest::floor_setting].
1885 ///
1886 /// # Example
1887 /// ```ignore,no_run
1888 /// # use google_cloud_modelarmor_v1::model::UpdateFloorSettingRequest;
1889 /// use google_cloud_modelarmor_v1::model::FloorSetting;
1890 /// let x = UpdateFloorSettingRequest::new().set_or_clear_floor_setting(Some(FloorSetting::default()/* use setters */));
1891 /// let x = UpdateFloorSettingRequest::new().set_or_clear_floor_setting(None::<FloorSetting>);
1892 /// ```
1893 pub fn set_or_clear_floor_setting<T>(mut self, v: std::option::Option<T>) -> Self
1894 where
1895 T: std::convert::Into<crate::model::FloorSetting>,
1896 {
1897 self.floor_setting = v.map(|x| x.into());
1898 self
1899 }
1900
1901 /// Sets the value of [update_mask][crate::model::UpdateFloorSettingRequest::update_mask].
1902 ///
1903 /// # Example
1904 /// ```ignore,no_run
1905 /// # use google_cloud_modelarmor_v1::model::UpdateFloorSettingRequest;
1906 /// use wkt::FieldMask;
1907 /// let x = UpdateFloorSettingRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1908 /// ```
1909 pub fn set_update_mask<T>(mut self, v: T) -> Self
1910 where
1911 T: std::convert::Into<wkt::FieldMask>,
1912 {
1913 self.update_mask = std::option::Option::Some(v.into());
1914 self
1915 }
1916
1917 /// Sets or clears the value of [update_mask][crate::model::UpdateFloorSettingRequest::update_mask].
1918 ///
1919 /// # Example
1920 /// ```ignore,no_run
1921 /// # use google_cloud_modelarmor_v1::model::UpdateFloorSettingRequest;
1922 /// use wkt::FieldMask;
1923 /// let x = UpdateFloorSettingRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1924 /// let x = UpdateFloorSettingRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1925 /// ```
1926 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1927 where
1928 T: std::convert::Into<wkt::FieldMask>,
1929 {
1930 self.update_mask = v.map(|x| x.into());
1931 self
1932 }
1933}
1934
1935impl wkt::message::Message for UpdateFloorSettingRequest {
1936 fn typename() -> &'static str {
1937 "type.googleapis.com/google.cloud.modelarmor.v1.UpdateFloorSettingRequest"
1938 }
1939}
1940
1941/// Filters configuration.
1942#[derive(Clone, Default, PartialEq)]
1943#[non_exhaustive]
1944pub struct FilterConfig {
1945 /// Optional. Responsible AI settings.
1946 pub rai_settings: std::option::Option<crate::model::RaiFilterSettings>,
1947
1948 /// Optional. Sensitive Data Protection settings.
1949 pub sdp_settings: std::option::Option<crate::model::SdpFilterSettings>,
1950
1951 /// Optional. Prompt injection and Jailbreak filter settings.
1952 pub pi_and_jailbreak_filter_settings:
1953 std::option::Option<crate::model::PiAndJailbreakFilterSettings>,
1954
1955 /// Optional. Malicious URI filter settings.
1956 pub malicious_uri_filter_settings:
1957 std::option::Option<crate::model::MaliciousUriFilterSettings>,
1958
1959 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1960}
1961
1962impl FilterConfig {
1963 pub fn new() -> Self {
1964 std::default::Default::default()
1965 }
1966
1967 /// Sets the value of [rai_settings][crate::model::FilterConfig::rai_settings].
1968 ///
1969 /// # Example
1970 /// ```ignore,no_run
1971 /// # use google_cloud_modelarmor_v1::model::FilterConfig;
1972 /// use google_cloud_modelarmor_v1::model::RaiFilterSettings;
1973 /// let x = FilterConfig::new().set_rai_settings(RaiFilterSettings::default()/* use setters */);
1974 /// ```
1975 pub fn set_rai_settings<T>(mut self, v: T) -> Self
1976 where
1977 T: std::convert::Into<crate::model::RaiFilterSettings>,
1978 {
1979 self.rai_settings = std::option::Option::Some(v.into());
1980 self
1981 }
1982
1983 /// Sets or clears the value of [rai_settings][crate::model::FilterConfig::rai_settings].
1984 ///
1985 /// # Example
1986 /// ```ignore,no_run
1987 /// # use google_cloud_modelarmor_v1::model::FilterConfig;
1988 /// use google_cloud_modelarmor_v1::model::RaiFilterSettings;
1989 /// let x = FilterConfig::new().set_or_clear_rai_settings(Some(RaiFilterSettings::default()/* use setters */));
1990 /// let x = FilterConfig::new().set_or_clear_rai_settings(None::<RaiFilterSettings>);
1991 /// ```
1992 pub fn set_or_clear_rai_settings<T>(mut self, v: std::option::Option<T>) -> Self
1993 where
1994 T: std::convert::Into<crate::model::RaiFilterSettings>,
1995 {
1996 self.rai_settings = v.map(|x| x.into());
1997 self
1998 }
1999
2000 /// Sets the value of [sdp_settings][crate::model::FilterConfig::sdp_settings].
2001 ///
2002 /// # Example
2003 /// ```ignore,no_run
2004 /// # use google_cloud_modelarmor_v1::model::FilterConfig;
2005 /// use google_cloud_modelarmor_v1::model::SdpFilterSettings;
2006 /// let x = FilterConfig::new().set_sdp_settings(SdpFilterSettings::default()/* use setters */);
2007 /// ```
2008 pub fn set_sdp_settings<T>(mut self, v: T) -> Self
2009 where
2010 T: std::convert::Into<crate::model::SdpFilterSettings>,
2011 {
2012 self.sdp_settings = std::option::Option::Some(v.into());
2013 self
2014 }
2015
2016 /// Sets or clears the value of [sdp_settings][crate::model::FilterConfig::sdp_settings].
2017 ///
2018 /// # Example
2019 /// ```ignore,no_run
2020 /// # use google_cloud_modelarmor_v1::model::FilterConfig;
2021 /// use google_cloud_modelarmor_v1::model::SdpFilterSettings;
2022 /// let x = FilterConfig::new().set_or_clear_sdp_settings(Some(SdpFilterSettings::default()/* use setters */));
2023 /// let x = FilterConfig::new().set_or_clear_sdp_settings(None::<SdpFilterSettings>);
2024 /// ```
2025 pub fn set_or_clear_sdp_settings<T>(mut self, v: std::option::Option<T>) -> Self
2026 where
2027 T: std::convert::Into<crate::model::SdpFilterSettings>,
2028 {
2029 self.sdp_settings = v.map(|x| x.into());
2030 self
2031 }
2032
2033 /// Sets the value of [pi_and_jailbreak_filter_settings][crate::model::FilterConfig::pi_and_jailbreak_filter_settings].
2034 ///
2035 /// # Example
2036 /// ```ignore,no_run
2037 /// # use google_cloud_modelarmor_v1::model::FilterConfig;
2038 /// use google_cloud_modelarmor_v1::model::PiAndJailbreakFilterSettings;
2039 /// let x = FilterConfig::new().set_pi_and_jailbreak_filter_settings(PiAndJailbreakFilterSettings::default()/* use setters */);
2040 /// ```
2041 pub fn set_pi_and_jailbreak_filter_settings<T>(mut self, v: T) -> Self
2042 where
2043 T: std::convert::Into<crate::model::PiAndJailbreakFilterSettings>,
2044 {
2045 self.pi_and_jailbreak_filter_settings = std::option::Option::Some(v.into());
2046 self
2047 }
2048
2049 /// Sets or clears the value of [pi_and_jailbreak_filter_settings][crate::model::FilterConfig::pi_and_jailbreak_filter_settings].
2050 ///
2051 /// # Example
2052 /// ```ignore,no_run
2053 /// # use google_cloud_modelarmor_v1::model::FilterConfig;
2054 /// use google_cloud_modelarmor_v1::model::PiAndJailbreakFilterSettings;
2055 /// let x = FilterConfig::new().set_or_clear_pi_and_jailbreak_filter_settings(Some(PiAndJailbreakFilterSettings::default()/* use setters */));
2056 /// let x = FilterConfig::new().set_or_clear_pi_and_jailbreak_filter_settings(None::<PiAndJailbreakFilterSettings>);
2057 /// ```
2058 pub fn set_or_clear_pi_and_jailbreak_filter_settings<T>(
2059 mut self,
2060 v: std::option::Option<T>,
2061 ) -> Self
2062 where
2063 T: std::convert::Into<crate::model::PiAndJailbreakFilterSettings>,
2064 {
2065 self.pi_and_jailbreak_filter_settings = v.map(|x| x.into());
2066 self
2067 }
2068
2069 /// Sets the value of [malicious_uri_filter_settings][crate::model::FilterConfig::malicious_uri_filter_settings].
2070 ///
2071 /// # Example
2072 /// ```ignore,no_run
2073 /// # use google_cloud_modelarmor_v1::model::FilterConfig;
2074 /// use google_cloud_modelarmor_v1::model::MaliciousUriFilterSettings;
2075 /// let x = FilterConfig::new().set_malicious_uri_filter_settings(MaliciousUriFilterSettings::default()/* use setters */);
2076 /// ```
2077 pub fn set_malicious_uri_filter_settings<T>(mut self, v: T) -> Self
2078 where
2079 T: std::convert::Into<crate::model::MaliciousUriFilterSettings>,
2080 {
2081 self.malicious_uri_filter_settings = std::option::Option::Some(v.into());
2082 self
2083 }
2084
2085 /// Sets or clears the value of [malicious_uri_filter_settings][crate::model::FilterConfig::malicious_uri_filter_settings].
2086 ///
2087 /// # Example
2088 /// ```ignore,no_run
2089 /// # use google_cloud_modelarmor_v1::model::FilterConfig;
2090 /// use google_cloud_modelarmor_v1::model::MaliciousUriFilterSettings;
2091 /// let x = FilterConfig::new().set_or_clear_malicious_uri_filter_settings(Some(MaliciousUriFilterSettings::default()/* use setters */));
2092 /// let x = FilterConfig::new().set_or_clear_malicious_uri_filter_settings(None::<MaliciousUriFilterSettings>);
2093 /// ```
2094 pub fn set_or_clear_malicious_uri_filter_settings<T>(
2095 mut self,
2096 v: std::option::Option<T>,
2097 ) -> Self
2098 where
2099 T: std::convert::Into<crate::model::MaliciousUriFilterSettings>,
2100 {
2101 self.malicious_uri_filter_settings = v.map(|x| x.into());
2102 self
2103 }
2104}
2105
2106impl wkt::message::Message for FilterConfig {
2107 fn typename() -> &'static str {
2108 "type.googleapis.com/google.cloud.modelarmor.v1.FilterConfig"
2109 }
2110}
2111
2112/// Prompt injection and Jailbreak Filter settings.
2113#[derive(Clone, Default, PartialEq)]
2114#[non_exhaustive]
2115pub struct PiAndJailbreakFilterSettings {
2116 /// Optional. Tells whether Prompt injection and Jailbreak filter is enabled or
2117 /// disabled.
2118 pub filter_enforcement:
2119 crate::model::pi_and_jailbreak_filter_settings::PiAndJailbreakFilterEnforcement,
2120
2121 /// Optional. Confidence level for this filter.
2122 /// Confidence level is used to determine the threshold for the filter. If
2123 /// detection confidence is equal to or greater than the specified level, a
2124 /// positive match is reported. Confidence level will only be used if the
2125 /// filter is enabled.
2126 pub confidence_level: crate::model::DetectionConfidenceLevel,
2127
2128 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2129}
2130
2131impl PiAndJailbreakFilterSettings {
2132 pub fn new() -> Self {
2133 std::default::Default::default()
2134 }
2135
2136 /// Sets the value of [filter_enforcement][crate::model::PiAndJailbreakFilterSettings::filter_enforcement].
2137 ///
2138 /// # Example
2139 /// ```ignore,no_run
2140 /// # use google_cloud_modelarmor_v1::model::PiAndJailbreakFilterSettings;
2141 /// use google_cloud_modelarmor_v1::model::pi_and_jailbreak_filter_settings::PiAndJailbreakFilterEnforcement;
2142 /// let x0 = PiAndJailbreakFilterSettings::new().set_filter_enforcement(PiAndJailbreakFilterEnforcement::Enabled);
2143 /// let x1 = PiAndJailbreakFilterSettings::new().set_filter_enforcement(PiAndJailbreakFilterEnforcement::Disabled);
2144 /// ```
2145 pub fn set_filter_enforcement<
2146 T: std::convert::Into<
2147 crate::model::pi_and_jailbreak_filter_settings::PiAndJailbreakFilterEnforcement,
2148 >,
2149 >(
2150 mut self,
2151 v: T,
2152 ) -> Self {
2153 self.filter_enforcement = v.into();
2154 self
2155 }
2156
2157 /// Sets the value of [confidence_level][crate::model::PiAndJailbreakFilterSettings::confidence_level].
2158 ///
2159 /// # Example
2160 /// ```ignore,no_run
2161 /// # use google_cloud_modelarmor_v1::model::PiAndJailbreakFilterSettings;
2162 /// use google_cloud_modelarmor_v1::model::DetectionConfidenceLevel;
2163 /// let x0 = PiAndJailbreakFilterSettings::new().set_confidence_level(DetectionConfidenceLevel::LowAndAbove);
2164 /// let x1 = PiAndJailbreakFilterSettings::new().set_confidence_level(DetectionConfidenceLevel::MediumAndAbove);
2165 /// let x2 = PiAndJailbreakFilterSettings::new().set_confidence_level(DetectionConfidenceLevel::High);
2166 /// ```
2167 pub fn set_confidence_level<T: std::convert::Into<crate::model::DetectionConfidenceLevel>>(
2168 mut self,
2169 v: T,
2170 ) -> Self {
2171 self.confidence_level = v.into();
2172 self
2173 }
2174}
2175
2176impl wkt::message::Message for PiAndJailbreakFilterSettings {
2177 fn typename() -> &'static str {
2178 "type.googleapis.com/google.cloud.modelarmor.v1.PiAndJailbreakFilterSettings"
2179 }
2180}
2181
2182/// Defines additional types related to [PiAndJailbreakFilterSettings].
2183pub mod pi_and_jailbreak_filter_settings {
2184 #[allow(unused_imports)]
2185 use super::*;
2186
2187 /// Option to specify the state of Prompt Injection and Jailbreak filter
2188 /// (ENABLED/DISABLED).
2189 ///
2190 /// # Working with unknown values
2191 ///
2192 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2193 /// additional enum variants at any time. Adding new variants is not considered
2194 /// a breaking change. Applications should write their code in anticipation of:
2195 ///
2196 /// - New values appearing in future releases of the client library, **and**
2197 /// - New values received dynamically, without application changes.
2198 ///
2199 /// Please consult the [Working with enums] section in the user guide for some
2200 /// guidelines.
2201 ///
2202 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2203 #[derive(Clone, Debug, PartialEq)]
2204 #[non_exhaustive]
2205 pub enum PiAndJailbreakFilterEnforcement {
2206 /// Same as Disabled
2207 Unspecified,
2208 /// Enabled
2209 Enabled,
2210 /// Enabled
2211 Disabled,
2212 /// If set, the enum was initialized with an unknown value.
2213 ///
2214 /// Applications can examine the value using [PiAndJailbreakFilterEnforcement::value] or
2215 /// [PiAndJailbreakFilterEnforcement::name].
2216 UnknownValue(pi_and_jailbreak_filter_enforcement::UnknownValue),
2217 }
2218
2219 #[doc(hidden)]
2220 pub mod pi_and_jailbreak_filter_enforcement {
2221 #[allow(unused_imports)]
2222 use super::*;
2223 #[derive(Clone, Debug, PartialEq)]
2224 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2225 }
2226
2227 impl PiAndJailbreakFilterEnforcement {
2228 /// Gets the enum value.
2229 ///
2230 /// Returns `None` if the enum contains an unknown value deserialized from
2231 /// the string representation of enums.
2232 pub fn value(&self) -> std::option::Option<i32> {
2233 match self {
2234 Self::Unspecified => std::option::Option::Some(0),
2235 Self::Enabled => std::option::Option::Some(1),
2236 Self::Disabled => std::option::Option::Some(2),
2237 Self::UnknownValue(u) => u.0.value(),
2238 }
2239 }
2240
2241 /// Gets the enum value as a string.
2242 ///
2243 /// Returns `None` if the enum contains an unknown value deserialized from
2244 /// the integer representation of enums.
2245 pub fn name(&self) -> std::option::Option<&str> {
2246 match self {
2247 Self::Unspecified => {
2248 std::option::Option::Some("PI_AND_JAILBREAK_FILTER_ENFORCEMENT_UNSPECIFIED")
2249 }
2250 Self::Enabled => std::option::Option::Some("ENABLED"),
2251 Self::Disabled => std::option::Option::Some("DISABLED"),
2252 Self::UnknownValue(u) => u.0.name(),
2253 }
2254 }
2255 }
2256
2257 impl std::default::Default for PiAndJailbreakFilterEnforcement {
2258 fn default() -> Self {
2259 use std::convert::From;
2260 Self::from(0)
2261 }
2262 }
2263
2264 impl std::fmt::Display for PiAndJailbreakFilterEnforcement {
2265 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2266 wkt::internal::display_enum(f, self.name(), self.value())
2267 }
2268 }
2269
2270 impl std::convert::From<i32> for PiAndJailbreakFilterEnforcement {
2271 fn from(value: i32) -> Self {
2272 match value {
2273 0 => Self::Unspecified,
2274 1 => Self::Enabled,
2275 2 => Self::Disabled,
2276 _ => Self::UnknownValue(pi_and_jailbreak_filter_enforcement::UnknownValue(
2277 wkt::internal::UnknownEnumValue::Integer(value),
2278 )),
2279 }
2280 }
2281 }
2282
2283 impl std::convert::From<&str> for PiAndJailbreakFilterEnforcement {
2284 fn from(value: &str) -> Self {
2285 use std::string::ToString;
2286 match value {
2287 "PI_AND_JAILBREAK_FILTER_ENFORCEMENT_UNSPECIFIED" => Self::Unspecified,
2288 "ENABLED" => Self::Enabled,
2289 "DISABLED" => Self::Disabled,
2290 _ => Self::UnknownValue(pi_and_jailbreak_filter_enforcement::UnknownValue(
2291 wkt::internal::UnknownEnumValue::String(value.to_string()),
2292 )),
2293 }
2294 }
2295 }
2296
2297 impl serde::ser::Serialize for PiAndJailbreakFilterEnforcement {
2298 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2299 where
2300 S: serde::Serializer,
2301 {
2302 match self {
2303 Self::Unspecified => serializer.serialize_i32(0),
2304 Self::Enabled => serializer.serialize_i32(1),
2305 Self::Disabled => serializer.serialize_i32(2),
2306 Self::UnknownValue(u) => u.0.serialize(serializer),
2307 }
2308 }
2309 }
2310
2311 impl<'de> serde::de::Deserialize<'de> for PiAndJailbreakFilterEnforcement {
2312 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2313 where
2314 D: serde::Deserializer<'de>,
2315 {
2316 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PiAndJailbreakFilterEnforcement>::new(
2317 ".google.cloud.modelarmor.v1.PiAndJailbreakFilterSettings.PiAndJailbreakFilterEnforcement"))
2318 }
2319 }
2320}
2321
2322/// Malicious URI filter settings.
2323#[derive(Clone, Default, PartialEq)]
2324#[non_exhaustive]
2325pub struct MaliciousUriFilterSettings {
2326 /// Optional. Tells whether the Malicious URI filter is enabled or disabled.
2327 pub filter_enforcement:
2328 crate::model::malicious_uri_filter_settings::MaliciousUriFilterEnforcement,
2329
2330 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2331}
2332
2333impl MaliciousUriFilterSettings {
2334 pub fn new() -> Self {
2335 std::default::Default::default()
2336 }
2337
2338 /// Sets the value of [filter_enforcement][crate::model::MaliciousUriFilterSettings::filter_enforcement].
2339 ///
2340 /// # Example
2341 /// ```ignore,no_run
2342 /// # use google_cloud_modelarmor_v1::model::MaliciousUriFilterSettings;
2343 /// use google_cloud_modelarmor_v1::model::malicious_uri_filter_settings::MaliciousUriFilterEnforcement;
2344 /// let x0 = MaliciousUriFilterSettings::new().set_filter_enforcement(MaliciousUriFilterEnforcement::Enabled);
2345 /// let x1 = MaliciousUriFilterSettings::new().set_filter_enforcement(MaliciousUriFilterEnforcement::Disabled);
2346 /// ```
2347 pub fn set_filter_enforcement<
2348 T: std::convert::Into<
2349 crate::model::malicious_uri_filter_settings::MaliciousUriFilterEnforcement,
2350 >,
2351 >(
2352 mut self,
2353 v: T,
2354 ) -> Self {
2355 self.filter_enforcement = v.into();
2356 self
2357 }
2358}
2359
2360impl wkt::message::Message for MaliciousUriFilterSettings {
2361 fn typename() -> &'static str {
2362 "type.googleapis.com/google.cloud.modelarmor.v1.MaliciousUriFilterSettings"
2363 }
2364}
2365
2366/// Defines additional types related to [MaliciousUriFilterSettings].
2367pub mod malicious_uri_filter_settings {
2368 #[allow(unused_imports)]
2369 use super::*;
2370
2371 /// Option to specify the state of Malicious URI filter (ENABLED/DISABLED).
2372 ///
2373 /// # Working with unknown values
2374 ///
2375 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2376 /// additional enum variants at any time. Adding new variants is not considered
2377 /// a breaking change. Applications should write their code in anticipation of:
2378 ///
2379 /// - New values appearing in future releases of the client library, **and**
2380 /// - New values received dynamically, without application changes.
2381 ///
2382 /// Please consult the [Working with enums] section in the user guide for some
2383 /// guidelines.
2384 ///
2385 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2386 #[derive(Clone, Debug, PartialEq)]
2387 #[non_exhaustive]
2388 pub enum MaliciousUriFilterEnforcement {
2389 /// Same as Disabled
2390 Unspecified,
2391 /// Enabled
2392 Enabled,
2393 /// Disabled
2394 Disabled,
2395 /// If set, the enum was initialized with an unknown value.
2396 ///
2397 /// Applications can examine the value using [MaliciousUriFilterEnforcement::value] or
2398 /// [MaliciousUriFilterEnforcement::name].
2399 UnknownValue(malicious_uri_filter_enforcement::UnknownValue),
2400 }
2401
2402 #[doc(hidden)]
2403 pub mod malicious_uri_filter_enforcement {
2404 #[allow(unused_imports)]
2405 use super::*;
2406 #[derive(Clone, Debug, PartialEq)]
2407 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2408 }
2409
2410 impl MaliciousUriFilterEnforcement {
2411 /// Gets the enum value.
2412 ///
2413 /// Returns `None` if the enum contains an unknown value deserialized from
2414 /// the string representation of enums.
2415 pub fn value(&self) -> std::option::Option<i32> {
2416 match self {
2417 Self::Unspecified => std::option::Option::Some(0),
2418 Self::Enabled => std::option::Option::Some(1),
2419 Self::Disabled => std::option::Option::Some(2),
2420 Self::UnknownValue(u) => u.0.value(),
2421 }
2422 }
2423
2424 /// Gets the enum value as a string.
2425 ///
2426 /// Returns `None` if the enum contains an unknown value deserialized from
2427 /// the integer representation of enums.
2428 pub fn name(&self) -> std::option::Option<&str> {
2429 match self {
2430 Self::Unspecified => {
2431 std::option::Option::Some("MALICIOUS_URI_FILTER_ENFORCEMENT_UNSPECIFIED")
2432 }
2433 Self::Enabled => std::option::Option::Some("ENABLED"),
2434 Self::Disabled => std::option::Option::Some("DISABLED"),
2435 Self::UnknownValue(u) => u.0.name(),
2436 }
2437 }
2438 }
2439
2440 impl std::default::Default for MaliciousUriFilterEnforcement {
2441 fn default() -> Self {
2442 use std::convert::From;
2443 Self::from(0)
2444 }
2445 }
2446
2447 impl std::fmt::Display for MaliciousUriFilterEnforcement {
2448 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2449 wkt::internal::display_enum(f, self.name(), self.value())
2450 }
2451 }
2452
2453 impl std::convert::From<i32> for MaliciousUriFilterEnforcement {
2454 fn from(value: i32) -> Self {
2455 match value {
2456 0 => Self::Unspecified,
2457 1 => Self::Enabled,
2458 2 => Self::Disabled,
2459 _ => Self::UnknownValue(malicious_uri_filter_enforcement::UnknownValue(
2460 wkt::internal::UnknownEnumValue::Integer(value),
2461 )),
2462 }
2463 }
2464 }
2465
2466 impl std::convert::From<&str> for MaliciousUriFilterEnforcement {
2467 fn from(value: &str) -> Self {
2468 use std::string::ToString;
2469 match value {
2470 "MALICIOUS_URI_FILTER_ENFORCEMENT_UNSPECIFIED" => Self::Unspecified,
2471 "ENABLED" => Self::Enabled,
2472 "DISABLED" => Self::Disabled,
2473 _ => Self::UnknownValue(malicious_uri_filter_enforcement::UnknownValue(
2474 wkt::internal::UnknownEnumValue::String(value.to_string()),
2475 )),
2476 }
2477 }
2478 }
2479
2480 impl serde::ser::Serialize for MaliciousUriFilterEnforcement {
2481 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2482 where
2483 S: serde::Serializer,
2484 {
2485 match self {
2486 Self::Unspecified => serializer.serialize_i32(0),
2487 Self::Enabled => serializer.serialize_i32(1),
2488 Self::Disabled => serializer.serialize_i32(2),
2489 Self::UnknownValue(u) => u.0.serialize(serializer),
2490 }
2491 }
2492 }
2493
2494 impl<'de> serde::de::Deserialize<'de> for MaliciousUriFilterEnforcement {
2495 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2496 where
2497 D: serde::Deserializer<'de>,
2498 {
2499 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MaliciousUriFilterEnforcement>::new(
2500 ".google.cloud.modelarmor.v1.MaliciousUriFilterSettings.MaliciousUriFilterEnforcement"))
2501 }
2502 }
2503}
2504
2505/// Responsible AI Filter settings.
2506#[derive(Clone, Default, PartialEq)]
2507#[non_exhaustive]
2508pub struct RaiFilterSettings {
2509 /// Required. List of Responsible AI filters enabled for template.
2510 pub rai_filters: std::vec::Vec<crate::model::rai_filter_settings::RaiFilter>,
2511
2512 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2513}
2514
2515impl RaiFilterSettings {
2516 pub fn new() -> Self {
2517 std::default::Default::default()
2518 }
2519
2520 /// Sets the value of [rai_filters][crate::model::RaiFilterSettings::rai_filters].
2521 ///
2522 /// # Example
2523 /// ```ignore,no_run
2524 /// # use google_cloud_modelarmor_v1::model::RaiFilterSettings;
2525 /// use google_cloud_modelarmor_v1::model::rai_filter_settings::RaiFilter;
2526 /// let x = RaiFilterSettings::new()
2527 /// .set_rai_filters([
2528 /// RaiFilter::default()/* use setters */,
2529 /// RaiFilter::default()/* use (different) setters */,
2530 /// ]);
2531 /// ```
2532 pub fn set_rai_filters<T, V>(mut self, v: T) -> Self
2533 where
2534 T: std::iter::IntoIterator<Item = V>,
2535 V: std::convert::Into<crate::model::rai_filter_settings::RaiFilter>,
2536 {
2537 use std::iter::Iterator;
2538 self.rai_filters = v.into_iter().map(|i| i.into()).collect();
2539 self
2540 }
2541}
2542
2543impl wkt::message::Message for RaiFilterSettings {
2544 fn typename() -> &'static str {
2545 "type.googleapis.com/google.cloud.modelarmor.v1.RaiFilterSettings"
2546 }
2547}
2548
2549/// Defines additional types related to [RaiFilterSettings].
2550pub mod rai_filter_settings {
2551 #[allow(unused_imports)]
2552 use super::*;
2553
2554 /// Responsible AI filter.
2555 #[derive(Clone, Default, PartialEq)]
2556 #[non_exhaustive]
2557 pub struct RaiFilter {
2558 /// Required. Type of responsible AI filter.
2559 pub filter_type: crate::model::RaiFilterType,
2560
2561 /// Optional. Confidence level for this RAI filter.
2562 /// During data sanitization, if data is classified under this filter with a
2563 /// confidence level equal to or greater than the specified level, a positive
2564 /// match is reported. If the confidence level is unspecified (i.e., 0), the
2565 /// system will use a reasonable default level based on the `filter_type`.
2566 pub confidence_level: crate::model::DetectionConfidenceLevel,
2567
2568 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2569 }
2570
2571 impl RaiFilter {
2572 pub fn new() -> Self {
2573 std::default::Default::default()
2574 }
2575
2576 /// Sets the value of [filter_type][crate::model::rai_filter_settings::RaiFilter::filter_type].
2577 ///
2578 /// # Example
2579 /// ```ignore,no_run
2580 /// # use google_cloud_modelarmor_v1::model::rai_filter_settings::RaiFilter;
2581 /// use google_cloud_modelarmor_v1::model::RaiFilterType;
2582 /// let x0 = RaiFilter::new().set_filter_type(RaiFilterType::SexuallyExplicit);
2583 /// let x1 = RaiFilter::new().set_filter_type(RaiFilterType::HateSpeech);
2584 /// let x2 = RaiFilter::new().set_filter_type(RaiFilterType::Harassment);
2585 /// ```
2586 pub fn set_filter_type<T: std::convert::Into<crate::model::RaiFilterType>>(
2587 mut self,
2588 v: T,
2589 ) -> Self {
2590 self.filter_type = v.into();
2591 self
2592 }
2593
2594 /// Sets the value of [confidence_level][crate::model::rai_filter_settings::RaiFilter::confidence_level].
2595 ///
2596 /// # Example
2597 /// ```ignore,no_run
2598 /// # use google_cloud_modelarmor_v1::model::rai_filter_settings::RaiFilter;
2599 /// use google_cloud_modelarmor_v1::model::DetectionConfidenceLevel;
2600 /// let x0 = RaiFilter::new().set_confidence_level(DetectionConfidenceLevel::LowAndAbove);
2601 /// let x1 = RaiFilter::new().set_confidence_level(DetectionConfidenceLevel::MediumAndAbove);
2602 /// let x2 = RaiFilter::new().set_confidence_level(DetectionConfidenceLevel::High);
2603 /// ```
2604 pub fn set_confidence_level<
2605 T: std::convert::Into<crate::model::DetectionConfidenceLevel>,
2606 >(
2607 mut self,
2608 v: T,
2609 ) -> Self {
2610 self.confidence_level = v.into();
2611 self
2612 }
2613 }
2614
2615 impl wkt::message::Message for RaiFilter {
2616 fn typename() -> &'static str {
2617 "type.googleapis.com/google.cloud.modelarmor.v1.RaiFilterSettings.RaiFilter"
2618 }
2619 }
2620}
2621
2622/// Sensitive Data Protection settings.
2623#[derive(Clone, Default, PartialEq)]
2624#[non_exhaustive]
2625pub struct SdpFilterSettings {
2626 /// Either of Sensitive Data Protection basic or advanced configuration.
2627 pub sdp_configuration: std::option::Option<crate::model::sdp_filter_settings::SdpConfiguration>,
2628
2629 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2630}
2631
2632impl SdpFilterSettings {
2633 pub fn new() -> Self {
2634 std::default::Default::default()
2635 }
2636
2637 /// Sets the value of [sdp_configuration][crate::model::SdpFilterSettings::sdp_configuration].
2638 ///
2639 /// Note that all the setters affecting `sdp_configuration` are mutually
2640 /// exclusive.
2641 ///
2642 /// # Example
2643 /// ```ignore,no_run
2644 /// # use google_cloud_modelarmor_v1::model::SdpFilterSettings;
2645 /// use google_cloud_modelarmor_v1::model::SdpBasicConfig;
2646 /// let x = SdpFilterSettings::new().set_sdp_configuration(Some(
2647 /// google_cloud_modelarmor_v1::model::sdp_filter_settings::SdpConfiguration::BasicConfig(SdpBasicConfig::default().into())));
2648 /// ```
2649 pub fn set_sdp_configuration<
2650 T: std::convert::Into<
2651 std::option::Option<crate::model::sdp_filter_settings::SdpConfiguration>,
2652 >,
2653 >(
2654 mut self,
2655 v: T,
2656 ) -> Self {
2657 self.sdp_configuration = v.into();
2658 self
2659 }
2660
2661 /// The value of [sdp_configuration][crate::model::SdpFilterSettings::sdp_configuration]
2662 /// if it holds a `BasicConfig`, `None` if the field is not set or
2663 /// holds a different branch.
2664 pub fn basic_config(
2665 &self,
2666 ) -> std::option::Option<&std::boxed::Box<crate::model::SdpBasicConfig>> {
2667 #[allow(unreachable_patterns)]
2668 self.sdp_configuration.as_ref().and_then(|v| match v {
2669 crate::model::sdp_filter_settings::SdpConfiguration::BasicConfig(v) => {
2670 std::option::Option::Some(v)
2671 }
2672 _ => std::option::Option::None,
2673 })
2674 }
2675
2676 /// Sets the value of [sdp_configuration][crate::model::SdpFilterSettings::sdp_configuration]
2677 /// to hold a `BasicConfig`.
2678 ///
2679 /// Note that all the setters affecting `sdp_configuration` are
2680 /// mutually exclusive.
2681 ///
2682 /// # Example
2683 /// ```ignore,no_run
2684 /// # use google_cloud_modelarmor_v1::model::SdpFilterSettings;
2685 /// use google_cloud_modelarmor_v1::model::SdpBasicConfig;
2686 /// let x = SdpFilterSettings::new().set_basic_config(SdpBasicConfig::default()/* use setters */);
2687 /// assert!(x.basic_config().is_some());
2688 /// assert!(x.advanced_config().is_none());
2689 /// ```
2690 pub fn set_basic_config<
2691 T: std::convert::Into<std::boxed::Box<crate::model::SdpBasicConfig>>,
2692 >(
2693 mut self,
2694 v: T,
2695 ) -> Self {
2696 self.sdp_configuration = std::option::Option::Some(
2697 crate::model::sdp_filter_settings::SdpConfiguration::BasicConfig(v.into()),
2698 );
2699 self
2700 }
2701
2702 /// The value of [sdp_configuration][crate::model::SdpFilterSettings::sdp_configuration]
2703 /// if it holds a `AdvancedConfig`, `None` if the field is not set or
2704 /// holds a different branch.
2705 pub fn advanced_config(
2706 &self,
2707 ) -> std::option::Option<&std::boxed::Box<crate::model::SdpAdvancedConfig>> {
2708 #[allow(unreachable_patterns)]
2709 self.sdp_configuration.as_ref().and_then(|v| match v {
2710 crate::model::sdp_filter_settings::SdpConfiguration::AdvancedConfig(v) => {
2711 std::option::Option::Some(v)
2712 }
2713 _ => std::option::Option::None,
2714 })
2715 }
2716
2717 /// Sets the value of [sdp_configuration][crate::model::SdpFilterSettings::sdp_configuration]
2718 /// to hold a `AdvancedConfig`.
2719 ///
2720 /// Note that all the setters affecting `sdp_configuration` are
2721 /// mutually exclusive.
2722 ///
2723 /// # Example
2724 /// ```ignore,no_run
2725 /// # use google_cloud_modelarmor_v1::model::SdpFilterSettings;
2726 /// use google_cloud_modelarmor_v1::model::SdpAdvancedConfig;
2727 /// let x = SdpFilterSettings::new().set_advanced_config(SdpAdvancedConfig::default()/* use setters */);
2728 /// assert!(x.advanced_config().is_some());
2729 /// assert!(x.basic_config().is_none());
2730 /// ```
2731 pub fn set_advanced_config<
2732 T: std::convert::Into<std::boxed::Box<crate::model::SdpAdvancedConfig>>,
2733 >(
2734 mut self,
2735 v: T,
2736 ) -> Self {
2737 self.sdp_configuration = std::option::Option::Some(
2738 crate::model::sdp_filter_settings::SdpConfiguration::AdvancedConfig(v.into()),
2739 );
2740 self
2741 }
2742}
2743
2744impl wkt::message::Message for SdpFilterSettings {
2745 fn typename() -> &'static str {
2746 "type.googleapis.com/google.cloud.modelarmor.v1.SdpFilterSettings"
2747 }
2748}
2749
2750/// Defines additional types related to [SdpFilterSettings].
2751pub mod sdp_filter_settings {
2752 #[allow(unused_imports)]
2753 use super::*;
2754
2755 /// Either of Sensitive Data Protection basic or advanced configuration.
2756 #[derive(Clone, Debug, PartialEq)]
2757 #[non_exhaustive]
2758 pub enum SdpConfiguration {
2759 /// Optional. Basic Sensitive Data Protection configuration inspects the
2760 /// content for sensitive data using a fixed set of six info-types. Sensitive
2761 /// Data Protection templates cannot be used with basic configuration. Only
2762 /// Sensitive Data Protection inspection operation is supported with basic
2763 /// configuration.
2764 BasicConfig(std::boxed::Box<crate::model::SdpBasicConfig>),
2765 /// Optional. Advanced Sensitive Data Protection configuration which enables
2766 /// use of Sensitive Data Protection templates. Supports both Sensitive Data
2767 /// Protection inspection and de-identification operations.
2768 AdvancedConfig(std::boxed::Box<crate::model::SdpAdvancedConfig>),
2769 }
2770}
2771
2772/// Sensitive Data Protection basic configuration.
2773#[derive(Clone, Default, PartialEq)]
2774#[non_exhaustive]
2775pub struct SdpBasicConfig {
2776 /// Optional. Tells whether the Sensitive Data Protection basic config is
2777 /// enabled or disabled.
2778 pub filter_enforcement: crate::model::sdp_basic_config::SdpBasicConfigEnforcement,
2779
2780 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2781}
2782
2783impl SdpBasicConfig {
2784 pub fn new() -> Self {
2785 std::default::Default::default()
2786 }
2787
2788 /// Sets the value of [filter_enforcement][crate::model::SdpBasicConfig::filter_enforcement].
2789 ///
2790 /// # Example
2791 /// ```ignore,no_run
2792 /// # use google_cloud_modelarmor_v1::model::SdpBasicConfig;
2793 /// use google_cloud_modelarmor_v1::model::sdp_basic_config::SdpBasicConfigEnforcement;
2794 /// let x0 = SdpBasicConfig::new().set_filter_enforcement(SdpBasicConfigEnforcement::Enabled);
2795 /// let x1 = SdpBasicConfig::new().set_filter_enforcement(SdpBasicConfigEnforcement::Disabled);
2796 /// ```
2797 pub fn set_filter_enforcement<
2798 T: std::convert::Into<crate::model::sdp_basic_config::SdpBasicConfigEnforcement>,
2799 >(
2800 mut self,
2801 v: T,
2802 ) -> Self {
2803 self.filter_enforcement = v.into();
2804 self
2805 }
2806}
2807
2808impl wkt::message::Message for SdpBasicConfig {
2809 fn typename() -> &'static str {
2810 "type.googleapis.com/google.cloud.modelarmor.v1.SdpBasicConfig"
2811 }
2812}
2813
2814/// Defines additional types related to [SdpBasicConfig].
2815pub mod sdp_basic_config {
2816 #[allow(unused_imports)]
2817 use super::*;
2818
2819 /// Option to specify the state of Sensitive Data Protection basic config
2820 /// (ENABLED/DISABLED).
2821 ///
2822 /// # Working with unknown values
2823 ///
2824 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2825 /// additional enum variants at any time. Adding new variants is not considered
2826 /// a breaking change. Applications should write their code in anticipation of:
2827 ///
2828 /// - New values appearing in future releases of the client library, **and**
2829 /// - New values received dynamically, without application changes.
2830 ///
2831 /// Please consult the [Working with enums] section in the user guide for some
2832 /// guidelines.
2833 ///
2834 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2835 #[derive(Clone, Debug, PartialEq)]
2836 #[non_exhaustive]
2837 pub enum SdpBasicConfigEnforcement {
2838 /// Same as Disabled
2839 Unspecified,
2840 /// Enabled
2841 Enabled,
2842 /// Disabled
2843 Disabled,
2844 /// If set, the enum was initialized with an unknown value.
2845 ///
2846 /// Applications can examine the value using [SdpBasicConfigEnforcement::value] or
2847 /// [SdpBasicConfigEnforcement::name].
2848 UnknownValue(sdp_basic_config_enforcement::UnknownValue),
2849 }
2850
2851 #[doc(hidden)]
2852 pub mod sdp_basic_config_enforcement {
2853 #[allow(unused_imports)]
2854 use super::*;
2855 #[derive(Clone, Debug, PartialEq)]
2856 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2857 }
2858
2859 impl SdpBasicConfigEnforcement {
2860 /// Gets the enum value.
2861 ///
2862 /// Returns `None` if the enum contains an unknown value deserialized from
2863 /// the string representation of enums.
2864 pub fn value(&self) -> std::option::Option<i32> {
2865 match self {
2866 Self::Unspecified => std::option::Option::Some(0),
2867 Self::Enabled => std::option::Option::Some(1),
2868 Self::Disabled => std::option::Option::Some(2),
2869 Self::UnknownValue(u) => u.0.value(),
2870 }
2871 }
2872
2873 /// Gets the enum value as a string.
2874 ///
2875 /// Returns `None` if the enum contains an unknown value deserialized from
2876 /// the integer representation of enums.
2877 pub fn name(&self) -> std::option::Option<&str> {
2878 match self {
2879 Self::Unspecified => {
2880 std::option::Option::Some("SDP_BASIC_CONFIG_ENFORCEMENT_UNSPECIFIED")
2881 }
2882 Self::Enabled => std::option::Option::Some("ENABLED"),
2883 Self::Disabled => std::option::Option::Some("DISABLED"),
2884 Self::UnknownValue(u) => u.0.name(),
2885 }
2886 }
2887 }
2888
2889 impl std::default::Default for SdpBasicConfigEnforcement {
2890 fn default() -> Self {
2891 use std::convert::From;
2892 Self::from(0)
2893 }
2894 }
2895
2896 impl std::fmt::Display for SdpBasicConfigEnforcement {
2897 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2898 wkt::internal::display_enum(f, self.name(), self.value())
2899 }
2900 }
2901
2902 impl std::convert::From<i32> for SdpBasicConfigEnforcement {
2903 fn from(value: i32) -> Self {
2904 match value {
2905 0 => Self::Unspecified,
2906 1 => Self::Enabled,
2907 2 => Self::Disabled,
2908 _ => Self::UnknownValue(sdp_basic_config_enforcement::UnknownValue(
2909 wkt::internal::UnknownEnumValue::Integer(value),
2910 )),
2911 }
2912 }
2913 }
2914
2915 impl std::convert::From<&str> for SdpBasicConfigEnforcement {
2916 fn from(value: &str) -> Self {
2917 use std::string::ToString;
2918 match value {
2919 "SDP_BASIC_CONFIG_ENFORCEMENT_UNSPECIFIED" => Self::Unspecified,
2920 "ENABLED" => Self::Enabled,
2921 "DISABLED" => Self::Disabled,
2922 _ => Self::UnknownValue(sdp_basic_config_enforcement::UnknownValue(
2923 wkt::internal::UnknownEnumValue::String(value.to_string()),
2924 )),
2925 }
2926 }
2927 }
2928
2929 impl serde::ser::Serialize for SdpBasicConfigEnforcement {
2930 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2931 where
2932 S: serde::Serializer,
2933 {
2934 match self {
2935 Self::Unspecified => serializer.serialize_i32(0),
2936 Self::Enabled => serializer.serialize_i32(1),
2937 Self::Disabled => serializer.serialize_i32(2),
2938 Self::UnknownValue(u) => u.0.serialize(serializer),
2939 }
2940 }
2941 }
2942
2943 impl<'de> serde::de::Deserialize<'de> for SdpBasicConfigEnforcement {
2944 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2945 where
2946 D: serde::Deserializer<'de>,
2947 {
2948 deserializer.deserialize_any(
2949 wkt::internal::EnumVisitor::<SdpBasicConfigEnforcement>::new(
2950 ".google.cloud.modelarmor.v1.SdpBasicConfig.SdpBasicConfigEnforcement",
2951 ),
2952 )
2953 }
2954 }
2955}
2956
2957/// Sensitive Data Protection Advanced configuration.
2958#[derive(Clone, Default, PartialEq)]
2959#[non_exhaustive]
2960pub struct SdpAdvancedConfig {
2961 /// Optional. Sensitive Data Protection inspect template resource name
2962 ///
2963 /// If only inspect template is provided (de-identify template not provided),
2964 /// then Sensitive Data Protection InspectContent action is performed during
2965 /// Sanitization. All Sensitive Data Protection findings identified during
2966 /// inspection will be returned as SdpFinding in SdpInsepctionResult.
2967 ///
2968 /// e.g.
2969 /// `projects/{project}/locations/{location}/inspectTemplates/{inspect_template}`
2970 pub inspect_template: std::string::String,
2971
2972 /// Optional. Optional Sensitive Data Protection Deidentify template resource
2973 /// name.
2974 ///
2975 /// If provided then DeidentifyContent action is performed during Sanitization
2976 /// using this template and inspect template. The De-identified data will
2977 /// be returned in SdpDeidentifyResult.
2978 /// Note that all info-types present in the deidentify template must be present
2979 /// in inspect template.
2980 ///
2981 /// e.g.
2982 /// `projects/{project}/locations/{location}/deidentifyTemplates/{deidentify_template}`
2983 pub deidentify_template: std::string::String,
2984
2985 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2986}
2987
2988impl SdpAdvancedConfig {
2989 pub fn new() -> Self {
2990 std::default::Default::default()
2991 }
2992
2993 /// Sets the value of [inspect_template][crate::model::SdpAdvancedConfig::inspect_template].
2994 ///
2995 /// # Example
2996 /// ```ignore,no_run
2997 /// # use google_cloud_modelarmor_v1::model::SdpAdvancedConfig;
2998 /// let x = SdpAdvancedConfig::new().set_inspect_template("example");
2999 /// ```
3000 pub fn set_inspect_template<T: std::convert::Into<std::string::String>>(
3001 mut self,
3002 v: T,
3003 ) -> Self {
3004 self.inspect_template = v.into();
3005 self
3006 }
3007
3008 /// Sets the value of [deidentify_template][crate::model::SdpAdvancedConfig::deidentify_template].
3009 ///
3010 /// # Example
3011 /// ```ignore,no_run
3012 /// # use google_cloud_modelarmor_v1::model::SdpAdvancedConfig;
3013 /// let x = SdpAdvancedConfig::new().set_deidentify_template("example");
3014 /// ```
3015 pub fn set_deidentify_template<T: std::convert::Into<std::string::String>>(
3016 mut self,
3017 v: T,
3018 ) -> Self {
3019 self.deidentify_template = v.into();
3020 self
3021 }
3022}
3023
3024impl wkt::message::Message for SdpAdvancedConfig {
3025 fn typename() -> &'static str {
3026 "type.googleapis.com/google.cloud.modelarmor.v1.SdpAdvancedConfig"
3027 }
3028}
3029
3030/// Sanitize User Prompt request.
3031#[derive(Clone, Default, PartialEq)]
3032#[non_exhaustive]
3033pub struct SanitizeUserPromptRequest {
3034 /// Required. Represents resource name of template
3035 /// e.g. name=projects/sample-project/locations/us-central1/templates/templ01
3036 pub name: std::string::String,
3037
3038 /// Required. User prompt data to sanitize.
3039 pub user_prompt_data: std::option::Option<crate::model::DataItem>,
3040
3041 /// Optional. Metadata related to Multi Language Detection.
3042 pub multi_language_detection_metadata:
3043 std::option::Option<crate::model::MultiLanguageDetectionMetadata>,
3044
3045 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3046}
3047
3048impl SanitizeUserPromptRequest {
3049 pub fn new() -> Self {
3050 std::default::Default::default()
3051 }
3052
3053 /// Sets the value of [name][crate::model::SanitizeUserPromptRequest::name].
3054 ///
3055 /// # Example
3056 /// ```ignore,no_run
3057 /// # use google_cloud_modelarmor_v1::model::SanitizeUserPromptRequest;
3058 /// let x = SanitizeUserPromptRequest::new().set_name("example");
3059 /// ```
3060 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3061 self.name = v.into();
3062 self
3063 }
3064
3065 /// Sets the value of [user_prompt_data][crate::model::SanitizeUserPromptRequest::user_prompt_data].
3066 ///
3067 /// # Example
3068 /// ```ignore,no_run
3069 /// # use google_cloud_modelarmor_v1::model::SanitizeUserPromptRequest;
3070 /// use google_cloud_modelarmor_v1::model::DataItem;
3071 /// let x = SanitizeUserPromptRequest::new().set_user_prompt_data(DataItem::default()/* use setters */);
3072 /// ```
3073 pub fn set_user_prompt_data<T>(mut self, v: T) -> Self
3074 where
3075 T: std::convert::Into<crate::model::DataItem>,
3076 {
3077 self.user_prompt_data = std::option::Option::Some(v.into());
3078 self
3079 }
3080
3081 /// Sets or clears the value of [user_prompt_data][crate::model::SanitizeUserPromptRequest::user_prompt_data].
3082 ///
3083 /// # Example
3084 /// ```ignore,no_run
3085 /// # use google_cloud_modelarmor_v1::model::SanitizeUserPromptRequest;
3086 /// use google_cloud_modelarmor_v1::model::DataItem;
3087 /// let x = SanitizeUserPromptRequest::new().set_or_clear_user_prompt_data(Some(DataItem::default()/* use setters */));
3088 /// let x = SanitizeUserPromptRequest::new().set_or_clear_user_prompt_data(None::<DataItem>);
3089 /// ```
3090 pub fn set_or_clear_user_prompt_data<T>(mut self, v: std::option::Option<T>) -> Self
3091 where
3092 T: std::convert::Into<crate::model::DataItem>,
3093 {
3094 self.user_prompt_data = v.map(|x| x.into());
3095 self
3096 }
3097
3098 /// Sets the value of [multi_language_detection_metadata][crate::model::SanitizeUserPromptRequest::multi_language_detection_metadata].
3099 ///
3100 /// # Example
3101 /// ```ignore,no_run
3102 /// # use google_cloud_modelarmor_v1::model::SanitizeUserPromptRequest;
3103 /// use google_cloud_modelarmor_v1::model::MultiLanguageDetectionMetadata;
3104 /// let x = SanitizeUserPromptRequest::new().set_multi_language_detection_metadata(MultiLanguageDetectionMetadata::default()/* use setters */);
3105 /// ```
3106 pub fn set_multi_language_detection_metadata<T>(mut self, v: T) -> Self
3107 where
3108 T: std::convert::Into<crate::model::MultiLanguageDetectionMetadata>,
3109 {
3110 self.multi_language_detection_metadata = std::option::Option::Some(v.into());
3111 self
3112 }
3113
3114 /// Sets or clears the value of [multi_language_detection_metadata][crate::model::SanitizeUserPromptRequest::multi_language_detection_metadata].
3115 ///
3116 /// # Example
3117 /// ```ignore,no_run
3118 /// # use google_cloud_modelarmor_v1::model::SanitizeUserPromptRequest;
3119 /// use google_cloud_modelarmor_v1::model::MultiLanguageDetectionMetadata;
3120 /// let x = SanitizeUserPromptRequest::new().set_or_clear_multi_language_detection_metadata(Some(MultiLanguageDetectionMetadata::default()/* use setters */));
3121 /// let x = SanitizeUserPromptRequest::new().set_or_clear_multi_language_detection_metadata(None::<MultiLanguageDetectionMetadata>);
3122 /// ```
3123 pub fn set_or_clear_multi_language_detection_metadata<T>(
3124 mut self,
3125 v: std::option::Option<T>,
3126 ) -> Self
3127 where
3128 T: std::convert::Into<crate::model::MultiLanguageDetectionMetadata>,
3129 {
3130 self.multi_language_detection_metadata = v.map(|x| x.into());
3131 self
3132 }
3133}
3134
3135impl wkt::message::Message for SanitizeUserPromptRequest {
3136 fn typename() -> &'static str {
3137 "type.googleapis.com/google.cloud.modelarmor.v1.SanitizeUserPromptRequest"
3138 }
3139}
3140
3141/// Sanitize Model Response request.
3142#[derive(Clone, Default, PartialEq)]
3143#[non_exhaustive]
3144pub struct SanitizeModelResponseRequest {
3145 /// Required. Represents resource name of template
3146 /// e.g. name=projects/sample-project/locations/us-central1/templates/templ01
3147 pub name: std::string::String,
3148
3149 /// Required. Model response data to sanitize.
3150 pub model_response_data: std::option::Option<crate::model::DataItem>,
3151
3152 /// Optional. User Prompt associated with Model response.
3153 pub user_prompt: std::string::String,
3154
3155 /// Optional. Metadata related for multi language detection.
3156 pub multi_language_detection_metadata:
3157 std::option::Option<crate::model::MultiLanguageDetectionMetadata>,
3158
3159 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3160}
3161
3162impl SanitizeModelResponseRequest {
3163 pub fn new() -> Self {
3164 std::default::Default::default()
3165 }
3166
3167 /// Sets the value of [name][crate::model::SanitizeModelResponseRequest::name].
3168 ///
3169 /// # Example
3170 /// ```ignore,no_run
3171 /// # use google_cloud_modelarmor_v1::model::SanitizeModelResponseRequest;
3172 /// let x = SanitizeModelResponseRequest::new().set_name("example");
3173 /// ```
3174 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3175 self.name = v.into();
3176 self
3177 }
3178
3179 /// Sets the value of [model_response_data][crate::model::SanitizeModelResponseRequest::model_response_data].
3180 ///
3181 /// # Example
3182 /// ```ignore,no_run
3183 /// # use google_cloud_modelarmor_v1::model::SanitizeModelResponseRequest;
3184 /// use google_cloud_modelarmor_v1::model::DataItem;
3185 /// let x = SanitizeModelResponseRequest::new().set_model_response_data(DataItem::default()/* use setters */);
3186 /// ```
3187 pub fn set_model_response_data<T>(mut self, v: T) -> Self
3188 where
3189 T: std::convert::Into<crate::model::DataItem>,
3190 {
3191 self.model_response_data = std::option::Option::Some(v.into());
3192 self
3193 }
3194
3195 /// Sets or clears the value of [model_response_data][crate::model::SanitizeModelResponseRequest::model_response_data].
3196 ///
3197 /// # Example
3198 /// ```ignore,no_run
3199 /// # use google_cloud_modelarmor_v1::model::SanitizeModelResponseRequest;
3200 /// use google_cloud_modelarmor_v1::model::DataItem;
3201 /// let x = SanitizeModelResponseRequest::new().set_or_clear_model_response_data(Some(DataItem::default()/* use setters */));
3202 /// let x = SanitizeModelResponseRequest::new().set_or_clear_model_response_data(None::<DataItem>);
3203 /// ```
3204 pub fn set_or_clear_model_response_data<T>(mut self, v: std::option::Option<T>) -> Self
3205 where
3206 T: std::convert::Into<crate::model::DataItem>,
3207 {
3208 self.model_response_data = v.map(|x| x.into());
3209 self
3210 }
3211
3212 /// Sets the value of [user_prompt][crate::model::SanitizeModelResponseRequest::user_prompt].
3213 ///
3214 /// # Example
3215 /// ```ignore,no_run
3216 /// # use google_cloud_modelarmor_v1::model::SanitizeModelResponseRequest;
3217 /// let x = SanitizeModelResponseRequest::new().set_user_prompt("example");
3218 /// ```
3219 pub fn set_user_prompt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3220 self.user_prompt = v.into();
3221 self
3222 }
3223
3224 /// Sets the value of [multi_language_detection_metadata][crate::model::SanitizeModelResponseRequest::multi_language_detection_metadata].
3225 ///
3226 /// # Example
3227 /// ```ignore,no_run
3228 /// # use google_cloud_modelarmor_v1::model::SanitizeModelResponseRequest;
3229 /// use google_cloud_modelarmor_v1::model::MultiLanguageDetectionMetadata;
3230 /// let x = SanitizeModelResponseRequest::new().set_multi_language_detection_metadata(MultiLanguageDetectionMetadata::default()/* use setters */);
3231 /// ```
3232 pub fn set_multi_language_detection_metadata<T>(mut self, v: T) -> Self
3233 where
3234 T: std::convert::Into<crate::model::MultiLanguageDetectionMetadata>,
3235 {
3236 self.multi_language_detection_metadata = std::option::Option::Some(v.into());
3237 self
3238 }
3239
3240 /// Sets or clears the value of [multi_language_detection_metadata][crate::model::SanitizeModelResponseRequest::multi_language_detection_metadata].
3241 ///
3242 /// # Example
3243 /// ```ignore,no_run
3244 /// # use google_cloud_modelarmor_v1::model::SanitizeModelResponseRequest;
3245 /// use google_cloud_modelarmor_v1::model::MultiLanguageDetectionMetadata;
3246 /// let x = SanitizeModelResponseRequest::new().set_or_clear_multi_language_detection_metadata(Some(MultiLanguageDetectionMetadata::default()/* use setters */));
3247 /// let x = SanitizeModelResponseRequest::new().set_or_clear_multi_language_detection_metadata(None::<MultiLanguageDetectionMetadata>);
3248 /// ```
3249 pub fn set_or_clear_multi_language_detection_metadata<T>(
3250 mut self,
3251 v: std::option::Option<T>,
3252 ) -> Self
3253 where
3254 T: std::convert::Into<crate::model::MultiLanguageDetectionMetadata>,
3255 {
3256 self.multi_language_detection_metadata = v.map(|x| x.into());
3257 self
3258 }
3259}
3260
3261impl wkt::message::Message for SanitizeModelResponseRequest {
3262 fn typename() -> &'static str {
3263 "type.googleapis.com/google.cloud.modelarmor.v1.SanitizeModelResponseRequest"
3264 }
3265}
3266
3267/// Sanitized User Prompt Response.
3268#[derive(Clone, Default, PartialEq)]
3269#[non_exhaustive]
3270pub struct SanitizeUserPromptResponse {
3271 /// Output only. Sanitization Result.
3272 pub sanitization_result: std::option::Option<crate::model::SanitizationResult>,
3273
3274 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3275}
3276
3277impl SanitizeUserPromptResponse {
3278 pub fn new() -> Self {
3279 std::default::Default::default()
3280 }
3281
3282 /// Sets the value of [sanitization_result][crate::model::SanitizeUserPromptResponse::sanitization_result].
3283 ///
3284 /// # Example
3285 /// ```ignore,no_run
3286 /// # use google_cloud_modelarmor_v1::model::SanitizeUserPromptResponse;
3287 /// use google_cloud_modelarmor_v1::model::SanitizationResult;
3288 /// let x = SanitizeUserPromptResponse::new().set_sanitization_result(SanitizationResult::default()/* use setters */);
3289 /// ```
3290 pub fn set_sanitization_result<T>(mut self, v: T) -> Self
3291 where
3292 T: std::convert::Into<crate::model::SanitizationResult>,
3293 {
3294 self.sanitization_result = std::option::Option::Some(v.into());
3295 self
3296 }
3297
3298 /// Sets or clears the value of [sanitization_result][crate::model::SanitizeUserPromptResponse::sanitization_result].
3299 ///
3300 /// # Example
3301 /// ```ignore,no_run
3302 /// # use google_cloud_modelarmor_v1::model::SanitizeUserPromptResponse;
3303 /// use google_cloud_modelarmor_v1::model::SanitizationResult;
3304 /// let x = SanitizeUserPromptResponse::new().set_or_clear_sanitization_result(Some(SanitizationResult::default()/* use setters */));
3305 /// let x = SanitizeUserPromptResponse::new().set_or_clear_sanitization_result(None::<SanitizationResult>);
3306 /// ```
3307 pub fn set_or_clear_sanitization_result<T>(mut self, v: std::option::Option<T>) -> Self
3308 where
3309 T: std::convert::Into<crate::model::SanitizationResult>,
3310 {
3311 self.sanitization_result = v.map(|x| x.into());
3312 self
3313 }
3314}
3315
3316impl wkt::message::Message for SanitizeUserPromptResponse {
3317 fn typename() -> &'static str {
3318 "type.googleapis.com/google.cloud.modelarmor.v1.SanitizeUserPromptResponse"
3319 }
3320}
3321
3322/// Sanitized Model Response Response.
3323#[derive(Clone, Default, PartialEq)]
3324#[non_exhaustive]
3325pub struct SanitizeModelResponseResponse {
3326 /// Output only. Sanitization Result.
3327 pub sanitization_result: std::option::Option<crate::model::SanitizationResult>,
3328
3329 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3330}
3331
3332impl SanitizeModelResponseResponse {
3333 pub fn new() -> Self {
3334 std::default::Default::default()
3335 }
3336
3337 /// Sets the value of [sanitization_result][crate::model::SanitizeModelResponseResponse::sanitization_result].
3338 ///
3339 /// # Example
3340 /// ```ignore,no_run
3341 /// # use google_cloud_modelarmor_v1::model::SanitizeModelResponseResponse;
3342 /// use google_cloud_modelarmor_v1::model::SanitizationResult;
3343 /// let x = SanitizeModelResponseResponse::new().set_sanitization_result(SanitizationResult::default()/* use setters */);
3344 /// ```
3345 pub fn set_sanitization_result<T>(mut self, v: T) -> Self
3346 where
3347 T: std::convert::Into<crate::model::SanitizationResult>,
3348 {
3349 self.sanitization_result = std::option::Option::Some(v.into());
3350 self
3351 }
3352
3353 /// Sets or clears the value of [sanitization_result][crate::model::SanitizeModelResponseResponse::sanitization_result].
3354 ///
3355 /// # Example
3356 /// ```ignore,no_run
3357 /// # use google_cloud_modelarmor_v1::model::SanitizeModelResponseResponse;
3358 /// use google_cloud_modelarmor_v1::model::SanitizationResult;
3359 /// let x = SanitizeModelResponseResponse::new().set_or_clear_sanitization_result(Some(SanitizationResult::default()/* use setters */));
3360 /// let x = SanitizeModelResponseResponse::new().set_or_clear_sanitization_result(None::<SanitizationResult>);
3361 /// ```
3362 pub fn set_or_clear_sanitization_result<T>(mut self, v: std::option::Option<T>) -> Self
3363 where
3364 T: std::convert::Into<crate::model::SanitizationResult>,
3365 {
3366 self.sanitization_result = v.map(|x| x.into());
3367 self
3368 }
3369}
3370
3371impl wkt::message::Message for SanitizeModelResponseResponse {
3372 fn typename() -> &'static str {
3373 "type.googleapis.com/google.cloud.modelarmor.v1.SanitizeModelResponseResponse"
3374 }
3375}
3376
3377/// Sanitization result after applying all the filters on input content.
3378#[derive(Clone, Default, PartialEq)]
3379#[non_exhaustive]
3380pub struct SanitizationResult {
3381 /// Output only. Overall filter match state for Sanitization.
3382 /// The state can have below two values.
3383 ///
3384 /// 1. NO_MATCH_FOUND: No filters in configuration satisfy matching criteria.
3385 /// In other words, input passed all filters.
3386 ///
3387 /// 1. MATCH_FOUND: At least one filter in configuration satisfies matching.
3388 /// In other words, input did not pass one or more filters.
3389 ///
3390 pub filter_match_state: crate::model::FilterMatchState,
3391
3392 /// Output only. Results for all filters where the key is the filter name -
3393 /// either of "csam", "malicious_uris", "rai", "pi_and_jailbreak" ,"sdp".
3394 pub filter_results: std::collections::HashMap<std::string::String, crate::model::FilterResult>,
3395
3396 /// Output only. A field indicating the outcome of the invocation, irrespective
3397 /// of match status. It can have the following three values: SUCCESS: All
3398 /// filters were executed successfully. PARTIAL: Some filters were skipped or
3399 /// failed execution. FAILURE: All filters were skipped or failed execution.
3400 pub invocation_result: crate::model::InvocationResult,
3401
3402 /// Output only. Metadata related to Sanitization.
3403 pub sanitization_metadata:
3404 std::option::Option<crate::model::sanitization_result::SanitizationMetadata>,
3405
3406 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3407}
3408
3409impl SanitizationResult {
3410 pub fn new() -> Self {
3411 std::default::Default::default()
3412 }
3413
3414 /// Sets the value of [filter_match_state][crate::model::SanitizationResult::filter_match_state].
3415 ///
3416 /// # Example
3417 /// ```ignore,no_run
3418 /// # use google_cloud_modelarmor_v1::model::SanitizationResult;
3419 /// use google_cloud_modelarmor_v1::model::FilterMatchState;
3420 /// let x0 = SanitizationResult::new().set_filter_match_state(FilterMatchState::NoMatchFound);
3421 /// let x1 = SanitizationResult::new().set_filter_match_state(FilterMatchState::MatchFound);
3422 /// ```
3423 pub fn set_filter_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
3424 mut self,
3425 v: T,
3426 ) -> Self {
3427 self.filter_match_state = v.into();
3428 self
3429 }
3430
3431 /// Sets the value of [filter_results][crate::model::SanitizationResult::filter_results].
3432 ///
3433 /// # Example
3434 /// ```ignore,no_run
3435 /// # use google_cloud_modelarmor_v1::model::SanitizationResult;
3436 /// use google_cloud_modelarmor_v1::model::FilterResult;
3437 /// let x = SanitizationResult::new().set_filter_results([
3438 /// ("key0", FilterResult::default()/* use setters */),
3439 /// ("key1", FilterResult::default()/* use (different) setters */),
3440 /// ]);
3441 /// ```
3442 pub fn set_filter_results<T, K, V>(mut self, v: T) -> Self
3443 where
3444 T: std::iter::IntoIterator<Item = (K, V)>,
3445 K: std::convert::Into<std::string::String>,
3446 V: std::convert::Into<crate::model::FilterResult>,
3447 {
3448 use std::iter::Iterator;
3449 self.filter_results = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3450 self
3451 }
3452
3453 /// Sets the value of [invocation_result][crate::model::SanitizationResult::invocation_result].
3454 ///
3455 /// # Example
3456 /// ```ignore,no_run
3457 /// # use google_cloud_modelarmor_v1::model::SanitizationResult;
3458 /// use google_cloud_modelarmor_v1::model::InvocationResult;
3459 /// let x0 = SanitizationResult::new().set_invocation_result(InvocationResult::Success);
3460 /// let x1 = SanitizationResult::new().set_invocation_result(InvocationResult::Partial);
3461 /// let x2 = SanitizationResult::new().set_invocation_result(InvocationResult::Failure);
3462 /// ```
3463 pub fn set_invocation_result<T: std::convert::Into<crate::model::InvocationResult>>(
3464 mut self,
3465 v: T,
3466 ) -> Self {
3467 self.invocation_result = v.into();
3468 self
3469 }
3470
3471 /// Sets the value of [sanitization_metadata][crate::model::SanitizationResult::sanitization_metadata].
3472 ///
3473 /// # Example
3474 /// ```ignore,no_run
3475 /// # use google_cloud_modelarmor_v1::model::SanitizationResult;
3476 /// use google_cloud_modelarmor_v1::model::sanitization_result::SanitizationMetadata;
3477 /// let x = SanitizationResult::new().set_sanitization_metadata(SanitizationMetadata::default()/* use setters */);
3478 /// ```
3479 pub fn set_sanitization_metadata<T>(mut self, v: T) -> Self
3480 where
3481 T: std::convert::Into<crate::model::sanitization_result::SanitizationMetadata>,
3482 {
3483 self.sanitization_metadata = std::option::Option::Some(v.into());
3484 self
3485 }
3486
3487 /// Sets or clears the value of [sanitization_metadata][crate::model::SanitizationResult::sanitization_metadata].
3488 ///
3489 /// # Example
3490 /// ```ignore,no_run
3491 /// # use google_cloud_modelarmor_v1::model::SanitizationResult;
3492 /// use google_cloud_modelarmor_v1::model::sanitization_result::SanitizationMetadata;
3493 /// let x = SanitizationResult::new().set_or_clear_sanitization_metadata(Some(SanitizationMetadata::default()/* use setters */));
3494 /// let x = SanitizationResult::new().set_or_clear_sanitization_metadata(None::<SanitizationMetadata>);
3495 /// ```
3496 pub fn set_or_clear_sanitization_metadata<T>(mut self, v: std::option::Option<T>) -> Self
3497 where
3498 T: std::convert::Into<crate::model::sanitization_result::SanitizationMetadata>,
3499 {
3500 self.sanitization_metadata = v.map(|x| x.into());
3501 self
3502 }
3503}
3504
3505impl wkt::message::Message for SanitizationResult {
3506 fn typename() -> &'static str {
3507 "type.googleapis.com/google.cloud.modelarmor.v1.SanitizationResult"
3508 }
3509}
3510
3511/// Defines additional types related to [SanitizationResult].
3512pub mod sanitization_result {
3513 #[allow(unused_imports)]
3514 use super::*;
3515
3516 /// Message describing Sanitization metadata.
3517 #[derive(Clone, Default, PartialEq)]
3518 #[non_exhaustive]
3519 pub struct SanitizationMetadata {
3520 /// Error code if any.
3521 pub error_code: i64,
3522
3523 /// Error message if any.
3524 pub error_message: std::string::String,
3525
3526 /// Passthrough field defined in TemplateMetadata to indicate whether to
3527 /// ignore partial invocation failures.
3528 pub ignore_partial_invocation_failures: bool,
3529
3530 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3531 }
3532
3533 impl SanitizationMetadata {
3534 pub fn new() -> Self {
3535 std::default::Default::default()
3536 }
3537
3538 /// Sets the value of [error_code][crate::model::sanitization_result::SanitizationMetadata::error_code].
3539 ///
3540 /// # Example
3541 /// ```ignore,no_run
3542 /// # use google_cloud_modelarmor_v1::model::sanitization_result::SanitizationMetadata;
3543 /// let x = SanitizationMetadata::new().set_error_code(42);
3544 /// ```
3545 pub fn set_error_code<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
3546 self.error_code = v.into();
3547 self
3548 }
3549
3550 /// Sets the value of [error_message][crate::model::sanitization_result::SanitizationMetadata::error_message].
3551 ///
3552 /// # Example
3553 /// ```ignore,no_run
3554 /// # use google_cloud_modelarmor_v1::model::sanitization_result::SanitizationMetadata;
3555 /// let x = SanitizationMetadata::new().set_error_message("example");
3556 /// ```
3557 pub fn set_error_message<T: std::convert::Into<std::string::String>>(
3558 mut self,
3559 v: T,
3560 ) -> Self {
3561 self.error_message = v.into();
3562 self
3563 }
3564
3565 /// Sets the value of [ignore_partial_invocation_failures][crate::model::sanitization_result::SanitizationMetadata::ignore_partial_invocation_failures].
3566 ///
3567 /// # Example
3568 /// ```ignore,no_run
3569 /// # use google_cloud_modelarmor_v1::model::sanitization_result::SanitizationMetadata;
3570 /// let x = SanitizationMetadata::new().set_ignore_partial_invocation_failures(true);
3571 /// ```
3572 pub fn set_ignore_partial_invocation_failures<T: std::convert::Into<bool>>(
3573 mut self,
3574 v: T,
3575 ) -> Self {
3576 self.ignore_partial_invocation_failures = v.into();
3577 self
3578 }
3579 }
3580
3581 impl wkt::message::Message for SanitizationMetadata {
3582 fn typename() -> &'static str {
3583 "type.googleapis.com/google.cloud.modelarmor.v1.SanitizationResult.SanitizationMetadata"
3584 }
3585 }
3586}
3587
3588/// Message for Enabling Multi Language Detection.
3589#[derive(Clone, Default, PartialEq)]
3590#[non_exhaustive]
3591pub struct MultiLanguageDetectionMetadata {
3592 /// Optional. Optional Source language of the user prompt.
3593 ///
3594 /// If multi-language detection is enabled but language is not set in that case
3595 /// we would automatically detect the source language.
3596 pub source_language: std::string::String,
3597
3598 /// Optional. Enable detection of multi-language prompts and responses.
3599 pub enable_multi_language_detection: bool,
3600
3601 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3602}
3603
3604impl MultiLanguageDetectionMetadata {
3605 pub fn new() -> Self {
3606 std::default::Default::default()
3607 }
3608
3609 /// Sets the value of [source_language][crate::model::MultiLanguageDetectionMetadata::source_language].
3610 ///
3611 /// # Example
3612 /// ```ignore,no_run
3613 /// # use google_cloud_modelarmor_v1::model::MultiLanguageDetectionMetadata;
3614 /// let x = MultiLanguageDetectionMetadata::new().set_source_language("example");
3615 /// ```
3616 pub fn set_source_language<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3617 self.source_language = v.into();
3618 self
3619 }
3620
3621 /// Sets the value of [enable_multi_language_detection][crate::model::MultiLanguageDetectionMetadata::enable_multi_language_detection].
3622 ///
3623 /// # Example
3624 /// ```ignore,no_run
3625 /// # use google_cloud_modelarmor_v1::model::MultiLanguageDetectionMetadata;
3626 /// let x = MultiLanguageDetectionMetadata::new().set_enable_multi_language_detection(true);
3627 /// ```
3628 pub fn set_enable_multi_language_detection<T: std::convert::Into<bool>>(
3629 mut self,
3630 v: T,
3631 ) -> Self {
3632 self.enable_multi_language_detection = v.into();
3633 self
3634 }
3635}
3636
3637impl wkt::message::Message for MultiLanguageDetectionMetadata {
3638 fn typename() -> &'static str {
3639 "type.googleapis.com/google.cloud.modelarmor.v1.MultiLanguageDetectionMetadata"
3640 }
3641}
3642
3643/// Filter Result obtained after Sanitization operations.
3644#[derive(Clone, Default, PartialEq)]
3645#[non_exhaustive]
3646pub struct FilterResult {
3647 /// Encapsulates one of responsible AI, Sensitive Data Protection, Prompt
3648 /// Injection and Jailbreak, Malicious URI, CSAM, Virus Scan related filter
3649 /// results.
3650 pub filter_result: std::option::Option<crate::model::filter_result::FilterResult>,
3651
3652 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3653}
3654
3655impl FilterResult {
3656 pub fn new() -> Self {
3657 std::default::Default::default()
3658 }
3659
3660 /// Sets the value of [filter_result][crate::model::FilterResult::filter_result].
3661 ///
3662 /// Note that all the setters affecting `filter_result` are mutually
3663 /// exclusive.
3664 ///
3665 /// # Example
3666 /// ```ignore,no_run
3667 /// # use google_cloud_modelarmor_v1::model::FilterResult;
3668 /// use google_cloud_modelarmor_v1::model::RaiFilterResult;
3669 /// let x = FilterResult::new().set_filter_result(Some(
3670 /// google_cloud_modelarmor_v1::model::filter_result::FilterResult::RaiFilterResult(RaiFilterResult::default().into())));
3671 /// ```
3672 pub fn set_filter_result<
3673 T: std::convert::Into<std::option::Option<crate::model::filter_result::FilterResult>>,
3674 >(
3675 mut self,
3676 v: T,
3677 ) -> Self {
3678 self.filter_result = v.into();
3679 self
3680 }
3681
3682 /// The value of [filter_result][crate::model::FilterResult::filter_result]
3683 /// if it holds a `RaiFilterResult`, `None` if the field is not set or
3684 /// holds a different branch.
3685 pub fn rai_filter_result(
3686 &self,
3687 ) -> std::option::Option<&std::boxed::Box<crate::model::RaiFilterResult>> {
3688 #[allow(unreachable_patterns)]
3689 self.filter_result.as_ref().and_then(|v| match v {
3690 crate::model::filter_result::FilterResult::RaiFilterResult(v) => {
3691 std::option::Option::Some(v)
3692 }
3693 _ => std::option::Option::None,
3694 })
3695 }
3696
3697 /// Sets the value of [filter_result][crate::model::FilterResult::filter_result]
3698 /// to hold a `RaiFilterResult`.
3699 ///
3700 /// Note that all the setters affecting `filter_result` are
3701 /// mutually exclusive.
3702 ///
3703 /// # Example
3704 /// ```ignore,no_run
3705 /// # use google_cloud_modelarmor_v1::model::FilterResult;
3706 /// use google_cloud_modelarmor_v1::model::RaiFilterResult;
3707 /// let x = FilterResult::new().set_rai_filter_result(RaiFilterResult::default()/* use setters */);
3708 /// assert!(x.rai_filter_result().is_some());
3709 /// assert!(x.sdp_filter_result().is_none());
3710 /// assert!(x.pi_and_jailbreak_filter_result().is_none());
3711 /// assert!(x.malicious_uri_filter_result().is_none());
3712 /// assert!(x.csam_filter_filter_result().is_none());
3713 /// assert!(x.virus_scan_filter_result().is_none());
3714 /// ```
3715 pub fn set_rai_filter_result<
3716 T: std::convert::Into<std::boxed::Box<crate::model::RaiFilterResult>>,
3717 >(
3718 mut self,
3719 v: T,
3720 ) -> Self {
3721 self.filter_result = std::option::Option::Some(
3722 crate::model::filter_result::FilterResult::RaiFilterResult(v.into()),
3723 );
3724 self
3725 }
3726
3727 /// The value of [filter_result][crate::model::FilterResult::filter_result]
3728 /// if it holds a `SdpFilterResult`, `None` if the field is not set or
3729 /// holds a different branch.
3730 pub fn sdp_filter_result(
3731 &self,
3732 ) -> std::option::Option<&std::boxed::Box<crate::model::SdpFilterResult>> {
3733 #[allow(unreachable_patterns)]
3734 self.filter_result.as_ref().and_then(|v| match v {
3735 crate::model::filter_result::FilterResult::SdpFilterResult(v) => {
3736 std::option::Option::Some(v)
3737 }
3738 _ => std::option::Option::None,
3739 })
3740 }
3741
3742 /// Sets the value of [filter_result][crate::model::FilterResult::filter_result]
3743 /// to hold a `SdpFilterResult`.
3744 ///
3745 /// Note that all the setters affecting `filter_result` are
3746 /// mutually exclusive.
3747 ///
3748 /// # Example
3749 /// ```ignore,no_run
3750 /// # use google_cloud_modelarmor_v1::model::FilterResult;
3751 /// use google_cloud_modelarmor_v1::model::SdpFilterResult;
3752 /// let x = FilterResult::new().set_sdp_filter_result(SdpFilterResult::default()/* use setters */);
3753 /// assert!(x.sdp_filter_result().is_some());
3754 /// assert!(x.rai_filter_result().is_none());
3755 /// assert!(x.pi_and_jailbreak_filter_result().is_none());
3756 /// assert!(x.malicious_uri_filter_result().is_none());
3757 /// assert!(x.csam_filter_filter_result().is_none());
3758 /// assert!(x.virus_scan_filter_result().is_none());
3759 /// ```
3760 pub fn set_sdp_filter_result<
3761 T: std::convert::Into<std::boxed::Box<crate::model::SdpFilterResult>>,
3762 >(
3763 mut self,
3764 v: T,
3765 ) -> Self {
3766 self.filter_result = std::option::Option::Some(
3767 crate::model::filter_result::FilterResult::SdpFilterResult(v.into()),
3768 );
3769 self
3770 }
3771
3772 /// The value of [filter_result][crate::model::FilterResult::filter_result]
3773 /// if it holds a `PiAndJailbreakFilterResult`, `None` if the field is not set or
3774 /// holds a different branch.
3775 pub fn pi_and_jailbreak_filter_result(
3776 &self,
3777 ) -> std::option::Option<&std::boxed::Box<crate::model::PiAndJailbreakFilterResult>> {
3778 #[allow(unreachable_patterns)]
3779 self.filter_result.as_ref().and_then(|v| match v {
3780 crate::model::filter_result::FilterResult::PiAndJailbreakFilterResult(v) => {
3781 std::option::Option::Some(v)
3782 }
3783 _ => std::option::Option::None,
3784 })
3785 }
3786
3787 /// Sets the value of [filter_result][crate::model::FilterResult::filter_result]
3788 /// to hold a `PiAndJailbreakFilterResult`.
3789 ///
3790 /// Note that all the setters affecting `filter_result` are
3791 /// mutually exclusive.
3792 ///
3793 /// # Example
3794 /// ```ignore,no_run
3795 /// # use google_cloud_modelarmor_v1::model::FilterResult;
3796 /// use google_cloud_modelarmor_v1::model::PiAndJailbreakFilterResult;
3797 /// let x = FilterResult::new().set_pi_and_jailbreak_filter_result(PiAndJailbreakFilterResult::default()/* use setters */);
3798 /// assert!(x.pi_and_jailbreak_filter_result().is_some());
3799 /// assert!(x.rai_filter_result().is_none());
3800 /// assert!(x.sdp_filter_result().is_none());
3801 /// assert!(x.malicious_uri_filter_result().is_none());
3802 /// assert!(x.csam_filter_filter_result().is_none());
3803 /// assert!(x.virus_scan_filter_result().is_none());
3804 /// ```
3805 pub fn set_pi_and_jailbreak_filter_result<
3806 T: std::convert::Into<std::boxed::Box<crate::model::PiAndJailbreakFilterResult>>,
3807 >(
3808 mut self,
3809 v: T,
3810 ) -> Self {
3811 self.filter_result = std::option::Option::Some(
3812 crate::model::filter_result::FilterResult::PiAndJailbreakFilterResult(v.into()),
3813 );
3814 self
3815 }
3816
3817 /// The value of [filter_result][crate::model::FilterResult::filter_result]
3818 /// if it holds a `MaliciousUriFilterResult`, `None` if the field is not set or
3819 /// holds a different branch.
3820 pub fn malicious_uri_filter_result(
3821 &self,
3822 ) -> std::option::Option<&std::boxed::Box<crate::model::MaliciousUriFilterResult>> {
3823 #[allow(unreachable_patterns)]
3824 self.filter_result.as_ref().and_then(|v| match v {
3825 crate::model::filter_result::FilterResult::MaliciousUriFilterResult(v) => {
3826 std::option::Option::Some(v)
3827 }
3828 _ => std::option::Option::None,
3829 })
3830 }
3831
3832 /// Sets the value of [filter_result][crate::model::FilterResult::filter_result]
3833 /// to hold a `MaliciousUriFilterResult`.
3834 ///
3835 /// Note that all the setters affecting `filter_result` are
3836 /// mutually exclusive.
3837 ///
3838 /// # Example
3839 /// ```ignore,no_run
3840 /// # use google_cloud_modelarmor_v1::model::FilterResult;
3841 /// use google_cloud_modelarmor_v1::model::MaliciousUriFilterResult;
3842 /// let x = FilterResult::new().set_malicious_uri_filter_result(MaliciousUriFilterResult::default()/* use setters */);
3843 /// assert!(x.malicious_uri_filter_result().is_some());
3844 /// assert!(x.rai_filter_result().is_none());
3845 /// assert!(x.sdp_filter_result().is_none());
3846 /// assert!(x.pi_and_jailbreak_filter_result().is_none());
3847 /// assert!(x.csam_filter_filter_result().is_none());
3848 /// assert!(x.virus_scan_filter_result().is_none());
3849 /// ```
3850 pub fn set_malicious_uri_filter_result<
3851 T: std::convert::Into<std::boxed::Box<crate::model::MaliciousUriFilterResult>>,
3852 >(
3853 mut self,
3854 v: T,
3855 ) -> Self {
3856 self.filter_result = std::option::Option::Some(
3857 crate::model::filter_result::FilterResult::MaliciousUriFilterResult(v.into()),
3858 );
3859 self
3860 }
3861
3862 /// The value of [filter_result][crate::model::FilterResult::filter_result]
3863 /// if it holds a `CsamFilterFilterResult`, `None` if the field is not set or
3864 /// holds a different branch.
3865 pub fn csam_filter_filter_result(
3866 &self,
3867 ) -> std::option::Option<&std::boxed::Box<crate::model::CsamFilterResult>> {
3868 #[allow(unreachable_patterns)]
3869 self.filter_result.as_ref().and_then(|v| match v {
3870 crate::model::filter_result::FilterResult::CsamFilterFilterResult(v) => {
3871 std::option::Option::Some(v)
3872 }
3873 _ => std::option::Option::None,
3874 })
3875 }
3876
3877 /// Sets the value of [filter_result][crate::model::FilterResult::filter_result]
3878 /// to hold a `CsamFilterFilterResult`.
3879 ///
3880 /// Note that all the setters affecting `filter_result` are
3881 /// mutually exclusive.
3882 ///
3883 /// # Example
3884 /// ```ignore,no_run
3885 /// # use google_cloud_modelarmor_v1::model::FilterResult;
3886 /// use google_cloud_modelarmor_v1::model::CsamFilterResult;
3887 /// let x = FilterResult::new().set_csam_filter_filter_result(CsamFilterResult::default()/* use setters */);
3888 /// assert!(x.csam_filter_filter_result().is_some());
3889 /// assert!(x.rai_filter_result().is_none());
3890 /// assert!(x.sdp_filter_result().is_none());
3891 /// assert!(x.pi_and_jailbreak_filter_result().is_none());
3892 /// assert!(x.malicious_uri_filter_result().is_none());
3893 /// assert!(x.virus_scan_filter_result().is_none());
3894 /// ```
3895 pub fn set_csam_filter_filter_result<
3896 T: std::convert::Into<std::boxed::Box<crate::model::CsamFilterResult>>,
3897 >(
3898 mut self,
3899 v: T,
3900 ) -> Self {
3901 self.filter_result = std::option::Option::Some(
3902 crate::model::filter_result::FilterResult::CsamFilterFilterResult(v.into()),
3903 );
3904 self
3905 }
3906
3907 /// The value of [filter_result][crate::model::FilterResult::filter_result]
3908 /// if it holds a `VirusScanFilterResult`, `None` if the field is not set or
3909 /// holds a different branch.
3910 pub fn virus_scan_filter_result(
3911 &self,
3912 ) -> std::option::Option<&std::boxed::Box<crate::model::VirusScanFilterResult>> {
3913 #[allow(unreachable_patterns)]
3914 self.filter_result.as_ref().and_then(|v| match v {
3915 crate::model::filter_result::FilterResult::VirusScanFilterResult(v) => {
3916 std::option::Option::Some(v)
3917 }
3918 _ => std::option::Option::None,
3919 })
3920 }
3921
3922 /// Sets the value of [filter_result][crate::model::FilterResult::filter_result]
3923 /// to hold a `VirusScanFilterResult`.
3924 ///
3925 /// Note that all the setters affecting `filter_result` are
3926 /// mutually exclusive.
3927 ///
3928 /// # Example
3929 /// ```ignore,no_run
3930 /// # use google_cloud_modelarmor_v1::model::FilterResult;
3931 /// use google_cloud_modelarmor_v1::model::VirusScanFilterResult;
3932 /// let x = FilterResult::new().set_virus_scan_filter_result(VirusScanFilterResult::default()/* use setters */);
3933 /// assert!(x.virus_scan_filter_result().is_some());
3934 /// assert!(x.rai_filter_result().is_none());
3935 /// assert!(x.sdp_filter_result().is_none());
3936 /// assert!(x.pi_and_jailbreak_filter_result().is_none());
3937 /// assert!(x.malicious_uri_filter_result().is_none());
3938 /// assert!(x.csam_filter_filter_result().is_none());
3939 /// ```
3940 pub fn set_virus_scan_filter_result<
3941 T: std::convert::Into<std::boxed::Box<crate::model::VirusScanFilterResult>>,
3942 >(
3943 mut self,
3944 v: T,
3945 ) -> Self {
3946 self.filter_result = std::option::Option::Some(
3947 crate::model::filter_result::FilterResult::VirusScanFilterResult(v.into()),
3948 );
3949 self
3950 }
3951}
3952
3953impl wkt::message::Message for FilterResult {
3954 fn typename() -> &'static str {
3955 "type.googleapis.com/google.cloud.modelarmor.v1.FilterResult"
3956 }
3957}
3958
3959/// Defines additional types related to [FilterResult].
3960pub mod filter_result {
3961 #[allow(unused_imports)]
3962 use super::*;
3963
3964 /// Encapsulates one of responsible AI, Sensitive Data Protection, Prompt
3965 /// Injection and Jailbreak, Malicious URI, CSAM, Virus Scan related filter
3966 /// results.
3967 #[derive(Clone, Debug, PartialEq)]
3968 #[non_exhaustive]
3969 pub enum FilterResult {
3970 /// Responsible AI filter results.
3971 RaiFilterResult(std::boxed::Box<crate::model::RaiFilterResult>),
3972 /// Sensitive Data Protection results.
3973 SdpFilterResult(std::boxed::Box<crate::model::SdpFilterResult>),
3974 /// Prompt injection and Jailbreak filter results.
3975 PiAndJailbreakFilterResult(std::boxed::Box<crate::model::PiAndJailbreakFilterResult>),
3976 /// Malicious URI filter results.
3977 MaliciousUriFilterResult(std::boxed::Box<crate::model::MaliciousUriFilterResult>),
3978 /// CSAM filter results.
3979 CsamFilterFilterResult(std::boxed::Box<crate::model::CsamFilterResult>),
3980 /// Virus scan results.
3981 VirusScanFilterResult(std::boxed::Box<crate::model::VirusScanFilterResult>),
3982 }
3983}
3984
3985/// Responsible AI Result.
3986#[derive(Clone, Default, PartialEq)]
3987#[non_exhaustive]
3988pub struct RaiFilterResult {
3989 /// Output only. Reports whether the RAI filter was successfully executed or
3990 /// not.
3991 pub execution_state: crate::model::FilterExecutionState,
3992
3993 /// Optional messages corresponding to the result.
3994 /// A message can provide warnings or error details.
3995 /// For example, if execution state is skipped then this field provides
3996 /// related reason/explanation.
3997 pub message_items: std::vec::Vec<crate::model::MessageItem>,
3998
3999 /// Output only. Overall filter match state for RAI.
4000 /// Value is MATCH_FOUND if at least one RAI filter confidence level is
4001 /// equal to or higher than the confidence level defined in configuration.
4002 pub match_state: crate::model::FilterMatchState,
4003
4004 /// The map of RAI filter results where key is RAI filter type - either of
4005 /// "sexually_explicit", "hate_speech", "harassment", "dangerous".
4006 pub rai_filter_type_results: std::collections::HashMap<
4007 std::string::String,
4008 crate::model::rai_filter_result::RaiFilterTypeResult,
4009 >,
4010
4011 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4012}
4013
4014impl RaiFilterResult {
4015 pub fn new() -> Self {
4016 std::default::Default::default()
4017 }
4018
4019 /// Sets the value of [execution_state][crate::model::RaiFilterResult::execution_state].
4020 ///
4021 /// # Example
4022 /// ```ignore,no_run
4023 /// # use google_cloud_modelarmor_v1::model::RaiFilterResult;
4024 /// use google_cloud_modelarmor_v1::model::FilterExecutionState;
4025 /// let x0 = RaiFilterResult::new().set_execution_state(FilterExecutionState::ExecutionSuccess);
4026 /// let x1 = RaiFilterResult::new().set_execution_state(FilterExecutionState::ExecutionSkipped);
4027 /// ```
4028 pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
4029 mut self,
4030 v: T,
4031 ) -> Self {
4032 self.execution_state = v.into();
4033 self
4034 }
4035
4036 /// Sets the value of [message_items][crate::model::RaiFilterResult::message_items].
4037 ///
4038 /// # Example
4039 /// ```ignore,no_run
4040 /// # use google_cloud_modelarmor_v1::model::RaiFilterResult;
4041 /// use google_cloud_modelarmor_v1::model::MessageItem;
4042 /// let x = RaiFilterResult::new()
4043 /// .set_message_items([
4044 /// MessageItem::default()/* use setters */,
4045 /// MessageItem::default()/* use (different) setters */,
4046 /// ]);
4047 /// ```
4048 pub fn set_message_items<T, V>(mut self, v: T) -> Self
4049 where
4050 T: std::iter::IntoIterator<Item = V>,
4051 V: std::convert::Into<crate::model::MessageItem>,
4052 {
4053 use std::iter::Iterator;
4054 self.message_items = v.into_iter().map(|i| i.into()).collect();
4055 self
4056 }
4057
4058 /// Sets the value of [match_state][crate::model::RaiFilterResult::match_state].
4059 ///
4060 /// # Example
4061 /// ```ignore,no_run
4062 /// # use google_cloud_modelarmor_v1::model::RaiFilterResult;
4063 /// use google_cloud_modelarmor_v1::model::FilterMatchState;
4064 /// let x0 = RaiFilterResult::new().set_match_state(FilterMatchState::NoMatchFound);
4065 /// let x1 = RaiFilterResult::new().set_match_state(FilterMatchState::MatchFound);
4066 /// ```
4067 pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
4068 mut self,
4069 v: T,
4070 ) -> Self {
4071 self.match_state = v.into();
4072 self
4073 }
4074
4075 /// Sets the value of [rai_filter_type_results][crate::model::RaiFilterResult::rai_filter_type_results].
4076 ///
4077 /// # Example
4078 /// ```ignore,no_run
4079 /// # use google_cloud_modelarmor_v1::model::RaiFilterResult;
4080 /// use google_cloud_modelarmor_v1::model::rai_filter_result::RaiFilterTypeResult;
4081 /// let x = RaiFilterResult::new().set_rai_filter_type_results([
4082 /// ("key0", RaiFilterTypeResult::default()/* use setters */),
4083 /// ("key1", RaiFilterTypeResult::default()/* use (different) setters */),
4084 /// ]);
4085 /// ```
4086 pub fn set_rai_filter_type_results<T, K, V>(mut self, v: T) -> Self
4087 where
4088 T: std::iter::IntoIterator<Item = (K, V)>,
4089 K: std::convert::Into<std::string::String>,
4090 V: std::convert::Into<crate::model::rai_filter_result::RaiFilterTypeResult>,
4091 {
4092 use std::iter::Iterator;
4093 self.rai_filter_type_results = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4094 self
4095 }
4096}
4097
4098impl wkt::message::Message for RaiFilterResult {
4099 fn typename() -> &'static str {
4100 "type.googleapis.com/google.cloud.modelarmor.v1.RaiFilterResult"
4101 }
4102}
4103
4104/// Defines additional types related to [RaiFilterResult].
4105pub mod rai_filter_result {
4106 #[allow(unused_imports)]
4107 use super::*;
4108
4109 /// Detailed Filter result for each of the responsible AI Filter Types.
4110 #[derive(Clone, Default, PartialEq)]
4111 #[non_exhaustive]
4112 pub struct RaiFilterTypeResult {
4113 /// Type of responsible AI filter.
4114 pub filter_type: crate::model::RaiFilterType,
4115
4116 /// Confidence level identified for this RAI filter.
4117 pub confidence_level: crate::model::DetectionConfidenceLevel,
4118
4119 /// Output only. Match state for this RAI filter.
4120 pub match_state: crate::model::FilterMatchState,
4121
4122 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4123 }
4124
4125 impl RaiFilterTypeResult {
4126 pub fn new() -> Self {
4127 std::default::Default::default()
4128 }
4129
4130 /// Sets the value of [filter_type][crate::model::rai_filter_result::RaiFilterTypeResult::filter_type].
4131 ///
4132 /// # Example
4133 /// ```ignore,no_run
4134 /// # use google_cloud_modelarmor_v1::model::rai_filter_result::RaiFilterTypeResult;
4135 /// use google_cloud_modelarmor_v1::model::RaiFilterType;
4136 /// let x0 = RaiFilterTypeResult::new().set_filter_type(RaiFilterType::SexuallyExplicit);
4137 /// let x1 = RaiFilterTypeResult::new().set_filter_type(RaiFilterType::HateSpeech);
4138 /// let x2 = RaiFilterTypeResult::new().set_filter_type(RaiFilterType::Harassment);
4139 /// ```
4140 pub fn set_filter_type<T: std::convert::Into<crate::model::RaiFilterType>>(
4141 mut self,
4142 v: T,
4143 ) -> Self {
4144 self.filter_type = v.into();
4145 self
4146 }
4147
4148 /// Sets the value of [confidence_level][crate::model::rai_filter_result::RaiFilterTypeResult::confidence_level].
4149 ///
4150 /// # Example
4151 /// ```ignore,no_run
4152 /// # use google_cloud_modelarmor_v1::model::rai_filter_result::RaiFilterTypeResult;
4153 /// use google_cloud_modelarmor_v1::model::DetectionConfidenceLevel;
4154 /// let x0 = RaiFilterTypeResult::new().set_confidence_level(DetectionConfidenceLevel::LowAndAbove);
4155 /// let x1 = RaiFilterTypeResult::new().set_confidence_level(DetectionConfidenceLevel::MediumAndAbove);
4156 /// let x2 = RaiFilterTypeResult::new().set_confidence_level(DetectionConfidenceLevel::High);
4157 /// ```
4158 pub fn set_confidence_level<
4159 T: std::convert::Into<crate::model::DetectionConfidenceLevel>,
4160 >(
4161 mut self,
4162 v: T,
4163 ) -> Self {
4164 self.confidence_level = v.into();
4165 self
4166 }
4167
4168 /// Sets the value of [match_state][crate::model::rai_filter_result::RaiFilterTypeResult::match_state].
4169 ///
4170 /// # Example
4171 /// ```ignore,no_run
4172 /// # use google_cloud_modelarmor_v1::model::rai_filter_result::RaiFilterTypeResult;
4173 /// use google_cloud_modelarmor_v1::model::FilterMatchState;
4174 /// let x0 = RaiFilterTypeResult::new().set_match_state(FilterMatchState::NoMatchFound);
4175 /// let x1 = RaiFilterTypeResult::new().set_match_state(FilterMatchState::MatchFound);
4176 /// ```
4177 pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
4178 mut self,
4179 v: T,
4180 ) -> Self {
4181 self.match_state = v.into();
4182 self
4183 }
4184 }
4185
4186 impl wkt::message::Message for RaiFilterTypeResult {
4187 fn typename() -> &'static str {
4188 "type.googleapis.com/google.cloud.modelarmor.v1.RaiFilterResult.RaiFilterTypeResult"
4189 }
4190 }
4191}
4192
4193/// Sensitive Data Protection filter result.
4194#[derive(Clone, Default, PartialEq)]
4195#[non_exhaustive]
4196pub struct SdpFilterResult {
4197 /// Either of Sensitive Data Protection Inspect result or Deidentify result.
4198 pub result: std::option::Option<crate::model::sdp_filter_result::Result>,
4199
4200 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4201}
4202
4203impl SdpFilterResult {
4204 pub fn new() -> Self {
4205 std::default::Default::default()
4206 }
4207
4208 /// Sets the value of [result][crate::model::SdpFilterResult::result].
4209 ///
4210 /// Note that all the setters affecting `result` are mutually
4211 /// exclusive.
4212 ///
4213 /// # Example
4214 /// ```ignore,no_run
4215 /// # use google_cloud_modelarmor_v1::model::SdpFilterResult;
4216 /// use google_cloud_modelarmor_v1::model::SdpInspectResult;
4217 /// let x = SdpFilterResult::new().set_result(Some(
4218 /// google_cloud_modelarmor_v1::model::sdp_filter_result::Result::InspectResult(SdpInspectResult::default().into())));
4219 /// ```
4220 pub fn set_result<
4221 T: std::convert::Into<std::option::Option<crate::model::sdp_filter_result::Result>>,
4222 >(
4223 mut self,
4224 v: T,
4225 ) -> Self {
4226 self.result = v.into();
4227 self
4228 }
4229
4230 /// The value of [result][crate::model::SdpFilterResult::result]
4231 /// if it holds a `InspectResult`, `None` if the field is not set or
4232 /// holds a different branch.
4233 pub fn inspect_result(
4234 &self,
4235 ) -> std::option::Option<&std::boxed::Box<crate::model::SdpInspectResult>> {
4236 #[allow(unreachable_patterns)]
4237 self.result.as_ref().and_then(|v| match v {
4238 crate::model::sdp_filter_result::Result::InspectResult(v) => {
4239 std::option::Option::Some(v)
4240 }
4241 _ => std::option::Option::None,
4242 })
4243 }
4244
4245 /// Sets the value of [result][crate::model::SdpFilterResult::result]
4246 /// to hold a `InspectResult`.
4247 ///
4248 /// Note that all the setters affecting `result` are
4249 /// mutually exclusive.
4250 ///
4251 /// # Example
4252 /// ```ignore,no_run
4253 /// # use google_cloud_modelarmor_v1::model::SdpFilterResult;
4254 /// use google_cloud_modelarmor_v1::model::SdpInspectResult;
4255 /// let x = SdpFilterResult::new().set_inspect_result(SdpInspectResult::default()/* use setters */);
4256 /// assert!(x.inspect_result().is_some());
4257 /// assert!(x.deidentify_result().is_none());
4258 /// ```
4259 pub fn set_inspect_result<
4260 T: std::convert::Into<std::boxed::Box<crate::model::SdpInspectResult>>,
4261 >(
4262 mut self,
4263 v: T,
4264 ) -> Self {
4265 self.result = std::option::Option::Some(
4266 crate::model::sdp_filter_result::Result::InspectResult(v.into()),
4267 );
4268 self
4269 }
4270
4271 /// The value of [result][crate::model::SdpFilterResult::result]
4272 /// if it holds a `DeidentifyResult`, `None` if the field is not set or
4273 /// holds a different branch.
4274 pub fn deidentify_result(
4275 &self,
4276 ) -> std::option::Option<&std::boxed::Box<crate::model::SdpDeidentifyResult>> {
4277 #[allow(unreachable_patterns)]
4278 self.result.as_ref().and_then(|v| match v {
4279 crate::model::sdp_filter_result::Result::DeidentifyResult(v) => {
4280 std::option::Option::Some(v)
4281 }
4282 _ => std::option::Option::None,
4283 })
4284 }
4285
4286 /// Sets the value of [result][crate::model::SdpFilterResult::result]
4287 /// to hold a `DeidentifyResult`.
4288 ///
4289 /// Note that all the setters affecting `result` are
4290 /// mutually exclusive.
4291 ///
4292 /// # Example
4293 /// ```ignore,no_run
4294 /// # use google_cloud_modelarmor_v1::model::SdpFilterResult;
4295 /// use google_cloud_modelarmor_v1::model::SdpDeidentifyResult;
4296 /// let x = SdpFilterResult::new().set_deidentify_result(SdpDeidentifyResult::default()/* use setters */);
4297 /// assert!(x.deidentify_result().is_some());
4298 /// assert!(x.inspect_result().is_none());
4299 /// ```
4300 pub fn set_deidentify_result<
4301 T: std::convert::Into<std::boxed::Box<crate::model::SdpDeidentifyResult>>,
4302 >(
4303 mut self,
4304 v: T,
4305 ) -> Self {
4306 self.result = std::option::Option::Some(
4307 crate::model::sdp_filter_result::Result::DeidentifyResult(v.into()),
4308 );
4309 self
4310 }
4311}
4312
4313impl wkt::message::Message for SdpFilterResult {
4314 fn typename() -> &'static str {
4315 "type.googleapis.com/google.cloud.modelarmor.v1.SdpFilterResult"
4316 }
4317}
4318
4319/// Defines additional types related to [SdpFilterResult].
4320pub mod sdp_filter_result {
4321 #[allow(unused_imports)]
4322 use super::*;
4323
4324 /// Either of Sensitive Data Protection Inspect result or Deidentify result.
4325 #[derive(Clone, Debug, PartialEq)]
4326 #[non_exhaustive]
4327 pub enum Result {
4328 /// Sensitive Data Protection Inspection result if inspection is performed.
4329 InspectResult(std::boxed::Box<crate::model::SdpInspectResult>),
4330 /// Sensitive Data Protection Deidentification result if deidentification is
4331 /// performed.
4332 DeidentifyResult(std::boxed::Box<crate::model::SdpDeidentifyResult>),
4333 }
4334}
4335
4336/// Sensitive Data Protection Inspection Result.
4337#[derive(Clone, Default, PartialEq)]
4338#[non_exhaustive]
4339pub struct SdpInspectResult {
4340 /// Output only. Reports whether Sensitive Data Protection inspection was
4341 /// successfully executed or not.
4342 pub execution_state: crate::model::FilterExecutionState,
4343
4344 /// Optional messages corresponding to the result.
4345 /// A message can provide warnings or error details.
4346 /// For example, if execution state is skipped then this field provides
4347 /// related reason/explanation.
4348 pub message_items: std::vec::Vec<crate::model::MessageItem>,
4349
4350 /// Output only. Match state for SDP Inspection.
4351 /// Value is MATCH_FOUND if at least one Sensitive Data Protection finding is
4352 /// identified.
4353 pub match_state: crate::model::FilterMatchState,
4354
4355 /// List of Sensitive Data Protection findings.
4356 pub findings: std::vec::Vec<crate::model::SdpFinding>,
4357
4358 /// If true, then there is possibility that more findings were identified and
4359 /// the findings returned are a subset of all findings. The findings
4360 /// list might be truncated because the input items were too large, or because
4361 /// the server reached the maximum amount of resources allowed for a single API
4362 /// call.
4363 pub findings_truncated: bool,
4364
4365 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4366}
4367
4368impl SdpInspectResult {
4369 pub fn new() -> Self {
4370 std::default::Default::default()
4371 }
4372
4373 /// Sets the value of [execution_state][crate::model::SdpInspectResult::execution_state].
4374 ///
4375 /// # Example
4376 /// ```ignore,no_run
4377 /// # use google_cloud_modelarmor_v1::model::SdpInspectResult;
4378 /// use google_cloud_modelarmor_v1::model::FilterExecutionState;
4379 /// let x0 = SdpInspectResult::new().set_execution_state(FilterExecutionState::ExecutionSuccess);
4380 /// let x1 = SdpInspectResult::new().set_execution_state(FilterExecutionState::ExecutionSkipped);
4381 /// ```
4382 pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
4383 mut self,
4384 v: T,
4385 ) -> Self {
4386 self.execution_state = v.into();
4387 self
4388 }
4389
4390 /// Sets the value of [message_items][crate::model::SdpInspectResult::message_items].
4391 ///
4392 /// # Example
4393 /// ```ignore,no_run
4394 /// # use google_cloud_modelarmor_v1::model::SdpInspectResult;
4395 /// use google_cloud_modelarmor_v1::model::MessageItem;
4396 /// let x = SdpInspectResult::new()
4397 /// .set_message_items([
4398 /// MessageItem::default()/* use setters */,
4399 /// MessageItem::default()/* use (different) setters */,
4400 /// ]);
4401 /// ```
4402 pub fn set_message_items<T, V>(mut self, v: T) -> Self
4403 where
4404 T: std::iter::IntoIterator<Item = V>,
4405 V: std::convert::Into<crate::model::MessageItem>,
4406 {
4407 use std::iter::Iterator;
4408 self.message_items = v.into_iter().map(|i| i.into()).collect();
4409 self
4410 }
4411
4412 /// Sets the value of [match_state][crate::model::SdpInspectResult::match_state].
4413 ///
4414 /// # Example
4415 /// ```ignore,no_run
4416 /// # use google_cloud_modelarmor_v1::model::SdpInspectResult;
4417 /// use google_cloud_modelarmor_v1::model::FilterMatchState;
4418 /// let x0 = SdpInspectResult::new().set_match_state(FilterMatchState::NoMatchFound);
4419 /// let x1 = SdpInspectResult::new().set_match_state(FilterMatchState::MatchFound);
4420 /// ```
4421 pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
4422 mut self,
4423 v: T,
4424 ) -> Self {
4425 self.match_state = v.into();
4426 self
4427 }
4428
4429 /// Sets the value of [findings][crate::model::SdpInspectResult::findings].
4430 ///
4431 /// # Example
4432 /// ```ignore,no_run
4433 /// # use google_cloud_modelarmor_v1::model::SdpInspectResult;
4434 /// use google_cloud_modelarmor_v1::model::SdpFinding;
4435 /// let x = SdpInspectResult::new()
4436 /// .set_findings([
4437 /// SdpFinding::default()/* use setters */,
4438 /// SdpFinding::default()/* use (different) setters */,
4439 /// ]);
4440 /// ```
4441 pub fn set_findings<T, V>(mut self, v: T) -> Self
4442 where
4443 T: std::iter::IntoIterator<Item = V>,
4444 V: std::convert::Into<crate::model::SdpFinding>,
4445 {
4446 use std::iter::Iterator;
4447 self.findings = v.into_iter().map(|i| i.into()).collect();
4448 self
4449 }
4450
4451 /// Sets the value of [findings_truncated][crate::model::SdpInspectResult::findings_truncated].
4452 ///
4453 /// # Example
4454 /// ```ignore,no_run
4455 /// # use google_cloud_modelarmor_v1::model::SdpInspectResult;
4456 /// let x = SdpInspectResult::new().set_findings_truncated(true);
4457 /// ```
4458 pub fn set_findings_truncated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4459 self.findings_truncated = v.into();
4460 self
4461 }
4462}
4463
4464impl wkt::message::Message for SdpInspectResult {
4465 fn typename() -> &'static str {
4466 "type.googleapis.com/google.cloud.modelarmor.v1.SdpInspectResult"
4467 }
4468}
4469
4470/// Represents Data item
4471#[derive(Clone, Default, PartialEq)]
4472#[non_exhaustive]
4473pub struct DataItem {
4474 /// Either of text or bytes data.
4475 pub data_item: std::option::Option<crate::model::data_item::DataItem>,
4476
4477 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4478}
4479
4480impl DataItem {
4481 pub fn new() -> Self {
4482 std::default::Default::default()
4483 }
4484
4485 /// Sets the value of [data_item][crate::model::DataItem::data_item].
4486 ///
4487 /// Note that all the setters affecting `data_item` are mutually
4488 /// exclusive.
4489 ///
4490 /// # Example
4491 /// ```ignore,no_run
4492 /// # use google_cloud_modelarmor_v1::model::DataItem;
4493 /// use google_cloud_modelarmor_v1::model::data_item::DataItem as DataItemOneOf;
4494 /// let x = DataItem::new().set_data_item(Some(DataItemOneOf::Text("example".to_string())));
4495 /// ```
4496 pub fn set_data_item<
4497 T: std::convert::Into<std::option::Option<crate::model::data_item::DataItem>>,
4498 >(
4499 mut self,
4500 v: T,
4501 ) -> Self {
4502 self.data_item = v.into();
4503 self
4504 }
4505
4506 /// The value of [data_item][crate::model::DataItem::data_item]
4507 /// if it holds a `Text`, `None` if the field is not set or
4508 /// holds a different branch.
4509 pub fn text(&self) -> std::option::Option<&std::string::String> {
4510 #[allow(unreachable_patterns)]
4511 self.data_item.as_ref().and_then(|v| match v {
4512 crate::model::data_item::DataItem::Text(v) => std::option::Option::Some(v),
4513 _ => std::option::Option::None,
4514 })
4515 }
4516
4517 /// Sets the value of [data_item][crate::model::DataItem::data_item]
4518 /// to hold a `Text`.
4519 ///
4520 /// Note that all the setters affecting `data_item` are
4521 /// mutually exclusive.
4522 ///
4523 /// # Example
4524 /// ```ignore,no_run
4525 /// # use google_cloud_modelarmor_v1::model::DataItem;
4526 /// let x = DataItem::new().set_text("example");
4527 /// assert!(x.text().is_some());
4528 /// assert!(x.byte_item().is_none());
4529 /// ```
4530 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4531 self.data_item =
4532 std::option::Option::Some(crate::model::data_item::DataItem::Text(v.into()));
4533 self
4534 }
4535
4536 /// The value of [data_item][crate::model::DataItem::data_item]
4537 /// if it holds a `ByteItem`, `None` if the field is not set or
4538 /// holds a different branch.
4539 pub fn byte_item(&self) -> std::option::Option<&std::boxed::Box<crate::model::ByteDataItem>> {
4540 #[allow(unreachable_patterns)]
4541 self.data_item.as_ref().and_then(|v| match v {
4542 crate::model::data_item::DataItem::ByteItem(v) => std::option::Option::Some(v),
4543 _ => std::option::Option::None,
4544 })
4545 }
4546
4547 /// Sets the value of [data_item][crate::model::DataItem::data_item]
4548 /// to hold a `ByteItem`.
4549 ///
4550 /// Note that all the setters affecting `data_item` are
4551 /// mutually exclusive.
4552 ///
4553 /// # Example
4554 /// ```ignore,no_run
4555 /// # use google_cloud_modelarmor_v1::model::DataItem;
4556 /// use google_cloud_modelarmor_v1::model::ByteDataItem;
4557 /// let x = DataItem::new().set_byte_item(ByteDataItem::default()/* use setters */);
4558 /// assert!(x.byte_item().is_some());
4559 /// assert!(x.text().is_none());
4560 /// ```
4561 pub fn set_byte_item<T: std::convert::Into<std::boxed::Box<crate::model::ByteDataItem>>>(
4562 mut self,
4563 v: T,
4564 ) -> Self {
4565 self.data_item =
4566 std::option::Option::Some(crate::model::data_item::DataItem::ByteItem(v.into()));
4567 self
4568 }
4569}
4570
4571impl wkt::message::Message for DataItem {
4572 fn typename() -> &'static str {
4573 "type.googleapis.com/google.cloud.modelarmor.v1.DataItem"
4574 }
4575}
4576
4577/// Defines additional types related to [DataItem].
4578pub mod data_item {
4579 #[allow(unused_imports)]
4580 use super::*;
4581
4582 /// Either of text or bytes data.
4583 #[derive(Clone, Debug, PartialEq)]
4584 #[non_exhaustive]
4585 pub enum DataItem {
4586 /// Plaintext string data for sanitization.
4587 Text(std::string::String),
4588 /// Data provided in the form of bytes.
4589 ByteItem(std::boxed::Box<crate::model::ByteDataItem>),
4590 }
4591}
4592
4593/// Represents Byte Data item.
4594#[derive(Clone, Default, PartialEq)]
4595#[non_exhaustive]
4596pub struct ByteDataItem {
4597 /// Required. The type of byte data
4598 pub byte_data_type: crate::model::byte_data_item::ByteItemType,
4599
4600 /// Required. Bytes Data
4601 pub byte_data: ::bytes::Bytes,
4602
4603 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4604}
4605
4606impl ByteDataItem {
4607 pub fn new() -> Self {
4608 std::default::Default::default()
4609 }
4610
4611 /// Sets the value of [byte_data_type][crate::model::ByteDataItem::byte_data_type].
4612 ///
4613 /// # Example
4614 /// ```ignore,no_run
4615 /// # use google_cloud_modelarmor_v1::model::ByteDataItem;
4616 /// use google_cloud_modelarmor_v1::model::byte_data_item::ByteItemType;
4617 /// let x0 = ByteDataItem::new().set_byte_data_type(ByteItemType::PlaintextUtf8);
4618 /// let x1 = ByteDataItem::new().set_byte_data_type(ByteItemType::Pdf);
4619 /// let x2 = ByteDataItem::new().set_byte_data_type(ByteItemType::WordDocument);
4620 /// ```
4621 pub fn set_byte_data_type<T: std::convert::Into<crate::model::byte_data_item::ByteItemType>>(
4622 mut self,
4623 v: T,
4624 ) -> Self {
4625 self.byte_data_type = v.into();
4626 self
4627 }
4628
4629 /// Sets the value of [byte_data][crate::model::ByteDataItem::byte_data].
4630 ///
4631 /// # Example
4632 /// ```ignore,no_run
4633 /// # use google_cloud_modelarmor_v1::model::ByteDataItem;
4634 /// let x = ByteDataItem::new().set_byte_data(bytes::Bytes::from_static(b"example"));
4635 /// ```
4636 pub fn set_byte_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4637 self.byte_data = v.into();
4638 self
4639 }
4640}
4641
4642impl wkt::message::Message for ByteDataItem {
4643 fn typename() -> &'static str {
4644 "type.googleapis.com/google.cloud.modelarmor.v1.ByteDataItem"
4645 }
4646}
4647
4648/// Defines additional types related to [ByteDataItem].
4649pub mod byte_data_item {
4650 #[allow(unused_imports)]
4651 use super::*;
4652
4653 /// Option to specify the type of byte data.
4654 ///
4655 /// # Working with unknown values
4656 ///
4657 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4658 /// additional enum variants at any time. Adding new variants is not considered
4659 /// a breaking change. Applications should write their code in anticipation of:
4660 ///
4661 /// - New values appearing in future releases of the client library, **and**
4662 /// - New values received dynamically, without application changes.
4663 ///
4664 /// Please consult the [Working with enums] section in the user guide for some
4665 /// guidelines.
4666 ///
4667 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4668 #[derive(Clone, Debug, PartialEq)]
4669 #[non_exhaustive]
4670 pub enum ByteItemType {
4671 /// Unused
4672 Unspecified,
4673 /// plain text
4674 PlaintextUtf8,
4675 /// PDF
4676 Pdf,
4677 /// DOCX, DOCM, DOTX, DOTM
4678 WordDocument,
4679 /// XLSX, XLSM, XLTX, XLYM
4680 ExcelDocument,
4681 /// PPTX, PPTM, POTX, POTM, POT
4682 PowerpointDocument,
4683 /// TXT
4684 Txt,
4685 /// CSV
4686 Csv,
4687 /// If set, the enum was initialized with an unknown value.
4688 ///
4689 /// Applications can examine the value using [ByteItemType::value] or
4690 /// [ByteItemType::name].
4691 UnknownValue(byte_item_type::UnknownValue),
4692 }
4693
4694 #[doc(hidden)]
4695 pub mod byte_item_type {
4696 #[allow(unused_imports)]
4697 use super::*;
4698 #[derive(Clone, Debug, PartialEq)]
4699 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4700 }
4701
4702 impl ByteItemType {
4703 /// Gets the enum value.
4704 ///
4705 /// Returns `None` if the enum contains an unknown value deserialized from
4706 /// the string representation of enums.
4707 pub fn value(&self) -> std::option::Option<i32> {
4708 match self {
4709 Self::Unspecified => std::option::Option::Some(0),
4710 Self::PlaintextUtf8 => std::option::Option::Some(1),
4711 Self::Pdf => std::option::Option::Some(2),
4712 Self::WordDocument => std::option::Option::Some(3),
4713 Self::ExcelDocument => std::option::Option::Some(4),
4714 Self::PowerpointDocument => std::option::Option::Some(5),
4715 Self::Txt => std::option::Option::Some(6),
4716 Self::Csv => std::option::Option::Some(7),
4717 Self::UnknownValue(u) => u.0.value(),
4718 }
4719 }
4720
4721 /// Gets the enum value as a string.
4722 ///
4723 /// Returns `None` if the enum contains an unknown value deserialized from
4724 /// the integer representation of enums.
4725 pub fn name(&self) -> std::option::Option<&str> {
4726 match self {
4727 Self::Unspecified => std::option::Option::Some("BYTE_ITEM_TYPE_UNSPECIFIED"),
4728 Self::PlaintextUtf8 => std::option::Option::Some("PLAINTEXT_UTF8"),
4729 Self::Pdf => std::option::Option::Some("PDF"),
4730 Self::WordDocument => std::option::Option::Some("WORD_DOCUMENT"),
4731 Self::ExcelDocument => std::option::Option::Some("EXCEL_DOCUMENT"),
4732 Self::PowerpointDocument => std::option::Option::Some("POWERPOINT_DOCUMENT"),
4733 Self::Txt => std::option::Option::Some("TXT"),
4734 Self::Csv => std::option::Option::Some("CSV"),
4735 Self::UnknownValue(u) => u.0.name(),
4736 }
4737 }
4738 }
4739
4740 impl std::default::Default for ByteItemType {
4741 fn default() -> Self {
4742 use std::convert::From;
4743 Self::from(0)
4744 }
4745 }
4746
4747 impl std::fmt::Display for ByteItemType {
4748 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4749 wkt::internal::display_enum(f, self.name(), self.value())
4750 }
4751 }
4752
4753 impl std::convert::From<i32> for ByteItemType {
4754 fn from(value: i32) -> Self {
4755 match value {
4756 0 => Self::Unspecified,
4757 1 => Self::PlaintextUtf8,
4758 2 => Self::Pdf,
4759 3 => Self::WordDocument,
4760 4 => Self::ExcelDocument,
4761 5 => Self::PowerpointDocument,
4762 6 => Self::Txt,
4763 7 => Self::Csv,
4764 _ => Self::UnknownValue(byte_item_type::UnknownValue(
4765 wkt::internal::UnknownEnumValue::Integer(value),
4766 )),
4767 }
4768 }
4769 }
4770
4771 impl std::convert::From<&str> for ByteItemType {
4772 fn from(value: &str) -> Self {
4773 use std::string::ToString;
4774 match value {
4775 "BYTE_ITEM_TYPE_UNSPECIFIED" => Self::Unspecified,
4776 "PLAINTEXT_UTF8" => Self::PlaintextUtf8,
4777 "PDF" => Self::Pdf,
4778 "WORD_DOCUMENT" => Self::WordDocument,
4779 "EXCEL_DOCUMENT" => Self::ExcelDocument,
4780 "POWERPOINT_DOCUMENT" => Self::PowerpointDocument,
4781 "TXT" => Self::Txt,
4782 "CSV" => Self::Csv,
4783 _ => Self::UnknownValue(byte_item_type::UnknownValue(
4784 wkt::internal::UnknownEnumValue::String(value.to_string()),
4785 )),
4786 }
4787 }
4788 }
4789
4790 impl serde::ser::Serialize for ByteItemType {
4791 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4792 where
4793 S: serde::Serializer,
4794 {
4795 match self {
4796 Self::Unspecified => serializer.serialize_i32(0),
4797 Self::PlaintextUtf8 => serializer.serialize_i32(1),
4798 Self::Pdf => serializer.serialize_i32(2),
4799 Self::WordDocument => serializer.serialize_i32(3),
4800 Self::ExcelDocument => serializer.serialize_i32(4),
4801 Self::PowerpointDocument => serializer.serialize_i32(5),
4802 Self::Txt => serializer.serialize_i32(6),
4803 Self::Csv => serializer.serialize_i32(7),
4804 Self::UnknownValue(u) => u.0.serialize(serializer),
4805 }
4806 }
4807 }
4808
4809 impl<'de> serde::de::Deserialize<'de> for ByteItemType {
4810 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4811 where
4812 D: serde::Deserializer<'de>,
4813 {
4814 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ByteItemType>::new(
4815 ".google.cloud.modelarmor.v1.ByteDataItem.ByteItemType",
4816 ))
4817 }
4818 }
4819}
4820
4821/// Sensitive Data Protection Deidentification Result.
4822#[derive(Clone, Default, PartialEq)]
4823#[non_exhaustive]
4824pub struct SdpDeidentifyResult {
4825 /// Output only. Reports whether Sensitive Data Protection deidentification was
4826 /// successfully executed or not.
4827 pub execution_state: crate::model::FilterExecutionState,
4828
4829 /// Optional messages corresponding to the result.
4830 /// A message can provide warnings or error details.
4831 /// For example, if execution state is skipped then this field provides
4832 /// related reason/explanation.
4833 pub message_items: std::vec::Vec<crate::model::MessageItem>,
4834
4835 /// Output only. Match state for Sensitive Data Protection Deidentification.
4836 /// Value is MATCH_FOUND if content is de-identified.
4837 pub match_state: crate::model::FilterMatchState,
4838
4839 /// De-identified data.
4840 pub data: std::option::Option<crate::model::DataItem>,
4841
4842 /// Total size in bytes that were transformed during deidentification.
4843 pub transformed_bytes: i64,
4844
4845 /// List of Sensitive Data Protection info-types that were de-identified.
4846 pub info_types: std::vec::Vec<std::string::String>,
4847
4848 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4849}
4850
4851impl SdpDeidentifyResult {
4852 pub fn new() -> Self {
4853 std::default::Default::default()
4854 }
4855
4856 /// Sets the value of [execution_state][crate::model::SdpDeidentifyResult::execution_state].
4857 ///
4858 /// # Example
4859 /// ```ignore,no_run
4860 /// # use google_cloud_modelarmor_v1::model::SdpDeidentifyResult;
4861 /// use google_cloud_modelarmor_v1::model::FilterExecutionState;
4862 /// let x0 = SdpDeidentifyResult::new().set_execution_state(FilterExecutionState::ExecutionSuccess);
4863 /// let x1 = SdpDeidentifyResult::new().set_execution_state(FilterExecutionState::ExecutionSkipped);
4864 /// ```
4865 pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
4866 mut self,
4867 v: T,
4868 ) -> Self {
4869 self.execution_state = v.into();
4870 self
4871 }
4872
4873 /// Sets the value of [message_items][crate::model::SdpDeidentifyResult::message_items].
4874 ///
4875 /// # Example
4876 /// ```ignore,no_run
4877 /// # use google_cloud_modelarmor_v1::model::SdpDeidentifyResult;
4878 /// use google_cloud_modelarmor_v1::model::MessageItem;
4879 /// let x = SdpDeidentifyResult::new()
4880 /// .set_message_items([
4881 /// MessageItem::default()/* use setters */,
4882 /// MessageItem::default()/* use (different) setters */,
4883 /// ]);
4884 /// ```
4885 pub fn set_message_items<T, V>(mut self, v: T) -> Self
4886 where
4887 T: std::iter::IntoIterator<Item = V>,
4888 V: std::convert::Into<crate::model::MessageItem>,
4889 {
4890 use std::iter::Iterator;
4891 self.message_items = v.into_iter().map(|i| i.into()).collect();
4892 self
4893 }
4894
4895 /// Sets the value of [match_state][crate::model::SdpDeidentifyResult::match_state].
4896 ///
4897 /// # Example
4898 /// ```ignore,no_run
4899 /// # use google_cloud_modelarmor_v1::model::SdpDeidentifyResult;
4900 /// use google_cloud_modelarmor_v1::model::FilterMatchState;
4901 /// let x0 = SdpDeidentifyResult::new().set_match_state(FilterMatchState::NoMatchFound);
4902 /// let x1 = SdpDeidentifyResult::new().set_match_state(FilterMatchState::MatchFound);
4903 /// ```
4904 pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
4905 mut self,
4906 v: T,
4907 ) -> Self {
4908 self.match_state = v.into();
4909 self
4910 }
4911
4912 /// Sets the value of [data][crate::model::SdpDeidentifyResult::data].
4913 ///
4914 /// # Example
4915 /// ```ignore,no_run
4916 /// # use google_cloud_modelarmor_v1::model::SdpDeidentifyResult;
4917 /// use google_cloud_modelarmor_v1::model::DataItem;
4918 /// let x = SdpDeidentifyResult::new().set_data(DataItem::default()/* use setters */);
4919 /// ```
4920 pub fn set_data<T>(mut self, v: T) -> Self
4921 where
4922 T: std::convert::Into<crate::model::DataItem>,
4923 {
4924 self.data = std::option::Option::Some(v.into());
4925 self
4926 }
4927
4928 /// Sets or clears the value of [data][crate::model::SdpDeidentifyResult::data].
4929 ///
4930 /// # Example
4931 /// ```ignore,no_run
4932 /// # use google_cloud_modelarmor_v1::model::SdpDeidentifyResult;
4933 /// use google_cloud_modelarmor_v1::model::DataItem;
4934 /// let x = SdpDeidentifyResult::new().set_or_clear_data(Some(DataItem::default()/* use setters */));
4935 /// let x = SdpDeidentifyResult::new().set_or_clear_data(None::<DataItem>);
4936 /// ```
4937 pub fn set_or_clear_data<T>(mut self, v: std::option::Option<T>) -> Self
4938 where
4939 T: std::convert::Into<crate::model::DataItem>,
4940 {
4941 self.data = v.map(|x| x.into());
4942 self
4943 }
4944
4945 /// Sets the value of [transformed_bytes][crate::model::SdpDeidentifyResult::transformed_bytes].
4946 ///
4947 /// # Example
4948 /// ```ignore,no_run
4949 /// # use google_cloud_modelarmor_v1::model::SdpDeidentifyResult;
4950 /// let x = SdpDeidentifyResult::new().set_transformed_bytes(42);
4951 /// ```
4952 pub fn set_transformed_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4953 self.transformed_bytes = v.into();
4954 self
4955 }
4956
4957 /// Sets the value of [info_types][crate::model::SdpDeidentifyResult::info_types].
4958 ///
4959 /// # Example
4960 /// ```ignore,no_run
4961 /// # use google_cloud_modelarmor_v1::model::SdpDeidentifyResult;
4962 /// let x = SdpDeidentifyResult::new().set_info_types(["a", "b", "c"]);
4963 /// ```
4964 pub fn set_info_types<T, V>(mut self, v: T) -> Self
4965 where
4966 T: std::iter::IntoIterator<Item = V>,
4967 V: std::convert::Into<std::string::String>,
4968 {
4969 use std::iter::Iterator;
4970 self.info_types = v.into_iter().map(|i| i.into()).collect();
4971 self
4972 }
4973}
4974
4975impl wkt::message::Message for SdpDeidentifyResult {
4976 fn typename() -> &'static str {
4977 "type.googleapis.com/google.cloud.modelarmor.v1.SdpDeidentifyResult"
4978 }
4979}
4980
4981/// Finding corresponding to Sensitive Data Protection filter.
4982#[derive(Clone, Default, PartialEq)]
4983#[non_exhaustive]
4984pub struct SdpFinding {
4985 /// Name of Sensitive Data Protection info type for this finding.
4986 pub info_type: std::string::String,
4987
4988 /// Identified confidence likelihood for `info_type`.
4989 pub likelihood: crate::model::SdpFindingLikelihood,
4990
4991 /// Location for this finding.
4992 pub location: std::option::Option<crate::model::sdp_finding::SdpFindingLocation>,
4993
4994 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4995}
4996
4997impl SdpFinding {
4998 pub fn new() -> Self {
4999 std::default::Default::default()
5000 }
5001
5002 /// Sets the value of [info_type][crate::model::SdpFinding::info_type].
5003 ///
5004 /// # Example
5005 /// ```ignore,no_run
5006 /// # use google_cloud_modelarmor_v1::model::SdpFinding;
5007 /// let x = SdpFinding::new().set_info_type("example");
5008 /// ```
5009 pub fn set_info_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5010 self.info_type = v.into();
5011 self
5012 }
5013
5014 /// Sets the value of [likelihood][crate::model::SdpFinding::likelihood].
5015 ///
5016 /// # Example
5017 /// ```ignore,no_run
5018 /// # use google_cloud_modelarmor_v1::model::SdpFinding;
5019 /// use google_cloud_modelarmor_v1::model::SdpFindingLikelihood;
5020 /// let x0 = SdpFinding::new().set_likelihood(SdpFindingLikelihood::VeryUnlikely);
5021 /// let x1 = SdpFinding::new().set_likelihood(SdpFindingLikelihood::Unlikely);
5022 /// let x2 = SdpFinding::new().set_likelihood(SdpFindingLikelihood::Possible);
5023 /// ```
5024 pub fn set_likelihood<T: std::convert::Into<crate::model::SdpFindingLikelihood>>(
5025 mut self,
5026 v: T,
5027 ) -> Self {
5028 self.likelihood = v.into();
5029 self
5030 }
5031
5032 /// Sets the value of [location][crate::model::SdpFinding::location].
5033 ///
5034 /// # Example
5035 /// ```ignore,no_run
5036 /// # use google_cloud_modelarmor_v1::model::SdpFinding;
5037 /// use google_cloud_modelarmor_v1::model::sdp_finding::SdpFindingLocation;
5038 /// let x = SdpFinding::new().set_location(SdpFindingLocation::default()/* use setters */);
5039 /// ```
5040 pub fn set_location<T>(mut self, v: T) -> Self
5041 where
5042 T: std::convert::Into<crate::model::sdp_finding::SdpFindingLocation>,
5043 {
5044 self.location = std::option::Option::Some(v.into());
5045 self
5046 }
5047
5048 /// Sets or clears the value of [location][crate::model::SdpFinding::location].
5049 ///
5050 /// # Example
5051 /// ```ignore,no_run
5052 /// # use google_cloud_modelarmor_v1::model::SdpFinding;
5053 /// use google_cloud_modelarmor_v1::model::sdp_finding::SdpFindingLocation;
5054 /// let x = SdpFinding::new().set_or_clear_location(Some(SdpFindingLocation::default()/* use setters */));
5055 /// let x = SdpFinding::new().set_or_clear_location(None::<SdpFindingLocation>);
5056 /// ```
5057 pub fn set_or_clear_location<T>(mut self, v: std::option::Option<T>) -> Self
5058 where
5059 T: std::convert::Into<crate::model::sdp_finding::SdpFindingLocation>,
5060 {
5061 self.location = v.map(|x| x.into());
5062 self
5063 }
5064}
5065
5066impl wkt::message::Message for SdpFinding {
5067 fn typename() -> &'static str {
5068 "type.googleapis.com/google.cloud.modelarmor.v1.SdpFinding"
5069 }
5070}
5071
5072/// Defines additional types related to [SdpFinding].
5073pub mod sdp_finding {
5074 #[allow(unused_imports)]
5075 use super::*;
5076
5077 /// Location of this Sensitive Data Protection Finding within input content.
5078 #[derive(Clone, Default, PartialEq)]
5079 #[non_exhaustive]
5080 pub struct SdpFindingLocation {
5081 /// Zero-based byte offsets delimiting the finding.
5082 /// These are relative to the finding's containing element.
5083 /// Note that when the content is not textual, this references
5084 /// the UTF-8 encoded textual representation of the content.
5085 pub byte_range: std::option::Option<crate::model::RangeInfo>,
5086
5087 /// Unicode character offsets delimiting the finding.
5088 /// These are relative to the finding's containing element.
5089 /// Provided when the content is text.
5090 pub codepoint_range: std::option::Option<crate::model::RangeInfo>,
5091
5092 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5093 }
5094
5095 impl SdpFindingLocation {
5096 pub fn new() -> Self {
5097 std::default::Default::default()
5098 }
5099
5100 /// Sets the value of [byte_range][crate::model::sdp_finding::SdpFindingLocation::byte_range].
5101 ///
5102 /// # Example
5103 /// ```ignore,no_run
5104 /// # use google_cloud_modelarmor_v1::model::sdp_finding::SdpFindingLocation;
5105 /// use google_cloud_modelarmor_v1::model::RangeInfo;
5106 /// let x = SdpFindingLocation::new().set_byte_range(RangeInfo::default()/* use setters */);
5107 /// ```
5108 pub fn set_byte_range<T>(mut self, v: T) -> Self
5109 where
5110 T: std::convert::Into<crate::model::RangeInfo>,
5111 {
5112 self.byte_range = std::option::Option::Some(v.into());
5113 self
5114 }
5115
5116 /// Sets or clears the value of [byte_range][crate::model::sdp_finding::SdpFindingLocation::byte_range].
5117 ///
5118 /// # Example
5119 /// ```ignore,no_run
5120 /// # use google_cloud_modelarmor_v1::model::sdp_finding::SdpFindingLocation;
5121 /// use google_cloud_modelarmor_v1::model::RangeInfo;
5122 /// let x = SdpFindingLocation::new().set_or_clear_byte_range(Some(RangeInfo::default()/* use setters */));
5123 /// let x = SdpFindingLocation::new().set_or_clear_byte_range(None::<RangeInfo>);
5124 /// ```
5125 pub fn set_or_clear_byte_range<T>(mut self, v: std::option::Option<T>) -> Self
5126 where
5127 T: std::convert::Into<crate::model::RangeInfo>,
5128 {
5129 self.byte_range = v.map(|x| x.into());
5130 self
5131 }
5132
5133 /// Sets the value of [codepoint_range][crate::model::sdp_finding::SdpFindingLocation::codepoint_range].
5134 ///
5135 /// # Example
5136 /// ```ignore,no_run
5137 /// # use google_cloud_modelarmor_v1::model::sdp_finding::SdpFindingLocation;
5138 /// use google_cloud_modelarmor_v1::model::RangeInfo;
5139 /// let x = SdpFindingLocation::new().set_codepoint_range(RangeInfo::default()/* use setters */);
5140 /// ```
5141 pub fn set_codepoint_range<T>(mut self, v: T) -> Self
5142 where
5143 T: std::convert::Into<crate::model::RangeInfo>,
5144 {
5145 self.codepoint_range = std::option::Option::Some(v.into());
5146 self
5147 }
5148
5149 /// Sets or clears the value of [codepoint_range][crate::model::sdp_finding::SdpFindingLocation::codepoint_range].
5150 ///
5151 /// # Example
5152 /// ```ignore,no_run
5153 /// # use google_cloud_modelarmor_v1::model::sdp_finding::SdpFindingLocation;
5154 /// use google_cloud_modelarmor_v1::model::RangeInfo;
5155 /// let x = SdpFindingLocation::new().set_or_clear_codepoint_range(Some(RangeInfo::default()/* use setters */));
5156 /// let x = SdpFindingLocation::new().set_or_clear_codepoint_range(None::<RangeInfo>);
5157 /// ```
5158 pub fn set_or_clear_codepoint_range<T>(mut self, v: std::option::Option<T>) -> Self
5159 where
5160 T: std::convert::Into<crate::model::RangeInfo>,
5161 {
5162 self.codepoint_range = v.map(|x| x.into());
5163 self
5164 }
5165 }
5166
5167 impl wkt::message::Message for SdpFindingLocation {
5168 fn typename() -> &'static str {
5169 "type.googleapis.com/google.cloud.modelarmor.v1.SdpFinding.SdpFindingLocation"
5170 }
5171 }
5172}
5173
5174/// Prompt injection and Jailbreak Filter Result.
5175#[derive(Clone, Default, PartialEq)]
5176#[non_exhaustive]
5177pub struct PiAndJailbreakFilterResult {
5178 /// Output only. Reports whether Prompt injection and Jailbreak filter was
5179 /// successfully executed or not.
5180 pub execution_state: crate::model::FilterExecutionState,
5181
5182 /// Optional messages corresponding to the result.
5183 /// A message can provide warnings or error details.
5184 /// For example, if execution state is skipped then this field provides
5185 /// related reason/explanation.
5186 pub message_items: std::vec::Vec<crate::model::MessageItem>,
5187
5188 /// Output only. Match state for Prompt injection and Jailbreak.
5189 pub match_state: crate::model::FilterMatchState,
5190
5191 /// Confidence level identified for Prompt injection and Jailbreak.
5192 pub confidence_level: crate::model::DetectionConfidenceLevel,
5193
5194 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5195}
5196
5197impl PiAndJailbreakFilterResult {
5198 pub fn new() -> Self {
5199 std::default::Default::default()
5200 }
5201
5202 /// Sets the value of [execution_state][crate::model::PiAndJailbreakFilterResult::execution_state].
5203 ///
5204 /// # Example
5205 /// ```ignore,no_run
5206 /// # use google_cloud_modelarmor_v1::model::PiAndJailbreakFilterResult;
5207 /// use google_cloud_modelarmor_v1::model::FilterExecutionState;
5208 /// let x0 = PiAndJailbreakFilterResult::new().set_execution_state(FilterExecutionState::ExecutionSuccess);
5209 /// let x1 = PiAndJailbreakFilterResult::new().set_execution_state(FilterExecutionState::ExecutionSkipped);
5210 /// ```
5211 pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
5212 mut self,
5213 v: T,
5214 ) -> Self {
5215 self.execution_state = v.into();
5216 self
5217 }
5218
5219 /// Sets the value of [message_items][crate::model::PiAndJailbreakFilterResult::message_items].
5220 ///
5221 /// # Example
5222 /// ```ignore,no_run
5223 /// # use google_cloud_modelarmor_v1::model::PiAndJailbreakFilterResult;
5224 /// use google_cloud_modelarmor_v1::model::MessageItem;
5225 /// let x = PiAndJailbreakFilterResult::new()
5226 /// .set_message_items([
5227 /// MessageItem::default()/* use setters */,
5228 /// MessageItem::default()/* use (different) setters */,
5229 /// ]);
5230 /// ```
5231 pub fn set_message_items<T, V>(mut self, v: T) -> Self
5232 where
5233 T: std::iter::IntoIterator<Item = V>,
5234 V: std::convert::Into<crate::model::MessageItem>,
5235 {
5236 use std::iter::Iterator;
5237 self.message_items = v.into_iter().map(|i| i.into()).collect();
5238 self
5239 }
5240
5241 /// Sets the value of [match_state][crate::model::PiAndJailbreakFilterResult::match_state].
5242 ///
5243 /// # Example
5244 /// ```ignore,no_run
5245 /// # use google_cloud_modelarmor_v1::model::PiAndJailbreakFilterResult;
5246 /// use google_cloud_modelarmor_v1::model::FilterMatchState;
5247 /// let x0 = PiAndJailbreakFilterResult::new().set_match_state(FilterMatchState::NoMatchFound);
5248 /// let x1 = PiAndJailbreakFilterResult::new().set_match_state(FilterMatchState::MatchFound);
5249 /// ```
5250 pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
5251 mut self,
5252 v: T,
5253 ) -> Self {
5254 self.match_state = v.into();
5255 self
5256 }
5257
5258 /// Sets the value of [confidence_level][crate::model::PiAndJailbreakFilterResult::confidence_level].
5259 ///
5260 /// # Example
5261 /// ```ignore,no_run
5262 /// # use google_cloud_modelarmor_v1::model::PiAndJailbreakFilterResult;
5263 /// use google_cloud_modelarmor_v1::model::DetectionConfidenceLevel;
5264 /// let x0 = PiAndJailbreakFilterResult::new().set_confidence_level(DetectionConfidenceLevel::LowAndAbove);
5265 /// let x1 = PiAndJailbreakFilterResult::new().set_confidence_level(DetectionConfidenceLevel::MediumAndAbove);
5266 /// let x2 = PiAndJailbreakFilterResult::new().set_confidence_level(DetectionConfidenceLevel::High);
5267 /// ```
5268 pub fn set_confidence_level<T: std::convert::Into<crate::model::DetectionConfidenceLevel>>(
5269 mut self,
5270 v: T,
5271 ) -> Self {
5272 self.confidence_level = v.into();
5273 self
5274 }
5275}
5276
5277impl wkt::message::Message for PiAndJailbreakFilterResult {
5278 fn typename() -> &'static str {
5279 "type.googleapis.com/google.cloud.modelarmor.v1.PiAndJailbreakFilterResult"
5280 }
5281}
5282
5283/// Malicious URI Filter Result.
5284#[derive(Clone, Default, PartialEq)]
5285#[non_exhaustive]
5286pub struct MaliciousUriFilterResult {
5287 /// Output only. Reports whether Malicious URI filter was successfully executed
5288 /// or not.
5289 pub execution_state: crate::model::FilterExecutionState,
5290
5291 /// Optional messages corresponding to the result.
5292 /// A message can provide warnings or error details.
5293 /// For example, if execution state is skipped then this field provides
5294 /// related reason/explanation.
5295 pub message_items: std::vec::Vec<crate::model::MessageItem>,
5296
5297 /// Output only. Match state for this Malicious URI.
5298 /// Value is MATCH_FOUND if at least one Malicious URI is found.
5299 pub match_state: crate::model::FilterMatchState,
5300
5301 /// List of Malicious URIs found in data.
5302 pub malicious_uri_matched_items:
5303 std::vec::Vec<crate::model::malicious_uri_filter_result::MaliciousUriMatchedItem>,
5304
5305 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5306}
5307
5308impl MaliciousUriFilterResult {
5309 pub fn new() -> Self {
5310 std::default::Default::default()
5311 }
5312
5313 /// Sets the value of [execution_state][crate::model::MaliciousUriFilterResult::execution_state].
5314 ///
5315 /// # Example
5316 /// ```ignore,no_run
5317 /// # use google_cloud_modelarmor_v1::model::MaliciousUriFilterResult;
5318 /// use google_cloud_modelarmor_v1::model::FilterExecutionState;
5319 /// let x0 = MaliciousUriFilterResult::new().set_execution_state(FilterExecutionState::ExecutionSuccess);
5320 /// let x1 = MaliciousUriFilterResult::new().set_execution_state(FilterExecutionState::ExecutionSkipped);
5321 /// ```
5322 pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
5323 mut self,
5324 v: T,
5325 ) -> Self {
5326 self.execution_state = v.into();
5327 self
5328 }
5329
5330 /// Sets the value of [message_items][crate::model::MaliciousUriFilterResult::message_items].
5331 ///
5332 /// # Example
5333 /// ```ignore,no_run
5334 /// # use google_cloud_modelarmor_v1::model::MaliciousUriFilterResult;
5335 /// use google_cloud_modelarmor_v1::model::MessageItem;
5336 /// let x = MaliciousUriFilterResult::new()
5337 /// .set_message_items([
5338 /// MessageItem::default()/* use setters */,
5339 /// MessageItem::default()/* use (different) setters */,
5340 /// ]);
5341 /// ```
5342 pub fn set_message_items<T, V>(mut self, v: T) -> Self
5343 where
5344 T: std::iter::IntoIterator<Item = V>,
5345 V: std::convert::Into<crate::model::MessageItem>,
5346 {
5347 use std::iter::Iterator;
5348 self.message_items = v.into_iter().map(|i| i.into()).collect();
5349 self
5350 }
5351
5352 /// Sets the value of [match_state][crate::model::MaliciousUriFilterResult::match_state].
5353 ///
5354 /// # Example
5355 /// ```ignore,no_run
5356 /// # use google_cloud_modelarmor_v1::model::MaliciousUriFilterResult;
5357 /// use google_cloud_modelarmor_v1::model::FilterMatchState;
5358 /// let x0 = MaliciousUriFilterResult::new().set_match_state(FilterMatchState::NoMatchFound);
5359 /// let x1 = MaliciousUriFilterResult::new().set_match_state(FilterMatchState::MatchFound);
5360 /// ```
5361 pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
5362 mut self,
5363 v: T,
5364 ) -> Self {
5365 self.match_state = v.into();
5366 self
5367 }
5368
5369 /// Sets the value of [malicious_uri_matched_items][crate::model::MaliciousUriFilterResult::malicious_uri_matched_items].
5370 ///
5371 /// # Example
5372 /// ```ignore,no_run
5373 /// # use google_cloud_modelarmor_v1::model::MaliciousUriFilterResult;
5374 /// use google_cloud_modelarmor_v1::model::malicious_uri_filter_result::MaliciousUriMatchedItem;
5375 /// let x = MaliciousUriFilterResult::new()
5376 /// .set_malicious_uri_matched_items([
5377 /// MaliciousUriMatchedItem::default()/* use setters */,
5378 /// MaliciousUriMatchedItem::default()/* use (different) setters */,
5379 /// ]);
5380 /// ```
5381 pub fn set_malicious_uri_matched_items<T, V>(mut self, v: T) -> Self
5382 where
5383 T: std::iter::IntoIterator<Item = V>,
5384 V: std::convert::Into<crate::model::malicious_uri_filter_result::MaliciousUriMatchedItem>,
5385 {
5386 use std::iter::Iterator;
5387 self.malicious_uri_matched_items = v.into_iter().map(|i| i.into()).collect();
5388 self
5389 }
5390}
5391
5392impl wkt::message::Message for MaliciousUriFilterResult {
5393 fn typename() -> &'static str {
5394 "type.googleapis.com/google.cloud.modelarmor.v1.MaliciousUriFilterResult"
5395 }
5396}
5397
5398/// Defines additional types related to [MaliciousUriFilterResult].
5399pub mod malicious_uri_filter_result {
5400 #[allow(unused_imports)]
5401 use super::*;
5402
5403 /// Information regarding malicious URI and its location within the input
5404 /// content.
5405 #[derive(Clone, Default, PartialEq)]
5406 #[non_exhaustive]
5407 pub struct MaliciousUriMatchedItem {
5408 /// Malicious URI.
5409 pub uri: std::string::String,
5410
5411 /// List of locations where Malicious URI is identified.
5412 /// The `locations` field is supported only for plaintext content i.e.
5413 /// ByteItemType.PLAINTEXT_UTF8
5414 pub locations: std::vec::Vec<crate::model::RangeInfo>,
5415
5416 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5417 }
5418
5419 impl MaliciousUriMatchedItem {
5420 pub fn new() -> Self {
5421 std::default::Default::default()
5422 }
5423
5424 /// Sets the value of [uri][crate::model::malicious_uri_filter_result::MaliciousUriMatchedItem::uri].
5425 ///
5426 /// # Example
5427 /// ```ignore,no_run
5428 /// # use google_cloud_modelarmor_v1::model::malicious_uri_filter_result::MaliciousUriMatchedItem;
5429 /// let x = MaliciousUriMatchedItem::new().set_uri("example");
5430 /// ```
5431 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5432 self.uri = v.into();
5433 self
5434 }
5435
5436 /// Sets the value of [locations][crate::model::malicious_uri_filter_result::MaliciousUriMatchedItem::locations].
5437 ///
5438 /// # Example
5439 /// ```ignore,no_run
5440 /// # use google_cloud_modelarmor_v1::model::malicious_uri_filter_result::MaliciousUriMatchedItem;
5441 /// use google_cloud_modelarmor_v1::model::RangeInfo;
5442 /// let x = MaliciousUriMatchedItem::new()
5443 /// .set_locations([
5444 /// RangeInfo::default()/* use setters */,
5445 /// RangeInfo::default()/* use (different) setters */,
5446 /// ]);
5447 /// ```
5448 pub fn set_locations<T, V>(mut self, v: T) -> Self
5449 where
5450 T: std::iter::IntoIterator<Item = V>,
5451 V: std::convert::Into<crate::model::RangeInfo>,
5452 {
5453 use std::iter::Iterator;
5454 self.locations = v.into_iter().map(|i| i.into()).collect();
5455 self
5456 }
5457 }
5458
5459 impl wkt::message::Message for MaliciousUriMatchedItem {
5460 fn typename() -> &'static str {
5461 "type.googleapis.com/google.cloud.modelarmor.v1.MaliciousUriFilterResult.MaliciousUriMatchedItem"
5462 }
5463 }
5464}
5465
5466/// Virus scan results.
5467#[derive(Clone, Default, PartialEq)]
5468#[non_exhaustive]
5469pub struct VirusScanFilterResult {
5470 /// Output only. Reports whether Virus Scan was successfully executed or not.
5471 pub execution_state: crate::model::FilterExecutionState,
5472
5473 /// Optional messages corresponding to the result.
5474 /// A message can provide warnings or error details.
5475 /// For example, if execution status is skipped then this field provides
5476 /// related reason/explanation.
5477 pub message_items: std::vec::Vec<crate::model::MessageItem>,
5478
5479 /// Output only. Match status for Virus.
5480 /// Value is MATCH_FOUND if the data is infected with a virus.
5481 pub match_state: crate::model::FilterMatchState,
5482
5483 /// Type of content scanned.
5484 pub scanned_content_type: crate::model::virus_scan_filter_result::ScannedContentType,
5485
5486 /// Size of scanned content in bytes.
5487 pub scanned_size: std::option::Option<i64>,
5488
5489 /// List of Viruses identified.
5490 /// This field will be empty if no virus was detected.
5491 pub virus_details: std::vec::Vec<crate::model::VirusDetail>,
5492
5493 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5494}
5495
5496impl VirusScanFilterResult {
5497 pub fn new() -> Self {
5498 std::default::Default::default()
5499 }
5500
5501 /// Sets the value of [execution_state][crate::model::VirusScanFilterResult::execution_state].
5502 ///
5503 /// # Example
5504 /// ```ignore,no_run
5505 /// # use google_cloud_modelarmor_v1::model::VirusScanFilterResult;
5506 /// use google_cloud_modelarmor_v1::model::FilterExecutionState;
5507 /// let x0 = VirusScanFilterResult::new().set_execution_state(FilterExecutionState::ExecutionSuccess);
5508 /// let x1 = VirusScanFilterResult::new().set_execution_state(FilterExecutionState::ExecutionSkipped);
5509 /// ```
5510 pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
5511 mut self,
5512 v: T,
5513 ) -> Self {
5514 self.execution_state = v.into();
5515 self
5516 }
5517
5518 /// Sets the value of [message_items][crate::model::VirusScanFilterResult::message_items].
5519 ///
5520 /// # Example
5521 /// ```ignore,no_run
5522 /// # use google_cloud_modelarmor_v1::model::VirusScanFilterResult;
5523 /// use google_cloud_modelarmor_v1::model::MessageItem;
5524 /// let x = VirusScanFilterResult::new()
5525 /// .set_message_items([
5526 /// MessageItem::default()/* use setters */,
5527 /// MessageItem::default()/* use (different) setters */,
5528 /// ]);
5529 /// ```
5530 pub fn set_message_items<T, V>(mut self, v: T) -> Self
5531 where
5532 T: std::iter::IntoIterator<Item = V>,
5533 V: std::convert::Into<crate::model::MessageItem>,
5534 {
5535 use std::iter::Iterator;
5536 self.message_items = v.into_iter().map(|i| i.into()).collect();
5537 self
5538 }
5539
5540 /// Sets the value of [match_state][crate::model::VirusScanFilterResult::match_state].
5541 ///
5542 /// # Example
5543 /// ```ignore,no_run
5544 /// # use google_cloud_modelarmor_v1::model::VirusScanFilterResult;
5545 /// use google_cloud_modelarmor_v1::model::FilterMatchState;
5546 /// let x0 = VirusScanFilterResult::new().set_match_state(FilterMatchState::NoMatchFound);
5547 /// let x1 = VirusScanFilterResult::new().set_match_state(FilterMatchState::MatchFound);
5548 /// ```
5549 pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
5550 mut self,
5551 v: T,
5552 ) -> Self {
5553 self.match_state = v.into();
5554 self
5555 }
5556
5557 /// Sets the value of [scanned_content_type][crate::model::VirusScanFilterResult::scanned_content_type].
5558 ///
5559 /// # Example
5560 /// ```ignore,no_run
5561 /// # use google_cloud_modelarmor_v1::model::VirusScanFilterResult;
5562 /// use google_cloud_modelarmor_v1::model::virus_scan_filter_result::ScannedContentType;
5563 /// let x0 = VirusScanFilterResult::new().set_scanned_content_type(ScannedContentType::Unknown);
5564 /// let x1 = VirusScanFilterResult::new().set_scanned_content_type(ScannedContentType::Plaintext);
5565 /// let x2 = VirusScanFilterResult::new().set_scanned_content_type(ScannedContentType::Pdf);
5566 /// ```
5567 pub fn set_scanned_content_type<
5568 T: std::convert::Into<crate::model::virus_scan_filter_result::ScannedContentType>,
5569 >(
5570 mut self,
5571 v: T,
5572 ) -> Self {
5573 self.scanned_content_type = v.into();
5574 self
5575 }
5576
5577 /// Sets the value of [scanned_size][crate::model::VirusScanFilterResult::scanned_size].
5578 ///
5579 /// # Example
5580 /// ```ignore,no_run
5581 /// # use google_cloud_modelarmor_v1::model::VirusScanFilterResult;
5582 /// let x = VirusScanFilterResult::new().set_scanned_size(42);
5583 /// ```
5584 pub fn set_scanned_size<T>(mut self, v: T) -> Self
5585 where
5586 T: std::convert::Into<i64>,
5587 {
5588 self.scanned_size = std::option::Option::Some(v.into());
5589 self
5590 }
5591
5592 /// Sets or clears the value of [scanned_size][crate::model::VirusScanFilterResult::scanned_size].
5593 ///
5594 /// # Example
5595 /// ```ignore,no_run
5596 /// # use google_cloud_modelarmor_v1::model::VirusScanFilterResult;
5597 /// let x = VirusScanFilterResult::new().set_or_clear_scanned_size(Some(42));
5598 /// let x = VirusScanFilterResult::new().set_or_clear_scanned_size(None::<i32>);
5599 /// ```
5600 pub fn set_or_clear_scanned_size<T>(mut self, v: std::option::Option<T>) -> Self
5601 where
5602 T: std::convert::Into<i64>,
5603 {
5604 self.scanned_size = v.map(|x| x.into());
5605 self
5606 }
5607
5608 /// Sets the value of [virus_details][crate::model::VirusScanFilterResult::virus_details].
5609 ///
5610 /// # Example
5611 /// ```ignore,no_run
5612 /// # use google_cloud_modelarmor_v1::model::VirusScanFilterResult;
5613 /// use google_cloud_modelarmor_v1::model::VirusDetail;
5614 /// let x = VirusScanFilterResult::new()
5615 /// .set_virus_details([
5616 /// VirusDetail::default()/* use setters */,
5617 /// VirusDetail::default()/* use (different) setters */,
5618 /// ]);
5619 /// ```
5620 pub fn set_virus_details<T, V>(mut self, v: T) -> Self
5621 where
5622 T: std::iter::IntoIterator<Item = V>,
5623 V: std::convert::Into<crate::model::VirusDetail>,
5624 {
5625 use std::iter::Iterator;
5626 self.virus_details = v.into_iter().map(|i| i.into()).collect();
5627 self
5628 }
5629}
5630
5631impl wkt::message::Message for VirusScanFilterResult {
5632 fn typename() -> &'static str {
5633 "type.googleapis.com/google.cloud.modelarmor.v1.VirusScanFilterResult"
5634 }
5635}
5636
5637/// Defines additional types related to [VirusScanFilterResult].
5638pub mod virus_scan_filter_result {
5639 #[allow(unused_imports)]
5640 use super::*;
5641
5642 /// Type of content scanned.
5643 ///
5644 /// # Working with unknown values
5645 ///
5646 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5647 /// additional enum variants at any time. Adding new variants is not considered
5648 /// a breaking change. Applications should write their code in anticipation of:
5649 ///
5650 /// - New values appearing in future releases of the client library, **and**
5651 /// - New values received dynamically, without application changes.
5652 ///
5653 /// Please consult the [Working with enums] section in the user guide for some
5654 /// guidelines.
5655 ///
5656 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5657 #[derive(Clone, Debug, PartialEq)]
5658 #[non_exhaustive]
5659 pub enum ScannedContentType {
5660 /// Unused
5661 Unspecified,
5662 /// Unknown content
5663 Unknown,
5664 /// Plaintext
5665 Plaintext,
5666 /// PDF
5667 /// Scanning for only PDF is supported.
5668 Pdf,
5669 /// If set, the enum was initialized with an unknown value.
5670 ///
5671 /// Applications can examine the value using [ScannedContentType::value] or
5672 /// [ScannedContentType::name].
5673 UnknownValue(scanned_content_type::UnknownValue),
5674 }
5675
5676 #[doc(hidden)]
5677 pub mod scanned_content_type {
5678 #[allow(unused_imports)]
5679 use super::*;
5680 #[derive(Clone, Debug, PartialEq)]
5681 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5682 }
5683
5684 impl ScannedContentType {
5685 /// Gets the enum value.
5686 ///
5687 /// Returns `None` if the enum contains an unknown value deserialized from
5688 /// the string representation of enums.
5689 pub fn value(&self) -> std::option::Option<i32> {
5690 match self {
5691 Self::Unspecified => std::option::Option::Some(0),
5692 Self::Unknown => std::option::Option::Some(1),
5693 Self::Plaintext => std::option::Option::Some(2),
5694 Self::Pdf => std::option::Option::Some(3),
5695 Self::UnknownValue(u) => u.0.value(),
5696 }
5697 }
5698
5699 /// Gets the enum value as a string.
5700 ///
5701 /// Returns `None` if the enum contains an unknown value deserialized from
5702 /// the integer representation of enums.
5703 pub fn name(&self) -> std::option::Option<&str> {
5704 match self {
5705 Self::Unspecified => std::option::Option::Some("SCANNED_CONTENT_TYPE_UNSPECIFIED"),
5706 Self::Unknown => std::option::Option::Some("UNKNOWN"),
5707 Self::Plaintext => std::option::Option::Some("PLAINTEXT"),
5708 Self::Pdf => std::option::Option::Some("PDF"),
5709 Self::UnknownValue(u) => u.0.name(),
5710 }
5711 }
5712 }
5713
5714 impl std::default::Default for ScannedContentType {
5715 fn default() -> Self {
5716 use std::convert::From;
5717 Self::from(0)
5718 }
5719 }
5720
5721 impl std::fmt::Display for ScannedContentType {
5722 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5723 wkt::internal::display_enum(f, self.name(), self.value())
5724 }
5725 }
5726
5727 impl std::convert::From<i32> for ScannedContentType {
5728 fn from(value: i32) -> Self {
5729 match value {
5730 0 => Self::Unspecified,
5731 1 => Self::Unknown,
5732 2 => Self::Plaintext,
5733 3 => Self::Pdf,
5734 _ => Self::UnknownValue(scanned_content_type::UnknownValue(
5735 wkt::internal::UnknownEnumValue::Integer(value),
5736 )),
5737 }
5738 }
5739 }
5740
5741 impl std::convert::From<&str> for ScannedContentType {
5742 fn from(value: &str) -> Self {
5743 use std::string::ToString;
5744 match value {
5745 "SCANNED_CONTENT_TYPE_UNSPECIFIED" => Self::Unspecified,
5746 "UNKNOWN" => Self::Unknown,
5747 "PLAINTEXT" => Self::Plaintext,
5748 "PDF" => Self::Pdf,
5749 _ => Self::UnknownValue(scanned_content_type::UnknownValue(
5750 wkt::internal::UnknownEnumValue::String(value.to_string()),
5751 )),
5752 }
5753 }
5754 }
5755
5756 impl serde::ser::Serialize for ScannedContentType {
5757 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5758 where
5759 S: serde::Serializer,
5760 {
5761 match self {
5762 Self::Unspecified => serializer.serialize_i32(0),
5763 Self::Unknown => serializer.serialize_i32(1),
5764 Self::Plaintext => serializer.serialize_i32(2),
5765 Self::Pdf => serializer.serialize_i32(3),
5766 Self::UnknownValue(u) => u.0.serialize(serializer),
5767 }
5768 }
5769 }
5770
5771 impl<'de> serde::de::Deserialize<'de> for ScannedContentType {
5772 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5773 where
5774 D: serde::Deserializer<'de>,
5775 {
5776 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ScannedContentType>::new(
5777 ".google.cloud.modelarmor.v1.VirusScanFilterResult.ScannedContentType",
5778 ))
5779 }
5780 }
5781}
5782
5783/// Details of an identified virus
5784#[derive(Clone, Default, PartialEq)]
5785#[non_exhaustive]
5786pub struct VirusDetail {
5787 /// Name of vendor that produced this virus identification.
5788 pub vendor: std::string::String,
5789
5790 /// Names of this Virus.
5791 pub names: std::vec::Vec<std::string::String>,
5792
5793 /// Threat type of the identified virus
5794 pub threat_type: crate::model::virus_detail::ThreatType,
5795
5796 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5797}
5798
5799impl VirusDetail {
5800 pub fn new() -> Self {
5801 std::default::Default::default()
5802 }
5803
5804 /// Sets the value of [vendor][crate::model::VirusDetail::vendor].
5805 ///
5806 /// # Example
5807 /// ```ignore,no_run
5808 /// # use google_cloud_modelarmor_v1::model::VirusDetail;
5809 /// let x = VirusDetail::new().set_vendor("example");
5810 /// ```
5811 pub fn set_vendor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5812 self.vendor = v.into();
5813 self
5814 }
5815
5816 /// Sets the value of [names][crate::model::VirusDetail::names].
5817 ///
5818 /// # Example
5819 /// ```ignore,no_run
5820 /// # use google_cloud_modelarmor_v1::model::VirusDetail;
5821 /// let x = VirusDetail::new().set_names(["a", "b", "c"]);
5822 /// ```
5823 pub fn set_names<T, V>(mut self, v: T) -> Self
5824 where
5825 T: std::iter::IntoIterator<Item = V>,
5826 V: std::convert::Into<std::string::String>,
5827 {
5828 use std::iter::Iterator;
5829 self.names = v.into_iter().map(|i| i.into()).collect();
5830 self
5831 }
5832
5833 /// Sets the value of [threat_type][crate::model::VirusDetail::threat_type].
5834 ///
5835 /// # Example
5836 /// ```ignore,no_run
5837 /// # use google_cloud_modelarmor_v1::model::VirusDetail;
5838 /// use google_cloud_modelarmor_v1::model::virus_detail::ThreatType;
5839 /// let x0 = VirusDetail::new().set_threat_type(ThreatType::Unknown);
5840 /// let x1 = VirusDetail::new().set_threat_type(ThreatType::VirusOrWorm);
5841 /// let x2 = VirusDetail::new().set_threat_type(ThreatType::MaliciousProgram);
5842 /// ```
5843 pub fn set_threat_type<T: std::convert::Into<crate::model::virus_detail::ThreatType>>(
5844 mut self,
5845 v: T,
5846 ) -> Self {
5847 self.threat_type = v.into();
5848 self
5849 }
5850}
5851
5852impl wkt::message::Message for VirusDetail {
5853 fn typename() -> &'static str {
5854 "type.googleapis.com/google.cloud.modelarmor.v1.VirusDetail"
5855 }
5856}
5857
5858/// Defines additional types related to [VirusDetail].
5859pub mod virus_detail {
5860 #[allow(unused_imports)]
5861 use super::*;
5862
5863 /// Defines all the threat types of a virus
5864 ///
5865 /// # Working with unknown values
5866 ///
5867 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5868 /// additional enum variants at any time. Adding new variants is not considered
5869 /// a breaking change. Applications should write their code in anticipation of:
5870 ///
5871 /// - New values appearing in future releases of the client library, **and**
5872 /// - New values received dynamically, without application changes.
5873 ///
5874 /// Please consult the [Working with enums] section in the user guide for some
5875 /// guidelines.
5876 ///
5877 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5878 #[derive(Clone, Debug, PartialEq)]
5879 #[non_exhaustive]
5880 pub enum ThreatType {
5881 /// Unused
5882 Unspecified,
5883 /// Unable to categorize threat
5884 Unknown,
5885 /// Virus or Worm threat.
5886 VirusOrWorm,
5887 /// Malicious program. E.g. Spyware, Trojan.
5888 MaliciousProgram,
5889 /// Potentially harmful content. E.g. Injected code, Macro
5890 PotentiallyHarmfulContent,
5891 /// Potentially unwanted content. E.g. Adware.
5892 PotentiallyUnwantedContent,
5893 /// If set, the enum was initialized with an unknown value.
5894 ///
5895 /// Applications can examine the value using [ThreatType::value] or
5896 /// [ThreatType::name].
5897 UnknownValue(threat_type::UnknownValue),
5898 }
5899
5900 #[doc(hidden)]
5901 pub mod threat_type {
5902 #[allow(unused_imports)]
5903 use super::*;
5904 #[derive(Clone, Debug, PartialEq)]
5905 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5906 }
5907
5908 impl ThreatType {
5909 /// Gets the enum value.
5910 ///
5911 /// Returns `None` if the enum contains an unknown value deserialized from
5912 /// the string representation of enums.
5913 pub fn value(&self) -> std::option::Option<i32> {
5914 match self {
5915 Self::Unspecified => std::option::Option::Some(0),
5916 Self::Unknown => std::option::Option::Some(1),
5917 Self::VirusOrWorm => std::option::Option::Some(2),
5918 Self::MaliciousProgram => std::option::Option::Some(3),
5919 Self::PotentiallyHarmfulContent => std::option::Option::Some(4),
5920 Self::PotentiallyUnwantedContent => std::option::Option::Some(5),
5921 Self::UnknownValue(u) => u.0.value(),
5922 }
5923 }
5924
5925 /// Gets the enum value as a string.
5926 ///
5927 /// Returns `None` if the enum contains an unknown value deserialized from
5928 /// the integer representation of enums.
5929 pub fn name(&self) -> std::option::Option<&str> {
5930 match self {
5931 Self::Unspecified => std::option::Option::Some("THREAT_TYPE_UNSPECIFIED"),
5932 Self::Unknown => std::option::Option::Some("UNKNOWN"),
5933 Self::VirusOrWorm => std::option::Option::Some("VIRUS_OR_WORM"),
5934 Self::MaliciousProgram => std::option::Option::Some("MALICIOUS_PROGRAM"),
5935 Self::PotentiallyHarmfulContent => {
5936 std::option::Option::Some("POTENTIALLY_HARMFUL_CONTENT")
5937 }
5938 Self::PotentiallyUnwantedContent => {
5939 std::option::Option::Some("POTENTIALLY_UNWANTED_CONTENT")
5940 }
5941 Self::UnknownValue(u) => u.0.name(),
5942 }
5943 }
5944 }
5945
5946 impl std::default::Default for ThreatType {
5947 fn default() -> Self {
5948 use std::convert::From;
5949 Self::from(0)
5950 }
5951 }
5952
5953 impl std::fmt::Display for ThreatType {
5954 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5955 wkt::internal::display_enum(f, self.name(), self.value())
5956 }
5957 }
5958
5959 impl std::convert::From<i32> for ThreatType {
5960 fn from(value: i32) -> Self {
5961 match value {
5962 0 => Self::Unspecified,
5963 1 => Self::Unknown,
5964 2 => Self::VirusOrWorm,
5965 3 => Self::MaliciousProgram,
5966 4 => Self::PotentiallyHarmfulContent,
5967 5 => Self::PotentiallyUnwantedContent,
5968 _ => Self::UnknownValue(threat_type::UnknownValue(
5969 wkt::internal::UnknownEnumValue::Integer(value),
5970 )),
5971 }
5972 }
5973 }
5974
5975 impl std::convert::From<&str> for ThreatType {
5976 fn from(value: &str) -> Self {
5977 use std::string::ToString;
5978 match value {
5979 "THREAT_TYPE_UNSPECIFIED" => Self::Unspecified,
5980 "UNKNOWN" => Self::Unknown,
5981 "VIRUS_OR_WORM" => Self::VirusOrWorm,
5982 "MALICIOUS_PROGRAM" => Self::MaliciousProgram,
5983 "POTENTIALLY_HARMFUL_CONTENT" => Self::PotentiallyHarmfulContent,
5984 "POTENTIALLY_UNWANTED_CONTENT" => Self::PotentiallyUnwantedContent,
5985 _ => Self::UnknownValue(threat_type::UnknownValue(
5986 wkt::internal::UnknownEnumValue::String(value.to_string()),
5987 )),
5988 }
5989 }
5990 }
5991
5992 impl serde::ser::Serialize for ThreatType {
5993 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5994 where
5995 S: serde::Serializer,
5996 {
5997 match self {
5998 Self::Unspecified => serializer.serialize_i32(0),
5999 Self::Unknown => serializer.serialize_i32(1),
6000 Self::VirusOrWorm => serializer.serialize_i32(2),
6001 Self::MaliciousProgram => serializer.serialize_i32(3),
6002 Self::PotentiallyHarmfulContent => serializer.serialize_i32(4),
6003 Self::PotentiallyUnwantedContent => serializer.serialize_i32(5),
6004 Self::UnknownValue(u) => u.0.serialize(serializer),
6005 }
6006 }
6007 }
6008
6009 impl<'de> serde::de::Deserialize<'de> for ThreatType {
6010 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6011 where
6012 D: serde::Deserializer<'de>,
6013 {
6014 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ThreatType>::new(
6015 ".google.cloud.modelarmor.v1.VirusDetail.ThreatType",
6016 ))
6017 }
6018 }
6019}
6020
6021/// CSAM (Child Safety Abuse Material) Filter Result
6022#[derive(Clone, Default, PartialEq)]
6023#[non_exhaustive]
6024pub struct CsamFilterResult {
6025 /// Output only. Reports whether the CSAM filter was successfully executed or
6026 /// not.
6027 pub execution_state: crate::model::FilterExecutionState,
6028
6029 /// Optional messages corresponding to the result.
6030 /// A message can provide warnings or error details.
6031 /// For example, if execution state is skipped then this field provides
6032 /// related reason/explanation.
6033 pub message_items: std::vec::Vec<crate::model::MessageItem>,
6034
6035 /// Output only. Match state for CSAM.
6036 pub match_state: crate::model::FilterMatchState,
6037
6038 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6039}
6040
6041impl CsamFilterResult {
6042 pub fn new() -> Self {
6043 std::default::Default::default()
6044 }
6045
6046 /// Sets the value of [execution_state][crate::model::CsamFilterResult::execution_state].
6047 ///
6048 /// # Example
6049 /// ```ignore,no_run
6050 /// # use google_cloud_modelarmor_v1::model::CsamFilterResult;
6051 /// use google_cloud_modelarmor_v1::model::FilterExecutionState;
6052 /// let x0 = CsamFilterResult::new().set_execution_state(FilterExecutionState::ExecutionSuccess);
6053 /// let x1 = CsamFilterResult::new().set_execution_state(FilterExecutionState::ExecutionSkipped);
6054 /// ```
6055 pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
6056 mut self,
6057 v: T,
6058 ) -> Self {
6059 self.execution_state = v.into();
6060 self
6061 }
6062
6063 /// Sets the value of [message_items][crate::model::CsamFilterResult::message_items].
6064 ///
6065 /// # Example
6066 /// ```ignore,no_run
6067 /// # use google_cloud_modelarmor_v1::model::CsamFilterResult;
6068 /// use google_cloud_modelarmor_v1::model::MessageItem;
6069 /// let x = CsamFilterResult::new()
6070 /// .set_message_items([
6071 /// MessageItem::default()/* use setters */,
6072 /// MessageItem::default()/* use (different) setters */,
6073 /// ]);
6074 /// ```
6075 pub fn set_message_items<T, V>(mut self, v: T) -> Self
6076 where
6077 T: std::iter::IntoIterator<Item = V>,
6078 V: std::convert::Into<crate::model::MessageItem>,
6079 {
6080 use std::iter::Iterator;
6081 self.message_items = v.into_iter().map(|i| i.into()).collect();
6082 self
6083 }
6084
6085 /// Sets the value of [match_state][crate::model::CsamFilterResult::match_state].
6086 ///
6087 /// # Example
6088 /// ```ignore,no_run
6089 /// # use google_cloud_modelarmor_v1::model::CsamFilterResult;
6090 /// use google_cloud_modelarmor_v1::model::FilterMatchState;
6091 /// let x0 = CsamFilterResult::new().set_match_state(FilterMatchState::NoMatchFound);
6092 /// let x1 = CsamFilterResult::new().set_match_state(FilterMatchState::MatchFound);
6093 /// ```
6094 pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
6095 mut self,
6096 v: T,
6097 ) -> Self {
6098 self.match_state = v.into();
6099 self
6100 }
6101}
6102
6103impl wkt::message::Message for CsamFilterResult {
6104 fn typename() -> &'static str {
6105 "type.googleapis.com/google.cloud.modelarmor.v1.CsamFilterResult"
6106 }
6107}
6108
6109/// Message item to report information, warning or error messages.
6110#[derive(Clone, Default, PartialEq)]
6111#[non_exhaustive]
6112pub struct MessageItem {
6113 /// Type of message.
6114 pub message_type: crate::model::message_item::MessageType,
6115
6116 /// The message content.
6117 pub message: std::string::String,
6118
6119 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6120}
6121
6122impl MessageItem {
6123 pub fn new() -> Self {
6124 std::default::Default::default()
6125 }
6126
6127 /// Sets the value of [message_type][crate::model::MessageItem::message_type].
6128 ///
6129 /// # Example
6130 /// ```ignore,no_run
6131 /// # use google_cloud_modelarmor_v1::model::MessageItem;
6132 /// use google_cloud_modelarmor_v1::model::message_item::MessageType;
6133 /// let x0 = MessageItem::new().set_message_type(MessageType::Info);
6134 /// let x1 = MessageItem::new().set_message_type(MessageType::Warning);
6135 /// let x2 = MessageItem::new().set_message_type(MessageType::Error);
6136 /// ```
6137 pub fn set_message_type<T: std::convert::Into<crate::model::message_item::MessageType>>(
6138 mut self,
6139 v: T,
6140 ) -> Self {
6141 self.message_type = v.into();
6142 self
6143 }
6144
6145 /// Sets the value of [message][crate::model::MessageItem::message].
6146 ///
6147 /// # Example
6148 /// ```ignore,no_run
6149 /// # use google_cloud_modelarmor_v1::model::MessageItem;
6150 /// let x = MessageItem::new().set_message("example");
6151 /// ```
6152 pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6153 self.message = v.into();
6154 self
6155 }
6156}
6157
6158impl wkt::message::Message for MessageItem {
6159 fn typename() -> &'static str {
6160 "type.googleapis.com/google.cloud.modelarmor.v1.MessageItem"
6161 }
6162}
6163
6164/// Defines additional types related to [MessageItem].
6165pub mod message_item {
6166 #[allow(unused_imports)]
6167 use super::*;
6168
6169 /// Option to specify the type of message.
6170 ///
6171 /// # Working with unknown values
6172 ///
6173 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6174 /// additional enum variants at any time. Adding new variants is not considered
6175 /// a breaking change. Applications should write their code in anticipation of:
6176 ///
6177 /// - New values appearing in future releases of the client library, **and**
6178 /// - New values received dynamically, without application changes.
6179 ///
6180 /// Please consult the [Working with enums] section in the user guide for some
6181 /// guidelines.
6182 ///
6183 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6184 #[derive(Clone, Debug, PartialEq)]
6185 #[non_exhaustive]
6186 pub enum MessageType {
6187 /// Unused
6188 Unspecified,
6189 /// Information related message.
6190 Info,
6191 /// Warning related message.
6192 Warning,
6193 /// Error message.
6194 Error,
6195 /// If set, the enum was initialized with an unknown value.
6196 ///
6197 /// Applications can examine the value using [MessageType::value] or
6198 /// [MessageType::name].
6199 UnknownValue(message_type::UnknownValue),
6200 }
6201
6202 #[doc(hidden)]
6203 pub mod message_type {
6204 #[allow(unused_imports)]
6205 use super::*;
6206 #[derive(Clone, Debug, PartialEq)]
6207 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6208 }
6209
6210 impl MessageType {
6211 /// Gets the enum value.
6212 ///
6213 /// Returns `None` if the enum contains an unknown value deserialized from
6214 /// the string representation of enums.
6215 pub fn value(&self) -> std::option::Option<i32> {
6216 match self {
6217 Self::Unspecified => std::option::Option::Some(0),
6218 Self::Info => std::option::Option::Some(1),
6219 Self::Warning => std::option::Option::Some(2),
6220 Self::Error => std::option::Option::Some(3),
6221 Self::UnknownValue(u) => u.0.value(),
6222 }
6223 }
6224
6225 /// Gets the enum value as a string.
6226 ///
6227 /// Returns `None` if the enum contains an unknown value deserialized from
6228 /// the integer representation of enums.
6229 pub fn name(&self) -> std::option::Option<&str> {
6230 match self {
6231 Self::Unspecified => std::option::Option::Some("MESSAGE_TYPE_UNSPECIFIED"),
6232 Self::Info => std::option::Option::Some("INFO"),
6233 Self::Warning => std::option::Option::Some("WARNING"),
6234 Self::Error => std::option::Option::Some("ERROR"),
6235 Self::UnknownValue(u) => u.0.name(),
6236 }
6237 }
6238 }
6239
6240 impl std::default::Default for MessageType {
6241 fn default() -> Self {
6242 use std::convert::From;
6243 Self::from(0)
6244 }
6245 }
6246
6247 impl std::fmt::Display for MessageType {
6248 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6249 wkt::internal::display_enum(f, self.name(), self.value())
6250 }
6251 }
6252
6253 impl std::convert::From<i32> for MessageType {
6254 fn from(value: i32) -> Self {
6255 match value {
6256 0 => Self::Unspecified,
6257 1 => Self::Info,
6258 2 => Self::Warning,
6259 3 => Self::Error,
6260 _ => Self::UnknownValue(message_type::UnknownValue(
6261 wkt::internal::UnknownEnumValue::Integer(value),
6262 )),
6263 }
6264 }
6265 }
6266
6267 impl std::convert::From<&str> for MessageType {
6268 fn from(value: &str) -> Self {
6269 use std::string::ToString;
6270 match value {
6271 "MESSAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
6272 "INFO" => Self::Info,
6273 "WARNING" => Self::Warning,
6274 "ERROR" => Self::Error,
6275 _ => Self::UnknownValue(message_type::UnknownValue(
6276 wkt::internal::UnknownEnumValue::String(value.to_string()),
6277 )),
6278 }
6279 }
6280 }
6281
6282 impl serde::ser::Serialize for MessageType {
6283 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6284 where
6285 S: serde::Serializer,
6286 {
6287 match self {
6288 Self::Unspecified => serializer.serialize_i32(0),
6289 Self::Info => serializer.serialize_i32(1),
6290 Self::Warning => serializer.serialize_i32(2),
6291 Self::Error => serializer.serialize_i32(3),
6292 Self::UnknownValue(u) => u.0.serialize(serializer),
6293 }
6294 }
6295 }
6296
6297 impl<'de> serde::de::Deserialize<'de> for MessageType {
6298 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6299 where
6300 D: serde::Deserializer<'de>,
6301 {
6302 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MessageType>::new(
6303 ".google.cloud.modelarmor.v1.MessageItem.MessageType",
6304 ))
6305 }
6306 }
6307}
6308
6309/// Half-open range interval [start, end)
6310#[derive(Clone, Default, PartialEq)]
6311#[non_exhaustive]
6312pub struct RangeInfo {
6313 /// For proto3, value cannot be set to 0 unless the field is optional.
6314 /// Ref: <https://protobuf.dev/programming-guides/proto3/#default>
6315 /// Index of first character (inclusive).
6316 pub start: std::option::Option<i64>,
6317
6318 /// Index of last character (exclusive).
6319 pub end: std::option::Option<i64>,
6320
6321 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6322}
6323
6324impl RangeInfo {
6325 pub fn new() -> Self {
6326 std::default::Default::default()
6327 }
6328
6329 /// Sets the value of [start][crate::model::RangeInfo::start].
6330 ///
6331 /// # Example
6332 /// ```ignore,no_run
6333 /// # use google_cloud_modelarmor_v1::model::RangeInfo;
6334 /// let x = RangeInfo::new().set_start(42);
6335 /// ```
6336 pub fn set_start<T>(mut self, v: T) -> Self
6337 where
6338 T: std::convert::Into<i64>,
6339 {
6340 self.start = std::option::Option::Some(v.into());
6341 self
6342 }
6343
6344 /// Sets or clears the value of [start][crate::model::RangeInfo::start].
6345 ///
6346 /// # Example
6347 /// ```ignore,no_run
6348 /// # use google_cloud_modelarmor_v1::model::RangeInfo;
6349 /// let x = RangeInfo::new().set_or_clear_start(Some(42));
6350 /// let x = RangeInfo::new().set_or_clear_start(None::<i32>);
6351 /// ```
6352 pub fn set_or_clear_start<T>(mut self, v: std::option::Option<T>) -> Self
6353 where
6354 T: std::convert::Into<i64>,
6355 {
6356 self.start = v.map(|x| x.into());
6357 self
6358 }
6359
6360 /// Sets the value of [end][crate::model::RangeInfo::end].
6361 ///
6362 /// # Example
6363 /// ```ignore,no_run
6364 /// # use google_cloud_modelarmor_v1::model::RangeInfo;
6365 /// let x = RangeInfo::new().set_end(42);
6366 /// ```
6367 pub fn set_end<T>(mut self, v: T) -> Self
6368 where
6369 T: std::convert::Into<i64>,
6370 {
6371 self.end = std::option::Option::Some(v.into());
6372 self
6373 }
6374
6375 /// Sets or clears the value of [end][crate::model::RangeInfo::end].
6376 ///
6377 /// # Example
6378 /// ```ignore,no_run
6379 /// # use google_cloud_modelarmor_v1::model::RangeInfo;
6380 /// let x = RangeInfo::new().set_or_clear_end(Some(42));
6381 /// let x = RangeInfo::new().set_or_clear_end(None::<i32>);
6382 /// ```
6383 pub fn set_or_clear_end<T>(mut self, v: std::option::Option<T>) -> Self
6384 where
6385 T: std::convert::Into<i64>,
6386 {
6387 self.end = v.map(|x| x.into());
6388 self
6389 }
6390}
6391
6392impl wkt::message::Message for RangeInfo {
6393 fn typename() -> &'static str {
6394 "type.googleapis.com/google.cloud.modelarmor.v1.RangeInfo"
6395 }
6396}
6397
6398/// Option to specify filter match state.
6399///
6400/// # Working with unknown values
6401///
6402/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6403/// additional enum variants at any time. Adding new variants is not considered
6404/// a breaking change. Applications should write their code in anticipation of:
6405///
6406/// - New values appearing in future releases of the client library, **and**
6407/// - New values received dynamically, without application changes.
6408///
6409/// Please consult the [Working with enums] section in the user guide for some
6410/// guidelines.
6411///
6412/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6413#[derive(Clone, Debug, PartialEq)]
6414#[non_exhaustive]
6415pub enum FilterMatchState {
6416 /// Unused
6417 Unspecified,
6418 /// Matching criteria is not achieved for filters.
6419 NoMatchFound,
6420 /// Matching criteria is achieved for the filter.
6421 MatchFound,
6422 /// If set, the enum was initialized with an unknown value.
6423 ///
6424 /// Applications can examine the value using [FilterMatchState::value] or
6425 /// [FilterMatchState::name].
6426 UnknownValue(filter_match_state::UnknownValue),
6427}
6428
6429#[doc(hidden)]
6430pub mod filter_match_state {
6431 #[allow(unused_imports)]
6432 use super::*;
6433 #[derive(Clone, Debug, PartialEq)]
6434 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6435}
6436
6437impl FilterMatchState {
6438 /// Gets the enum value.
6439 ///
6440 /// Returns `None` if the enum contains an unknown value deserialized from
6441 /// the string representation of enums.
6442 pub fn value(&self) -> std::option::Option<i32> {
6443 match self {
6444 Self::Unspecified => std::option::Option::Some(0),
6445 Self::NoMatchFound => std::option::Option::Some(1),
6446 Self::MatchFound => std::option::Option::Some(2),
6447 Self::UnknownValue(u) => u.0.value(),
6448 }
6449 }
6450
6451 /// Gets the enum value as a string.
6452 ///
6453 /// Returns `None` if the enum contains an unknown value deserialized from
6454 /// the integer representation of enums.
6455 pub fn name(&self) -> std::option::Option<&str> {
6456 match self {
6457 Self::Unspecified => std::option::Option::Some("FILTER_MATCH_STATE_UNSPECIFIED"),
6458 Self::NoMatchFound => std::option::Option::Some("NO_MATCH_FOUND"),
6459 Self::MatchFound => std::option::Option::Some("MATCH_FOUND"),
6460 Self::UnknownValue(u) => u.0.name(),
6461 }
6462 }
6463}
6464
6465impl std::default::Default for FilterMatchState {
6466 fn default() -> Self {
6467 use std::convert::From;
6468 Self::from(0)
6469 }
6470}
6471
6472impl std::fmt::Display for FilterMatchState {
6473 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6474 wkt::internal::display_enum(f, self.name(), self.value())
6475 }
6476}
6477
6478impl std::convert::From<i32> for FilterMatchState {
6479 fn from(value: i32) -> Self {
6480 match value {
6481 0 => Self::Unspecified,
6482 1 => Self::NoMatchFound,
6483 2 => Self::MatchFound,
6484 _ => Self::UnknownValue(filter_match_state::UnknownValue(
6485 wkt::internal::UnknownEnumValue::Integer(value),
6486 )),
6487 }
6488 }
6489}
6490
6491impl std::convert::From<&str> for FilterMatchState {
6492 fn from(value: &str) -> Self {
6493 use std::string::ToString;
6494 match value {
6495 "FILTER_MATCH_STATE_UNSPECIFIED" => Self::Unspecified,
6496 "NO_MATCH_FOUND" => Self::NoMatchFound,
6497 "MATCH_FOUND" => Self::MatchFound,
6498 _ => Self::UnknownValue(filter_match_state::UnknownValue(
6499 wkt::internal::UnknownEnumValue::String(value.to_string()),
6500 )),
6501 }
6502 }
6503}
6504
6505impl serde::ser::Serialize for FilterMatchState {
6506 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6507 where
6508 S: serde::Serializer,
6509 {
6510 match self {
6511 Self::Unspecified => serializer.serialize_i32(0),
6512 Self::NoMatchFound => serializer.serialize_i32(1),
6513 Self::MatchFound => serializer.serialize_i32(2),
6514 Self::UnknownValue(u) => u.0.serialize(serializer),
6515 }
6516 }
6517}
6518
6519impl<'de> serde::de::Deserialize<'de> for FilterMatchState {
6520 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6521 where
6522 D: serde::Deserializer<'de>,
6523 {
6524 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FilterMatchState>::new(
6525 ".google.cloud.modelarmor.v1.FilterMatchState",
6526 ))
6527 }
6528}
6529
6530/// Enum which reports whether a specific filter executed successfully or not.
6531///
6532/// # Working with unknown values
6533///
6534/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6535/// additional enum variants at any time. Adding new variants is not considered
6536/// a breaking change. Applications should write their code in anticipation of:
6537///
6538/// - New values appearing in future releases of the client library, **and**
6539/// - New values received dynamically, without application changes.
6540///
6541/// Please consult the [Working with enums] section in the user guide for some
6542/// guidelines.
6543///
6544/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6545#[derive(Clone, Debug, PartialEq)]
6546#[non_exhaustive]
6547pub enum FilterExecutionState {
6548 /// Unused
6549 Unspecified,
6550 /// Filter executed successfully
6551 ExecutionSuccess,
6552 /// Filter execution was skipped. This can happen due to server-side error
6553 /// or permission issue.
6554 ExecutionSkipped,
6555 /// If set, the enum was initialized with an unknown value.
6556 ///
6557 /// Applications can examine the value using [FilterExecutionState::value] or
6558 /// [FilterExecutionState::name].
6559 UnknownValue(filter_execution_state::UnknownValue),
6560}
6561
6562#[doc(hidden)]
6563pub mod filter_execution_state {
6564 #[allow(unused_imports)]
6565 use super::*;
6566 #[derive(Clone, Debug, PartialEq)]
6567 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6568}
6569
6570impl FilterExecutionState {
6571 /// Gets the enum value.
6572 ///
6573 /// Returns `None` if the enum contains an unknown value deserialized from
6574 /// the string representation of enums.
6575 pub fn value(&self) -> std::option::Option<i32> {
6576 match self {
6577 Self::Unspecified => std::option::Option::Some(0),
6578 Self::ExecutionSuccess => std::option::Option::Some(1),
6579 Self::ExecutionSkipped => std::option::Option::Some(2),
6580 Self::UnknownValue(u) => u.0.value(),
6581 }
6582 }
6583
6584 /// Gets the enum value as a string.
6585 ///
6586 /// Returns `None` if the enum contains an unknown value deserialized from
6587 /// the integer representation of enums.
6588 pub fn name(&self) -> std::option::Option<&str> {
6589 match self {
6590 Self::Unspecified => std::option::Option::Some("FILTER_EXECUTION_STATE_UNSPECIFIED"),
6591 Self::ExecutionSuccess => std::option::Option::Some("EXECUTION_SUCCESS"),
6592 Self::ExecutionSkipped => std::option::Option::Some("EXECUTION_SKIPPED"),
6593 Self::UnknownValue(u) => u.0.name(),
6594 }
6595 }
6596}
6597
6598impl std::default::Default for FilterExecutionState {
6599 fn default() -> Self {
6600 use std::convert::From;
6601 Self::from(0)
6602 }
6603}
6604
6605impl std::fmt::Display for FilterExecutionState {
6606 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6607 wkt::internal::display_enum(f, self.name(), self.value())
6608 }
6609}
6610
6611impl std::convert::From<i32> for FilterExecutionState {
6612 fn from(value: i32) -> Self {
6613 match value {
6614 0 => Self::Unspecified,
6615 1 => Self::ExecutionSuccess,
6616 2 => Self::ExecutionSkipped,
6617 _ => Self::UnknownValue(filter_execution_state::UnknownValue(
6618 wkt::internal::UnknownEnumValue::Integer(value),
6619 )),
6620 }
6621 }
6622}
6623
6624impl std::convert::From<&str> for FilterExecutionState {
6625 fn from(value: &str) -> Self {
6626 use std::string::ToString;
6627 match value {
6628 "FILTER_EXECUTION_STATE_UNSPECIFIED" => Self::Unspecified,
6629 "EXECUTION_SUCCESS" => Self::ExecutionSuccess,
6630 "EXECUTION_SKIPPED" => Self::ExecutionSkipped,
6631 _ => Self::UnknownValue(filter_execution_state::UnknownValue(
6632 wkt::internal::UnknownEnumValue::String(value.to_string()),
6633 )),
6634 }
6635 }
6636}
6637
6638impl serde::ser::Serialize for FilterExecutionState {
6639 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6640 where
6641 S: serde::Serializer,
6642 {
6643 match self {
6644 Self::Unspecified => serializer.serialize_i32(0),
6645 Self::ExecutionSuccess => serializer.serialize_i32(1),
6646 Self::ExecutionSkipped => serializer.serialize_i32(2),
6647 Self::UnknownValue(u) => u.0.serialize(serializer),
6648 }
6649 }
6650}
6651
6652impl<'de> serde::de::Deserialize<'de> for FilterExecutionState {
6653 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6654 where
6655 D: serde::Deserializer<'de>,
6656 {
6657 deserializer.deserialize_any(wkt::internal::EnumVisitor::<FilterExecutionState>::new(
6658 ".google.cloud.modelarmor.v1.FilterExecutionState",
6659 ))
6660 }
6661}
6662
6663/// Options for responsible AI Filter Types.
6664///
6665/// # Working with unknown values
6666///
6667/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6668/// additional enum variants at any time. Adding new variants is not considered
6669/// a breaking change. Applications should write their code in anticipation of:
6670///
6671/// - New values appearing in future releases of the client library, **and**
6672/// - New values received dynamically, without application changes.
6673///
6674/// Please consult the [Working with enums] section in the user guide for some
6675/// guidelines.
6676///
6677/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6678#[derive(Clone, Debug, PartialEq)]
6679#[non_exhaustive]
6680pub enum RaiFilterType {
6681 /// Unspecified filter type.
6682 Unspecified,
6683 /// Sexually Explicit.
6684 SexuallyExplicit,
6685 /// Hate Speech.
6686 HateSpeech,
6687 /// Harassment.
6688 Harassment,
6689 /// Danger
6690 Dangerous,
6691 /// If set, the enum was initialized with an unknown value.
6692 ///
6693 /// Applications can examine the value using [RaiFilterType::value] or
6694 /// [RaiFilterType::name].
6695 UnknownValue(rai_filter_type::UnknownValue),
6696}
6697
6698#[doc(hidden)]
6699pub mod rai_filter_type {
6700 #[allow(unused_imports)]
6701 use super::*;
6702 #[derive(Clone, Debug, PartialEq)]
6703 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6704}
6705
6706impl RaiFilterType {
6707 /// Gets the enum value.
6708 ///
6709 /// Returns `None` if the enum contains an unknown value deserialized from
6710 /// the string representation of enums.
6711 pub fn value(&self) -> std::option::Option<i32> {
6712 match self {
6713 Self::Unspecified => std::option::Option::Some(0),
6714 Self::SexuallyExplicit => std::option::Option::Some(2),
6715 Self::HateSpeech => std::option::Option::Some(3),
6716 Self::Harassment => std::option::Option::Some(6),
6717 Self::Dangerous => std::option::Option::Some(17),
6718 Self::UnknownValue(u) => u.0.value(),
6719 }
6720 }
6721
6722 /// Gets the enum value as a string.
6723 ///
6724 /// Returns `None` if the enum contains an unknown value deserialized from
6725 /// the integer representation of enums.
6726 pub fn name(&self) -> std::option::Option<&str> {
6727 match self {
6728 Self::Unspecified => std::option::Option::Some("RAI_FILTER_TYPE_UNSPECIFIED"),
6729 Self::SexuallyExplicit => std::option::Option::Some("SEXUALLY_EXPLICIT"),
6730 Self::HateSpeech => std::option::Option::Some("HATE_SPEECH"),
6731 Self::Harassment => std::option::Option::Some("HARASSMENT"),
6732 Self::Dangerous => std::option::Option::Some("DANGEROUS"),
6733 Self::UnknownValue(u) => u.0.name(),
6734 }
6735 }
6736}
6737
6738impl std::default::Default for RaiFilterType {
6739 fn default() -> Self {
6740 use std::convert::From;
6741 Self::from(0)
6742 }
6743}
6744
6745impl std::fmt::Display for RaiFilterType {
6746 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6747 wkt::internal::display_enum(f, self.name(), self.value())
6748 }
6749}
6750
6751impl std::convert::From<i32> for RaiFilterType {
6752 fn from(value: i32) -> Self {
6753 match value {
6754 0 => Self::Unspecified,
6755 2 => Self::SexuallyExplicit,
6756 3 => Self::HateSpeech,
6757 6 => Self::Harassment,
6758 17 => Self::Dangerous,
6759 _ => Self::UnknownValue(rai_filter_type::UnknownValue(
6760 wkt::internal::UnknownEnumValue::Integer(value),
6761 )),
6762 }
6763 }
6764}
6765
6766impl std::convert::From<&str> for RaiFilterType {
6767 fn from(value: &str) -> Self {
6768 use std::string::ToString;
6769 match value {
6770 "RAI_FILTER_TYPE_UNSPECIFIED" => Self::Unspecified,
6771 "SEXUALLY_EXPLICIT" => Self::SexuallyExplicit,
6772 "HATE_SPEECH" => Self::HateSpeech,
6773 "HARASSMENT" => Self::Harassment,
6774 "DANGEROUS" => Self::Dangerous,
6775 _ => Self::UnknownValue(rai_filter_type::UnknownValue(
6776 wkt::internal::UnknownEnumValue::String(value.to_string()),
6777 )),
6778 }
6779 }
6780}
6781
6782impl serde::ser::Serialize for RaiFilterType {
6783 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6784 where
6785 S: serde::Serializer,
6786 {
6787 match self {
6788 Self::Unspecified => serializer.serialize_i32(0),
6789 Self::SexuallyExplicit => serializer.serialize_i32(2),
6790 Self::HateSpeech => serializer.serialize_i32(3),
6791 Self::Harassment => serializer.serialize_i32(6),
6792 Self::Dangerous => serializer.serialize_i32(17),
6793 Self::UnknownValue(u) => u.0.serialize(serializer),
6794 }
6795 }
6796}
6797
6798impl<'de> serde::de::Deserialize<'de> for RaiFilterType {
6799 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6800 where
6801 D: serde::Deserializer<'de>,
6802 {
6803 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RaiFilterType>::new(
6804 ".google.cloud.modelarmor.v1.RaiFilterType",
6805 ))
6806 }
6807}
6808
6809/// Confidence levels for detectors.
6810/// Higher value maps to a greater confidence level. To enforce stricter level a
6811/// lower value should be used.
6812///
6813/// # Working with unknown values
6814///
6815/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6816/// additional enum variants at any time. Adding new variants is not considered
6817/// a breaking change. Applications should write their code in anticipation of:
6818///
6819/// - New values appearing in future releases of the client library, **and**
6820/// - New values received dynamically, without application changes.
6821///
6822/// Please consult the [Working with enums] section in the user guide for some
6823/// guidelines.
6824///
6825/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6826#[derive(Clone, Debug, PartialEq)]
6827#[non_exhaustive]
6828pub enum DetectionConfidenceLevel {
6829 /// Same as LOW_AND_ABOVE.
6830 Unspecified,
6831 /// Highest chance of a false positive.
6832 LowAndAbove,
6833 /// Some chance of false positives.
6834 MediumAndAbove,
6835 /// Low chance of false positives.
6836 High,
6837 /// If set, the enum was initialized with an unknown value.
6838 ///
6839 /// Applications can examine the value using [DetectionConfidenceLevel::value] or
6840 /// [DetectionConfidenceLevel::name].
6841 UnknownValue(detection_confidence_level::UnknownValue),
6842}
6843
6844#[doc(hidden)]
6845pub mod detection_confidence_level {
6846 #[allow(unused_imports)]
6847 use super::*;
6848 #[derive(Clone, Debug, PartialEq)]
6849 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6850}
6851
6852impl DetectionConfidenceLevel {
6853 /// Gets the enum value.
6854 ///
6855 /// Returns `None` if the enum contains an unknown value deserialized from
6856 /// the string representation of enums.
6857 pub fn value(&self) -> std::option::Option<i32> {
6858 match self {
6859 Self::Unspecified => std::option::Option::Some(0),
6860 Self::LowAndAbove => std::option::Option::Some(1),
6861 Self::MediumAndAbove => std::option::Option::Some(2),
6862 Self::High => std::option::Option::Some(3),
6863 Self::UnknownValue(u) => u.0.value(),
6864 }
6865 }
6866
6867 /// Gets the enum value as a string.
6868 ///
6869 /// Returns `None` if the enum contains an unknown value deserialized from
6870 /// the integer representation of enums.
6871 pub fn name(&self) -> std::option::Option<&str> {
6872 match self {
6873 Self::Unspecified => {
6874 std::option::Option::Some("DETECTION_CONFIDENCE_LEVEL_UNSPECIFIED")
6875 }
6876 Self::LowAndAbove => std::option::Option::Some("LOW_AND_ABOVE"),
6877 Self::MediumAndAbove => std::option::Option::Some("MEDIUM_AND_ABOVE"),
6878 Self::High => std::option::Option::Some("HIGH"),
6879 Self::UnknownValue(u) => u.0.name(),
6880 }
6881 }
6882}
6883
6884impl std::default::Default for DetectionConfidenceLevel {
6885 fn default() -> Self {
6886 use std::convert::From;
6887 Self::from(0)
6888 }
6889}
6890
6891impl std::fmt::Display for DetectionConfidenceLevel {
6892 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6893 wkt::internal::display_enum(f, self.name(), self.value())
6894 }
6895}
6896
6897impl std::convert::From<i32> for DetectionConfidenceLevel {
6898 fn from(value: i32) -> Self {
6899 match value {
6900 0 => Self::Unspecified,
6901 1 => Self::LowAndAbove,
6902 2 => Self::MediumAndAbove,
6903 3 => Self::High,
6904 _ => Self::UnknownValue(detection_confidence_level::UnknownValue(
6905 wkt::internal::UnknownEnumValue::Integer(value),
6906 )),
6907 }
6908 }
6909}
6910
6911impl std::convert::From<&str> for DetectionConfidenceLevel {
6912 fn from(value: &str) -> Self {
6913 use std::string::ToString;
6914 match value {
6915 "DETECTION_CONFIDENCE_LEVEL_UNSPECIFIED" => Self::Unspecified,
6916 "LOW_AND_ABOVE" => Self::LowAndAbove,
6917 "MEDIUM_AND_ABOVE" => Self::MediumAndAbove,
6918 "HIGH" => Self::High,
6919 _ => Self::UnknownValue(detection_confidence_level::UnknownValue(
6920 wkt::internal::UnknownEnumValue::String(value.to_string()),
6921 )),
6922 }
6923 }
6924}
6925
6926impl serde::ser::Serialize for DetectionConfidenceLevel {
6927 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6928 where
6929 S: serde::Serializer,
6930 {
6931 match self {
6932 Self::Unspecified => serializer.serialize_i32(0),
6933 Self::LowAndAbove => serializer.serialize_i32(1),
6934 Self::MediumAndAbove => serializer.serialize_i32(2),
6935 Self::High => serializer.serialize_i32(3),
6936 Self::UnknownValue(u) => u.0.serialize(serializer),
6937 }
6938 }
6939}
6940
6941impl<'de> serde::de::Deserialize<'de> for DetectionConfidenceLevel {
6942 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6943 where
6944 D: serde::Deserializer<'de>,
6945 {
6946 deserializer.deserialize_any(wkt::internal::EnumVisitor::<DetectionConfidenceLevel>::new(
6947 ".google.cloud.modelarmor.v1.DetectionConfidenceLevel",
6948 ))
6949 }
6950}
6951
6952/// For more information about each Sensitive Data Protection likelihood level,
6953/// see <https://cloud.google.com/sensitive-data-protection/docs/likelihood>.
6954///
6955/// # Working with unknown values
6956///
6957/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6958/// additional enum variants at any time. Adding new variants is not considered
6959/// a breaking change. Applications should write their code in anticipation of:
6960///
6961/// - New values appearing in future releases of the client library, **and**
6962/// - New values received dynamically, without application changes.
6963///
6964/// Please consult the [Working with enums] section in the user guide for some
6965/// guidelines.
6966///
6967/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6968#[derive(Clone, Debug, PartialEq)]
6969#[non_exhaustive]
6970pub enum SdpFindingLikelihood {
6971 /// Default value; same as POSSIBLE.
6972 Unspecified,
6973 /// Highest chance of a false positive.
6974 VeryUnlikely,
6975 /// High chance of a false positive.
6976 Unlikely,
6977 /// Some matching signals. The default value.
6978 Possible,
6979 /// Low chance of a false positive.
6980 Likely,
6981 /// Confidence level is high. Lowest chance of a false positive.
6982 VeryLikely,
6983 /// If set, the enum was initialized with an unknown value.
6984 ///
6985 /// Applications can examine the value using [SdpFindingLikelihood::value] or
6986 /// [SdpFindingLikelihood::name].
6987 UnknownValue(sdp_finding_likelihood::UnknownValue),
6988}
6989
6990#[doc(hidden)]
6991pub mod sdp_finding_likelihood {
6992 #[allow(unused_imports)]
6993 use super::*;
6994 #[derive(Clone, Debug, PartialEq)]
6995 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6996}
6997
6998impl SdpFindingLikelihood {
6999 /// Gets the enum value.
7000 ///
7001 /// Returns `None` if the enum contains an unknown value deserialized from
7002 /// the string representation of enums.
7003 pub fn value(&self) -> std::option::Option<i32> {
7004 match self {
7005 Self::Unspecified => std::option::Option::Some(0),
7006 Self::VeryUnlikely => std::option::Option::Some(1),
7007 Self::Unlikely => std::option::Option::Some(2),
7008 Self::Possible => std::option::Option::Some(3),
7009 Self::Likely => std::option::Option::Some(4),
7010 Self::VeryLikely => std::option::Option::Some(5),
7011 Self::UnknownValue(u) => u.0.value(),
7012 }
7013 }
7014
7015 /// Gets the enum value as a string.
7016 ///
7017 /// Returns `None` if the enum contains an unknown value deserialized from
7018 /// the integer representation of enums.
7019 pub fn name(&self) -> std::option::Option<&str> {
7020 match self {
7021 Self::Unspecified => std::option::Option::Some("SDP_FINDING_LIKELIHOOD_UNSPECIFIED"),
7022 Self::VeryUnlikely => std::option::Option::Some("VERY_UNLIKELY"),
7023 Self::Unlikely => std::option::Option::Some("UNLIKELY"),
7024 Self::Possible => std::option::Option::Some("POSSIBLE"),
7025 Self::Likely => std::option::Option::Some("LIKELY"),
7026 Self::VeryLikely => std::option::Option::Some("VERY_LIKELY"),
7027 Self::UnknownValue(u) => u.0.name(),
7028 }
7029 }
7030}
7031
7032impl std::default::Default for SdpFindingLikelihood {
7033 fn default() -> Self {
7034 use std::convert::From;
7035 Self::from(0)
7036 }
7037}
7038
7039impl std::fmt::Display for SdpFindingLikelihood {
7040 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7041 wkt::internal::display_enum(f, self.name(), self.value())
7042 }
7043}
7044
7045impl std::convert::From<i32> for SdpFindingLikelihood {
7046 fn from(value: i32) -> Self {
7047 match value {
7048 0 => Self::Unspecified,
7049 1 => Self::VeryUnlikely,
7050 2 => Self::Unlikely,
7051 3 => Self::Possible,
7052 4 => Self::Likely,
7053 5 => Self::VeryLikely,
7054 _ => Self::UnknownValue(sdp_finding_likelihood::UnknownValue(
7055 wkt::internal::UnknownEnumValue::Integer(value),
7056 )),
7057 }
7058 }
7059}
7060
7061impl std::convert::From<&str> for SdpFindingLikelihood {
7062 fn from(value: &str) -> Self {
7063 use std::string::ToString;
7064 match value {
7065 "SDP_FINDING_LIKELIHOOD_UNSPECIFIED" => Self::Unspecified,
7066 "VERY_UNLIKELY" => Self::VeryUnlikely,
7067 "UNLIKELY" => Self::Unlikely,
7068 "POSSIBLE" => Self::Possible,
7069 "LIKELY" => Self::Likely,
7070 "VERY_LIKELY" => Self::VeryLikely,
7071 _ => Self::UnknownValue(sdp_finding_likelihood::UnknownValue(
7072 wkt::internal::UnknownEnumValue::String(value.to_string()),
7073 )),
7074 }
7075 }
7076}
7077
7078impl serde::ser::Serialize for SdpFindingLikelihood {
7079 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7080 where
7081 S: serde::Serializer,
7082 {
7083 match self {
7084 Self::Unspecified => serializer.serialize_i32(0),
7085 Self::VeryUnlikely => serializer.serialize_i32(1),
7086 Self::Unlikely => serializer.serialize_i32(2),
7087 Self::Possible => serializer.serialize_i32(3),
7088 Self::Likely => serializer.serialize_i32(4),
7089 Self::VeryLikely => serializer.serialize_i32(5),
7090 Self::UnknownValue(u) => u.0.serialize(serializer),
7091 }
7092 }
7093}
7094
7095impl<'de> serde::de::Deserialize<'de> for SdpFindingLikelihood {
7096 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7097 where
7098 D: serde::Deserializer<'de>,
7099 {
7100 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SdpFindingLikelihood>::new(
7101 ".google.cloud.modelarmor.v1.SdpFindingLikelihood",
7102 ))
7103 }
7104}
7105
7106/// A field indicating the outcome of the invocation, irrespective of match
7107/// status.
7108///
7109/// # Working with unknown values
7110///
7111/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7112/// additional enum variants at any time. Adding new variants is not considered
7113/// a breaking change. Applications should write their code in anticipation of:
7114///
7115/// - New values appearing in future releases of the client library, **and**
7116/// - New values received dynamically, without application changes.
7117///
7118/// Please consult the [Working with enums] section in the user guide for some
7119/// guidelines.
7120///
7121/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7122#[derive(Clone, Debug, PartialEq)]
7123#[non_exhaustive]
7124pub enum InvocationResult {
7125 /// Unused. Default value.
7126 Unspecified,
7127 /// All filters were invoked successfully.
7128 Success,
7129 /// Some filters were skipped or failed.
7130 Partial,
7131 /// All filters were skipped or failed.
7132 Failure,
7133 /// If set, the enum was initialized with an unknown value.
7134 ///
7135 /// Applications can examine the value using [InvocationResult::value] or
7136 /// [InvocationResult::name].
7137 UnknownValue(invocation_result::UnknownValue),
7138}
7139
7140#[doc(hidden)]
7141pub mod invocation_result {
7142 #[allow(unused_imports)]
7143 use super::*;
7144 #[derive(Clone, Debug, PartialEq)]
7145 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7146}
7147
7148impl InvocationResult {
7149 /// Gets the enum value.
7150 ///
7151 /// Returns `None` if the enum contains an unknown value deserialized from
7152 /// the string representation of enums.
7153 pub fn value(&self) -> std::option::Option<i32> {
7154 match self {
7155 Self::Unspecified => std::option::Option::Some(0),
7156 Self::Success => std::option::Option::Some(1),
7157 Self::Partial => std::option::Option::Some(2),
7158 Self::Failure => std::option::Option::Some(3),
7159 Self::UnknownValue(u) => u.0.value(),
7160 }
7161 }
7162
7163 /// Gets the enum value as a string.
7164 ///
7165 /// Returns `None` if the enum contains an unknown value deserialized from
7166 /// the integer representation of enums.
7167 pub fn name(&self) -> std::option::Option<&str> {
7168 match self {
7169 Self::Unspecified => std::option::Option::Some("INVOCATION_RESULT_UNSPECIFIED"),
7170 Self::Success => std::option::Option::Some("SUCCESS"),
7171 Self::Partial => std::option::Option::Some("PARTIAL"),
7172 Self::Failure => std::option::Option::Some("FAILURE"),
7173 Self::UnknownValue(u) => u.0.name(),
7174 }
7175 }
7176}
7177
7178impl std::default::Default for InvocationResult {
7179 fn default() -> Self {
7180 use std::convert::From;
7181 Self::from(0)
7182 }
7183}
7184
7185impl std::fmt::Display for InvocationResult {
7186 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7187 wkt::internal::display_enum(f, self.name(), self.value())
7188 }
7189}
7190
7191impl std::convert::From<i32> for InvocationResult {
7192 fn from(value: i32) -> Self {
7193 match value {
7194 0 => Self::Unspecified,
7195 1 => Self::Success,
7196 2 => Self::Partial,
7197 3 => Self::Failure,
7198 _ => Self::UnknownValue(invocation_result::UnknownValue(
7199 wkt::internal::UnknownEnumValue::Integer(value),
7200 )),
7201 }
7202 }
7203}
7204
7205impl std::convert::From<&str> for InvocationResult {
7206 fn from(value: &str) -> Self {
7207 use std::string::ToString;
7208 match value {
7209 "INVOCATION_RESULT_UNSPECIFIED" => Self::Unspecified,
7210 "SUCCESS" => Self::Success,
7211 "PARTIAL" => Self::Partial,
7212 "FAILURE" => Self::Failure,
7213 _ => Self::UnknownValue(invocation_result::UnknownValue(
7214 wkt::internal::UnknownEnumValue::String(value.to_string()),
7215 )),
7216 }
7217 }
7218}
7219
7220impl serde::ser::Serialize for InvocationResult {
7221 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7222 where
7223 S: serde::Serializer,
7224 {
7225 match self {
7226 Self::Unspecified => serializer.serialize_i32(0),
7227 Self::Success => serializer.serialize_i32(1),
7228 Self::Partial => serializer.serialize_i32(2),
7229 Self::Failure => serializer.serialize_i32(3),
7230 Self::UnknownValue(u) => u.0.serialize(serializer),
7231 }
7232 }
7233}
7234
7235impl<'de> serde::de::Deserialize<'de> for InvocationResult {
7236 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7237 where
7238 D: serde::Deserializer<'de>,
7239 {
7240 deserializer.deserialize_any(wkt::internal::EnumVisitor::<InvocationResult>::new(
7241 ".google.cloud.modelarmor.v1.InvocationResult",
7242 ))
7243 }
7244}