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