aws_sdk_dynamodb/operation/get_item/_get_item_input.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Represents the input of a <code>GetItem</code> operation.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct GetItemInput {
7 /// <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>
8 pub table_name: ::std::option::Option<::std::string::String>,
9 /// <p>A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item to retrieve.</p>
10 /// <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>
11 pub key: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AttributeValue>>,
12 /// <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>
13 pub attributes_to_get: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
14 /// <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>
15 pub consistent_read: ::std::option::Option<bool>,
16 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
17 /// <ul>
18 /// <li>
19 /// <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>
20 /// <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>
21 /// <li>
22 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
23 /// <li>
24 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
25 /// </ul>
26 pub return_consumed_capacity: ::std::option::Option<crate::types::ReturnConsumedCapacity>,
27 /// <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>
28 /// <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>
29 /// <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>
30 pub projection_expression: ::std::option::Option<::std::string::String>,
31 /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
32 /// <ul>
33 /// <li>
34 /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
35 /// <li>
36 /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
37 /// <li>
38 /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
39 /// </ul>
40 /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
41 /// <ul>
42 /// <li>
43 /// <p><code>Percentile</code></p></li>
44 /// </ul>
45 /// <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>
46 /// <ul>
47 /// <li>
48 /// <p><code>{"#P":"Percentile"}</code></p></li>
49 /// </ul>
50 /// <p>You could then use this substitution in an expression, as in this example:</p>
51 /// <ul>
52 /// <li>
53 /// <p><code>#P = :val</code></p></li>
54 /// </ul><note>
55 /// <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>
56 /// </note>
57 /// <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>
58 pub expression_attribute_names: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
59}
60impl GetItemInput {
61 /// <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>
62 pub fn table_name(&self) -> ::std::option::Option<&str> {
63 self.table_name.as_deref()
64 }
65 /// <p>A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item to retrieve.</p>
66 /// <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>
67 pub fn key(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::AttributeValue>> {
68 self.key.as_ref()
69 }
70 /// <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>
71 ///
72 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.attributes_to_get.is_none()`.
73 pub fn attributes_to_get(&self) -> &[::std::string::String] {
74 self.attributes_to_get.as_deref().unwrap_or_default()
75 }
76 /// <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>
77 pub fn consistent_read(&self) -> ::std::option::Option<bool> {
78 self.consistent_read
79 }
80 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
81 /// <ul>
82 /// <li>
83 /// <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>
84 /// <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>
85 /// <li>
86 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
87 /// <li>
88 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
89 /// </ul>
90 pub fn return_consumed_capacity(&self) -> ::std::option::Option<&crate::types::ReturnConsumedCapacity> {
91 self.return_consumed_capacity.as_ref()
92 }
93 /// <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>
94 /// <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>
95 /// <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>
96 pub fn projection_expression(&self) -> ::std::option::Option<&str> {
97 self.projection_expression.as_deref()
98 }
99 /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
100 /// <ul>
101 /// <li>
102 /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
103 /// <li>
104 /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
105 /// <li>
106 /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
107 /// </ul>
108 /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
109 /// <ul>
110 /// <li>
111 /// <p><code>Percentile</code></p></li>
112 /// </ul>
113 /// <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>
114 /// <ul>
115 /// <li>
116 /// <p><code>{"#P":"Percentile"}</code></p></li>
117 /// </ul>
118 /// <p>You could then use this substitution in an expression, as in this example:</p>
119 /// <ul>
120 /// <li>
121 /// <p><code>#P = :val</code></p></li>
122 /// </ul><note>
123 /// <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>
124 /// </note>
125 /// <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>
126 pub fn expression_attribute_names(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
127 self.expression_attribute_names.as_ref()
128 }
129}
130impl GetItemInput {
131 /// Creates a new builder-style object to manufacture [`GetItemInput`](crate::operation::get_item::GetItemInput).
132 pub fn builder() -> crate::operation::get_item::builders::GetItemInputBuilder {
133 crate::operation::get_item::builders::GetItemInputBuilder::default()
134 }
135}
136
137/// A builder for [`GetItemInput`](crate::operation::get_item::GetItemInput).
138#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
139#[non_exhaustive]
140pub struct GetItemInputBuilder {
141 pub(crate) table_name: ::std::option::Option<::std::string::String>,
142 pub(crate) key: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AttributeValue>>,
143 pub(crate) attributes_to_get: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
144 pub(crate) consistent_read: ::std::option::Option<bool>,
145 pub(crate) return_consumed_capacity: ::std::option::Option<crate::types::ReturnConsumedCapacity>,
146 pub(crate) projection_expression: ::std::option::Option<::std::string::String>,
147 pub(crate) expression_attribute_names: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
148}
149impl GetItemInputBuilder {
150 /// <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>
151 /// This field is required.
152 pub fn table_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
153 self.table_name = ::std::option::Option::Some(input.into());
154 self
155 }
156 /// <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>
157 pub fn set_table_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
158 self.table_name = input;
159 self
160 }
161 /// <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>
162 pub fn get_table_name(&self) -> &::std::option::Option<::std::string::String> {
163 &self.table_name
164 }
165 /// Adds a key-value pair to `key`.
166 ///
167 /// To override the contents of this collection use [`set_key`](Self::set_key).
168 ///
169 /// <p>A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item to retrieve.</p>
170 /// <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>
171 pub fn key(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::AttributeValue) -> Self {
172 let mut hash_map = self.key.unwrap_or_default();
173 hash_map.insert(k.into(), v);
174 self.key = ::std::option::Option::Some(hash_map);
175 self
176 }
177 /// <p>A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item to retrieve.</p>
178 /// <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>
179 pub fn set_key(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AttributeValue>>) -> Self {
180 self.key = input;
181 self
182 }
183 /// <p>A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item to retrieve.</p>
184 /// <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>
185 pub fn get_key(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AttributeValue>> {
186 &self.key
187 }
188 /// Appends an item to `attributes_to_get`.
189 ///
190 /// To override the contents of this collection use [`set_attributes_to_get`](Self::set_attributes_to_get).
191 ///
192 /// <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>
193 pub fn attributes_to_get(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
194 let mut v = self.attributes_to_get.unwrap_or_default();
195 v.push(input.into());
196 self.attributes_to_get = ::std::option::Option::Some(v);
197 self
198 }
199 /// <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>
200 pub fn set_attributes_to_get(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
201 self.attributes_to_get = input;
202 self
203 }
204 /// <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>
205 pub fn get_attributes_to_get(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
206 &self.attributes_to_get
207 }
208 /// <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>
209 pub fn consistent_read(mut self, input: bool) -> Self {
210 self.consistent_read = ::std::option::Option::Some(input);
211 self
212 }
213 /// <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>
214 pub fn set_consistent_read(mut self, input: ::std::option::Option<bool>) -> Self {
215 self.consistent_read = input;
216 self
217 }
218 /// <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>
219 pub fn get_consistent_read(&self) -> &::std::option::Option<bool> {
220 &self.consistent_read
221 }
222 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
223 /// <ul>
224 /// <li>
225 /// <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>
226 /// <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>
227 /// <li>
228 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
229 /// <li>
230 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
231 /// </ul>
232 pub fn return_consumed_capacity(mut self, input: crate::types::ReturnConsumedCapacity) -> Self {
233 self.return_consumed_capacity = ::std::option::Option::Some(input);
234 self
235 }
236 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
237 /// <ul>
238 /// <li>
239 /// <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>
240 /// <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>
241 /// <li>
242 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
243 /// <li>
244 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
245 /// </ul>
246 pub fn set_return_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ReturnConsumedCapacity>) -> Self {
247 self.return_consumed_capacity = input;
248 self
249 }
250 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
251 /// <ul>
252 /// <li>
253 /// <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>
254 /// <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>
255 /// <li>
256 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
257 /// <li>
258 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
259 /// </ul>
260 pub fn get_return_consumed_capacity(&self) -> &::std::option::Option<crate::types::ReturnConsumedCapacity> {
261 &self.return_consumed_capacity
262 }
263 /// <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>
264 /// <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>
265 /// <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>
266 pub fn projection_expression(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
267 self.projection_expression = ::std::option::Option::Some(input.into());
268 self
269 }
270 /// <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>
271 /// <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>
272 /// <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>
273 pub fn set_projection_expression(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
274 self.projection_expression = input;
275 self
276 }
277 /// <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>
278 /// <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>
279 /// <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>
280 pub fn get_projection_expression(&self) -> &::std::option::Option<::std::string::String> {
281 &self.projection_expression
282 }
283 /// Adds a key-value pair to `expression_attribute_names`.
284 ///
285 /// To override the contents of this collection use [`set_expression_attribute_names`](Self::set_expression_attribute_names).
286 ///
287 /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
288 /// <ul>
289 /// <li>
290 /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
291 /// <li>
292 /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
293 /// <li>
294 /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
295 /// </ul>
296 /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
297 /// <ul>
298 /// <li>
299 /// <p><code>Percentile</code></p></li>
300 /// </ul>
301 /// <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>
302 /// <ul>
303 /// <li>
304 /// <p><code>{"#P":"Percentile"}</code></p></li>
305 /// </ul>
306 /// <p>You could then use this substitution in an expression, as in this example:</p>
307 /// <ul>
308 /// <li>
309 /// <p><code>#P = :val</code></p></li>
310 /// </ul><note>
311 /// <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>
312 /// </note>
313 /// <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>
314 pub fn expression_attribute_names(
315 mut self,
316 k: impl ::std::convert::Into<::std::string::String>,
317 v: impl ::std::convert::Into<::std::string::String>,
318 ) -> Self {
319 let mut hash_map = self.expression_attribute_names.unwrap_or_default();
320 hash_map.insert(k.into(), v.into());
321 self.expression_attribute_names = ::std::option::Option::Some(hash_map);
322 self
323 }
324 /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
325 /// <ul>
326 /// <li>
327 /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
328 /// <li>
329 /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
330 /// <li>
331 /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
332 /// </ul>
333 /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
334 /// <ul>
335 /// <li>
336 /// <p><code>Percentile</code></p></li>
337 /// </ul>
338 /// <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>
339 /// <ul>
340 /// <li>
341 /// <p><code>{"#P":"Percentile"}</code></p></li>
342 /// </ul>
343 /// <p>You could then use this substitution in an expression, as in this example:</p>
344 /// <ul>
345 /// <li>
346 /// <p><code>#P = :val</code></p></li>
347 /// </ul><note>
348 /// <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>
349 /// </note>
350 /// <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>
351 pub fn set_expression_attribute_names(
352 mut self,
353 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
354 ) -> Self {
355 self.expression_attribute_names = input;
356 self
357 }
358 /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
359 /// <ul>
360 /// <li>
361 /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
362 /// <li>
363 /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
364 /// <li>
365 /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
366 /// </ul>
367 /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
368 /// <ul>
369 /// <li>
370 /// <p><code>Percentile</code></p></li>
371 /// </ul>
372 /// <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>
373 /// <ul>
374 /// <li>
375 /// <p><code>{"#P":"Percentile"}</code></p></li>
376 /// </ul>
377 /// <p>You could then use this substitution in an expression, as in this example:</p>
378 /// <ul>
379 /// <li>
380 /// <p><code>#P = :val</code></p></li>
381 /// </ul><note>
382 /// <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>
383 /// </note>
384 /// <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>
385 pub fn get_expression_attribute_names(
386 &self,
387 ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
388 &self.expression_attribute_names
389 }
390 /// Consumes the builder and constructs a [`GetItemInput`](crate::operation::get_item::GetItemInput).
391 pub fn build(self) -> ::std::result::Result<crate::operation::get_item::GetItemInput, ::aws_smithy_types::error::operation::BuildError> {
392 ::std::result::Result::Ok(crate::operation::get_item::GetItemInput {
393 table_name: self.table_name,
394 key: self.key,
395 attributes_to_get: self.attributes_to_get,
396 consistent_read: self.consistent_read,
397 return_consumed_capacity: self.return_consumed_capacity,
398 projection_expression: self.projection_expression,
399 expression_attribute_names: self.expression_attribute_names,
400 })
401 }
402}