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