aws_sdk_workdocs/protocol_serde/
shape_get_folder_path.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_get_folder_path_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::get_folder_path::GetFolderPathOutput, crate::operation::get_folder_path::GetFolderPathError> {
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::get_folder_path::GetFolderPathError::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::get_folder_path::GetFolderPathError::unhandled(generic)),
16 };
17
18 let _error_message = generic.message().map(|msg| msg.to_owned());
19 Err(match error_code {
20 "EntityNotExistsException" => crate::operation::get_folder_path::GetFolderPathError::EntityNotExistsException({
21 #[allow(unused_mut)]
22 let mut tmp = {
23 #[allow(unused_mut)]
24 let mut output = crate::types::error::builders::EntityNotExistsExceptionBuilder::default();
25 output = crate::protocol_serde::shape_entity_not_exists_exception::de_entity_not_exists_exception_json_err(_response_body, output)
26 .map_err(crate::operation::get_folder_path::GetFolderPathError::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 "FailedDependencyException" => crate::operation::get_folder_path::GetFolderPathError::FailedDependencyException({
36 #[allow(unused_mut)]
37 let mut tmp = {
38 #[allow(unused_mut)]
39 let mut output = crate::types::error::builders::FailedDependencyExceptionBuilder::default();
40 output = crate::protocol_serde::shape_failed_dependency_exception::de_failed_dependency_exception_json_err(_response_body, output)
41 .map_err(crate::operation::get_folder_path::GetFolderPathError::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 "ServiceUnavailableException" => crate::operation::get_folder_path::GetFolderPathError::ServiceUnavailableException({
51 #[allow(unused_mut)]
52 let mut tmp = {
53 #[allow(unused_mut)]
54 let mut output = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
55 output =
56 crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(_response_body, output)
57 .map_err(crate::operation::get_folder_path::GetFolderPathError::unhandled)?;
58 let output = output.meta(generic);
59 output.build()
60 };
61 if tmp.message.is_none() {
62 tmp.message = _error_message;
63 }
64 tmp
65 }),
66 "UnauthorizedOperationException" => crate::operation::get_folder_path::GetFolderPathError::UnauthorizedOperationException({
67 #[allow(unused_mut)]
68 let mut tmp = {
69 #[allow(unused_mut)]
70 let mut output = crate::types::error::builders::UnauthorizedOperationExceptionBuilder::default();
71 output = crate::protocol_serde::shape_unauthorized_operation_exception::de_unauthorized_operation_exception_json_err(
72 _response_body,
73 output,
74 )
75 .map_err(crate::operation::get_folder_path::GetFolderPathError::unhandled)?;
76 let output = output.meta(generic);
77 output.build()
78 };
79 if tmp.message.is_none() {
80 tmp.message = _error_message;
81 }
82 tmp
83 }),
84 "UnauthorizedResourceAccessException" => crate::operation::get_folder_path::GetFolderPathError::UnauthorizedResourceAccessException({
85 #[allow(unused_mut)]
86 let mut tmp = {
87 #[allow(unused_mut)]
88 let mut output = crate::types::error::builders::UnauthorizedResourceAccessExceptionBuilder::default();
89 output = crate::protocol_serde::shape_unauthorized_resource_access_exception::de_unauthorized_resource_access_exception_json_err(
90 _response_body,
91 output,
92 )
93 .map_err(crate::operation::get_folder_path::GetFolderPathError::unhandled)?;
94 let output = output.meta(generic);
95 output.build()
96 };
97 if tmp.message.is_none() {
98 tmp.message = _error_message;
99 }
100 tmp
101 }),
102 _ => crate::operation::get_folder_path::GetFolderPathError::generic(generic),
103 })
104}
105
106#[allow(clippy::unnecessary_wraps)]
107pub fn de_get_folder_path_http_response(
108 _response_status: u16,
109 _response_headers: &::aws_smithy_runtime_api::http::Headers,
110 _response_body: &[u8],
111) -> std::result::Result<crate::operation::get_folder_path::GetFolderPathOutput, crate::operation::get_folder_path::GetFolderPathError> {
112 Ok({
113 #[allow(unused_mut)]
114 let mut output = crate::operation::get_folder_path::builders::GetFolderPathOutputBuilder::default();
115 output = crate::protocol_serde::shape_get_folder_path::de_get_folder_path(_response_body, output)
116 .map_err(crate::operation::get_folder_path::GetFolderPathError::unhandled)?;
117 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
118 output.build()
119 })
120}
121
122pub fn ser_get_folder_path_headers(
123 input: &crate::operation::get_folder_path::GetFolderPathInput,
124 mut builder: ::http::request::Builder,
125) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
126 if let ::std::option::Option::Some(inner_1) = &input.authentication_token {
127 let formatted_2 = inner_1.as_str();
128 let header_value = formatted_2;
129 let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
130 ::aws_smithy_types::error::operation::BuildError::invalid_field(
131 "authentication_token",
132 format!("`{}` cannot be used as a header value: {}", &"*** Sensitive Data Redacted ***", err),
133 )
134 })?;
135 builder = builder.header("Authentication", header_value);
136 }
137 Ok(builder)
138}
139
140pub(crate) fn de_get_folder_path(
141 value: &[u8],
142 mut builder: crate::operation::get_folder_path::builders::GetFolderPathOutputBuilder,
143) -> ::std::result::Result<
144 crate::operation::get_folder_path::builders::GetFolderPathOutputBuilder,
145 ::aws_smithy_json::deserialize::error::DeserializeError,
146> {
147 let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
148 let tokens = &mut tokens_owned;
149 ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
150 loop {
151 match tokens.next().transpose()? {
152 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
153 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
154 "Path" => {
155 builder = builder.set_path(crate::protocol_serde::shape_resource_path::de_resource_path(tokens)?);
156 }
157 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
158 },
159 other => {
160 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
161 "expected object key or end object, found: {:?}",
162 other
163 )))
164 }
165 }
166 }
167 if tokens.next().is_some() {
168 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
169 "found more JSON tokens after completing parsing",
170 ));
171 }
172 Ok(builder)
173}