169 169 | }
|
170 170 | #[derive(Debug)]
|
171 171 | struct StreamingOperationWithOptionalDataRequestSerializer;
|
172 172 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for StreamingOperationWithOptionalDataRequestSerializer {
|
173 173 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
174 174 | fn serialize_input(
|
175 175 | &self,
|
176 176 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
177 177 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
178 178 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
179 179 | let input = input
|
180 180 | .downcast::<crate::operation::streaming_operation_with_optional_data::StreamingOperationWithOptionalDataInput>()
|
181 181 | .expect("correct type");
|
182 182 | let _header_serialization_settings = _cfg
|
183 183 | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
184 184 | .cloned()
|
185 185 | .unwrap_or_default();
|
186 186 | let mut request_builder = {
|
187 187 | #[allow(clippy::uninlined_format_args)]
|
188 188 | fn uri_base(
|
189 189 | _input: &crate::operation::streaming_operation_with_optional_data::StreamingOperationWithOptionalDataInput,
|
190 190 | output: &mut ::std::string::String,
|
191 191 | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
192 192 | use ::std::fmt::Write as _;
|
193 193 | ::std::write!(output, "/service/RpcV2CborService/operation/StreamingOperationWithOptionalData").expect("formatting should succeed");
|
194 194 | ::std::result::Result::Ok(())
|
195 195 | }
|
196 196 | #[allow(clippy::unnecessary_wraps)]
|
197 197 | fn update_http_builder(
|
198 198 | input: &crate::operation::streaming_operation_with_optional_data::StreamingOperationWithOptionalDataInput,
|
199 - | builder: ::http::request::Builder,
|
200 - | ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
199 + | builder: ::http_1x::request::Builder,
|
200 + | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
201 201 | let mut uri = ::std::string::String::new();
|
202 202 | uri_base(input, &mut uri)?;
|
203 203 | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
204 204 | }
|
205 - | let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
|
206 - | builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/vnd.amazon.eventstream");
|
205 + | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
207 206 | builder =
|
208 - | _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("smithy-protocol"), "rpc-v2-cbor");
|
207 + | _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/vnd.amazon.eventstream");
|
209 208 | builder = _header_serialization_settings.set_default_header(
|
210 209 | builder,
|
211 - | ::http::header::HeaderName::from_static("accept"),
|
210 + | ::http_1x::header::HeaderName::from_static("smithy-protocol"),
|
211 + | "rpc-v2-cbor",
|
212 + | );
|
213 + | builder = _header_serialization_settings.set_default_header(
|
214 + | builder,
|
215 + | ::http_1x::header::HeaderName::from_static("accept"),
|
212 216 | "application/vnd.amazon.eventstream, application/cbor",
|
213 217 | );
|
214 218 | builder
|
215 219 | };
|
216 220 | let body = ::aws_smithy_types::body::SdkBody::from({
|
217 221 | let error_marshaller = crate::event_stream_serde::EventsErrorMarshaller::new();
|
218 222 | let marshaller = crate::event_stream_serde::EventsMarshaller::new();
|
219 223 | let (signer, signer_sender) = ::aws_smithy_eventstream::frame::DeferredSigner::new();
|
220 224 | _cfg.interceptor_state().store_put(signer_sender);
|
221 225 | ::aws_smithy_types::body::SdkBody::from_body_0_4(::hyper::Body::wrap_stream({
|
222 226 | use ::futures_util::StreamExt;
|
223 227 | let body =
|
224 228 | crate::protocol_serde::shape_streaming_operation_with_optional_data::ser_streaming_operation_with_optional_data_input(&input)?;
|
225 229 | let initial_message = crate::event_stream_serde::initial_message_from_body(body);
|
226 230 | let mut buffer = ::std::vec::Vec::new();
|
227 231 | ::aws_smithy_eventstream::frame::write_message_to(&initial_message, &mut buffer)?;
|
228 232 | let initial_message_stream = futures_util::stream::iter(vec![Ok(buffer.into())]);
|
229 233 | let adapter = input.events.into_body_stream(marshaller, error_marshaller, signer);
|
230 234 | initial_message_stream.chain(adapter)
|
231 235 | }))
|
232 236 | });
|
233 237 | if let Some(content_length) = body.content_length() {
|
234 238 | let content_length = content_length.to_string();
|
235 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
|
239 + | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
236 240 | }
|
237 241 | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
238 242 | }
|
239 243 | }
|
240 244 | #[derive(Debug)]
|
241 245 | struct StreamingOperationWithOptionalDataEndpointParamsInterceptor;
|
242 246 |
|
243 247 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for StreamingOperationWithOptionalDataEndpointParamsInterceptor {
|
244 248 | fn name(&self) -> &'static str {
|
245 249 | "StreamingOperationWithOptionalDataEndpointParamsInterceptor"
|
246 250 | }
|
247 251 |
|
248 252 | fn read_before_execution(
|
249 253 | &self,
|
250 254 | context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
|
251 255 | '_,
|
252 256 | ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
253 257 | ::aws_smithy_runtime_api::client::interceptors::context::Output,
|
254 258 | ::aws_smithy_runtime_api::client::interceptors::context::Error,
|
255 259 | >,
|
256 260 | cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
257 261 | ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
|
258 262 | let _input = context
|
259 263 | .input()
|
260 264 | .downcast_ref::<StreamingOperationWithOptionalDataInput>()
|
261 265 | .ok_or("failed to downcast to StreamingOperationWithOptionalDataInput")?;
|
262 266 |
|
263 267 | let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
|
264 268 | ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
|
265 269 | })?;
|