aws_sdk_dynamodb/operation/get_item/_get_item_output.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Represents the output of a <code>GetItem</code> operation.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct GetItemOutput {
7 /// <p>A map of attribute names to <code>AttributeValue</code> objects, as specified by <code>ProjectionExpression</code>.</p>
8 pub item: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>,
9 /// <p>The capacity units consumed by the <code>GetItem</code> operation. The data returned includes the total provisioned throughput consumed, along with statistics for the table and any indexes involved in the operation. <code>ConsumedCapacity</code> is only returned if the <code>ReturnConsumedCapacity</code> parameter was specified. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/read-write-operations.html#read-operation-consumption">Capacity unit consumption for read operations</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
10 pub consumed_capacity: ::std::option::Option<crate::types::ConsumedCapacity>,
11 _request_id: Option<String>,
12}
13impl GetItemOutput {
14 /// <p>A map of attribute names to <code>AttributeValue</code> objects, as specified by <code>ProjectionExpression</code>.</p>
15 pub fn item(&self) -> ::std::option::Option<&::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>> {
16 self.item.as_ref()
17 }
18 /// <p>The capacity units consumed by the <code>GetItem</code> operation. The data returned includes the total provisioned throughput consumed, along with statistics for the table and any indexes involved in the operation. <code>ConsumedCapacity</code> is only returned if the <code>ReturnConsumedCapacity</code> parameter was specified. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/read-write-operations.html#read-operation-consumption">Capacity unit consumption for read operations</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
19 pub fn consumed_capacity(&self) -> ::std::option::Option<&crate::types::ConsumedCapacity> {
20 self.consumed_capacity.as_ref()
21 }
22}
23impl ::aws_types::request_id::RequestId for GetItemOutput {
24 fn request_id(&self) -> Option<&str> {
25 self._request_id.as_deref()
26 }
27 }
28impl GetItemOutput {
29 /// Creates a new builder-style object to manufacture [`GetItemOutput`](crate::operation::get_item::GetItemOutput).
30 pub fn builder() -> crate::operation::get_item::builders::GetItemOutputBuilder {
31 crate::operation::get_item::builders::GetItemOutputBuilder::default()
32 }
33}
34
35/// A builder for [`GetItemOutput`](crate::operation::get_item::GetItemOutput).
36#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
37#[non_exhaustive]
38pub struct GetItemOutputBuilder {
39 pub(crate) item: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>,
40 pub(crate) consumed_capacity: ::std::option::Option<crate::types::ConsumedCapacity>,
41 _request_id: Option<String>,
42}
43impl GetItemOutputBuilder {
44 /// Adds a key-value pair to `item`.
45 ///
46 /// To override the contents of this collection use [`set_item`](Self::set_item).
47 ///
48 /// <p>A map of attribute names to <code>AttributeValue</code> objects, as specified by <code>ProjectionExpression</code>.</p>
49 pub fn item(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::AttributeValue) -> Self {
50 let mut hash_map = self.item.unwrap_or_default();
51 hash_map.insert(k.into(), v);
52 self.item = ::std::option::Option::Some(hash_map);
53 self
54 }
55 /// <p>A map of attribute names to <code>AttributeValue</code> objects, as specified by <code>ProjectionExpression</code>.</p>
56 pub fn set_item(mut self, input: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>) -> Self {
57 self.item = input; self
58 }
59 /// <p>A map of attribute names to <code>AttributeValue</code> objects, as specified by <code>ProjectionExpression</code>.</p>
60 pub fn get_item(&self) -> &::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>> {
61 &self.item
62 }
63 /// <p>The capacity units consumed by the <code>GetItem</code> operation. The data returned includes the total provisioned throughput consumed, along with statistics for the table and any indexes involved in the operation. <code>ConsumedCapacity</code> is only returned if the <code>ReturnConsumedCapacity</code> parameter was specified. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/read-write-operations.html#read-operation-consumption">Capacity unit consumption for read operations</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
64 pub fn consumed_capacity(mut self, input: crate::types::ConsumedCapacity) -> Self {
65 self.consumed_capacity = ::std::option::Option::Some(input);
66 self
67 }
68 /// <p>The capacity units consumed by the <code>GetItem</code> operation. The data returned includes the total provisioned throughput consumed, along with statistics for the table and any indexes involved in the operation. <code>ConsumedCapacity</code> is only returned if the <code>ReturnConsumedCapacity</code> parameter was specified. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/read-write-operations.html#read-operation-consumption">Capacity unit consumption for read operations</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
69 pub fn set_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ConsumedCapacity>) -> Self {
70 self.consumed_capacity = input; self
71 }
72 /// <p>The capacity units consumed by the <code>GetItem</code> operation. The data returned includes the total provisioned throughput consumed, along with statistics for the table and any indexes involved in the operation. <code>ConsumedCapacity</code> is only returned if the <code>ReturnConsumedCapacity</code> parameter was specified. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/read-write-operations.html#read-operation-consumption">Capacity unit consumption for read operations</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
73 pub fn get_consumed_capacity(&self) -> &::std::option::Option<crate::types::ConsumedCapacity> {
74 &self.consumed_capacity
75 }
76 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
77 self._request_id = Some(request_id.into());
78 self
79 }
80
81 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
82 self._request_id = request_id;
83 self
84 }
85 /// Consumes the builder and constructs a [`GetItemOutput`](crate::operation::get_item::GetItemOutput).
86 pub fn build(self) -> crate::operation::get_item::GetItemOutput {
87 crate::operation::get_item::GetItemOutput {
88 item: self.item
89 ,
90 consumed_capacity: self.consumed_capacity
91 ,
92 _request_id: self._request_id,
93 }
94 }
95}
96