134 134 | /// </ul>
|
135 135 | #[non_exhaustive]
|
136 136 | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
137 137 | pub struct TransactionCanceledException {
|
138 138 | #[allow(missing_docs)] // documentation missing in model
|
139 139 | pub message: ::std::option::Option<::std::string::String>,
|
140 140 | /// <p>A list of cancellation reasons.</p>
|
141 141 | pub cancellation_reasons: ::std::option::Option<::std::vec::Vec<crate::types::CancellationReason>>,
|
142 142 | pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata,
|
143 143 | }
|
144 144 | impl TransactionCanceledException {
|
145 145 | /// <p>A list of cancellation reasons.</p>
|
146 146 | ///
|
147 147 | /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.cancellation_reasons.is_none()`.
|
148 148 | pub fn cancellation_reasons(&self) -> &[crate::types::CancellationReason] {
|
149 149 | self.cancellation_reasons.as_deref().unwrap_or_default()
|
150 150 | }
|
151 151 | }
|
152 152 | static TRANSACTIONCANCELEDEXCEPTION_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static(
|
153 153 | "com.amazonaws.dynamodb#TransactionCanceledException",
|
154 154 | "com.amazonaws.dynamodb",
|
155 155 | "TransactionCanceledException",
|
156 156 | );
|
157 157 | static TRANSACTIONCANCELEDEXCEPTION_MEMBER_MESSAGE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
158 158 | ::aws_smithy_schema::ShapeId::from_static(
|
159 159 | "com.amazonaws.dynamodb#TransactionCanceledException$Message",
|
160 160 | "com.amazonaws.dynamodb",
|
161 161 | "TransactionCanceledException",
|
162 162 | ),
|
163 163 | ::aws_smithy_schema::ShapeType::String,
|
164 - | "message",
|
164 + | "Message",
|
165 165 | 0,
|
166 166 | );
|
167 167 | static TRANSACTIONCANCELEDEXCEPTION_MEMBER_CANCELLATION_REASONS: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
168 168 | ::aws_smithy_schema::ShapeId::from_static(
|
169 169 | "com.amazonaws.dynamodb#TransactionCanceledException$CancellationReasons",
|
170 170 | "com.amazonaws.dynamodb",
|
171 171 | "TransactionCanceledException",
|
172 172 | ),
|
173 173 | ::aws_smithy_schema::ShapeType::List,
|
174 - | "cancellation_reasons",
|
174 + | "CancellationReasons",
|
175 175 | 1,
|
176 176 | );
|
177 177 | static TRANSACTIONCANCELEDEXCEPTION_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
|
178 178 | TRANSACTIONCANCELEDEXCEPTION_SCHEMA_ID,
|
179 179 | ::aws_smithy_schema::ShapeType::Structure,
|
180 180 | &[
|
181 181 | &TRANSACTIONCANCELEDEXCEPTION_MEMBER_MESSAGE,
|
182 182 | &TRANSACTIONCANCELEDEXCEPTION_MEMBER_CANCELLATION_REASONS,
|
183 183 | ],
|
184 184 | );
|
185 185 | impl TransactionCanceledException {
|
186 186 | /// The schema for this shape.
|
187 187 | pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &TRANSACTIONCANCELEDEXCEPTION_SCHEMA;
|
188 188 | }
|
189 189 | impl ::aws_smithy_schema::serde::SerializableStruct for TransactionCanceledException {
|
190 190 | #[allow(unused_variables, clippy::diverging_sub_expression)]
|
191 191 | fn serialize_members(
|
192 192 | &self,
|
193 193 | ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
|
194 194 | ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
|
195 195 | if let Some(ref val) = self.message {
|
196 196 | ser.write_string(&TRANSACTIONCANCELEDEXCEPTION_MEMBER_MESSAGE, val)?;
|
197 197 | }
|
198 198 | if let Some(ref val) = self.cancellation_reasons {
|
199 199 | ser.write_list(
|
200 200 | &TRANSACTIONCANCELEDEXCEPTION_MEMBER_CANCELLATION_REASONS,
|
201 201 | &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
|
202 202 | for item in val {
|
203 203 | ser.write_struct(crate::types::CancellationReason::SCHEMA, item)?;
|
204 204 | }
|
205 205 | Ok(())
|
206 206 | },
|
207 207 | )?;
|
208 208 | }
|
209 209 | Ok(())
|
210 210 | }
|
211 211 | }
|
212 212 | impl TransactionCanceledException {
|
213 213 | /// Deserializes this structure from a [`ShapeDeserializer`].
|
214 - | pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
|
215 - | deserializer: &mut D,
|
214 + | pub fn deserialize(
|
215 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
216 216 | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
217 217 | #[allow(unused_variables, unused_mut)]
|
218 218 | let mut builder = Self::builder();
|
219 219 | #[allow(
|
220 220 | unused_variables,
|
221 221 | unreachable_code,
|
222 222 | clippy::single_match,
|
223 223 | clippy::match_single_binding,
|
224 224 | clippy::diverging_sub_expression
|
225 225 | )]
|
226 - | deserializer.read_struct(&TRANSACTIONCANCELEDEXCEPTION_SCHEMA, (), |_, member, deser| {
|
226 + | deserializer.read_struct(&TRANSACTIONCANCELEDEXCEPTION_SCHEMA, &mut |member, deser| {
|
227 227 | match member.member_index() {
|
228 228 | Some(0) => {
|
229 229 | builder.message = Some(deser.read_string(member)?);
|
230 230 | }
|
231 231 | Some(1) => {
|
232 232 | builder.cancellation_reasons = Some({
|
233 - | let container = if let Some(cap) = deser.container_size() {
|
234 - | Vec::with_capacity(cap)
|
235 - | } else {
|
236 - | Vec::new()
|
237 - | };
|
238 - | deser.read_list(member, container, |mut list, deser| {
|
239 - | list.push(crate::types::CancellationReason::deserialize(deser)?);
|
240 - | Ok(list)
|
241 - | })?
|
233 + | let mut container = Vec::new();
|
234 + | deser.read_list(member, &mut |deser| {
|
235 + | container.push(crate::types::CancellationReason::deserialize(deser)?);
|
236 + | Ok(())
|
237 + | })?;
|
238 + | container
|
242 239 | });
|
243 240 | }
|
244 241 | _ => {}
|
245 242 | }
|
246 243 | Ok(())
|
247 244 | })?;
|
248 245 | Ok(builder.build())
|
249 246 | }
|
250 247 | }
|
248 + | impl TransactionCanceledException {
|
249 + | /// Deserializes this structure from a body deserializer and HTTP response.
|
250 + | pub fn deserialize_with_response(
|
251 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
252 + | _headers: &::aws_smithy_runtime_api::http::Headers,
|
253 + | _status: u16,
|
254 + | _body: &[u8],
|
255 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
256 + | Self::deserialize(deserializer)
|
257 + | }
|
258 + | }
|
251 259 | impl TransactionCanceledException {
|
252 260 | /// Returns the error message.
|
253 261 | pub fn message(&self) -> ::std::option::Option<&str> {
|
254 262 | self.message.as_deref()
|
255 263 | }
|
256 264 | }
|
257 265 | impl ::std::fmt::Display for TransactionCanceledException {
|
258 266 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
259 267 | ::std::write!(f, "TransactionCanceledException")?;
|
260 268 | if let ::std::option::Option::Some(inner_1) = &self.message {
|