aws_sdk_backup/protocol_serde/
shape_describe_framework.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_describe_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::describe_framework::DescribeFrameworkOutput, crate::operation::describe_framework::DescribeFrameworkError>
8{
9 #[allow(unused_mut)]
10 let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
11 .map_err(crate::operation::describe_framework::DescribeFrameworkError::unhandled)?;
12 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
13 let generic = generic_builder.build();
14 let error_code = match generic.code() {
15 Some(code) => code,
16 None => return Err(crate::operation::describe_framework::DescribeFrameworkError::unhandled(generic)),
17 };
18
19 let _error_message = generic.message().map(|msg| msg.to_owned());
20 Err(match error_code {
21 "InvalidParameterValueException" => crate::operation::describe_framework::DescribeFrameworkError::InvalidParameterValueException({
22 #[allow(unused_mut)]
23 let mut tmp = {
24 #[allow(unused_mut)]
25 let mut output = crate::types::error::builders::InvalidParameterValueExceptionBuilder::default();
26 output = crate::protocol_serde::shape_invalid_parameter_value_exception::de_invalid_parameter_value_exception_json_err(
27 _response_body,
28 output,
29 )
30 .map_err(crate::operation::describe_framework::DescribeFrameworkError::unhandled)?;
31 let output = output.meta(generic);
32 output.build()
33 };
34 if tmp.message.is_none() {
35 tmp.message = _error_message;
36 }
37 tmp
38 }),
39 "MissingParameterValueException" => crate::operation::describe_framework::DescribeFrameworkError::MissingParameterValueException({
40 #[allow(unused_mut)]
41 let mut tmp = {
42 #[allow(unused_mut)]
43 let mut output = crate::types::error::builders::MissingParameterValueExceptionBuilder::default();
44 output = crate::protocol_serde::shape_missing_parameter_value_exception::de_missing_parameter_value_exception_json_err(
45 _response_body,
46 output,
47 )
48 .map_err(crate::operation::describe_framework::DescribeFrameworkError::unhandled)?;
49 let output = output.meta(generic);
50 output.build()
51 };
52 if tmp.message.is_none() {
53 tmp.message = _error_message;
54 }
55 tmp
56 }),
57 "ResourceNotFoundException" => crate::operation::describe_framework::DescribeFrameworkError::ResourceNotFoundException({
58 #[allow(unused_mut)]
59 let mut tmp = {
60 #[allow(unused_mut)]
61 let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
62 output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
63 .map_err(crate::operation::describe_framework::DescribeFrameworkError::unhandled)?;
64 let output = output.meta(generic);
65 output.build()
66 };
67 if tmp.message.is_none() {
68 tmp.message = _error_message;
69 }
70 tmp
71 }),
72 "ServiceUnavailableException" => crate::operation::describe_framework::DescribeFrameworkError::ServiceUnavailableException({
73 #[allow(unused_mut)]
74 let mut tmp = {
75 #[allow(unused_mut)]
76 let mut output = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
77 output =
78 crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(_response_body, output)
79 .map_err(crate::operation::describe_framework::DescribeFrameworkError::unhandled)?;
80 let output = output.meta(generic);
81 output.build()
82 };
83 if tmp.message.is_none() {
84 tmp.message = _error_message;
85 }
86 tmp
87 }),
88 _ => crate::operation::describe_framework::DescribeFrameworkError::generic(generic),
89 })
90}
91
92#[allow(clippy::unnecessary_wraps)]
93pub fn de_describe_framework_http_response(
94 _response_status: u16,
95 _response_headers: &::aws_smithy_runtime_api::http::Headers,
96 _response_body: &[u8],
97) -> std::result::Result<crate::operation::describe_framework::DescribeFrameworkOutput, crate::operation::describe_framework::DescribeFrameworkError>
98{
99 Ok({
100 #[allow(unused_mut)]
101 let mut output = crate::operation::describe_framework::builders::DescribeFrameworkOutputBuilder::default();
102 output = crate::protocol_serde::shape_describe_framework::de_describe_framework(_response_body, output)
103 .map_err(crate::operation::describe_framework::DescribeFrameworkError::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_framework(
110 value: &[u8],
111 mut builder: crate::operation::describe_framework::builders::DescribeFrameworkOutputBuilder,
112) -> ::std::result::Result<
113 crate::operation::describe_framework::builders::DescribeFrameworkOutputBuilder,
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 "CreationTime" => {
124 builder = builder.set_creation_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
125 tokens.next(),
126 ::aws_smithy_types::date_time::Format::EpochSeconds,
127 )?);
128 }
129 "DeploymentStatus" => {
130 builder = builder.set_deployment_status(
131 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
132 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
133 .transpose()?,
134 );
135 }
136 "FrameworkArn" => {
137 builder = builder.set_framework_arn(
138 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
139 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
140 .transpose()?,
141 );
142 }
143 "FrameworkControls" => {
144 builder = builder.set_framework_controls(crate::protocol_serde::shape_framework_controls::de_framework_controls(tokens)?);
145 }
146 "FrameworkDescription" => {
147 builder = builder.set_framework_description(
148 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
149 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
150 .transpose()?,
151 );
152 }
153 "FrameworkName" => {
154 builder = builder.set_framework_name(
155 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
156 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
157 .transpose()?,
158 );
159 }
160 "FrameworkStatus" => {
161 builder = builder.set_framework_status(
162 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
163 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
164 .transpose()?,
165 );
166 }
167 "IdempotencyToken" => {
168 builder = builder.set_idempotency_token(
169 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
170 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
171 .transpose()?,
172 );
173 }
174 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
175 },
176 other => {
177 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
178 "expected object key or end object, found: {:?}",
179 other
180 )))
181 }
182 }
183 }
184 if tokens.next().is_some() {
185 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
186 "found more JSON tokens after completing parsing",
187 ));
188 }
189 Ok(builder)
190}