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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct AddPermissionInput {
    /// <p>The ARN of the topic whose access control policy you wish to modify.</p>
    pub topic_arn: ::std::option::Option<::std::string::String>,
    /// <p>A unique identifier for the new policy statement.</p>
    pub label: ::std::option::Option<::std::string::String>,
    /// <p>The Amazon Web Services account IDs of the users (principals) who will be given access to the specified actions. The users must have Amazon Web Services account, but do not need to be signed up for this service.</p>
    pub aws_account_id: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    /// <p>The action you want to allow for the specified principal(s).</p>
    /// <p>Valid values: Any Amazon SNS action name, for example <code>Publish</code>.</p>
    pub action_name: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl AddPermissionInput {
    /// <p>The ARN of the topic whose access control policy you wish to modify.</p>
    pub fn topic_arn(&self) -> ::std::option::Option<&str> {
        self.topic_arn.as_deref()
    }
    /// <p>A unique identifier for the new policy statement.</p>
    pub fn label(&self) -> ::std::option::Option<&str> {
        self.label.as_deref()
    }
    /// <p>The Amazon Web Services account IDs of the users (principals) who will be given access to the specified actions. The users must have Amazon Web Services account, but do not need to be signed up for this service.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.aws_account_id.is_none()`.
    pub fn aws_account_id(&self) -> &[::std::string::String] {
        self.aws_account_id.as_deref().unwrap_or_default()
    }
    /// <p>The action you want to allow for the specified principal(s).</p>
    /// <p>Valid values: Any Amazon SNS action name, for example <code>Publish</code>.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.action_name.is_none()`.
    pub fn action_name(&self) -> &[::std::string::String] {
        self.action_name.as_deref().unwrap_or_default()
    }
}
impl AddPermissionInput {
    /// Creates a new builder-style object to manufacture [`AddPermissionInput`](crate::operation::add_permission::AddPermissionInput).
    pub fn builder() -> crate::operation::add_permission::builders::AddPermissionInputBuilder {
        crate::operation::add_permission::builders::AddPermissionInputBuilder::default()
    }
}

/// A builder for [`AddPermissionInput`](crate::operation::add_permission::AddPermissionInput).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct AddPermissionInputBuilder {
    pub(crate) topic_arn: ::std::option::Option<::std::string::String>,
    pub(crate) label: ::std::option::Option<::std::string::String>,
    pub(crate) aws_account_id: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) action_name: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl AddPermissionInputBuilder {
    /// <p>The ARN of the topic whose access control policy you wish to modify.</p>
    /// This field is required.
    pub fn topic_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.topic_arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The ARN of the topic whose access control policy you wish to modify.</p>
    pub fn set_topic_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.topic_arn = input;
        self
    }
    /// <p>The ARN of the topic whose access control policy you wish to modify.</p>
    pub fn get_topic_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.topic_arn
    }
    /// <p>A unique identifier for the new policy statement.</p>
    /// This field is required.
    pub fn label(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.label = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A unique identifier for the new policy statement.</p>
    pub fn set_label(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.label = input;
        self
    }
    /// <p>A unique identifier for the new policy statement.</p>
    pub fn get_label(&self) -> &::std::option::Option<::std::string::String> {
        &self.label
    }
    /// Appends an item to `aws_account_id`.
    ///
    /// To override the contents of this collection use [`set_aws_account_id`](Self::set_aws_account_id).
    ///
    /// <p>The Amazon Web Services account IDs of the users (principals) who will be given access to the specified actions. The users must have Amazon Web Services account, but do not need to be signed up for this service.</p>
    pub fn aws_account_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.aws_account_id.unwrap_or_default();
        v.push(input.into());
        self.aws_account_id = ::std::option::Option::Some(v);
        self
    }
    /// <p>The Amazon Web Services account IDs of the users (principals) who will be given access to the specified actions. The users must have Amazon Web Services account, but do not need to be signed up for this service.</p>
    pub fn set_aws_account_id(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.aws_account_id = input;
        self
    }
    /// <p>The Amazon Web Services account IDs of the users (principals) who will be given access to the specified actions. The users must have Amazon Web Services account, but do not need to be signed up for this service.</p>
    pub fn get_aws_account_id(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.aws_account_id
    }
    /// Appends an item to `action_name`.
    ///
    /// To override the contents of this collection use [`set_action_name`](Self::set_action_name).
    ///
    /// <p>The action you want to allow for the specified principal(s).</p>
    /// <p>Valid values: Any Amazon SNS action name, for example <code>Publish</code>.</p>
    pub fn action_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.action_name.unwrap_or_default();
        v.push(input.into());
        self.action_name = ::std::option::Option::Some(v);
        self
    }
    /// <p>The action you want to allow for the specified principal(s).</p>
    /// <p>Valid values: Any Amazon SNS action name, for example <code>Publish</code>.</p>
    pub fn set_action_name(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.action_name = input;
        self
    }
    /// <p>The action you want to allow for the specified principal(s).</p>
    /// <p>Valid values: Any Amazon SNS action name, for example <code>Publish</code>.</p>
    pub fn get_action_name(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.action_name
    }
    /// Consumes the builder and constructs a [`AddPermissionInput`](crate::operation::add_permission::AddPermissionInput).
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::add_permission::AddPermissionInput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::add_permission::AddPermissionInput {
            topic_arn: self.topic_arn,
            label: self.label,
            aws_account_id: self.aws_account_id,
            action_name: self.action_name,
        })
    }
}