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