1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct UploadPart;
6impl UploadPart {
7 pub fn new() -> Self {
9 Self
10 }
11 pub(crate) async fn orchestrate(
12 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
13 input: crate::operation::upload_part::UploadPartInput,
14 ) -> ::std::result::Result<
15 crate::operation::upload_part::UploadPartOutput,
16 ::aws_smithy_runtime_api::client::result::SdkError<
17 crate::operation::upload_part::UploadPartError,
18 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
19 >,
20 > {
21 let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
22 ::aws_smithy_runtime_api::client::interceptors::context::Error,
23 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
24 >| {
25 err.map_service_error(|err| {
26 err.downcast::<crate::operation::upload_part::UploadPartError>()
27 .expect("correct error type")
28 })
29 };
30 let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
31 .await
32 .map_err(map_err)?;
33 let output = context.finalize().map_err(map_err)?;
34 ::std::result::Result::Ok(
35 output
36 .downcast::<crate::operation::upload_part::UploadPartOutput>()
37 .expect("correct output type"),
38 )
39 }
40
41 pub(crate) async fn orchestrate_with_stop_point(
42 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
43 input: crate::operation::upload_part::UploadPartInput,
44 stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
45 ) -> ::std::result::Result<
46 ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
47 ::aws_smithy_runtime_api::client::result::SdkError<
48 ::aws_smithy_runtime_api::client::interceptors::context::Error,
49 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
50 >,
51 > {
52 let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
53 use ::tracing::Instrument;
54 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("S3", "UploadPart", input, runtime_plugins, stop_point)
55 .instrument(::tracing::debug_span!(
58 "S3.UploadPart",
59 "rpc.service" = "S3",
60 "rpc.method" = "UploadPart",
61 "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
62 "rpc.system" = "aws-api",
63 ))
64 .await
65 }
66
67 pub(crate) fn operation_runtime_plugins(
68 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
69 client_config: &crate::config::Config,
70 config_override: ::std::option::Option<crate::config::Builder>,
71 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
72 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
73
74 if let ::std::option::Option::Some(config_override) = config_override {
75 for plugin in config_override.runtime_plugins.iter().cloned() {
76 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
77 }
78 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
79 config_override,
80 client_config.config.clone(),
81 &client_config.runtime_components,
82 ));
83 }
84 runtime_plugins
85 }
86}
87impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for UploadPart {
88 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
89 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("UploadPart");
90
91 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
92 UploadPartRequestSerializer,
93 ));
94 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
95 UploadPartResponseDeserializer,
96 ));
97
98 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
99 crate::config::auth::Params::builder()
100 .operation_name("UploadPart")
101 .build()
102 .expect("required fields set"),
103 ));
104
105 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
106 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("UploadPart", "S3"));
107 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
108 signing_options.double_uri_encode = false;
109 signing_options.content_sha256_header = true;
110 signing_options.normalize_uri_path = false;
111 signing_options.payload_override = None;
112
113 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
114 signing_options,
115 ..::std::default::Default::default()
116 });
117
118 ::std::option::Option::Some(cfg.freeze())
119 }
120
121 fn runtime_components(
122 &self,
123 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
124 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
125 #[allow(unused_mut)]
126 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("UploadPart")
127 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
128 UploadPartTelemetryInputCaptureInterceptor,
129 ))
130 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
131 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
132 ))
133 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
134 UploadPartEndpointParamsInterceptor,
135 ))
136 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
137 crate::http_request_checksum::RequestChecksumInterceptor::new(
138 |input: &::aws_smithy_runtime_api::client::interceptors::context::Input| {
139 let input: &crate::operation::upload_part::UploadPartInput = input.downcast_ref().expect("correct type");
140 let checksum_algorithm = input.checksum_algorithm();
141 let checksum_algorithm = checksum_algorithm.map(|algorithm| algorithm.as_str());
142 (checksum_algorithm.map(|s| s.to_string()), false)
143 },
144 |request: &mut ::aws_smithy_runtime_api::http::Request, cfg: &::aws_smithy_types::config_bag::ConfigBag| {
145 let mut user_set_checksum_value = false;
147 let headers_to_check =
148 request
149 .headers()
150 .iter()
151 .filter_map(|(name, _val)| if name.starts_with("x-amz-checksum-") { Some(name) } else { None });
152 for algo_header in headers_to_check {
153 if request.headers().get(algo_header).is_some() {
154 user_set_checksum_value = true;
155 }
156 }
157
158 let user_set_checksum_algo = request.headers().get("x-amz-sdk-checksum-algorithm").is_some();
160
161 let request_checksum_calculation = cfg
163 .load::<::aws_smithy_types::checksum_config::RequestChecksumCalculation>()
164 .unwrap_or(&::aws_smithy_types::checksum_config::RequestChecksumCalculation::WhenSupported);
165
166 let http_checksum_required = false;
168
169 let is_presigned_req = cfg.load::<crate::presigning::PresigningMarker>().is_some();
170
171 match (
176 request_checksum_calculation,
177 http_checksum_required,
178 user_set_checksum_value,
179 user_set_checksum_algo,
180 is_presigned_req,
181 ) {
182 (_, _, _, _, true) => {}
183 (::aws_smithy_types::checksum_config::RequestChecksumCalculation::WhenSupported, _, false, false, _)
184 | (::aws_smithy_types::checksum_config::RequestChecksumCalculation::WhenRequired, true, false, false, _) => {
185 request.headers_mut().insert("x-amz-sdk-checksum-algorithm", "CRC32");
186 }
187 _ => {}
188 }
189
190 Ok(user_set_checksum_value)
193 },
194 ),
195 ))
196 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
197 crate::aws_chunked::AwsChunkedContentEncodingInterceptor,
198 ))
199 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
200 crate::operation::upload_part::UploadPartError,
201 >::new())
202 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
203 crate::operation::upload_part::UploadPartError,
204 >::new())
205 .with_retry_classifier(
206 ::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<crate::operation::upload_part::UploadPartError>::builder()
207 .transient_errors({
208 let mut transient_errors: Vec<&'static str> = ::aws_runtime::retries::classifiers::TRANSIENT_ERRORS.into();
209 transient_errors.push("InternalError");
210 ::std::borrow::Cow::Owned(transient_errors)
211 })
212 .build(),
213 )
214 .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
215 crate::operation::upload_part::UploadPartError,
216 >::new());
217
218 ::std::borrow::Cow::Owned(rcb)
219 }
220}
221
222#[derive(Debug)]
223struct UploadPartTelemetryInputCaptureInterceptor;
224
225#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
226impl ::aws_smithy_runtime_api::client::interceptors::Intercept for UploadPartTelemetryInputCaptureInterceptor {
227 fn name(&self) -> &'static str {
228 "UploadPartTelemetryInputCaptureInterceptor"
229 }
230
231 fn read_before_execution(
232 &self,
233 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
234 '_,
235 ::aws_smithy_runtime_api::client::interceptors::context::Input,
236 ::aws_smithy_runtime_api::client::interceptors::context::Output,
237 ::aws_smithy_runtime_api::client::interceptors::context::Error,
238 >,
239 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
240 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
241 let ::std::option::Option::Some(requested) = cfg
243 .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
244 .filter(|r| !r.is_empty())
245 else {
246 return ::std::result::Result::Ok(());
247 };
248
249 let ::std::option::Option::Some(input) = context.input().downcast_ref::<UploadPartInput>() else {
250 return ::std::result::Result::Ok(());
252 };
253
254 let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
255 if requested.should_capture("Bucket") {
256 if let ::std::option::Option::Some(value) = input.bucket.as_deref() {
257 captured.insert("Bucket", value);
258 }
259 }
260 if requested.should_capture("ContentMD5") {
261 if let ::std::option::Option::Some(value) = input.content_md5.as_deref() {
262 captured.insert("ContentMD5", value);
263 }
264 }
265 if requested.should_capture("ChecksumCRC32") {
266 if let ::std::option::Option::Some(value) = input.checksum_crc32.as_deref() {
267 captured.insert("ChecksumCRC32", value);
268 }
269 }
270 if requested.should_capture("ChecksumCRC32C") {
271 if let ::std::option::Option::Some(value) = input.checksum_crc32_c.as_deref() {
272 captured.insert("ChecksumCRC32C", value);
273 }
274 }
275 if requested.should_capture("ChecksumCRC64NVME") {
276 if let ::std::option::Option::Some(value) = input.checksum_crc64_nvme.as_deref() {
277 captured.insert("ChecksumCRC64NVME", value);
278 }
279 }
280 if requested.should_capture("ChecksumSHA1") {
281 if let ::std::option::Option::Some(value) = input.checksum_sha1.as_deref() {
282 captured.insert("ChecksumSHA1", value);
283 }
284 }
285 if requested.should_capture("ChecksumSHA256") {
286 if let ::std::option::Option::Some(value) = input.checksum_sha256.as_deref() {
287 captured.insert("ChecksumSHA256", value);
288 }
289 }
290 if requested.should_capture("ChecksumSHA512") {
291 if let ::std::option::Option::Some(value) = input.checksum_sha512.as_deref() {
292 captured.insert("ChecksumSHA512", value);
293 }
294 }
295 if requested.should_capture("ChecksumMD5") {
296 if let ::std::option::Option::Some(value) = input.checksum_md5.as_deref() {
297 captured.insert("ChecksumMD5", value);
298 }
299 }
300 if requested.should_capture("ChecksumXXHASH64") {
301 if let ::std::option::Option::Some(value) = input.checksum_xxhash64.as_deref() {
302 captured.insert("ChecksumXXHASH64", value);
303 }
304 }
305 if requested.should_capture("ChecksumXXHASH3") {
306 if let ::std::option::Option::Some(value) = input.checksum_xxhash3.as_deref() {
307 captured.insert("ChecksumXXHASH3", value);
308 }
309 }
310 if requested.should_capture("ChecksumXXHASH128") {
311 if let ::std::option::Option::Some(value) = input.checksum_xxhash128.as_deref() {
312 captured.insert("ChecksumXXHASH128", value);
313 }
314 }
315 if requested.should_capture("Key") {
316 if let ::std::option::Option::Some(value) = input.key.as_deref() {
317 captured.insert("Key", value);
318 }
319 }
320 if requested.should_capture("UploadId") {
321 if let ::std::option::Option::Some(value) = input.upload_id.as_deref() {
322 captured.insert("UploadId", value);
323 }
324 }
325 if requested.should_capture("SSECustomerAlgorithm") {
326 if let ::std::option::Option::Some(value) = input.sse_customer_algorithm.as_deref() {
327 captured.insert("SSECustomerAlgorithm", value);
328 }
329 }
330 if requested.should_capture("SSECustomerKeyMD5") {
331 if let ::std::option::Option::Some(value) = input.sse_customer_key_md5.as_deref() {
332 captured.insert("SSECustomerKeyMD5", value);
333 }
334 }
335 if requested.should_capture("ExpectedBucketOwner") {
336 if let ::std::option::Option::Some(value) = input.expected_bucket_owner.as_deref() {
337 captured.insert("ExpectedBucketOwner", value);
338 }
339 }
340
341 cfg.interceptor_state().store_put(captured);
342 ::std::result::Result::Ok(())
343 }
344}
345#[derive(Debug)]
346struct UploadPartResponseDeserializer;
347impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for UploadPartResponseDeserializer {
348 fn deserialize_nonstreaming_with_config(
349 &self,
350 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
351 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
352 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
353 let (success, status) = (response.status().is_success(), response.status().as_u16());
354 let headers = response.headers();
355 let body = response.body().bytes().expect("body loaded");
356 #[allow(unused_mut)]
357 let mut force_error = false;
358 ::tracing::debug!(extended_request_id = ?crate::s3_request_id::RequestIdExt::extended_request_id(response));
359 if matches!(crate::rest_xml_unwrapped_errors::body_is_error(body), Ok(true)) {
360 force_error = true;
361 }
362 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
363 let parse_result = if !success && status != 200 || force_error {
364 crate::protocol_serde::shape_upload_part::de_upload_part_http_error(status, headers, body, _cfg)
365 } else {
366 crate::protocol_serde::shape_upload_part::de_upload_part_http_response(status, headers, body, _cfg)
367 };
368 crate::protocol_serde::type_erase_result(parse_result)
369 }
370}
371#[derive(Debug)]
372struct UploadPartRequestSerializer;
373impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for UploadPartRequestSerializer {
374 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
375 fn serialize_input(
376 &self,
377 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
378 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
379 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
380 let input = input.downcast::<crate::operation::upload_part::UploadPartInput>().expect("correct type");
381 let _header_serialization_settings = _cfg
382 .load::<crate::serialization_settings::HeaderSerializationSettings>()
383 .cloned()
384 .unwrap_or_default();
385 let mut request_builder = {
386 #[allow(clippy::uninlined_format_args)]
387 fn uri_base(
388 _input: &crate::operation::upload_part::UploadPartInput,
389 output: &mut ::std::string::String,
390 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
391 use ::std::fmt::Write as _;
392 let input_1 = &_input.key;
393 let input_1 = input_1
394 .as_ref()
395 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("key", "cannot be empty or unset"))?;
396 let key = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Greedy);
397 if key.is_empty() {
398 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
399 "key",
400 "cannot be empty or unset",
401 ));
402 }
403 ::std::write!(output, "/{Key}", Key = key).expect("formatting should succeed");
404 ::std::result::Result::Ok(())
405 }
406 fn uri_query(
407 _input: &crate::operation::upload_part::UploadPartInput,
408 mut output: &mut ::std::string::String,
409 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
410 let mut query = ::aws_smithy_http::query::Writer::new(output);
411 query.push_kv("x-id", "UploadPart");
412 let inner_2 = &_input.part_number;
413 let inner_2 = inner_2
414 .as_ref()
415 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("part_number", "cannot be empty or unset"))?;
416 query.push_kv("partNumber", ::aws_smithy_types::primitive::Encoder::from(*inner_2).encode());
417 let inner_3 = &_input.upload_id;
418 let inner_3 = inner_3
419 .as_ref()
420 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("upload_id", "cannot be empty or unset"))?;
421 if inner_3.is_empty() {
422 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
423 "upload_id",
424 "cannot be empty or unset",
425 ));
426 }
427 query.push_kv("uploadId", &::aws_smithy_http::query::fmt_string(inner_3));
428 ::std::result::Result::Ok(())
429 }
430 #[allow(clippy::unnecessary_wraps)]
431 fn update_http_builder(
432 input: &crate::operation::upload_part::UploadPartInput,
433 builder: ::http_1x::request::Builder,
434 ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
435 let mut uri = ::std::string::String::new();
436 uri_base(input, &mut uri)?;
437 uri_query(input, &mut uri)?;
438 let builder = crate::protocol_serde::shape_upload_part::ser_upload_part_headers(input, builder)?;
439 ::std::result::Result::Ok(builder.method("PUT").uri(uri))
440 }
441 let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
442 builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/octet-stream");
443 builder
444 };
445 let body = crate::protocol_serde::shape_upload_part_input::ser_body_http_payload(input.body)?.into_inner();
446 if let Some(content_length) = body.content_length() {
447 let content_length = content_length.to_string();
448 request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
449 }
450 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
451 }
452}
453#[derive(Debug)]
454struct UploadPartEndpointParamsInterceptor;
455
456#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
457impl ::aws_smithy_runtime_api::client::interceptors::Intercept for UploadPartEndpointParamsInterceptor {
458 fn name(&self) -> &'static str {
459 "UploadPartEndpointParamsInterceptor"
460 }
461
462 fn read_before_execution(
463 &self,
464 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
465 '_,
466 ::aws_smithy_runtime_api::client::interceptors::context::Input,
467 ::aws_smithy_runtime_api::client::interceptors::context::Output,
468 ::aws_smithy_runtime_api::client::interceptors::context::Error,
469 >,
470 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
471 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
472 let _input = context
473 .input()
474 .downcast_ref::<UploadPartInput>()
475 .ok_or("failed to downcast to UploadPartInput")?;
476
477 let params = crate::config::endpoint::Params::builder()
478 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
479 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
480 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
481 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
482 .set_force_path_style(cfg.load::<crate::config::ForcePathStyle>().map(|ty| ty.0))
483 .set_use_arn_region(cfg.load::<crate::config::UseArnRegion>().map(|ty| ty.0))
484 .set_disable_multi_region_access_points(cfg.load::<crate::config::DisableMultiRegionAccessPoints>().map(|ty| ty.0))
485 .set_accelerate(cfg.load::<crate::config::Accelerate>().map(|ty| ty.0))
486 .set_disable_s3_express_session_auth(cfg.load::<crate::config::DisableS3ExpressSessionAuth>().map(|ty| ty.0))
487 .set_bucket(Some(
488 _input
489 .bucket
490 .clone()
491 .filter(|f| !AsRef::<str>::as_ref(f).trim().is_empty())
492 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("bucket", "A required field was not set"))?,
493 ))
494 .set_key(Some(
495 _input
496 .key
497 .clone()
498 .filter(|f| !AsRef::<str>::as_ref(f).trim().is_empty())
499 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("key", "A required field was not set"))?,
500 ))
501 .build()
502 .map_err(|err| {
503 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
504 })?;
505 cfg.interceptor_state()
506 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
507 ::std::result::Result::Ok(())
508 }
509}
510
511#[non_exhaustive]
516#[derive(::std::fmt::Debug)]
517pub enum UploadPartError {
518 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
520 variable wildcard pattern and check `.code()`:
521 \
522 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
523 \
524 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-UploadPartError) for what information is available for the error.")]
525 Unhandled(crate::error::sealed_unhandled::Unhandled),
526}
527impl UploadPartError {
528 pub fn unhandled(
530 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
531 ) -> Self {
532 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
533 source: err.into(),
534 meta: ::std::default::Default::default(),
535 })
536 }
537
538 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
540 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
541 source: err.clone().into(),
542 meta: err,
543 })
544 }
545 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
550 match self {
551 Self::Unhandled(e) => &e.meta,
552 }
553 }
554}
555impl ::std::error::Error for UploadPartError {
556 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
557 match self {
558 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
559 }
560 }
561}
562impl ::std::fmt::Display for UploadPartError {
563 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
564 match self {
565 Self::Unhandled(_inner) => {
566 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
567 write!(f, "unhandled error ({code})")
568 } else {
569 f.write_str("unhandled error")
570 }
571 }
572 }
573 }
574}
575impl ::aws_smithy_types::retry::ProvideErrorKind for UploadPartError {
576 fn code(&self) -> ::std::option::Option<&str> {
577 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
578 }
579 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
580 ::std::option::Option::None
581 }
582}
583impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for UploadPartError {
584 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
585 match self {
586 Self::Unhandled(_inner) => &_inner.meta,
587 }
588 }
589}
590impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for UploadPartError {
591 fn create_unhandled_error(
592 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
593 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
594 ) -> Self {
595 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
596 source,
597 meta: meta.unwrap_or_default(),
598 })
599 }
600}
601impl crate::s3_request_id::RequestIdExt for crate::operation::upload_part::UploadPartError {
602 fn extended_request_id(&self) -> Option<&str> {
603 self.meta().extended_request_id()
604 }
605}
606impl ::aws_types::request_id::RequestId for crate::operation::upload_part::UploadPartError {
607 fn request_id(&self) -> Option<&str> {
608 self.meta().request_id()
609 }
610}
611
612pub use crate::operation::upload_part::_upload_part_input::UploadPartInput;
613
614pub use crate::operation::upload_part::_upload_part_output::UploadPartOutput;
615
616mod _upload_part_input;
617
618mod _upload_part_output;
619
620pub mod builders;