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