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.
69 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>> {
70 let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
71 let runtime_plugins = crate::operation::get_item::GetItem::operation_runtime_plugins(
72 self.handle.runtime_plugins.clone(),
73 &self.handle.conf,
74 self.config_override,
75 );
76 crate::operation::get_item::GetItem::orchestrate(&runtime_plugins, input).await
77 }
78
79 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
80 pub fn customize(
81 self,
82 ) -> crate::client::customize::CustomizableOperation<crate::operation::get_item::GetItemOutput, crate::operation::get_item::GetItemError, Self> {
83 crate::client::customize::CustomizableOperation::new(self)
84 }
85 pub(crate) fn config_override(
86 mut self,
87 config_override: impl ::std::convert::Into<crate::config::Builder>,
88 ) -> Self {
89 self.set_config_override(::std::option::Option::Some(config_override.into()));
90 self
91 }
92
93 pub(crate) fn set_config_override(
94 &mut self,
95 config_override: ::std::option::Option<crate::config::Builder>,
96 ) -> &mut Self {
97 self.config_override = config_override;
98 self
99 }
100 /// <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>
101 pub fn table_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
102 self.inner = self.inner.table_name(input.into());
103 self
104 }
105 /// <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>
106 pub fn set_table_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
107 self.inner = self.inner.set_table_name(input);
108 self
109 }
110 /// <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>
111 pub fn get_table_name(&self) -> &::std::option::Option<::std::string::String> {
112 self.inner.get_table_name()
113 }
114 ///
115 /// Adds a key-value pair to `Key`.
116 ///
117 /// To override the contents of this collection use [`set_key`](Self::set_key).
118 ///
119 /// <p>A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item to retrieve.</p>
120 /// <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>
121 pub fn key(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::AttributeValue) -> Self {
122 self.inner = self.inner.key(k.into(), v);
123 self
124 }
125 /// <p>A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item to retrieve.</p>
126 /// <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>
127 pub fn set_key(mut self, input: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>) -> Self {
128 self.inner = self.inner.set_key(input);
129 self
130 }
131 /// <p>A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item to retrieve.</p>
132 /// <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>
133 pub fn get_key(&self) -> &::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>> {
134 self.inner.get_key()
135 }
136 ///
137 /// Appends an item to `AttributesToGet`.
138 ///
139 /// To override the contents of this collection use [`set_attributes_to_get`](Self::set_attributes_to_get).
140 ///
141 /// <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>
142 pub fn attributes_to_get(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
143 self.inner = self.inner.attributes_to_get(input.into());
144 self
145 }
146 /// <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>
147 pub fn set_attributes_to_get(mut self, input: ::std::option::Option<::std::vec::Vec::<::std::string::String>>) -> Self {
148 self.inner = self.inner.set_attributes_to_get(input);
149 self
150 }
151 /// <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>
152 pub fn get_attributes_to_get(&self) -> &::std::option::Option<::std::vec::Vec::<::std::string::String>> {
153 self.inner.get_attributes_to_get()
154 }
155 /// <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>
156 pub fn consistent_read(mut self, input: bool) -> Self {
157 self.inner = self.inner.consistent_read(input);
158 self
159 }
160 /// <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>
161 pub fn set_consistent_read(mut self, input: ::std::option::Option<bool>) -> Self {
162 self.inner = self.inner.set_consistent_read(input);
163 self
164 }
165 /// <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>
166 pub fn get_consistent_read(&self) -> &::std::option::Option<bool> {
167 self.inner.get_consistent_read()
168 }
169 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
170 /// <ul>
171 /// <li>
172 /// <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>
173 /// <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>
174 /// <li>
175 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
176 /// <li>
177 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
178 /// </ul>
179 pub fn return_consumed_capacity(mut self, input: crate::types::ReturnConsumedCapacity) -> Self {
180 self.inner = self.inner.return_consumed_capacity(input);
181 self
182 }
183 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
184 /// <ul>
185 /// <li>
186 /// <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>
187 /// <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>
188 /// <li>
189 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
190 /// <li>
191 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
192 /// </ul>
193 pub fn set_return_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ReturnConsumedCapacity>) -> Self {
194 self.inner = self.inner.set_return_consumed_capacity(input);
195 self
196 }
197 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
198 /// <ul>
199 /// <li>
200 /// <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>
201 /// <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>
202 /// <li>
203 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
204 /// <li>
205 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
206 /// </ul>
207 pub fn get_return_consumed_capacity(&self) -> &::std::option::Option<crate::types::ReturnConsumedCapacity> {
208 self.inner.get_return_consumed_capacity()
209 }
210 /// <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>
211 /// <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>
212 /// <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>
213 pub fn projection_expression(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
214 self.inner = self.inner.projection_expression(input.into());
215 self
216 }
217 /// <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>
218 /// <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>
219 /// <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>
220 pub fn set_projection_expression(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
221 self.inner = self.inner.set_projection_expression(input);
222 self
223 }
224 /// <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>
225 /// <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>
226 /// <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>
227 pub fn get_projection_expression(&self) -> &::std::option::Option<::std::string::String> {
228 self.inner.get_projection_expression()
229 }
230 ///
231 /// Adds a key-value pair to `ExpressionAttributeNames`.
232 ///
233 /// To override the contents of this collection use [`set_expression_attribute_names`](Self::set_expression_attribute_names).
234 ///
235 /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
236 /// <ul>
237 /// <li>
238 /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
239 /// <li>
240 /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
241 /// <li>
242 /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
243 /// </ul>
244 /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
245 /// <ul>
246 /// <li>
247 /// <p><code>Percentile</code></p></li>
248 /// </ul>
249 /// <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>
250 /// <ul>
251 /// <li>
252 /// <p><code>{"#P":"Percentile"}</code></p></li>
253 /// </ul>
254 /// <p>You could then use this substitution in an expression, as in this example:</p>
255 /// <ul>
256 /// <li>
257 /// <p><code>#P = :val</code></p></li>
258 /// </ul><note>
259 /// <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>
260 /// </note>
261 /// <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>
262 pub fn expression_attribute_names(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
263 self.inner = self.inner.expression_attribute_names(k.into(), v.into());
264 self
265 }
266 /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
267 /// <ul>
268 /// <li>
269 /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
270 /// <li>
271 /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
272 /// <li>
273 /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
274 /// </ul>
275 /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
276 /// <ul>
277 /// <li>
278 /// <p><code>Percentile</code></p></li>
279 /// </ul>
280 /// <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>
281 /// <ul>
282 /// <li>
283 /// <p><code>{"#P":"Percentile"}</code></p></li>
284 /// </ul>
285 /// <p>You could then use this substitution in an expression, as in this example:</p>
286 /// <ul>
287 /// <li>
288 /// <p><code>#P = :val</code></p></li>
289 /// </ul><note>
290 /// <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>
291 /// </note>
292 /// <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>
293 pub fn set_expression_attribute_names(mut self, input: ::std::option::Option<::std::collections::HashMap::<::std::string::String, ::std::string::String>>) -> Self {
294 self.inner = self.inner.set_expression_attribute_names(input);
295 self
296 }
297 /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
298 /// <ul>
299 /// <li>
300 /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
301 /// <li>
302 /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
303 /// <li>
304 /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
305 /// </ul>
306 /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
307 /// <ul>
308 /// <li>
309 /// <p><code>Percentile</code></p></li>
310 /// </ul>
311 /// <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>
312 /// <ul>
313 /// <li>
314 /// <p><code>{"#P":"Percentile"}</code></p></li>
315 /// </ul>
316 /// <p>You could then use this substitution in an expression, as in this example:</p>
317 /// <ul>
318 /// <li>
319 /// <p><code>#P = :val</code></p></li>
320 /// </ul><note>
321 /// <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>
322 /// </note>
323 /// <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>
324 pub fn get_expression_attribute_names(&self) -> &::std::option::Option<::std::collections::HashMap::<::std::string::String, ::std::string::String>> {
325 self.inner.get_expression_attribute_names()
326 }
327}
328