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