1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 | /// Orchestration and serialization glue logic for `SimpleScalarProperties`.
|
3 3 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
4 4 | #[non_exhaustive]
|
5 5 | pub struct SimpleScalarProperties;
|
6 6 | impl SimpleScalarProperties {
|
7 7 | /// Creates a new `SimpleScalarProperties`
|
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<'static> =
|
13 + | crate::operation::simple_scalar_properties::SimpleScalarPropertiesInput::SCHEMA;
|
14 + | /// The schema for this operation's output shape.
|
15 + | pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> =
|
16 + | crate::operation::simple_scalar_properties::SimpleScalarPropertiesOutput::SCHEMA;
|
11 17 | pub(crate) async fn orchestrate(
|
12 18 | runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
|
13 19 | input: crate::operation::simple_scalar_properties::SimpleScalarPropertiesInput,
|
14 20 | ) -> ::std::result::Result<
|
15 21 | crate::operation::simple_scalar_properties::SimpleScalarPropertiesOutput,
|
16 22 | ::aws_smithy_runtime_api::client::result::SdkError<
|
17 23 | crate::operation::simple_scalar_properties::SimpleScalarPropertiesError,
|
18 24 | ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
19 25 | >,
|
20 26 | > {
|
140 146 |
|
141 147 | #[derive(Debug)]
|
142 148 | struct SimpleScalarPropertiesResponseDeserializer;
|
143 149 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for SimpleScalarPropertiesResponseDeserializer {
|
144 150 | fn deserialize_nonstreaming_with_config(
|
145 151 | &self,
|
146 152 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
147 153 | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
148 154 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
149 155 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
150 - | let headers = response.headers();
|
156 + | // Load body and headers BEFORE BeforeParseResponse so customizations
|
157 + | // (e.g., S3's `body_is_error` check that detects errors returned with
|
158 + | // HTTP 200) can inspect them. The legacy non-streaming path also
|
159 + | // loads `body` before firing this hook.
|
151 160 | let body = response.body().bytes().expect("body loaded");
|
161 + | let headers = response.headers();
|
152 162 | #[allow(unused_mut)]
|
153 163 | let mut force_error = false;
|
154 164 |
|
155 - | let parse_result = if !success && status != 200 || force_error {
|
156 - | crate::protocol_serde::shape_simple_scalar_properties::de_simple_scalar_properties_http_error(status, headers, body)
|
165 + | if !success && status != 200 || force_error {
|
166 + | let protocol = _cfg
|
167 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
168 + | .expect("a SharedClientProtocol is required");
|
169 + | #[allow(unused_mut)]
|
170 + | let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
|
171 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
172 + | })?;
|
173 + |
|
174 + | let generic = generic_builder.build();
|
175 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
176 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
|
177 + | crate::operation::simple_scalar_properties::SimpleScalarPropertiesError::generic(generic),
|
178 + | ),
|
179 + | ))
|
157 180 | } else {
|
158 - | crate::protocol_serde::shape_simple_scalar_properties::de_simple_scalar_properties_http_response(status, headers, body)
|
159 - | };
|
160 - | crate::protocol_serde::type_erase_result(parse_result)
|
181 + | let protocol = _cfg
|
182 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
183 + | .expect("a SharedClientProtocol is required");
|
184 + | let mut deser = protocol
|
185 + | .deserialize_response(response, SimpleScalarProperties::OUTPUT_SCHEMA, _cfg)
|
186 + | .map_err(|e| {
|
187 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
188 + | })?;
|
189 + | // body and headers are already in scope from the top of the function;
|
190 + | // alias `headers` as `_response_headers` so MutateOutput
|
191 + | // customizations have a stable name to read from.
|
192 + | let _response_headers = headers;
|
193 + | #[allow(unused_mut)]
|
194 + | let mut output = crate::operation::simple_scalar_properties::SimpleScalarPropertiesOutput::deserialize_with_response(
|
195 + | &mut *deser,
|
196 + | _response_headers,
|
197 + | response.status().into(),
|
198 + | body,
|
199 + | )
|
200 + | .map_err(|e| {
|
201 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
202 + | })?;
|
203 + |
|
204 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
205 + | }
|
161 206 | }
|
162 207 | }
|
163 208 | #[derive(Debug)]
|
164 209 | struct SimpleScalarPropertiesRequestSerializer;
|
165 210 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for SimpleScalarPropertiesRequestSerializer {
|
166 211 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
167 212 | fn serialize_input(
|
168 213 | &self,
|
169 214 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
170 215 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
171 216 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
172 217 | let input = input
|
173 218 | .downcast::<crate::operation::simple_scalar_properties::SimpleScalarPropertiesInput>()
|
174 219 | .expect("correct type");
|
175 - | let _header_serialization_settings = _cfg
|
176 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
177 - | .cloned()
|
178 - | .unwrap_or_default();
|
179 - | let mut request_builder = {
|
180 - | #[allow(clippy::uninlined_format_args)]
|
181 - | fn uri_base(
|
182 - | _input: &crate::operation::simple_scalar_properties::SimpleScalarPropertiesInput,
|
183 - | output: &mut ::std::string::String,
|
184 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
185 - | use ::std::fmt::Write as _;
|
186 - | ::std::write!(output, "/").expect("formatting should succeed");
|
187 - | ::std::result::Result::Ok(())
|
188 - | }
|
189 - | #[allow(clippy::unnecessary_wraps)]
|
190 - | fn update_http_builder(
|
191 - | input: &crate::operation::simple_scalar_properties::SimpleScalarPropertiesInput,
|
192 - | builder: ::http_1x::request::Builder,
|
193 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
194 - | let mut uri = ::std::string::String::new();
|
195 - | uri_base(input, &mut uri)?;
|
196 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
197 - | }
|
198 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
199 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.0");
|
200 - | builder = _header_serialization_settings.set_default_header(
|
201 - | builder,
|
202 - | ::http_1x::header::HeaderName::from_static("x-amz-target"),
|
203 - | "JsonRpc10.SimpleScalarProperties",
|
204 - | );
|
205 - | builder
|
206 - | };
|
207 - | let body = ::aws_smithy_types::body::SdkBody::from(
|
208 - | crate::protocol_serde::shape_simple_scalar_properties::ser_simple_scalar_properties_input(&input)?,
|
209 - | );
|
210 - | if let Some(content_length) = body.content_length() {
|
211 - | let content_length = content_length.to_string();
|
212 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
213 - | }
|
214 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
220 + |
|
221 + | let protocol = _cfg
|
222 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
223 + | .expect("a SharedClientProtocol is required");
|
224 + | let mut request = protocol
|
225 + | .serialize_request(&input, SimpleScalarProperties::INPUT_SCHEMA, "/", _cfg)
|
226 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
227 + |
|
228 + | return ::std::result::Result::Ok(request);
|
215 229 | }
|
216 230 | }
|
217 231 | #[derive(Debug)]
|
218 232 | struct SimpleScalarPropertiesEndpointParamsInterceptor;
|
219 233 |
|
220 234 | #[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
|
221 235 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for SimpleScalarPropertiesEndpointParamsInterceptor {
|
222 236 | fn name(&self) -> &'static str {
|
223 237 | "SimpleScalarPropertiesEndpointParamsInterceptor"
|
224 238 | }
|