aws_sdk_dynamodb/operation/get_resource_policy/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_resource_policy::_get_resource_policy_output::GetResourcePolicyOutputBuilder;
3
4pub use crate::operation::get_resource_policy::_get_resource_policy_input::GetResourcePolicyInputBuilder;
5
6impl crate::operation::get_resource_policy::builders::GetResourcePolicyInputBuilder {
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::get_resource_policy::GetResourcePolicyOutput,
10 ::aws_smithy_runtime_api::client::result::SdkError<
11 crate::operation::get_resource_policy::GetResourcePolicyError,
12 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse
13 >
14 > {
15 let mut fluent_builder = client.get_resource_policy();
16 fluent_builder.inner = self;
17 fluent_builder.send().await
18 }
19 }
20/// Fluent builder constructing a request to `GetResourcePolicy`.
21///
22/// <p>Returns the resource-based policy document attached to the resource, which can be a table or stream, in JSON format.</p>
23/// <p><code>GetResourcePolicy</code> follows an <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html"> <i>eventually consistent</i> </a> model. The following list describes the outcomes when you issue the <code>GetResourcePolicy</code> request immediately after issuing another request:</p>
24/// <ul>
25/// <li>
26/// <p>If you issue a <code>GetResourcePolicy</code> request immediately after a <code>PutResourcePolicy</code> request, DynamoDB might return a <code>PolicyNotFoundException</code>.</p></li>
27/// <li>
28/// <p>If you issue a <code>GetResourcePolicy</code>request immediately after a <code>DeleteResourcePolicy</code> request, DynamoDB might return the policy that was present before the deletion request.</p></li>
29/// <li>
30/// <p>If you issue a <code>GetResourcePolicy</code> request immediately after a <code>CreateTable</code> request, which includes a resource-based policy, DynamoDB might return a <code>ResourceNotFoundException</code> or a <code>PolicyNotFoundException</code>.</p></li>
31/// </ul>
32/// <p>Because <code>GetResourcePolicy</code> uses an <i>eventually consistent</i> query, the metadata for your policy or table might not be available at that moment. Wait for a few seconds, and then retry the <code>GetResourcePolicy</code> request.</p>
33/// <p>After a <code>GetResourcePolicy</code> request returns a policy created using the <code>PutResourcePolicy</code> request, the policy will be applied in the authorization of requests to the resource. Because this process is eventually consistent, it will take some time to apply the policy to all requests to a resource. Policies that you attach while creating a table using the <code>CreateTable</code> request will always be applied to all requests for that table.</p>
34#[derive(::std::clone::Clone, ::std::fmt::Debug)]
35pub struct GetResourcePolicyFluentBuilder {
36 handle: ::std::sync::Arc<crate::client::Handle>,
37 inner: crate::operation::get_resource_policy::builders::GetResourcePolicyInputBuilder,
38config_override: ::std::option::Option<crate::config::Builder>,
39 }
40impl
41 crate::client::customize::internal::CustomizableSend<
42 crate::operation::get_resource_policy::GetResourcePolicyOutput,
43 crate::operation::get_resource_policy::GetResourcePolicyError,
44 > for GetResourcePolicyFluentBuilder
45 {
46 fn send(
47 self,
48 config_override: crate::config::Builder,
49 ) -> crate::client::customize::internal::BoxFuture<
50 crate::client::customize::internal::SendResult<
51 crate::operation::get_resource_policy::GetResourcePolicyOutput,
52 crate::operation::get_resource_policy::GetResourcePolicyError,
53 >,
54 > {
55 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
56 }
57 }
58impl GetResourcePolicyFluentBuilder {
59 /// Creates a new `GetResourcePolicyFluentBuilder`.
60 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
61 Self {
62 handle,
63 inner: ::std::default::Default::default(),
64 config_override: ::std::option::Option::None,
65 }
66 }
67 /// Access the GetResourcePolicy as a reference.
68 pub fn as_input(&self) -> &crate::operation::get_resource_policy::builders::GetResourcePolicyInputBuilder {
69 &self.inner
70 }
71 /// Sends the request and returns the response.
72 ///
73 /// If an error occurs, an `SdkError` will be returned with additional details that
74 /// can be matched against.
75 ///
76 /// By default, any retryable failures will be retried twice. Retry behavior
77 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
78 /// set when configuring the client.
79 pub async fn send(self) -> ::std::result::Result<crate::operation::get_resource_policy::GetResourcePolicyOutput, ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_resource_policy::GetResourcePolicyError, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> {
80 let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
81 let runtime_plugins = crate::operation::get_resource_policy::GetResourcePolicy::operation_runtime_plugins(
82 self.handle.runtime_plugins.clone(),
83 &self.handle.conf,
84 self.config_override,
85 );
86 crate::operation::get_resource_policy::GetResourcePolicy::orchestrate(&runtime_plugins, input).await
87 }
88
89 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
90 pub fn customize(
91 self,
92 ) -> crate::client::customize::CustomizableOperation<crate::operation::get_resource_policy::GetResourcePolicyOutput, crate::operation::get_resource_policy::GetResourcePolicyError, Self> {
93 crate::client::customize::CustomizableOperation::new(self)
94 }
95 pub(crate) fn config_override(
96 mut self,
97 config_override: impl ::std::convert::Into<crate::config::Builder>,
98 ) -> Self {
99 self.set_config_override(::std::option::Option::Some(config_override.into()));
100 self
101 }
102
103 pub(crate) fn set_config_override(
104 &mut self,
105 config_override: ::std::option::Option<crate::config::Builder>,
106 ) -> &mut Self {
107 self.config_override = config_override;
108 self
109 }
110 /// <p>The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy is attached. The resources you can specify include tables and streams.</p>
111 pub fn resource_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
112 self.inner = self.inner.resource_arn(input.into());
113 self
114 }
115 /// <p>The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy is attached. The resources you can specify include tables and streams.</p>
116 pub fn set_resource_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
117 self.inner = self.inner.set_resource_arn(input);
118 self
119 }
120 /// <p>The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy is attached. The resources you can specify include tables and streams.</p>
121 pub fn get_resource_arn(&self) -> &::std::option::Option<::std::string::String> {
122 self.inner.get_resource_arn()
123 }
124}
125