1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct CreateCrawler;
6impl CreateCrawler {
7 pub fn new() -> Self {
9 Self
10 }
11 pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::create_crawler::CreateCrawlerInput::SCHEMA;
13 pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::create_crawler::CreateCrawlerOutput::SCHEMA;
15 pub(crate) async fn orchestrate(
16 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17 input: crate::operation::create_crawler::CreateCrawlerInput,
18 ) -> ::std::result::Result<
19 crate::operation::create_crawler::CreateCrawlerOutput,
20 ::aws_smithy_runtime_api::client::result::SdkError<
21 crate::operation::create_crawler::CreateCrawlerError,
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_crawler::CreateCrawlerError>()
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_crawler::CreateCrawlerOutput>()
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_crawler::CreateCrawlerInput,
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", "CreateCrawler", input, runtime_plugins, stop_point)
59 .instrument(::tracing::debug_span!(
62 "Glue.CreateCrawler",
63 "rpc.service" = "Glue",
64 "rpc.method" = "CreateCrawler",
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::InvalidInputException::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::InvalidInputException::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::InvalidInputException::deserialize(d)?))
118 },
119 )
120.insert_error_shape(
121 crate::types::error::OperationTimeoutException::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::OperationTimeoutException::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::OperationTimeoutException::deserialize(d)?))
127 },
128 )
129.insert_error_shape(
130 crate::types::error::ResourceNumberLimitExceededException::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::ResourceNumberLimitExceededException::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::ResourceNumberLimitExceededException::deserialize(d)?))
136 },
137 )
138 .build()
139 });
140}
141impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for CreateCrawler {
142 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
143 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("CreateCrawler");
144
145 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
146 CreateCrawlerRequestSerializer,
147 ));
148 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
149 CreateCrawlerResponseDeserializer,
150 ));
151
152 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
153 crate::config::auth::Params::builder()
154 .operation_name("CreateCrawler")
155 .build()
156 .expect("required fields set"),
157 ));
158
159 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("CreateCrawler", "Glue"));
160 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
161 signing_options.double_uri_encode = true;
162 signing_options.content_sha256_header = false;
163 signing_options.normalize_uri_path = true;
164 signing_options.payload_override = None;
165
166 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
167 signing_options,
168 ..::std::default::Default::default()
169 });
170
171 ::std::option::Option::Some(cfg.freeze())
172 }
173
174 fn runtime_components(
175 &self,
176 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
177 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
178 #[allow(unused_mut)]
179 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("CreateCrawler")
180 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
181 CreateCrawlerTelemetryInputCaptureInterceptor,
182 ))
183 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
184 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
185 ))
186 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
187 CreateCrawlerEndpointParamsInterceptor,
188 ))
189 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
190 crate::operation::create_crawler::CreateCrawlerError,
191 >::new())
192 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
193 crate::operation::create_crawler::CreateCrawlerError,
194 >::new())
195 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
196 crate::operation::create_crawler::CreateCrawlerError,
197 >::new())
198 .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
199 crate::operation::create_crawler::CreateCrawlerError,
200 >::new());
201
202 ::std::borrow::Cow::Owned(rcb)
203 }
204}
205
206#[derive(Debug)]
207struct CreateCrawlerTelemetryInputCaptureInterceptor;
208
209#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
210impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateCrawlerTelemetryInputCaptureInterceptor {
211 fn name(&self) -> &'static str {
212 "CreateCrawlerTelemetryInputCaptureInterceptor"
213 }
214
215 fn read_before_execution(
216 &self,
217 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
218 '_,
219 ::aws_smithy_runtime_api::client::interceptors::context::Input,
220 ::aws_smithy_runtime_api::client::interceptors::context::Output,
221 ::aws_smithy_runtime_api::client::interceptors::context::Error,
222 >,
223 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
224 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
225 let ::std::option::Option::Some(requested) = cfg
227 .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
228 .filter(|r| !r.is_empty())
229 else {
230 return ::std::result::Result::Ok(());
231 };
232
233 let ::std::option::Option::Some(input) = context.input().downcast_ref::<CreateCrawlerInput>() else {
234 return ::std::result::Result::Ok(());
236 };
237
238 let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
239 if requested.should_capture("Name") {
240 if let ::std::option::Option::Some(value) = input.name.as_deref() {
241 captured.insert("Name", value);
242 }
243 }
244 if requested.should_capture("Role") {
245 if let ::std::option::Option::Some(value) = input.role.as_deref() {
246 captured.insert("Role", value);
247 }
248 }
249 if requested.should_capture("DatabaseName") {
250 if let ::std::option::Option::Some(value) = input.database_name.as_deref() {
251 captured.insert("DatabaseName", value);
252 }
253 }
254 if requested.should_capture("Description") {
255 if let ::std::option::Option::Some(value) = input.description.as_deref() {
256 captured.insert("Description", value);
257 }
258 }
259 if requested.should_capture("Schedule") {
260 if let ::std::option::Option::Some(value) = input.schedule.as_deref() {
261 captured.insert("Schedule", value);
262 }
263 }
264 if requested.should_capture("TablePrefix") {
265 if let ::std::option::Option::Some(value) = input.table_prefix.as_deref() {
266 captured.insert("TablePrefix", value);
267 }
268 }
269 if requested.should_capture("Configuration") {
270 if let ::std::option::Option::Some(value) = input.configuration.as_deref() {
271 captured.insert("Configuration", value);
272 }
273 }
274 if requested.should_capture("CrawlerSecurityConfiguration") {
275 if let ::std::option::Option::Some(value) = input.crawler_security_configuration.as_deref() {
276 captured.insert("CrawlerSecurityConfiguration", value);
277 }
278 }
279 if requested.should_capture("CatalogId") {
280 if let ::std::option::Option::Some(value) = input.catalog_id.as_deref() {
281 captured.insert("CatalogId", value);
282 }
283 }
284
285 cfg.interceptor_state().store_put(captured);
286 ::std::result::Result::Ok(())
287 }
288}
289#[derive(Debug)]
290struct CreateCrawlerResponseDeserializer;
291impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreateCrawlerResponseDeserializer {
292 fn deserialize_nonstreaming_with_config(
293 &self,
294 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
295 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
296 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
297 let (success, status) = (response.status().is_success(), response.status().as_u16());
298 #[allow(unused_variables)]
303 let body = response.body().bytes().expect("body loaded");
304 let headers = response.headers();
305 #[allow(unused_mut)]
306 let mut force_error = false;
307 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
308 if !success && status != 200 || force_error {
309 let protocol = _cfg
310 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
311 .expect("a SharedClientProtocol is required");
312 #[allow(unused_mut)]
313 let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
314 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
315 })?;
316 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
317 let generic = generic_builder.build();
318 let error_code = match generic.code() {
319 ::std::option::Option::Some(code) => code,
320 ::std::option::Option::None => {
321 return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
322 ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::create_crawler::CreateCrawlerError::unhandled(generic)),
323 ))
324 }
325 };
326 let _error_message = generic.message().map(|msg| msg.to_owned());
327 let err = match error_code {
328 "AlreadyExistsException" => crate::operation::create_crawler::CreateCrawlerError::AlreadyExistsException({
329 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
330 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
331 e,
332 ))
333 })?;
334 let mut tmp = <crate::types::error::builders::AlreadyExistsExceptionBuilder>::default();
335 tmp.deserialize_members(&mut *deser).map_err(|e| {
336 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
337 e,
338 ))
339 })?;
340 if tmp.message.is_none() {
341 tmp.message = _error_message;
342 }
343 let tmp = tmp.meta(generic);
344 tmp.build()
345 }),
346 "InvalidInputException" => crate::operation::create_crawler::CreateCrawlerError::InvalidInputException({
347 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
348 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
349 e,
350 ))
351 })?;
352 let mut tmp = <crate::types::error::builders::InvalidInputExceptionBuilder>::default();
353 tmp.deserialize_members(&mut *deser).map_err(|e| {
354 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
355 e,
356 ))
357 })?;
358 if tmp.message.is_none() {
359 tmp.message = _error_message;
360 }
361 let tmp = tmp.meta(generic);
362 tmp.build()
363 }),
364 "OperationTimeoutException" => crate::operation::create_crawler::CreateCrawlerError::OperationTimeoutException({
365 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
366 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
367 e,
368 ))
369 })?;
370 let mut tmp = <crate::types::error::builders::OperationTimeoutExceptionBuilder>::default();
371 tmp.deserialize_members(&mut *deser).map_err(|e| {
372 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
373 e,
374 ))
375 })?;
376 if tmp.message.is_none() {
377 tmp.message = _error_message;
378 }
379 let tmp = tmp.meta(generic);
380 tmp.build()
381 }),
382 "ResourceNumberLimitExceededException" => {
383 crate::operation::create_crawler::CreateCrawlerError::ResourceNumberLimitExceededException({
384 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
385 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
386 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
387 )
388 })?;
389 let mut tmp = <crate::types::error::builders::ResourceNumberLimitExceededExceptionBuilder>::default();
390 tmp.deserialize_members(&mut *deser).map_err(|e| {
391 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
392 ::aws_smithy_runtime_api::box_error::BoxError::from(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 }
402 _ => {
403 match protocol
411 .deserialize_error_response(response, _cfg)
412 .ok()
413 .and_then(|mut deser| {
414 ::aws_smithy_schema::registry::reify_error(
415 crate::operation::create_crawler::error_registry::REGISTRY
416 .or(&crate::error_type_registry::REGISTRY),
417 error_code,
418 &mut *deser,
419 )
420 }) {
421 ::std::option::Option::Some(source) => <crate::operation::create_crawler::CreateCrawlerError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
422 ::std::option::Option::None => crate::operation::create_crawler::CreateCrawlerError::generic(generic),
423 }
424 }
425 };
426 ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
427 ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
428 ))
429 } else {
430 let protocol = _cfg
431 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
432 .expect("a SharedClientProtocol is required");
433 let mut deser = protocol.deserialize_response(response, CreateCrawler::OUTPUT_SCHEMA, _cfg).map_err(|e| {
434 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
435 })?;
436 let _response_headers = headers;
440 #[allow(unused_mut)]
444 let mut output = <crate::operation::create_crawler::builders::CreateCrawlerOutputBuilder>::default();
445 output.deserialize_members(&mut *deser).map_err(|e| {
446 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
447 })?;
448 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
449 let output = output.build();
450 ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
451 }
452 }
453}
454#[derive(Debug)]
455struct CreateCrawlerRequestSerializer;
456impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreateCrawlerRequestSerializer {
457 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
458 fn serialize_input(
459 &self,
460 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
461 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
462 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
463 let input = input
464 .downcast::<crate::operation::create_crawler::CreateCrawlerInput>()
465 .expect("correct type");
466
467 let protocol = _cfg
468 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
469 .expect("a SharedClientProtocol is required");
470 let mut request = protocol
471 .serialize_request(&input, CreateCrawler::INPUT_SCHEMA, "/", _cfg)
472 .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
473
474 return ::std::result::Result::Ok(request);
475 }
476}
477#[derive(Debug)]
478struct CreateCrawlerEndpointParamsInterceptor;
479
480#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
481impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateCrawlerEndpointParamsInterceptor {
482 fn name(&self) -> &'static str {
483 "CreateCrawlerEndpointParamsInterceptor"
484 }
485
486 fn read_before_execution(
487 &self,
488 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
489 '_,
490 ::aws_smithy_runtime_api::client::interceptors::context::Input,
491 ::aws_smithy_runtime_api::client::interceptors::context::Output,
492 ::aws_smithy_runtime_api::client::interceptors::context::Error,
493 >,
494 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
495 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
496 let _input = context
497 .input()
498 .downcast_ref::<CreateCrawlerInput>()
499 .ok_or("failed to downcast to CreateCrawlerInput")?;
500
501 let params = crate::config::endpoint::Params::builder()
502 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
503 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
504 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
505 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
506 .build()
507 .map_err(|err| {
508 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
509 })?;
510 cfg.interceptor_state()
511 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
512 ::std::result::Result::Ok(())
513 }
514}
515
516#[non_exhaustive]
521#[derive(::std::fmt::Debug)]
522pub enum CreateCrawlerError {
523 AlreadyExistsException(crate::types::error::AlreadyExistsException),
525 InvalidInputException(crate::types::error::InvalidInputException),
527 OperationTimeoutException(crate::types::error::OperationTimeoutException),
529 ResourceNumberLimitExceededException(crate::types::error::ResourceNumberLimitExceededException),
531 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
533 variable wildcard pattern and check `.code()`:
534 \
535 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
536 \
537 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CreateCrawlerError) for what information is available for the error.")]
538 Unhandled(crate::error::sealed_unhandled::Unhandled),
539}
540impl CreateCrawlerError {
541 pub fn unhandled(
543 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
544 ) -> Self {
545 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
546 source: err.into(),
547 meta: ::std::default::Default::default(),
548 })
549 }
550
551 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
553 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
554 source: err.clone().into(),
555 meta: err,
556 })
557 }
558 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
563 match self {
564 Self::AlreadyExistsException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
565 Self::InvalidInputException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
566 Self::OperationTimeoutException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
567 Self::ResourceNumberLimitExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
568 Self::Unhandled(e) => &e.meta,
569 }
570 }
571 pub fn is_already_exists_exception(&self) -> bool {
573 matches!(self, Self::AlreadyExistsException(_))
574 }
575 pub fn is_invalid_input_exception(&self) -> bool {
577 matches!(self, Self::InvalidInputException(_))
578 }
579 pub fn is_operation_timeout_exception(&self) -> bool {
581 matches!(self, Self::OperationTimeoutException(_))
582 }
583 pub fn is_resource_number_limit_exceeded_exception(&self) -> bool {
585 matches!(self, Self::ResourceNumberLimitExceededException(_))
586 }
587}
588impl ::std::error::Error for CreateCrawlerError {
589 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
590 match self {
591 Self::AlreadyExistsException(_inner) => ::std::option::Option::Some(_inner),
592 Self::InvalidInputException(_inner) => ::std::option::Option::Some(_inner),
593 Self::OperationTimeoutException(_inner) => ::std::option::Option::Some(_inner),
594 Self::ResourceNumberLimitExceededException(_inner) => ::std::option::Option::Some(_inner),
595 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
596 }
597 }
598}
599impl ::std::fmt::Display for CreateCrawlerError {
600 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
601 match self {
602 Self::AlreadyExistsException(_inner) => _inner.fmt(f),
603 Self::InvalidInputException(_inner) => _inner.fmt(f),
604 Self::OperationTimeoutException(_inner) => _inner.fmt(f),
605 Self::ResourceNumberLimitExceededException(_inner) => _inner.fmt(f),
606 Self::Unhandled(_inner) => {
607 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
608 write!(f, "unhandled error ({code})")
609 } else {
610 f.write_str("unhandled error")
611 }
612 }
613 }
614 }
615}
616impl ::aws_smithy_types::retry::ProvideErrorKind for CreateCrawlerError {
617 fn code(&self) -> ::std::option::Option<&str> {
618 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
619 }
620 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
621 ::std::option::Option::None
622 }
623}
624impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CreateCrawlerError {
625 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
626 match self {
627 Self::AlreadyExistsException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
628 Self::InvalidInputException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
629 Self::OperationTimeoutException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
630 Self::ResourceNumberLimitExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
631 Self::Unhandled(_inner) => &_inner.meta,
632 }
633 }
634}
635impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CreateCrawlerError {
636 fn create_unhandled_error(
637 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
638 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
639 ) -> Self {
640 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
641 source,
642 meta: meta.unwrap_or_default(),
643 })
644 }
645}
646impl ::aws_types::request_id::RequestId for crate::operation::create_crawler::CreateCrawlerError {
647 fn request_id(&self) -> Option<&str> {
648 self.meta().request_id()
649 }
650}
651
652pub use crate::operation::create_crawler::_create_crawler_input::CreateCrawlerInput;
653
654pub use crate::operation::create_crawler::_create_crawler_output::CreateCrawlerOutput;
655
656mod _create_crawler_input;
657
658mod _create_crawler_output;
659
660pub mod builders;