1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct PutAttachment;
6impl PutAttachment {
7 pub fn new() -> Self {
9 Self
10 }
11 pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::put_attachment::PutAttachmentInput::SCHEMA;
13 pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::put_attachment::PutAttachmentOutput::SCHEMA;
15 pub(crate) async fn orchestrate(
16 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17 input: crate::operation::put_attachment::PutAttachmentInput,
18 ) -> ::std::result::Result<
19 crate::operation::put_attachment::PutAttachmentOutput,
20 ::aws_smithy_runtime_api::client::result::SdkError<
21 crate::operation::put_attachment::PutAttachmentError,
22 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
23 >,
24 > {
25 let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
26 ::aws_smithy_runtime_api::client::interceptors::context::Error,
27 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
28 >| {
29 err.map_service_error(|err| {
30 err.downcast::<crate::operation::put_attachment::PutAttachmentError>()
31 .expect("correct error type")
32 })
33 };
34 let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
35 .await
36 .map_err(map_err)?;
37 let output = context.finalize().map_err(map_err)?;
38 ::std::result::Result::Ok(
39 output
40 .downcast::<crate::operation::put_attachment::PutAttachmentOutput>()
41 .expect("correct output type"),
42 )
43 }
44
45 pub(crate) async fn orchestrate_with_stop_point(
46 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
47 input: crate::operation::put_attachment::PutAttachmentInput,
48 stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
49 ) -> ::std::result::Result<
50 ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
51 ::aws_smithy_runtime_api::client::result::SdkError<
52 ::aws_smithy_runtime_api::client::interceptors::context::Error,
53 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
54 >,
55 > {
56 let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
57 use ::tracing::Instrument;
58 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("Glue", "PutAttachment", input, runtime_plugins, stop_point)
59 .instrument(::tracing::debug_span!(
62 "Glue.PutAttachment",
63 "rpc.service" = "Glue",
64 "rpc.method" = "PutAttachment",
65 "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
66 "rpc.system" = "aws-api",
67 ))
68 .await
69 }
70
71 pub(crate) fn operation_runtime_plugins(
72 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
73 client_config: &crate::config::Config,
74 config_override: ::std::option::Option<crate::config::Builder>,
75 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
76 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
77 runtime_plugins = runtime_plugins.with_operation_plugin(crate::client_idempotency_token::IdempotencyTokenRuntimePlugin::new(
78 |token_provider, input| {
79 let input: &mut crate::operation::put_attachment::PutAttachmentInput = input.downcast_mut().expect("correct type");
80 if input.client_token.is_none() {
81 input.client_token = ::std::option::Option::Some(token_provider.make_idempotency_token());
82 }
83 },
84 ));
85 if let ::std::option::Option::Some(config_override) = config_override {
86 for plugin in config_override.runtime_plugins.iter().cloned() {
87 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
88 }
89 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
90 config_override,
91 client_config.config.clone(),
92 &client_config.runtime_components,
93 ));
94 }
95 runtime_plugins
96 }
97}
98pub(crate) mod error_registry {
107 pub(crate) static REGISTRY: ::std::sync::LazyLock<::aws_smithy_schema::registry::TypeRegistry> = ::std::sync::LazyLock::new(|| {
108 ::aws_smithy_schema::registry::TypeRegistry::builder()
109 .insert_error_shape(
110 crate::types::error::AccessDeniedException::SCHEMA,
111 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
112 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::AccessDeniedException::deserialize(d)?))
113 },
114 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
115 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::AccessDeniedException::deserialize(d)?))
116 },
117 )
118.insert_error_shape(
119 crate::types::error::ConcurrentModificationException::SCHEMA,
120 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
121 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ConcurrentModificationException::deserialize(d)?))
122 },
123 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
124 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ConcurrentModificationException::deserialize(d)?))
125 },
126 )
127.insert_error_shape(
128 crate::types::error::EntityNotFoundException::SCHEMA,
129 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
130 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::EntityNotFoundException::deserialize(d)?))
131 },
132 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
133 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::EntityNotFoundException::deserialize(d)?))
134 },
135 )
136.insert_error_shape(
137 crate::types::error::InternalServiceException::SCHEMA,
138 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
139 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InternalServiceException::deserialize(d)?))
140 },
141 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
142 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InternalServiceException::deserialize(d)?))
143 },
144 )
145.insert_error_shape(
146 crate::types::error::InvalidInputException::SCHEMA,
147 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
148 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidInputException::deserialize(d)?))
149 },
150 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
151 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidInputException::deserialize(d)?))
152 },
153 )
154.insert_error_shape(
155 crate::types::error::ThrottlingException::SCHEMA,
156 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
157 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ThrottlingException::deserialize(d)?))
158 },
159 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
160 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ThrottlingException::deserialize(d)?))
161 },
162 )
163 .build()
164 });
165}
166impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for PutAttachment {
167 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
168 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("PutAttachment");
169
170 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
171 PutAttachmentRequestSerializer,
172 ));
173 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
174 PutAttachmentResponseDeserializer,
175 ));
176
177 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
178 crate::config::auth::Params::builder()
179 .operation_name("PutAttachment")
180 .build()
181 .expect("required fields set"),
182 ));
183
184 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("PutAttachment", "Glue"));
185 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
186 signing_options.double_uri_encode = true;
187 signing_options.content_sha256_header = false;
188 signing_options.normalize_uri_path = true;
189 signing_options.payload_override = None;
190
191 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
192 signing_options,
193 ..::std::default::Default::default()
194 });
195
196 ::std::option::Option::Some(cfg.freeze())
197 }
198
199 fn runtime_components(
200 &self,
201 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
202 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
203 #[allow(unused_mut)]
204 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("PutAttachment")
205 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
206 PutAttachmentTelemetryInputCaptureInterceptor,
207 ))
208 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
209 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
210 ))
211 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
212 PutAttachmentEndpointParamsInterceptor,
213 ))
214 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
215 crate::operation::put_attachment::PutAttachmentError,
216 >::new())
217 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
218 crate::operation::put_attachment::PutAttachmentError,
219 >::new())
220 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
221 crate::operation::put_attachment::PutAttachmentError,
222 >::new())
223 .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
224 crate::operation::put_attachment::PutAttachmentError,
225 >::new());
226
227 ::std::borrow::Cow::Owned(rcb)
228 }
229}
230
231#[derive(Debug)]
232struct PutAttachmentTelemetryInputCaptureInterceptor;
233
234#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
235impl ::aws_smithy_runtime_api::client::interceptors::Intercept for PutAttachmentTelemetryInputCaptureInterceptor {
236 fn name(&self) -> &'static str {
237 "PutAttachmentTelemetryInputCaptureInterceptor"
238 }
239
240 fn read_before_execution(
241 &self,
242 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
243 '_,
244 ::aws_smithy_runtime_api::client::interceptors::context::Input,
245 ::aws_smithy_runtime_api::client::interceptors::context::Output,
246 ::aws_smithy_runtime_api::client::interceptors::context::Error,
247 >,
248 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
249 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
250 let ::std::option::Option::Some(requested) = cfg
252 .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
253 .filter(|r| !r.is_empty())
254 else {
255 return ::std::result::Result::Ok(());
256 };
257
258 let ::std::option::Option::Some(input) = context.input().downcast_ref::<PutAttachmentInput>() else {
259 return ::std::result::Result::Ok(());
261 };
262
263 let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
264 if requested.should_capture("AssetIdentifier") {
265 if let ::std::option::Option::Some(value) = input.asset_identifier.as_deref() {
266 captured.insert("AssetIdentifier", value);
267 }
268 }
269 if requested.should_capture("IterableFormName") {
270 if let ::std::option::Option::Some(value) = input.iterable_form_name.as_deref() {
271 captured.insert("IterableFormName", value);
272 }
273 }
274 if requested.should_capture("ItemIdentifier") {
275 if let ::std::option::Option::Some(value) = input.item_identifier.as_deref() {
276 captured.insert("ItemIdentifier", value);
277 }
278 }
279 if requested.should_capture("AttachmentName") {
280 if let ::std::option::Option::Some(value) = input.attachment_name.as_deref() {
281 captured.insert("AttachmentName", value);
282 }
283 }
284 if requested.should_capture("Content") {
285 if let ::std::option::Option::Some(value) = input.content.as_deref() {
286 captured.insert("Content", value);
287 }
288 }
289 if requested.should_capture("FormTypeIdentifier") {
290 if let ::std::option::Option::Some(value) = input.form_type_identifier.as_deref() {
291 captured.insert("FormTypeIdentifier", value);
292 }
293 }
294 if requested.should_capture("ClientToken") {
295 if let ::std::option::Option::Some(value) = input.client_token.as_deref() {
296 captured.insert("ClientToken", value);
297 }
298 }
299
300 cfg.interceptor_state().store_put(captured);
301 ::std::result::Result::Ok(())
302 }
303}
304#[derive(Debug)]
305struct PutAttachmentResponseDeserializer;
306impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for PutAttachmentResponseDeserializer {
307 fn deserialize_nonstreaming_with_config(
308 &self,
309 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
310 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
311 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
312 let (success, status) = (response.status().is_success(), response.status().as_u16());
313 #[allow(unused_variables)]
318 let body = response.body().bytes().expect("body loaded");
319 let headers = response.headers();
320 #[allow(unused_mut)]
321 let mut force_error = false;
322 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
323 if !success && status != 200 || force_error {
324 let protocol = _cfg
325 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
326 .expect("a SharedClientProtocol is required");
327 #[allow(unused_mut)]
328 let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
329 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
330 })?;
331 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
332 let generic = generic_builder.build();
333 let error_code = match generic.code() {
334 ::std::option::Option::Some(code) => code,
335 ::std::option::Option::None => {
336 return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
337 ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::put_attachment::PutAttachmentError::unhandled(generic)),
338 ))
339 }
340 };
341 let _error_message = generic.message().map(|msg| msg.to_owned());
342 let err = match error_code {
343 "AccessDeniedException" => crate::operation::put_attachment::PutAttachmentError::AccessDeniedException({
344 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
345 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
346 e,
347 ))
348 })?;
349 let mut tmp = <crate::types::error::builders::AccessDeniedExceptionBuilder>::default();
350 tmp.deserialize_members(&mut *deser).map_err(|e| {
351 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
352 e,
353 ))
354 })?;
355 if tmp.message.is_none() {
356 tmp.message = _error_message;
357 }
358 let tmp = tmp.meta(generic);
359 tmp.build()
360 }),
361 "ConcurrentModificationException" => crate::operation::put_attachment::PutAttachmentError::ConcurrentModificationException({
362 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
363 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
364 e,
365 ))
366 })?;
367 let mut tmp = <crate::types::error::builders::ConcurrentModificationExceptionBuilder>::default();
368 tmp.deserialize_members(&mut *deser).map_err(|e| {
369 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
370 e,
371 ))
372 })?;
373 if tmp.message.is_none() {
374 tmp.message = _error_message;
375 }
376 let tmp = tmp.meta(generic);
377 tmp.build()
378 }),
379 "EntityNotFoundException" => crate::operation::put_attachment::PutAttachmentError::EntityNotFoundException({
380 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
381 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
382 e,
383 ))
384 })?;
385 let mut tmp = <crate::types::error::builders::EntityNotFoundExceptionBuilder>::default();
386 tmp.deserialize_members(&mut *deser).map_err(|e| {
387 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
388 e,
389 ))
390 })?;
391 if tmp.message.is_none() {
392 tmp.message = _error_message;
393 }
394 let tmp = tmp.meta(generic);
395 tmp.build()
396 }),
397 "InternalServiceException" => crate::operation::put_attachment::PutAttachmentError::InternalServiceException({
398 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
399 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
400 e,
401 ))
402 })?;
403 let mut tmp = <crate::types::error::builders::InternalServiceExceptionBuilder>::default();
404 tmp.deserialize_members(&mut *deser).map_err(|e| {
405 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
406 e,
407 ))
408 })?;
409 if tmp.message.is_none() {
410 tmp.message = _error_message;
411 }
412 let tmp = tmp.meta(generic);
413 tmp.build()
414 }),
415 "InvalidInputException" => crate::operation::put_attachment::PutAttachmentError::InvalidInputException({
416 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
417 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
418 e,
419 ))
420 })?;
421 let mut tmp = <crate::types::error::builders::InvalidInputExceptionBuilder>::default();
422 tmp.deserialize_members(&mut *deser).map_err(|e| {
423 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
424 e,
425 ))
426 })?;
427 if tmp.message.is_none() {
428 tmp.message = _error_message;
429 }
430 let tmp = tmp.meta(generic);
431 tmp.build()
432 }),
433 "ThrottlingException" => crate::operation::put_attachment::PutAttachmentError::ThrottlingException({
434 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
435 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
436 e,
437 ))
438 })?;
439 let mut tmp = <crate::types::error::builders::ThrottlingExceptionBuilder>::default();
440 tmp.deserialize_members(&mut *deser).map_err(|e| {
441 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
442 e,
443 ))
444 })?;
445 if tmp.message.is_none() {
446 tmp.message = _error_message;
447 }
448 let tmp = tmp.meta(generic);
449 tmp.build()
450 }),
451 _ => {
452 match protocol
460 .deserialize_error_response(response, _cfg)
461 .ok()
462 .and_then(|mut deser| {
463 ::aws_smithy_schema::registry::reify_error(
464 crate::operation::put_attachment::error_registry::REGISTRY
465 .or(&crate::error_type_registry::REGISTRY),
466 error_code,
467 &mut *deser,
468 )
469 }) {
470 ::std::option::Option::Some(source) => <crate::operation::put_attachment::PutAttachmentError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
471 ::std::option::Option::None => crate::operation::put_attachment::PutAttachmentError::generic(generic),
472 }
473 }
474 };
475 ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
476 ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
477 ))
478 } else {
479 let protocol = _cfg
480 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
481 .expect("a SharedClientProtocol is required");
482 let mut deser = protocol.deserialize_response(response, PutAttachment::OUTPUT_SCHEMA, _cfg).map_err(|e| {
483 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
484 })?;
485 let _response_headers = headers;
489 #[allow(unused_mut)]
493 let mut output = <crate::operation::put_attachment::builders::PutAttachmentOutputBuilder>::default();
494 output.deserialize_members(&mut *deser).map_err(|e| {
495 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
496 })?;
497 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
498 let output = output.build();
499 ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
500 }
501 }
502}
503#[derive(Debug)]
504struct PutAttachmentRequestSerializer;
505impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for PutAttachmentRequestSerializer {
506 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
507 fn serialize_input(
508 &self,
509 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
510 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
511 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
512 let input = input
513 .downcast::<crate::operation::put_attachment::PutAttachmentInput>()
514 .expect("correct type");
515 let _required_check = input
516 .asset_identifier
517 .as_ref()
518 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("asset_identifier", "cannot be empty or unset"))?;
519 if _required_check.is_empty() {
520 return ::std::result::Result::Err(
521 ::aws_smithy_types::error::operation::BuildError::missing_field("asset_identifier", "cannot be empty or unset").into(),
522 );
523 }
524 let protocol = _cfg
525 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
526 .expect("a SharedClientProtocol is required");
527 let mut request = protocol
528 .serialize_request(&input, PutAttachment::INPUT_SCHEMA, "/", _cfg)
529 .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
530
531 return ::std::result::Result::Ok(request);
532 }
533}
534#[derive(Debug)]
535struct PutAttachmentEndpointParamsInterceptor;
536
537#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
538impl ::aws_smithy_runtime_api::client::interceptors::Intercept for PutAttachmentEndpointParamsInterceptor {
539 fn name(&self) -> &'static str {
540 "PutAttachmentEndpointParamsInterceptor"
541 }
542
543 fn read_before_execution(
544 &self,
545 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
546 '_,
547 ::aws_smithy_runtime_api::client::interceptors::context::Input,
548 ::aws_smithy_runtime_api::client::interceptors::context::Output,
549 ::aws_smithy_runtime_api::client::interceptors::context::Error,
550 >,
551 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
552 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
553 let _input = context
554 .input()
555 .downcast_ref::<PutAttachmentInput>()
556 .ok_or("failed to downcast to PutAttachmentInput")?;
557
558 let params = crate::config::endpoint::Params::builder()
559 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
560 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
561 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
562 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
563 .build()
564 .map_err(|err| {
565 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
566 })?;
567 cfg.interceptor_state()
568 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
569 ::std::result::Result::Ok(())
570 }
571}
572
573#[non_exhaustive]
578#[derive(::std::fmt::Debug)]
579pub enum PutAttachmentError {
580 AccessDeniedException(crate::types::error::AccessDeniedException),
582 ConcurrentModificationException(crate::types::error::ConcurrentModificationException),
584 EntityNotFoundException(crate::types::error::EntityNotFoundException),
586 InternalServiceException(crate::types::error::InternalServiceException),
588 InvalidInputException(crate::types::error::InvalidInputException),
590 ThrottlingException(crate::types::error::ThrottlingException),
592 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
594 variable wildcard pattern and check `.code()`:
595 \
596 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
597 \
598 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-PutAttachmentError) for what information is available for the error.")]
599 Unhandled(crate::error::sealed_unhandled::Unhandled),
600}
601impl PutAttachmentError {
602 pub fn unhandled(
604 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
605 ) -> Self {
606 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
607 source: err.into(),
608 meta: ::std::default::Default::default(),
609 })
610 }
611
612 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
614 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
615 source: err.clone().into(),
616 meta: err,
617 })
618 }
619 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
624 match self {
625 Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
626 Self::ConcurrentModificationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
627 Self::EntityNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
628 Self::InternalServiceException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
629 Self::InvalidInputException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
630 Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
631 Self::Unhandled(e) => &e.meta,
632 }
633 }
634 pub fn is_access_denied_exception(&self) -> bool {
636 matches!(self, Self::AccessDeniedException(_))
637 }
638 pub fn is_concurrent_modification_exception(&self) -> bool {
640 matches!(self, Self::ConcurrentModificationException(_))
641 }
642 pub fn is_entity_not_found_exception(&self) -> bool {
644 matches!(self, Self::EntityNotFoundException(_))
645 }
646 pub fn is_internal_service_exception(&self) -> bool {
648 matches!(self, Self::InternalServiceException(_))
649 }
650 pub fn is_invalid_input_exception(&self) -> bool {
652 matches!(self, Self::InvalidInputException(_))
653 }
654 pub fn is_throttling_exception(&self) -> bool {
656 matches!(self, Self::ThrottlingException(_))
657 }
658}
659impl ::std::error::Error for PutAttachmentError {
660 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
661 match self {
662 Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
663 Self::ConcurrentModificationException(_inner) => ::std::option::Option::Some(_inner),
664 Self::EntityNotFoundException(_inner) => ::std::option::Option::Some(_inner),
665 Self::InternalServiceException(_inner) => ::std::option::Option::Some(_inner),
666 Self::InvalidInputException(_inner) => ::std::option::Option::Some(_inner),
667 Self::ThrottlingException(_inner) => ::std::option::Option::Some(_inner),
668 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
669 }
670 }
671}
672impl ::std::fmt::Display for PutAttachmentError {
673 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
674 match self {
675 Self::AccessDeniedException(_inner) => _inner.fmt(f),
676 Self::ConcurrentModificationException(_inner) => _inner.fmt(f),
677 Self::EntityNotFoundException(_inner) => _inner.fmt(f),
678 Self::InternalServiceException(_inner) => _inner.fmt(f),
679 Self::InvalidInputException(_inner) => _inner.fmt(f),
680 Self::ThrottlingException(_inner) => _inner.fmt(f),
681 Self::Unhandled(_inner) => {
682 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
683 write!(f, "unhandled error ({code})")
684 } else {
685 f.write_str("unhandled error")
686 }
687 }
688 }
689 }
690}
691impl ::aws_smithy_types::retry::ProvideErrorKind for PutAttachmentError {
692 fn code(&self) -> ::std::option::Option<&str> {
693 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
694 }
695 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
696 ::std::option::Option::None
697 }
698}
699impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for PutAttachmentError {
700 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
701 match self {
702 Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
703 Self::ConcurrentModificationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
704 Self::EntityNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
705 Self::InternalServiceException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
706 Self::InvalidInputException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
707 Self::ThrottlingException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
708 Self::Unhandled(_inner) => &_inner.meta,
709 }
710 }
711}
712impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for PutAttachmentError {
713 fn create_unhandled_error(
714 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
715 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
716 ) -> Self {
717 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
718 source,
719 meta: meta.unwrap_or_default(),
720 })
721 }
722}
723impl ::aws_types::request_id::RequestId for crate::operation::put_attachment::PutAttachmentError {
724 fn request_id(&self) -> Option<&str> {
725 self.meta().request_id()
726 }
727}
728
729pub use crate::operation::put_attachment::_put_attachment_input::PutAttachmentInput;
730
731pub use crate::operation::put_attachment::_put_attachment_output::PutAttachmentOutput;
732
733mod _put_attachment_input;
734
735mod _put_attachment_output;
736
737pub mod builders;