1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct UploadReadSetPart;
6impl UploadReadSetPart {
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_read_set_part::UploadReadSetPartInput,
14 ) -> ::std::result::Result<
15 crate::operation::upload_read_set_part::UploadReadSetPartOutput,
16 ::aws_smithy_runtime_api::client::result::SdkError<
17 crate::operation::upload_read_set_part::UploadReadSetPartError,
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_read_set_part::UploadReadSetPartError>()
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_read_set_part::UploadReadSetPartOutput>()
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_read_set_part::UploadReadSetPartInput,
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 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("omics", "UploadReadSetPart", input, runtime_plugins, stop_point).await
54 }
55
56 pub(crate) fn operation_runtime_plugins(
57 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
58 client_config: &crate::config::Config,
59 config_override: ::std::option::Option<crate::config::Builder>,
60 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
61 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
62 runtime_plugins = runtime_plugins.with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![
63 ::aws_runtime::auth::sigv4::SCHEME_ID,
64 ]));
65 if let ::std::option::Option::Some(config_override) = config_override {
66 for plugin in config_override.runtime_plugins.iter().cloned() {
67 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
68 }
69 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
70 config_override,
71 client_config.config.clone(),
72 &client_config.runtime_components,
73 ));
74 }
75 runtime_plugins
76 }
77}
78impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for UploadReadSetPart {
79 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
80 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("UploadReadSetPart");
81
82 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
83 UploadReadSetPartRequestSerializer,
84 ));
85 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
86 UploadReadSetPartResponseDeserializer,
87 ));
88
89 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
90 ::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new(),
91 ));
92
93 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
94 "UploadReadSetPart",
95 "omics",
96 ));
97 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
98 signing_options.double_uri_encode = true;
99 signing_options.content_sha256_header = true;
100 signing_options.normalize_uri_path = true;
101 signing_options.payload_override = Some(::aws_sigv4::http_request::SignableBody::UnsignedPayload);
102
103 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
104 signing_options,
105 ..::std::default::Default::default()
106 });
107
108 ::std::option::Option::Some(cfg.freeze())
109 }
110
111 fn runtime_components(
112 &self,
113 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
114 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
115 #[allow(unused_mut)]
116 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("UploadReadSetPart")
117 .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
118 .with_interceptor(UploadReadSetPartEndpointParamsInterceptor)
119 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
120 crate::operation::upload_read_set_part::UploadReadSetPartError,
121 >::new())
122 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
123 crate::operation::upload_read_set_part::UploadReadSetPartError,
124 >::new())
125 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
126 crate::operation::upload_read_set_part::UploadReadSetPartError,
127 >::new());
128
129 ::std::borrow::Cow::Owned(rcb)
130 }
131}
132
133#[derive(Debug)]
134struct UploadReadSetPartResponseDeserializer;
135impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for UploadReadSetPartResponseDeserializer {
136 fn deserialize_nonstreaming(
137 &self,
138 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
139 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
140 let (success, status) = (response.status().is_success(), response.status().as_u16());
141 let headers = response.headers();
142 let body = response.body().bytes().expect("body loaded");
143 #[allow(unused_mut)]
144 let mut force_error = false;
145 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
146 let parse_result = if !success && status != 200 || force_error {
147 crate::protocol_serde::shape_upload_read_set_part::de_upload_read_set_part_http_error(status, headers, body)
148 } else {
149 crate::protocol_serde::shape_upload_read_set_part::de_upload_read_set_part_http_response(status, headers, body)
150 };
151 crate::protocol_serde::type_erase_result(parse_result)
152 }
153}
154#[derive(Debug)]
155struct UploadReadSetPartRequestSerializer;
156impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for UploadReadSetPartRequestSerializer {
157 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
158 fn serialize_input(
159 &self,
160 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
161 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
162 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
163 let input = input
164 .downcast::<crate::operation::upload_read_set_part::UploadReadSetPartInput>()
165 .expect("correct type");
166 let _header_serialization_settings = _cfg
167 .load::<crate::serialization_settings::HeaderSerializationSettings>()
168 .cloned()
169 .unwrap_or_default();
170 let mut request_builder = {
171 fn uri_base(
172 _input: &crate::operation::upload_read_set_part::UploadReadSetPartInput,
173 output: &mut ::std::string::String,
174 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
175 use ::std::fmt::Write as _;
176 let input_1 = &_input.sequence_store_id;
177 let input_1 = input_1.as_ref().ok_or_else(|| {
178 ::aws_smithy_types::error::operation::BuildError::missing_field("sequence_store_id", "cannot be empty or unset")
179 })?;
180 let sequence_store_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
181 if sequence_store_id.is_empty() {
182 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
183 "sequence_store_id",
184 "cannot be empty or unset",
185 ));
186 }
187 let input_2 = &_input.upload_id;
188 let input_2 = input_2
189 .as_ref()
190 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("upload_id", "cannot be empty or unset"))?;
191 let upload_id = ::aws_smithy_http::label::fmt_string(input_2, ::aws_smithy_http::label::EncodingStrategy::Default);
192 if upload_id.is_empty() {
193 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
194 "upload_id",
195 "cannot be empty or unset",
196 ));
197 }
198 ::std::write!(
199 output,
200 "/sequencestore/{sequenceStoreId}/upload/{uploadId}/part",
201 sequenceStoreId = sequence_store_id,
202 uploadId = upload_id
203 )
204 .expect("formatting should succeed");
205 ::std::result::Result::Ok(())
206 }
207 fn uri_query(
208 _input: &crate::operation::upload_read_set_part::UploadReadSetPartInput,
209 mut output: &mut ::std::string::String,
210 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
211 let mut query = ::aws_smithy_http::query::Writer::new(output);
212 let inner_3 = &_input.part_source;
213 let inner_3 = inner_3
214 .as_ref()
215 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("part_source", "cannot be empty or unset"))?;
216 query.push_kv("partSource", &::aws_smithy_http::query::fmt_string(inner_3));
217 let inner_4 = &_input.part_number;
218 let inner_4 = inner_4
219 .as_ref()
220 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("part_number", "cannot be empty or unset"))?;
221 query.push_kv("partNumber", ::aws_smithy_types::primitive::Encoder::from(*inner_4).encode());
222 ::std::result::Result::Ok(())
223 }
224 #[allow(clippy::unnecessary_wraps)]
225 fn update_http_builder(
226 input: &crate::operation::upload_read_set_part::UploadReadSetPartInput,
227 builder: ::http::request::Builder,
228 ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
229 let mut uri = ::std::string::String::new();
230 uri_base(input, &mut uri)?;
231 uri_query(input, &mut uri)?;
232 ::std::result::Result::Ok(builder.method("PUT").uri(uri))
233 }
234 let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
235 builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/octet-stream");
236 builder
237 };
238 let body = crate::protocol_serde::shape_upload_read_set_part_input::ser_payload_http_payload(input.payload)?.into_inner();
239 if let Some(content_length) = body.content_length() {
240 let content_length = content_length.to_string();
241 request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
242 }
243 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
244 }
245}
246#[derive(Debug)]
247struct UploadReadSetPartEndpointParamsInterceptor;
248
249impl ::aws_smithy_runtime_api::client::interceptors::Intercept for UploadReadSetPartEndpointParamsInterceptor {
250 fn name(&self) -> &'static str {
251 "UploadReadSetPartEndpointParamsInterceptor"
252 }
253
254 fn read_before_execution(
255 &self,
256 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
257 '_,
258 ::aws_smithy_runtime_api::client::interceptors::context::Input,
259 ::aws_smithy_runtime_api::client::interceptors::context::Output,
260 ::aws_smithy_runtime_api::client::interceptors::context::Error,
261 >,
262 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
263 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
264 let _input = context
265 .input()
266 .downcast_ref::<UploadReadSetPartInput>()
267 .ok_or("failed to downcast to UploadReadSetPartInput")?;
268
269 let endpoint_prefix = ::aws_smithy_runtime_api::client::endpoint::EndpointPrefix::new("storage-").map_err(|err| {
270 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint prefix could not be built", err)
271 })?;
272 cfg.interceptor_state().store_put(endpoint_prefix);
273
274 let params = crate::config::endpoint::Params::builder()
275 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
276 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
277 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
278 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
279 .build()
280 .map_err(|err| {
281 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
282 })?;
283 cfg.interceptor_state()
284 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
285 ::std::result::Result::Ok(())
286 }
287}
288
289#[non_exhaustive]
294#[derive(::std::fmt::Debug)]
295pub enum UploadReadSetPartError {
296 AccessDeniedException(crate::types::error::AccessDeniedException),
298 InternalServerException(crate::types::error::InternalServerException),
300 NotSupportedOperationException(crate::types::error::NotSupportedOperationException),
302 RequestTimeoutException(crate::types::error::RequestTimeoutException),
304 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
306 ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
308 ThrottlingException(crate::types::error::ThrottlingException),
310 ValidationException(crate::types::error::ValidationException),
312 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
314 variable wildcard pattern and check `.code()`:
315 \
316 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
317 \
318 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-UploadReadSetPartError) for what information is available for the error.")]
319 Unhandled(crate::error::sealed_unhandled::Unhandled),
320}
321impl UploadReadSetPartError {
322 pub fn unhandled(
324 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
325 ) -> Self {
326 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
327 source: err.into(),
328 meta: ::std::default::Default::default(),
329 })
330 }
331
332 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
334 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
335 source: err.clone().into(),
336 meta: err,
337 })
338 }
339 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
344 match self {
345 Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
346 Self::InternalServerException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
347 Self::NotSupportedOperationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
348 Self::RequestTimeoutException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
349 Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
350 Self::ServiceQuotaExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
351 Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
352 Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
353 Self::Unhandled(e) => &e.meta,
354 }
355 }
356 pub fn is_access_denied_exception(&self) -> bool {
358 matches!(self, Self::AccessDeniedException(_))
359 }
360 pub fn is_internal_server_exception(&self) -> bool {
362 matches!(self, Self::InternalServerException(_))
363 }
364 pub fn is_not_supported_operation_exception(&self) -> bool {
366 matches!(self, Self::NotSupportedOperationException(_))
367 }
368 pub fn is_request_timeout_exception(&self) -> bool {
370 matches!(self, Self::RequestTimeoutException(_))
371 }
372 pub fn is_resource_not_found_exception(&self) -> bool {
374 matches!(self, Self::ResourceNotFoundException(_))
375 }
376 pub fn is_service_quota_exceeded_exception(&self) -> bool {
378 matches!(self, Self::ServiceQuotaExceededException(_))
379 }
380 pub fn is_throttling_exception(&self) -> bool {
382 matches!(self, Self::ThrottlingException(_))
383 }
384 pub fn is_validation_exception(&self) -> bool {
386 matches!(self, Self::ValidationException(_))
387 }
388}
389impl ::std::error::Error for UploadReadSetPartError {
390 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
391 match self {
392 Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
393 Self::InternalServerException(_inner) => ::std::option::Option::Some(_inner),
394 Self::NotSupportedOperationException(_inner) => ::std::option::Option::Some(_inner),
395 Self::RequestTimeoutException(_inner) => ::std::option::Option::Some(_inner),
396 Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
397 Self::ServiceQuotaExceededException(_inner) => ::std::option::Option::Some(_inner),
398 Self::ThrottlingException(_inner) => ::std::option::Option::Some(_inner),
399 Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
400 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
401 }
402 }
403}
404impl ::std::fmt::Display for UploadReadSetPartError {
405 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
406 match self {
407 Self::AccessDeniedException(_inner) => _inner.fmt(f),
408 Self::InternalServerException(_inner) => _inner.fmt(f),
409 Self::NotSupportedOperationException(_inner) => _inner.fmt(f),
410 Self::RequestTimeoutException(_inner) => _inner.fmt(f),
411 Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
412 Self::ServiceQuotaExceededException(_inner) => _inner.fmt(f),
413 Self::ThrottlingException(_inner) => _inner.fmt(f),
414 Self::ValidationException(_inner) => _inner.fmt(f),
415 Self::Unhandled(_inner) => {
416 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
417 write!(f, "unhandled error ({code})")
418 } else {
419 f.write_str("unhandled error")
420 }
421 }
422 }
423 }
424}
425impl ::aws_smithy_types::retry::ProvideErrorKind for UploadReadSetPartError {
426 fn code(&self) -> ::std::option::Option<&str> {
427 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
428 }
429 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
430 match self {
431 Self::InternalServerException(inner) => ::std::option::Option::Some(inner.retryable_error_kind()),
432 Self::ThrottlingException(inner) => ::std::option::Option::Some(inner.retryable_error_kind()),
433 _ => ::std::option::Option::None,
434 }
435 }
436}
437impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for UploadReadSetPartError {
438 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
439 match self {
440 Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
441 Self::InternalServerException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
442 Self::NotSupportedOperationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
443 Self::RequestTimeoutException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
444 Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
445 Self::ServiceQuotaExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
446 Self::ThrottlingException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
447 Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
448 Self::Unhandled(_inner) => &_inner.meta,
449 }
450 }
451}
452impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for UploadReadSetPartError {
453 fn create_unhandled_error(
454 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
455 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
456 ) -> Self {
457 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
458 source,
459 meta: meta.unwrap_or_default(),
460 })
461 }
462}
463impl ::aws_types::request_id::RequestId for crate::operation::upload_read_set_part::UploadReadSetPartError {
464 fn request_id(&self) -> Option<&str> {
465 self.meta().request_id()
466 }
467}
468
469pub use crate::operation::upload_read_set_part::_upload_read_set_part_output::UploadReadSetPartOutput;
470
471pub use crate::operation::upload_read_set_part::_upload_read_set_part_input::UploadReadSetPartInput;
472
473mod _upload_read_set_part_input;
474
475mod _upload_read_set_part_output;
476
477pub mod builders;