aws_sdk_dynamodb/operation/update_item/
_update_item_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Represents the output of an <code>UpdateItem</code> operation.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct UpdateItemOutput  {
7    /// <p>A map of attribute values as they appear before or after the <code>UpdateItem</code> operation, as determined by the <code>ReturnValues</code> parameter.</p>
8    /// <p>The <code>Attributes</code> map is only present if the update was successful and <code>ReturnValues</code> was specified as something other than <code>NONE</code> in the request. Each element represents one attribute.</p>
9    pub attributes: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>,
10    /// <p>The capacity units consumed by the <code>UpdateItem</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>
11    pub consumed_capacity: ::std::option::Option<crate::types::ConsumedCapacity>,
12    /// <p>Information about item collections, if any, that were affected by the <code>UpdateItem</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>
13    /// <p>Each <code>ItemCollectionMetrics</code> element consists of:</p>
14    /// <ul>
15    /// <li>
16    /// <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>
17    /// <li>
18    /// <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>
19    /// <p>The estimate is subject to change over time; therefore, do not rely on the precision or accuracy of the estimate.</p></li>
20    /// </ul>
21    pub item_collection_metrics: ::std::option::Option<crate::types::ItemCollectionMetrics>,
22    _request_id: Option<String>,
23}
24impl  UpdateItemOutput  {
25    /// <p>A map of attribute values as they appear before or after the <code>UpdateItem</code> operation, as determined by the <code>ReturnValues</code> parameter.</p>
26    /// <p>The <code>Attributes</code> map is only present if the update was successful and <code>ReturnValues</code> was specified as something other than <code>NONE</code> in the request. Each element represents one attribute.</p>
27    pub fn attributes(&self) -> ::std::option::Option<&::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>> {
28        self.attributes.as_ref()
29    }
30    /// <p>The capacity units consumed by the <code>UpdateItem</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>
31    pub fn consumed_capacity(&self) -> ::std::option::Option<&crate::types::ConsumedCapacity> {
32        self.consumed_capacity.as_ref()
33    }
34    /// <p>Information about item collections, if any, that were affected by the <code>UpdateItem</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>
35    /// <p>Each <code>ItemCollectionMetrics</code> element consists of:</p>
36    /// <ul>
37    /// <li>
38    /// <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>
39    /// <li>
40    /// <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>
41    /// <p>The estimate is subject to change over time; therefore, do not rely on the precision or accuracy of the estimate.</p></li>
42    /// </ul>
43    pub fn item_collection_metrics(&self) -> ::std::option::Option<&crate::types::ItemCollectionMetrics> {
44        self.item_collection_metrics.as_ref()
45    }
46}
47static UPDATEITEMOUTPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.dynamodb.synthetic#UpdateItemOutput", "com.amazonaws.dynamodb.synthetic", "UpdateItemOutput");
48static UPDATEITEMOUTPUT_MEMBER_ATTRIBUTES: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
49                            ::aws_smithy_schema::ShapeId::from_static(
50                                "com.amazonaws.dynamodb.synthetic#UpdateItemOutput$Attributes",
51                                "com.amazonaws.dynamodb.synthetic",
52                                "UpdateItemOutput",
53                            ),
54                            ::aws_smithy_schema::ShapeType::Map,
55                            "Attributes",
56                            0,
57                        );
58static UPDATEITEMOUTPUT_MEMBER_CONSUMED_CAPACITY: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
59                            ::aws_smithy_schema::ShapeId::from_static(
60                                "com.amazonaws.dynamodb.synthetic#UpdateItemOutput$ConsumedCapacity",
61                                "com.amazonaws.dynamodb.synthetic",
62                                "UpdateItemOutput",
63                            ),
64                            ::aws_smithy_schema::ShapeType::Structure,
65                            "ConsumedCapacity",
66                            1,
67                        );
68static UPDATEITEMOUTPUT_MEMBER_ITEM_COLLECTION_METRICS: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
69                            ::aws_smithy_schema::ShapeId::from_static(
70                                "com.amazonaws.dynamodb.synthetic#UpdateItemOutput$ItemCollectionMetrics",
71                                "com.amazonaws.dynamodb.synthetic",
72                                "UpdateItemOutput",
73                            ),
74                            ::aws_smithy_schema::ShapeType::Structure,
75                            "ItemCollectionMetrics",
76                            2,
77                        );
78static UPDATEITEMOUTPUT_MEMBER__REQUEST_ID: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
79                            ::aws_smithy_schema::ShapeId::from_static(
80                                "synthetic#request_id",
81                                "synthetic",
82                                "request_id",
83                            ),
84                            ::aws_smithy_schema::ShapeType::String,
85                            "request_id",
86                            3,
87                        ).with_http_header("x-amzn-requestid");
88static UPDATEITEMOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
89                            UPDATEITEMOUTPUT_SCHEMA_ID,
90                            ::aws_smithy_schema::ShapeType::Structure,
91                            &[&UPDATEITEMOUTPUT_MEMBER_ATTRIBUTES, &UPDATEITEMOUTPUT_MEMBER_CONSUMED_CAPACITY, &UPDATEITEMOUTPUT_MEMBER_ITEM_COLLECTION_METRICS, &UPDATEITEMOUTPUT_MEMBER__REQUEST_ID],
92                        );
93impl UpdateItemOutput {
94                /// The schema for this shape.
95                pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &UPDATEITEMOUTPUT_SCHEMA;
96            }
97impl ::aws_smithy_schema::serde::SerializableStruct for UpdateItemOutput {
98                #[allow(unused_variables, clippy::diverging_sub_expression)]
99                fn serialize_members(&self, ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
100                    if let Some(ref val) = self.attributes {
101                                
102                    ser.write_map(&UPDATEITEMOUTPUT_MEMBER_ATTRIBUTES, &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
103                        for (key, value) in val {
104                            ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
105                            ser.write_struct(crate::types::AttributeValue::SCHEMA, value)?;
106                        }
107                        Ok(())
108                    })?;
109                    
110                            }
111if let Some(ref val) = self.consumed_capacity {
112                                ser.write_struct(&UPDATEITEMOUTPUT_MEMBER_CONSUMED_CAPACITY, val)?;
113                            }
114if let Some(ref val) = self.item_collection_metrics {
115                                ser.write_struct(&UPDATEITEMOUTPUT_MEMBER_ITEM_COLLECTION_METRICS, val)?;
116                            }
117                    Ok(())
118                }
119            }
120impl UpdateItemOutput {
121                /// Deserializes this structure from a [`ShapeDeserializer`].
122                pub fn deserialize(deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
123                    #[allow(unused_variables, unused_mut)]
124                    let mut builder = Self::builder();
125                    #[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding, clippy::diverging_sub_expression)]
126                    deserializer.read_struct(&UPDATEITEMOUTPUT_SCHEMA, &mut |member, deser| {
127                        match member.member_index() {
128                            Some(0) => {
129                                    builder.attributes = 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 });
130                                }
131Some(1) => {
132                                    builder.consumed_capacity = Some(crate::types::ConsumedCapacity::deserialize(deser)?);
133                                }
134Some(2) => {
135                                    builder.item_collection_metrics = Some(crate::types::ItemCollectionMetrics::deserialize(deser)?);
136                                }
137Some(3) => {
138                                builder._request_id = Some(deser.read_string(member)?);
139                            }
140                            _ => {}
141                        }
142                        Ok(())
143                    })?;
144                    Ok(builder.build())
145                }
146            }
147impl UpdateItemOutput {
148                /// Deserializes this structure from a body deserializer and HTTP response headers.
149                /// Header-bound members are read directly from headers, avoiding runtime
150                /// member iteration overhead. Body members are read via the deserializer.
151                pub fn deserialize_with_response(
152                    deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
153                    headers: &::aws_smithy_runtime_api::http::Headers,
154                    _status: u16,
155                    _body: &[u8],
156                ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
157                    #[allow(unused_variables, unused_mut)]
158                    let mut builder = Self::builder();
159if let Some(val) = headers.get("x-amzn-requestid") {
160                    builder._request_id = Some(val.to_string());
161                }
162#[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding, clippy::diverging_sub_expression)]
163                    deserializer.read_struct(&UPDATEITEMOUTPUT_SCHEMA, &mut |member, deser| {
164                        match member.member_index() {
165                            Some(0) => { builder.attributes = 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 }); }
166Some(1) => { builder.consumed_capacity = Some(crate::types::ConsumedCapacity::deserialize(deser)?); }
167Some(2) => { builder.item_collection_metrics = Some(crate::types::ItemCollectionMetrics::deserialize(deser)?); }
168                            _ => {}
169                        }
170                        Ok(())
171                    })?;
172                    Ok(builder.build())
173                    }
174                    }
175impl ::aws_types::request_id::RequestId for UpdateItemOutput {
176                                    fn request_id(&self) -> Option<&str> {
177                                        self._request_id.as_deref()
178                                    }
179                                }
180impl UpdateItemOutput {
181    /// Creates a new builder-style object to manufacture [`UpdateItemOutput`](crate::operation::update_item::UpdateItemOutput).
182    pub fn builder() -> crate::operation::update_item::builders::UpdateItemOutputBuilder {
183        crate::operation::update_item::builders::UpdateItemOutputBuilder::default()
184    }
185}
186
187/// A builder for [`UpdateItemOutput`](crate::operation::update_item::UpdateItemOutput).
188#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
189#[non_exhaustive]
190pub struct UpdateItemOutputBuilder {
191    pub(crate) attributes: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>,
192    pub(crate) consumed_capacity: ::std::option::Option<crate::types::ConsumedCapacity>,
193    pub(crate) item_collection_metrics: ::std::option::Option<crate::types::ItemCollectionMetrics>,
194    _request_id: Option<String>,
195}
196impl UpdateItemOutputBuilder {
197    /// Adds a key-value pair to `attributes`.
198    ///
199    /// To override the contents of this collection use [`set_attributes`](Self::set_attributes).
200    ///
201    /// <p>A map of attribute values as they appear before or after the <code>UpdateItem</code> operation, as determined by the <code>ReturnValues</code> parameter.</p>
202    /// <p>The <code>Attributes</code> map is only present if the update was successful and <code>ReturnValues</code> was specified as something other than <code>NONE</code> in the request. Each element represents one attribute.</p>
203    pub fn attributes(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::AttributeValue) -> Self {
204        let mut hash_map = self.attributes.unwrap_or_default();
205                        hash_map.insert(k.into(), v);
206                        self.attributes = ::std::option::Option::Some(hash_map);
207                        self
208    }
209    /// <p>A map of attribute values as they appear before or after the <code>UpdateItem</code> operation, as determined by the <code>ReturnValues</code> parameter.</p>
210    /// <p>The <code>Attributes</code> map is only present if the update was successful and <code>ReturnValues</code> was specified as something other than <code>NONE</code> in the request. Each element represents one attribute.</p>
211    pub fn set_attributes(mut self, input: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>) -> Self {
212        self.attributes = input; self
213    }
214    /// <p>A map of attribute values as they appear before or after the <code>UpdateItem</code> operation, as determined by the <code>ReturnValues</code> parameter.</p>
215    /// <p>The <code>Attributes</code> map is only present if the update was successful and <code>ReturnValues</code> was specified as something other than <code>NONE</code> in the request. Each element represents one attribute.</p>
216    pub fn get_attributes(&self) -> &::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>> {
217        &self.attributes
218    }
219    /// <p>The capacity units consumed by the <code>UpdateItem</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>
220    pub fn consumed_capacity(mut self, input: crate::types::ConsumedCapacity) -> Self {
221        self.consumed_capacity = ::std::option::Option::Some(input);
222        self
223    }
224    /// <p>The capacity units consumed by the <code>UpdateItem</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>
225    pub fn set_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ConsumedCapacity>) -> Self {
226        self.consumed_capacity = input; self
227    }
228    /// <p>The capacity units consumed by the <code>UpdateItem</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>
229    pub fn get_consumed_capacity(&self) -> &::std::option::Option<crate::types::ConsumedCapacity> {
230        &self.consumed_capacity
231    }
232    /// <p>Information about item collections, if any, that were affected by the <code>UpdateItem</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>
233    /// <p>Each <code>ItemCollectionMetrics</code> element consists of:</p>
234    /// <ul>
235    /// <li>
236    /// <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>
237    /// <li>
238    /// <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>
239    /// <p>The estimate is subject to change over time; therefore, do not rely on the precision or accuracy of the estimate.</p></li>
240    /// </ul>
241    pub fn item_collection_metrics(mut self, input: crate::types::ItemCollectionMetrics) -> Self {
242        self.item_collection_metrics = ::std::option::Option::Some(input);
243        self
244    }
245    /// <p>Information about item collections, if any, that were affected by the <code>UpdateItem</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>
246    /// <p>Each <code>ItemCollectionMetrics</code> element consists of:</p>
247    /// <ul>
248    /// <li>
249    /// <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>
250    /// <li>
251    /// <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>
252    /// <p>The estimate is subject to change over time; therefore, do not rely on the precision or accuracy of the estimate.</p></li>
253    /// </ul>
254    pub fn set_item_collection_metrics(mut self, input: ::std::option::Option<crate::types::ItemCollectionMetrics>) -> Self {
255        self.item_collection_metrics = input; self
256    }
257    /// <p>Information about item collections, if any, that were affected by the <code>UpdateItem</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>
258    /// <p>Each <code>ItemCollectionMetrics</code> element consists of:</p>
259    /// <ul>
260    /// <li>
261    /// <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>
262    /// <li>
263    /// <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>
264    /// <p>The estimate is subject to change over time; therefore, do not rely on the precision or accuracy of the estimate.</p></li>
265    /// </ul>
266    pub fn get_item_collection_metrics(&self) -> &::std::option::Option<crate::types::ItemCollectionMetrics> {
267        &self.item_collection_metrics
268    }
269    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
270                                        self._request_id = Some(request_id.into());
271                                        self
272                                    }
273    
274                                    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
275                                        self._request_id = request_id;
276                                        self
277                                    }
278    /// Consumes the builder and constructs a [`UpdateItemOutput`](crate::operation::update_item::UpdateItemOutput).
279    pub fn build(self) -> crate::operation::update_item::UpdateItemOutput {
280        crate::operation::update_item::UpdateItemOutput {
281            attributes: self.attributes
282            ,
283            consumed_capacity: self.consumed_capacity
284            ,
285            item_collection_metrics: self.item_collection_metrics
286            ,
287            _request_id: self._request_id,
288        }
289    }
290}
291