aws_sdk_elasticsearch/protocol_serde/
shape_describe_domain_change_progress.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_describe_domain_change_progress_http_error(
4 _response_status: u16,
5 _response_headers: &::aws_smithy_runtime_api::http::Headers,
6 _response_body: &[u8],
7) -> std::result::Result<
8 crate::operation::describe_domain_change_progress::DescribeDomainChangeProgressOutput,
9 crate::operation::describe_domain_change_progress::DescribeDomainChangeProgressError,
10> {
11 #[allow(unused_mut)]
12 let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
13 .map_err(crate::operation::describe_domain_change_progress::DescribeDomainChangeProgressError::unhandled)?;
14 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
15 let generic = generic_builder.build();
16 let error_code = match generic.code() {
17 Some(code) => code,
18 None => return Err(crate::operation::describe_domain_change_progress::DescribeDomainChangeProgressError::unhandled(generic)),
19 };
20
21 let _error_message = generic.message().map(|msg| msg.to_owned());
22 Err(match error_code {
23 "BaseException" => crate::operation::describe_domain_change_progress::DescribeDomainChangeProgressError::BaseException({
24 #[allow(unused_mut)]
25 let mut tmp = {
26 #[allow(unused_mut)]
27 let mut output = crate::types::error::builders::BaseExceptionBuilder::default();
28 output = crate::protocol_serde::shape_base_exception::de_base_exception_json_err(_response_body, output)
29 .map_err(crate::operation::describe_domain_change_progress::DescribeDomainChangeProgressError::unhandled)?;
30 let output = output.meta(generic);
31 output.build()
32 };
33 if tmp.message.is_none() {
34 tmp.message = _error_message;
35 }
36 tmp
37 }),
38 "InternalException" => crate::operation::describe_domain_change_progress::DescribeDomainChangeProgressError::InternalException({
39 #[allow(unused_mut)]
40 let mut tmp = {
41 #[allow(unused_mut)]
42 let mut output = crate::types::error::builders::InternalExceptionBuilder::default();
43 output = crate::protocol_serde::shape_internal_exception::de_internal_exception_json_err(_response_body, output)
44 .map_err(crate::operation::describe_domain_change_progress::DescribeDomainChangeProgressError::unhandled)?;
45 let output = output.meta(generic);
46 output.build()
47 };
48 if tmp.message.is_none() {
49 tmp.message = _error_message;
50 }
51 tmp
52 }),
53 "ResourceNotFoundException" => {
54 crate::operation::describe_domain_change_progress::DescribeDomainChangeProgressError::ResourceNotFoundException({
55 #[allow(unused_mut)]
56 let mut tmp = {
57 #[allow(unused_mut)]
58 let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
59 output =
60 crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
61 .map_err(crate::operation::describe_domain_change_progress::DescribeDomainChangeProgressError::unhandled)?;
62 let output = output.meta(generic);
63 output.build()
64 };
65 if tmp.message.is_none() {
66 tmp.message = _error_message;
67 }
68 tmp
69 })
70 }
71 "ValidationException" => crate::operation::describe_domain_change_progress::DescribeDomainChangeProgressError::ValidationException({
72 #[allow(unused_mut)]
73 let mut tmp = {
74 #[allow(unused_mut)]
75 let mut output = crate::types::error::builders::ValidationExceptionBuilder::default();
76 output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
77 .map_err(crate::operation::describe_domain_change_progress::DescribeDomainChangeProgressError::unhandled)?;
78 let output = output.meta(generic);
79 output.build()
80 };
81 if tmp.message.is_none() {
82 tmp.message = _error_message;
83 }
84 tmp
85 }),
86 _ => crate::operation::describe_domain_change_progress::DescribeDomainChangeProgressError::generic(generic),
87 })
88}
89
90#[allow(clippy::unnecessary_wraps)]
91pub fn de_describe_domain_change_progress_http_response(
92 _response_status: u16,
93 _response_headers: &::aws_smithy_runtime_api::http::Headers,
94 _response_body: &[u8],
95) -> std::result::Result<
96 crate::operation::describe_domain_change_progress::DescribeDomainChangeProgressOutput,
97 crate::operation::describe_domain_change_progress::DescribeDomainChangeProgressError,
98> {
99 Ok({
100 #[allow(unused_mut)]
101 let mut output = crate::operation::describe_domain_change_progress::builders::DescribeDomainChangeProgressOutputBuilder::default();
102 output = crate::protocol_serde::shape_describe_domain_change_progress::de_describe_domain_change_progress(_response_body, output)
103 .map_err(crate::operation::describe_domain_change_progress::DescribeDomainChangeProgressError::unhandled)?;
104 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
105 output.build()
106 })
107}
108
109pub(crate) fn de_describe_domain_change_progress(
110 value: &[u8],
111 mut builder: crate::operation::describe_domain_change_progress::builders::DescribeDomainChangeProgressOutputBuilder,
112) -> ::std::result::Result<
113 crate::operation::describe_domain_change_progress::builders::DescribeDomainChangeProgressOutputBuilder,
114 ::aws_smithy_json::deserialize::error::DeserializeError,
115> {
116 let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
117 let tokens = &mut tokens_owned;
118 ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
119 loop {
120 match tokens.next().transpose()? {
121 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
122 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
123 "ChangeProgressStatus" => {
124 builder = builder.set_change_progress_status(
125 crate::protocol_serde::shape_change_progress_status_details::de_change_progress_status_details(tokens)?,
126 );
127 }
128 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
129 },
130 other => {
131 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
132 "expected object key or end object, found: {:?}",
133 other
134 )))
135 }
136 }
137 }
138 if tokens.next().is_some() {
139 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
140 "found more JSON tokens after completing parsing",
141 ));
142 }
143 Ok(builder)
144}