1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_get_storage_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_storage::GetStorageOutput, crate::operation::get_storage::GetStorageError> {
|
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_storage::GetStorageError::unhandled)?;
|
11 - | let generic = generic_builder.build();
|
12 - | let error_code = match generic.code() {
|
13 - | Some(code) => code,
|
14 - | None => return Err(crate::operation::get_storage::GetStorageError::unhandled(generic)),
|
15 - | };
|
16 - |
|
17 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
18 - | Err(match error_code {
|
19 - | "ResourceNotFoundException" => crate::operation::get_storage::GetStorageError::ResourceNotFoundError({
|
20 - | #[allow(unused_mut)]
|
21 - | let mut tmp = {
|
22 - | #[allow(unused_mut)]
|
23 - | let mut output = crate::types::error::builders::ResourceNotFoundErrorBuilder::default();
|
24 - | output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
|
25 - | .map_err(crate::operation::get_storage::GetStorageError::unhandled)?;
|
26 - | let output = output.meta(generic);
|
27 - | crate::serde_util::resource_not_found_exception_correct_errors(output)
|
28 - | .build()
|
29 - | .map_err(crate::operation::get_storage::GetStorageError::unhandled)?
|
30 - | };
|
31 - | tmp
|
32 - | }),
|
33 - | "StorageAccessNotAuthorized" => crate::operation::get_storage::GetStorageError::StorageAccessNotAuthorized({
|
34 - | #[allow(unused_mut)]
|
35 - | let mut tmp = {
|
36 - | #[allow(unused_mut)]
|
37 - | let mut output = crate::types::error::builders::StorageAccessNotAuthorizedBuilder::default();
|
38 - | output =
|
39 - | crate::protocol_serde::shape_storage_access_not_authorized::de_storage_access_not_authorized_json_err(_response_body, output)
|
40 - | .map_err(crate::operation::get_storage::GetStorageError::unhandled)?;
|
41 - | let output = output.meta(generic);
|
42 - | output.build()
|
43 - | };
|
44 - | if tmp.message.is_none() {
|
45 - | tmp.message = _error_message;
|
46 - | }
|
47 - | tmp
|
48 - | }),
|
49 - | "ValidationException" => crate::operation::get_storage::GetStorageError::ValidationError({
|
50 - | #[allow(unused_mut)]
|
51 - | let mut tmp = {
|
52 - | #[allow(unused_mut)]
|
53 - | let mut output = crate::types::error::builders::ValidationErrorBuilder::default();
|
54 - | output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
|
55 - | .map_err(crate::operation::get_storage::GetStorageError::unhandled)?;
|
56 - | let output = output.meta(generic);
|
57 - | crate::serde_util::validation_exception_correct_errors(output)
|
58 - | .build()
|
59 - | .map_err(crate::operation::get_storage::GetStorageError::unhandled)?
|
60 - | };
|
61 - | tmp
|
62 - | }),
|
63 - | _ => crate::operation::get_storage::GetStorageError::generic(generic),
|
64 - | })
|
65 - | }
|
66 - |
|
67 - | #[allow(clippy::unnecessary_wraps)]
|
68 - | pub fn de_get_storage_http_response(
|
69 - | _response_status: u16,
|
70 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
71 - | _response_body: &[u8],
|
72 - | ) -> std::result::Result<crate::operation::get_storage::GetStorageOutput, crate::operation::get_storage::GetStorageError> {
|
73 - | Ok({
|
74 - | #[allow(unused_mut)]
|
75 - | let mut output = crate::operation::get_storage::builders::GetStorageOutputBuilder::default();
|
76 - | output = crate::protocol_serde::shape_get_storage::de_get_storage(_response_body, output)
|
77 - | .map_err(crate::operation::get_storage::GetStorageError::unhandled)?;
|
78 - | crate::serde_util::get_storage_output_output_correct_errors(output)
|
79 - | .build()
|
80 - | .map_err(crate::operation::get_storage::GetStorageError::unhandled)?
|
81 - | })
|
82 - | }
|
83 - |
|
84 - | pub fn ser_get_storage_headers(
|
85 - | input: &crate::operation::get_storage::GetStorageInput,
|
86 - | mut builder: ::http_1x::request::Builder,
|
87 - | ) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
88 - | if let ::std::option::Option::Some(inner_1) = &input.passcode {
|
89 - | let formatted_2 = inner_1.as_str();
|
90 - | let header_value = formatted_2;
|
91 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
92 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
93 - | "passcode",
|
94 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
95 - | )
|
96 - | })?;
|
97 - | builder = builder.header("passcode", header_value);
|
98 - | }
|
99 - | Ok(builder)
|
100 - | }
|
101 - |
|
102 - | pub(crate) fn de_get_storage(
|
103 - | _value: &[u8],
|
104 - | mut builder: crate::operation::get_storage::builders::GetStorageOutputBuilder,
|
105 - | ) -> ::std::result::Result<crate::operation::get_storage::builders::GetStorageOutputBuilder, ::aws_smithy_json::deserialize::error::DeserializeError>
|
106 - | {
|
107 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
108 - | let tokens = &mut tokens_owned;
|
109 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
110 - | loop {
|
111 - | match tokens.next().transpose()? {
|
112 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
113 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
114 - | "collection" => {
|
115 - | builder = builder.set_collection(crate::protocol_serde::shape_species_collection::de_species_collection(tokens, _value)?);
|
116 - | }
|
117 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
118 - | },
|
119 - | other => {
|
120 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
121 - | "expected object key or end object, found: {other:?}"
|
122 - | )))
|
123 - | }
|
124 - | }
|
125 - | }
|
126 - | if tokens.next().is_some() {
|
127 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
128 - | "found more JSON tokens after completing parsing",
|
129 - | ));
|
130 - | }
|
131 - | Ok(builder)
|
132 - | }
|