45 45 | /// <p>Use <code>ReturnValuesOnConditionCheckFailure</code> to get the item attributes if the <code>ConditionCheck</code> condition fails. For <code>ReturnValuesOnConditionCheckFailure</code>, the valid values are: NONE and ALL_OLD.</p>
|
46 46 | pub fn return_values_on_condition_check_failure(&self) -> ::std::option::Option<&crate::types::ReturnValuesOnConditionCheckFailure> {
|
47 47 | self.return_values_on_condition_check_failure.as_ref()
|
48 48 | }
|
49 49 | }
|
50 50 | static CONDITIONCHECK_SCHEMA_ID: ::aws_smithy_schema::ShapeId =
|
51 51 | ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.dynamodb#ConditionCheck", "com.amazonaws.dynamodb", "ConditionCheck");
|
52 52 | static CONDITIONCHECK_MEMBER_KEY: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
53 53 | ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.dynamodb#ConditionCheck$Key", "com.amazonaws.dynamodb", "ConditionCheck"),
|
54 54 | ::aws_smithy_schema::ShapeType::Map,
|
55 - | "key",
|
55 + | "Key",
|
56 56 | 0,
|
57 57 | );
|
58 58 | static CONDITIONCHECK_MEMBER_TABLE_NAME: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
59 59 | ::aws_smithy_schema::ShapeId::from_static(
|
60 60 | "com.amazonaws.dynamodb#ConditionCheck$TableName",
|
61 61 | "com.amazonaws.dynamodb",
|
62 62 | "ConditionCheck",
|
63 63 | ),
|
64 64 | ::aws_smithy_schema::ShapeType::String,
|
65 - | "table_name",
|
65 + | "TableName",
|
66 66 | 1,
|
67 67 | );
|
68 68 | static CONDITIONCHECK_MEMBER_CONDITION_EXPRESSION: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
69 69 | ::aws_smithy_schema::ShapeId::from_static(
|
70 70 | "com.amazonaws.dynamodb#ConditionCheck$ConditionExpression",
|
71 71 | "com.amazonaws.dynamodb",
|
72 72 | "ConditionCheck",
|
73 73 | ),
|
74 74 | ::aws_smithy_schema::ShapeType::String,
|
75 - | "condition_expression",
|
75 + | "ConditionExpression",
|
76 76 | 2,
|
77 77 | );
|
78 78 | static CONDITIONCHECK_MEMBER_EXPRESSION_ATTRIBUTE_NAMES: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
79 79 | ::aws_smithy_schema::ShapeId::from_static(
|
80 80 | "com.amazonaws.dynamodb#ConditionCheck$ExpressionAttributeNames",
|
81 81 | "com.amazonaws.dynamodb",
|
82 82 | "ConditionCheck",
|
83 83 | ),
|
84 84 | ::aws_smithy_schema::ShapeType::Map,
|
85 - | "expression_attribute_names",
|
85 + | "ExpressionAttributeNames",
|
86 86 | 3,
|
87 87 | );
|
88 88 | static CONDITIONCHECK_MEMBER_EXPRESSION_ATTRIBUTE_VALUES: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
89 89 | ::aws_smithy_schema::ShapeId::from_static(
|
90 90 | "com.amazonaws.dynamodb#ConditionCheck$ExpressionAttributeValues",
|
91 91 | "com.amazonaws.dynamodb",
|
92 92 | "ConditionCheck",
|
93 93 | ),
|
94 94 | ::aws_smithy_schema::ShapeType::Map,
|
95 - | "expression_attribute_values",
|
95 + | "ExpressionAttributeValues",
|
96 96 | 4,
|
97 97 | );
|
98 98 | static CONDITIONCHECK_MEMBER_RETURN_VALUES_ON_CONDITION_CHECK_FAILURE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
99 99 | ::aws_smithy_schema::ShapeId::from_static(
|
100 100 | "com.amazonaws.dynamodb#ConditionCheck$ReturnValuesOnConditionCheckFailure",
|
101 101 | "com.amazonaws.dynamodb",
|
102 102 | "ConditionCheck",
|
103 103 | ),
|
104 104 | ::aws_smithy_schema::ShapeType::String,
|
105 - | "return_values_on_condition_check_failure",
|
105 + | "ReturnValuesOnConditionCheckFailure",
|
106 106 | 5,
|
107 107 | );
|
108 108 | static CONDITIONCHECK_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
|
109 109 | CONDITIONCHECK_SCHEMA_ID,
|
110 110 | ::aws_smithy_schema::ShapeType::Structure,
|
111 111 | &[
|
112 112 | &CONDITIONCHECK_MEMBER_KEY,
|
113 113 | &CONDITIONCHECK_MEMBER_TABLE_NAME,
|
114 114 | &CONDITIONCHECK_MEMBER_CONDITION_EXPRESSION,
|
115 115 | &CONDITIONCHECK_MEMBER_EXPRESSION_ATTRIBUTE_NAMES,
|
116 116 | &CONDITIONCHECK_MEMBER_EXPRESSION_ATTRIBUTE_VALUES,
|
117 117 | &CONDITIONCHECK_MEMBER_RETURN_VALUES_ON_CONDITION_CHECK_FAILURE,
|
118 118 | ],
|
119 119 | );
|
120 120 | impl ConditionCheck {
|
121 121 | /// The schema for this shape.
|
122 122 | pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &CONDITIONCHECK_SCHEMA;
|
123 123 | }
|
124 124 | impl ::aws_smithy_schema::serde::SerializableStruct for ConditionCheck {
|
125 125 | #[allow(unused_variables, clippy::diverging_sub_expression)]
|
126 126 | fn serialize_members(
|
127 127 | &self,
|
128 128 | ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
|
129 129 | ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
|
130 130 | {
|
131 131 | let val = &self.key;
|
132 132 |
|
133 133 | ser.write_map(
|
134 134 | &CONDITIONCHECK_MEMBER_KEY,
|
135 135 | &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
|
136 136 | for (key, value) in val {
|
137 137 | ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
|
138 - | todo!("schema: unsupported map value type");
|
138 + | ser.write_struct(crate::types::AttributeValue::SCHEMA, value)?;
|
139 139 | }
|
140 140 | Ok(())
|
141 141 | },
|
142 142 | )?;
|
143 143 | }
|
144 144 | {
|
145 145 | let val = &self.table_name;
|
146 146 | ser.write_string(&CONDITIONCHECK_MEMBER_TABLE_NAME, val)?;
|
147 147 | }
|
148 148 | {
|
149 149 | let val = &self.condition_expression;
|
150 150 | ser.write_string(&CONDITIONCHECK_MEMBER_CONDITION_EXPRESSION, val)?;
|
151 151 | }
|
152 152 | if let Some(ref val) = self.expression_attribute_names {
|
153 153 | ser.write_map(
|
154 154 | &CONDITIONCHECK_MEMBER_EXPRESSION_ATTRIBUTE_NAMES,
|
155 155 | &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
|
156 156 | for (key, value) in val {
|
157 157 | ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
|
158 158 | ser.write_string(&::aws_smithy_schema::prelude::STRING, value)?;
|
159 159 | }
|
160 160 | Ok(())
|
161 161 | },
|
162 162 | )?;
|
163 163 | }
|
164 164 | if let Some(ref val) = self.expression_attribute_values {
|
165 165 | ser.write_map(
|
166 166 | &CONDITIONCHECK_MEMBER_EXPRESSION_ATTRIBUTE_VALUES,
|
167 167 | &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
|
168 168 | for (key, value) in val {
|
169 169 | ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
|
170 - | todo!("schema: unsupported map value type");
|
170 + | ser.write_struct(crate::types::AttributeValue::SCHEMA, value)?;
|
171 171 | }
|
172 172 | Ok(())
|
173 173 | },
|
174 174 | )?;
|
175 175 | }
|
176 176 | if let Some(ref val) = self.return_values_on_condition_check_failure {
|
177 177 | ser.write_string(&CONDITIONCHECK_MEMBER_RETURN_VALUES_ON_CONDITION_CHECK_FAILURE, val.as_str())?;
|
178 178 | }
|
179 179 | Ok(())
|
180 180 | }
|
181 181 | }
|
182 182 | impl ConditionCheck {
|
183 183 | /// Deserializes this structure from a [`ShapeDeserializer`].
|
184 - | pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
|
185 - | deserializer: &mut D,
|
184 + | pub fn deserialize(
|
185 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
186 186 | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
187 187 | #[allow(unused_variables, unused_mut)]
|
188 188 | let mut builder = Self::builder();
|
189 189 | #[allow(
|
190 190 | unused_variables,
|
191 191 | unreachable_code,
|
192 192 | clippy::single_match,
|
193 193 | clippy::match_single_binding,
|
194 194 | clippy::diverging_sub_expression
|
195 195 | )]
|
196 - | deserializer.read_struct(&CONDITIONCHECK_SCHEMA, (), |_, member, deser| {
|
196 + | deserializer.read_struct(&CONDITIONCHECK_SCHEMA, &mut |member, deser| {
|
197 197 | match member.member_index() {
|
198 198 | Some(0) => {
|
199 199 | builder.key = Some({
|
200 - | let container = if let Some(cap) = deser.container_size() {
|
201 - | std::collections::HashMap::with_capacity(cap)
|
202 - | } else {
|
203 - | std::collections::HashMap::new()
|
204 - | };
|
205 - | deser.read_map(member, container, |mut map, key, deser| {
|
206 - | map.insert(key, todo!("deserialize nested aggregate"));
|
207 - | Ok(map)
|
208 - | })?
|
200 + | let mut container = std::collections::HashMap::new();
|
201 + | deser.read_map(member, &mut |key, deser| {
|
202 + | container.insert(key, crate::types::AttributeValue::deserialize(deser)?);
|
203 + | Ok(())
|
204 + | })?;
|
205 + | container
|
209 206 | });
|
210 207 | }
|
211 208 | Some(1) => {
|
212 209 | builder.table_name = Some(deser.read_string(member)?);
|
213 210 | }
|
214 211 | Some(2) => {
|
215 212 | builder.condition_expression = Some(deser.read_string(member)?);
|
216 213 | }
|
217 214 | Some(3) => {
|
218 - | builder.expression_attribute_names = Some({
|
219 - | let container = if let Some(cap) = deser.container_size() {
|
220 - | std::collections::HashMap::with_capacity(cap)
|
221 - | } else {
|
222 - | std::collections::HashMap::new()
|
223 - | };
|
224 - | deser.read_map(member, container, |mut map, key, deser| {
|
225 - | map.insert(key, deser.read_string(member)?);
|
226 - | Ok(map)
|
227 - | })?
|
228 - | });
|
215 + | builder.expression_attribute_names = Some(deser.read_string_string_map(member)?);
|
229 216 | }
|
230 217 | Some(4) => {
|
231 218 | builder.expression_attribute_values = Some({
|
232 - | let container = if let Some(cap) = deser.container_size() {
|
233 - | std::collections::HashMap::with_capacity(cap)
|
234 - | } else {
|
235 - | std::collections::HashMap::new()
|
236 - | };
|
237 - | deser.read_map(member, container, |mut map, key, deser| {
|
238 - | map.insert(key, todo!("deserialize nested aggregate"));
|
239 - | Ok(map)
|
240 - | })?
|
219 + | let mut container = std::collections::HashMap::new();
|
220 + | deser.read_map(member, &mut |key, deser| {
|
221 + | container.insert(key, crate::types::AttributeValue::deserialize(deser)?);
|
222 + | Ok(())
|
223 + | })?;
|
224 + | container
|
241 225 | });
|
242 226 | }
|
243 227 | Some(5) => {
|
244 228 | builder.return_values_on_condition_check_failure = Some(crate::types::ReturnValuesOnConditionCheckFailure::from(
|
245 229 | deser.read_string(member)?.as_str(),
|
246 230 | ));
|
247 231 | }
|
248 232 | _ => {}
|
249 233 | }
|
250 234 | Ok(())
|
251 235 | })?;
|
236 + | builder.key = builder.key.or(Some(::std::collections::HashMap::new()));
|
237 + | builder.table_name = builder.table_name.or(Some(String::new()));
|
238 + | builder.condition_expression = builder.condition_expression.or(Some(String::new()));
|
252 239 | builder
|
253 240 | .build()
|
254 241 | .map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
|
255 242 | }
|
256 243 | }
|
244 + | impl ConditionCheck {
|
245 + | /// Deserializes this structure from a body deserializer and HTTP response.
|
246 + | pub fn deserialize_with_response(
|
247 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
248 + | _headers: &::aws_smithy_runtime_api::http::Headers,
|
249 + | _status: u16,
|
250 + | _body: &[u8],
|
251 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
252 + | Self::deserialize(deserializer)
|
253 + | }
|
254 + | }
|
257 255 | impl ConditionCheck {
|
258 256 | /// Creates a new builder-style object to manufacture [`ConditionCheck`](crate::types::ConditionCheck).
|
259 257 | pub fn builder() -> crate::types::builders::ConditionCheckBuilder {
|
260 258 | crate::types::builders::ConditionCheckBuilder::default()
|
261 259 | }
|
262 260 | }
|
263 261 |
|
264 262 | /// A builder for [`ConditionCheck`](crate::types::ConditionCheck).
|
265 263 | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
|
266 264 | #[non_exhaustive]
|