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