1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_get_transformer_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_transformer::GetTransformerOutput, crate::operation::get_transformer::GetTransformerError> {
|
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_transformer::GetTransformerError::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_transformer::GetTransformerError::unhandled(generic)),
|
16 - | };
|
17 - |
|
18 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
19 - | Err(match error_code {
|
20 - | "InvalidOperationException" => crate::operation::get_transformer::GetTransformerError::InvalidOperationException({
|
21 - | #[allow(unused_mut)]
|
22 - | let mut tmp = {
|
23 - | #[allow(unused_mut)]
|
24 - | let mut output = crate::types::error::builders::InvalidOperationExceptionBuilder::default();
|
25 - | output = crate::protocol_serde::shape_invalid_operation_exception::de_invalid_operation_exception_json_err(_response_body, output)
|
26 - | .map_err(crate::operation::get_transformer::GetTransformerError::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 - | "InvalidParameterException" => crate::operation::get_transformer::GetTransformerError::InvalidParameterException({
|
36 - | #[allow(unused_mut)]
|
37 - | let mut tmp = {
|
38 - | #[allow(unused_mut)]
|
39 - | let mut output = crate::types::error::builders::InvalidParameterExceptionBuilder::default();
|
40 - | output = crate::protocol_serde::shape_invalid_parameter_exception::de_invalid_parameter_exception_json_err(_response_body, output)
|
41 - | .map_err(crate::operation::get_transformer::GetTransformerError::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 - | "ResourceNotFoundException" => crate::operation::get_transformer::GetTransformerError::ResourceNotFoundException({
|
51 - | #[allow(unused_mut)]
|
52 - | let mut tmp = {
|
53 - | #[allow(unused_mut)]
|
54 - | let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
|
55 - | output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
|
56 - | .map_err(crate::operation::get_transformer::GetTransformerError::unhandled)?;
|
57 - | let output = output.meta(generic);
|
58 - | output.build()
|
59 - | };
|
60 - | if tmp.message.is_none() {
|
61 - | tmp.message = _error_message;
|
62 - | }
|
63 - | tmp
|
64 - | }),
|
65 - | "ServiceUnavailableException" => crate::operation::get_transformer::GetTransformerError::ServiceUnavailableException({
|
66 - | #[allow(unused_mut)]
|
67 - | let mut tmp = {
|
68 - | #[allow(unused_mut)]
|
69 - | let mut output = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
|
70 - | output =
|
71 - | crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(_response_body, output)
|
72 - | .map_err(crate::operation::get_transformer::GetTransformerError::unhandled)?;
|
73 - | let output = output.meta(generic);
|
74 - | output.build()
|
75 - | };
|
76 - | if tmp.message.is_none() {
|
77 - | tmp.message = _error_message;
|
78 - | }
|
79 - | tmp
|
80 - | }),
|
81 - | _ => crate::operation::get_transformer::GetTransformerError::generic(generic),
|
82 - | })
|
83 - | }
|
84 - |
|
85 - | #[allow(clippy::unnecessary_wraps)]
|
86 - | pub fn de_get_transformer_http_response(
|
87 - | _response_status: u16,
|
88 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
89 - | _response_body: &[u8],
|
90 - | ) -> std::result::Result<crate::operation::get_transformer::GetTransformerOutput, crate::operation::get_transformer::GetTransformerError> {
|
91 - | Ok({
|
92 - | #[allow(unused_mut)]
|
93 - | let mut output = crate::operation::get_transformer::builders::GetTransformerOutputBuilder::default();
|
94 - | output = crate::protocol_serde::shape_get_transformer::de_get_transformer(_response_body, output)
|
95 - | .map_err(crate::operation::get_transformer::GetTransformerError::unhandled)?;
|
96 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
97 - | output.build()
|
98 - | })
|
99 - | }
|
100 - |
|
101 - | pub fn ser_get_transformer_input(
|
102 - | input: &crate::operation::get_transformer::GetTransformerInput,
|
103 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
104 - | let mut out = String::new();
|
105 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
106 - | crate::protocol_serde::shape_get_transformer_input::ser_get_transformer_input_input(&mut object, input)?;
|
107 - | object.finish();
|
108 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
109 - | }
|
110 - |
|
111 - | pub(crate) fn de_get_transformer(
|
112 - | _value: &[u8],
|
113 - | mut builder: crate::operation::get_transformer::builders::GetTransformerOutputBuilder,
|
114 - | ) -> ::std::result::Result<
|
115 - | crate::operation::get_transformer::builders::GetTransformerOutputBuilder,
|
116 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
117 - | > {
|
118 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
119 - | let tokens = &mut tokens_owned;
|
120 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
121 - | loop {
|
122 - | match tokens.next().transpose()? {
|
123 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
124 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
125 - | "logGroupIdentifier" => {
|
126 - | builder = builder.set_log_group_identifier(
|
127 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
128 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
129 - | .transpose()?,
|
130 - | );
|
131 - | }
|
132 - | "creationTime" => {
|
133 - | builder = builder.set_creation_time(
|
134 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
135 - | .map(i64::try_from)
|
136 - | .transpose()?,
|
137 - | );
|
138 - | }
|
139 - | "lastModifiedTime" => {
|
140 - | builder = builder.set_last_modified_time(
|
141 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
142 - | .map(i64::try_from)
|
143 - | .transpose()?,
|
144 - | );
|
145 - | }
|
146 - | "transformerConfig" => {
|
147 - | builder = builder.set_transformer_config(crate::protocol_serde::shape_processors::de_processors(tokens, _value)?);
|
148 - | }
|
149 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
150 - | },
|
151 - | other => {
|
152 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
153 - | "expected object key or end object, found: {other:?}"
|
154 - | )))
|
155 - | }
|
156 - | }
|
157 - | }
|
158 - | if tokens.next().is_some() {
|
159 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
160 - | "found more JSON tokens after completing parsing",
|
161 - | ));
|
162 - | }
|
163 - | Ok(builder)
|
164 - | }
|