aws_sdk_backup/protocol_serde/
shape_update_framework.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_update_framework_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::update_framework::UpdateFrameworkOutput, crate::operation::update_framework::UpdateFrameworkError> {
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::update_framework::UpdateFrameworkError::unhandled)?;
11 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
12 let generic = generic_builder.build();
13 let error_code = match generic.code() {
14 Some(code) => code,
15 None => return Err(crate::operation::update_framework::UpdateFrameworkError::unhandled(generic)),
16 };
17
18 let _error_message = generic.message().map(|msg| msg.to_owned());
19 Err(match error_code {
20 "AlreadyExistsException" => crate::operation::update_framework::UpdateFrameworkError::AlreadyExistsException({
21 #[allow(unused_mut)]
22 let mut tmp = {
23 #[allow(unused_mut)]
24 let mut output = crate::types::error::builders::AlreadyExistsExceptionBuilder::default();
25 output = crate::protocol_serde::shape_already_exists_exception::de_already_exists_exception_json_err(_response_body, output)
26 .map_err(crate::operation::update_framework::UpdateFrameworkError::unhandled)?;
27 let output = output.meta(generic);
28 output.build()
29 };
30 if tmp.message.is_none() {
31 tmp.message = _error_message;
32 }
33 tmp
34 }),
35 "ConflictException" => crate::operation::update_framework::UpdateFrameworkError::ConflictException({
36 #[allow(unused_mut)]
37 let mut tmp = {
38 #[allow(unused_mut)]
39 let mut output = crate::types::error::builders::ConflictExceptionBuilder::default();
40 output = crate::protocol_serde::shape_conflict_exception::de_conflict_exception_json_err(_response_body, output)
41 .map_err(crate::operation::update_framework::UpdateFrameworkError::unhandled)?;
42 let output = output.meta(generic);
43 output.build()
44 };
45 if tmp.message.is_none() {
46 tmp.message = _error_message;
47 }
48 tmp
49 }),
50 "InvalidParameterValueException" => crate::operation::update_framework::UpdateFrameworkError::InvalidParameterValueException({
51 #[allow(unused_mut)]
52 let mut tmp = {
53 #[allow(unused_mut)]
54 let mut output = crate::types::error::builders::InvalidParameterValueExceptionBuilder::default();
55 output = crate::protocol_serde::shape_invalid_parameter_value_exception::de_invalid_parameter_value_exception_json_err(
56 _response_body,
57 output,
58 )
59 .map_err(crate::operation::update_framework::UpdateFrameworkError::unhandled)?;
60 let output = output.meta(generic);
61 output.build()
62 };
63 if tmp.message.is_none() {
64 tmp.message = _error_message;
65 }
66 tmp
67 }),
68 "LimitExceededException" => crate::operation::update_framework::UpdateFrameworkError::LimitExceededException({
69 #[allow(unused_mut)]
70 let mut tmp = {
71 #[allow(unused_mut)]
72 let mut output = crate::types::error::builders::LimitExceededExceptionBuilder::default();
73 output = crate::protocol_serde::shape_limit_exceeded_exception::de_limit_exceeded_exception_json_err(_response_body, output)
74 .map_err(crate::operation::update_framework::UpdateFrameworkError::unhandled)?;
75 let output = output.meta(generic);
76 output.build()
77 };
78 if tmp.message.is_none() {
79 tmp.message = _error_message;
80 }
81 tmp
82 }),
83 "MissingParameterValueException" => crate::operation::update_framework::UpdateFrameworkError::MissingParameterValueException({
84 #[allow(unused_mut)]
85 let mut tmp = {
86 #[allow(unused_mut)]
87 let mut output = crate::types::error::builders::MissingParameterValueExceptionBuilder::default();
88 output = crate::protocol_serde::shape_missing_parameter_value_exception::de_missing_parameter_value_exception_json_err(
89 _response_body,
90 output,
91 )
92 .map_err(crate::operation::update_framework::UpdateFrameworkError::unhandled)?;
93 let output = output.meta(generic);
94 output.build()
95 };
96 if tmp.message.is_none() {
97 tmp.message = _error_message;
98 }
99 tmp
100 }),
101 "ResourceNotFoundException" => crate::operation::update_framework::UpdateFrameworkError::ResourceNotFoundException({
102 #[allow(unused_mut)]
103 let mut tmp = {
104 #[allow(unused_mut)]
105 let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
106 output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
107 .map_err(crate::operation::update_framework::UpdateFrameworkError::unhandled)?;
108 let output = output.meta(generic);
109 output.build()
110 };
111 if tmp.message.is_none() {
112 tmp.message = _error_message;
113 }
114 tmp
115 }),
116 "ServiceUnavailableException" => crate::operation::update_framework::UpdateFrameworkError::ServiceUnavailableException({
117 #[allow(unused_mut)]
118 let mut tmp = {
119 #[allow(unused_mut)]
120 let mut output = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
121 output =
122 crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(_response_body, output)
123 .map_err(crate::operation::update_framework::UpdateFrameworkError::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 _ => crate::operation::update_framework::UpdateFrameworkError::generic(generic),
133 })
134}
135
136#[allow(clippy::unnecessary_wraps)]
137pub fn de_update_framework_http_response(
138 _response_status: u16,
139 _response_headers: &::aws_smithy_runtime_api::http::Headers,
140 _response_body: &[u8],
141) -> std::result::Result<crate::operation::update_framework::UpdateFrameworkOutput, crate::operation::update_framework::UpdateFrameworkError> {
142 Ok({
143 #[allow(unused_mut)]
144 let mut output = crate::operation::update_framework::builders::UpdateFrameworkOutputBuilder::default();
145 output = crate::protocol_serde::shape_update_framework::de_update_framework(_response_body, output)
146 .map_err(crate::operation::update_framework::UpdateFrameworkError::unhandled)?;
147 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
148 output.build()
149 })
150}
151
152pub fn ser_update_framework_input(
153 input: &crate::operation::update_framework::UpdateFrameworkInput,
154) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
155 let mut out = String::new();
156 let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
157 crate::protocol_serde::shape_update_framework_input::ser_update_framework_input_input(&mut object, input)?;
158 object.finish();
159 Ok(::aws_smithy_types::body::SdkBody::from(out))
160}
161
162pub(crate) fn de_update_framework(
163 value: &[u8],
164 mut builder: crate::operation::update_framework::builders::UpdateFrameworkOutputBuilder,
165) -> ::std::result::Result<
166 crate::operation::update_framework::builders::UpdateFrameworkOutputBuilder,
167 ::aws_smithy_json::deserialize::error::DeserializeError,
168> {
169 let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
170 let tokens = &mut tokens_owned;
171 ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
172 loop {
173 match tokens.next().transpose()? {
174 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
175 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
176 "CreationTime" => {
177 builder = builder.set_creation_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
178 tokens.next(),
179 ::aws_smithy_types::date_time::Format::EpochSeconds,
180 )?);
181 }
182 "FrameworkArn" => {
183 builder = builder.set_framework_arn(
184 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
185 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
186 .transpose()?,
187 );
188 }
189 "FrameworkName" => {
190 builder = builder.set_framework_name(
191 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
192 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
193 .transpose()?,
194 );
195 }
196 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
197 },
198 other => {
199 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
200 "expected object key or end object, found: {:?}",
201 other
202 )))
203 }
204 }
205 }
206 if tokens.next().is_some() {
207 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
208 "found more JSON tokens after completing parsing",
209 ));
210 }
211 Ok(builder)
212}