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(
57 mut self,
58 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AttributeValue>>,
59 ) -> Self {
60 self.item = input;
61 self
62 }
63 /// <p>A map of attribute names to <code>AttributeValue</code> objects, as specified by <code>ProjectionExpression</code>.</p>
64 pub fn get_item(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::AttributeValue>> {
65 &self.item
66 }
67 /// <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>
68 pub fn consumed_capacity(mut self, input: crate::types::ConsumedCapacity) -> Self {
69 self.consumed_capacity = ::std::option::Option::Some(input);
70 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 set_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ConsumedCapacity>) -> Self {
74 self.consumed_capacity = input;
75 self
76 }
77 /// <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>
78 pub fn get_consumed_capacity(&self) -> &::std::option::Option<crate::types::ConsumedCapacity> {
79 &self.consumed_capacity
80 }
81 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
82 self._request_id = Some(request_id.into());
83 self
84 }
85
86 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
87 self._request_id = request_id;
88 self
89 }
90 /// Consumes the builder and constructs a [`GetItemOutput`](crate::operation::get_item::GetItemOutput).
91 pub fn build(self) -> crate::operation::get_item::GetItemOutput {
92 crate::operation::get_item::GetItemOutput {
93 item: self.item,
94 consumed_capacity: self.consumed_capacity,
95 _request_id: self._request_id,
96 }
97 }
98}