#![allow(rustdoc::bare_urls)]
#![allow(rustdoc::broken_intra_doc_links)]
#![allow(rustdoc::invalid_html_tags)]
#![allow(rustdoc::redundant_explicit_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gaxi;
extern crate google_cloud_gax;
extern crate google_cloud_location;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;
mod debug;
mod deserialize;
mod serialize;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Template {
pub name: std::string::String,
pub create_time: std::option::Option<wkt::Timestamp>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub labels: std::collections::HashMap<std::string::String, std::string::String>,
pub filter_config: std::option::Option<crate::model::FilterConfig>,
pub template_metadata: std::option::Option<crate::model::template::TemplateMetadata>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Template {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = v.map(|x| x.into());
self
}
pub fn set_labels<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_filter_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::FilterConfig>,
{
self.filter_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_filter_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::FilterConfig>,
{
self.filter_config = v.map(|x| x.into());
self
}
pub fn set_template_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::template::TemplateMetadata>,
{
self.template_metadata = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_template_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::template::TemplateMetadata>,
{
self.template_metadata = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Template {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.Template"
}
}
pub mod template {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TemplateMetadata {
pub ignore_partial_invocation_failures: bool,
pub custom_prompt_safety_error_code: i32,
pub custom_prompt_safety_error_message: std::string::String,
pub custom_llm_response_safety_error_code: i32,
pub custom_llm_response_safety_error_message: std::string::String,
pub log_template_operations: bool,
pub log_sanitize_operations: bool,
pub enforcement_type: crate::model::template::template_metadata::EnforcementType,
pub multi_language_detection:
std::option::Option<crate::model::template::template_metadata::MultiLanguageDetection>,
pub modalities: std::vec::Vec<crate::model::Modality>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TemplateMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_ignore_partial_invocation_failures<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.ignore_partial_invocation_failures = v.into();
self
}
pub fn set_custom_prompt_safety_error_code<T: std::convert::Into<i32>>(
mut self,
v: T,
) -> Self {
self.custom_prompt_safety_error_code = v.into();
self
}
pub fn set_custom_prompt_safety_error_message<
T: std::convert::Into<std::string::String>,
>(
mut self,
v: T,
) -> Self {
self.custom_prompt_safety_error_message = v.into();
self
}
pub fn set_custom_llm_response_safety_error_code<T: std::convert::Into<i32>>(
mut self,
v: T,
) -> Self {
self.custom_llm_response_safety_error_code = v.into();
self
}
pub fn set_custom_llm_response_safety_error_message<
T: std::convert::Into<std::string::String>,
>(
mut self,
v: T,
) -> Self {
self.custom_llm_response_safety_error_message = v.into();
self
}
pub fn set_log_template_operations<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.log_template_operations = v.into();
self
}
pub fn set_log_sanitize_operations<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.log_sanitize_operations = v.into();
self
}
pub fn set_enforcement_type<
T: std::convert::Into<crate::model::template::template_metadata::EnforcementType>,
>(
mut self,
v: T,
) -> Self {
self.enforcement_type = v.into();
self
}
pub fn set_multi_language_detection<T>(mut self, v: T) -> Self
where
T: std::convert::Into<
crate::model::template::template_metadata::MultiLanguageDetection,
>,
{
self.multi_language_detection = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_multi_language_detection<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<
crate::model::template::template_metadata::MultiLanguageDetection,
>,
{
self.multi_language_detection = v.map(|x| x.into());
self
}
pub fn set_modalities<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Modality>,
{
use std::iter::Iterator;
self.modalities = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for TemplateMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.Template.TemplateMetadata"
}
}
pub mod template_metadata {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MultiLanguageDetection {
pub enable_multi_language_detection: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MultiLanguageDetection {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_enable_multi_language_detection<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.enable_multi_language_detection = v.into();
self
}
}
impl wkt::message::Message for MultiLanguageDetection {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.Template.TemplateMetadata.MultiLanguageDetection"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum EnforcementType {
Unspecified,
InspectOnly,
InspectAndBlock,
UnknownValue(enforcement_type::UnknownValue),
}
#[doc(hidden)]
pub mod enforcement_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl EnforcementType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::InspectOnly => std::option::Option::Some(1),
Self::InspectAndBlock => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ENFORCEMENT_TYPE_UNSPECIFIED"),
Self::InspectOnly => std::option::Option::Some("INSPECT_ONLY"),
Self::InspectAndBlock => std::option::Option::Some("INSPECT_AND_BLOCK"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for EnforcementType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for EnforcementType {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for EnforcementType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::InspectOnly,
2 => Self::InspectAndBlock,
_ => Self::UnknownValue(enforcement_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for EnforcementType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ENFORCEMENT_TYPE_UNSPECIFIED" => Self::Unspecified,
"INSPECT_ONLY" => Self::InspectOnly,
"INSPECT_AND_BLOCK" => Self::InspectAndBlock,
_ => Self::UnknownValue(enforcement_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for EnforcementType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::InspectOnly => serializer.serialize_i32(1),
Self::InspectAndBlock => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for EnforcementType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<EnforcementType>::new(
".google.cloud.modelarmor.v1.Template.TemplateMetadata.EnforcementType",
))
}
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FloorSetting {
pub name: std::string::String,
pub create_time: std::option::Option<wkt::Timestamp>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub filter_config: std::option::Option<crate::model::FilterConfig>,
pub enable_floor_setting_enforcement: std::option::Option<bool>,
pub integrated_services: std::vec::Vec<crate::model::floor_setting::IntegratedService>,
pub ai_platform_floor_setting: std::option::Option<crate::model::AiPlatformFloorSetting>,
pub floor_setting_metadata:
std::option::Option<crate::model::floor_setting::FloorSettingMetadata>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FloorSetting {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = v.map(|x| x.into());
self
}
pub fn set_filter_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::FilterConfig>,
{
self.filter_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_filter_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::FilterConfig>,
{
self.filter_config = v.map(|x| x.into());
self
}
pub fn set_enable_floor_setting_enforcement<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.enable_floor_setting_enforcement = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_enable_floor_setting_enforcement<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<bool>,
{
self.enable_floor_setting_enforcement = v.map(|x| x.into());
self
}
pub fn set_integrated_services<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::floor_setting::IntegratedService>,
{
use std::iter::Iterator;
self.integrated_services = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_ai_platform_floor_setting<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AiPlatformFloorSetting>,
{
self.ai_platform_floor_setting = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_ai_platform_floor_setting<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AiPlatformFloorSetting>,
{
self.ai_platform_floor_setting = v.map(|x| x.into());
self
}
pub fn set_floor_setting_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::floor_setting::FloorSettingMetadata>,
{
self.floor_setting_metadata = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_floor_setting_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::floor_setting::FloorSettingMetadata>,
{
self.floor_setting_metadata = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for FloorSetting {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.FloorSetting"
}
}
pub mod floor_setting {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FloorSettingMetadata {
pub multi_language_detection: std::option::Option<
crate::model::floor_setting::floor_setting_metadata::MultiLanguageDetection,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FloorSettingMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_multi_language_detection<T>(mut self, v: T) -> Self
where
T: std::convert::Into<
crate::model::floor_setting::floor_setting_metadata::MultiLanguageDetection,
>,
{
self.multi_language_detection = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_multi_language_detection<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<
crate::model::floor_setting::floor_setting_metadata::MultiLanguageDetection,
>,
{
self.multi_language_detection = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for FloorSettingMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.FloorSetting.FloorSettingMetadata"
}
}
pub mod floor_setting_metadata {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MultiLanguageDetection {
pub enable_multi_language_detection: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MultiLanguageDetection {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_enable_multi_language_detection<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.enable_multi_language_detection = v.into();
self
}
}
impl wkt::message::Message for MultiLanguageDetection {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.FloorSetting.FloorSettingMetadata.MultiLanguageDetection"
}
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum IntegratedService {
Unspecified,
AiPlatform,
UnknownValue(integrated_service::UnknownValue),
}
#[doc(hidden)]
pub mod integrated_service {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl IntegratedService {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::AiPlatform => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("INTEGRATED_SERVICE_UNSPECIFIED"),
Self::AiPlatform => std::option::Option::Some("AI_PLATFORM"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for IntegratedService {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for IntegratedService {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for IntegratedService {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::AiPlatform,
_ => Self::UnknownValue(integrated_service::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for IntegratedService {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"INTEGRATED_SERVICE_UNSPECIFIED" => Self::Unspecified,
"AI_PLATFORM" => Self::AiPlatform,
_ => Self::UnknownValue(integrated_service::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for IntegratedService {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::AiPlatform => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for IntegratedService {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<IntegratedService>::new(
".google.cloud.modelarmor.v1.FloorSetting.IntegratedService",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AiPlatformFloorSetting {
pub enable_cloud_logging: bool,
pub enforcement_type:
std::option::Option<crate::model::ai_platform_floor_setting::EnforcementType>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AiPlatformFloorSetting {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_enable_cloud_logging<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_cloud_logging = v.into();
self
}
pub fn set_enforcement_type<
T: std::convert::Into<
std::option::Option<crate::model::ai_platform_floor_setting::EnforcementType>,
>,
>(
mut self,
v: T,
) -> Self {
self.enforcement_type = v.into();
self
}
pub fn inspect_only(&self) -> std::option::Option<&bool> {
#[allow(unreachable_patterns)]
self.enforcement_type.as_ref().and_then(|v| match v {
crate::model::ai_platform_floor_setting::EnforcementType::InspectOnly(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_inspect_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enforcement_type = std::option::Option::Some(
crate::model::ai_platform_floor_setting::EnforcementType::InspectOnly(v.into()),
);
self
}
pub fn inspect_and_block(&self) -> std::option::Option<&bool> {
#[allow(unreachable_patterns)]
self.enforcement_type.as_ref().and_then(|v| match v {
crate::model::ai_platform_floor_setting::EnforcementType::InspectAndBlock(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_inspect_and_block<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enforcement_type = std::option::Option::Some(
crate::model::ai_platform_floor_setting::EnforcementType::InspectAndBlock(v.into()),
);
self
}
}
impl wkt::message::Message for AiPlatformFloorSetting {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.AiPlatformFloorSetting"
}
}
pub mod ai_platform_floor_setting {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum EnforcementType {
InspectOnly(bool),
InspectAndBlock(bool),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListTemplatesRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub filter: std::string::String,
pub order_by: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListTemplatesRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.order_by = v.into();
self
}
}
impl wkt::message::Message for ListTemplatesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.ListTemplatesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListTemplatesResponse {
pub templates: std::vec::Vec<crate::model::Template>,
pub next_page_token: std::string::String,
pub unreachable: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListTemplatesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_templates<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Template>,
{
use std::iter::Iterator;
self.templates = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
pub fn set_unreachable<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.unreachable = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ListTemplatesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.ListTemplatesResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListTemplatesResponse {
type PageItem = crate::model::Template;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.templates
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetTemplateRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetTemplateRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetTemplateRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.GetTemplateRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateTemplateRequest {
pub parent: std::string::String,
pub template_id: std::string::String,
pub template: std::option::Option<crate::model::Template>,
pub request_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateTemplateRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_template_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.template_id = v.into();
self
}
pub fn set_template<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Template>,
{
self.template = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Template>,
{
self.template = v.map(|x| x.into());
self
}
pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.request_id = v.into();
self
}
}
impl wkt::message::Message for CreateTemplateRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.CreateTemplateRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateTemplateRequest {
pub update_mask: std::option::Option<wkt::FieldMask>,
pub template: std::option::Option<crate::model::Template>,
pub request_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateTemplateRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
pub fn set_template<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Template>,
{
self.template = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_template<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Template>,
{
self.template = v.map(|x| x.into());
self
}
pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.request_id = v.into();
self
}
}
impl wkt::message::Message for UpdateTemplateRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.UpdateTemplateRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteTemplateRequest {
pub name: std::string::String,
pub request_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteTemplateRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.request_id = v.into();
self
}
}
impl wkt::message::Message for DeleteTemplateRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.DeleteTemplateRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetFloorSettingRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetFloorSettingRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetFloorSettingRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.GetFloorSettingRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateFloorSettingRequest {
pub floor_setting: std::option::Option<crate::model::FloorSetting>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateFloorSettingRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_floor_setting<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::FloorSetting>,
{
self.floor_setting = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_floor_setting<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::FloorSetting>,
{
self.floor_setting = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateFloorSettingRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.UpdateFloorSettingRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FilterConfig {
pub rai_settings: std::option::Option<crate::model::RaiFilterSettings>,
pub sdp_settings: std::option::Option<crate::model::SdpFilterSettings>,
pub pi_and_jailbreak_filter_settings:
std::option::Option<crate::model::PiAndJailbreakFilterSettings>,
pub malicious_uri_filter_settings:
std::option::Option<crate::model::MaliciousUriFilterSettings>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FilterConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_rai_settings<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RaiFilterSettings>,
{
self.rai_settings = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_rai_settings<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RaiFilterSettings>,
{
self.rai_settings = v.map(|x| x.into());
self
}
pub fn set_sdp_settings<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SdpFilterSettings>,
{
self.sdp_settings = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_sdp_settings<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SdpFilterSettings>,
{
self.sdp_settings = v.map(|x| x.into());
self
}
pub fn set_pi_and_jailbreak_filter_settings<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::PiAndJailbreakFilterSettings>,
{
self.pi_and_jailbreak_filter_settings = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_pi_and_jailbreak_filter_settings<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::PiAndJailbreakFilterSettings>,
{
self.pi_and_jailbreak_filter_settings = v.map(|x| x.into());
self
}
pub fn set_malicious_uri_filter_settings<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MaliciousUriFilterSettings>,
{
self.malicious_uri_filter_settings = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_malicious_uri_filter_settings<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::MaliciousUriFilterSettings>,
{
self.malicious_uri_filter_settings = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for FilterConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.FilterConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PiAndJailbreakFilterSettings {
pub filter_enforcement:
crate::model::pi_and_jailbreak_filter_settings::PiAndJailbreakFilterEnforcement,
pub confidence_level: crate::model::DetectionConfidenceLevel,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PiAndJailbreakFilterSettings {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_filter_enforcement<
T: std::convert::Into<
crate::model::pi_and_jailbreak_filter_settings::PiAndJailbreakFilterEnforcement,
>,
>(
mut self,
v: T,
) -> Self {
self.filter_enforcement = v.into();
self
}
pub fn set_confidence_level<T: std::convert::Into<crate::model::DetectionConfidenceLevel>>(
mut self,
v: T,
) -> Self {
self.confidence_level = v.into();
self
}
}
impl wkt::message::Message for PiAndJailbreakFilterSettings {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.PiAndJailbreakFilterSettings"
}
}
pub mod pi_and_jailbreak_filter_settings {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum PiAndJailbreakFilterEnforcement {
Unspecified,
Enabled,
Disabled,
UnknownValue(pi_and_jailbreak_filter_enforcement::UnknownValue),
}
#[doc(hidden)]
pub mod pi_and_jailbreak_filter_enforcement {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl PiAndJailbreakFilterEnforcement {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Enabled => std::option::Option::Some(1),
Self::Disabled => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("PI_AND_JAILBREAK_FILTER_ENFORCEMENT_UNSPECIFIED")
}
Self::Enabled => std::option::Option::Some("ENABLED"),
Self::Disabled => std::option::Option::Some("DISABLED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for PiAndJailbreakFilterEnforcement {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for PiAndJailbreakFilterEnforcement {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for PiAndJailbreakFilterEnforcement {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Enabled,
2 => Self::Disabled,
_ => Self::UnknownValue(pi_and_jailbreak_filter_enforcement::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for PiAndJailbreakFilterEnforcement {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"PI_AND_JAILBREAK_FILTER_ENFORCEMENT_UNSPECIFIED" => Self::Unspecified,
"ENABLED" => Self::Enabled,
"DISABLED" => Self::Disabled,
_ => Self::UnknownValue(pi_and_jailbreak_filter_enforcement::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for PiAndJailbreakFilterEnforcement {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Enabled => serializer.serialize_i32(1),
Self::Disabled => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for PiAndJailbreakFilterEnforcement {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<PiAndJailbreakFilterEnforcement>::new(
".google.cloud.modelarmor.v1.PiAndJailbreakFilterSettings.PiAndJailbreakFilterEnforcement"))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MaliciousUriFilterSettings {
pub filter_enforcement:
crate::model::malicious_uri_filter_settings::MaliciousUriFilterEnforcement,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MaliciousUriFilterSettings {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_filter_enforcement<
T: std::convert::Into<
crate::model::malicious_uri_filter_settings::MaliciousUriFilterEnforcement,
>,
>(
mut self,
v: T,
) -> Self {
self.filter_enforcement = v.into();
self
}
}
impl wkt::message::Message for MaliciousUriFilterSettings {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.MaliciousUriFilterSettings"
}
}
pub mod malicious_uri_filter_settings {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum MaliciousUriFilterEnforcement {
Unspecified,
Enabled,
Disabled,
UnknownValue(malicious_uri_filter_enforcement::UnknownValue),
}
#[doc(hidden)]
pub mod malicious_uri_filter_enforcement {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl MaliciousUriFilterEnforcement {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Enabled => std::option::Option::Some(1),
Self::Disabled => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("MALICIOUS_URI_FILTER_ENFORCEMENT_UNSPECIFIED")
}
Self::Enabled => std::option::Option::Some("ENABLED"),
Self::Disabled => std::option::Option::Some("DISABLED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for MaliciousUriFilterEnforcement {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for MaliciousUriFilterEnforcement {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for MaliciousUriFilterEnforcement {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Enabled,
2 => Self::Disabled,
_ => Self::UnknownValue(malicious_uri_filter_enforcement::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for MaliciousUriFilterEnforcement {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MALICIOUS_URI_FILTER_ENFORCEMENT_UNSPECIFIED" => Self::Unspecified,
"ENABLED" => Self::Enabled,
"DISABLED" => Self::Disabled,
_ => Self::UnknownValue(malicious_uri_filter_enforcement::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for MaliciousUriFilterEnforcement {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Enabled => serializer.serialize_i32(1),
Self::Disabled => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for MaliciousUriFilterEnforcement {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<MaliciousUriFilterEnforcement>::new(
".google.cloud.modelarmor.v1.MaliciousUriFilterSettings.MaliciousUriFilterEnforcement"))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RaiFilterSettings {
pub rai_filters: std::vec::Vec<crate::model::rai_filter_settings::RaiFilter>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RaiFilterSettings {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_rai_filters<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::rai_filter_settings::RaiFilter>,
{
use std::iter::Iterator;
self.rai_filters = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for RaiFilterSettings {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.RaiFilterSettings"
}
}
pub mod rai_filter_settings {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RaiFilter {
pub filter_type: crate::model::RaiFilterType,
pub confidence_level: crate::model::DetectionConfidenceLevel,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RaiFilter {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_filter_type<T: std::convert::Into<crate::model::RaiFilterType>>(
mut self,
v: T,
) -> Self {
self.filter_type = v.into();
self
}
pub fn set_confidence_level<
T: std::convert::Into<crate::model::DetectionConfidenceLevel>,
>(
mut self,
v: T,
) -> Self {
self.confidence_level = v.into();
self
}
}
impl wkt::message::Message for RaiFilter {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.RaiFilterSettings.RaiFilter"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SdpFilterSettings {
pub sdp_configuration: std::option::Option<crate::model::sdp_filter_settings::SdpConfiguration>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SdpFilterSettings {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_sdp_configuration<
T: std::convert::Into<
std::option::Option<crate::model::sdp_filter_settings::SdpConfiguration>,
>,
>(
mut self,
v: T,
) -> Self {
self.sdp_configuration = v.into();
self
}
pub fn basic_config(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SdpBasicConfig>> {
#[allow(unreachable_patterns)]
self.sdp_configuration.as_ref().and_then(|v| match v {
crate::model::sdp_filter_settings::SdpConfiguration::BasicConfig(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_basic_config<
T: std::convert::Into<std::boxed::Box<crate::model::SdpBasicConfig>>,
>(
mut self,
v: T,
) -> Self {
self.sdp_configuration = std::option::Option::Some(
crate::model::sdp_filter_settings::SdpConfiguration::BasicConfig(v.into()),
);
self
}
pub fn advanced_config(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SdpAdvancedConfig>> {
#[allow(unreachable_patterns)]
self.sdp_configuration.as_ref().and_then(|v| match v {
crate::model::sdp_filter_settings::SdpConfiguration::AdvancedConfig(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_advanced_config<
T: std::convert::Into<std::boxed::Box<crate::model::SdpAdvancedConfig>>,
>(
mut self,
v: T,
) -> Self {
self.sdp_configuration = std::option::Option::Some(
crate::model::sdp_filter_settings::SdpConfiguration::AdvancedConfig(v.into()),
);
self
}
}
impl wkt::message::Message for SdpFilterSettings {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.SdpFilterSettings"
}
}
pub mod sdp_filter_settings {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SdpConfiguration {
BasicConfig(std::boxed::Box<crate::model::SdpBasicConfig>),
AdvancedConfig(std::boxed::Box<crate::model::SdpAdvancedConfig>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SdpBasicConfig {
pub filter_enforcement: crate::model::sdp_basic_config::SdpBasicConfigEnforcement,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SdpBasicConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_filter_enforcement<
T: std::convert::Into<crate::model::sdp_basic_config::SdpBasicConfigEnforcement>,
>(
mut self,
v: T,
) -> Self {
self.filter_enforcement = v.into();
self
}
}
impl wkt::message::Message for SdpBasicConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.SdpBasicConfig"
}
}
pub mod sdp_basic_config {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SdpBasicConfigEnforcement {
Unspecified,
Enabled,
Disabled,
UnknownValue(sdp_basic_config_enforcement::UnknownValue),
}
#[doc(hidden)]
pub mod sdp_basic_config_enforcement {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl SdpBasicConfigEnforcement {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Enabled => std::option::Option::Some(1),
Self::Disabled => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("SDP_BASIC_CONFIG_ENFORCEMENT_UNSPECIFIED")
}
Self::Enabled => std::option::Option::Some("ENABLED"),
Self::Disabled => std::option::Option::Some("DISABLED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for SdpBasicConfigEnforcement {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for SdpBasicConfigEnforcement {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for SdpBasicConfigEnforcement {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Enabled,
2 => Self::Disabled,
_ => Self::UnknownValue(sdp_basic_config_enforcement::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for SdpBasicConfigEnforcement {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SDP_BASIC_CONFIG_ENFORCEMENT_UNSPECIFIED" => Self::Unspecified,
"ENABLED" => Self::Enabled,
"DISABLED" => Self::Disabled,
_ => Self::UnknownValue(sdp_basic_config_enforcement::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for SdpBasicConfigEnforcement {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Enabled => serializer.serialize_i32(1),
Self::Disabled => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for SdpBasicConfigEnforcement {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(
wkt::internal::EnumVisitor::<SdpBasicConfigEnforcement>::new(
".google.cloud.modelarmor.v1.SdpBasicConfig.SdpBasicConfigEnforcement",
),
)
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SdpAdvancedConfig {
pub inspect_template: std::string::String,
pub deidentify_template: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SdpAdvancedConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_inspect_template<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.inspect_template = v.into();
self
}
pub fn set_deidentify_template<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.deidentify_template = v.into();
self
}
}
impl wkt::message::Message for SdpAdvancedConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.SdpAdvancedConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SanitizeUserPromptRequest {
pub name: std::string::String,
pub user_prompt_data: std::option::Option<crate::model::DataItem>,
pub multi_language_detection_metadata:
std::option::Option<crate::model::MultiLanguageDetectionMetadata>,
pub streaming_mode: std::option::Option<crate::model::StreamingMode>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SanitizeUserPromptRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_user_prompt_data<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DataItem>,
{
self.user_prompt_data = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_user_prompt_data<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DataItem>,
{
self.user_prompt_data = v.map(|x| x.into());
self
}
pub fn set_multi_language_detection_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MultiLanguageDetectionMetadata>,
{
self.multi_language_detection_metadata = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_multi_language_detection_metadata<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::MultiLanguageDetectionMetadata>,
{
self.multi_language_detection_metadata = v.map(|x| x.into());
self
}
pub fn set_streaming_mode<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::StreamingMode>,
{
self.streaming_mode = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_streaming_mode<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::StreamingMode>,
{
self.streaming_mode = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SanitizeUserPromptRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.SanitizeUserPromptRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SanitizeModelResponseRequest {
pub name: std::string::String,
pub model_response_data: std::option::Option<crate::model::DataItem>,
pub user_prompt: std::string::String,
pub multi_language_detection_metadata:
std::option::Option<crate::model::MultiLanguageDetectionMetadata>,
pub streaming_mode: std::option::Option<crate::model::StreamingMode>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SanitizeModelResponseRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_model_response_data<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DataItem>,
{
self.model_response_data = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_model_response_data<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DataItem>,
{
self.model_response_data = v.map(|x| x.into());
self
}
pub fn set_user_prompt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.user_prompt = v.into();
self
}
pub fn set_multi_language_detection_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MultiLanguageDetectionMetadata>,
{
self.multi_language_detection_metadata = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_multi_language_detection_metadata<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::MultiLanguageDetectionMetadata>,
{
self.multi_language_detection_metadata = v.map(|x| x.into());
self
}
pub fn set_streaming_mode<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::StreamingMode>,
{
self.streaming_mode = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_streaming_mode<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::StreamingMode>,
{
self.streaming_mode = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SanitizeModelResponseRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.SanitizeModelResponseRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SanitizeUserPromptResponse {
pub sanitization_result: std::option::Option<crate::model::SanitizationResult>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SanitizeUserPromptResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_sanitization_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SanitizationResult>,
{
self.sanitization_result = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_sanitization_result<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SanitizationResult>,
{
self.sanitization_result = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SanitizeUserPromptResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.SanitizeUserPromptResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SanitizeModelResponseResponse {
pub sanitization_result: std::option::Option<crate::model::SanitizationResult>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SanitizeModelResponseResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_sanitization_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SanitizationResult>,
{
self.sanitization_result = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_sanitization_result<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SanitizationResult>,
{
self.sanitization_result = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SanitizeModelResponseResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.SanitizeModelResponseResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SanitizationResult {
pub filter_match_state: crate::model::FilterMatchState,
pub filter_results: std::collections::HashMap<std::string::String, crate::model::FilterResult>,
pub invocation_result: crate::model::InvocationResult,
pub sanitization_metadata:
std::option::Option<crate::model::sanitization_result::SanitizationMetadata>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SanitizationResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_filter_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
mut self,
v: T,
) -> Self {
self.filter_match_state = v.into();
self
}
pub fn set_filter_results<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::FilterResult>,
{
use std::iter::Iterator;
self.filter_results = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_invocation_result<T: std::convert::Into<crate::model::InvocationResult>>(
mut self,
v: T,
) -> Self {
self.invocation_result = v.into();
self
}
pub fn set_sanitization_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::sanitization_result::SanitizationMetadata>,
{
self.sanitization_metadata = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_sanitization_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::sanitization_result::SanitizationMetadata>,
{
self.sanitization_metadata = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SanitizationResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.SanitizationResult"
}
}
pub mod sanitization_result {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SanitizationMetadata {
pub error_code: i64,
pub error_message: std::string::String,
pub ignore_partial_invocation_failures: bool,
pub stream_chunk_processed: std::option::Option<crate::model::DataItem>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SanitizationMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_error_code<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.error_code = v.into();
self
}
pub fn set_error_message<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.error_message = v.into();
self
}
pub fn set_ignore_partial_invocation_failures<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.ignore_partial_invocation_failures = v.into();
self
}
pub fn set_stream_chunk_processed<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DataItem>,
{
self.stream_chunk_processed = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_stream_chunk_processed<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DataItem>,
{
self.stream_chunk_processed = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SanitizationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.SanitizationResult.SanitizationMetadata"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MultiLanguageDetectionMetadata {
pub source_language: std::string::String,
pub enable_multi_language_detection: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MultiLanguageDetectionMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_source_language<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.source_language = v.into();
self
}
pub fn set_enable_multi_language_detection<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.enable_multi_language_detection = v.into();
self
}
}
impl wkt::message::Message for MultiLanguageDetectionMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.MultiLanguageDetectionMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FilterResult {
pub filter_result: std::option::Option<crate::model::filter_result::FilterResult>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FilterResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_filter_result<
T: std::convert::Into<std::option::Option<crate::model::filter_result::FilterResult>>,
>(
mut self,
v: T,
) -> Self {
self.filter_result = v.into();
self
}
pub fn rai_filter_result(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::RaiFilterResult>> {
#[allow(unreachable_patterns)]
self.filter_result.as_ref().and_then(|v| match v {
crate::model::filter_result::FilterResult::RaiFilterResult(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_rai_filter_result<
T: std::convert::Into<std::boxed::Box<crate::model::RaiFilterResult>>,
>(
mut self,
v: T,
) -> Self {
self.filter_result = std::option::Option::Some(
crate::model::filter_result::FilterResult::RaiFilterResult(v.into()),
);
self
}
pub fn sdp_filter_result(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SdpFilterResult>> {
#[allow(unreachable_patterns)]
self.filter_result.as_ref().and_then(|v| match v {
crate::model::filter_result::FilterResult::SdpFilterResult(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_sdp_filter_result<
T: std::convert::Into<std::boxed::Box<crate::model::SdpFilterResult>>,
>(
mut self,
v: T,
) -> Self {
self.filter_result = std::option::Option::Some(
crate::model::filter_result::FilterResult::SdpFilterResult(v.into()),
);
self
}
pub fn pi_and_jailbreak_filter_result(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::PiAndJailbreakFilterResult>> {
#[allow(unreachable_patterns)]
self.filter_result.as_ref().and_then(|v| match v {
crate::model::filter_result::FilterResult::PiAndJailbreakFilterResult(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_pi_and_jailbreak_filter_result<
T: std::convert::Into<std::boxed::Box<crate::model::PiAndJailbreakFilterResult>>,
>(
mut self,
v: T,
) -> Self {
self.filter_result = std::option::Option::Some(
crate::model::filter_result::FilterResult::PiAndJailbreakFilterResult(v.into()),
);
self
}
pub fn malicious_uri_filter_result(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::MaliciousUriFilterResult>> {
#[allow(unreachable_patterns)]
self.filter_result.as_ref().and_then(|v| match v {
crate::model::filter_result::FilterResult::MaliciousUriFilterResult(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_malicious_uri_filter_result<
T: std::convert::Into<std::boxed::Box<crate::model::MaliciousUriFilterResult>>,
>(
mut self,
v: T,
) -> Self {
self.filter_result = std::option::Option::Some(
crate::model::filter_result::FilterResult::MaliciousUriFilterResult(v.into()),
);
self
}
pub fn csam_filter_filter_result(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::CsamFilterResult>> {
#[allow(unreachable_patterns)]
self.filter_result.as_ref().and_then(|v| match v {
crate::model::filter_result::FilterResult::CsamFilterFilterResult(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_csam_filter_filter_result<
T: std::convert::Into<std::boxed::Box<crate::model::CsamFilterResult>>,
>(
mut self,
v: T,
) -> Self {
self.filter_result = std::option::Option::Some(
crate::model::filter_result::FilterResult::CsamFilterFilterResult(v.into()),
);
self
}
pub fn virus_scan_filter_result(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::VirusScanFilterResult>> {
#[allow(unreachable_patterns)]
self.filter_result.as_ref().and_then(|v| match v {
crate::model::filter_result::FilterResult::VirusScanFilterResult(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_virus_scan_filter_result<
T: std::convert::Into<std::boxed::Box<crate::model::VirusScanFilterResult>>,
>(
mut self,
v: T,
) -> Self {
self.filter_result = std::option::Option::Some(
crate::model::filter_result::FilterResult::VirusScanFilterResult(v.into()),
);
self
}
}
impl wkt::message::Message for FilterResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.FilterResult"
}
}
pub mod filter_result {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum FilterResult {
RaiFilterResult(std::boxed::Box<crate::model::RaiFilterResult>),
SdpFilterResult(std::boxed::Box<crate::model::SdpFilterResult>),
PiAndJailbreakFilterResult(std::boxed::Box<crate::model::PiAndJailbreakFilterResult>),
MaliciousUriFilterResult(std::boxed::Box<crate::model::MaliciousUriFilterResult>),
CsamFilterFilterResult(std::boxed::Box<crate::model::CsamFilterResult>),
VirusScanFilterResult(std::boxed::Box<crate::model::VirusScanFilterResult>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RaiFilterResult {
pub execution_state: crate::model::FilterExecutionState,
pub message_items: std::vec::Vec<crate::model::MessageItem>,
pub match_state: crate::model::FilterMatchState,
pub rai_filter_type_results: std::collections::HashMap<
std::string::String,
crate::model::rai_filter_result::RaiFilterTypeResult,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RaiFilterResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
mut self,
v: T,
) -> Self {
self.execution_state = v.into();
self
}
pub fn set_message_items<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::MessageItem>,
{
use std::iter::Iterator;
self.message_items = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
mut self,
v: T,
) -> Self {
self.match_state = v.into();
self
}
pub fn set_rai_filter_type_results<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::rai_filter_result::RaiFilterTypeResult>,
{
use std::iter::Iterator;
self.rai_filter_type_results = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for RaiFilterResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.RaiFilterResult"
}
}
pub mod rai_filter_result {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RaiFilterTypeResult {
pub filter_type: crate::model::RaiFilterType,
pub confidence_level: crate::model::DetectionConfidenceLevel,
pub match_state: crate::model::FilterMatchState,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RaiFilterTypeResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_filter_type<T: std::convert::Into<crate::model::RaiFilterType>>(
mut self,
v: T,
) -> Self {
self.filter_type = v.into();
self
}
pub fn set_confidence_level<
T: std::convert::Into<crate::model::DetectionConfidenceLevel>,
>(
mut self,
v: T,
) -> Self {
self.confidence_level = v.into();
self
}
pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
mut self,
v: T,
) -> Self {
self.match_state = v.into();
self
}
}
impl wkt::message::Message for RaiFilterTypeResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.RaiFilterResult.RaiFilterTypeResult"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SdpFilterResult {
pub result: std::option::Option<crate::model::sdp_filter_result::Result>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SdpFilterResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_result<
T: std::convert::Into<std::option::Option<crate::model::sdp_filter_result::Result>>,
>(
mut self,
v: T,
) -> Self {
self.result = v.into();
self
}
pub fn inspect_result(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SdpInspectResult>> {
#[allow(unreachable_patterns)]
self.result.as_ref().and_then(|v| match v {
crate::model::sdp_filter_result::Result::InspectResult(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_inspect_result<
T: std::convert::Into<std::boxed::Box<crate::model::SdpInspectResult>>,
>(
mut self,
v: T,
) -> Self {
self.result = std::option::Option::Some(
crate::model::sdp_filter_result::Result::InspectResult(v.into()),
);
self
}
pub fn deidentify_result(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SdpDeidentifyResult>> {
#[allow(unreachable_patterns)]
self.result.as_ref().and_then(|v| match v {
crate::model::sdp_filter_result::Result::DeidentifyResult(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_deidentify_result<
T: std::convert::Into<std::boxed::Box<crate::model::SdpDeidentifyResult>>,
>(
mut self,
v: T,
) -> Self {
self.result = std::option::Option::Some(
crate::model::sdp_filter_result::Result::DeidentifyResult(v.into()),
);
self
}
pub fn redact_result(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SdpRedactResult>> {
#[allow(unreachable_patterns)]
self.result.as_ref().and_then(|v| match v {
crate::model::sdp_filter_result::Result::RedactResult(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_redact_result<
T: std::convert::Into<std::boxed::Box<crate::model::SdpRedactResult>>,
>(
mut self,
v: T,
) -> Self {
self.result = std::option::Option::Some(
crate::model::sdp_filter_result::Result::RedactResult(v.into()),
);
self
}
}
impl wkt::message::Message for SdpFilterResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.SdpFilterResult"
}
}
pub mod sdp_filter_result {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Result {
InspectResult(std::boxed::Box<crate::model::SdpInspectResult>),
DeidentifyResult(std::boxed::Box<crate::model::SdpDeidentifyResult>),
RedactResult(std::boxed::Box<crate::model::SdpRedactResult>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SdpInspectResult {
pub execution_state: crate::model::FilterExecutionState,
pub message_items: std::vec::Vec<crate::model::MessageItem>,
pub match_state: crate::model::FilterMatchState,
pub findings: std::vec::Vec<crate::model::SdpFinding>,
pub findings_truncated: bool,
pub extracted_image_text: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SdpInspectResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
mut self,
v: T,
) -> Self {
self.execution_state = v.into();
self
}
pub fn set_message_items<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::MessageItem>,
{
use std::iter::Iterator;
self.message_items = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
mut self,
v: T,
) -> Self {
self.match_state = v.into();
self
}
pub fn set_findings<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SdpFinding>,
{
use std::iter::Iterator;
self.findings = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_findings_truncated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.findings_truncated = v.into();
self
}
pub fn set_extracted_image_text<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.extracted_image_text = v.into();
self
}
}
impl wkt::message::Message for SdpInspectResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.SdpInspectResult"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DataItem {
pub data_item: std::option::Option<crate::model::data_item::DataItem>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DataItem {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_data_item<
T: std::convert::Into<std::option::Option<crate::model::data_item::DataItem>>,
>(
mut self,
v: T,
) -> Self {
self.data_item = v.into();
self
}
pub fn text(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.data_item.as_ref().and_then(|v| match v {
crate::model::data_item::DataItem::Text(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.data_item =
std::option::Option::Some(crate::model::data_item::DataItem::Text(v.into()));
self
}
pub fn byte_item(&self) -> std::option::Option<&std::boxed::Box<crate::model::ByteDataItem>> {
#[allow(unreachable_patterns)]
self.data_item.as_ref().and_then(|v| match v {
crate::model::data_item::DataItem::ByteItem(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_byte_item<T: std::convert::Into<std::boxed::Box<crate::model::ByteDataItem>>>(
mut self,
v: T,
) -> Self {
self.data_item =
std::option::Option::Some(crate::model::data_item::DataItem::ByteItem(v.into()));
self
}
}
impl wkt::message::Message for DataItem {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.DataItem"
}
}
pub mod data_item {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DataItem {
Text(std::string::String),
ByteItem(std::boxed::Box<crate::model::ByteDataItem>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ByteDataItem {
pub byte_data_type: crate::model::byte_data_item::ByteItemType,
pub byte_data: ::bytes::Bytes,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ByteDataItem {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_byte_data_type<T: std::convert::Into<crate::model::byte_data_item::ByteItemType>>(
mut self,
v: T,
) -> Self {
self.byte_data_type = v.into();
self
}
pub fn set_byte_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.byte_data = v.into();
self
}
}
impl wkt::message::Message for ByteDataItem {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.ByteDataItem"
}
}
pub mod byte_data_item {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ByteItemType {
Unspecified,
PlaintextUtf8,
Pdf,
WordDocument,
ExcelDocument,
PowerpointDocument,
Txt,
Csv,
Image,
UnknownValue(byte_item_type::UnknownValue),
}
#[doc(hidden)]
pub mod byte_item_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ByteItemType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::PlaintextUtf8 => std::option::Option::Some(1),
Self::Pdf => std::option::Option::Some(2),
Self::WordDocument => std::option::Option::Some(3),
Self::ExcelDocument => std::option::Option::Some(4),
Self::PowerpointDocument => std::option::Option::Some(5),
Self::Txt => std::option::Option::Some(6),
Self::Csv => std::option::Option::Some(7),
Self::Image => std::option::Option::Some(8),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("BYTE_ITEM_TYPE_UNSPECIFIED"),
Self::PlaintextUtf8 => std::option::Option::Some("PLAINTEXT_UTF8"),
Self::Pdf => std::option::Option::Some("PDF"),
Self::WordDocument => std::option::Option::Some("WORD_DOCUMENT"),
Self::ExcelDocument => std::option::Option::Some("EXCEL_DOCUMENT"),
Self::PowerpointDocument => std::option::Option::Some("POWERPOINT_DOCUMENT"),
Self::Txt => std::option::Option::Some("TXT"),
Self::Csv => std::option::Option::Some("CSV"),
Self::Image => std::option::Option::Some("IMAGE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ByteItemType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ByteItemType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ByteItemType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::PlaintextUtf8,
2 => Self::Pdf,
3 => Self::WordDocument,
4 => Self::ExcelDocument,
5 => Self::PowerpointDocument,
6 => Self::Txt,
7 => Self::Csv,
8 => Self::Image,
_ => Self::UnknownValue(byte_item_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ByteItemType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"BYTE_ITEM_TYPE_UNSPECIFIED" => Self::Unspecified,
"PLAINTEXT_UTF8" => Self::PlaintextUtf8,
"PDF" => Self::Pdf,
"WORD_DOCUMENT" => Self::WordDocument,
"EXCEL_DOCUMENT" => Self::ExcelDocument,
"POWERPOINT_DOCUMENT" => Self::PowerpointDocument,
"TXT" => Self::Txt,
"CSV" => Self::Csv,
"IMAGE" => Self::Image,
_ => Self::UnknownValue(byte_item_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ByteItemType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::PlaintextUtf8 => serializer.serialize_i32(1),
Self::Pdf => serializer.serialize_i32(2),
Self::WordDocument => serializer.serialize_i32(3),
Self::ExcelDocument => serializer.serialize_i32(4),
Self::PowerpointDocument => serializer.serialize_i32(5),
Self::Txt => serializer.serialize_i32(6),
Self::Csv => serializer.serialize_i32(7),
Self::Image => serializer.serialize_i32(8),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ByteItemType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ByteItemType>::new(
".google.cloud.modelarmor.v1.ByteDataItem.ByteItemType",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SdpDeidentifyResult {
pub execution_state: crate::model::FilterExecutionState,
pub message_items: std::vec::Vec<crate::model::MessageItem>,
pub match_state: crate::model::FilterMatchState,
pub data: std::option::Option<crate::model::DataItem>,
pub transformed_bytes: i64,
pub info_types: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SdpDeidentifyResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
mut self,
v: T,
) -> Self {
self.execution_state = v.into();
self
}
pub fn set_message_items<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::MessageItem>,
{
use std::iter::Iterator;
self.message_items = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
mut self,
v: T,
) -> Self {
self.match_state = v.into();
self
}
pub fn set_data<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DataItem>,
{
self.data = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_data<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DataItem>,
{
self.data = v.map(|x| x.into());
self
}
pub fn set_transformed_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.transformed_bytes = v.into();
self
}
pub fn set_info_types<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.info_types = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for SdpDeidentifyResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.SdpDeidentifyResult"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SdpImageFindingLocation {
pub bounding_boxes: std::vec::Vec<crate::model::sdp_image_finding_location::SdpBoundingBox>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SdpImageFindingLocation {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_bounding_boxes<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::sdp_image_finding_location::SdpBoundingBox>,
{
use std::iter::Iterator;
self.bounding_boxes = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for SdpImageFindingLocation {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.SdpImageFindingLocation"
}
}
pub mod sdp_image_finding_location {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SdpBoundingBox {
pub top: i32,
pub left: i32,
pub width: i32,
pub height: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SdpBoundingBox {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_top<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.top = v.into();
self
}
pub fn set_left<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.left = v.into();
self
}
pub fn set_width<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.width = v.into();
self
}
pub fn set_height<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.height = v.into();
self
}
}
impl wkt::message::Message for SdpBoundingBox {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.SdpImageFindingLocation.SdpBoundingBox"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SdpContentLocation {
pub container_name: std::string::String,
pub location: std::option::Option<crate::model::sdp_content_location::Location>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SdpContentLocation {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_container_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.container_name = v.into();
self
}
pub fn set_location<
T: std::convert::Into<std::option::Option<crate::model::sdp_content_location::Location>>,
>(
mut self,
v: T,
) -> Self {
self.location = v.into();
self
}
pub fn image_finding_location(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SdpImageFindingLocation>> {
#[allow(unreachable_patterns)]
self.location.as_ref().and_then(|v| match v {
crate::model::sdp_content_location::Location::ImageFindingLocation(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_image_finding_location<
T: std::convert::Into<std::boxed::Box<crate::model::SdpImageFindingLocation>>,
>(
mut self,
v: T,
) -> Self {
self.location = std::option::Option::Some(
crate::model::sdp_content_location::Location::ImageFindingLocation(v.into()),
);
self
}
}
impl wkt::message::Message for SdpContentLocation {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.SdpContentLocation"
}
}
pub mod sdp_content_location {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Location {
ImageFindingLocation(std::boxed::Box<crate::model::SdpImageFindingLocation>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SdpFinding {
pub info_type: std::string::String,
pub likelihood: crate::model::SdpFindingLikelihood,
pub location: std::option::Option<crate::model::sdp_finding::SdpFindingLocation>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SdpFinding {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_info_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.info_type = v.into();
self
}
pub fn set_likelihood<T: std::convert::Into<crate::model::SdpFindingLikelihood>>(
mut self,
v: T,
) -> Self {
self.likelihood = v.into();
self
}
pub fn set_location<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::sdp_finding::SdpFindingLocation>,
{
self.location = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_location<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::sdp_finding::SdpFindingLocation>,
{
self.location = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for SdpFinding {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.SdpFinding"
}
}
pub mod sdp_finding {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SdpFindingLocation {
pub byte_range: std::option::Option<crate::model::RangeInfo>,
pub codepoint_range: std::option::Option<crate::model::RangeInfo>,
pub content_locations: std::vec::Vec<crate::model::SdpContentLocation>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SdpFindingLocation {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_byte_range<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RangeInfo>,
{
self.byte_range = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_byte_range<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RangeInfo>,
{
self.byte_range = v.map(|x| x.into());
self
}
pub fn set_codepoint_range<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RangeInfo>,
{
self.codepoint_range = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_codepoint_range<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RangeInfo>,
{
self.codepoint_range = v.map(|x| x.into());
self
}
pub fn set_content_locations<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SdpContentLocation>,
{
use std::iter::Iterator;
self.content_locations = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for SdpFindingLocation {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.SdpFinding.SdpFindingLocation"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SdpRedactResult {
pub execution_state: crate::model::FilterExecutionState,
pub message_items: std::vec::Vec<crate::model::MessageItem>,
pub match_state: crate::model::FilterMatchState,
pub redacted_image: ::bytes::Bytes,
pub findings: std::vec::Vec<crate::model::SdpFinding>,
pub extracted_image_text: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SdpRedactResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
mut self,
v: T,
) -> Self {
self.execution_state = v.into();
self
}
pub fn set_message_items<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::MessageItem>,
{
use std::iter::Iterator;
self.message_items = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
mut self,
v: T,
) -> Self {
self.match_state = v.into();
self
}
pub fn set_redacted_image<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.redacted_image = v.into();
self
}
pub fn set_findings<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SdpFinding>,
{
use std::iter::Iterator;
self.findings = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_extracted_image_text<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.extracted_image_text = v.into();
self
}
}
impl wkt::message::Message for SdpRedactResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.SdpRedactResult"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PiAndJailbreakFilterResult {
pub execution_state: crate::model::FilterExecutionState,
pub message_items: std::vec::Vec<crate::model::MessageItem>,
pub match_state: crate::model::FilterMatchState,
pub confidence_level: crate::model::DetectionConfidenceLevel,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PiAndJailbreakFilterResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
mut self,
v: T,
) -> Self {
self.execution_state = v.into();
self
}
pub fn set_message_items<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::MessageItem>,
{
use std::iter::Iterator;
self.message_items = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
mut self,
v: T,
) -> Self {
self.match_state = v.into();
self
}
pub fn set_confidence_level<T: std::convert::Into<crate::model::DetectionConfidenceLevel>>(
mut self,
v: T,
) -> Self {
self.confidence_level = v.into();
self
}
}
impl wkt::message::Message for PiAndJailbreakFilterResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.PiAndJailbreakFilterResult"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MaliciousUriFilterResult {
pub execution_state: crate::model::FilterExecutionState,
pub message_items: std::vec::Vec<crate::model::MessageItem>,
pub match_state: crate::model::FilterMatchState,
pub malicious_uri_matched_items:
std::vec::Vec<crate::model::malicious_uri_filter_result::MaliciousUriMatchedItem>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MaliciousUriFilterResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
mut self,
v: T,
) -> Self {
self.execution_state = v.into();
self
}
pub fn set_message_items<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::MessageItem>,
{
use std::iter::Iterator;
self.message_items = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
mut self,
v: T,
) -> Self {
self.match_state = v.into();
self
}
pub fn set_malicious_uri_matched_items<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::malicious_uri_filter_result::MaliciousUriMatchedItem>,
{
use std::iter::Iterator;
self.malicious_uri_matched_items = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for MaliciousUriFilterResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.MaliciousUriFilterResult"
}
}
pub mod malicious_uri_filter_result {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MaliciousUriMatchedItem {
pub uri: std::string::String,
pub locations: std::vec::Vec<crate::model::RangeInfo>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MaliciousUriMatchedItem {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
pub fn set_locations<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::RangeInfo>,
{
use std::iter::Iterator;
self.locations = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for MaliciousUriMatchedItem {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.MaliciousUriFilterResult.MaliciousUriMatchedItem"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct VirusScanFilterResult {
pub execution_state: crate::model::FilterExecutionState,
pub message_items: std::vec::Vec<crate::model::MessageItem>,
pub match_state: crate::model::FilterMatchState,
pub scanned_content_type: crate::model::virus_scan_filter_result::ScannedContentType,
pub scanned_size: std::option::Option<i64>,
pub virus_details: std::vec::Vec<crate::model::VirusDetail>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl VirusScanFilterResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
mut self,
v: T,
) -> Self {
self.execution_state = v.into();
self
}
pub fn set_message_items<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::MessageItem>,
{
use std::iter::Iterator;
self.message_items = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
mut self,
v: T,
) -> Self {
self.match_state = v.into();
self
}
pub fn set_scanned_content_type<
T: std::convert::Into<crate::model::virus_scan_filter_result::ScannedContentType>,
>(
mut self,
v: T,
) -> Self {
self.scanned_content_type = v.into();
self
}
pub fn set_scanned_size<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.scanned_size = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_scanned_size<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.scanned_size = v.map(|x| x.into());
self
}
pub fn set_virus_details<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::VirusDetail>,
{
use std::iter::Iterator;
self.virus_details = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for VirusScanFilterResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.VirusScanFilterResult"
}
}
pub mod virus_scan_filter_result {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ScannedContentType {
Unspecified,
Unknown,
Plaintext,
Pdf,
UnknownValue(scanned_content_type::UnknownValue),
}
#[doc(hidden)]
pub mod scanned_content_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ScannedContentType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Unknown => std::option::Option::Some(1),
Self::Plaintext => std::option::Option::Some(2),
Self::Pdf => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SCANNED_CONTENT_TYPE_UNSPECIFIED"),
Self::Unknown => std::option::Option::Some("UNKNOWN"),
Self::Plaintext => std::option::Option::Some("PLAINTEXT"),
Self::Pdf => std::option::Option::Some("PDF"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ScannedContentType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ScannedContentType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ScannedContentType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Unknown,
2 => Self::Plaintext,
3 => Self::Pdf,
_ => Self::UnknownValue(scanned_content_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ScannedContentType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SCANNED_CONTENT_TYPE_UNSPECIFIED" => Self::Unspecified,
"UNKNOWN" => Self::Unknown,
"PLAINTEXT" => Self::Plaintext,
"PDF" => Self::Pdf,
_ => Self::UnknownValue(scanned_content_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ScannedContentType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Unknown => serializer.serialize_i32(1),
Self::Plaintext => serializer.serialize_i32(2),
Self::Pdf => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ScannedContentType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ScannedContentType>::new(
".google.cloud.modelarmor.v1.VirusScanFilterResult.ScannedContentType",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct VirusDetail {
pub vendor: std::string::String,
pub names: std::vec::Vec<std::string::String>,
pub threat_type: crate::model::virus_detail::ThreatType,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl VirusDetail {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_vendor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.vendor = v.into();
self
}
pub fn set_names<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.names = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_threat_type<T: std::convert::Into<crate::model::virus_detail::ThreatType>>(
mut self,
v: T,
) -> Self {
self.threat_type = v.into();
self
}
}
impl wkt::message::Message for VirusDetail {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.VirusDetail"
}
}
pub mod virus_detail {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ThreatType {
Unspecified,
Unknown,
VirusOrWorm,
MaliciousProgram,
PotentiallyHarmfulContent,
PotentiallyUnwantedContent,
UnknownValue(threat_type::UnknownValue),
}
#[doc(hidden)]
pub mod threat_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ThreatType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Unknown => std::option::Option::Some(1),
Self::VirusOrWorm => std::option::Option::Some(2),
Self::MaliciousProgram => std::option::Option::Some(3),
Self::PotentiallyHarmfulContent => std::option::Option::Some(4),
Self::PotentiallyUnwantedContent => std::option::Option::Some(5),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("THREAT_TYPE_UNSPECIFIED"),
Self::Unknown => std::option::Option::Some("UNKNOWN"),
Self::VirusOrWorm => std::option::Option::Some("VIRUS_OR_WORM"),
Self::MaliciousProgram => std::option::Option::Some("MALICIOUS_PROGRAM"),
Self::PotentiallyHarmfulContent => {
std::option::Option::Some("POTENTIALLY_HARMFUL_CONTENT")
}
Self::PotentiallyUnwantedContent => {
std::option::Option::Some("POTENTIALLY_UNWANTED_CONTENT")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ThreatType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ThreatType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ThreatType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Unknown,
2 => Self::VirusOrWorm,
3 => Self::MaliciousProgram,
4 => Self::PotentiallyHarmfulContent,
5 => Self::PotentiallyUnwantedContent,
_ => Self::UnknownValue(threat_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ThreatType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"THREAT_TYPE_UNSPECIFIED" => Self::Unspecified,
"UNKNOWN" => Self::Unknown,
"VIRUS_OR_WORM" => Self::VirusOrWorm,
"MALICIOUS_PROGRAM" => Self::MaliciousProgram,
"POTENTIALLY_HARMFUL_CONTENT" => Self::PotentiallyHarmfulContent,
"POTENTIALLY_UNWANTED_CONTENT" => Self::PotentiallyUnwantedContent,
_ => Self::UnknownValue(threat_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ThreatType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Unknown => serializer.serialize_i32(1),
Self::VirusOrWorm => serializer.serialize_i32(2),
Self::MaliciousProgram => serializer.serialize_i32(3),
Self::PotentiallyHarmfulContent => serializer.serialize_i32(4),
Self::PotentiallyUnwantedContent => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ThreatType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ThreatType>::new(
".google.cloud.modelarmor.v1.VirusDetail.ThreatType",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CsamFilterResult {
pub execution_state: crate::model::FilterExecutionState,
pub message_items: std::vec::Vec<crate::model::MessageItem>,
pub match_state: crate::model::FilterMatchState,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CsamFilterResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_execution_state<T: std::convert::Into<crate::model::FilterExecutionState>>(
mut self,
v: T,
) -> Self {
self.execution_state = v.into();
self
}
pub fn set_message_items<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::MessageItem>,
{
use std::iter::Iterator;
self.message_items = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_match_state<T: std::convert::Into<crate::model::FilterMatchState>>(
mut self,
v: T,
) -> Self {
self.match_state = v.into();
self
}
}
impl wkt::message::Message for CsamFilterResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.CsamFilterResult"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageItem {
pub message_type: crate::model::message_item::MessageType,
pub message: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl MessageItem {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_message_type<T: std::convert::Into<crate::model::message_item::MessageType>>(
mut self,
v: T,
) -> Self {
self.message_type = v.into();
self
}
pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.message = v.into();
self
}
}
impl wkt::message::Message for MessageItem {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.MessageItem"
}
}
pub mod message_item {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum MessageType {
Unspecified,
Info,
Warning,
Error,
UnknownValue(message_type::UnknownValue),
}
#[doc(hidden)]
pub mod message_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl MessageType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Info => std::option::Option::Some(1),
Self::Warning => std::option::Option::Some(2),
Self::Error => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("MESSAGE_TYPE_UNSPECIFIED"),
Self::Info => std::option::Option::Some("INFO"),
Self::Warning => std::option::Option::Some("WARNING"),
Self::Error => std::option::Option::Some("ERROR"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for MessageType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for MessageType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for MessageType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Info,
2 => Self::Warning,
3 => Self::Error,
_ => Self::UnknownValue(message_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for MessageType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MESSAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
"INFO" => Self::Info,
"WARNING" => Self::Warning,
"ERROR" => Self::Error,
_ => Self::UnknownValue(message_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for MessageType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Info => serializer.serialize_i32(1),
Self::Warning => serializer.serialize_i32(2),
Self::Error => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for MessageType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<MessageType>::new(
".google.cloud.modelarmor.v1.MessageItem.MessageType",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RangeInfo {
pub start: std::option::Option<i64>,
pub end: std::option::Option<i64>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RangeInfo {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_start<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.start = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_start<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.start = v.map(|x| x.into());
self
}
pub fn set_end<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.end = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_end<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.end = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for RangeInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.modelarmor.v1.RangeInfo"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum FilterMatchState {
Unspecified,
NoMatchFound,
MatchFound,
UnknownValue(filter_match_state::UnknownValue),
}
#[doc(hidden)]
pub mod filter_match_state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl FilterMatchState {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::NoMatchFound => std::option::Option::Some(1),
Self::MatchFound => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("FILTER_MATCH_STATE_UNSPECIFIED"),
Self::NoMatchFound => std::option::Option::Some("NO_MATCH_FOUND"),
Self::MatchFound => std::option::Option::Some("MATCH_FOUND"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for FilterMatchState {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for FilterMatchState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for FilterMatchState {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::NoMatchFound,
2 => Self::MatchFound,
_ => Self::UnknownValue(filter_match_state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for FilterMatchState {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"FILTER_MATCH_STATE_UNSPECIFIED" => Self::Unspecified,
"NO_MATCH_FOUND" => Self::NoMatchFound,
"MATCH_FOUND" => Self::MatchFound,
_ => Self::UnknownValue(filter_match_state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for FilterMatchState {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::NoMatchFound => serializer.serialize_i32(1),
Self::MatchFound => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for FilterMatchState {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<FilterMatchState>::new(
".google.cloud.modelarmor.v1.FilterMatchState",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum FilterExecutionState {
Unspecified,
ExecutionSuccess,
ExecutionSkipped,
UnknownValue(filter_execution_state::UnknownValue),
}
#[doc(hidden)]
pub mod filter_execution_state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl FilterExecutionState {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::ExecutionSuccess => std::option::Option::Some(1),
Self::ExecutionSkipped => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("FILTER_EXECUTION_STATE_UNSPECIFIED"),
Self::ExecutionSuccess => std::option::Option::Some("EXECUTION_SUCCESS"),
Self::ExecutionSkipped => std::option::Option::Some("EXECUTION_SKIPPED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for FilterExecutionState {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for FilterExecutionState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for FilterExecutionState {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::ExecutionSuccess,
2 => Self::ExecutionSkipped,
_ => Self::UnknownValue(filter_execution_state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for FilterExecutionState {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"FILTER_EXECUTION_STATE_UNSPECIFIED" => Self::Unspecified,
"EXECUTION_SUCCESS" => Self::ExecutionSuccess,
"EXECUTION_SKIPPED" => Self::ExecutionSkipped,
_ => Self::UnknownValue(filter_execution_state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for FilterExecutionState {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::ExecutionSuccess => serializer.serialize_i32(1),
Self::ExecutionSkipped => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for FilterExecutionState {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<FilterExecutionState>::new(
".google.cloud.modelarmor.v1.FilterExecutionState",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RaiFilterType {
Unspecified,
SexuallyExplicit,
HateSpeech,
Harassment,
Dangerous,
UnknownValue(rai_filter_type::UnknownValue),
}
#[doc(hidden)]
pub mod rai_filter_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl RaiFilterType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::SexuallyExplicit => std::option::Option::Some(2),
Self::HateSpeech => std::option::Option::Some(3),
Self::Harassment => std::option::Option::Some(6),
Self::Dangerous => std::option::Option::Some(17),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("RAI_FILTER_TYPE_UNSPECIFIED"),
Self::SexuallyExplicit => std::option::Option::Some("SEXUALLY_EXPLICIT"),
Self::HateSpeech => std::option::Option::Some("HATE_SPEECH"),
Self::Harassment => std::option::Option::Some("HARASSMENT"),
Self::Dangerous => std::option::Option::Some("DANGEROUS"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for RaiFilterType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for RaiFilterType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for RaiFilterType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
2 => Self::SexuallyExplicit,
3 => Self::HateSpeech,
6 => Self::Harassment,
17 => Self::Dangerous,
_ => Self::UnknownValue(rai_filter_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for RaiFilterType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"RAI_FILTER_TYPE_UNSPECIFIED" => Self::Unspecified,
"SEXUALLY_EXPLICIT" => Self::SexuallyExplicit,
"HATE_SPEECH" => Self::HateSpeech,
"HARASSMENT" => Self::Harassment,
"DANGEROUS" => Self::Dangerous,
_ => Self::UnknownValue(rai_filter_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for RaiFilterType {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::SexuallyExplicit => serializer.serialize_i32(2),
Self::HateSpeech => serializer.serialize_i32(3),
Self::Harassment => serializer.serialize_i32(6),
Self::Dangerous => serializer.serialize_i32(17),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for RaiFilterType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<RaiFilterType>::new(
".google.cloud.modelarmor.v1.RaiFilterType",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DetectionConfidenceLevel {
Unspecified,
LowAndAbove,
MediumAndAbove,
High,
UnknownValue(detection_confidence_level::UnknownValue),
}
#[doc(hidden)]
pub mod detection_confidence_level {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl DetectionConfidenceLevel {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::LowAndAbove => std::option::Option::Some(1),
Self::MediumAndAbove => std::option::Option::Some(2),
Self::High => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("DETECTION_CONFIDENCE_LEVEL_UNSPECIFIED")
}
Self::LowAndAbove => std::option::Option::Some("LOW_AND_ABOVE"),
Self::MediumAndAbove => std::option::Option::Some("MEDIUM_AND_ABOVE"),
Self::High => std::option::Option::Some("HIGH"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for DetectionConfidenceLevel {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for DetectionConfidenceLevel {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for DetectionConfidenceLevel {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::LowAndAbove,
2 => Self::MediumAndAbove,
3 => Self::High,
_ => Self::UnknownValue(detection_confidence_level::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for DetectionConfidenceLevel {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DETECTION_CONFIDENCE_LEVEL_UNSPECIFIED" => Self::Unspecified,
"LOW_AND_ABOVE" => Self::LowAndAbove,
"MEDIUM_AND_ABOVE" => Self::MediumAndAbove,
"HIGH" => Self::High,
_ => Self::UnknownValue(detection_confidence_level::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for DetectionConfidenceLevel {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::LowAndAbove => serializer.serialize_i32(1),
Self::MediumAndAbove => serializer.serialize_i32(2),
Self::High => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for DetectionConfidenceLevel {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DetectionConfidenceLevel>::new(
".google.cloud.modelarmor.v1.DetectionConfidenceLevel",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SdpFindingLikelihood {
Unspecified,
VeryUnlikely,
Unlikely,
Possible,
Likely,
VeryLikely,
UnknownValue(sdp_finding_likelihood::UnknownValue),
}
#[doc(hidden)]
pub mod sdp_finding_likelihood {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl SdpFindingLikelihood {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::VeryUnlikely => std::option::Option::Some(1),
Self::Unlikely => std::option::Option::Some(2),
Self::Possible => std::option::Option::Some(3),
Self::Likely => std::option::Option::Some(4),
Self::VeryLikely => std::option::Option::Some(5),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SDP_FINDING_LIKELIHOOD_UNSPECIFIED"),
Self::VeryUnlikely => std::option::Option::Some("VERY_UNLIKELY"),
Self::Unlikely => std::option::Option::Some("UNLIKELY"),
Self::Possible => std::option::Option::Some("POSSIBLE"),
Self::Likely => std::option::Option::Some("LIKELY"),
Self::VeryLikely => std::option::Option::Some("VERY_LIKELY"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for SdpFindingLikelihood {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for SdpFindingLikelihood {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for SdpFindingLikelihood {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::VeryUnlikely,
2 => Self::Unlikely,
3 => Self::Possible,
4 => Self::Likely,
5 => Self::VeryLikely,
_ => Self::UnknownValue(sdp_finding_likelihood::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for SdpFindingLikelihood {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SDP_FINDING_LIKELIHOOD_UNSPECIFIED" => Self::Unspecified,
"VERY_UNLIKELY" => Self::VeryUnlikely,
"UNLIKELY" => Self::Unlikely,
"POSSIBLE" => Self::Possible,
"LIKELY" => Self::Likely,
"VERY_LIKELY" => Self::VeryLikely,
_ => Self::UnknownValue(sdp_finding_likelihood::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for SdpFindingLikelihood {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::VeryUnlikely => serializer.serialize_i32(1),
Self::Unlikely => serializer.serialize_i32(2),
Self::Possible => serializer.serialize_i32(3),
Self::Likely => serializer.serialize_i32(4),
Self::VeryLikely => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for SdpFindingLikelihood {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<SdpFindingLikelihood>::new(
".google.cloud.modelarmor.v1.SdpFindingLikelihood",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum InvocationResult {
Unspecified,
Success,
Partial,
Failure,
UnknownValue(invocation_result::UnknownValue),
}
#[doc(hidden)]
pub mod invocation_result {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl InvocationResult {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Success => std::option::Option::Some(1),
Self::Partial => std::option::Option::Some(2),
Self::Failure => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("INVOCATION_RESULT_UNSPECIFIED"),
Self::Success => std::option::Option::Some("SUCCESS"),
Self::Partial => std::option::Option::Some("PARTIAL"),
Self::Failure => std::option::Option::Some("FAILURE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for InvocationResult {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for InvocationResult {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for InvocationResult {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Success,
2 => Self::Partial,
3 => Self::Failure,
_ => Self::UnknownValue(invocation_result::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for InvocationResult {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"INVOCATION_RESULT_UNSPECIFIED" => Self::Unspecified,
"SUCCESS" => Self::Success,
"PARTIAL" => Self::Partial,
"FAILURE" => Self::Failure,
_ => Self::UnknownValue(invocation_result::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for InvocationResult {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Success => serializer.serialize_i32(1),
Self::Partial => serializer.serialize_i32(2),
Self::Failure => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for InvocationResult {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<InvocationResult>::new(
".google.cloud.modelarmor.v1.InvocationResult",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum StreamingMode {
Unspecified,
Buffered,
Realtime,
UnknownValue(streaming_mode::UnknownValue),
}
#[doc(hidden)]
pub mod streaming_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl StreamingMode {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Buffered => std::option::Option::Some(1),
Self::Realtime => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STREAMING_MODE_UNSPECIFIED"),
Self::Buffered => std::option::Option::Some("STREAMING_MODE_BUFFERED"),
Self::Realtime => std::option::Option::Some("STREAMING_MODE_REALTIME"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for StreamingMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for StreamingMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for StreamingMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Buffered,
2 => Self::Realtime,
_ => Self::UnknownValue(streaming_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for StreamingMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STREAMING_MODE_UNSPECIFIED" => Self::Unspecified,
"STREAMING_MODE_BUFFERED" => Self::Buffered,
"STREAMING_MODE_REALTIME" => Self::Realtime,
_ => Self::UnknownValue(streaming_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for StreamingMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Buffered => serializer.serialize_i32(1),
Self::Realtime => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for StreamingMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<StreamingMode>::new(
".google.cloud.modelarmor.v1.StreamingMode",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Modality {
Unspecified,
Text,
Image,
UnknownValue(modality::UnknownValue),
}
#[doc(hidden)]
pub mod modality {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Modality {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Text => std::option::Option::Some(1),
Self::Image => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("MODALITY_UNSPECIFIED"),
Self::Text => std::option::Option::Some("MODALITY_TEXT"),
Self::Image => std::option::Option::Some("MODALITY_IMAGE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Modality {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Modality {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for Modality {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Text,
2 => Self::Image,
_ => Self::UnknownValue(modality::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Modality {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MODALITY_UNSPECIFIED" => Self::Unspecified,
"MODALITY_TEXT" => Self::Text,
"MODALITY_IMAGE" => Self::Image,
_ => Self::UnknownValue(modality::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Modality {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Text => serializer.serialize_i32(1),
Self::Image => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Modality {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Modality>::new(
".google.cloud.modelarmor.v1.Modality",
))
}
}