aws_sdk_sns/operation/add_permission/_add_permission_input.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct AddPermissionInput {
6 /// <p>The ARN of the topic whose access control policy you wish to modify.</p>
7 pub topic_arn: ::std::option::Option<::std::string::String>,
8 /// <p>A unique identifier for the new policy statement.</p>
9 pub label: ::std::option::Option<::std::string::String>,
10 /// <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>
11 pub aws_account_id: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
12 /// <p>The action you want to allow for the specified principal(s).</p>
13 /// <p>Valid values: Any Amazon SNS action name, for example <code>Publish</code>.</p>
14 pub action_name: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
15}
16impl AddPermissionInput {
17 /// <p>The ARN of the topic whose access control policy you wish to modify.</p>
18 pub fn topic_arn(&self) -> ::std::option::Option<&str> {
19 self.topic_arn.as_deref()
20 }
21 /// <p>A unique identifier for the new policy statement.</p>
22 pub fn label(&self) -> ::std::option::Option<&str> {
23 self.label.as_deref()
24 }
25 /// <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>
26 ///
27 /// 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()`.
28 pub fn aws_account_id(&self) -> &[::std::string::String] {
29 self.aws_account_id.as_deref().unwrap_or_default()
30 }
31 /// <p>The action you want to allow for the specified principal(s).</p>
32 /// <p>Valid values: Any Amazon SNS action name, for example <code>Publish</code>.</p>
33 ///
34 /// 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()`.
35 pub fn action_name(&self) -> &[::std::string::String] {
36 self.action_name.as_deref().unwrap_or_default()
37 }
38}
39impl AddPermissionInput {
40 /// Creates a new builder-style object to manufacture [`AddPermissionInput`](crate::operation::add_permission::AddPermissionInput).
41 pub fn builder() -> crate::operation::add_permission::builders::AddPermissionInputBuilder {
42 crate::operation::add_permission::builders::AddPermissionInputBuilder::default()
43 }
44}
45
46/// A builder for [`AddPermissionInput`](crate::operation::add_permission::AddPermissionInput).
47#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
48#[non_exhaustive]
49pub struct AddPermissionInputBuilder {
50 pub(crate) topic_arn: ::std::option::Option<::std::string::String>,
51 pub(crate) label: ::std::option::Option<::std::string::String>,
52 pub(crate) aws_account_id: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
53 pub(crate) action_name: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
54}
55impl AddPermissionInputBuilder {
56 /// <p>The ARN of the topic whose access control policy you wish to modify.</p>
57 /// This field is required.
58 pub fn topic_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
59 self.topic_arn = ::std::option::Option::Some(input.into());
60 self
61 }
62 /// <p>The ARN of the topic whose access control policy you wish to modify.</p>
63 pub fn set_topic_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
64 self.topic_arn = input;
65 self
66 }
67 /// <p>The ARN of the topic whose access control policy you wish to modify.</p>
68 pub fn get_topic_arn(&self) -> &::std::option::Option<::std::string::String> {
69 &self.topic_arn
70 }
71 /// <p>A unique identifier for the new policy statement.</p>
72 /// This field is required.
73 pub fn label(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
74 self.label = ::std::option::Option::Some(input.into());
75 self
76 }
77 /// <p>A unique identifier for the new policy statement.</p>
78 pub fn set_label(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
79 self.label = input;
80 self
81 }
82 /// <p>A unique identifier for the new policy statement.</p>
83 pub fn get_label(&self) -> &::std::option::Option<::std::string::String> {
84 &self.label
85 }
86 /// Appends an item to `aws_account_id`.
87 ///
88 /// To override the contents of this collection use [`set_aws_account_id`](Self::set_aws_account_id).
89 ///
90 /// <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>
91 pub fn aws_account_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
92 let mut v = self.aws_account_id.unwrap_or_default();
93 v.push(input.into());
94 self.aws_account_id = ::std::option::Option::Some(v);
95 self
96 }
97 /// <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>
98 pub fn set_aws_account_id(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
99 self.aws_account_id = input;
100 self
101 }
102 /// <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>
103 pub fn get_aws_account_id(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
104 &self.aws_account_id
105 }
106 /// Appends an item to `action_name`.
107 ///
108 /// To override the contents of this collection use [`set_action_name`](Self::set_action_name).
109 ///
110 /// <p>The action you want to allow for the specified principal(s).</p>
111 /// <p>Valid values: Any Amazon SNS action name, for example <code>Publish</code>.</p>
112 pub fn action_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113 let mut v = self.action_name.unwrap_or_default();
114 v.push(input.into());
115 self.action_name = ::std::option::Option::Some(v);
116 self
117 }
118 /// <p>The action you want to allow for the specified principal(s).</p>
119 /// <p>Valid values: Any Amazon SNS action name, for example <code>Publish</code>.</p>
120 pub fn set_action_name(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
121 self.action_name = input;
122 self
123 }
124 /// <p>The action you want to allow for the specified principal(s).</p>
125 /// <p>Valid values: Any Amazon SNS action name, for example <code>Publish</code>.</p>
126 pub fn get_action_name(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
127 &self.action_name
128 }
129 /// Consumes the builder and constructs a [`AddPermissionInput`](crate::operation::add_permission::AddPermissionInput).
130 pub fn build(
131 self,
132 ) -> ::std::result::Result<crate::operation::add_permission::AddPermissionInput, ::aws_smithy_types::error::operation::BuildError> {
133 ::std::result::Result::Ok(crate::operation::add_permission::AddPermissionInput {
134 topic_arn: self.topic_arn,
135 label: self.label,
136 aws_account_id: self.aws_account_id,
137 action_name: self.action_name,
138 })
139 }
140}