74 83 | runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
|
75 84 | }
|
76 85 | runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
|
77 86 | config_override,
|
78 87 | client_config.config.clone(),
|
79 88 | &client_config.runtime_components,
|
80 89 | ));
|
81 90 | }
|
82 91 | runtime_plugins
|
83 92 | }
|
93 + | /* OperationGenerator.kt:85 */
|
84 94 | }
|
95 + | /* OperationRuntimePluginGenerator.kt:55 */
|
85 96 | impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for Operation {
|
86 97 | fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
|
87 98 | let mut cfg = ::aws_smithy_types::config_bag::Layer::new("Operation");
|
88 99 |
|
89 100 | cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
|
90 101 | OperationRequestSerializer,
|
91 102 | ));
|
92 103 | cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
|
93 104 | OperationResponseDeserializer,
|
94 105 | ));
|
95 106 |
|
96 107 | cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
|
97 108 | ::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new(),
|
98 109 | ));
|
99 110 |
|
100 111 | cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
|
101 112 | "Operation",
|
102 113 | "QueryCompatService",
|
103 114 | ));
|
104 115 |
|
105 116 | ::std::option::Option::Some(cfg.freeze())
|
106 117 | }
|
107 118 |
|
108 119 | fn runtime_components(
|
109 120 | &self,
|
110 121 | _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
|
111 122 | ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
|
112 123 | #[allow(unused_mut)]
|
113 124 | let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("Operation")
|
114 125 | .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
|
115 126 | .with_interceptor(OperationEndpointParamsInterceptor)
|
116 127 | .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
|
117 128 | crate::operation::operation::OperationError,
|
118 129 | >::new())
|
119 130 | .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
|
120 131 | crate::operation::operation::OperationError,
|
121 132 | >::new());
|
122 133 |
|
123 134 | ::std::borrow::Cow::Owned(rcb)
|
124 135 | }
|
125 136 | }
|
126 137 |
|
138 + | /* ResponseDeserializerGenerator.kt:64 */
|
127 139 | #[derive(Debug)]
|
128 140 | struct OperationResponseDeserializer;
|
129 141 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for OperationResponseDeserializer {
|
130 142 | fn deserialize_nonstreaming(
|
131 143 | &self,
|
132 144 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
133 145 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
134 146 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
135 147 | let headers = response.headers();
|
136 148 | let body = response.body().bytes().expect("body loaded");
|
137 149 | #[allow(unused_mut)]
|
138 150 | let mut force_error = false;
|
139 151 |
|
140 152 | let parse_result = if !success && status != 200 || force_error {
|
141 153 | crate::protocol_serde::shape_operation::de_operation_http_error(status, headers, body)
|
142 154 | } else {
|
143 155 | crate::protocol_serde::shape_operation::de_operation_http_response(status, headers, body)
|
144 156 | };
|
145 157 | crate::protocol_serde::type_erase_result(parse_result)
|
146 158 | }
|
147 159 | }
|
160 + | /* RequestSerializerGenerator.kt:67 */
|
148 161 | #[derive(Debug)]
|
149 162 | struct OperationRequestSerializer;
|
150 163 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for OperationRequestSerializer {
|
151 164 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
152 165 | fn serialize_input(
|
153 166 | &self,
|
154 167 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
155 168 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
156 169 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
157 170 | let input = input.downcast::<crate::operation::operation::OperationInput>().expect("correct type");
|
158 171 | let _header_serialization_settings = _cfg
|
159 172 | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
160 173 | .cloned()
|
161 174 | .unwrap_or_default();
|
162 175 | let mut request_builder = {
|
163 176 | fn uri_base(
|
164 177 | _input: &crate::operation::operation::OperationInput,
|
165 178 | output: &mut ::std::string::String,
|
166 179 | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
167 180 | use ::std::fmt::Write as _;
|
168 181 | ::std::write!(output, "/").expect("formatting should succeed");
|
169 182 | ::std::result::Result::Ok(())
|
170 183 | }
|
171 184 | #[allow(clippy::unnecessary_wraps)]
|
172 185 | fn update_http_builder(
|
173 186 | input: &crate::operation::operation::OperationInput,
|
174 187 | builder: ::http::request::Builder,
|
175 188 | ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
176 189 | let mut uri = ::std::string::String::new();
|
177 190 | uri_base(input, &mut uri)?;
|
178 191 | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
179 192 | }
|
180 193 | let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
|
181 194 | builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/x-amz-json-1.0");
|
182 195 | builder = _header_serialization_settings.set_default_header(
|
183 196 | builder,
|
184 197 | ::http::header::HeaderName::from_static("x-amz-target"),
|
185 198 | "QueryCompatService.Operation",
|
186 199 | );
|
187 200 | builder =
|
188 201 | _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("x-amzn-query-mode"), "true");
|
189 202 | builder
|
190 203 | };
|
191 204 | let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_operation::ser_operation_input(&input)?);
|
192 205 | if let Some(content_length) = body.content_length() {
|
193 206 | let content_length = content_length.to_string();
|
194 207 | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
|
195 208 | }
|
196 209 | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
197 210 | }
|
198 211 | }
|
212 + | /* EndpointParamsInterceptorGenerator.kt:86 */
|
199 213 | #[derive(Debug)]
|
200 214 | struct OperationEndpointParamsInterceptor;
|
201 215 |
|
202 216 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for OperationEndpointParamsInterceptor {
|
203 217 | fn name(&self) -> &'static str {
|
204 218 | "OperationEndpointParamsInterceptor"
|
205 219 | }
|
206 220 |
|
207 221 | fn read_before_execution(
|
208 222 | &self,
|
209 223 | context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
|
210 224 | '_,
|
211 225 | ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
212 226 | ::aws_smithy_runtime_api::client::interceptors::context::Output,
|
213 227 | ::aws_smithy_runtime_api::client::interceptors::context::Error,
|
214 228 | >,
|
215 229 | cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
216 230 | ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
|
217 231 | let _input = context
|
218 232 | .input()
|
219 233 | .downcast_ref::<OperationInput>()
|
220 234 | .ok_or("failed to downcast to OperationInput")?;
|
221 235 |
|
222 236 | let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
|
223 237 | ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
|
224 238 | })?;
|
225 239 | cfg.interceptor_state()
|
226 240 | .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
|
227 241 | ::std::result::Result::Ok(())
|
228 242 | }
|
229 243 | }
|
230 244 |
|
231 245 | // The get_* functions below are generated from JMESPath expressions in the
|
232 246 | // operationContextParams trait. They target the operation's input shape.
|
233 247 |
|
248 + | /* RustType.kt:516 */
|
234 249 | #[allow(unreachable_code, unused_variables)]
|
250 + | /* RustType.kt:516 */
|
235 251 | #[cfg(test)]
|
252 + | /* ProtocolTestGenerator.kt:98 */
|
236 253 | mod operation_test {
|
237 254 |
|
238 255 | /// Test ID: BasicQueryCompatTest
|
239 256 | #[::tokio::test]
|
240 257 | #[::tracing_test::traced_test]
|
241 258 | async fn basic_query_compat_test_request() {
|
242 259 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
243 260 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
244 261 |
|
245 262 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
246 263 | let result = client
|
247 264 | .operation()
|
248 265 | .set_message(::std::option::Option::Some("hello!".to_owned()))
|
249 266 | .send()
|
250 267 | .await;
|
251 268 | let _ = dbg!(result);
|
252 269 | let http_request = request_receiver.expect_request();
|
253 270 | let expected_headers = [("x-amz-target", "QueryCompatService.Operation"), ("x-amzn-query-mode", "true")];
|
254 271 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
255 272 | let body = http_request.body().bytes().expect("body should be strict");
|
256 273 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
257 274 | body,
|
258 275 | "{\"message\":\"hello!\"}",
|
259 276 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
260 277 | ));
|
261 278 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
262 279 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
263 280 | ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
|
264 281 | }
|
282 + |
|
283 + | /* ProtocolTestGenerator.kt:98 */
|
265 284 | }
|
266 285 |
|
286 + | /* OperationErrorGenerator.kt:79 */
|
267 287 | /// Error type for the `OperationError` operation.
|
288 + | /* RustType.kt:516 */
|
268 289 | #[non_exhaustive]
|
290 + | /* RustType.kt:516 */
|
269 291 | #[derive(::std::fmt::Debug)]
|
270 - | pub enum OperationError {
|
292 + | pub /* OperationErrorGenerator.kt:81 */ enum OperationError {
|
293 + | /* OperationErrorGenerator.kt:88 */
|
271 294 | /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
|
272 295 | #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
|
273 296 | variable wildcard pattern and check `.code()`:
|
274 297 | \
|
275 298 | `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
|
276 299 | \
|
277 300 | See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-OperationError) for what information is available for the error.")]
|
278 301 | Unhandled(crate::error::sealed_unhandled::Unhandled),
|
302 + | /* OperationErrorGenerator.kt:81 */
|
279 303 | }
|
304 + | /* OperationErrorGenerator.kt:218 */
|
280 305 | impl OperationError {
|
306 + | /* OperationErrorGenerator.kt:219 */
|
281 307 | /// Creates the `OperationError::Unhandled` variant from any error type.
|
282 308 | pub fn unhandled(
|
283 309 | err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
|
284 310 | ) -> Self {
|
285 311 | Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
|
286 312 | source: err.into(),
|
287 313 | meta: ::std::default::Default::default(),
|
288 314 | })
|
289 315 | }
|
290 316 |
|
291 317 | /// Creates the `OperationError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
|
292 318 | pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
|
293 319 | Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
|
294 320 | source: err.clone().into(),
|
295 321 | meta: err,
|
296 322 | })
|
297 323 | }
|
298 - | ///
|
324 + | /// /* OperationErrorGenerator.kt:236 */
|
299 325 | /// Returns error metadata, which includes the error code, message,
|
300 326 | /// request ID, and potentially additional information.
|
301 327 | ///
|
328 + | /* OperationErrorGenerator.kt:242 */
|
302 329 | pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
|
330 + | /* OperationErrorGenerator.kt:243 */
|
303 331 | match self {
|
304 - | Self::Unhandled(e) => &e.meta,
|
332 + | /* OperationErrorGenerator.kt:251 */ Self::Unhandled(e) => &e.meta,
|
333 + | /* OperationErrorGenerator.kt:243 */
|
305 334 | }
|
335 + | /* OperationErrorGenerator.kt:242 */
|
306 336 | }
|
337 + | /* OperationErrorGenerator.kt:218 */
|
307 338 | }
|
339 + | /* OperationErrorGenerator.kt:269 */
|
308 340 | impl ::std::error::Error for OperationError {
|
341 + | /* OperationErrorGenerator.kt:270 */
|
309 342 | fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
|
343 + | /* OperationErrorGenerator.kt:318 */
|
310 344 | match self {
|
311 - | Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
|
345 + | /* OperationErrorGenerator.kt:326 */
|
346 + | Self::Unhandled(_inner) => {
|
347 + | /* OperationErrorGenerator.kt:279 */
|
348 + | ::std::option::Option::Some(&*_inner.source)
|
349 + | /* OperationErrorGenerator.kt:326 */
|
350 + | } /* OperationErrorGenerator.kt:318 */
|
312 351 | }
|
352 + | /* OperationErrorGenerator.kt:270 */
|
313 353 | }
|
354 + | /* OperationErrorGenerator.kt:269 */
|
314 355 | }
|
356 + | /* OperationErrorGenerator.kt:133 */
|
315 357 | impl ::std::fmt::Display for OperationError {
|
358 + | /* OperationErrorGenerator.kt:134 */
|
316 359 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
360 + | /* OperationErrorGenerator.kt:318 */
|
317 361 | match self {
|
362 + | /* OperationErrorGenerator.kt:326 */
|
318 363 | Self::Unhandled(_inner) => {
|
364 + | /* OperationErrorGenerator.kt:139 */
|
319 365 | if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
|
320 366 | write!(f, "unhandled error ({code})")
|
321 367 | } else {
|
322 368 | f.write_str("unhandled error")
|
323 369 | }
|
324 - | }
|
370 + | /* OperationErrorGenerator.kt:326 */
|
371 + | } /* OperationErrorGenerator.kt:318 */
|
325 372 | }
|
373 + | /* OperationErrorGenerator.kt:134 */
|
326 374 | }
|
375 + | /* OperationErrorGenerator.kt:133 */
|
327 376 | }
|
377 + | /* OperationErrorGenerator.kt:182 */
|
328 378 | impl ::aws_smithy_types::retry::ProvideErrorKind for OperationError {
|
379 + | /* OperationErrorGenerator.kt:186 */
|
329 380 | fn code(&self) -> ::std::option::Option<&str> {
|
381 + | /* OperationErrorGenerator.kt:187 */
|
330 382 | ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
|
383 + | /* OperationErrorGenerator.kt:186 */
|
331 384 | }
|
385 + | /* OperationErrorGenerator.kt:190 */
|
332 386 | fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
|
387 + | /* OperationErrorGenerator.kt:197 */
|
333 388 | ::std::option::Option::None
|
389 + | /* OperationErrorGenerator.kt:190 */
|
334 390 | }
|
391 + | /* OperationErrorGenerator.kt:182 */
|
335 392 | }
|
393 + | /* OperationErrorGenerator.kt:163 */
|
336 394 | impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for OperationError {
|
395 + | /* OperationErrorGenerator.kt:164 */
|
337 396 | fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
|
397 + | /* OperationErrorGenerator.kt:318 */
|
338 398 | match self {
|
339 - | Self::Unhandled(_inner) => &_inner.meta,
|
399 + | /* OperationErrorGenerator.kt:326 */
|
400 + | Self::Unhandled(_inner) => {
|
401 + | /* OperationErrorGenerator.kt:168 */
|
402 + | &_inner.meta
|
403 + | /* OperationErrorGenerator.kt:326 */
|
404 + | } /* OperationErrorGenerator.kt:318 */
|
340 405 | }
|
406 + | /* OperationErrorGenerator.kt:164 */
|
341 407 | }
|
408 + | /* OperationErrorGenerator.kt:163 */
|
342 409 | }
|
410 + | /* OperationErrorGenerator.kt:109 */
|
343 411 | impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for OperationError {
|
412 + | /* OperationErrorGenerator.kt:110 */
|
344 413 | fn create_unhandled_error(
|
345 414 | source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
|
346 415 | meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
|
347 416 | ) -> Self {
|
417 + | /* OperationErrorGenerator.kt:121 */
|
348 418 | Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
|
349 419 | source,
|
350 420 | meta: meta.unwrap_or_default(),
|
351 421 | })
|
422 + | /* OperationErrorGenerator.kt:110 */
|
352 423 | }
|
424 + | /* OperationErrorGenerator.kt:109 */
|
353 425 | }
|
354 426 |
|
427 + | /* CodegenDelegator.kt:255 */
|
355 428 | pub use crate::operation::operation::_operation_output::OperationOutput;
|
356 429 |
|
430 + | /* CodegenDelegator.kt:255 */
|
357 431 | pub use crate::operation::operation::_operation_input::OperationInput;
|
358 432 |
|
433 + | /* RustModule.kt:172 */
|
359 434 | mod _operation_input;
|
360 435 |
|
436 + | /* RustModule.kt:172 */
|
361 437 | mod _operation_output;
|
362 438 |
|
363 - | /// Builders
|
439 + | /// /* CodegenDelegator.kt:51 */Builders
|
364 440 | pub mod builders;
|