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()
75 .unwrap_or_default()
76 }
77 /// <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>
78 pub fn consistent_read(&self) -> ::std::option::Option<bool> {
79 self.consistent_read
80 }
81 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
82 /// <ul>
83 /// <li>
84 /// <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>
85 /// <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>
86 /// <li>
87 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
88 /// <li>
89 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
90 /// </ul>
91 pub fn return_consumed_capacity(&self) -> ::std::option::Option<&crate::types::ReturnConsumedCapacity> {
92 self.return_consumed_capacity.as_ref()
93 }
94 /// <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>
95 /// <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>
96 /// <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>
97 pub fn projection_expression(&self) -> ::std::option::Option<&str> {
98 self.projection_expression.as_deref()
99 }
100 /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
101 /// <ul>
102 /// <li>
103 /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
104 /// <li>
105 /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
106 /// <li>
107 /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
108 /// </ul>
109 /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
110 /// <ul>
111 /// <li>
112 /// <p><code>Percentile</code></p></li>
113 /// </ul>
114 /// <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>
115 /// <ul>
116 /// <li>
117 /// <p><code>{"#P":"Percentile"}</code></p></li>
118 /// </ul>
119 /// <p>You could then use this substitution in an expression, as in this example:</p>
120 /// <ul>
121 /// <li>
122 /// <p><code>#P = :val</code></p></li>
123 /// </ul><note>
124 /// <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>
125 /// </note>
126 /// <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>
127 pub fn expression_attribute_names(&self) -> ::std::option::Option<&::std::collections::HashMap::<::std::string::String, ::std::string::String>> {
128 self.expression_attribute_names.as_ref()
129 }
130}
131static GETITEMINPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.dynamodb.synthetic#GetItemInput", "com.amazonaws.dynamodb.synthetic", "GetItemInput");
132static GETITEMINPUT_MEMBER_TABLE_NAME: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
133 ::aws_smithy_schema::ShapeId::from_static(
134 "com.amazonaws.dynamodb.synthetic#GetItemInput$TableName",
135 "com.amazonaws.dynamodb.synthetic",
136 "GetItemInput",
137 ),
138 ::aws_smithy_schema::ShapeType::String,
139 "TableName",
140 0,
141 );
142static GETITEMINPUT_MEMBER_KEY: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
143 ::aws_smithy_schema::ShapeId::from_static(
144 "com.amazonaws.dynamodb.synthetic#GetItemInput$Key",
145 "com.amazonaws.dynamodb.synthetic",
146 "GetItemInput",
147 ),
148 ::aws_smithy_schema::ShapeType::Map,
149 "Key",
150 1,
151 );
152static GETITEMINPUT_MEMBER_ATTRIBUTES_TO_GET: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
153 ::aws_smithy_schema::ShapeId::from_static(
154 "com.amazonaws.dynamodb.synthetic#GetItemInput$AttributesToGet",
155 "com.amazonaws.dynamodb.synthetic",
156 "GetItemInput",
157 ),
158 ::aws_smithy_schema::ShapeType::List,
159 "AttributesToGet",
160 2,
161 );
162static GETITEMINPUT_MEMBER_CONSISTENT_READ: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
163 ::aws_smithy_schema::ShapeId::from_static(
164 "com.amazonaws.dynamodb.synthetic#GetItemInput$ConsistentRead",
165 "com.amazonaws.dynamodb.synthetic",
166 "GetItemInput",
167 ),
168 ::aws_smithy_schema::ShapeType::Boolean,
169 "ConsistentRead",
170 3,
171 );
172static GETITEMINPUT_MEMBER_RETURN_CONSUMED_CAPACITY: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
173 ::aws_smithy_schema::ShapeId::from_static(
174 "com.amazonaws.dynamodb.synthetic#GetItemInput$ReturnConsumedCapacity",
175 "com.amazonaws.dynamodb.synthetic",
176 "GetItemInput",
177 ),
178 ::aws_smithy_schema::ShapeType::String,
179 "ReturnConsumedCapacity",
180 4,
181 );
182static GETITEMINPUT_MEMBER_PROJECTION_EXPRESSION: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
183 ::aws_smithy_schema::ShapeId::from_static(
184 "com.amazonaws.dynamodb.synthetic#GetItemInput$ProjectionExpression",
185 "com.amazonaws.dynamodb.synthetic",
186 "GetItemInput",
187 ),
188 ::aws_smithy_schema::ShapeType::String,
189 "ProjectionExpression",
190 5,
191 );
192static GETITEMINPUT_MEMBER_EXPRESSION_ATTRIBUTE_NAMES: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
193 ::aws_smithy_schema::ShapeId::from_static(
194 "com.amazonaws.dynamodb.synthetic#GetItemInput$ExpressionAttributeNames",
195 "com.amazonaws.dynamodb.synthetic",
196 "GetItemInput",
197 ),
198 ::aws_smithy_schema::ShapeType::Map,
199 "ExpressionAttributeNames",
200 6,
201 );
202static GETITEMINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
203 GETITEMINPUT_SCHEMA_ID,
204 ::aws_smithy_schema::ShapeType::Structure,
205 &[&GETITEMINPUT_MEMBER_TABLE_NAME, &GETITEMINPUT_MEMBER_KEY, &GETITEMINPUT_MEMBER_ATTRIBUTES_TO_GET, &GETITEMINPUT_MEMBER_CONSISTENT_READ, &GETITEMINPUT_MEMBER_RETURN_CONSUMED_CAPACITY, &GETITEMINPUT_MEMBER_PROJECTION_EXPRESSION, &GETITEMINPUT_MEMBER_EXPRESSION_ATTRIBUTE_NAMES],
206 );
207impl GetItemInput {
208 /// The schema for this shape.
209 pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &GETITEMINPUT_SCHEMA;
210 }
211impl ::aws_smithy_schema::serde::SerializableStruct for GetItemInput {
212 #[allow(unused_variables, clippy::diverging_sub_expression)]
213 fn serialize_members(&self, ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
214 if let Some(ref val) = self.table_name {
215 ser.write_string(&GETITEMINPUT_MEMBER_TABLE_NAME, val)?;
216 }
217if let Some(ref val) = self.key {
218
219 ser.write_map(&GETITEMINPUT_MEMBER_KEY, &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
220 for (key, value) in val {
221 ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
222 ser.write_struct(crate::types::AttributeValue::SCHEMA, value)?;
223 }
224 Ok(())
225 })?;
226
227 }
228if let Some(ref val) = self.attributes_to_get {
229
230 ser.write_list(&GETITEMINPUT_MEMBER_ATTRIBUTES_TO_GET, &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
231 for item in val {
232 ser.write_string(&aws_smithy_schema::prelude::STRING, item)?;
233 }
234 Ok(())
235 })?;
236
237 }
238if let Some(ref val) = self.consistent_read {
239 ser.write_boolean(&GETITEMINPUT_MEMBER_CONSISTENT_READ, *val)?;
240 }
241if let Some(ref val) = self.return_consumed_capacity {
242 ser.write_string(&GETITEMINPUT_MEMBER_RETURN_CONSUMED_CAPACITY, val.as_str())?;
243 }
244if let Some(ref val) = self.projection_expression {
245 ser.write_string(&GETITEMINPUT_MEMBER_PROJECTION_EXPRESSION, val)?;
246 }
247if let Some(ref val) = self.expression_attribute_names {
248
249 ser.write_map(&GETITEMINPUT_MEMBER_EXPRESSION_ATTRIBUTE_NAMES, &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
250 for (key, value) in val {
251 ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
252 ser.write_string(&::aws_smithy_schema::prelude::STRING, value)?;
253 }
254 Ok(())
255 })?;
256
257 }
258 Ok(())
259 }
260 }
261impl GetItemInput {
262 /// Deserializes this structure from a [`ShapeDeserializer`].
263 pub fn deserialize(deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
264 #[allow(unused_variables, unused_mut)]
265 let mut builder = Self::builder();
266 #[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding, clippy::diverging_sub_expression)]
267 deserializer.read_struct(&GETITEMINPUT_SCHEMA, &mut |member, deser| {
268 match member.member_index() {
269 Some(0) => {
270 builder.table_name = Some(deser.read_string(member)?);
271 }
272Some(1) => {
273 builder.key = Some({ let mut container = std::collections::HashMap::new(); deser.read_map(member, &mut |key, deser| { container.insert(key, crate::types::AttributeValue::deserialize(deser)?); Ok(()) })?; container });
274 }
275Some(2) => {
276 builder.attributes_to_get = Some(deser.read_string_list(member)?);
277 }
278Some(3) => {
279 builder.consistent_read = Some(deser.read_boolean(member)?);
280 }
281Some(4) => {
282 builder.return_consumed_capacity = Some(crate::types::ReturnConsumedCapacity::from(deser.read_string(member)?.as_str()));
283 }
284Some(5) => {
285 builder.projection_expression = Some(deser.read_string(member)?);
286 }
287Some(6) => {
288 builder.expression_attribute_names = Some(deser.read_string_string_map(member)?);
289 }
290 _ => {}
291 }
292 Ok(())
293 })?;
294 builder.table_name = builder.table_name.or(Some(String::new()));
295builder.key = builder.key.or(Some(::std::collections::HashMap::new()));
296builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
297 }
298 }
299impl GetItemInput {
300 /// Deserializes this structure from a body deserializer and HTTP response.
301 pub fn deserialize_with_response(
302 deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
303 _headers: &::aws_smithy_runtime_api::http::Headers,
304 _status: u16,
305 _body: &[u8],
306 ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
307 Self::deserialize(deserializer)
308 }
309 }
310impl GetItemInput {
311 /// Creates a new builder-style object to manufacture [`GetItemInput`](crate::operation::get_item::GetItemInput).
312 pub fn builder() -> crate::operation::get_item::builders::GetItemInputBuilder {
313 crate::operation::get_item::builders::GetItemInputBuilder::default()
314 }
315}
316
317/// A builder for [`GetItemInput`](crate::operation::get_item::GetItemInput).
318#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
319#[non_exhaustive]
320pub struct GetItemInputBuilder {
321 pub(crate) table_name: ::std::option::Option<::std::string::String>,
322 pub(crate) key: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>,
323 pub(crate) attributes_to_get: ::std::option::Option<::std::vec::Vec::<::std::string::String>>,
324 pub(crate) consistent_read: ::std::option::Option<bool>,
325 pub(crate) return_consumed_capacity: ::std::option::Option<crate::types::ReturnConsumedCapacity>,
326 pub(crate) projection_expression: ::std::option::Option<::std::string::String>,
327 pub(crate) expression_attribute_names: ::std::option::Option<::std::collections::HashMap::<::std::string::String, ::std::string::String>>,
328}
329impl GetItemInputBuilder {
330 /// <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>
331 /// This field is required.
332 pub fn table_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
333 self.table_name = ::std::option::Option::Some(input.into());
334 self
335 }
336 /// <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>
337 pub fn set_table_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
338 self.table_name = input; self
339 }
340 /// <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>
341 pub fn get_table_name(&self) -> &::std::option::Option<::std::string::String> {
342 &self.table_name
343 }
344 /// Adds a key-value pair to `key`.
345 ///
346 /// To override the contents of this collection use [`set_key`](Self::set_key).
347 ///
348 /// <p>A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item to retrieve.</p>
349 /// <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>
350 pub fn key(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::AttributeValue) -> Self {
351 let mut hash_map = self.key.unwrap_or_default();
352 hash_map.insert(k.into(), v);
353 self.key = ::std::option::Option::Some(hash_map);
354 self
355 }
356 /// <p>A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item to retrieve.</p>
357 /// <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>
358 pub fn set_key(mut self, input: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>) -> Self {
359 self.key = input; self
360 }
361 /// <p>A map of attribute names to <code>AttributeValue</code> objects, representing the primary key of the item to retrieve.</p>
362 /// <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>
363 pub fn get_key(&self) -> &::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>> {
364 &self.key
365 }
366 /// Appends an item to `attributes_to_get`.
367 ///
368 /// To override the contents of this collection use [`set_attributes_to_get`](Self::set_attributes_to_get).
369 ///
370 /// <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>
371 pub fn attributes_to_get(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
372 let mut v = self.attributes_to_get.unwrap_or_default();
373 v.push(input.into());
374 self.attributes_to_get = ::std::option::Option::Some(v);
375 self
376 }
377 /// <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>
378 pub fn set_attributes_to_get(mut self, input: ::std::option::Option<::std::vec::Vec::<::std::string::String>>) -> Self {
379 self.attributes_to_get = input; self
380 }
381 /// <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>
382 pub fn get_attributes_to_get(&self) -> &::std::option::Option<::std::vec::Vec::<::std::string::String>> {
383 &self.attributes_to_get
384 }
385 /// <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>
386 pub fn consistent_read(mut self, input: bool) -> Self {
387 self.consistent_read = ::std::option::Option::Some(input);
388 self
389 }
390 /// <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>
391 pub fn set_consistent_read(mut self, input: ::std::option::Option<bool>) -> Self {
392 self.consistent_read = input; self
393 }
394 /// <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>
395 pub fn get_consistent_read(&self) -> &::std::option::Option<bool> {
396 &self.consistent_read
397 }
398 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
399 /// <ul>
400 /// <li>
401 /// <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>
402 /// <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>
403 /// <li>
404 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
405 /// <li>
406 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
407 /// </ul>
408 pub fn return_consumed_capacity(mut self, input: crate::types::ReturnConsumedCapacity) -> Self {
409 self.return_consumed_capacity = ::std::option::Option::Some(input);
410 self
411 }
412 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
413 /// <ul>
414 /// <li>
415 /// <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>
416 /// <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>
417 /// <li>
418 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
419 /// <li>
420 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
421 /// </ul>
422 pub fn set_return_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ReturnConsumedCapacity>) -> Self {
423 self.return_consumed_capacity = input; self
424 }
425 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
426 /// <ul>
427 /// <li>
428 /// <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>
429 /// <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>
430 /// <li>
431 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
432 /// <li>
433 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
434 /// </ul>
435 pub fn get_return_consumed_capacity(&self) -> &::std::option::Option<crate::types::ReturnConsumedCapacity> {
436 &self.return_consumed_capacity
437 }
438 /// <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>
439 /// <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>
440 /// <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>
441 pub fn projection_expression(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
442 self.projection_expression = ::std::option::Option::Some(input.into());
443 self
444 }
445 /// <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>
446 /// <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>
447 /// <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>
448 pub fn set_projection_expression(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
449 self.projection_expression = input; self
450 }
451 /// <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>
452 /// <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>
453 /// <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>
454 pub fn get_projection_expression(&self) -> &::std::option::Option<::std::string::String> {
455 &self.projection_expression
456 }
457 /// Adds a key-value pair to `expression_attribute_names`.
458 ///
459 /// To override the contents of this collection use [`set_expression_attribute_names`](Self::set_expression_attribute_names).
460 ///
461 /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
462 /// <ul>
463 /// <li>
464 /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
465 /// <li>
466 /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
467 /// <li>
468 /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
469 /// </ul>
470 /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
471 /// <ul>
472 /// <li>
473 /// <p><code>Percentile</code></p></li>
474 /// </ul>
475 /// <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>
476 /// <ul>
477 /// <li>
478 /// <p><code>{"#P":"Percentile"}</code></p></li>
479 /// </ul>
480 /// <p>You could then use this substitution in an expression, as in this example:</p>
481 /// <ul>
482 /// <li>
483 /// <p><code>#P = :val</code></p></li>
484 /// </ul><note>
485 /// <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>
486 /// </note>
487 /// <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>
488 pub fn expression_attribute_names(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
489 let mut hash_map = self.expression_attribute_names.unwrap_or_default();
490 hash_map.insert(k.into(), v.into());
491 self.expression_attribute_names = ::std::option::Option::Some(hash_map);
492 self
493 }
494 /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
495 /// <ul>
496 /// <li>
497 /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
498 /// <li>
499 /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
500 /// <li>
501 /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
502 /// </ul>
503 /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
504 /// <ul>
505 /// <li>
506 /// <p><code>Percentile</code></p></li>
507 /// </ul>
508 /// <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>
509 /// <ul>
510 /// <li>
511 /// <p><code>{"#P":"Percentile"}</code></p></li>
512 /// </ul>
513 /// <p>You could then use this substitution in an expression, as in this example:</p>
514 /// <ul>
515 /// <li>
516 /// <p><code>#P = :val</code></p></li>
517 /// </ul><note>
518 /// <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>
519 /// </note>
520 /// <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>
521 pub fn set_expression_attribute_names(mut self, input: ::std::option::Option<::std::collections::HashMap::<::std::string::String, ::std::string::String>>) -> Self {
522 self.expression_attribute_names = input; self
523 }
524 /// <p>One or more substitution tokens for attribute names in an expression. The following are some use cases for using <code>ExpressionAttributeNames</code>:</p>
525 /// <ul>
526 /// <li>
527 /// <p>To access an attribute whose name conflicts with a DynamoDB reserved word.</p></li>
528 /// <li>
529 /// <p>To create a placeholder for repeating occurrences of an attribute name in an expression.</p></li>
530 /// <li>
531 /// <p>To prevent special characters in an attribute name from being misinterpreted in an expression.</p></li>
532 /// </ul>
533 /// <p>Use the <b>#</b> character in an expression to dereference an attribute name. For example, consider the following attribute name:</p>
534 /// <ul>
535 /// <li>
536 /// <p><code>Percentile</code></p></li>
537 /// </ul>
538 /// <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>
539 /// <ul>
540 /// <li>
541 /// <p><code>{"#P":"Percentile"}</code></p></li>
542 /// </ul>
543 /// <p>You could then use this substitution in an expression, as in this example:</p>
544 /// <ul>
545 /// <li>
546 /// <p><code>#P = :val</code></p></li>
547 /// </ul><note>
548 /// <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>
549 /// </note>
550 /// <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>
551 pub fn get_expression_attribute_names(&self) -> &::std::option::Option<::std::collections::HashMap::<::std::string::String, ::std::string::String>> {
552 &self.expression_attribute_names
553 }
554 /// Consumes the builder and constructs a [`GetItemInput`](crate::operation::get_item::GetItemInput).
555 pub fn build(self) -> ::std::result::Result<crate::operation::get_item::GetItemInput, ::aws_smithy_types::error::operation::BuildError> {
556 ::std::result::Result::Ok(
557 crate::operation::get_item::GetItemInput {
558 table_name: self.table_name
559 ,
560 key: self.key
561 ,
562 attributes_to_get: self.attributes_to_get
563 ,
564 consistent_read: self.consistent_read
565 ,
566 return_consumed_capacity: self.return_consumed_capacity
567 ,
568 projection_expression: self.projection_expression
569 ,
570 expression_attribute_names: self.expression_attribute_names
571 ,
572 }
573 )
574 }
575}
576