148 148 | let input = input.downcast::<crate::operation::operation::OperationInput>().expect("correct type");
|
149 149 | let _header_serialization_settings = _cfg
|
150 150 | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
151 151 | .cloned()
|
152 152 | .unwrap_or_default();
|
153 153 | let mut request_builder = {
|
154 154 | fn uri_base(
|
155 155 | _input: &crate::operation::operation::OperationInput,
|
156 156 | output: &mut ::std::string::String,
|
157 157 | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
158 158 | use ::std::fmt::Write as _;
|
159 159 | ::std::write!(output, "/").expect("formatting should succeed");
|
160 160 | ::std::result::Result::Ok(())
|
161 161 | }
|
162 162 | #[allow(clippy::unnecessary_wraps)]
|
163 163 | fn update_http_builder(
|
164 164 | input: &crate::operation::operation::OperationInput,
|
165 165 | builder: ::http::request::Builder,
|
166 166 | ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
167 167 | let mut uri = ::std::string::String::new();
|
168 168 | uri_base(input, &mut uri)?;
|
169 169 | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
170 170 | }
|
171 171 | let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
|
172 172 | builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/x-amz-json-1.0");
|
173 173 | builder = _header_serialization_settings.set_default_header(
|
174 174 | builder,
|
175 175 | ::http::header::HeaderName::from_static("x-amz-target"),
|
176 176 | "QueryCompatService.Operation",
|
177 177 | );
|
178 + | builder =
|
179 + | _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("x-amzn-query-mode"), "true");
|
178 180 | builder
|
179 181 | };
|
180 182 | let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_operation::ser_operation_input(&input)?);
|
181 183 | if let Some(content_length) = body.content_length() {
|
182 184 | let content_length = content_length.to_string();
|
183 185 | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
|
184 186 | }
|
185 187 | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
186 188 | }
|
187 189 | }
|
188 190 | #[derive(Debug)]
|
189 191 | struct OperationEndpointParamsInterceptor;
|
190 192 |
|
191 193 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for OperationEndpointParamsInterceptor {
|
192 194 | fn name(&self) -> &'static str {
|
193 195 | "OperationEndpointParamsInterceptor"
|
194 196 | }
|
195 197 |
|
196 198 | fn read_before_execution(
|
197 199 | &self,
|
198 200 | context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
|
199 201 | '_,
|
200 202 | ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
201 203 | ::aws_smithy_runtime_api::client::interceptors::context::Output,
|
202 204 | ::aws_smithy_runtime_api::client::interceptors::context::Error,
|
203 205 | >,
|
204 206 | cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
205 207 | ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
|
206 208 | let _input = context
|
207 209 | .input()
|
212 214 | ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
|
213 215 | })?;
|
214 216 | cfg.interceptor_state()
|
215 217 | .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
|
216 218 | ::std::result::Result::Ok(())
|
217 219 | }
|
218 220 | }
|
219 221 |
|
220 222 | // The get_* functions below are generated from JMESPath expressions in the
|
221 223 | // operationContextParams trait. They target the operation's input shape.
|
222 224 |
|
223 225 | #[allow(unreachable_code, unused_variables)]
|
224 226 | #[cfg(test)]
|
225 227 | mod operation_test {
|
226 228 |
|
227 229 | /// Test ID: BasicQueryCompatTest
|
228 230 | #[::tokio::test]
|
229 231 | #[::tracing_test::traced_test]
|
230 232 | async fn basic_query_compat_test_request() {
|
231 233 | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
232 234 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
233 235 |
|
234 236 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
235 237 | let result = client
|
236 238 | .operation()
|
237 239 | .set_message(::std::option::Option::Some("hello!".to_owned()))
|
238 240 | .send()
|
239 241 | .await;
|
240 242 | let _ = dbg!(result);
|
241 243 | let http_request = request_receiver.expect_request();
|
242 - | let expected_headers = [("x-amz-target", "QueryCompatService.Operation")];
|
244 + | let expected_headers = [("x-amz-target", "QueryCompatService.Operation"), ("x-amzn-query-mode", "true")];
|
243 245 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
244 246 | let body = http_request.body().bytes().expect("body should be strict");
|
245 247 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
246 248 | body,
|
247 249 | "{\"message\":\"hello!\"}",
|
248 250 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
249 251 | ));
|
250 252 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
251 253 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
252 254 | ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
|
253 255 | }
|
254 256 | }
|
255 257 |
|
256 258 | /// Error type for the `OperationError` operation.
|
257 259 | #[non_exhaustive]
|
258 260 | #[derive(::std::fmt::Debug)]
|
259 261 | pub enum OperationError {
|
260 262 | /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
|
261 263 | #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
|
262 264 | variable wildcard pattern and check `.code()`:
|
263 265 | \
|
264 266 | `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
|
265 267 | \
|
266 268 | See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-OperationError) for what information is available for the error.")]
|
267 269 | Unhandled(crate::error::sealed_unhandled::Unhandled),
|
268 270 | }
|
269 271 | impl OperationError {
|
270 272 | /// Creates the `OperationError::Unhandled` variant from any error type.
|
271 273 | pub fn unhandled(
|
272 274 | err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
|