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