67 67 | ) -> &crate::operation::streaming_operation_with_initial_response::builders::StreamingOperationWithInitialResponseInputBuilder {
|
68 68 | &self.inner
|
69 69 | }
|
70 70 | /// Sends the request and returns the response.
|
71 71 | ///
|
72 72 | /// If an error occurs, an `SdkError` will be returned with additional details that
|
73 73 | /// can be matched against.
|
74 74 | ///
|
75 75 | /// By default, any retryable failures will be retried twice. Retry behavior
|
76 76 | /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
|
77 77 | /// set when configuring the client.
|
78 78 | pub async fn send(
|
79 79 | self,
|
80 80 | ) -> ::std::result::Result<
|
81 81 | crate::operation::streaming_operation_with_initial_response::StreamingOperationWithInitialResponseOutput,
|
82 82 | ::aws_smithy_runtime_api::client::result::SdkError<
|
83 83 | crate::operation::streaming_operation_with_initial_response::StreamingOperationWithInitialResponseError,
|
84 84 | ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
85 85 | >,
|
86 86 | > {
|
87 87 | let input = self
|
88 88 | .inner
|
89 89 | .build()
|
90 90 | .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
|
91 91 | let runtime_plugins =
|
92 92 | crate::operation::streaming_operation_with_initial_response::StreamingOperationWithInitialResponse::operation_runtime_plugins(
|
93 93 | self.handle.runtime_plugins.clone(),
|
94 94 | &self.handle.conf,
|
95 95 | self.config_override,
|
96 96 | );
|
97 - | let mut output =
|
97 + | let output =
|
98 98 | crate::operation::streaming_operation_with_initial_response::StreamingOperationWithInitialResponse::orchestrate(&runtime_plugins, input)
|
99 99 | .await?;
|
100 100 |
|
101 101 | // Converts any error encountered beyond this point into an `SdkError` response error
|
102 102 | // with an `HttpResponse`. However, since we have already exited the `orchestrate`
|
103 103 | // function, the original `HttpResponse` is no longer available and cannot be restored.
|
104 104 | // This means that header information from the original response has been lost.
|
105 105 | //
|
106 106 | // Note that the response body would have been consumed by the deserializer
|
107 107 | // regardless, even if the initial message was hypothetically processed during
|
108 108 | // the orchestrator's deserialization phase but later resulted in an error.
|
109 109 | fn response_error(
|
110 110 | err: impl ::std::convert::Into<::aws_smithy_runtime_api::box_error::BoxError>,
|
111 111 | ) -> ::aws_smithy_runtime_api::client::result::SdkError<
|
112 112 | crate::operation::streaming_operation_with_initial_response::StreamingOperationWithInitialResponseError,
|
113 113 | ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
114 114 | > {
|
115 115 | ::aws_smithy_runtime_api::client::result::SdkError::response_error(
|
116 116 | err,
|
117 117 | ::aws_smithy_runtime_api::client::orchestrator::HttpResponse::new(
|
118 118 | ::aws_smithy_runtime_api::http::StatusCode::try_from(200).expect("valid successful code"),
|
119 119 | ::aws_smithy_types::body::SdkBody::empty(),
|
120 120 | ),
|
121 121 | )
|
122 122 | }
|
123 + | let mut output = output;
|
123 124 |
|
124 125 | let message = output.events.try_recv_initial_response().await.map_err(response_error)?;
|
125 126 |
|
126 - | match message {
|
127 - | ::std::option::Option::Some(_message) => {
|
128 - | let mut builder = output.into_builder();
|
129 - | builder = crate::protocol_serde::shape_streaming_operation_with_initial_response::de_streaming_operation_with_initial_response(
|
130 - | _message.payload(),
|
131 - | builder,
|
132 - | )
|
133 - | .map_err(response_error)?;
|
134 - | let output = builder.build().map_err(response_error)?;
|
135 - | ::std::result::Result::Ok(output)
|
136 - | }
|
137 - | ::std::option::Option::None => ::std::result::Result::Ok(output),
|
127 + | if let ::std::option::Option::Some(_message) = message {
|
128 + | let mut builder = output.into_builder();
|
129 + | builder = crate::protocol_serde::shape_streaming_operation_with_initial_response::de_streaming_operation_with_initial_response(
|
130 + | _message.payload(),
|
131 + | builder,
|
132 + | )
|
133 + | .map_err(response_error)?;
|
134 + | output = builder.build().map_err(response_error)?;
|
138 135 | }
|
136 + | ::std::result::Result::Ok(output)
|
139 137 | }
|
140 138 |
|
141 139 | /// Consumes this builder, creating a customizable operation that can be modified before being sent.
|
142 140 | pub fn customize(
|
143 141 | self,
|
144 142 | ) -> crate::client::customize::CustomizableOperation<
|
145 143 | crate::operation::streaming_operation_with_initial_response::StreamingOperationWithInitialResponseOutput,
|
146 144 | crate::operation::streaming_operation_with_initial_response::StreamingOperationWithInitialResponseError,
|
147 145 | Self,
|
148 146 | > {
|
149 147 | crate::client::customize::CustomizableOperation::new(self)
|
150 148 | }
|
151 149 | pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
|
152 150 | self.set_config_override(::std::option::Option::Some(config_override.into()));
|
153 151 | self
|
154 152 | }
|
155 153 |
|
156 154 | pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
|
157 155 | self.config_override = config_override;
|
158 156 | self
|
159 157 | }
|
160 158 | #[allow(missing_docs)] // documentation missing in model
|
161 159 | pub fn events(
|
162 160 | mut self,
|
163 161 | input: ::aws_smithy_http::event_stream::EventStreamSender<crate::types::Events, crate::types::error::EventsError>,
|
164 162 | ) -> Self {
|
165 163 | self.inner = self.inner.events(input);
|
166 164 | self
|
167 165 | }
|
168 166 | #[allow(missing_docs)] // documentation missing in model
|