#![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 Contact {
pub name: std::string::String,
pub email: std::string::String,
pub notification_category_subscriptions: std::vec::Vec<crate::model::NotificationCategory>,
pub language_tag: std::string::String,
pub validation_state: crate::model::ValidationState,
pub validate_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Contact {
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_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.email = v.into();
self
}
pub fn set_notification_category_subscriptions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::NotificationCategory>,
{
use std::iter::Iterator;
self.notification_category_subscriptions = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_language_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_tag = v.into();
self
}
pub fn set_validation_state<T: std::convert::Into<crate::model::ValidationState>>(
mut self,
v: T,
) -> Self {
self.validation_state = v.into();
self
}
pub fn set_validate_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.validate_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_validate_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.validate_time = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Contact {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.essentialcontacts.v1.Contact"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListContactsRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListContactsRequest {
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
}
}
impl wkt::message::Message for ListContactsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.essentialcontacts.v1.ListContactsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListContactsResponse {
pub contacts: std::vec::Vec<crate::model::Contact>,
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListContactsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_contacts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Contact>,
{
use std::iter::Iterator;
self.contacts = 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
}
}
impl wkt::message::Message for ListContactsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.essentialcontacts.v1.ListContactsResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListContactsResponse {
type PageItem = crate::model::Contact;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.contacts
}
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 GetContactRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetContactRequest {
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 GetContactRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.essentialcontacts.v1.GetContactRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteContactRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteContactRequest {
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 DeleteContactRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.essentialcontacts.v1.DeleteContactRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateContactRequest {
pub parent: std::string::String,
pub contact: std::option::Option<crate::model::Contact>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateContactRequest {
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_contact<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Contact>,
{
self.contact = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_contact<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Contact>,
{
self.contact = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for CreateContactRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.essentialcontacts.v1.CreateContactRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateContactRequest {
pub contact: std::option::Option<crate::model::Contact>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateContactRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_contact<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Contact>,
{
self.contact = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_contact<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Contact>,
{
self.contact = 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 UpdateContactRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.essentialcontacts.v1.UpdateContactRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ComputeContactsRequest {
pub parent: std::string::String,
pub notification_categories: std::vec::Vec<crate::model::NotificationCategory>,
pub page_size: i32,
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ComputeContactsRequest {
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_notification_categories<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::NotificationCategory>,
{
use std::iter::Iterator;
self.notification_categories = v.into_iter().map(|i| i.into()).collect();
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
}
}
impl wkt::message::Message for ComputeContactsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.essentialcontacts.v1.ComputeContactsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ComputeContactsResponse {
pub contacts: std::vec::Vec<crate::model::Contact>,
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ComputeContactsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_contacts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Contact>,
{
use std::iter::Iterator;
self.contacts = 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
}
}
impl wkt::message::Message for ComputeContactsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.essentialcontacts.v1.ComputeContactsResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ComputeContactsResponse {
type PageItem = crate::model::Contact;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.contacts
}
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 SendTestMessageRequest {
pub contacts: std::vec::Vec<std::string::String>,
pub resource: std::string::String,
pub notification_category: crate::model::NotificationCategory,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SendTestMessageRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_contacts<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.contacts = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.resource = v.into();
self
}
pub fn set_notification_category<T: std::convert::Into<crate::model::NotificationCategory>>(
mut self,
v: T,
) -> Self {
self.notification_category = v.into();
self
}
}
impl wkt::message::Message for SendTestMessageRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.essentialcontacts.v1.SendTestMessageRequest"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum NotificationCategory {
Unspecified,
All,
Suspension,
Security,
Technical,
Billing,
Legal,
ProductUpdates,
TechnicalIncidents,
UnknownValue(notification_category::UnknownValue),
}
#[doc(hidden)]
pub mod notification_category {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl NotificationCategory {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::All => std::option::Option::Some(2),
Self::Suspension => std::option::Option::Some(3),
Self::Security => std::option::Option::Some(5),
Self::Technical => std::option::Option::Some(6),
Self::Billing => std::option::Option::Some(7),
Self::Legal => std::option::Option::Some(8),
Self::ProductUpdates => std::option::Option::Some(9),
Self::TechnicalIncidents => std::option::Option::Some(10),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("NOTIFICATION_CATEGORY_UNSPECIFIED"),
Self::All => std::option::Option::Some("ALL"),
Self::Suspension => std::option::Option::Some("SUSPENSION"),
Self::Security => std::option::Option::Some("SECURITY"),
Self::Technical => std::option::Option::Some("TECHNICAL"),
Self::Billing => std::option::Option::Some("BILLING"),
Self::Legal => std::option::Option::Some("LEGAL"),
Self::ProductUpdates => std::option::Option::Some("PRODUCT_UPDATES"),
Self::TechnicalIncidents => std::option::Option::Some("TECHNICAL_INCIDENTS"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for NotificationCategory {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for NotificationCategory {
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 NotificationCategory {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
2 => Self::All,
3 => Self::Suspension,
5 => Self::Security,
6 => Self::Technical,
7 => Self::Billing,
8 => Self::Legal,
9 => Self::ProductUpdates,
10 => Self::TechnicalIncidents,
_ => Self::UnknownValue(notification_category::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for NotificationCategory {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"NOTIFICATION_CATEGORY_UNSPECIFIED" => Self::Unspecified,
"ALL" => Self::All,
"SUSPENSION" => Self::Suspension,
"SECURITY" => Self::Security,
"TECHNICAL" => Self::Technical,
"BILLING" => Self::Billing,
"LEGAL" => Self::Legal,
"PRODUCT_UPDATES" => Self::ProductUpdates,
"TECHNICAL_INCIDENTS" => Self::TechnicalIncidents,
_ => Self::UnknownValue(notification_category::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for NotificationCategory {
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::All => serializer.serialize_i32(2),
Self::Suspension => serializer.serialize_i32(3),
Self::Security => serializer.serialize_i32(5),
Self::Technical => serializer.serialize_i32(6),
Self::Billing => serializer.serialize_i32(7),
Self::Legal => serializer.serialize_i32(8),
Self::ProductUpdates => serializer.serialize_i32(9),
Self::TechnicalIncidents => serializer.serialize_i32(10),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for NotificationCategory {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<NotificationCategory>::new(
".google.cloud.essentialcontacts.v1.NotificationCategory",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ValidationState {
Unspecified,
Valid,
Invalid,
UnknownValue(validation_state::UnknownValue),
}
#[doc(hidden)]
pub mod validation_state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ValidationState {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Valid => std::option::Option::Some(1),
Self::Invalid => 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("VALIDATION_STATE_UNSPECIFIED"),
Self::Valid => std::option::Option::Some("VALID"),
Self::Invalid => std::option::Option::Some("INVALID"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ValidationState {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ValidationState {
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 ValidationState {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Valid,
2 => Self::Invalid,
_ => Self::UnknownValue(validation_state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ValidationState {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"VALIDATION_STATE_UNSPECIFIED" => Self::Unspecified,
"VALID" => Self::Valid,
"INVALID" => Self::Invalid,
_ => Self::UnknownValue(validation_state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ValidationState {
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::Valid => serializer.serialize_i32(1),
Self::Invalid => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ValidationState {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValidationState>::new(
".google.cloud.essentialcontacts.v1.ValidationState",
))
}
}