aws_sdk_dynamodb/operation/update_time_to_live/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_time_to_live::_update_time_to_live_output::UpdateTimeToLiveOutputBuilder;
3
4pub use crate::operation::update_time_to_live::_update_time_to_live_input::UpdateTimeToLiveInputBuilder;
5
6impl crate::operation::update_time_to_live::builders::UpdateTimeToLiveInputBuilder {
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::update_time_to_live::UpdateTimeToLiveOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::update_time_to_live::UpdateTimeToLiveError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.update_time_to_live();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `UpdateTimeToLive`.
24///
25/// <p>The <code>UpdateTimeToLive</code> method enables or disables Time to Live (TTL) for the specified table. A successful <code>UpdateTimeToLive</code> call returns the current <code>TimeToLiveSpecification</code>. It can take up to one hour for the change to fully process. Any additional <code>UpdateTimeToLive</code> calls for the same table during this one hour duration result in a <code>ValidationException</code>.</p>
26/// <p>TTL compares the current time in epoch time format to the time stored in the TTL attribute of an item. If the epoch time value stored in the attribute is less than the current time, the item is marked as expired and subsequently deleted.</p><note>
27/// <p>The epoch time format is the number of seconds elapsed since 12:00:00 AM January 1, 1970 UTC.</p>
28/// </note>
29/// <p>DynamoDB deletes expired items on a best-effort basis to ensure availability of throughput for other data operations.</p><important>
30/// <p>DynamoDB typically deletes expired items within two days of expiration. The exact duration within which an item gets deleted after expiration is specific to the nature of the workload. Items that have expired and not been deleted will still show up in reads, queries, and scans.</p>
31/// </important>
32/// <p>As items are deleted, they are removed from any local secondary index and global secondary index immediately in the same eventually consistent way as a standard delete operation.</p>
33/// <p>For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/TTL.html">Time To Live</a> in the Amazon DynamoDB Developer Guide.</p>
34#[derive(::std::clone::Clone, ::std::fmt::Debug)]
35pub struct UpdateTimeToLiveFluentBuilder {
36    handle: ::std::sync::Arc<crate::client::Handle>,
37    inner: crate::operation::update_time_to_live::builders::UpdateTimeToLiveInputBuilder,
38    config_override: ::std::option::Option<crate::config::Builder>,
39}
40impl
41    crate::client::customize::internal::CustomizableSend<
42        crate::operation::update_time_to_live::UpdateTimeToLiveOutput,
43        crate::operation::update_time_to_live::UpdateTimeToLiveError,
44    > for UpdateTimeToLiveFluentBuilder
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::update_time_to_live::UpdateTimeToLiveOutput,
52            crate::operation::update_time_to_live::UpdateTimeToLiveError,
53        >,
54    > {
55        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
56    }
57}
58impl UpdateTimeToLiveFluentBuilder {
59    /// Creates a new `UpdateTimeToLiveFluentBuilder`.
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 UpdateTimeToLive as a reference.
68    pub fn as_input(&self) -> &crate::operation::update_time_to_live::builders::UpdateTimeToLiveInputBuilder {
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(
80        self,
81    ) -> ::std::result::Result<
82        crate::operation::update_time_to_live::UpdateTimeToLiveOutput,
83        ::aws_smithy_runtime_api::client::result::SdkError<
84            crate::operation::update_time_to_live::UpdateTimeToLiveError,
85            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
86        >,
87    > {
88        let input = self
89            .inner
90            .build()
91            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
92        let runtime_plugins = crate::operation::update_time_to_live::UpdateTimeToLive::operation_runtime_plugins(
93            self.handle.runtime_plugins.clone(),
94            &self.handle.conf,
95            self.config_override,
96        );
97        crate::operation::update_time_to_live::UpdateTimeToLive::orchestrate(&runtime_plugins, input).await
98    }
99
100    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
101    pub fn customize(
102        self,
103    ) -> crate::client::customize::CustomizableOperation<
104        crate::operation::update_time_to_live::UpdateTimeToLiveOutput,
105        crate::operation::update_time_to_live::UpdateTimeToLiveError,
106        Self,
107    > {
108        crate::client::customize::CustomizableOperation::new(self)
109    }
110    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
111        self.set_config_override(::std::option::Option::Some(config_override.into()));
112        self
113    }
114
115    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
116        self.config_override = config_override;
117        self
118    }
119    /// <p>The name of the table to be configured. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.</p>
120    pub fn table_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
121        self.inner = self.inner.table_name(input.into());
122        self
123    }
124    /// <p>The name of the table to be configured. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.</p>
125    pub fn set_table_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
126        self.inner = self.inner.set_table_name(input);
127        self
128    }
129    /// <p>The name of the table to be configured. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.</p>
130    pub fn get_table_name(&self) -> &::std::option::Option<::std::string::String> {
131        self.inner.get_table_name()
132    }
133    /// <p>Represents the settings used to enable or disable Time to Live for the specified table.</p>
134    pub fn time_to_live_specification(mut self, input: crate::types::TimeToLiveSpecification) -> Self {
135        self.inner = self.inner.time_to_live_specification(input);
136        self
137    }
138    /// <p>Represents the settings used to enable or disable Time to Live for the specified table.</p>
139    pub fn set_time_to_live_specification(mut self, input: ::std::option::Option<crate::types::TimeToLiveSpecification>) -> Self {
140        self.inner = self.inner.set_time_to_live_specification(input);
141        self
142    }
143    /// <p>Represents the settings used to enable or disable Time to Live for the specified table.</p>
144    pub fn get_time_to_live_specification(&self) -> &::std::option::Option<crate::types::TimeToLiveSpecification> {
145        self.inner.get_time_to_live_specification()
146    }
147}