1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct CreateDatabase;
6impl CreateDatabase {
7 pub fn new() -> Self {
9 Self
10 }
11 pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::create_database::CreateDatabaseInput::SCHEMA;
13 pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::create_database::CreateDatabaseOutput::SCHEMA;
15 pub(crate) async fn orchestrate(
16 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17 input: crate::operation::create_database::CreateDatabaseInput,
18 ) -> ::std::result::Result<
19 crate::operation::create_database::CreateDatabaseOutput,
20 ::aws_smithy_runtime_api::client::result::SdkError<
21 crate::operation::create_database::CreateDatabaseError,
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::create_database::CreateDatabaseError>()
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::create_database::CreateDatabaseOutput>()
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::create_database::CreateDatabaseInput,
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", "CreateDatabase", input, runtime_plugins, stop_point)
59 .instrument(::tracing::debug_span!(
62 "Glue.CreateDatabase",
63 "rpc.service" = "Glue",
64 "rpc.method" = "CreateDatabase",
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
78 if let ::std::option::Option::Some(config_override) = config_override {
79 for plugin in config_override.runtime_plugins.iter().cloned() {
80 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
81 }
82 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
83 config_override,
84 client_config.config.clone(),
85 &client_config.runtime_components,
86 ));
87 }
88 runtime_plugins
89 }
90}
91pub(crate) mod error_registry {
100 pub(crate) static REGISTRY: ::std::sync::LazyLock<::aws_smithy_schema::registry::TypeRegistry> = ::std::sync::LazyLock::new(|| {
101 ::aws_smithy_schema::registry::TypeRegistry::builder()
102 .insert_error_shape(
103 crate::types::error::AlreadyExistsException::SCHEMA,
104 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
105 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::AlreadyExistsException::deserialize(d)?))
106 },
107 |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> {
108 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::AlreadyExistsException::deserialize(d)?))
109 },
110 )
111.insert_error_shape(
112 crate::types::error::ConcurrentModificationException::SCHEMA,
113 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
114 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ConcurrentModificationException::deserialize(d)?))
115 },
116 |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> {
117 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ConcurrentModificationException::deserialize(d)?))
118 },
119 )
120.insert_error_shape(
121 crate::types::error::FederatedResourceAlreadyExistsException::SCHEMA,
122 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
123 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::FederatedResourceAlreadyExistsException::deserialize(d)?))
124 },
125 |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> {
126 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::FederatedResourceAlreadyExistsException::deserialize(d)?))
127 },
128 )
129.insert_error_shape(
130 crate::types::error::FederationSourceException::SCHEMA,
131 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
132 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::FederationSourceException::deserialize(d)?))
133 },
134 |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> {
135 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::FederationSourceException::deserialize(d)?))
136 },
137 )
138.insert_error_shape(
139 crate::types::error::FederationSourceRetryableException::SCHEMA,
140 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
141 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::FederationSourceRetryableException::deserialize(d)?))
142 },
143 |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> {
144 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::FederationSourceRetryableException::deserialize(d)?))
145 },
146 )
147.insert_error_shape(
148 crate::types::error::GlueEncryptionException::SCHEMA,
149 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
150 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::GlueEncryptionException::deserialize(d)?))
151 },
152 |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> {
153 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::GlueEncryptionException::deserialize(d)?))
154 },
155 )
156.insert_error_shape(
157 crate::types::error::InternalServiceException::SCHEMA,
158 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
159 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InternalServiceException::deserialize(d)?))
160 },
161 |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> {
162 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InternalServiceException::deserialize(d)?))
163 },
164 )
165.insert_error_shape(
166 crate::types::error::InvalidInputException::SCHEMA,
167 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
168 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidInputException::deserialize(d)?))
169 },
170 |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> {
171 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidInputException::deserialize(d)?))
172 },
173 )
174.insert_error_shape(
175 crate::types::error::OperationTimeoutException::SCHEMA,
176 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
177 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::OperationTimeoutException::deserialize(d)?))
178 },
179 |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> {
180 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::OperationTimeoutException::deserialize(d)?))
181 },
182 )
183.insert_error_shape(
184 crate::types::error::ResourceNumberLimitExceededException::SCHEMA,
185 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
186 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ResourceNumberLimitExceededException::deserialize(d)?))
187 },
188 |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> {
189 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ResourceNumberLimitExceededException::deserialize(d)?))
190 },
191 )
192 .build()
193 });
194}
195impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for CreateDatabase {
196 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
197 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("CreateDatabase");
198
199 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
200 CreateDatabaseRequestSerializer,
201 ));
202 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
203 CreateDatabaseResponseDeserializer,
204 ));
205
206 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
207 crate::config::auth::Params::builder()
208 .operation_name("CreateDatabase")
209 .build()
210 .expect("required fields set"),
211 ));
212
213 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("CreateDatabase", "Glue"));
214 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
215 signing_options.double_uri_encode = true;
216 signing_options.content_sha256_header = false;
217 signing_options.normalize_uri_path = true;
218 signing_options.payload_override = None;
219
220 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
221 signing_options,
222 ..::std::default::Default::default()
223 });
224
225 ::std::option::Option::Some(cfg.freeze())
226 }
227
228 fn runtime_components(
229 &self,
230 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
231 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
232 #[allow(unused_mut)]
233 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("CreateDatabase")
234 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
235 CreateDatabaseTelemetryInputCaptureInterceptor,
236 ))
237 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
238 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
239 ))
240 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
241 CreateDatabaseEndpointParamsInterceptor,
242 ))
243 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
244 crate::operation::create_database::CreateDatabaseError,
245 >::new())
246 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
247 crate::operation::create_database::CreateDatabaseError,
248 >::new())
249 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
250 crate::operation::create_database::CreateDatabaseError,
251 >::new())
252 .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
253 crate::operation::create_database::CreateDatabaseError,
254 >::new());
255
256 ::std::borrow::Cow::Owned(rcb)
257 }
258}
259
260#[derive(Debug)]
261struct CreateDatabaseTelemetryInputCaptureInterceptor;
262
263#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
264impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateDatabaseTelemetryInputCaptureInterceptor {
265 fn name(&self) -> &'static str {
266 "CreateDatabaseTelemetryInputCaptureInterceptor"
267 }
268
269 fn read_before_execution(
270 &self,
271 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
272 '_,
273 ::aws_smithy_runtime_api::client::interceptors::context::Input,
274 ::aws_smithy_runtime_api::client::interceptors::context::Output,
275 ::aws_smithy_runtime_api::client::interceptors::context::Error,
276 >,
277 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
278 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
279 let ::std::option::Option::Some(requested) = cfg
281 .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
282 .filter(|r| !r.is_empty())
283 else {
284 return ::std::result::Result::Ok(());
285 };
286
287 let ::std::option::Option::Some(input) = context.input().downcast_ref::<CreateDatabaseInput>() else {
288 return ::std::result::Result::Ok(());
290 };
291
292 let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
293 if requested.should_capture("CatalogId") {
294 if let ::std::option::Option::Some(value) = input.catalog_id.as_deref() {
295 captured.insert("CatalogId", value);
296 }
297 }
298
299 cfg.interceptor_state().store_put(captured);
300 ::std::result::Result::Ok(())
301 }
302}
303#[derive(Debug)]
304struct CreateDatabaseResponseDeserializer;
305impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreateDatabaseResponseDeserializer {
306 fn deserialize_nonstreaming_with_config(
307 &self,
308 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
309 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
310 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
311 let (success, status) = (response.status().is_success(), response.status().as_u16());
312 #[allow(unused_variables)]
317 let body = response.body().bytes().expect("body loaded");
318 let headers = response.headers();
319 #[allow(unused_mut)]
320 let mut force_error = false;
321 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
322 if !success && status != 200 || force_error {
323 let protocol = _cfg
324 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
325 .expect("a SharedClientProtocol is required");
326 #[allow(unused_mut)]
327 let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
328 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
329 })?;
330 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
331 let generic = generic_builder.build();
332 let error_code = match generic.code() {
333 ::std::option::Option::Some(code) => code,
334 ::std::option::Option::None => {
335 return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
336 ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::create_database::CreateDatabaseError::unhandled(
337 generic,
338 )),
339 ))
340 }
341 };
342 let _error_message = generic.message().map(|msg| msg.to_owned());
343 let err = match error_code {
344 "AlreadyExistsException" => crate::operation::create_database::CreateDatabaseError::AlreadyExistsException({
345 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
346 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
347 e,
348 ))
349 })?;
350 let mut tmp = <crate::types::error::builders::AlreadyExistsExceptionBuilder>::default();
351 tmp.deserialize_members(&mut *deser).map_err(|e| {
352 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
353 e,
354 ))
355 })?;
356 if tmp.message.is_none() {
357 tmp.message = _error_message;
358 }
359 let tmp = tmp.meta(generic);
360 tmp.build()
361 }),
362 "ConcurrentModificationException" => crate::operation::create_database::CreateDatabaseError::ConcurrentModificationException({
363 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
364 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
365 e,
366 ))
367 })?;
368 let mut tmp = <crate::types::error::builders::ConcurrentModificationExceptionBuilder>::default();
369 tmp.deserialize_members(&mut *deser).map_err(|e| {
370 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
371 e,
372 ))
373 })?;
374 if tmp.message.is_none() {
375 tmp.message = _error_message;
376 }
377 let tmp = tmp.meta(generic);
378 tmp.build()
379 }),
380 "FederatedResourceAlreadyExistsException" => {
381 crate::operation::create_database::CreateDatabaseError::FederatedResourceAlreadyExistsException({
382 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
383 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
384 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
385 )
386 })?;
387 let mut tmp = <crate::types::error::builders::FederatedResourceAlreadyExistsExceptionBuilder>::default();
388 tmp.deserialize_members(&mut *deser).map_err(|e| {
389 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
390 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
391 )
392 })?;
393 if tmp.message.is_none() {
394 tmp.message = _error_message;
395 }
396 let tmp = tmp.meta(generic);
397 tmp.build()
398 })
399 }
400 "FederationSourceException" => crate::operation::create_database::CreateDatabaseError::FederationSourceException({
401 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
402 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
403 e,
404 ))
405 })?;
406 let mut tmp = <crate::types::error::builders::FederationSourceExceptionBuilder>::default();
407 tmp.deserialize_members(&mut *deser).map_err(|e| {
408 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
409 e,
410 ))
411 })?;
412 if tmp.message.is_none() {
413 tmp.message = _error_message;
414 }
415 let tmp = tmp.meta(generic);
416 tmp.build()
417 }),
418 "FederationSourceRetryableException" => crate::operation::create_database::CreateDatabaseError::FederationSourceRetryableException({
419 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
420 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
421 e,
422 ))
423 })?;
424 let mut tmp = <crate::types::error::builders::FederationSourceRetryableExceptionBuilder>::default();
425 tmp.deserialize_members(&mut *deser).map_err(|e| {
426 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
427 e,
428 ))
429 })?;
430 if tmp.message.is_none() {
431 tmp.message = _error_message;
432 }
433 let tmp = tmp.meta(generic);
434 tmp.build()
435 }),
436 "GlueEncryptionException" => crate::operation::create_database::CreateDatabaseError::GlueEncryptionException({
437 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
438 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
439 e,
440 ))
441 })?;
442 let mut tmp = <crate::types::error::builders::GlueEncryptionExceptionBuilder>::default();
443 tmp.deserialize_members(&mut *deser).map_err(|e| {
444 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
445 e,
446 ))
447 })?;
448 if tmp.message.is_none() {
449 tmp.message = _error_message;
450 }
451 let tmp = tmp.meta(generic);
452 tmp.build()
453 }),
454 "InternalServiceException" => crate::operation::create_database::CreateDatabaseError::InternalServiceException({
455 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
456 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
457 e,
458 ))
459 })?;
460 let mut tmp = <crate::types::error::builders::InternalServiceExceptionBuilder>::default();
461 tmp.deserialize_members(&mut *deser).map_err(|e| {
462 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
463 e,
464 ))
465 })?;
466 if tmp.message.is_none() {
467 tmp.message = _error_message;
468 }
469 let tmp = tmp.meta(generic);
470 tmp.build()
471 }),
472 "InvalidInputException" => crate::operation::create_database::CreateDatabaseError::InvalidInputException({
473 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
474 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
475 e,
476 ))
477 })?;
478 let mut tmp = <crate::types::error::builders::InvalidInputExceptionBuilder>::default();
479 tmp.deserialize_members(&mut *deser).map_err(|e| {
480 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
481 e,
482 ))
483 })?;
484 if tmp.message.is_none() {
485 tmp.message = _error_message;
486 }
487 let tmp = tmp.meta(generic);
488 tmp.build()
489 }),
490 "OperationTimeoutException" => crate::operation::create_database::CreateDatabaseError::OperationTimeoutException({
491 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
492 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
493 e,
494 ))
495 })?;
496 let mut tmp = <crate::types::error::builders::OperationTimeoutExceptionBuilder>::default();
497 tmp.deserialize_members(&mut *deser).map_err(|e| {
498 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
499 e,
500 ))
501 })?;
502 if tmp.message.is_none() {
503 tmp.message = _error_message;
504 }
505 let tmp = tmp.meta(generic);
506 tmp.build()
507 }),
508 "ResourceNumberLimitExceededException" => {
509 crate::operation::create_database::CreateDatabaseError::ResourceNumberLimitExceededException({
510 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
511 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
512 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
513 )
514 })?;
515 let mut tmp = <crate::types::error::builders::ResourceNumberLimitExceededExceptionBuilder>::default();
516 tmp.deserialize_members(&mut *deser).map_err(|e| {
517 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
518 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
519 )
520 })?;
521 if tmp.message.is_none() {
522 tmp.message = _error_message;
523 }
524 let tmp = tmp.meta(generic);
525 tmp.build()
526 })
527 }
528 _ => {
529 match protocol
537 .deserialize_error_response(response, _cfg)
538 .ok()
539 .and_then(|mut deser| {
540 ::aws_smithy_schema::registry::reify_error(
541 crate::operation::create_database::error_registry::REGISTRY
542 .or(&crate::error_type_registry::REGISTRY),
543 error_code,
544 &mut *deser,
545 )
546 }) {
547 ::std::option::Option::Some(source) => <crate::operation::create_database::CreateDatabaseError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
548 ::std::option::Option::None => crate::operation::create_database::CreateDatabaseError::generic(generic),
549 }
550 }
551 };
552 ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
553 ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
554 ))
555 } else {
556 let protocol = _cfg
557 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
558 .expect("a SharedClientProtocol is required");
559 let mut deser = protocol
560 .deserialize_response(response, CreateDatabase::OUTPUT_SCHEMA, _cfg)
561 .map_err(|e| {
562 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
563 })?;
564 let _response_headers = headers;
568 #[allow(unused_mut)]
572 let mut output = <crate::operation::create_database::builders::CreateDatabaseOutputBuilder>::default();
573 output.deserialize_members(&mut *deser).map_err(|e| {
574 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
575 })?;
576 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
577 let output = output.build();
578 ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
579 }
580 }
581}
582#[derive(Debug)]
583struct CreateDatabaseRequestSerializer;
584impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreateDatabaseRequestSerializer {
585 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
586 fn serialize_input(
587 &self,
588 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
589 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
590 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
591 let input = input
592 .downcast::<crate::operation::create_database::CreateDatabaseInput>()
593 .expect("correct type");
594
595 let protocol = _cfg
596 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
597 .expect("a SharedClientProtocol is required");
598 let mut request = protocol
599 .serialize_request(&input, CreateDatabase::INPUT_SCHEMA, "/", _cfg)
600 .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
601
602 return ::std::result::Result::Ok(request);
603 }
604}
605#[derive(Debug)]
606struct CreateDatabaseEndpointParamsInterceptor;
607
608#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
609impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateDatabaseEndpointParamsInterceptor {
610 fn name(&self) -> &'static str {
611 "CreateDatabaseEndpointParamsInterceptor"
612 }
613
614 fn read_before_execution(
615 &self,
616 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
617 '_,
618 ::aws_smithy_runtime_api::client::interceptors::context::Input,
619 ::aws_smithy_runtime_api::client::interceptors::context::Output,
620 ::aws_smithy_runtime_api::client::interceptors::context::Error,
621 >,
622 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
623 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
624 let _input = context
625 .input()
626 .downcast_ref::<CreateDatabaseInput>()
627 .ok_or("failed to downcast to CreateDatabaseInput")?;
628
629 let params = crate::config::endpoint::Params::builder()
630 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
631 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
632 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
633 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
634 .build()
635 .map_err(|err| {
636 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
637 })?;
638 cfg.interceptor_state()
639 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
640 ::std::result::Result::Ok(())
641 }
642}
643
644#[non_exhaustive]
649#[derive(::std::fmt::Debug)]
650pub enum CreateDatabaseError {
651 AlreadyExistsException(crate::types::error::AlreadyExistsException),
653 ConcurrentModificationException(crate::types::error::ConcurrentModificationException),
655 FederatedResourceAlreadyExistsException(crate::types::error::FederatedResourceAlreadyExistsException),
657 FederationSourceException(crate::types::error::FederationSourceException),
659 FederationSourceRetryableException(crate::types::error::FederationSourceRetryableException),
661 GlueEncryptionException(crate::types::error::GlueEncryptionException),
663 InternalServiceException(crate::types::error::InternalServiceException),
665 InvalidInputException(crate::types::error::InvalidInputException),
667 OperationTimeoutException(crate::types::error::OperationTimeoutException),
669 ResourceNumberLimitExceededException(crate::types::error::ResourceNumberLimitExceededException),
671 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
673 variable wildcard pattern and check `.code()`:
674 \
675 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
676 \
677 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CreateDatabaseError) for what information is available for the error.")]
678 Unhandled(crate::error::sealed_unhandled::Unhandled),
679}
680impl CreateDatabaseError {
681 pub fn unhandled(
683 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
684 ) -> Self {
685 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
686 source: err.into(),
687 meta: ::std::default::Default::default(),
688 })
689 }
690
691 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
693 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
694 source: err.clone().into(),
695 meta: err,
696 })
697 }
698 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
703 match self {
704 Self::AlreadyExistsException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
705 Self::ConcurrentModificationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
706 Self::FederatedResourceAlreadyExistsException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
707 Self::FederationSourceException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
708 Self::FederationSourceRetryableException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
709 Self::GlueEncryptionException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
710 Self::InternalServiceException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
711 Self::InvalidInputException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
712 Self::OperationTimeoutException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
713 Self::ResourceNumberLimitExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
714 Self::Unhandled(e) => &e.meta,
715 }
716 }
717 pub fn is_already_exists_exception(&self) -> bool {
719 matches!(self, Self::AlreadyExistsException(_))
720 }
721 pub fn is_concurrent_modification_exception(&self) -> bool {
723 matches!(self, Self::ConcurrentModificationException(_))
724 }
725 pub fn is_federated_resource_already_exists_exception(&self) -> bool {
727 matches!(self, Self::FederatedResourceAlreadyExistsException(_))
728 }
729 pub fn is_federation_source_exception(&self) -> bool {
731 matches!(self, Self::FederationSourceException(_))
732 }
733 pub fn is_federation_source_retryable_exception(&self) -> bool {
735 matches!(self, Self::FederationSourceRetryableException(_))
736 }
737 pub fn is_glue_encryption_exception(&self) -> bool {
739 matches!(self, Self::GlueEncryptionException(_))
740 }
741 pub fn is_internal_service_exception(&self) -> bool {
743 matches!(self, Self::InternalServiceException(_))
744 }
745 pub fn is_invalid_input_exception(&self) -> bool {
747 matches!(self, Self::InvalidInputException(_))
748 }
749 pub fn is_operation_timeout_exception(&self) -> bool {
751 matches!(self, Self::OperationTimeoutException(_))
752 }
753 pub fn is_resource_number_limit_exceeded_exception(&self) -> bool {
755 matches!(self, Self::ResourceNumberLimitExceededException(_))
756 }
757}
758impl ::std::error::Error for CreateDatabaseError {
759 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
760 match self {
761 Self::AlreadyExistsException(_inner) => ::std::option::Option::Some(_inner),
762 Self::ConcurrentModificationException(_inner) => ::std::option::Option::Some(_inner),
763 Self::FederatedResourceAlreadyExistsException(_inner) => ::std::option::Option::Some(_inner),
764 Self::FederationSourceException(_inner) => ::std::option::Option::Some(_inner),
765 Self::FederationSourceRetryableException(_inner) => ::std::option::Option::Some(_inner),
766 Self::GlueEncryptionException(_inner) => ::std::option::Option::Some(_inner),
767 Self::InternalServiceException(_inner) => ::std::option::Option::Some(_inner),
768 Self::InvalidInputException(_inner) => ::std::option::Option::Some(_inner),
769 Self::OperationTimeoutException(_inner) => ::std::option::Option::Some(_inner),
770 Self::ResourceNumberLimitExceededException(_inner) => ::std::option::Option::Some(_inner),
771 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
772 }
773 }
774}
775impl ::std::fmt::Display for CreateDatabaseError {
776 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
777 match self {
778 Self::AlreadyExistsException(_inner) => _inner.fmt(f),
779 Self::ConcurrentModificationException(_inner) => _inner.fmt(f),
780 Self::FederatedResourceAlreadyExistsException(_inner) => _inner.fmt(f),
781 Self::FederationSourceException(_inner) => _inner.fmt(f),
782 Self::FederationSourceRetryableException(_inner) => _inner.fmt(f),
783 Self::GlueEncryptionException(_inner) => _inner.fmt(f),
784 Self::InternalServiceException(_inner) => _inner.fmt(f),
785 Self::InvalidInputException(_inner) => _inner.fmt(f),
786 Self::OperationTimeoutException(_inner) => _inner.fmt(f),
787 Self::ResourceNumberLimitExceededException(_inner) => _inner.fmt(f),
788 Self::Unhandled(_inner) => {
789 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
790 write!(f, "unhandled error ({code})")
791 } else {
792 f.write_str("unhandled error")
793 }
794 }
795 }
796 }
797}
798impl ::aws_smithy_types::retry::ProvideErrorKind for CreateDatabaseError {
799 fn code(&self) -> ::std::option::Option<&str> {
800 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
801 }
802 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
803 ::std::option::Option::None
804 }
805}
806impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CreateDatabaseError {
807 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
808 match self {
809 Self::AlreadyExistsException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
810 Self::ConcurrentModificationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
811 Self::FederatedResourceAlreadyExistsException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
812 Self::FederationSourceException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
813 Self::FederationSourceRetryableException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
814 Self::GlueEncryptionException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
815 Self::InternalServiceException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
816 Self::InvalidInputException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
817 Self::OperationTimeoutException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
818 Self::ResourceNumberLimitExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
819 Self::Unhandled(_inner) => &_inner.meta,
820 }
821 }
822}
823impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CreateDatabaseError {
824 fn create_unhandled_error(
825 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
826 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
827 ) -> Self {
828 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
829 source,
830 meta: meta.unwrap_or_default(),
831 })
832 }
833}
834impl ::aws_types::request_id::RequestId for crate::operation::create_database::CreateDatabaseError {
835 fn request_id(&self) -> Option<&str> {
836 self.meta().request_id()
837 }
838}
839
840pub use crate::operation::create_database::_create_database_input::CreateDatabaseInput;
841
842pub use crate::operation::create_database::_create_database_output::CreateDatabaseOutput;
843
844mod _create_database_input;
845
846mod _create_database_output;
847
848pub mod builders;