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 TestPayloadBlob {
|
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("TestPayloadBlob");
|
97 108 |
|
98 109 | cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
|
99 110 | TestPayloadBlobRequestSerializer,
|
100 111 | ));
|
101 112 | cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
|
102 113 | TestPayloadBlobResponseDeserializer,
|
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 | "TestPayloadBlob",
|
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("TestPayloadBlob")
|
123 134 | .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
|
124 135 | .with_interceptor(TestPayloadBlobEndpointParamsInterceptor)
|
125 136 | .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
|
126 137 | crate::operation::test_payload_blob::TestPayloadBlobError,
|
127 138 | >::new())
|
128 139 | .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
|
129 140 | crate::operation::test_payload_blob::TestPayloadBlobError,
|
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 TestPayloadBlobResponseDeserializer;
|
138 150 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for TestPayloadBlobResponseDeserializer {
|
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_payload_blob::de_test_payload_blob_http_error(status, headers, body)
|
151 163 | } else {
|
152 164 | crate::protocol_serde::shape_test_payload_blob::de_test_payload_blob_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 TestPayloadBlobRequestSerializer;
|
159 172 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for TestPayloadBlobRequestSerializer {
|
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_payload_blob::TestPayloadBlobInput>()
|
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_payload_blob::TestPayloadBlobInput,
|
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, "/blob_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_payload_blob::TestPayloadBlobInput,
|
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_payload_blob::ser_test_payload_blob_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 = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/octet-stream");
|
194 207 | builder
|
195 208 | };
|
196 209 | let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_test_payload_blob_input::ser_data_http_payload(input.data)?);
|
197 210 | if let Some(content_length) = body.content_length() {
|
198 211 | let content_length = content_length.to_string();
|
199 212 | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
|
200 213 | }
|
201 214 | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
202 215 | }
|
203 216 | }
|
217 + | /* EndpointParamsInterceptorGenerator.kt:86 */
|
204 218 | #[derive(Debug)]
|
205 219 | struct TestPayloadBlobEndpointParamsInterceptor;
|
206 220 |
|
207 221 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for TestPayloadBlobEndpointParamsInterceptor {
|
208 222 | fn name(&self) -> &'static str {
|
209 223 | "TestPayloadBlobEndpointParamsInterceptor"
|
210 224 | }
|
211 225 |
|
212 226 | fn read_before_execution(
|
213 227 | &self,
|
214 228 | context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
|
215 229 | '_,
|
216 230 | ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
217 231 | ::aws_smithy_runtime_api::client::interceptors::context::Output,
|
218 232 | ::aws_smithy_runtime_api::client::interceptors::context::Error,
|
219 233 | >,
|
220 234 | cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
221 235 | ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
|
222 236 | let _input = context
|
223 237 | .input()
|
224 238 | .downcast_ref::<TestPayloadBlobInput>()
|
225 239 | .ok_or("failed to downcast to TestPayloadBlobInput")?;
|
226 240 |
|
227 241 | let params = crate::config::endpoint::Params::builder().build().map_err(|err| {
|
228 242 | ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
|
229 243 | })?;
|
230 244 | cfg.interceptor_state()
|
231 245 | .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
|
232 246 | ::std::result::Result::Ok(())
|
233 247 | }
|
234 248 | }
|
235 249 |
|
236 250 | // The get_* functions below are generated from JMESPath expressions in the
|
237 251 | // operationContextParams trait. They target the operation's input shape.
|
238 252 |
|
253 + | /* RustType.kt:516 */
|
239 254 | #[allow(unreachable_code, unused_variables)]
|
255 + | /* RustType.kt:516 */
|
240 256 | #[cfg(test)]
|
257 + | /* ProtocolTestGenerator.kt:98 */
|
241 258 | mod test_payload_blob_test {
|
242 259 |
|
243 260 | /// Serializes a payload targeting an empty blob
|
244 261 | /// Test ID: RestJsonHttpWithEmptyBlobPayload
|
245 262 | #[::tokio::test]
|
246 263 | #[::tracing_test::traced_test]
|
247 264 | async fn rest_json_http_with_empty_blob_payload_request() {
|
248 265 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
249 266 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
250 267 |
|
251 268 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
252 269 | let result = client.test_payload_blob().send().await;
|
253 270 | let _ = dbg!(result);
|
254 271 | let http_request = request_receiver.expect_request();
|
255 272 | let body = http_request.body().bytes().expect("body should be strict");
|
256 273 | // No body.
|
257 274 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
258 275 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
259 276 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
260 277 | ::pretty_assertions::assert_eq!(uri.path(), "/blob_payload", "path was incorrect");
|
261 278 | }
|
262 279 |
|
263 280 | /// Serializes a payload targeting a blob
|
264 281 | /// Test ID: RestJsonTestPayloadBlob
|
265 282 | #[::tokio::test]
|
266 283 | #[::tracing_test::traced_test]
|
267 284 | async fn rest_json_test_payload_blob_request() {
|
268 285 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
269 286 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
270 287 |
|
271 288 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
272 289 | let result = client
|
273 290 | .test_payload_blob()
|
274 291 | .set_content_type(::std::option::Option::Some("image/jpg".to_owned()))
|
275 292 | .set_data(::std::option::Option::Some(::aws_smithy_types::Blob::new("1234")))
|
276 293 | .send()
|
277 294 | .await;
|
278 295 | let _ = dbg!(result);
|
279 296 | let http_request = request_receiver.expect_request();
|
280 297 | let expected_headers = [("Content-Type", "image/jpg")];
|
281 298 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
282 299 | let required_headers = &["Content-Length"];
|
283 300 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
|
284 301 | let body = http_request.body().bytes().expect("body should be strict");
|
285 302 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
286 303 | body,
|
287 304 | "1234",
|
288 305 | ::aws_smithy_protocol_test::MediaType::from("image/jpg"),
|
289 306 | ));
|
290 307 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
291 308 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
292 309 | ::pretty_assertions::assert_eq!(uri.path(), "/blob_payload", "path was incorrect");
|
293 310 | }
|
311 + |
|
312 + | /* ProtocolTestGenerator.kt:98 */
|
294 313 | }
|
295 314 |
|
315 + | /* OperationErrorGenerator.kt:79 */
|
296 316 | /// Error type for the `TestPayloadBlobError` operation.
|
317 + | /* RustType.kt:516 */
|
297 318 | #[non_exhaustive]
|
319 + | /* RustType.kt:516 */
|
298 320 | #[derive(::std::fmt::Debug)]
|
299 - | pub enum TestPayloadBlobError {
|
321 + | pub /* OperationErrorGenerator.kt:81 */ enum TestPayloadBlobError {
|
322 + | /* OperationErrorGenerator.kt:88 */
|
300 323 | /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
|
301 324 | #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
|
302 325 | variable wildcard pattern and check `.code()`:
|
303 326 | \
|
304 327 | `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
|
305 328 | \
|
306 329 | See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-TestPayloadBlobError) for what information is available for the error.")]
|
307 330 | Unhandled(crate::error::sealed_unhandled::Unhandled),
|
331 + | /* OperationErrorGenerator.kt:81 */
|
308 332 | }
|
333 + | /* OperationErrorGenerator.kt:218 */
|
309 334 | impl TestPayloadBlobError {
|
335 + | /* OperationErrorGenerator.kt:219 */
|
310 336 | /// Creates the `TestPayloadBlobError::Unhandled` variant from any error type.
|
311 337 | pub fn unhandled(
|
312 338 | err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
|
313 339 | ) -> Self {
|
314 340 | Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
|
315 341 | source: err.into(),
|
316 342 | meta: ::std::default::Default::default(),
|
317 343 | })
|
318 344 | }
|
319 345 |
|
320 346 | /// Creates the `TestPayloadBlobError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
|
321 347 | pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
|
322 348 | Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
|
323 349 | source: err.clone().into(),
|
324 350 | meta: err,
|
325 351 | })
|
326 352 | }
|
327 - | ///
|
353 + | /// /* OperationErrorGenerator.kt:236 */
|
328 354 | /// Returns error metadata, which includes the error code, message,
|
329 355 | /// request ID, and potentially additional information.
|
330 356 | ///
|
357 + | /* OperationErrorGenerator.kt:242 */
|
331 358 | pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
|
359 + | /* OperationErrorGenerator.kt:243 */
|
332 360 | match self {
|
333 - | Self::Unhandled(e) => &e.meta,
|
361 + | /* OperationErrorGenerator.kt:251 */ Self::Unhandled(e) => &e.meta,
|
362 + | /* OperationErrorGenerator.kt:243 */
|
334 363 | }
|
364 + | /* OperationErrorGenerator.kt:242 */
|
335 365 | }
|
366 + | /* OperationErrorGenerator.kt:218 */
|
336 367 | }
|
368 + | /* OperationErrorGenerator.kt:269 */
|
337 369 | impl ::std::error::Error for TestPayloadBlobError {
|
370 + | /* OperationErrorGenerator.kt:270 */
|
338 371 | fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
|
372 + | /* OperationErrorGenerator.kt:318 */
|
339 373 | match self {
|
340 - | Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
|
374 + | /* OperationErrorGenerator.kt:326 */
|
375 + | Self::Unhandled(_inner) => {
|
376 + | /* OperationErrorGenerator.kt:279 */
|
377 + | ::std::option::Option::Some(&*_inner.source)
|
378 + | /* OperationErrorGenerator.kt:326 */
|
379 + | } /* OperationErrorGenerator.kt:318 */
|
341 380 | }
|
381 + | /* OperationErrorGenerator.kt:270 */
|
342 382 | }
|
383 + | /* OperationErrorGenerator.kt:269 */
|
343 384 | }
|
385 + | /* OperationErrorGenerator.kt:133 */
|
344 386 | impl ::std::fmt::Display for TestPayloadBlobError {
|
387 + | /* OperationErrorGenerator.kt:134 */
|
345 388 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
389 + | /* OperationErrorGenerator.kt:318 */
|
346 390 | match self {
|
391 + | /* OperationErrorGenerator.kt:326 */
|
347 392 | Self::Unhandled(_inner) => {
|
393 + | /* OperationErrorGenerator.kt:139 */
|
348 394 | if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
|
349 395 | write!(f, "unhandled error ({code})")
|
350 396 | } else {
|
351 397 | f.write_str("unhandled error")
|
352 398 | }
|
353 - | }
|
399 + | /* OperationErrorGenerator.kt:326 */
|
400 + | } /* OperationErrorGenerator.kt:318 */
|
354 401 | }
|
402 + | /* OperationErrorGenerator.kt:134 */
|
355 403 | }
|
404 + | /* OperationErrorGenerator.kt:133 */
|
356 405 | }
|
406 + | /* OperationErrorGenerator.kt:182 */
|
357 407 | impl ::aws_smithy_types::retry::ProvideErrorKind for TestPayloadBlobError {
|
408 + | /* OperationErrorGenerator.kt:186 */
|
358 409 | fn code(&self) -> ::std::option::Option<&str> {
|
410 + | /* OperationErrorGenerator.kt:187 */
|
359 411 | ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
|
412 + | /* OperationErrorGenerator.kt:186 */
|
360 413 | }
|
414 + | /* OperationErrorGenerator.kt:190 */
|
361 415 | fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
|
416 + | /* OperationErrorGenerator.kt:197 */
|
362 417 | ::std::option::Option::None
|
418 + | /* OperationErrorGenerator.kt:190 */
|
363 419 | }
|
420 + | /* OperationErrorGenerator.kt:182 */
|
364 421 | }
|
422 + | /* OperationErrorGenerator.kt:163 */
|
365 423 | impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for TestPayloadBlobError {
|
424 + | /* OperationErrorGenerator.kt:164 */
|
366 425 | fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
|
426 + | /* OperationErrorGenerator.kt:318 */
|
367 427 | match self {
|
368 - | Self::Unhandled(_inner) => &_inner.meta,
|
428 + | /* OperationErrorGenerator.kt:326 */
|
429 + | Self::Unhandled(_inner) => {
|
430 + | /* OperationErrorGenerator.kt:168 */
|
431 + | &_inner.meta
|
432 + | /* OperationErrorGenerator.kt:326 */
|
433 + | } /* OperationErrorGenerator.kt:318 */
|
369 434 | }
|
435 + | /* OperationErrorGenerator.kt:164 */
|
370 436 | }
|
437 + | /* OperationErrorGenerator.kt:163 */
|
371 438 | }
|
439 + | /* OperationErrorGenerator.kt:109 */
|
372 440 | impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for TestPayloadBlobError {
|
441 + | /* OperationErrorGenerator.kt:110 */
|
373 442 | fn create_unhandled_error(
|
374 443 | source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
|
375 444 | meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
|
376 445 | ) -> Self {
|
446 + | /* OperationErrorGenerator.kt:121 */
|
377 447 | Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
|
378 448 | source,
|
379 449 | meta: meta.unwrap_or_default(),
|
380 450 | })
|
451 + | /* OperationErrorGenerator.kt:110 */
|
381 452 | }
|
453 + | /* OperationErrorGenerator.kt:109 */
|
382 454 | }
|
383 455 |
|
456 + | /* CodegenDelegator.kt:255 */
|
384 457 | pub use crate::operation::test_payload_blob::_test_payload_blob_output::TestPayloadBlobOutput;
|
385 458 |
|
459 + | /* CodegenDelegator.kt:255 */
|
386 460 | pub use crate::operation::test_payload_blob::_test_payload_blob_input::TestPayloadBlobInput;
|
387 461 |
|
462 + | /* RustModule.kt:172 */
|
388 463 | mod _test_payload_blob_input;
|
389 464 |
|
465 + | /* RustModule.kt:172 */
|
390 466 | mod _test_payload_blob_output;
|
391 467 |
|
392 - | /// Builders
|
468 + | /// /* CodegenDelegator.kt:51 */Builders
|
393 469 | pub mod builders;
|