aws_sdk_datasync/protocol_serde/
shape_describe_location_hdfs.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_describe_location_hdfs_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_location_hdfs::DescribeLocationHdfsOutput,
9 crate::operation::describe_location_hdfs::DescribeLocationHdfsError,
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_location_hdfs::DescribeLocationHdfsError::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_location_hdfs::DescribeLocationHdfsError::unhandled(generic)),
19 };
20
21 let _error_message = generic.message().map(|msg| msg.to_owned());
22 Err(match error_code {
23 "InternalException" => crate::operation::describe_location_hdfs::DescribeLocationHdfsError::InternalException({
24 #[allow(unused_mut)]
25 let mut tmp = {
26 #[allow(unused_mut)]
27 let mut output = crate::types::error::builders::InternalExceptionBuilder::default();
28 output = crate::protocol_serde::shape_internal_exception::de_internal_exception_json_err(_response_body, output)
29 .map_err(crate::operation::describe_location_hdfs::DescribeLocationHdfsError::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 "InvalidRequestException" => crate::operation::describe_location_hdfs::DescribeLocationHdfsError::InvalidRequestException({
39 #[allow(unused_mut)]
40 let mut tmp = {
41 #[allow(unused_mut)]
42 let mut output = crate::types::error::builders::InvalidRequestExceptionBuilder::default();
43 output = crate::protocol_serde::shape_invalid_request_exception::de_invalid_request_exception_json_err(_response_body, output)
44 .map_err(crate::operation::describe_location_hdfs::DescribeLocationHdfsError::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 _ => crate::operation::describe_location_hdfs::DescribeLocationHdfsError::generic(generic),
54 })
55}
56
57#[allow(clippy::unnecessary_wraps)]
58pub fn de_describe_location_hdfs_http_response(
59 _response_status: u16,
60 _response_headers: &::aws_smithy_runtime_api::http::Headers,
61 _response_body: &[u8],
62) -> std::result::Result<
63 crate::operation::describe_location_hdfs::DescribeLocationHdfsOutput,
64 crate::operation::describe_location_hdfs::DescribeLocationHdfsError,
65> {
66 Ok({
67 #[allow(unused_mut)]
68 let mut output = crate::operation::describe_location_hdfs::builders::DescribeLocationHdfsOutputBuilder::default();
69 output = crate::protocol_serde::shape_describe_location_hdfs::de_describe_location_hdfs(_response_body, output)
70 .map_err(crate::operation::describe_location_hdfs::DescribeLocationHdfsError::unhandled)?;
71 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
72 output.build()
73 })
74}
75
76pub fn ser_describe_location_hdfs_input(
77 input: &crate::operation::describe_location_hdfs::DescribeLocationHdfsInput,
78) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
79 let mut out = String::new();
80 let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
81 crate::protocol_serde::shape_describe_location_hdfs_input::ser_describe_location_hdfs_input_input(&mut object, input)?;
82 object.finish();
83 Ok(::aws_smithy_types::body::SdkBody::from(out))
84}
85
86pub(crate) fn de_describe_location_hdfs(
87 value: &[u8],
88 mut builder: crate::operation::describe_location_hdfs::builders::DescribeLocationHdfsOutputBuilder,
89) -> ::std::result::Result<
90 crate::operation::describe_location_hdfs::builders::DescribeLocationHdfsOutputBuilder,
91 ::aws_smithy_json::deserialize::error::DeserializeError,
92> {
93 let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
94 let tokens = &mut tokens_owned;
95 ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
96 loop {
97 match tokens.next().transpose()? {
98 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
99 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
100 "LocationArn" => {
101 builder = builder.set_location_arn(
102 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
103 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
104 .transpose()?,
105 );
106 }
107 "LocationUri" => {
108 builder = builder.set_location_uri(
109 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
110 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
111 .transpose()?,
112 );
113 }
114 "NameNodes" => {
115 builder = builder.set_name_nodes(crate::protocol_serde::shape_hdfs_name_node_list::de_hdfs_name_node_list(tokens)?);
116 }
117 "BlockSize" => {
118 builder = builder.set_block_size(
119 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
120 .map(i32::try_from)
121 .transpose()?,
122 );
123 }
124 "ReplicationFactor" => {
125 builder = builder.set_replication_factor(
126 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
127 .map(i32::try_from)
128 .transpose()?,
129 );
130 }
131 "KmsKeyProviderUri" => {
132 builder = builder.set_kms_key_provider_uri(
133 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
134 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
135 .transpose()?,
136 );
137 }
138 "QopConfiguration" => {
139 builder = builder.set_qop_configuration(crate::protocol_serde::shape_qop_configuration::de_qop_configuration(tokens)?);
140 }
141 "AuthenticationType" => {
142 builder = builder.set_authentication_type(
143 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
144 .map(|s| s.to_unescaped().map(|u| crate::types::HdfsAuthenticationType::from(u.as_ref())))
145 .transpose()?,
146 );
147 }
148 "SimpleUser" => {
149 builder = builder.set_simple_user(
150 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
151 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
152 .transpose()?,
153 );
154 }
155 "KerberosPrincipal" => {
156 builder = builder.set_kerberos_principal(
157 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
158 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
159 .transpose()?,
160 );
161 }
162 "AgentArns" => {
163 builder = builder.set_agent_arns(crate::protocol_serde::shape_agent_arn_list::de_agent_arn_list(tokens)?);
164 }
165 "CreationTime" => {
166 builder = builder.set_creation_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
167 tokens.next(),
168 ::aws_smithy_types::date_time::Format::EpochSeconds,
169 )?);
170 }
171 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
172 },
173 other => {
174 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
175 "expected object key or end object, found: {:?}",
176 other
177 )))
178 }
179 }
180 }
181 if tokens.next().is_some() {
182 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
183 "found more JSON tokens after completing parsing",
184 ));
185 }
186 Ok(builder)
187}