aws_sdk_sqs/operation/add_permission/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::add_permission::_add_permission_output::AddPermissionOutputBuilder;
3
4pub use crate::operation::add_permission::_add_permission_input::AddPermissionInputBuilder;
5
6impl crate::operation::add_permission::builders::AddPermissionInputBuilder {
7 /// Sends a request with this input using the given client.
8 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::add_permission::AddPermissionOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::add_permission::AddPermissionError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.add_permission();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `AddPermission`.
24///
25/// <p>Adds a permission to a queue for a specific <a href="https://docs.aws.amazon.com/general/latest/gr/glos-chap.html#P">principal</a>. This allows sharing access to the queue.</p>
26/// <p>When you create a queue, you have full control access rights for the queue. Only you, the owner of the queue, can grant or deny permissions to the queue. For more information about these permissions, see <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-writing-an-sqs-policy.html#write-messages-to-shared-queue">Allow Developers to Write Messages to a Shared Queue</a> in the <i>Amazon SQS Developer Guide</i>.</p><note>
27/// <ul>
28/// <li>
29/// <p><code>AddPermission</code> generates a policy for you. You can use <code> <code>SetQueueAttributes</code> </code> to upload your policy. For more information, see <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-creating-custom-policies.html">Using Custom Policies with the Amazon SQS Access Policy Language</a> in the <i>Amazon SQS Developer Guide</i>.</p></li>
30/// <li>
31/// <p>An Amazon SQS policy can have a maximum of seven actions per statement.</p></li>
32/// <li>
33/// <p>To remove the ability to change queue permissions, you must deny permission to the <code>AddPermission</code>, <code>RemovePermission</code>, and <code>SetQueueAttributes</code> actions in your IAM policy.</p></li>
34/// <li>
35/// <p>Amazon SQS <code>AddPermission</code> does not support adding a non-account principal.</p></li>
36/// </ul>
37/// </note> <note>
38/// <p>Cross-account permissions don't apply to this action. For more information, see <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-customer-managed-policy-examples.html#grant-cross-account-permissions-to-role-and-user-name">Grant cross-account permissions to a role and a username</a> in the <i>Amazon SQS Developer Guide</i>.</p>
39/// </note>
40#[derive(::std::clone::Clone, ::std::fmt::Debug)]
41pub struct AddPermissionFluentBuilder {
42 handle: ::std::sync::Arc<crate::client::Handle>,
43 inner: crate::operation::add_permission::builders::AddPermissionInputBuilder,
44 config_override: ::std::option::Option<crate::config::Builder>,
45}
46impl
47 crate::client::customize::internal::CustomizableSend<
48 crate::operation::add_permission::AddPermissionOutput,
49 crate::operation::add_permission::AddPermissionError,
50 > for AddPermissionFluentBuilder
51{
52 fn send(
53 self,
54 config_override: crate::config::Builder,
55 ) -> crate::client::customize::internal::BoxFuture<
56 crate::client::customize::internal::SendResult<
57 crate::operation::add_permission::AddPermissionOutput,
58 crate::operation::add_permission::AddPermissionError,
59 >,
60 > {
61 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
62 }
63}
64impl AddPermissionFluentBuilder {
65 /// Creates a new `AddPermissionFluentBuilder`.
66 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
67 Self {
68 handle,
69 inner: ::std::default::Default::default(),
70 config_override: ::std::option::Option::None,
71 }
72 }
73 /// Access the AddPermission as a reference.
74 pub fn as_input(&self) -> &crate::operation::add_permission::builders::AddPermissionInputBuilder {
75 &self.inner
76 }
77 /// Sends the request and returns the response.
78 ///
79 /// If an error occurs, an `SdkError` will be returned with additional details that
80 /// can be matched against.
81 ///
82 /// By default, any retryable failures will be retried twice. Retry behavior
83 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
84 /// set when configuring the client.
85 pub async fn send(
86 self,
87 ) -> ::std::result::Result<
88 crate::operation::add_permission::AddPermissionOutput,
89 ::aws_smithy_runtime_api::client::result::SdkError<
90 crate::operation::add_permission::AddPermissionError,
91 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
92 >,
93 > {
94 let input = self
95 .inner
96 .build()
97 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
98 let runtime_plugins = crate::operation::add_permission::AddPermission::operation_runtime_plugins(
99 self.handle.runtime_plugins.clone(),
100 &self.handle.conf,
101 self.config_override,
102 );
103 crate::operation::add_permission::AddPermission::orchestrate(&runtime_plugins, input).await
104 }
105
106 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
107 pub fn customize(
108 self,
109 ) -> crate::client::customize::CustomizableOperation<
110 crate::operation::add_permission::AddPermissionOutput,
111 crate::operation::add_permission::AddPermissionError,
112 Self,
113 > {
114 crate::client::customize::CustomizableOperation::new(self)
115 }
116 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
117 self.set_config_override(::std::option::Option::Some(config_override.into()));
118 self
119 }
120
121 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
122 self.config_override = config_override;
123 self
124 }
125 /// <p>The URL of the Amazon SQS queue to which permissions are added.</p>
126 /// <p>Queue URLs and names are case-sensitive.</p>
127 pub fn queue_url(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128 self.inner = self.inner.queue_url(input.into());
129 self
130 }
131 /// <p>The URL of the Amazon SQS queue to which permissions are added.</p>
132 /// <p>Queue URLs and names are case-sensitive.</p>
133 pub fn set_queue_url(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
134 self.inner = self.inner.set_queue_url(input);
135 self
136 }
137 /// <p>The URL of the Amazon SQS queue to which permissions are added.</p>
138 /// <p>Queue URLs and names are case-sensitive.</p>
139 pub fn get_queue_url(&self) -> &::std::option::Option<::std::string::String> {
140 self.inner.get_queue_url()
141 }
142 /// <p>The unique identification of the permission you're setting (for example, <code>AliceSendMessage</code>). Maximum 80 characters. Allowed characters include alphanumeric characters, hyphens (<code>-</code>), and underscores (<code>_</code>).</p>
143 pub fn label(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
144 self.inner = self.inner.label(input.into());
145 self
146 }
147 /// <p>The unique identification of the permission you're setting (for example, <code>AliceSendMessage</code>). Maximum 80 characters. Allowed characters include alphanumeric characters, hyphens (<code>-</code>), and underscores (<code>_</code>).</p>
148 pub fn set_label(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
149 self.inner = self.inner.set_label(input);
150 self
151 }
152 /// <p>The unique identification of the permission you're setting (for example, <code>AliceSendMessage</code>). Maximum 80 characters. Allowed characters include alphanumeric characters, hyphens (<code>-</code>), and underscores (<code>_</code>).</p>
153 pub fn get_label(&self) -> &::std::option::Option<::std::string::String> {
154 self.inner.get_label()
155 }
156 ///
157 /// Appends an item to `AWSAccountIds`.
158 ///
159 /// To override the contents of this collection use [`set_aws_account_ids`](Self::set_aws_account_ids).
160 ///
161 /// <p>The Amazon Web Services account numbers of the <a href="https://docs.aws.amazon.com/general/latest/gr/glos-chap.html#P">principals</a> who are to receive permission. For information about locating the Amazon Web Services account identification, see <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-making-api-requests.html#sqs-api-request-authentication">Your Amazon Web Services Identifiers</a> in the <i>Amazon SQS Developer Guide</i>.</p>
162 pub fn aws_account_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
163 self.inner = self.inner.aws_account_ids(input.into());
164 self
165 }
166 /// <p>The Amazon Web Services account numbers of the <a href="https://docs.aws.amazon.com/general/latest/gr/glos-chap.html#P">principals</a> who are to receive permission. For information about locating the Amazon Web Services account identification, see <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-making-api-requests.html#sqs-api-request-authentication">Your Amazon Web Services Identifiers</a> in the <i>Amazon SQS Developer Guide</i>.</p>
167 pub fn set_aws_account_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
168 self.inner = self.inner.set_aws_account_ids(input);
169 self
170 }
171 /// <p>The Amazon Web Services account numbers of the <a href="https://docs.aws.amazon.com/general/latest/gr/glos-chap.html#P">principals</a> who are to receive permission. For information about locating the Amazon Web Services account identification, see <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-making-api-requests.html#sqs-api-request-authentication">Your Amazon Web Services Identifiers</a> in the <i>Amazon SQS Developer Guide</i>.</p>
172 pub fn get_aws_account_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
173 self.inner.get_aws_account_ids()
174 }
175 ///
176 /// Appends an item to `Actions`.
177 ///
178 /// To override the contents of this collection use [`set_actions`](Self::set_actions).
179 ///
180 /// <p>The action the client wants to allow for the specified principal. Valid values: the name of any action or <code>*</code>.</p>
181 /// <p>For more information about these actions, see <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-overview-of-managing-access.html">Overview of Managing Access Permissions to Your Amazon Simple Queue Service Resource</a> in the <i>Amazon SQS Developer Guide</i>.</p>
182 /// <p>Specifying <code>SendMessage</code>, <code>DeleteMessage</code>, or <code>ChangeMessageVisibility</code> for <code>ActionName.n</code> also grants permissions for the corresponding batch versions of those actions: <code>SendMessageBatch</code>, <code>DeleteMessageBatch</code>, and <code>ChangeMessageVisibilityBatch</code>.</p>
183 pub fn actions(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
184 self.inner = self.inner.actions(input.into());
185 self
186 }
187 /// <p>The action the client wants to allow for the specified principal. Valid values: the name of any action or <code>*</code>.</p>
188 /// <p>For more information about these actions, see <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-overview-of-managing-access.html">Overview of Managing Access Permissions to Your Amazon Simple Queue Service Resource</a> in the <i>Amazon SQS Developer Guide</i>.</p>
189 /// <p>Specifying <code>SendMessage</code>, <code>DeleteMessage</code>, or <code>ChangeMessageVisibility</code> for <code>ActionName.n</code> also grants permissions for the corresponding batch versions of those actions: <code>SendMessageBatch</code>, <code>DeleteMessageBatch</code>, and <code>ChangeMessageVisibilityBatch</code>.</p>
190 pub fn set_actions(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
191 self.inner = self.inner.set_actions(input);
192 self
193 }
194 /// <p>The action the client wants to allow for the specified principal. Valid values: the name of any action or <code>*</code>.</p>
195 /// <p>For more information about these actions, see <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-overview-of-managing-access.html">Overview of Managing Access Permissions to Your Amazon Simple Queue Service Resource</a> in the <i>Amazon SQS Developer Guide</i>.</p>
196 /// <p>Specifying <code>SendMessage</code>, <code>DeleteMessage</code>, or <code>ChangeMessageVisibility</code> for <code>ActionName.n</code> also grants permissions for the corresponding batch versions of those actions: <code>SendMessageBatch</code>, <code>DeleteMessageBatch</code>, and <code>ChangeMessageVisibilityBatch</code>.</p>
197 pub fn get_actions(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
198 self.inner.get_actions()
199 }
200}