1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>The contact's preference for being opted-in to or opted-out of a topic.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct TopicPreference {
    /// <p>The name of the topic.</p>
    pub topic_name: ::std::option::Option<::std::string::String>,
    /// <p>The contact's subscription status to a topic which is either <code>OPT_IN</code> or <code>OPT_OUT</code>.</p>
    pub subscription_status: ::std::option::Option<crate::types::SubscriptionStatus>,
}
impl TopicPreference {
    /// <p>The name of the topic.</p>
    pub fn topic_name(&self) -> ::std::option::Option<&str> {
        self.topic_name.as_deref()
    }
    /// <p>The contact's subscription status to a topic which is either <code>OPT_IN</code> or <code>OPT_OUT</code>.</p>
    pub fn subscription_status(&self) -> ::std::option::Option<&crate::types::SubscriptionStatus> {
        self.subscription_status.as_ref()
    }
}
impl TopicPreference {
    /// Creates a new builder-style object to manufacture [`TopicPreference`](crate::types::TopicPreference).
    pub fn builder() -> crate::types::builders::TopicPreferenceBuilder {
        crate::types::builders::TopicPreferenceBuilder::default()
    }
}

/// A builder for [`TopicPreference`](crate::types::TopicPreference).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct TopicPreferenceBuilder {
    pub(crate) topic_name: ::std::option::Option<::std::string::String>,
    pub(crate) subscription_status: ::std::option::Option<crate::types::SubscriptionStatus>,
}
impl TopicPreferenceBuilder {
    /// <p>The name of the topic.</p>
    pub fn topic_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.topic_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the topic.</p>
    pub fn set_topic_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.topic_name = input;
        self
    }
    /// <p>The name of the topic.</p>
    pub fn get_topic_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.topic_name
    }
    /// <p>The contact's subscription status to a topic which is either <code>OPT_IN</code> or <code>OPT_OUT</code>.</p>
    pub fn subscription_status(mut self, input: crate::types::SubscriptionStatus) -> Self {
        self.subscription_status = ::std::option::Option::Some(input);
        self
    }
    /// <p>The contact's subscription status to a topic which is either <code>OPT_IN</code> or <code>OPT_OUT</code>.</p>
    pub fn set_subscription_status(mut self, input: ::std::option::Option<crate::types::SubscriptionStatus>) -> Self {
        self.subscription_status = input;
        self
    }
    /// <p>The contact's subscription status to a topic which is either <code>OPT_IN</code> or <code>OPT_OUT</code>.</p>
    pub fn get_subscription_status(&self) -> &::std::option::Option<crate::types::SubscriptionStatus> {
        &self.subscription_status
    }
    /// Consumes the builder and constructs a [`TopicPreference`](crate::types::TopicPreference).
    pub fn build(self) -> crate::types::TopicPreference {
        crate::types::TopicPreference {
            topic_name: self.topic_name,
            subscription_status: self.subscription_status,
        }
    }
}