130 136 | crate::operation::http_request_with_labels_and_timestamp_format::HttpRequestWithLabelsAndTimestampFormatError,
|
131 137 | >::new());
|
132 138 |
|
133 139 | ::std::borrow::Cow::Owned(rcb)
|
134 140 | }
|
135 141 | }
|
136 142 |
|
137 143 | #[derive(Debug)]
|
138 144 | struct HttpRequestWithLabelsAndTimestampFormatResponseDeserializer;
|
139 145 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for HttpRequestWithLabelsAndTimestampFormatResponseDeserializer {
|
140 - | fn deserialize_nonstreaming(
|
146 + | fn deserialize_nonstreaming_with_config(
|
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());
|
152 + | #[allow(unused_mut)]
|
153 + | let mut force_error = false;
|
154 + |
|
155 + | if !success && status != 200 || force_error {
|
145 156 | let headers = response.headers();
|
146 157 | let body = response.body().bytes().expect("body loaded");
|
147 158 | #[allow(unused_mut)]
|
148 - | let mut force_error = false;
|
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 + | })?;
|
149 162 |
|
150 - | let parse_result = if !success && status != 200 || force_error {
|
151 - | crate::protocol_serde::shape_http_request_with_labels_and_timestamp_format::de_http_request_with_labels_and_timestamp_format_http_error(
|
152 - | status, headers, body,
|
153 - | )
|
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::http_request_with_labels_and_timestamp_format::HttpRequestWithLabelsAndTimestampFormatError::generic(generic),
|
167 + | ),
|
168 + | ))
|
154 169 | } else {
|
155 - | crate::protocol_serde::shape_http_request_with_labels_and_timestamp_format::de_http_request_with_labels_and_timestamp_format_http_response(
|
156 - | status, headers, body,
|
157 - | )
|
158 - | };
|
159 - | crate::protocol_serde::type_erase_result(parse_result)
|
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, HttpRequestWithLabelsAndTimestampFormat::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::http_request_with_labels_and_timestamp_format::HttpRequestWithLabelsAndTimestampFormatOutput::deserialize_with_response(
|
180 + | &mut *deser,
|
181 + | response.headers(),
|
182 + | response.status().into(),
|
183 + | body,
|
184 + | ).map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
|
185 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
186 + | }
|
160 187 | }
|
161 188 | }
|
162 189 | #[derive(Debug)]
|
163 190 | struct HttpRequestWithLabelsAndTimestampFormatRequestSerializer;
|
164 191 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for HttpRequestWithLabelsAndTimestampFormatRequestSerializer {
|
165 192 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
166 193 | fn serialize_input(
|
167 194 | &self,
|
168 195 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
169 196 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
170 197 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
171 198 | let input = input
|
172 199 | .downcast::<crate::operation::http_request_with_labels_and_timestamp_format::HttpRequestWithLabelsAndTimestampFormatInput>()
|
173 200 | .expect("correct type");
|
174 - | let _header_serialization_settings = _cfg
|
175 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
176 - | .cloned()
|
177 - | .unwrap_or_default();
|
178 - | let mut request_builder = {
|
179 - | #[allow(clippy::uninlined_format_args)]
|
180 - | fn uri_base(
|
181 - | _input: &crate::operation::http_request_with_labels_and_timestamp_format::HttpRequestWithLabelsAndTimestampFormatInput,
|
182 - | output: &mut ::std::string::String,
|
183 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
184 - | use ::std::fmt::Write as _;
|
185 - | let input_1 = &_input.member_epoch_seconds;
|
186 - | let input_1 = input_1.as_ref().ok_or_else(|| {
|
187 - | ::aws_smithy_types::error::operation::BuildError::missing_field("member_epoch_seconds", "cannot be empty or unset")
|
188 - | })?;
|
189 - | let member_epoch_seconds = ::aws_smithy_http::label::fmt_timestamp(input_1, ::aws_smithy_types::date_time::Format::EpochSeconds)?;
|
190 - | if member_epoch_seconds.is_empty() {
|
191 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
192 - | "member_epoch_seconds",
|
193 - | "cannot be empty or unset",
|
194 - | ));
|
195 - | }
|
196 - | let input_2 = &_input.member_http_date;
|
197 - | let input_2 = input_2
|
198 - | .as_ref()
|
199 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("member_http_date", "cannot be empty or unset"))?;
|
200 - | let member_http_date = ::aws_smithy_http::label::fmt_timestamp(input_2, ::aws_smithy_types::date_time::Format::HttpDate)?;
|
201 - | if member_http_date.is_empty() {
|
202 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
203 - | "member_http_date",
|
204 - | "cannot be empty or unset",
|
205 - | ));
|
206 - | }
|
207 - | let input_3 = &_input.member_date_time;
|
208 - | let input_3 = input_3
|
209 - | .as_ref()
|
210 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("member_date_time", "cannot be empty or unset"))?;
|
211 - | let member_date_time = ::aws_smithy_http::label::fmt_timestamp(input_3, ::aws_smithy_types::date_time::Format::DateTime)?;
|
212 - | if member_date_time.is_empty() {
|
213 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
214 - | "member_date_time",
|
215 - | "cannot be empty or unset",
|
216 - | ));
|
217 - | }
|
218 - | let input_4 = &_input.default_format;
|
219 - | let input_4 = input_4
|
220 - | .as_ref()
|
221 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("default_format", "cannot be empty or unset"))?;
|
222 - | let default_format = ::aws_smithy_http::label::fmt_timestamp(input_4, ::aws_smithy_types::date_time::Format::DateTime)?;
|
223 - | if default_format.is_empty() {
|
224 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
225 - | "default_format",
|
226 - | "cannot be empty or unset",
|
227 - | ));
|
228 - | }
|
229 - | let input_5 = &_input.target_epoch_seconds;
|
230 - | let input_5 = input_5.as_ref().ok_or_else(|| {
|
231 - | ::aws_smithy_types::error::operation::BuildError::missing_field("target_epoch_seconds", "cannot be empty or unset")
|
232 - | })?;
|
233 - | let target_epoch_seconds = ::aws_smithy_http::label::fmt_timestamp(input_5, ::aws_smithy_types::date_time::Format::EpochSeconds)?;
|
234 - | if target_epoch_seconds.is_empty() {
|
235 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
236 - | "target_epoch_seconds",
|
237 - | "cannot be empty or unset",
|
238 - | ));
|
239 - | }
|
240 - | let input_6 = &_input.target_http_date;
|
241 - | let input_6 = input_6
|
242 - | .as_ref()
|
243 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("target_http_date", "cannot be empty or unset"))?;
|
244 - | let target_http_date = ::aws_smithy_http::label::fmt_timestamp(input_6, ::aws_smithy_types::date_time::Format::HttpDate)?;
|
245 - | if target_http_date.is_empty() {
|
246 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
247 - | "target_http_date",
|
248 - | "cannot be empty or unset",
|
249 - | ));
|
250 - | }
|
251 - | let input_7 = &_input.target_date_time;
|
252 - | let input_7 = input_7
|
253 - | .as_ref()
|
254 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("target_date_time", "cannot be empty or unset"))?;
|
255 - | let target_date_time = ::aws_smithy_http::label::fmt_timestamp(input_7, ::aws_smithy_types::date_time::Format::DateTime)?;
|
256 - | if target_date_time.is_empty() {
|
257 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
258 - | "target_date_time",
|
259 - | "cannot be empty or unset",
|
260 - | ));
|
201 + | let protocol = _cfg
|
202 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
203 + | .expect("a SharedClientProtocol is required");
|
204 + | if protocol.supports_http_bindings() {
|
205 + | let mut request = protocol
|
206 + | .serialize_body(&input, HttpRequestWithLabelsAndTimestampFormat::INPUT_SCHEMA, "", _cfg)
|
207 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
208 + | {
|
209 + | let mut uri = "/HttpRequestWithLabelsAndTimestampFormat/{memberEpochSeconds}/{memberHttpDate}/{memberDateTime}/{defaultFormat}/{targetEpochSeconds}/{targetHttpDate}/{targetDateTime}".to_string();
|
210 + | let mut query_params: Vec<(String, String)> = Vec::new();
|
211 + | if let Some(ref val) = input.member_epoch_seconds {
|
212 + | uri = uri.replace(
|
213 + | "{memberEpochSeconds}",
|
214 + | &::aws_smithy_schema::http_protocol::percent_encode(
|
215 + | &val.fmt(::aws_smithy_types::date_time::Format::EpochSeconds).expect("valid timestamp"),
|
216 + | ),
|
217 + | );
|
218 + | }
|
219 + | if let Some(ref val) = input.member_http_date {
|
220 + | uri = uri.replace(
|
221 + | "{memberHttpDate}",
|
222 + | &::aws_smithy_schema::http_protocol::percent_encode(
|
223 + | &val.fmt(::aws_smithy_types::date_time::Format::HttpDate).expect("valid timestamp"),
|
224 + | ),
|
225 + | );
|
226 + | }
|
227 + | if let Some(ref val) = input.member_date_time {
|
228 + | uri = uri.replace(
|
229 + | "{memberDateTime}",
|
230 + | &::aws_smithy_schema::http_protocol::percent_encode(
|
231 + | &val.fmt(::aws_smithy_types::date_time::Format::DateTime).expect("valid timestamp"),
|
232 + | ),
|
233 + | );
|
234 + | }
|
235 + | if let Some(ref val) = input.default_format {
|
236 + | uri = uri.replace(
|
237 + | "{defaultFormat}",
|
238 + | &::aws_smithy_schema::http_protocol::percent_encode(
|
239 + | &val.fmt(::aws_smithy_types::date_time::Format::DateTime).expect("valid timestamp"),
|
240 + | ),
|
241 + | );
|
242 + | }
|
243 + | if let Some(ref val) = input.target_epoch_seconds {
|
244 + | uri = uri.replace(
|
245 + | "{targetEpochSeconds}",
|
246 + | &::aws_smithy_schema::http_protocol::percent_encode(
|
247 + | &val.fmt(::aws_smithy_types::date_time::Format::EpochSeconds).expect("valid timestamp"),
|
248 + | ),
|
249 + | );
|
250 + | }
|
251 + | if let Some(ref val) = input.target_http_date {
|
252 + | uri = uri.replace(
|
253 + | "{targetHttpDate}",
|
254 + | &::aws_smithy_schema::http_protocol::percent_encode(
|
255 + | &val.fmt(::aws_smithy_types::date_time::Format::HttpDate).expect("valid timestamp"),
|
256 + | ),
|
257 + | );
|
258 + | }
|
259 + | if let Some(ref val) = input.target_date_time {
|
260 + | uri = uri.replace(
|
261 + | "{targetDateTime}",
|
262 + | &::aws_smithy_schema::http_protocol::percent_encode(
|
263 + | &val.fmt(::aws_smithy_types::date_time::Format::DateTime).expect("valid timestamp"),
|
264 + | ),
|
265 + | );
|
266 + | }
|
267 + | if !query_params.is_empty() {
|
268 + | uri.push(if uri.contains('?') { '&' } else { '?' });
|
269 + | let pairs: Vec<String> = query_params
|
270 + | .iter()
|
271 + | .map(|(k, v)| {
|
272 + | format!(
|
273 + | "{}={}",
|
274 + | ::aws_smithy_schema::http_protocol::percent_encode(k),
|
275 + | ::aws_smithy_schema::http_protocol::percent_encode(v)
|
276 + | )
|
277 + | })
|
278 + | .collect();
|
279 + | uri.push_str(&pairs.join("&"));
|
261 280 | }
|
262 - | ::std::write!(output, "/HttpRequestWithLabelsAndTimestampFormat/{memberEpochSeconds}/{memberHttpDate}/{memberDateTime}/{defaultFormat}/{targetEpochSeconds}/{targetHttpDate}/{targetDateTime}", memberEpochSeconds = member_epoch_seconds, memberHttpDate = member_http_date, memberDateTime = member_date_time, defaultFormat = default_format, targetEpochSeconds = target_epoch_seconds, targetHttpDate = target_http_date, targetDateTime = target_date_time).expect("formatting should succeed");
|
263 - | ::std::result::Result::Ok(())
|
281 + | request.set_uri(uri.as_str()).expect("valid URI");
|
264 282 | }
|
265 - | #[allow(clippy::unnecessary_wraps)]
|
266 - | fn update_http_builder(
|
267 - | input: &crate::operation::http_request_with_labels_and_timestamp_format::HttpRequestWithLabelsAndTimestampFormatInput,
|
268 - | builder: ::http_1x::request::Builder,
|
269 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
270 - | let mut uri = ::std::string::String::new();
|
271 - | uri_base(input, &mut uri)?;
|
272 - | ::std::result::Result::Ok(builder.method("GET").uri(uri))
|
273 - | }
|
274 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
275 - | builder
|
276 - | };
|
277 - | let body = ::aws_smithy_types::body::SdkBody::from("");
|
278 283 |
|
279 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
284 + | return ::std::result::Result::Ok(request);
|
285 + | } else {
|
286 + | let mut request = protocol
|
287 + | .serialize_request(&input, HttpRequestWithLabelsAndTimestampFormat::INPUT_SCHEMA, "", _cfg)
|
288 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
289 + |
|
290 + | return ::std::result::Result::Ok(request);
|
291 + | }
|
280 292 | }
|
281 293 | }
|
282 294 | #[derive(Debug)]
|
283 295 | struct HttpRequestWithLabelsAndTimestampFormatEndpointParamsInterceptor;
|
284 296 |
|
285 297 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for HttpRequestWithLabelsAndTimestampFormatEndpointParamsInterceptor {
|
286 298 | fn name(&self) -> &'static str {
|
287 299 | "HttpRequestWithLabelsAndTimestampFormatEndpointParamsInterceptor"
|
288 300 | }
|
289 301 |
|