aws_sdk_dynamodb/operation/put_item/_put_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>PutItem</code> operation.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct PutItemOutput {
7 /// <p>The attribute values as they appeared before the <code>PutItem</code> operation, but only if <code>ReturnValues</code> is specified as <code>ALL_OLD</code> in the request. Each element consists of an attribute name and an attribute value.</p>
8 pub attributes: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>,
9 /// <p>The capacity units consumed by the <code>PutItem</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#write-operation-consumption">Capacity unity consumption for write operations</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
10 pub consumed_capacity: ::std::option::Option<crate::types::ConsumedCapacity>,
11 /// <p>Information about item collections, if any, that were affected by the <code>PutItem</code> operation. <code>ItemCollectionMetrics</code> is only returned if the <code>ReturnItemCollectionMetrics</code> parameter was specified. If the table does not have any local secondary indexes, this information is not returned in the response.</p>
12 /// <p>Each <code>ItemCollectionMetrics</code> element consists of:</p>
13 /// <ul>
14 /// <li>
15 /// <p><code>ItemCollectionKey</code> - The partition key value of the item collection. This is the same as the partition key value of the item itself.</p></li>
16 /// <li>
17 /// <p><code>SizeEstimateRangeGB</code> - An estimate of item collection size, in gigabytes. This value is a two-element array containing a lower bound and an upper bound for the estimate. The estimate includes the size of all the items in the table, plus the size of all attributes projected into all of the local secondary indexes on that table. Use this estimate to measure whether a local secondary index is approaching its size limit.</p>
18 /// <p>The estimate is subject to change over time; therefore, do not rely on the precision or accuracy of the estimate.</p></li>
19 /// </ul>
20 pub item_collection_metrics: ::std::option::Option<crate::types::ItemCollectionMetrics>,
21 _request_id: Option<String>,
22}
23impl PutItemOutput {
24 /// <p>The attribute values as they appeared before the <code>PutItem</code> operation, but only if <code>ReturnValues</code> is specified as <code>ALL_OLD</code> in the request. Each element consists of an attribute name and an attribute value.</p>
25 pub fn attributes(&self) -> ::std::option::Option<&::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>> {
26 self.attributes.as_ref()
27 }
28 /// <p>The capacity units consumed by the <code>PutItem</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#write-operation-consumption">Capacity unity consumption for write operations</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
29 pub fn consumed_capacity(&self) -> ::std::option::Option<&crate::types::ConsumedCapacity> {
30 self.consumed_capacity.as_ref()
31 }
32 /// <p>Information about item collections, if any, that were affected by the <code>PutItem</code> operation. <code>ItemCollectionMetrics</code> is only returned if the <code>ReturnItemCollectionMetrics</code> parameter was specified. If the table does not have any local secondary indexes, this information is not returned in the response.</p>
33 /// <p>Each <code>ItemCollectionMetrics</code> element consists of:</p>
34 /// <ul>
35 /// <li>
36 /// <p><code>ItemCollectionKey</code> - The partition key value of the item collection. This is the same as the partition key value of the item itself.</p></li>
37 /// <li>
38 /// <p><code>SizeEstimateRangeGB</code> - An estimate of item collection size, in gigabytes. This value is a two-element array containing a lower bound and an upper bound for the estimate. The estimate includes the size of all the items in the table, plus the size of all attributes projected into all of the local secondary indexes on that table. Use this estimate to measure whether a local secondary index is approaching its size limit.</p>
39 /// <p>The estimate is subject to change over time; therefore, do not rely on the precision or accuracy of the estimate.</p></li>
40 /// </ul>
41 pub fn item_collection_metrics(&self) -> ::std::option::Option<&crate::types::ItemCollectionMetrics> {
42 self.item_collection_metrics.as_ref()
43 }
44}
45impl ::aws_types::request_id::RequestId for PutItemOutput {
46 fn request_id(&self) -> Option<&str> {
47 self._request_id.as_deref()
48 }
49 }
50impl PutItemOutput {
51 /// Creates a new builder-style object to manufacture [`PutItemOutput`](crate::operation::put_item::PutItemOutput).
52 pub fn builder() -> crate::operation::put_item::builders::PutItemOutputBuilder {
53 crate::operation::put_item::builders::PutItemOutputBuilder::default()
54 }
55}
56
57/// A builder for [`PutItemOutput`](crate::operation::put_item::PutItemOutput).
58#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
59#[non_exhaustive]
60pub struct PutItemOutputBuilder {
61 pub(crate) attributes: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>,
62 pub(crate) consumed_capacity: ::std::option::Option<crate::types::ConsumedCapacity>,
63 pub(crate) item_collection_metrics: ::std::option::Option<crate::types::ItemCollectionMetrics>,
64 _request_id: Option<String>,
65}
66impl PutItemOutputBuilder {
67 /// Adds a key-value pair to `attributes`.
68 ///
69 /// To override the contents of this collection use [`set_attributes`](Self::set_attributes).
70 ///
71 /// <p>The attribute values as they appeared before the <code>PutItem</code> operation, but only if <code>ReturnValues</code> is specified as <code>ALL_OLD</code> in the request. Each element consists of an attribute name and an attribute value.</p>
72 pub fn attributes(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::AttributeValue) -> Self {
73 let mut hash_map = self.attributes.unwrap_or_default();
74 hash_map.insert(k.into(), v);
75 self.attributes = ::std::option::Option::Some(hash_map);
76 self
77 }
78 /// <p>The attribute values as they appeared before the <code>PutItem</code> operation, but only if <code>ReturnValues</code> is specified as <code>ALL_OLD</code> in the request. Each element consists of an attribute name and an attribute value.</p>
79 pub fn set_attributes(mut self, input: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>) -> Self {
80 self.attributes = input; self
81 }
82 /// <p>The attribute values as they appeared before the <code>PutItem</code> operation, but only if <code>ReturnValues</code> is specified as <code>ALL_OLD</code> in the request. Each element consists of an attribute name and an attribute value.</p>
83 pub fn get_attributes(&self) -> &::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>> {
84 &self.attributes
85 }
86 /// <p>The capacity units consumed by the <code>PutItem</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#write-operation-consumption">Capacity unity consumption for write operations</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
87 pub fn consumed_capacity(mut self, input: crate::types::ConsumedCapacity) -> Self {
88 self.consumed_capacity = ::std::option::Option::Some(input);
89 self
90 }
91 /// <p>The capacity units consumed by the <code>PutItem</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#write-operation-consumption">Capacity unity consumption for write operations</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
92 pub fn set_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ConsumedCapacity>) -> Self {
93 self.consumed_capacity = input; self
94 }
95 /// <p>The capacity units consumed by the <code>PutItem</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#write-operation-consumption">Capacity unity consumption for write operations</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
96 pub fn get_consumed_capacity(&self) -> &::std::option::Option<crate::types::ConsumedCapacity> {
97 &self.consumed_capacity
98 }
99 /// <p>Information about item collections, if any, that were affected by the <code>PutItem</code> operation. <code>ItemCollectionMetrics</code> is only returned if the <code>ReturnItemCollectionMetrics</code> parameter was specified. If the table does not have any local secondary indexes, this information is not returned in the response.</p>
100 /// <p>Each <code>ItemCollectionMetrics</code> element consists of:</p>
101 /// <ul>
102 /// <li>
103 /// <p><code>ItemCollectionKey</code> - The partition key value of the item collection. This is the same as the partition key value of the item itself.</p></li>
104 /// <li>
105 /// <p><code>SizeEstimateRangeGB</code> - An estimate of item collection size, in gigabytes. This value is a two-element array containing a lower bound and an upper bound for the estimate. The estimate includes the size of all the items in the table, plus the size of all attributes projected into all of the local secondary indexes on that table. Use this estimate to measure whether a local secondary index is approaching its size limit.</p>
106 /// <p>The estimate is subject to change over time; therefore, do not rely on the precision or accuracy of the estimate.</p></li>
107 /// </ul>
108 pub fn item_collection_metrics(mut self, input: crate::types::ItemCollectionMetrics) -> Self {
109 self.item_collection_metrics = ::std::option::Option::Some(input);
110 self
111 }
112 /// <p>Information about item collections, if any, that were affected by the <code>PutItem</code> operation. <code>ItemCollectionMetrics</code> is only returned if the <code>ReturnItemCollectionMetrics</code> parameter was specified. If the table does not have any local secondary indexes, this information is not returned in the response.</p>
113 /// <p>Each <code>ItemCollectionMetrics</code> element consists of:</p>
114 /// <ul>
115 /// <li>
116 /// <p><code>ItemCollectionKey</code> - The partition key value of the item collection. This is the same as the partition key value of the item itself.</p></li>
117 /// <li>
118 /// <p><code>SizeEstimateRangeGB</code> - An estimate of item collection size, in gigabytes. This value is a two-element array containing a lower bound and an upper bound for the estimate. The estimate includes the size of all the items in the table, plus the size of all attributes projected into all of the local secondary indexes on that table. Use this estimate to measure whether a local secondary index is approaching its size limit.</p>
119 /// <p>The estimate is subject to change over time; therefore, do not rely on the precision or accuracy of the estimate.</p></li>
120 /// </ul>
121 pub fn set_item_collection_metrics(mut self, input: ::std::option::Option<crate::types::ItemCollectionMetrics>) -> Self {
122 self.item_collection_metrics = input; self
123 }
124 /// <p>Information about item collections, if any, that were affected by the <code>PutItem</code> operation. <code>ItemCollectionMetrics</code> is only returned if the <code>ReturnItemCollectionMetrics</code> parameter was specified. If the table does not have any local secondary indexes, this information is not returned in the response.</p>
125 /// <p>Each <code>ItemCollectionMetrics</code> element consists of:</p>
126 /// <ul>
127 /// <li>
128 /// <p><code>ItemCollectionKey</code> - The partition key value of the item collection. This is the same as the partition key value of the item itself.</p></li>
129 /// <li>
130 /// <p><code>SizeEstimateRangeGB</code> - An estimate of item collection size, in gigabytes. This value is a two-element array containing a lower bound and an upper bound for the estimate. The estimate includes the size of all the items in the table, plus the size of all attributes projected into all of the local secondary indexes on that table. Use this estimate to measure whether a local secondary index is approaching its size limit.</p>
131 /// <p>The estimate is subject to change over time; therefore, do not rely on the precision or accuracy of the estimate.</p></li>
132 /// </ul>
133 pub fn get_item_collection_metrics(&self) -> &::std::option::Option<crate::types::ItemCollectionMetrics> {
134 &self.item_collection_metrics
135 }
136 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
137 self._request_id = Some(request_id.into());
138 self
139 }
140
141 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
142 self._request_id = request_id;
143 self
144 }
145 /// Consumes the builder and constructs a [`PutItemOutput`](crate::operation::put_item::PutItemOutput).
146 pub fn build(self) -> crate::operation::put_item::PutItemOutput {
147 crate::operation::put_item::PutItemOutput {
148 attributes: self.attributes
149 ,
150 consumed_capacity: self.consumed_capacity
151 ,
152 item_collection_metrics: self.item_collection_metrics
153 ,
154 _request_id: self._request_id,
155 }
156 }
157}
158