aws_sdk_dynamodb/operation/get_item/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_item::_get_item_output::GetItemOutputBuilder;
3
4pub use crate::operation::get_item::_get_item_input::GetItemInputBuilder;
5
6impl crate::operation::get_item::builders::GetItemInputBuilder {
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_item::GetItemOutput,
10                        ::aws_smithy_runtime_api::client::result::SdkError<
11                            crate::operation::get_item::GetItemError,
12                            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse
13                        >
14                    > {
15                        let mut fluent_builder = client.get_item();
16                        fluent_builder.inner = self;
17                        fluent_builder.send().await
18                    }
19                }
20/// Fluent builder constructing a request to `GetItem`.
21/// 
22/// <p>The <code>GetItem</code> operation returns a set of attributes for the item with the given primary key. If there is no matching item, <code>GetItem</code> does not return any data and there will be no <code>Item</code> element in the response.</p>
23/// <p><code>GetItem</code> provides an eventually consistent read by default. If your application requires a strongly consistent read, set <code>ConsistentRead</code> to <code>true</code>. Although a strongly consistent read might take more time than an eventually consistent read, it always returns the last updated value.</p>
24#[derive(::std::clone::Clone, ::std::fmt::Debug)]
25pub struct GetItemFluentBuilder {
26                handle: ::std::sync::Arc<crate::client::Handle>,
27                inner: crate::operation::get_item::builders::GetItemInputBuilder,
28config_override: ::std::option::Option<crate::config::Builder>,
29            }
30impl
31                crate::client::customize::internal::CustomizableSend<
32                    crate::operation::get_item::GetItemOutput,
33                    crate::operation::get_item::GetItemError,
34                > for GetItemFluentBuilder
35            {
36                fn send(
37                    self,
38                    config_override: crate::config::Builder,
39                ) -> crate::client::customize::internal::BoxFuture<
40                    crate::client::customize::internal::SendResult<
41                        crate::operation::get_item::GetItemOutput,
42                        crate::operation::get_item::GetItemError,
43                    >,
44                > {
45                    ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
46                }
47            }
48impl GetItemFluentBuilder {
49    /// Creates a new `GetItemFluentBuilder`.
50                    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
51                        Self {
52                            handle,
53                            inner: ::std::default::Default::default(),
54    config_override: ::std::option::Option::None,
55                        }
56                    }
57    /// Access the GetItem as a reference.
58                    pub fn as_input(&self) -> &crate::operation::get_item::builders::GetItemInputBuilder {
59                        &self.inner
60                    }
61    /// Sends the request and returns the response.
62                    ///
63                    /// If an error occurs, an `SdkError` will be returned with additional details that
64                    /// can be matched against.
65                    ///
66                    /// By default, any retryable failures will be retried twice. Retry behavior
67                    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
68                    /// set when configuring the client. Note: retries are enabled by default when using
69                    /// `aws_config::load_from_env()` or when using `BehaviorVersion::v2025_01_17()` or later.
70                    pub async fn send(self) -> ::std::result::Result<crate::operation::get_item::GetItemOutput, ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::get_item::GetItemError, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> {
71                        let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
72                        let runtime_plugins = crate::operation::get_item::GetItem::operation_runtime_plugins(
73                            self.handle.runtime_plugins.clone(),
74                            &self.handle.conf,
75                            self.config_override,
76                        );
77                        crate::operation::get_item::GetItem::orchestrate(&runtime_plugins, input).await
78                    }
79    
80                    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
81                    pub fn customize(
82                        self,
83                    ) -> crate::client::customize::CustomizableOperation<crate::operation::get_item::GetItemOutput, crate::operation::get_item::GetItemError, Self> {
84                        crate::client::customize::CustomizableOperation::new(self)
85                    }
86    pub(crate) fn config_override(
87                            mut self,
88                            config_override: impl ::std::convert::Into<crate::config::Builder>,
89                        ) -> Self {
90                            self.set_config_override(::std::option::Option::Some(config_override.into()));
91                            self
92                        }
93    
94                        pub(crate) fn set_config_override(
95                            &mut self,
96                            config_override: ::std::option::Option<crate::config::Builder>,
97                        ) -> &mut Self {
98                            self.config_override = config_override;
99                            self
100                        }
101    /// <p>The name of the table containing the requested item. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.</p>
102    pub fn table_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
103                    self.inner = self.inner.table_name(input.into());
104                    self
105                }
106    /// <p>The name of the table containing the requested item. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.</p>
107    pub fn set_table_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
108                    self.inner = self.inner.set_table_name(input);
109                    self
110                }
111    /// <p>The name of the table containing the requested item. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.</p>
112    pub fn get_table_name(&self) -> &::std::option::Option<::std::string::String> {
113                    self.inner.get_table_name()
114                }
115    /// 
116    /// Adds a key-value pair to `Key`.
117    /// 
118    /// To override the contents of this collection use [`set_key`](Self::set_key).
119    /// 
120    /// <p>A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item to retrieve.</p>
121    /// <p>For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.</p>
122    pub fn key(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::AttributeValue) -> Self {
123                    self.inner = self.inner.key(k.into(), v);
124                    self
125                }
126    /// <p>A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item to retrieve.</p>
127    /// <p>For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.</p>
128    pub fn set_key(mut self, input: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>) -> Self {
129                    self.inner = self.inner.set_key(input);
130                    self
131                }
132    /// <p>A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item to retrieve.</p>
133    /// <p>For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.</p>
134    pub fn get_key(&self) -> &::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>> {
135                    self.inner.get_key()
136                }
137    /// 
138    /// Appends an item to `AttributesToGet`.
139    /// 
140    /// To override the contents of this collection use [`set_attributes_to_get`](Self::set_attributes_to_get).
141    /// 
142    /// <p>This is a legacy parameter. Use <code>ProjectionExpression</code> instead. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html">AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
143    pub fn attributes_to_get(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
144                        self.inner = self.inner.attributes_to_get(input.into());
145                        self
146                    }
147    /// <p>This is a legacy parameter. Use <code>ProjectionExpression</code> instead. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html">AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
148    pub fn set_attributes_to_get(mut self, input: ::std::option::Option<::std::vec::Vec::<::std::string::String>>) -> Self {
149                    self.inner = self.inner.set_attributes_to_get(input);
150                    self
151                }
152    /// <p>This is a legacy parameter. Use <code>ProjectionExpression</code> instead. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html">AttributesToGet</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
153    pub fn get_attributes_to_get(&self) -> &::std::option::Option<::std::vec::Vec::<::std::string::String>> {
154                    self.inner.get_attributes_to_get()
155                }
156    /// <p>Determines the read consistency model: If set to <code>true</code>, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.</p>
157    pub fn consistent_read(mut self, input: bool) -> Self {
158                    self.inner = self.inner.consistent_read(input);
159                    self
160                }
161    /// <p>Determines the read consistency model: If set to <code>true</code>, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.</p>
162    pub fn set_consistent_read(mut self, input: ::std::option::Option<bool>) -> Self {
163                    self.inner = self.inner.set_consistent_read(input);
164                    self
165                }
166    /// <p>Determines the read consistency model: If set to <code>true</code>, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.</p>
167    pub fn get_consistent_read(&self) -> &::std::option::Option<bool> {
168                    self.inner.get_consistent_read()
169                }
170    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
171    /// <ul>
172    /// <li>
173    /// <p><code>INDEXES</code> - The response includes the aggregate <code>ConsumedCapacity</code> for the operation, together with <code>ConsumedCapacity</code> for each table and secondary index that was accessed.</p>
174    /// <p>Note that some operations, such as <code>GetItem</code> and <code>BatchGetItem</code>, do not access any indexes at all. In these cases, specifying <code>INDEXES</code> will only return <code>ConsumedCapacity</code> information for table(s).</p></li>
175    /// <li>
176    /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
177    /// <li>
178    /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
179    /// </ul>
180    pub fn return_consumed_capacity(mut self, input: crate::types::ReturnConsumedCapacity) -> Self {
181                    self.inner = self.inner.return_consumed_capacity(input);
182                    self
183                }
184    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
185    /// <ul>
186    /// <li>
187    /// <p><code>INDEXES</code> - The response includes the aggregate <code>ConsumedCapacity</code> for the operation, together with <code>ConsumedCapacity</code> for each table and secondary index that was accessed.</p>
188    /// <p>Note that some operations, such as <code>GetItem</code> and <code>BatchGetItem</code>, do not access any indexes at all. In these cases, specifying <code>INDEXES</code> will only return <code>ConsumedCapacity</code> information for table(s).</p></li>
189    /// <li>
190    /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
191    /// <li>
192    /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
193    /// </ul>
194    pub fn set_return_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ReturnConsumedCapacity>) -> Self {
195                    self.inner = self.inner.set_return_consumed_capacity(input);
196                    self
197                }
198    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
199    /// <ul>
200    /// <li>
201    /// <p><code>INDEXES</code> - The response includes the aggregate <code>ConsumedCapacity</code> for the operation, together with <code>ConsumedCapacity</code> for each table and secondary index that was accessed.</p>
202    /// <p>Note that some operations, such as <code>GetItem</code> and <code>BatchGetItem</code>, do not access any indexes at all. In these cases, specifying <code>INDEXES</code> will only return <code>ConsumedCapacity</code> information for table(s).</p></li>
203    /// <li>
204    /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
205    /// <li>
206    /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
207    /// </ul>
208    pub fn get_return_consumed_capacity(&self) -> &::std::option::Option<crate::types::ReturnConsumedCapacity> {
209                    self.inner.get_return_consumed_capacity()
210                }
211    /// <p>A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.</p>
212    /// <p>If no attribute names are specified, then all attributes are returned. If any of the requested attributes are not found, they do not appear in the result.</p>
213    /// <p>For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html">Specifying Item Attributes</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
214    pub fn projection_expression(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
215                    self.inner = self.inner.projection_expression(input.into());
216                    self
217                }
218    /// <p>A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.</p>
219    /// <p>If no attribute names are specified, then all attributes are returned. If any of the requested attributes are not found, they do not appear in the result.</p>
220    /// <p>For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html">Specifying Item Attributes</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
221    pub fn set_projection_expression(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
222                    self.inner = self.inner.set_projection_expression(input);
223                    self
224                }
225    /// <p>A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.</p>
226    /// <p>If no attribute names are specified, then all attributes are returned. If any of the requested attributes are not found, they do not appear in the result.</p>
227    /// <p>For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html">Specifying Item Attributes</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
228    pub fn get_projection_expression(&self) -> &::std::option::Option<::std::string::String> {
229                    self.inner.get_projection_expression()
230                }
231    /// 
232    /// Adds a key-value pair to `ExpressionAttributeNames`.
233    /// 
234    /// To override the contents of this collection use [`set_expression_attribute_names`](Self::set_expression_attribute_names).
235    /// 
236    /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
237    /// <ul>
238    /// <li>
239    /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
240    /// <li>
241    /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
242    /// <li>
243    /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
244    /// </ul>
245    /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
246    /// <ul>
247    /// <li>
248    /// <p><code>Percentile</code></p></li>
249    /// </ul>
250    /// <p>The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html">Reserved Words</a> in the <i>Amazon DynamoDB Developer Guide</i>). To work around this, you could specify the following for <code>ExpressionAttributeNames</code>:</p>
251    /// <ul>
252    /// <li>
253    /// <p><code>{"#P":"Percentile"}</code></p></li>
254    /// </ul>
255    /// <p>You could then use this substitution in an expression, as in this example:</p>
256    /// <ul>
257    /// <li>
258    /// <p><code>#P = :val</code></p></li>
259    /// </ul><note>
260    /// <p>Tokens that begin with the <b>:</b> character are <i>expression attribute values</i>, which are placeholders for the actual value at runtime.</p>
261    /// </note>
262    /// <p>For more information on expression attribute names, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html">Specifying Item Attributes</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
263    pub fn expression_attribute_names(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
264                    self.inner = self.inner.expression_attribute_names(k.into(), v.into());
265                    self
266                }
267    /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
268    /// <ul>
269    /// <li>
270    /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
271    /// <li>
272    /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
273    /// <li>
274    /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
275    /// </ul>
276    /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
277    /// <ul>
278    /// <li>
279    /// <p><code>Percentile</code></p></li>
280    /// </ul>
281    /// <p>The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html">Reserved Words</a> in the <i>Amazon DynamoDB Developer Guide</i>). To work around this, you could specify the following for <code>ExpressionAttributeNames</code>:</p>
282    /// <ul>
283    /// <li>
284    /// <p><code>{"#P":"Percentile"}</code></p></li>
285    /// </ul>
286    /// <p>You could then use this substitution in an expression, as in this example:</p>
287    /// <ul>
288    /// <li>
289    /// <p><code>#P = :val</code></p></li>
290    /// </ul><note>
291    /// <p>Tokens that begin with the <b>:</b> character are <i>expression attribute values</i>, which are placeholders for the actual value at runtime.</p>
292    /// </note>
293    /// <p>For more information on expression attribute names, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html">Specifying Item Attributes</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
294    pub fn set_expression_attribute_names(mut self, input: ::std::option::Option<::std::collections::HashMap::<::std::string::String, ::std::string::String>>) -> Self {
295                    self.inner = self.inner.set_expression_attribute_names(input);
296                    self
297                }
298    /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
299    /// <ul>
300    /// <li>
301    /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
302    /// <li>
303    /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
304    /// <li>
305    /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
306    /// </ul>
307    /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
308    /// <ul>
309    /// <li>
310    /// <p><code>Percentile</code></p></li>
311    /// </ul>
312    /// <p>The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html">Reserved Words</a> in the <i>Amazon DynamoDB Developer Guide</i>). To work around this, you could specify the following for <code>ExpressionAttributeNames</code>:</p>
313    /// <ul>
314    /// <li>
315    /// <p><code>{"#P":"Percentile"}</code></p></li>
316    /// </ul>
317    /// <p>You could then use this substitution in an expression, as in this example:</p>
318    /// <ul>
319    /// <li>
320    /// <p><code>#P = :val</code></p></li>
321    /// </ul><note>
322    /// <p>Tokens that begin with the <b>:</b> character are <i>expression attribute values</i>, which are placeholders for the actual value at runtime.</p>
323    /// </note>
324    /// <p>For more information on expression attribute names, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html">Specifying Item Attributes</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
325    pub fn get_expression_attribute_names(&self) -> &::std::option::Option<::std::collections::HashMap::<::std::string::String, ::std::string::String>> {
326                    self.inner.get_expression_attribute_names()
327                }
328}
329