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