aws_sdk_sesv2/operation/create_contact/
_create_contact_input.rs1#[allow(missing_docs)] #[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateContactInput {
6 pub contact_list_name: ::std::option::Option<::std::string::String>,
8 pub email_address: ::std::option::Option<::std::string::String>,
10 pub topic_preferences: ::std::option::Option<::std::vec::Vec<crate::types::TopicPreference>>,
12 pub unsubscribe_all: ::std::option::Option<bool>,
14 pub attributes_data: ::std::option::Option<::std::string::String>,
16}
17impl CreateContactInput {
18 pub fn contact_list_name(&self) -> ::std::option::Option<&str> {
20 self.contact_list_name.as_deref()
21 }
22 pub fn email_address(&self) -> ::std::option::Option<&str> {
24 self.email_address.as_deref()
25 }
26 pub fn topic_preferences(&self) -> &[crate::types::TopicPreference] {
30 self.topic_preferences.as_deref().unwrap_or_default()
31 }
32 pub fn unsubscribe_all(&self) -> ::std::option::Option<bool> {
34 self.unsubscribe_all
35 }
36 pub fn attributes_data(&self) -> ::std::option::Option<&str> {
38 self.attributes_data.as_deref()
39 }
40}
41impl CreateContactInput {
42 pub fn builder() -> crate::operation::create_contact::builders::CreateContactInputBuilder {
44 crate::operation::create_contact::builders::CreateContactInputBuilder::default()
45 }
46}
47
48#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
50#[non_exhaustive]
51pub struct CreateContactInputBuilder {
52 pub(crate) contact_list_name: ::std::option::Option<::std::string::String>,
53 pub(crate) email_address: ::std::option::Option<::std::string::String>,
54 pub(crate) topic_preferences: ::std::option::Option<::std::vec::Vec<crate::types::TopicPreference>>,
55 pub(crate) unsubscribe_all: ::std::option::Option<bool>,
56 pub(crate) attributes_data: ::std::option::Option<::std::string::String>,
57}
58impl CreateContactInputBuilder {
59 pub fn contact_list_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
62 self.contact_list_name = ::std::option::Option::Some(input.into());
63 self
64 }
65 pub fn set_contact_list_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
67 self.contact_list_name = input;
68 self
69 }
70 pub fn get_contact_list_name(&self) -> &::std::option::Option<::std::string::String> {
72 &self.contact_list_name
73 }
74 pub fn email_address(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
77 self.email_address = ::std::option::Option::Some(input.into());
78 self
79 }
80 pub fn set_email_address(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
82 self.email_address = input;
83 self
84 }
85 pub fn get_email_address(&self) -> &::std::option::Option<::std::string::String> {
87 &self.email_address
88 }
89 pub fn topic_preferences(mut self, input: crate::types::TopicPreference) -> Self {
95 let mut v = self.topic_preferences.unwrap_or_default();
96 v.push(input);
97 self.topic_preferences = ::std::option::Option::Some(v);
98 self
99 }
100 pub fn set_topic_preferences(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TopicPreference>>) -> Self {
102 self.topic_preferences = input;
103 self
104 }
105 pub fn get_topic_preferences(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TopicPreference>> {
107 &self.topic_preferences
108 }
109 pub fn unsubscribe_all(mut self, input: bool) -> Self {
111 self.unsubscribe_all = ::std::option::Option::Some(input);
112 self
113 }
114 pub fn set_unsubscribe_all(mut self, input: ::std::option::Option<bool>) -> Self {
116 self.unsubscribe_all = input;
117 self
118 }
119 pub fn get_unsubscribe_all(&self) -> &::std::option::Option<bool> {
121 &self.unsubscribe_all
122 }
123 pub fn attributes_data(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
125 self.attributes_data = ::std::option::Option::Some(input.into());
126 self
127 }
128 pub fn set_attributes_data(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
130 self.attributes_data = input;
131 self
132 }
133 pub fn get_attributes_data(&self) -> &::std::option::Option<::std::string::String> {
135 &self.attributes_data
136 }
137 pub fn build(
139 self,
140 ) -> ::std::result::Result<crate::operation::create_contact::CreateContactInput, ::aws_smithy_types::error::operation::BuildError> {
141 ::std::result::Result::Ok(crate::operation::create_contact::CreateContactInput {
142 contact_list_name: self.contact_list_name,
143 email_address: self.email_address,
144 topic_preferences: self.topic_preferences,
145 unsubscribe_all: self.unsubscribe_all,
146 attributes_data: self.attributes_data,
147 })
148 }
149}