aws_sdk_dynamodb/operation/put_resource_policy/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_resource_policy::_put_resource_policy_output::PutResourcePolicyOutputBuilder;
3
4pub use crate::operation::put_resource_policy::_put_resource_policy_input::PutResourcePolicyInputBuilder;
5
6impl crate::operation::put_resource_policy::builders::PutResourcePolicyInputBuilder {
7                    /// Sends a request with this input using the given client.
8                    pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result<
9                        crate::operation::put_resource_policy::PutResourcePolicyOutput,
10                        ::aws_smithy_runtime_api::client::result::SdkError<
11                            crate::operation::put_resource_policy::PutResourcePolicyError,
12                            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse
13                        >
14                    > {
15                        let mut fluent_builder = client.put_resource_policy();
16                        fluent_builder.inner = self;
17                        fluent_builder.send().await
18                    }
19                }
20/// Fluent builder constructing a request to `PutResourcePolicy`.
21/// 
22/// <p>Attaches a resource-based policy document to the resource, which can be a table or stream. When you attach a resource-based policy using this API, the policy application is <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html"> <i>eventually consistent</i> </a>.</p>
23/// <p><code>PutResourcePolicy</code> is an idempotent operation; running it multiple times on the same resource using the same policy document will return the same revision ID. If you specify an <code>ExpectedRevisionId</code> that doesn't match the current policy's <code>RevisionId</code>, the <code>PolicyNotFoundException</code> will be returned.</p><note>
24/// <p><code>PutResourcePolicy</code> is an asynchronous operation. If you issue a <code>GetResourcePolicy</code> request immediately after a <code>PutResourcePolicy</code> request, DynamoDB might return your previous policy, if there was one, or return the <code>PolicyNotFoundException</code>. This is because <code>GetResourcePolicy</code> uses an eventually consistent query, and the metadata for your policy or table might not be available at that moment. Wait for a few seconds, and then try the <code>GetResourcePolicy</code> request again.</p>
25/// </note>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct PutResourcePolicyFluentBuilder {
28                handle: ::std::sync::Arc<crate::client::Handle>,
29                inner: crate::operation::put_resource_policy::builders::PutResourcePolicyInputBuilder,
30config_override: ::std::option::Option<crate::config::Builder>,
31            }
32impl
33                crate::client::customize::internal::CustomizableSend<
34                    crate::operation::put_resource_policy::PutResourcePolicyOutput,
35                    crate::operation::put_resource_policy::PutResourcePolicyError,
36                > for PutResourcePolicyFluentBuilder
37            {
38                fn send(
39                    self,
40                    config_override: crate::config::Builder,
41                ) -> crate::client::customize::internal::BoxFuture<
42                    crate::client::customize::internal::SendResult<
43                        crate::operation::put_resource_policy::PutResourcePolicyOutput,
44                        crate::operation::put_resource_policy::PutResourcePolicyError,
45                    >,
46                > {
47                    ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48                }
49            }
50impl PutResourcePolicyFluentBuilder {
51    /// Creates a new `PutResourcePolicyFluentBuilder`.
52                    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53                        Self {
54                            handle,
55                            inner: ::std::default::Default::default(),
56    config_override: ::std::option::Option::None,
57                        }
58                    }
59    /// Access the PutResourcePolicy as a reference.
60                    pub fn as_input(&self) -> &crate::operation::put_resource_policy::builders::PutResourcePolicyInputBuilder {
61                        &self.inner
62                    }
63    /// Sends the request and returns the response.
64                    ///
65                    /// If an error occurs, an `SdkError` will be returned with additional details that
66                    /// can be matched against.
67                    ///
68                    /// By default, any retryable failures will be retried twice. Retry behavior
69                    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70                    /// set when configuring the client.
71                    pub async fn send(self) -> ::std::result::Result<crate::operation::put_resource_policy::PutResourcePolicyOutput, ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::put_resource_policy::PutResourcePolicyError, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> {
72                        let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
73                        let runtime_plugins = crate::operation::put_resource_policy::PutResourcePolicy::operation_runtime_plugins(
74                            self.handle.runtime_plugins.clone(),
75                            &self.handle.conf,
76                            self.config_override,
77                        );
78                        crate::operation::put_resource_policy::PutResourcePolicy::orchestrate(&runtime_plugins, input).await
79                    }
80    
81                    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
82                    pub fn customize(
83                        self,
84                    ) -> crate::client::customize::CustomizableOperation<crate::operation::put_resource_policy::PutResourcePolicyOutput, crate::operation::put_resource_policy::PutResourcePolicyError, Self> {
85                        crate::client::customize::CustomizableOperation::new(self)
86                    }
87    pub(crate) fn config_override(
88                            mut self,
89                            config_override: impl ::std::convert::Into<crate::config::Builder>,
90                        ) -> Self {
91                            self.set_config_override(::std::option::Option::Some(config_override.into()));
92                            self
93                        }
94    
95                        pub(crate) fn set_config_override(
96                            &mut self,
97                            config_override: ::std::option::Option<crate::config::Builder>,
98                        ) -> &mut Self {
99                            self.config_override = config_override;
100                            self
101                        }
102    /// <p>The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached. The resources you can specify include tables and streams.</p>
103    /// <p>You can control index permissions using the base table's policy. To specify the same permission level for your table and its indexes, you can provide both the table and index Amazon Resource Name (ARN)s in the <code>Resource</code> field of a given <code>Statement</code> in your policy document. Alternatively, to specify different permissions for your table, indexes, or both, you can define multiple <code>Statement</code> fields in your policy document.</p>
104    pub fn resource_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
105                    self.inner = self.inner.resource_arn(input.into());
106                    self
107                }
108    /// <p>The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached. The resources you can specify include tables and streams.</p>
109    /// <p>You can control index permissions using the base table's policy. To specify the same permission level for your table and its indexes, you can provide both the table and index Amazon Resource Name (ARN)s in the <code>Resource</code> field of a given <code>Statement</code> in your policy document. Alternatively, to specify different permissions for your table, indexes, or both, you can define multiple <code>Statement</code> fields in your policy document.</p>
110    pub fn set_resource_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
111                    self.inner = self.inner.set_resource_arn(input);
112                    self
113                }
114    /// <p>The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached. The resources you can specify include tables and streams.</p>
115    /// <p>You can control index permissions using the base table's policy. To specify the same permission level for your table and its indexes, you can provide both the table and index Amazon Resource Name (ARN)s in the <code>Resource</code> field of a given <code>Statement</code> in your policy document. Alternatively, to specify different permissions for your table, indexes, or both, you can define multiple <code>Statement</code> fields in your policy document.</p>
116    pub fn get_resource_arn(&self) -> &::std::option::Option<::std::string::String> {
117                    self.inner.get_resource_arn()
118                }
119    /// <p>An Amazon Web Services resource-based policy document in JSON format.</p>
120    /// <ul>
121    /// <li>
122    /// <p>The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit.</p></li>
123    /// <li>
124    /// <p>Within a resource-based policy, if the action for a DynamoDB service-linked role (SLR) to replicate data for a global table is denied, adding or deleting a replica will fail with an error.</p></li>
125    /// </ul>
126    /// <p>For a full list of all considerations that apply while attaching a resource-based policy, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/rbac-considerations.html">Resource-based policy considerations</a>.</p>
127    pub fn policy(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128                    self.inner = self.inner.policy(input.into());
129                    self
130                }
131    /// <p>An Amazon Web Services resource-based policy document in JSON format.</p>
132    /// <ul>
133    /// <li>
134    /// <p>The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit.</p></li>
135    /// <li>
136    /// <p>Within a resource-based policy, if the action for a DynamoDB service-linked role (SLR) to replicate data for a global table is denied, adding or deleting a replica will fail with an error.</p></li>
137    /// </ul>
138    /// <p>For a full list of all considerations that apply while attaching a resource-based policy, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/rbac-considerations.html">Resource-based policy considerations</a>.</p>
139    pub fn set_policy(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140                    self.inner = self.inner.set_policy(input);
141                    self
142                }
143    /// <p>An Amazon Web Services resource-based policy document in JSON format.</p>
144    /// <ul>
145    /// <li>
146    /// <p>The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit.</p></li>
147    /// <li>
148    /// <p>Within a resource-based policy, if the action for a DynamoDB service-linked role (SLR) to replicate data for a global table is denied, adding or deleting a replica will fail with an error.</p></li>
149    /// </ul>
150    /// <p>For a full list of all considerations that apply while attaching a resource-based policy, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/rbac-considerations.html">Resource-based policy considerations</a>.</p>
151    pub fn get_policy(&self) -> &::std::option::Option<::std::string::String> {
152                    self.inner.get_policy()
153                }
154    /// <p>A string value that you can use to conditionally update your policy. You can provide the revision ID of your existing policy to make mutating requests against that policy.</p><note>
155    /// <p>When you provide an expected revision ID, if the revision ID of the existing policy on the resource doesn't match or if there's no policy attached to the resource, your request will be rejected with a <code>PolicyNotFoundException</code>.</p>
156    /// </note>
157    /// <p>To conditionally attach a policy when no policy exists for the resource, specify <code>NO_POLICY</code> for the revision ID.</p>
158    pub fn expected_revision_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
159                    self.inner = self.inner.expected_revision_id(input.into());
160                    self
161                }
162    /// <p>A string value that you can use to conditionally update your policy. You can provide the revision ID of your existing policy to make mutating requests against that policy.</p><note>
163    /// <p>When you provide an expected revision ID, if the revision ID of the existing policy on the resource doesn't match or if there's no policy attached to the resource, your request will be rejected with a <code>PolicyNotFoundException</code>.</p>
164    /// </note>
165    /// <p>To conditionally attach a policy when no policy exists for the resource, specify <code>NO_POLICY</code> for the revision ID.</p>
166    pub fn set_expected_revision_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
167                    self.inner = self.inner.set_expected_revision_id(input);
168                    self
169                }
170    /// <p>A string value that you can use to conditionally update your policy. You can provide the revision ID of your existing policy to make mutating requests against that policy.</p><note>
171    /// <p>When you provide an expected revision ID, if the revision ID of the existing policy on the resource doesn't match or if there's no policy attached to the resource, your request will be rejected with a <code>PolicyNotFoundException</code>.</p>
172    /// </note>
173    /// <p>To conditionally attach a policy when no policy exists for the resource, specify <code>NO_POLICY</code> for the revision ID.</p>
174    pub fn get_expected_revision_id(&self) -> &::std::option::Option<::std::string::String> {
175                    self.inner.get_expected_revision_id()
176                }
177    /// <p>Set this parameter to <code>true</code> to confirm that you want to remove your permissions to change the policy of this resource in the future.</p>
178    pub fn confirm_remove_self_resource_access(mut self, input: bool) -> Self {
179                    self.inner = self.inner.confirm_remove_self_resource_access(input);
180                    self
181                }
182    /// <p>Set this parameter to <code>true</code> to confirm that you want to remove your permissions to change the policy of this resource in the future.</p>
183    pub fn set_confirm_remove_self_resource_access(mut self, input: ::std::option::Option<bool>) -> Self {
184                    self.inner = self.inner.set_confirm_remove_self_resource_access(input);
185                    self
186                }
187    /// <p>Set this parameter to <code>true</code> to confirm that you want to remove your permissions to change the policy of this resource in the future.</p>
188    pub fn get_confirm_remove_self_resource_access(&self) -> &::std::option::Option<bool> {
189                    self.inner.get_confirm_remove_self_resource_access()
190                }
191}
192