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(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::get_item::GetItemOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::get_item::GetItemError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.get_item();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `GetItem`.
24///
25/// <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>
26/// <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>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct GetItemFluentBuilder {
29 handle: ::std::sync::Arc<crate::client::Handle>,
30 inner: crate::operation::get_item::builders::GetItemInputBuilder,
31 config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl crate::client::customize::internal::CustomizableSend<crate::operation::get_item::GetItemOutput, 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<crate::operation::get_item::GetItemOutput, crate::operation::get_item::GetItemError>,
41 > {
42 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
43 }
44}
45impl GetItemFluentBuilder {
46 /// Creates a new `GetItemFluentBuilder`.
47 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
48 Self {
49 handle,
50 inner: ::std::default::Default::default(),
51 config_override: ::std::option::Option::None,
52 }
53 }
54 /// Access the GetItem as a reference.
55 pub fn as_input(&self) -> &crate::operation::get_item::builders::GetItemInputBuilder {
56 &self.inner
57 }
58 /// Sends the request and returns the response.
59 ///
60 /// If an error occurs, an `SdkError` will be returned with additional details that
61 /// can be matched against.
62 ///
63 /// By default, any retryable failures will be retried twice. Retry behavior
64 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
65 /// set when configuring the client.
66 pub async fn send(
67 self,
68 ) -> ::std::result::Result<
69 crate::operation::get_item::GetItemOutput,
70 ::aws_smithy_runtime_api::client::result::SdkError<
71 crate::operation::get_item::GetItemError,
72 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
73 >,
74 > {
75 let input = self
76 .inner
77 .build()
78 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
79 let runtime_plugins = crate::operation::get_item::GetItem::operation_runtime_plugins(
80 self.handle.runtime_plugins.clone(),
81 &self.handle.conf,
82 self.config_override,
83 );
84 crate::operation::get_item::GetItem::orchestrate(&runtime_plugins, input).await
85 }
86
87 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
88 pub fn customize(
89 self,
90 ) -> crate::client::customize::CustomizableOperation<crate::operation::get_item::GetItemOutput, crate::operation::get_item::GetItemError, Self>
91 {
92 crate::client::customize::CustomizableOperation::new(self)
93 }
94 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
95 self.set_config_override(::std::option::Option::Some(config_override.into()));
96 self
97 }
98
99 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
100 self.config_override = config_override;
101 self
102 }
103 /// <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>
104 pub fn table_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
105 self.inner = self.inner.table_name(input.into());
106 self
107 }
108 /// <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>
109 pub fn set_table_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
110 self.inner = self.inner.set_table_name(input);
111 self
112 }
113 /// <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>
114 pub fn get_table_name(&self) -> &::std::option::Option<::std::string::String> {
115 self.inner.get_table_name()
116 }
117 ///
118 /// Adds a key-value pair to `Key`.
119 ///
120 /// To override the contents of this collection use [`set_key`](Self::set_key).
121 ///
122 /// <p>A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item to retrieve.</p>
123 /// <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>
124 pub fn key(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::AttributeValue) -> Self {
125 self.inner = self.inner.key(k.into(), v);
126 self
127 }
128 /// <p>A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item to retrieve.</p>
129 /// <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>
130 pub fn set_key(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AttributeValue>>) -> Self {
131 self.inner = self.inner.set_key(input);
132 self
133 }
134 /// <p>A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item to retrieve.</p>
135 /// <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>
136 pub fn get_key(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AttributeValue>> {
137 self.inner.get_key()
138 }
139 ///
140 /// Appends an item to `AttributesToGet`.
141 ///
142 /// To override the contents of this collection use [`set_attributes_to_get`](Self::set_attributes_to_get).
143 ///
144 /// <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>
145 pub fn attributes_to_get(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146 self.inner = self.inner.attributes_to_get(input.into());
147 self
148 }
149 /// <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>
150 pub fn set_attributes_to_get(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
151 self.inner = self.inner.set_attributes_to_get(input);
152 self
153 }
154 /// <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>
155 pub fn get_attributes_to_get(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
156 self.inner.get_attributes_to_get()
157 }
158 /// <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>
159 pub fn consistent_read(mut self, input: bool) -> Self {
160 self.inner = self.inner.consistent_read(input);
161 self
162 }
163 /// <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>
164 pub fn set_consistent_read(mut self, input: ::std::option::Option<bool>) -> Self {
165 self.inner = self.inner.set_consistent_read(input);
166 self
167 }
168 /// <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>
169 pub fn get_consistent_read(&self) -> &::std::option::Option<bool> {
170 self.inner.get_consistent_read()
171 }
172 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
173 /// <ul>
174 /// <li>
175 /// <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>
176 /// <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>
177 /// <li>
178 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
179 /// <li>
180 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
181 /// </ul>
182 pub fn return_consumed_capacity(mut self, input: crate::types::ReturnConsumedCapacity) -> Self {
183 self.inner = self.inner.return_consumed_capacity(input);
184 self
185 }
186 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
187 /// <ul>
188 /// <li>
189 /// <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>
190 /// <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>
191 /// <li>
192 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
193 /// <li>
194 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
195 /// </ul>
196 pub fn set_return_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ReturnConsumedCapacity>) -> Self {
197 self.inner = self.inner.set_return_consumed_capacity(input);
198 self
199 }
200 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
201 /// <ul>
202 /// <li>
203 /// <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>
204 /// <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>
205 /// <li>
206 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
207 /// <li>
208 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
209 /// </ul>
210 pub fn get_return_consumed_capacity(&self) -> &::std::option::Option<crate::types::ReturnConsumedCapacity> {
211 self.inner.get_return_consumed_capacity()
212 }
213 /// <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>
214 /// <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>
215 /// <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>
216 pub fn projection_expression(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
217 self.inner = self.inner.projection_expression(input.into());
218 self
219 }
220 /// <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>
221 /// <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>
222 /// <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>
223 pub fn set_projection_expression(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
224 self.inner = self.inner.set_projection_expression(input);
225 self
226 }
227 /// <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>
228 /// <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>
229 /// <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>
230 pub fn get_projection_expression(&self) -> &::std::option::Option<::std::string::String> {
231 self.inner.get_projection_expression()
232 }
233 ///
234 /// Adds a key-value pair to `ExpressionAttributeNames`.
235 ///
236 /// To override the contents of this collection use [`set_expression_attribute_names`](Self::set_expression_attribute_names).
237 ///
238 /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
239 /// <ul>
240 /// <li>
241 /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
242 /// <li>
243 /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
244 /// <li>
245 /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
246 /// </ul>
247 /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
248 /// <ul>
249 /// <li>
250 /// <p><code>Percentile</code></p></li>
251 /// </ul>
252 /// <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>
253 /// <ul>
254 /// <li>
255 /// <p><code>{"#P":"Percentile"}</code></p></li>
256 /// </ul>
257 /// <p>You could then use this substitution in an expression, as in this example:</p>
258 /// <ul>
259 /// <li>
260 /// <p><code>#P = :val</code></p></li>
261 /// </ul><note>
262 /// <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>
263 /// </note>
264 /// <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>
265 pub fn expression_attribute_names(
266 mut self,
267 k: impl ::std::convert::Into<::std::string::String>,
268 v: impl ::std::convert::Into<::std::string::String>,
269 ) -> Self {
270 self.inner = self.inner.expression_attribute_names(k.into(), v.into());
271 self
272 }
273 /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
274 /// <ul>
275 /// <li>
276 /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
277 /// <li>
278 /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
279 /// <li>
280 /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
281 /// </ul>
282 /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
283 /// <ul>
284 /// <li>
285 /// <p><code>Percentile</code></p></li>
286 /// </ul>
287 /// <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>
288 /// <ul>
289 /// <li>
290 /// <p><code>{"#P":"Percentile"}</code></p></li>
291 /// </ul>
292 /// <p>You could then use this substitution in an expression, as in this example:</p>
293 /// <ul>
294 /// <li>
295 /// <p><code>#P = :val</code></p></li>
296 /// </ul><note>
297 /// <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>
298 /// </note>
299 /// <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>
300 pub fn set_expression_attribute_names(
301 mut self,
302 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
303 ) -> Self {
304 self.inner = self.inner.set_expression_attribute_names(input);
305 self
306 }
307 /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
308 /// <ul>
309 /// <li>
310 /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
311 /// <li>
312 /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
313 /// <li>
314 /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
315 /// </ul>
316 /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
317 /// <ul>
318 /// <li>
319 /// <p><code>Percentile</code></p></li>
320 /// </ul>
321 /// <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>
322 /// <ul>
323 /// <li>
324 /// <p><code>{"#P":"Percentile"}</code></p></li>
325 /// </ul>
326 /// <p>You could then use this substitution in an expression, as in this example:</p>
327 /// <ul>
328 /// <li>
329 /// <p><code>#P = :val</code></p></li>
330 /// </ul><note>
331 /// <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>
332 /// </note>
333 /// <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>
334 pub fn get_expression_attribute_names(
335 &self,
336 ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
337 self.inner.get_expression_attribute_names()
338 }
339}