aws_sdk_dynamodb/operation/get_item/
_get_item_output.rs1#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct GetItemOutput {
7 pub item: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>,
9 pub consumed_capacity: ::std::option::Option<crate::types::ConsumedCapacity>,
11 _request_id: Option<String>,
12}
13impl GetItemOutput {
14 pub fn item(&self) -> ::std::option::Option<&::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>> {
16 self.item.as_ref()
17 }
18 pub fn consumed_capacity(&self) -> ::std::option::Option<&crate::types::ConsumedCapacity> {
20 self.consumed_capacity.as_ref()
21 }
22}
23static GETITEMOUTPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.dynamodb.synthetic#GetItemOutput", "com.amazonaws.dynamodb.synthetic", "GetItemOutput");
24static GETITEMOUTPUT_MEMBER_ITEM: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
25 ::aws_smithy_schema::ShapeId::from_static(
26 "com.amazonaws.dynamodb.synthetic#GetItemOutput$Item",
27 "com.amazonaws.dynamodb.synthetic",
28 "GetItemOutput",
29 ),
30 ::aws_smithy_schema::ShapeType::Map,
31 "Item",
32 0,
33 );
34static GETITEMOUTPUT_MEMBER_CONSUMED_CAPACITY: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
35 ::aws_smithy_schema::ShapeId::from_static(
36 "com.amazonaws.dynamodb.synthetic#GetItemOutput$ConsumedCapacity",
37 "com.amazonaws.dynamodb.synthetic",
38 "GetItemOutput",
39 ),
40 ::aws_smithy_schema::ShapeType::Structure,
41 "ConsumedCapacity",
42 1,
43 );
44static GETITEMOUTPUT_MEMBER__REQUEST_ID: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
45 ::aws_smithy_schema::ShapeId::from_static(
46 "synthetic#request_id",
47 "synthetic",
48 "request_id",
49 ),
50 ::aws_smithy_schema::ShapeType::String,
51 "request_id",
52 2,
53 ).with_http_header("x-amzn-requestid");
54static GETITEMOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
55 GETITEMOUTPUT_SCHEMA_ID,
56 ::aws_smithy_schema::ShapeType::Structure,
57 &[&GETITEMOUTPUT_MEMBER_ITEM, &GETITEMOUTPUT_MEMBER_CONSUMED_CAPACITY, &GETITEMOUTPUT_MEMBER__REQUEST_ID],
58 );
59impl GetItemOutput {
60 pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &GETITEMOUTPUT_SCHEMA;
62 }
63impl ::aws_smithy_schema::serde::SerializableStruct for GetItemOutput {
64 #[allow(unused_variables, clippy::diverging_sub_expression)]
65 fn serialize_members(&self, ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
66 if let Some(ref val) = self.item {
67
68 ser.write_map(&GETITEMOUTPUT_MEMBER_ITEM, &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
69 for (key, value) in val {
70 ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
71 ser.write_struct(crate::types::AttributeValue::SCHEMA, value)?;
72 }
73 Ok(())
74 })?;
75
76 }
77if let Some(ref val) = self.consumed_capacity {
78 ser.write_struct(&GETITEMOUTPUT_MEMBER_CONSUMED_CAPACITY, val)?;
79 }
80 Ok(())
81 }
82 }
83impl GetItemOutput {
84 pub fn deserialize(deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
86 #[allow(unused_variables, unused_mut)]
87 let mut builder = Self::builder();
88 #[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding, clippy::diverging_sub_expression)]
89 deserializer.read_struct(&GETITEMOUTPUT_SCHEMA, &mut |member, deser| {
90 match member.member_index() {
91 Some(0) => {
92 builder.item = 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 });
93 }
94Some(1) => {
95 builder.consumed_capacity = Some(crate::types::ConsumedCapacity::deserialize(deser)?);
96 }
97Some(2) => {
98 builder._request_id = Some(deser.read_string(member)?);
99 }
100 _ => {}
101 }
102 Ok(())
103 })?;
104 Ok(builder.build())
105 }
106 }
107impl GetItemOutput {
108 pub fn deserialize_with_response(
112 deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
113 headers: &::aws_smithy_runtime_api::http::Headers,
114 _status: u16,
115 _body: &[u8],
116 ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
117 #[allow(unused_variables, unused_mut)]
118 let mut builder = Self::builder();
119if let Some(val) = headers.get("x-amzn-requestid") {
120 builder._request_id = Some(val.to_string());
121 }
122#[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding, clippy::diverging_sub_expression)]
123 deserializer.read_struct(&GETITEMOUTPUT_SCHEMA, &mut |member, deser| {
124 match member.member_index() {
125 Some(0) => { builder.item = 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 }); }
126Some(1) => { builder.consumed_capacity = Some(crate::types::ConsumedCapacity::deserialize(deser)?); }
127 _ => {}
128 }
129 Ok(())
130 })?;
131 Ok(builder.build())
132 }
133 }
134impl ::aws_types::request_id::RequestId for GetItemOutput {
135 fn request_id(&self) -> Option<&str> {
136 self._request_id.as_deref()
137 }
138 }
139impl GetItemOutput {
140 pub fn builder() -> crate::operation::get_item::builders::GetItemOutputBuilder {
142 crate::operation::get_item::builders::GetItemOutputBuilder::default()
143 }
144}
145
146#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
148#[non_exhaustive]
149pub struct GetItemOutputBuilder {
150 pub(crate) item: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>,
151 pub(crate) consumed_capacity: ::std::option::Option<crate::types::ConsumedCapacity>,
152 _request_id: Option<String>,
153}
154impl GetItemOutputBuilder {
155 pub fn item(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::AttributeValue) -> Self {
161 let mut hash_map = self.item.unwrap_or_default();
162 hash_map.insert(k.into(), v);
163 self.item = ::std::option::Option::Some(hash_map);
164 self
165 }
166 pub fn set_item(mut self, input: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>) -> Self {
168 self.item = input; self
169 }
170 pub fn get_item(&self) -> &::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>> {
172 &self.item
173 }
174 pub fn consumed_capacity(mut self, input: crate::types::ConsumedCapacity) -> Self {
176 self.consumed_capacity = ::std::option::Option::Some(input);
177 self
178 }
179 pub fn set_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ConsumedCapacity>) -> Self {
181 self.consumed_capacity = input; self
182 }
183 pub fn get_consumed_capacity(&self) -> &::std::option::Option<crate::types::ConsumedCapacity> {
185 &self.consumed_capacity
186 }
187 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
188 self._request_id = Some(request_id.into());
189 self
190 }
191
192 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
193 self._request_id = request_id;
194 self
195 }
196 pub fn build(self) -> crate::operation::get_item::GetItemOutput {
198 crate::operation::get_item::GetItemOutput {
199 item: self.item
200 ,
201 consumed_capacity: self.consumed_capacity
202 ,
203 _request_id: self._request_id,
204 }
205 }
206}
207