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