1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_start_snapshot_http_error(
|
4 - | _response_status: u16,
|
5 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
6 - | _response_body: &[u8],
|
7 - | ) -> std::result::Result<crate::operation::start_snapshot::StartSnapshotOutput, crate::operation::start_snapshot::StartSnapshotError> {
|
8 - | #[allow(unused_mut)]
|
9 - | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
10 - | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?;
|
11 - | let generic = generic_builder.build();
|
12 - | let error_code = match generic.code() {
|
13 - | Some(code) => code,
|
14 - | None => return Err(crate::operation::start_snapshot::StartSnapshotError::unhandled(generic)),
|
15 - | };
|
16 - |
|
17 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
18 - | Err(match error_code {
|
19 - | "AccessDeniedException" => crate::operation::start_snapshot::StartSnapshotError::AccessDeniedError({
|
20 - | #[allow(unused_mut)]
|
21 - | let mut tmp = {
|
22 - | #[allow(unused_mut)]
|
23 - | let mut output = crate::types::error::builders::AccessDeniedErrorBuilder::default();
|
24 - | output = crate::protocol_serde::shape_access_denied_exception::de_access_denied_exception_json_err(_response_body, output)
|
25 - | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?;
|
26 - | let output = output.meta(generic);
|
27 - | crate::serde_util::access_denied_exception_correct_errors(output)
|
28 - | .build()
|
29 - | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?
|
30 - | };
|
31 - | if tmp.message.is_none() {
|
32 - | tmp.message = _error_message;
|
33 - | }
|
34 - | tmp
|
35 - | }),
|
36 - | "ConcurrentLimitExceededException" => crate::operation::start_snapshot::StartSnapshotError::ConcurrentLimitExceededError({
|
37 - | #[allow(unused_mut)]
|
38 - | let mut tmp = {
|
39 - | #[allow(unused_mut)]
|
40 - | let mut output = crate::types::error::builders::ConcurrentLimitExceededErrorBuilder::default();
|
41 - | output = crate::protocol_serde::shape_concurrent_limit_exceeded_exception::de_concurrent_limit_exceeded_exception_json_err(
|
42 - | _response_body,
|
43 - | output,
|
44 - | )
|
45 - | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?;
|
46 - | let output = output.meta(generic);
|
47 - | output.build()
|
48 - | };
|
49 - | if tmp.message.is_none() {
|
50 - | tmp.message = _error_message;
|
51 - | }
|
52 - | tmp
|
53 - | }),
|
54 - | "ConflictException" => crate::operation::start_snapshot::StartSnapshotError::ConflictError({
|
55 - | #[allow(unused_mut)]
|
56 - | let mut tmp = {
|
57 - | #[allow(unused_mut)]
|
58 - | let mut output = crate::types::error::builders::ConflictErrorBuilder::default();
|
59 - | output = crate::protocol_serde::shape_conflict_exception::de_conflict_exception_json_err(_response_body, output)
|
60 - | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?;
|
61 - | let output = output.meta(generic);
|
62 - | output.build()
|
63 - | };
|
64 - | if tmp.message.is_none() {
|
65 - | tmp.message = _error_message;
|
66 - | }
|
67 - | tmp
|
68 - | }),
|
69 - | "InternalServerException" => crate::operation::start_snapshot::StartSnapshotError::InternalServerError({
|
70 - | #[allow(unused_mut)]
|
71 - | let mut tmp = {
|
72 - | #[allow(unused_mut)]
|
73 - | let mut output = crate::types::error::builders::InternalServerErrorBuilder::default();
|
74 - | output = crate::protocol_serde::shape_internal_server_exception::de_internal_server_exception_json_err(_response_body, output)
|
75 - | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?;
|
76 - | let output = output.meta(generic);
|
77 - | output.build()
|
78 - | };
|
79 - | if tmp.message.is_none() {
|
80 - | tmp.message = _error_message;
|
81 - | }
|
82 - | tmp
|
83 - | }),
|
84 - | "RequestThrottledException" => crate::operation::start_snapshot::StartSnapshotError::RequestThrottledError({
|
85 - | #[allow(unused_mut)]
|
86 - | let mut tmp = {
|
87 - | #[allow(unused_mut)]
|
88 - | let mut output = crate::types::error::builders::RequestThrottledErrorBuilder::default();
|
89 - | output = crate::protocol_serde::shape_request_throttled_exception::de_request_throttled_exception_json_err(_response_body, output)
|
90 - | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?;
|
91 - | let output = output.meta(generic);
|
92 - | output.build()
|
93 - | };
|
94 - | if tmp.message.is_none() {
|
95 - | tmp.message = _error_message;
|
96 - | }
|
97 - | tmp
|
98 - | }),
|
99 - | "ResourceNotFoundException" => crate::operation::start_snapshot::StartSnapshotError::ResourceNotFoundError({
|
100 - | #[allow(unused_mut)]
|
101 - | let mut tmp = {
|
102 - | #[allow(unused_mut)]
|
103 - | let mut output = crate::types::error::builders::ResourceNotFoundErrorBuilder::default();
|
104 - | output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
|
105 - | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?;
|
106 - | let output = output.meta(generic);
|
107 - | output.build()
|
108 - | };
|
109 - | if tmp.message.is_none() {
|
110 - | tmp.message = _error_message;
|
111 - | }
|
112 - | tmp
|
113 - | }),
|
114 - | "ServiceQuotaExceededException" => crate::operation::start_snapshot::StartSnapshotError::ServiceQuotaExceededError({
|
115 - | #[allow(unused_mut)]
|
116 - | let mut tmp = {
|
117 - | #[allow(unused_mut)]
|
118 - | let mut output = crate::types::error::builders::ServiceQuotaExceededErrorBuilder::default();
|
119 - | output = crate::protocol_serde::shape_service_quota_exceeded_exception::de_service_quota_exceeded_exception_json_err(
|
120 - | _response_body,
|
121 - | output,
|
122 - | )
|
123 - | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?;
|
124 - | let output = output.meta(generic);
|
125 - | output.build()
|
126 - | };
|
127 - | if tmp.message.is_none() {
|
128 - | tmp.message = _error_message;
|
129 - | }
|
130 - | tmp
|
131 - | }),
|
132 - | "ValidationException" => crate::operation::start_snapshot::StartSnapshotError::ValidationError({
|
133 - | #[allow(unused_mut)]
|
134 - | let mut tmp = {
|
135 - | #[allow(unused_mut)]
|
136 - | let mut output = crate::types::error::builders::ValidationErrorBuilder::default();
|
137 - | output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
|
138 - | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?;
|
139 - | let output = output.meta(generic);
|
140 - | output.build()
|
141 - | };
|
142 - | if tmp.message.is_none() {
|
143 - | tmp.message = _error_message;
|
144 - | }
|
145 - | tmp
|
146 - | }),
|
147 - | _ => crate::operation::start_snapshot::StartSnapshotError::generic(generic),
|
148 - | })
|
149 - | }
|
150 - |
|
151 - | #[allow(clippy::unnecessary_wraps)]
|
152 - | pub fn de_start_snapshot_http_response(
|
153 - | _response_status: u16,
|
154 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
155 - | _response_body: &[u8],
|
156 - | ) -> std::result::Result<crate::operation::start_snapshot::StartSnapshotOutput, crate::operation::start_snapshot::StartSnapshotError> {
|
157 - | Ok({
|
158 - | #[allow(unused_mut)]
|
159 - | let mut output = crate::operation::start_snapshot::builders::StartSnapshotOutputBuilder::default();
|
160 - | output = crate::protocol_serde::shape_start_snapshot::de_start_snapshot(_response_body, output)
|
161 - | .map_err(crate::operation::start_snapshot::StartSnapshotError::unhandled)?;
|
162 - | output.build()
|
163 - | })
|
164 - | }
|
165 - |
|
166 - | pub fn ser_start_snapshot_input(
|
167 - | input: &crate::operation::start_snapshot::StartSnapshotInput,
|
168 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
169 - | let mut out = String::new();
|
170 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
171 - | crate::protocol_serde::shape_start_snapshot_input::ser_start_snapshot_input_input(&mut object, input)?;
|
172 - | object.finish();
|
173 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
174 - | }
|
175 - |
|
176 - | pub(crate) fn de_start_snapshot(
|
177 - | _value: &[u8],
|
178 - | mut builder: crate::operation::start_snapshot::builders::StartSnapshotOutputBuilder,
|
179 - | ) -> ::std::result::Result<
|
180 - | crate::operation::start_snapshot::builders::StartSnapshotOutputBuilder,
|
181 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
182 - | > {
|
183 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
184 - | let tokens = &mut tokens_owned;
|
185 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
186 - | loop {
|
187 - | match tokens.next().transpose()? {
|
188 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
189 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
190 - | "BlockSize" => {
|
191 - | builder = builder.set_block_size(
|
192 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
193 - | .map(i32::try_from)
|
194 - | .transpose()?,
|
195 - | );
|
196 - | }
|
197 - | "Description" => {
|
198 - | builder = builder.set_description(
|
199 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
200 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
201 - | .transpose()?,
|
202 - | );
|
203 - | }
|
204 - | "KmsKeyArn" => {
|
205 - | builder = builder.set_kms_key_arn(
|
206 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
207 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
208 - | .transpose()?,
|
209 - | );
|
210 - | }
|
211 - | "OwnerId" => {
|
212 - | builder = builder.set_owner_id(
|
213 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
214 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
215 - | .transpose()?,
|
216 - | );
|
217 - | }
|
218 - | "ParentSnapshotId" => {
|
219 - | builder = builder.set_parent_snapshot_id(
|
220 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
221 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
222 - | .transpose()?,
|
223 - | );
|
224 - | }
|
225 - | "SnapshotId" => {
|
226 - | builder = builder.set_snapshot_id(
|
227 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
228 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
229 - | .transpose()?,
|
230 - | );
|
231 - | }
|
232 - | "StartTime" => {
|
233 - | builder = builder.set_start_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
234 - | tokens.next(),
|
235 - | ::aws_smithy_types::date_time::Format::EpochSeconds,
|
236 - | )?);
|
237 - | }
|
238 - | "Status" => {
|
239 - | builder = builder.set_status(
|
240 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
241 - | .map(|s| s.to_unescaped().map(|u| crate::types::Status::from(u.as_ref())))
|
242 - | .transpose()?,
|
243 - | );
|
244 - | }
|
245 - | "Tags" => {
|
246 - | builder = builder.set_tags(crate::protocol_serde::shape_tags::de_tags(tokens, _value)?);
|
247 - | }
|
248 - | "VolumeSize" => {
|
249 - | builder = builder.set_volume_size(
|
250 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
251 - | .map(i64::try_from)
|
252 - | .transpose()?,
|
253 - | );
|
254 - | }
|
255 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
256 - | },
|
257 - | other => {
|
258 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
259 - | "expected object key or end object, found: {other:?}"
|
260 - | )))
|
261 - | }
|
262 - | }
|
263 - | }
|
264 - | if tokens.next().is_some() {
|
265 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
266 - | "found more JSON tokens after completing parsing",
|
267 - | ));
|
268 - | }
|
269 - | Ok(builder)
|
270 - | }
|