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