1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 | /// Orchestration and serialization glue logic for `MalformedTimestampQueryHttpDate`.
|
3 3 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
4 4 | #[non_exhaustive]
|
5 5 | pub struct MalformedTimestampQueryHttpDate;
|
6 6 | impl MalformedTimestampQueryHttpDate {
|
7 7 | /// Creates a new `MalformedTimestampQueryHttpDate`
|
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 =
|
13 + | crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateInput::SCHEMA;
|
14 + | /// The schema for this operation's output shape.
|
15 + | pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema =
|
16 + | crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateOutput::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::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateInput,
|
14 20 | ) -> ::std::result::Result<
|
15 21 | crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateOutput,
|
16 22 | ::aws_smithy_runtime_api::client::result::SdkError<
|
17 23 | crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateError,
|
18 24 | ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
19 25 | >,
|
20 26 | > {
|
133 139 | ::std::borrow::Cow::Owned(rcb)
|
134 140 | }
|
135 141 | }
|
136 142 |
|
137 143 | #[derive(Debug)]
|
138 144 | struct MalformedTimestampQueryHttpDateResponseDeserializer;
|
139 145 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for MalformedTimestampQueryHttpDateResponseDeserializer {
|
140 146 | fn deserialize_nonstreaming(
|
141 147 | &self,
|
142 148 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
149 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
143 150 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
144 151 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
145 - | let headers = response.headers();
|
146 - | let body = response.body().bytes().expect("body loaded");
|
147 152 | #[allow(unused_mut)]
|
148 153 | let mut force_error = false;
|
149 154 |
|
150 - | let parse_result = if !success && status != 200 || force_error {
|
151 - | crate::protocol_serde::shape_malformed_timestamp_query_http_date::de_malformed_timestamp_query_http_date_http_error(status, headers, body)
|
155 + | if !success && status != 200 || force_error {
|
156 + | let headers = response.headers();
|
157 + | let body = response.body().bytes().expect("body loaded");
|
158 + | #[allow(unused_mut)]
|
159 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
160 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
161 + | })?;
|
162 + |
|
163 + | let generic = generic_builder.build();
|
164 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
165 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(
|
166 + | crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateError::generic(generic),
|
167 + | ),
|
168 + | ))
|
152 169 | } else {
|
153 - | crate::protocol_serde::shape_malformed_timestamp_query_http_date::de_malformed_timestamp_query_http_date_http_response(
|
154 - | status, headers, body,
|
170 + | let protocol = _cfg
|
171 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
172 + | .expect("a SharedClientProtocol is required");
|
173 + | let mut deser = protocol
|
174 + | .deserialize_response(response, MalformedTimestampQueryHttpDate::OUTPUT_SCHEMA, _cfg)
|
175 + | .map_err(|e| {
|
176 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
177 + | })?;
|
178 + | let body = response.body().bytes().expect("body loaded");
|
179 + | let output = crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateOutput::deserialize_with_response(
|
180 + | &mut *deser,
|
181 + | response.headers(),
|
182 + | response.status().into(),
|
183 + | body,
|
155 184 | )
|
156 - | };
|
157 - | crate::protocol_serde::type_erase_result(parse_result)
|
185 + | .map_err(|e| {
|
186 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
187 + | })?;
|
188 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
189 + | }
|
158 190 | }
|
159 191 | }
|
160 192 | #[derive(Debug)]
|
161 193 | struct MalformedTimestampQueryHttpDateRequestSerializer;
|
162 194 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for MalformedTimestampQueryHttpDateRequestSerializer {
|
163 195 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
164 196 | fn serialize_input(
|
165 197 | &self,
|
166 198 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
167 199 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
168 200 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
169 201 | let input = input
|
170 202 | .downcast::<crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateInput>()
|
171 203 | .expect("correct type");
|
172 - | let _header_serialization_settings = _cfg
|
173 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
174 - | .cloned()
|
175 - | .unwrap_or_default();
|
176 - | let mut request_builder = {
|
177 - | #[allow(clippy::uninlined_format_args)]
|
178 - | fn uri_base(
|
179 - | _input: &crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateInput,
|
180 - | output: &mut ::std::string::String,
|
181 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
182 - | use ::std::fmt::Write as _;
|
183 - | ::std::write!(output, "/MalformedTimestampQueryHttpDate").expect("formatting should succeed");
|
184 - | ::std::result::Result::Ok(())
|
185 - | }
|
186 - | fn uri_query(
|
187 - | _input: &crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateInput,
|
188 - | mut output: &mut ::std::string::String,
|
189 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
190 - | let mut query = ::aws_smithy_http::query::Writer::new(output);
|
191 - | let inner_1 = &_input.timestamp;
|
192 - | let inner_1 = inner_1
|
193 - | .as_ref()
|
194 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("timestamp", "cannot be empty or unset"))?;
|
195 - | query.push_kv(
|
196 - | "timestamp",
|
197 - | &::aws_smithy_http::query::fmt_timestamp(inner_1, ::aws_smithy_types::date_time::Format::HttpDate)?,
|
198 - | );
|
199 - | ::std::result::Result::Ok(())
|
200 - | }
|
201 - | #[allow(clippy::unnecessary_wraps)]
|
202 - | fn update_http_builder(
|
203 - | input: &crate::operation::malformed_timestamp_query_http_date::MalformedTimestampQueryHttpDateInput,
|
204 - | builder: ::http_1x::request::Builder,
|
205 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
206 - | let mut uri = ::std::string::String::new();
|
207 - | uri_base(input, &mut uri)?;
|
208 - | uri_query(input, &mut uri)?;
|
209 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
204 + | let protocol = _cfg
|
205 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
206 + | .expect("a SharedClientProtocol is required");
|
207 + | if protocol.supports_http_bindings() {
|
208 + | let mut request = protocol
|
209 + | .serialize_body(&input, MalformedTimestampQueryHttpDate::INPUT_SCHEMA, "", _cfg)
|
210 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
211 + | {
|
212 + | let mut uri = "/MalformedTimestampQueryHttpDate".to_string();
|
213 + | let mut query_params: Vec<(String, String)> = Vec::new();
|
214 + | if let Some(ref val) = input.timestamp {
|
215 + | query_params.push((
|
216 + | "timestamp".to_string(),
|
217 + | val.fmt(::aws_smithy_types::date_time::Format::HttpDate).expect("valid timestamp"),
|
218 + | ));
|
219 + | }
|
220 + | if !query_params.is_empty() {
|
221 + | uri.push(if uri.contains('?') { '&' } else { '?' });
|
222 + | let pairs: Vec<String> = query_params
|
223 + | .iter()
|
224 + | .map(|(k, v)| {
|
225 + | format!(
|
226 + | "{}={}",
|
227 + | ::aws_smithy_schema::http_protocol::percent_encode(k),
|
228 + | ::aws_smithy_schema::http_protocol::percent_encode(v)
|
229 + | )
|
230 + | })
|
231 + | .collect();
|
232 + | uri.push_str(&pairs.join("&"));
|
233 + | }
|
234 + | request.set_uri(uri.as_str()).expect("valid URI");
|
210 235 | }
|
211 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
212 - | builder
|
213 - | };
|
214 - | let body = ::aws_smithy_types::body::SdkBody::from("");
|
215 236 |
|
216 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
237 + | return ::std::result::Result::Ok(request);
|
238 + | } else {
|
239 + | let mut request = protocol
|
240 + | .serialize_request(&input, MalformedTimestampQueryHttpDate::INPUT_SCHEMA, "", _cfg)
|
241 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
242 + |
|
243 + | return ::std::result::Result::Ok(request);
|
244 + | }
|
217 245 | }
|
218 246 | }
|
219 247 | #[derive(Debug)]
|
220 248 | struct MalformedTimestampQueryHttpDateEndpointParamsInterceptor;
|
221 249 |
|
222 250 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for MalformedTimestampQueryHttpDateEndpointParamsInterceptor {
|
223 251 | fn name(&self) -> &'static str {
|
224 252 | "MalformedTimestampQueryHttpDateEndpointParamsInterceptor"
|
225 253 | }
|
226 254 |
|