122 126 | crate::operation::list_changed_blocks::ListChangedBlocksError,
|
123 127 | >::new());
|
124 128 |
|
125 129 | ::std::borrow::Cow::Owned(rcb)
|
126 130 | }
|
127 131 | }
|
128 132 |
|
129 133 | #[derive(Debug)]
|
130 134 | struct ListChangedBlocksResponseDeserializer;
|
131 135 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ListChangedBlocksResponseDeserializer {
|
132 - | fn deserialize_nonstreaming(
|
136 + | fn deserialize_nonstreaming_with_config(
|
133 137 | &self,
|
134 138 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
139 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
135 140 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
136 141 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
142 + | #[allow(unused_mut)]
|
143 + | let mut force_error = false;
|
144 + |
|
145 + | if !success && status != 200 || force_error {
|
137 146 | let headers = response.headers();
|
138 147 | let body = response.body().bytes().expect("body loaded");
|
139 148 | #[allow(unused_mut)]
|
140 - | let mut force_error = false;
|
149 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
150 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
151 + | })?;
|
141 152 |
|
142 - | let parse_result = if !success && status != 200 || force_error {
|
143 - | crate::protocol_serde::shape_list_changed_blocks::de_list_changed_blocks_http_error(status, headers, body)
|
144 - | } else {
|
145 - | crate::protocol_serde::shape_list_changed_blocks::de_list_changed_blocks_http_response(status, headers, body)
|
153 + | let generic = generic_builder.build();
|
154 + | let error_code = match generic.code() {
|
155 + | ::std::option::Option::Some(code) => code,
|
156 + | ::std::option::Option::None => {
|
157 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
158 + | ::aws_smithy_runtime_api::box_error::BoxError::from(
|
159 + | crate::operation::list_changed_blocks::ListChangedBlocksError::unhandled(generic),
|
160 + | ),
|
161 + | ))
|
162 + | }
|
163 + | };
|
164 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
165 + | let protocol = _cfg
|
166 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
167 + | .expect("a SharedClientProtocol is required");
|
168 + | let err = match error_code {
|
169 + | "AccessDeniedException" => crate::operation::list_changed_blocks::ListChangedBlocksError::AccessDeniedError({
|
170 + | let mut tmp = match protocol
|
171 + | .deserialize_response(response, crate::types::error::AccessDeniedError::SCHEMA, _cfg)
|
172 + | .and_then(|mut deser| {
|
173 + | crate::types::error::AccessDeniedError::deserialize_with_response(
|
174 + | &mut *deser,
|
175 + | response.headers(),
|
176 + | response.status().into(),
|
177 + | body,
|
178 + | )
|
179 + | }) {
|
180 + | ::std::result::Result::Ok(val) => val,
|
181 + | ::std::result::Result::Err(e) => {
|
182 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
183 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
184 + | ))
|
185 + | }
|
186 + | };
|
187 + | tmp.meta = generic;
|
188 + | if tmp.message.is_none() {
|
189 + | tmp.message = _error_message;
|
190 + | }
|
191 + | tmp
|
192 + | }),
|
193 + | "InternalServerException" => crate::operation::list_changed_blocks::ListChangedBlocksError::InternalServerError({
|
194 + | let mut tmp = match protocol
|
195 + | .deserialize_response(response, crate::types::error::InternalServerError::SCHEMA, _cfg)
|
196 + | .and_then(|mut deser| {
|
197 + | crate::types::error::InternalServerError::deserialize_with_response(
|
198 + | &mut *deser,
|
199 + | response.headers(),
|
200 + | response.status().into(),
|
201 + | body,
|
202 + | )
|
203 + | }) {
|
204 + | ::std::result::Result::Ok(val) => val,
|
205 + | ::std::result::Result::Err(e) => {
|
206 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
207 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
208 + | ))
|
209 + | }
|
210 + | };
|
211 + | tmp.meta = generic;
|
212 + | if tmp.message.is_none() {
|
213 + | tmp.message = _error_message;
|
214 + | }
|
215 + | tmp
|
216 + | }),
|
217 + | "RequestThrottledException" => crate::operation::list_changed_blocks::ListChangedBlocksError::RequestThrottledError({
|
218 + | let mut tmp = match protocol
|
219 + | .deserialize_response(response, crate::types::error::RequestThrottledError::SCHEMA, _cfg)
|
220 + | .and_then(|mut deser| {
|
221 + | crate::types::error::RequestThrottledError::deserialize_with_response(
|
222 + | &mut *deser,
|
223 + | response.headers(),
|
224 + | response.status().into(),
|
225 + | body,
|
226 + | )
|
227 + | }) {
|
228 + | ::std::result::Result::Ok(val) => val,
|
229 + | ::std::result::Result::Err(e) => {
|
230 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
231 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
232 + | ))
|
233 + | }
|
234 + | };
|
235 + | tmp.meta = generic;
|
236 + | if tmp.message.is_none() {
|
237 + | tmp.message = _error_message;
|
238 + | }
|
239 + | tmp
|
240 + | }),
|
241 + | "ResourceNotFoundException" => crate::operation::list_changed_blocks::ListChangedBlocksError::ResourceNotFoundError({
|
242 + | let mut tmp = match protocol
|
243 + | .deserialize_response(response, crate::types::error::ResourceNotFoundError::SCHEMA, _cfg)
|
244 + | .and_then(|mut deser| {
|
245 + | crate::types::error::ResourceNotFoundError::deserialize_with_response(
|
246 + | &mut *deser,
|
247 + | response.headers(),
|
248 + | response.status().into(),
|
249 + | body,
|
250 + | )
|
251 + | }) {
|
252 + | ::std::result::Result::Ok(val) => val,
|
253 + | ::std::result::Result::Err(e) => {
|
254 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
255 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
256 + | ))
|
257 + | }
|
258 + | };
|
259 + | tmp.meta = generic;
|
260 + | if tmp.message.is_none() {
|
261 + | tmp.message = _error_message;
|
262 + | }
|
263 + | tmp
|
264 + | }),
|
265 + | "ServiceQuotaExceededException" => crate::operation::list_changed_blocks::ListChangedBlocksError::ServiceQuotaExceededError({
|
266 + | let mut tmp = match protocol
|
267 + | .deserialize_response(response, crate::types::error::ServiceQuotaExceededError::SCHEMA, _cfg)
|
268 + | .and_then(|mut deser| {
|
269 + | crate::types::error::ServiceQuotaExceededError::deserialize_with_response(
|
270 + | &mut *deser,
|
271 + | response.headers(),
|
272 + | response.status().into(),
|
273 + | body,
|
274 + | )
|
275 + | }) {
|
276 + | ::std::result::Result::Ok(val) => val,
|
277 + | ::std::result::Result::Err(e) => {
|
278 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
279 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
280 + | ))
|
281 + | }
|
282 + | };
|
283 + | tmp.meta = generic;
|
284 + | if tmp.message.is_none() {
|
285 + | tmp.message = _error_message;
|
286 + | }
|
287 + | tmp
|
288 + | }),
|
289 + | "ValidationException" => crate::operation::list_changed_blocks::ListChangedBlocksError::ValidationError({
|
290 + | let mut tmp = match protocol
|
291 + | .deserialize_response(response, crate::types::error::ValidationError::SCHEMA, _cfg)
|
292 + | .and_then(|mut deser| {
|
293 + | crate::types::error::ValidationError::deserialize_with_response(
|
294 + | &mut *deser,
|
295 + | response.headers(),
|
296 + | response.status().into(),
|
297 + | body,
|
298 + | )
|
299 + | }) {
|
300 + | ::std::result::Result::Ok(val) => val,
|
301 + | ::std::result::Result::Err(e) => {
|
302 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
303 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
304 + | ))
|
305 + | }
|
146 306 | };
|
147 - | crate::protocol_serde::type_erase_result(parse_result)
|
307 + | tmp.meta = generic;
|
308 + | if tmp.message.is_none() {
|
309 + | tmp.message = _error_message;
|
310 + | }
|
311 + | tmp
|
312 + | }),
|
313 + | _ => crate::operation::list_changed_blocks::ListChangedBlocksError::generic(generic),
|
314 + | };
|
315 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
316 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
317 + | ))
|
318 + | } else {
|
319 + | let protocol = _cfg
|
320 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
321 + | .expect("a SharedClientProtocol is required");
|
322 + | let mut deser = protocol
|
323 + | .deserialize_response(response, ListChangedBlocks::OUTPUT_SCHEMA, _cfg)
|
324 + | .map_err(|e| {
|
325 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
326 + | })?;
|
327 + | let body = response.body().bytes().expect("body loaded");
|
328 + | let output = crate::operation::list_changed_blocks::ListChangedBlocksOutput::deserialize_with_response(
|
329 + | &mut *deser,
|
330 + | response.headers(),
|
331 + | response.status().into(),
|
332 + | body,
|
333 + | )
|
334 + | .map_err(|e| {
|
335 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
336 + | })?;
|
337 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
338 + | }
|
148 339 | }
|
149 340 | }
|
150 341 | #[derive(Debug)]
|
151 342 | struct ListChangedBlocksRequestSerializer;
|
152 343 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ListChangedBlocksRequestSerializer {
|
153 344 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
154 345 | fn serialize_input(
|
155 346 | &self,
|
156 347 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
157 348 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
158 349 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
159 350 | let input = input
|
160 351 | .downcast::<crate::operation::list_changed_blocks::ListChangedBlocksInput>()
|
161 352 | .expect("correct type");
|
162 - | let _header_serialization_settings = _cfg
|
163 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
164 - | .cloned()
|
165 - | .unwrap_or_default();
|
166 - | let mut request_builder = {
|
167 - | #[allow(clippy::uninlined_format_args)]
|
168 - | fn uri_base(
|
169 - | _input: &crate::operation::list_changed_blocks::ListChangedBlocksInput,
|
170 - | output: &mut ::std::string::String,
|
171 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
172 - | use ::std::fmt::Write as _;
|
173 - | let input_1 = &_input.second_snapshot_id;
|
174 - | let input_1 = input_1.as_ref().ok_or_else(|| {
|
175 - | ::aws_smithy_types::error::operation::BuildError::missing_field("second_snapshot_id", "cannot be empty or unset")
|
176 - | })?;
|
177 - | let second_snapshot_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
|
178 - | if second_snapshot_id.is_empty() {
|
179 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
180 - | "second_snapshot_id",
|
181 - | "cannot be empty or unset",
|
182 - | ));
|
183 - | }
|
184 - | ::std::write!(
|
185 - | output,
|
186 - | "/snapshots/{SecondSnapshotId}/changedblocks",
|
187 - | SecondSnapshotId = second_snapshot_id
|
188 - | )
|
189 - | .expect("formatting should succeed");
|
190 - | ::std::result::Result::Ok(())
|
191 - | }
|
192 - | fn uri_query(
|
193 - | _input: &crate::operation::list_changed_blocks::ListChangedBlocksInput,
|
194 - | mut output: &mut ::std::string::String,
|
195 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
196 - | let mut query = ::aws_smithy_http::query::Writer::new(output);
|
197 - | if let ::std::option::Option::Some(inner_2) = &_input.first_snapshot_id {
|
198 - | {
|
199 - | query.push_kv("firstSnapshotId", &::aws_smithy_http::query::fmt_string(inner_2));
|
200 - | }
|
201 - | }
|
202 - | if let ::std::option::Option::Some(inner_3) = &_input.next_token {
|
203 - | {
|
204 - | query.push_kv("pageToken", &::aws_smithy_http::query::fmt_string(inner_3));
|
205 - | }
|
206 - | }
|
207 - | if let ::std::option::Option::Some(inner_4) = &_input.max_results {
|
208 - | {
|
209 - | query.push_kv("maxResults", ::aws_smithy_types::primitive::Encoder::from(*inner_4).encode());
|
210 - | }
|
211 - | }
|
212 - | if let ::std::option::Option::Some(inner_5) = &_input.starting_block_index {
|
353 + | let protocol = _cfg
|
354 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
355 + | .expect("a SharedClientProtocol is required");
|
356 + | if protocol.supports_http_bindings() {
|
357 + | let mut request = protocol
|
358 + | .serialize_body(&input, ListChangedBlocks::INPUT_SCHEMA, "", _cfg)
|
359 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
213 360 | {
|
214 - | query.push_kv("startingBlockIndex", ::aws_smithy_types::primitive::Encoder::from(*inner_5).encode());
|
215 - | }
|
361 + | let mut uri = "/snapshots/{SecondSnapshotId}/changedblocks".to_string();
|
362 + | let mut query_params: Vec<(String, String)> = Vec::new();
|
363 + | if let Some(ref val) = input.second_snapshot_id {
|
364 + | uri = uri.replace(
|
365 + | "{SecondSnapshotId}",
|
366 + | &::aws_smithy_schema::http_protocol::percent_encode(&val.to_string()),
|
367 + | );
|
368 + | }
|
369 + | if let Some(ref val) = input.first_snapshot_id {
|
370 + | query_params.push(("firstSnapshotId".to_string(), val.to_string()));
|
371 + | }
|
372 + | if let Some(ref val) = input.next_token {
|
373 + | query_params.push(("pageToken".to_string(), val.to_string()));
|
374 + | }
|
375 + | if let Some(ref val) = input.max_results {
|
376 + | query_params.push(("maxResults".to_string(), val.to_string()));
|
377 + | }
|
378 + | if let Some(ref val) = input.starting_block_index {
|
379 + | query_params.push(("startingBlockIndex".to_string(), val.to_string()));
|
380 + | }
|
381 + | if !query_params.is_empty() {
|
382 + | uri.push(if uri.contains('?') { '&' } else { '?' });
|
383 + | let pairs: Vec<String> = query_params
|
384 + | .iter()
|
385 + | .map(|(k, v)| {
|
386 + | format!(
|
387 + | "{}={}",
|
388 + | ::aws_smithy_schema::http_protocol::percent_encode(k),
|
389 + | ::aws_smithy_schema::http_protocol::percent_encode(v)
|
390 + | )
|
391 + | })
|
392 + | .collect();
|
393 + | uri.push_str(&pairs.join("&"));
|
216 394 | }
|
217 - | ::std::result::Result::Ok(())
|
395 + | request.set_uri(uri.as_str()).expect("valid URI");
|
218 396 | }
|
219 - | #[allow(clippy::unnecessary_wraps)]
|
220 - | fn update_http_builder(
|
221 - | input: &crate::operation::list_changed_blocks::ListChangedBlocksInput,
|
222 - | builder: ::http_1x::request::Builder,
|
223 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
224 - | let mut uri = ::std::string::String::new();
|
225 - | uri_base(input, &mut uri)?;
|
226 - | uri_query(input, &mut uri)?;
|
227 - | ::std::result::Result::Ok(builder.method("GET").uri(uri))
|
228 - | }
|
229 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
230 - | builder
|
231 - | };
|
232 - | let body = ::aws_smithy_types::body::SdkBody::from("");
|
233 397 |
|
234 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
398 + | return ::std::result::Result::Ok(request);
|
399 + | } else {
|
400 + | let mut request = protocol
|
401 + | .serialize_request(&input, ListChangedBlocks::INPUT_SCHEMA, "", _cfg)
|
402 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
403 + |
|
404 + | return ::std::result::Result::Ok(request);
|
405 + | }
|
235 406 | }
|
236 407 | }
|
237 408 | #[derive(Debug)]
|
238 409 | struct ListChangedBlocksEndpointParamsInterceptor;
|
239 410 |
|
240 411 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ListChangedBlocksEndpointParamsInterceptor {
|
241 412 | fn name(&self) -> &'static str {
|
242 413 | "ListChangedBlocksEndpointParamsInterceptor"
|
243 414 | }
|
244 415 |
|