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