#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gaxi;
extern crate google_cloud_gax;
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 Notification {
pub name: std::string::String,
pub subject: std::option::Option<crate::model::Subject>,
pub messages: std::vec::Vec<crate::model::Message>,
pub create_time: std::option::Option<wkt::Timestamp>,
pub notification_type: crate::model::NotificationType,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Notification {
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_subject<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Subject>,
{
self.subject = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_subject<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Subject>,
{
self.subject = v.map(|x| x.into());
self
}
pub fn set_messages<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Message>,
{
use std::iter::Iterator;
self.messages = v.into_iter().map(|i| i.into()).collect();
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_notification_type<T: std::convert::Into<crate::model::NotificationType>>(
mut self,
v: T,
) -> Self {
self.notification_type = v.into();
self
}
}
impl wkt::message::Message for Notification {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.advisorynotifications.v1.Notification"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Text {
pub en_text: std::string::String,
pub localized_text: std::string::String,
pub localization_state: crate::model::LocalizationState,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Text {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_en_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.en_text = v.into();
self
}
pub fn set_localized_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.localized_text = v.into();
self
}
pub fn set_localization_state<T: std::convert::Into<crate::model::LocalizationState>>(
mut self,
v: T,
) -> Self {
self.localization_state = v.into();
self
}
}
impl wkt::message::Message for Text {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.advisorynotifications.v1.Text"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Subject {
pub text: std::option::Option<crate::model::Text>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Subject {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_text<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Text>,
{
self.text = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_text<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Text>,
{
self.text = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Subject {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.advisorynotifications.v1.Subject"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Message {
pub body: std::option::Option<crate::model::message::Body>,
pub attachments: std::vec::Vec<crate::model::Attachment>,
pub create_time: std::option::Option<wkt::Timestamp>,
pub localization_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Message {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_body<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::message::Body>,
{
self.body = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_body<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::message::Body>,
{
self.body = v.map(|x| x.into());
self
}
pub fn set_attachments<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Attachment>,
{
use std::iter::Iterator;
self.attachments = v.into_iter().map(|i| i.into()).collect();
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_localization_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.localization_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_localization_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.localization_time = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Message {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.advisorynotifications.v1.Message"
}
}
pub mod message {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Body {
pub text: std::option::Option<crate::model::Text>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Body {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_text<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Text>,
{
self.text = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_text<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Text>,
{
self.text = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Body {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.advisorynotifications.v1.Message.Body"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Attachment {
pub display_name: std::string::String,
pub data: std::option::Option<crate::model::attachment::Data>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Attachment {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
pub fn set_data<T: std::convert::Into<std::option::Option<crate::model::attachment::Data>>>(
mut self,
v: T,
) -> Self {
self.data = v.into();
self
}
pub fn csv(&self) -> std::option::Option<&std::boxed::Box<crate::model::Csv>> {
#[allow(unreachable_patterns)]
self.data.as_ref().and_then(|v| match v {
crate::model::attachment::Data::Csv(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_csv<T: std::convert::Into<std::boxed::Box<crate::model::Csv>>>(
mut self,
v: T,
) -> Self {
self.data = std::option::Option::Some(crate::model::attachment::Data::Csv(v.into()));
self
}
}
impl wkt::message::Message for Attachment {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.advisorynotifications.v1.Attachment"
}
}
pub mod attachment {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Data {
Csv(std::boxed::Box<crate::model::Csv>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Csv {
pub headers: std::vec::Vec<std::string::String>,
pub data_rows: std::vec::Vec<crate::model::csv::CsvRow>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Csv {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_headers<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.headers = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_data_rows<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::csv::CsvRow>,
{
use std::iter::Iterator;
self.data_rows = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for Csv {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.advisorynotifications.v1.Csv"
}
}
pub mod csv {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CsvRow {
pub entries: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CsvRow {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_entries<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.entries = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for CsvRow {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.advisorynotifications.v1.Csv.CsvRow"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListNotificationsRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub view: crate::model::NotificationView,
pub language_code: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListNotificationsRequest {
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_view<T: std::convert::Into<crate::model::NotificationView>>(mut self, v: T) -> Self {
self.view = v.into();
self
}
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
}
impl wkt::message::Message for ListNotificationsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.advisorynotifications.v1.ListNotificationsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListNotificationsResponse {
pub notifications: std::vec::Vec<crate::model::Notification>,
pub next_page_token: std::string::String,
pub total_size: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListNotificationsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_notifications<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Notification>,
{
use std::iter::Iterator;
self.notifications = 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_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.total_size = v.into();
self
}
}
impl wkt::message::Message for ListNotificationsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.advisorynotifications.v1.ListNotificationsResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListNotificationsResponse {
type PageItem = crate::model::Notification;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.notifications
}
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 GetNotificationRequest {
pub name: std::string::String,
pub language_code: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetNotificationRequest {
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_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
}
impl wkt::message::Message for GetNotificationRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.advisorynotifications.v1.GetNotificationRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Settings {
pub name: std::string::String,
pub notification_settings:
std::collections::HashMap<std::string::String, crate::model::NotificationSettings>,
pub etag: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Settings {
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_notification_settings<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::NotificationSettings>,
{
use std::iter::Iterator;
self.notification_settings = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
}
impl wkt::message::Message for Settings {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.advisorynotifications.v1.Settings"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct NotificationSettings {
pub enabled: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl NotificationSettings {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enabled = v.into();
self
}
}
impl wkt::message::Message for NotificationSettings {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.advisorynotifications.v1.NotificationSettings"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetSettingsRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetSettingsRequest {
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 GetSettingsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.advisorynotifications.v1.GetSettingsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateSettingsRequest {
pub settings: std::option::Option<crate::model::Settings>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateSettingsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_settings<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Settings>,
{
self.settings = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_settings<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Settings>,
{
self.settings = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateSettingsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.advisorynotifications.v1.UpdateSettingsRequest"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum NotificationView {
Unspecified,
Basic,
Full,
UnknownValue(notification_view::UnknownValue),
}
#[doc(hidden)]
pub mod notification_view {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl NotificationView {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Basic => std::option::Option::Some(1),
Self::Full => 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("NOTIFICATION_VIEW_UNSPECIFIED"),
Self::Basic => std::option::Option::Some("BASIC"),
Self::Full => std::option::Option::Some("FULL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for NotificationView {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for NotificationView {
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 NotificationView {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Basic,
2 => Self::Full,
_ => Self::UnknownValue(notification_view::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for NotificationView {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"NOTIFICATION_VIEW_UNSPECIFIED" => Self::Unspecified,
"BASIC" => Self::Basic,
"FULL" => Self::Full,
_ => Self::UnknownValue(notification_view::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for NotificationView {
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::Basic => serializer.serialize_i32(1),
Self::Full => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for NotificationView {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<NotificationView>::new(
".google.cloud.advisorynotifications.v1.NotificationView",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum LocalizationState {
Unspecified,
NotApplicable,
Pending,
Completed,
UnknownValue(localization_state::UnknownValue),
}
#[doc(hidden)]
pub mod localization_state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl LocalizationState {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::NotApplicable => std::option::Option::Some(1),
Self::Pending => std::option::Option::Some(2),
Self::Completed => 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("LOCALIZATION_STATE_UNSPECIFIED"),
Self::NotApplicable => std::option::Option::Some("LOCALIZATION_STATE_NOT_APPLICABLE"),
Self::Pending => std::option::Option::Some("LOCALIZATION_STATE_PENDING"),
Self::Completed => std::option::Option::Some("LOCALIZATION_STATE_COMPLETED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for LocalizationState {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for LocalizationState {
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 LocalizationState {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::NotApplicable,
2 => Self::Pending,
3 => Self::Completed,
_ => Self::UnknownValue(localization_state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for LocalizationState {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"LOCALIZATION_STATE_UNSPECIFIED" => Self::Unspecified,
"LOCALIZATION_STATE_NOT_APPLICABLE" => Self::NotApplicable,
"LOCALIZATION_STATE_PENDING" => Self::Pending,
"LOCALIZATION_STATE_COMPLETED" => Self::Completed,
_ => Self::UnknownValue(localization_state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for LocalizationState {
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::NotApplicable => serializer.serialize_i32(1),
Self::Pending => serializer.serialize_i32(2),
Self::Completed => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for LocalizationState {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<LocalizationState>::new(
".google.cloud.advisorynotifications.v1.LocalizationState",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum NotificationType {
Unspecified,
SecurityPrivacyAdvisory,
SensitiveActions,
SecurityMsa,
ThreatHorizons,
UnknownValue(notification_type::UnknownValue),
}
#[doc(hidden)]
pub mod notification_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl NotificationType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::SecurityPrivacyAdvisory => std::option::Option::Some(1),
Self::SensitiveActions => std::option::Option::Some(2),
Self::SecurityMsa => std::option::Option::Some(3),
Self::ThreatHorizons => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("NOTIFICATION_TYPE_UNSPECIFIED"),
Self::SecurityPrivacyAdvisory => {
std::option::Option::Some("NOTIFICATION_TYPE_SECURITY_PRIVACY_ADVISORY")
}
Self::SensitiveActions => {
std::option::Option::Some("NOTIFICATION_TYPE_SENSITIVE_ACTIONS")
}
Self::SecurityMsa => std::option::Option::Some("NOTIFICATION_TYPE_SECURITY_MSA"),
Self::ThreatHorizons => std::option::Option::Some("NOTIFICATION_TYPE_THREAT_HORIZONS"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for NotificationType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for NotificationType {
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 NotificationType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::SecurityPrivacyAdvisory,
2 => Self::SensitiveActions,
3 => Self::SecurityMsa,
4 => Self::ThreatHorizons,
_ => Self::UnknownValue(notification_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for NotificationType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"NOTIFICATION_TYPE_UNSPECIFIED" => Self::Unspecified,
"NOTIFICATION_TYPE_SECURITY_PRIVACY_ADVISORY" => Self::SecurityPrivacyAdvisory,
"NOTIFICATION_TYPE_SENSITIVE_ACTIONS" => Self::SensitiveActions,
"NOTIFICATION_TYPE_SECURITY_MSA" => Self::SecurityMsa,
"NOTIFICATION_TYPE_THREAT_HORIZONS" => Self::ThreatHorizons,
_ => Self::UnknownValue(notification_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for NotificationType {
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::SecurityPrivacyAdvisory => serializer.serialize_i32(1),
Self::SensitiveActions => serializer.serialize_i32(2),
Self::SecurityMsa => serializer.serialize_i32(3),
Self::ThreatHorizons => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for NotificationType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<NotificationType>::new(
".google.cloud.advisorynotifications.v1.NotificationType",
))
}
}