1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 | /// Orchestration and serialization glue logic for `MalformedUnion`.
|
3 3 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
4 4 | #[non_exhaustive]
|
5 5 | pub struct MalformedUnion;
|
6 6 | impl MalformedUnion {
|
7 7 | /// Creates a new `MalformedUnion`
|
8 8 | pub fn new() -> Self {
|
9 9 | Self
|
10 10 | }
|
11 + | /// The schema for this operation's input shape.
|
12 + | pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::malformed_union::MalformedUnionInput::SCHEMA;
|
13 + | /// The schema for this operation's output shape.
|
14 + | pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::malformed_union::MalformedUnionOutput::SCHEMA;
|
11 15 | pub(crate) async fn orchestrate(
|
12 16 | runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
|
13 17 | input: crate::operation::malformed_union::MalformedUnionInput,
|
14 18 | ) -> ::std::result::Result<
|
15 19 | crate::operation::malformed_union::MalformedUnionOutput,
|
16 20 | ::aws_smithy_runtime_api::client::result::SdkError<
|
17 21 | crate::operation::malformed_union::MalformedUnionError,
|
18 22 | ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
19 23 | >,
|
20 24 | > {
|
124 128 | crate::operation::malformed_union::MalformedUnionError,
|
125 129 | >::new());
|
126 130 |
|
127 131 | ::std::borrow::Cow::Owned(rcb)
|
128 132 | }
|
129 133 | }
|
130 134 |
|
131 135 | #[derive(Debug)]
|
132 136 | struct MalformedUnionResponseDeserializer;
|
133 137 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for MalformedUnionResponseDeserializer {
|
134 - | fn deserialize_nonstreaming(
|
138 + | fn deserialize_nonstreaming_with_config(
|
135 139 | &self,
|
136 140 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
141 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
137 142 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
138 143 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
144 + | #[allow(unused_mut)]
|
145 + | let mut force_error = false;
|
146 + |
|
147 + | if !success && status != 200 || force_error {
|
139 148 | let headers = response.headers();
|
140 149 | let body = response.body().bytes().expect("body loaded");
|
141 150 | #[allow(unused_mut)]
|
142 - | let mut force_error = false;
|
151 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
152 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
153 + | })?;
|
143 154 |
|
144 - | let parse_result = if !success && status != 200 || force_error {
|
145 - | crate::protocol_serde::shape_malformed_union::de_malformed_union_http_error(status, headers, body)
|
155 + | let generic = generic_builder.build();
|
156 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
157 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
|
158 + | crate::operation::malformed_union::MalformedUnionError::generic(generic),
|
159 + | ),
|
160 + | ))
|
146 161 | } else {
|
147 - | crate::protocol_serde::shape_malformed_union::de_malformed_union_http_response(status, headers, body)
|
148 - | };
|
149 - | crate::protocol_serde::type_erase_result(parse_result)
|
162 + | let protocol = _cfg
|
163 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
164 + | .expect("a SharedClientProtocol is required");
|
165 + | let mut deser = protocol
|
166 + | .deserialize_response(response, MalformedUnion::OUTPUT_SCHEMA, _cfg)
|
167 + | .map_err(|e| {
|
168 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
169 + | })?;
|
170 + | let body = response.body().bytes().expect("body loaded");
|
171 + | let output = crate::operation::malformed_union::MalformedUnionOutput::deserialize_with_response(
|
172 + | &mut *deser,
|
173 + | response.headers(),
|
174 + | response.status().into(),
|
175 + | body,
|
176 + | )
|
177 + | .map_err(|e| {
|
178 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
179 + | })?;
|
180 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
181 + | }
|
150 182 | }
|
151 183 | }
|
152 184 | #[derive(Debug)]
|
153 185 | struct MalformedUnionRequestSerializer;
|
154 186 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for MalformedUnionRequestSerializer {
|
155 187 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
156 188 | fn serialize_input(
|
157 189 | &self,
|
158 190 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
159 191 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
160 192 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
161 193 | let input = input
|
162 194 | .downcast::<crate::operation::malformed_union::MalformedUnionInput>()
|
163 195 | .expect("correct type");
|
164 - | let _header_serialization_settings = _cfg
|
165 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
166 - | .cloned()
|
167 - | .unwrap_or_default();
|
168 - | let mut request_builder = {
|
169 - | #[allow(clippy::uninlined_format_args)]
|
170 - | fn uri_base(
|
171 - | _input: &crate::operation::malformed_union::MalformedUnionInput,
|
172 - | output: &mut ::std::string::String,
|
173 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
174 - | use ::std::fmt::Write as _;
|
175 - | ::std::write!(output, "/MalformedUnion").expect("formatting should succeed");
|
176 - | ::std::result::Result::Ok(())
|
177 - | }
|
178 - | #[allow(clippy::unnecessary_wraps)]
|
179 - | fn update_http_builder(
|
180 - | input: &crate::operation::malformed_union::MalformedUnionInput,
|
181 - | builder: ::http_1x::request::Builder,
|
182 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
183 - | let mut uri = ::std::string::String::new();
|
184 - | uri_base(input, &mut uri)?;
|
185 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
186 - | }
|
187 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
188 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
|
189 - | builder
|
190 - | };
|
191 - | let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_malformed_union::ser_malformed_union_input(&input)?);
|
192 - | if let Some(content_length) = body.content_length() {
|
193 - | let content_length = content_length.to_string();
|
194 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
195 - | }
|
196 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
196 + | let protocol = _cfg
|
197 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
198 + | .expect("a SharedClientProtocol is required");
|
199 + | let mut request = protocol
|
200 + | .serialize_request(&input, MalformedUnion::INPUT_SCHEMA, "", _cfg)
|
201 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
202 + |
|
203 + | return ::std::result::Result::Ok(request);
|
197 204 | }
|
198 205 | }
|
199 206 | #[derive(Debug)]
|
200 207 | struct MalformedUnionEndpointParamsInterceptor;
|
201 208 |
|
202 209 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for MalformedUnionEndpointParamsInterceptor {
|
203 210 | fn name(&self) -> &'static str {
|
204 211 | "MalformedUnionEndpointParamsInterceptor"
|
205 212 | }
|
206 213 |
|