1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct CreateBucketMetadataTableConfiguration;
6impl CreateBucketMetadataTableConfiguration {
7 pub fn new() -> Self {
9 Self
10 }
11 pub(crate) async fn orchestrate(
12 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
13 input: crate::operation::create_bucket_metadata_table_configuration::CreateBucketMetadataTableConfigurationInput,
14 ) -> ::std::result::Result<
15 crate::operation::create_bucket_metadata_table_configuration::CreateBucketMetadataTableConfigurationOutput,
16 ::aws_smithy_runtime_api::client::result::SdkError<
17 crate::operation::create_bucket_metadata_table_configuration::CreateBucketMetadataTableConfigurationError,
18 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
19 >,
20 > {
21 let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
22 ::aws_smithy_runtime_api::client::interceptors::context::Error,
23 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
24 >| {
25 err.map_service_error(|err| {
26 err.downcast::<crate::operation::create_bucket_metadata_table_configuration::CreateBucketMetadataTableConfigurationError>()
27 .expect("correct error type")
28 })
29 };
30 use ::tracing::Instrument;
31 let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
32 .instrument(::tracing::debug_span!(
35 "s3.CreateBucketMetadataTableConfiguration",
36 "rpc.service" = "s3",
37 "rpc.method" = "CreateBucketMetadataTableConfiguration",
38 "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
39 "rpc.system" = "aws-api",
40 ))
41 .await
42 .map_err(map_err)?;
43 let output = context.finalize().map_err(map_err)?;
44 ::std::result::Result::Ok(
45 output
46 .downcast::<crate::operation::create_bucket_metadata_table_configuration::CreateBucketMetadataTableConfigurationOutput>()
47 .expect("correct output type"),
48 )
49 }
50
51 pub(crate) async fn orchestrate_with_stop_point(
52 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
53 input: crate::operation::create_bucket_metadata_table_configuration::CreateBucketMetadataTableConfigurationInput,
54 stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
55 ) -> ::std::result::Result<
56 ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
57 ::aws_smithy_runtime_api::client::result::SdkError<
58 ::aws_smithy_runtime_api::client::interceptors::context::Error,
59 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
60 >,
61 > {
62 let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
63 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point(
64 "s3",
65 "CreateBucketMetadataTableConfiguration",
66 input,
67 runtime_plugins,
68 stop_point,
69 )
70 .await
71 }
72
73 pub(crate) fn operation_runtime_plugins(
74 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
75 client_config: &crate::config::Config,
76 config_override: ::std::option::Option<crate::config::Builder>,
77 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
78 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
79 runtime_plugins = runtime_plugins.with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![
80 ::aws_runtime::auth::sigv4::SCHEME_ID,
81 #[cfg(feature = "sigv4a")]
82 {
83 ::aws_runtime::auth::sigv4a::SCHEME_ID
84 },
85 crate::s3_express::auth::SCHEME_ID,
86 ::aws_smithy_runtime::client::auth::no_auth::NO_AUTH_SCHEME_ID,
87 ]));
88 if let ::std::option::Option::Some(config_override) = config_override {
89 for plugin in config_override.runtime_plugins.iter().cloned() {
90 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
91 }
92 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
93 config_override,
94 client_config.config.clone(),
95 &client_config.runtime_components,
96 ));
97 }
98 runtime_plugins
99 }
100}
101impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for CreateBucketMetadataTableConfiguration {
102 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
103 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("CreateBucketMetadataTableConfiguration");
104
105 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
106 CreateBucketMetadataTableConfigurationRequestSerializer,
107 ));
108 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
109 CreateBucketMetadataTableConfigurationResponseDeserializer,
110 ));
111
112 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
113 ::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new(),
114 ));
115
116 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
117 "CreateBucketMetadataTableConfiguration",
118 "s3",
119 ));
120 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
121 signing_options.double_uri_encode = false;
122 signing_options.content_sha256_header = true;
123 signing_options.normalize_uri_path = false;
124 signing_options.payload_override = None;
125
126 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
127 signing_options,
128 ..::std::default::Default::default()
129 });
130 cfg.store_put(crate::s3_express::checksum::provide_default_checksum_algorithm());
131
132 ::std::option::Option::Some(cfg.freeze())
133 }
134
135 fn runtime_components(
136 &self,
137 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
138 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
139 #[allow(unused_mut)]
140 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("CreateBucketMetadataTableConfiguration")
141 .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
142 .with_interceptor(CreateBucketMetadataTableConfigurationEndpointParamsInterceptor)
143 .with_interceptor(crate::http_request_checksum::RequestChecksumInterceptor::new(
144 |input: &::aws_smithy_runtime_api::client::interceptors::context::Input| {
145 let input: &crate::operation::create_bucket_metadata_table_configuration::CreateBucketMetadataTableConfigurationInput =
146 input.downcast_ref().expect("correct type");
147 let checksum_algorithm = input.checksum_algorithm();
148 let checksum_algorithm = checksum_algorithm.map(|algorithm| algorithm.as_str());
149 (checksum_algorithm.map(|s| s.to_string()), true)
150 },
151 |request: &mut ::aws_smithy_runtime_api::http::Request, cfg: &::aws_smithy_types::config_bag::ConfigBag| {
152 let mut user_set_checksum_value = false;
154 let headers_to_check =
155 request
156 .headers()
157 .iter()
158 .filter_map(|(name, _val)| if name.starts_with("x-amz-checksum-") { Some(name) } else { None });
159 for algo_header in headers_to_check {
160 if request.headers().get(algo_header).is_some() {
161 user_set_checksum_value = true;
162 }
163 }
164
165 let user_set_checksum_algo = request.headers().get("x-amz-sdk-checksum-algorithm").is_some();
167
168 let request_checksum_calculation = cfg
170 .load::<::aws_smithy_types::checksum_config::RequestChecksumCalculation>()
171 .unwrap_or(&::aws_smithy_types::checksum_config::RequestChecksumCalculation::WhenSupported);
172
173 let http_checksum_required = true;
175
176 let is_presigned_req = cfg.load::<crate::presigning::PresigningMarker>().is_some();
177
178 match (
183 request_checksum_calculation,
184 http_checksum_required,
185 user_set_checksum_value,
186 user_set_checksum_algo,
187 is_presigned_req,
188 ) {
189 (_, _, _, _, true) => {}
190 (::aws_smithy_types::checksum_config::RequestChecksumCalculation::WhenSupported, _, false, false, _)
191 | (::aws_smithy_types::checksum_config::RequestChecksumCalculation::WhenRequired, true, false, false, _) => {
192 request.headers_mut().insert("x-amz-sdk-checksum-algorithm", "CRC32");
193 }
194 _ => {}
195 }
196
197 Ok(user_set_checksum_value)
200 },
201 ))
202 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
203 crate::operation::create_bucket_metadata_table_configuration::CreateBucketMetadataTableConfigurationError,
204 >::new())
205 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
206 crate::operation::create_bucket_metadata_table_configuration::CreateBucketMetadataTableConfigurationError,
207 >::new())
208 .with_retry_classifier(
209 ::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
210 crate::operation::create_bucket_metadata_table_configuration::CreateBucketMetadataTableConfigurationError,
211 >::builder()
212 .transient_errors({
213 let mut transient_errors: Vec<&'static str> = ::aws_runtime::retries::classifiers::TRANSIENT_ERRORS.into();
214 transient_errors.push("InternalError");
215 ::std::borrow::Cow::Owned(transient_errors)
216 })
217 .build(),
218 );
219
220 ::std::borrow::Cow::Owned(rcb)
221 }
222}
223
224#[derive(Debug)]
225struct CreateBucketMetadataTableConfigurationResponseDeserializer;
226impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreateBucketMetadataTableConfigurationResponseDeserializer {
227 fn deserialize_nonstreaming(
228 &self,
229 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
230 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
231 let (success, status) = (response.status().is_success(), response.status().as_u16());
232 let headers = response.headers();
233 let body = response.body().bytes().expect("body loaded");
234 #[allow(unused_mut)]
235 let mut force_error = false;
236 ::tracing::debug!(extended_request_id = ?crate::s3_request_id::RequestIdExt::extended_request_id(response));
237 if matches!(crate::rest_xml_unwrapped_errors::body_is_error(body), Ok(true)) {
238 force_error = true;
239 }
240 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
241 let parse_result = if !success && status != 200 || force_error {
242 crate::protocol_serde::shape_create_bucket_metadata_table_configuration::de_create_bucket_metadata_table_configuration_http_error(
243 status, headers, body,
244 )
245 } else {
246 crate::protocol_serde::shape_create_bucket_metadata_table_configuration::de_create_bucket_metadata_table_configuration_http_response(
247 status, headers, body,
248 )
249 };
250 crate::protocol_serde::type_erase_result(parse_result)
251 }
252}
253#[derive(Debug)]
254struct CreateBucketMetadataTableConfigurationRequestSerializer;
255impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreateBucketMetadataTableConfigurationRequestSerializer {
256 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
257 fn serialize_input(
258 &self,
259 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
260 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
261 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
262 let input = input
263 .downcast::<crate::operation::create_bucket_metadata_table_configuration::CreateBucketMetadataTableConfigurationInput>()
264 .expect("correct type");
265 let _header_serialization_settings = _cfg
266 .load::<crate::serialization_settings::HeaderSerializationSettings>()
267 .cloned()
268 .unwrap_or_default();
269 let mut request_builder = {
270 fn uri_base(
271 _input: &crate::operation::create_bucket_metadata_table_configuration::CreateBucketMetadataTableConfigurationInput,
272 output: &mut ::std::string::String,
273 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
274 use ::std::fmt::Write as _;
275 ::std::write!(output, "/").expect("formatting should succeed");
276 ::std::result::Result::Ok(())
277 }
278 fn uri_query(
279 _input: &crate::operation::create_bucket_metadata_table_configuration::CreateBucketMetadataTableConfigurationInput,
280 mut output: &mut ::std::string::String,
281 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
282 let mut query = ::aws_smithy_http::query::Writer::new(output);
283 query.push_v("metadataTable");
284 ::std::result::Result::Ok(())
285 }
286 #[allow(clippy::unnecessary_wraps)]
287 fn update_http_builder(
288 input: &crate::operation::create_bucket_metadata_table_configuration::CreateBucketMetadataTableConfigurationInput,
289 builder: ::http::request::Builder,
290 ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
291 let mut uri = ::std::string::String::new();
292 uri_base(input, &mut uri)?;
293 uri_query(input, &mut uri)?;
294 let builder =
295 crate::protocol_serde::shape_create_bucket_metadata_table_configuration::ser_create_bucket_metadata_table_configuration_headers(
296 input, builder,
297 )?;
298 ::std::result::Result::Ok(builder.method("POST").uri(uri))
299 }
300 let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
301 builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/xml");
302 builder
303 };
304 let body = ::aws_smithy_types::body::SdkBody::from(
305 crate::protocol_serde::shape_create_bucket_metadata_table_configuration_input::ser_metadata_table_configuration_http_payload(
306 &input.metadata_table_configuration,
307 )?,
308 );
309 if let Some(content_length) = body.content_length() {
310 let content_length = content_length.to_string();
311 request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
312 }
313 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
314 }
315}
316#[derive(Debug)]
317struct CreateBucketMetadataTableConfigurationEndpointParamsInterceptor;
318
319impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateBucketMetadataTableConfigurationEndpointParamsInterceptor {
320 fn name(&self) -> &'static str {
321 "CreateBucketMetadataTableConfigurationEndpointParamsInterceptor"
322 }
323
324 fn read_before_execution(
325 &self,
326 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
327 '_,
328 ::aws_smithy_runtime_api::client::interceptors::context::Input,
329 ::aws_smithy_runtime_api::client::interceptors::context::Output,
330 ::aws_smithy_runtime_api::client::interceptors::context::Error,
331 >,
332 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
333 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
334 let _input = context
335 .input()
336 .downcast_ref::<CreateBucketMetadataTableConfigurationInput>()
337 .ok_or("failed to downcast to CreateBucketMetadataTableConfigurationInput")?;
338
339 let params = crate::config::endpoint::Params::builder()
340 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
341 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
342 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
343 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
344 .set_force_path_style(cfg.load::<crate::config::ForcePathStyle>().map(|ty| ty.0))
345 .set_use_arn_region(cfg.load::<crate::config::UseArnRegion>().map(|ty| ty.0))
346 .set_disable_multi_region_access_points(cfg.load::<crate::config::DisableMultiRegionAccessPoints>().map(|ty| ty.0))
347 .set_accelerate(cfg.load::<crate::config::Accelerate>().map(|ty| ty.0))
348 .set_disable_s3_express_session_auth(cfg.load::<crate::config::DisableS3ExpressSessionAuth>().map(|ty| ty.0))
349 .set_use_s3_express_control_endpoint(Some(true))
350 .set_bucket(Some(
351 _input
352 .bucket
353 .clone()
354 .filter(|f| !AsRef::<str>::as_ref(f).trim().is_empty())
355 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("bucket", "A required field was not set"))?,
356 ))
357 .build()
358 .map_err(|err| {
359 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
360 })?;
361 cfg.interceptor_state()
362 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
363 ::std::result::Result::Ok(())
364 }
365}
366
367#[non_exhaustive]
372#[derive(::std::fmt::Debug)]
373pub enum CreateBucketMetadataTableConfigurationError {
374 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
376 variable wildcard pattern and check `.code()`:
377 \
378 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
379 \
380 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CreateBucketMetadataTableConfigurationError) for what information is available for the error.")]
381 Unhandled(crate::error::sealed_unhandled::Unhandled),
382}
383impl CreateBucketMetadataTableConfigurationError {
384 pub fn unhandled(
386 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
387 ) -> Self {
388 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
389 source: err.into(),
390 meta: ::std::default::Default::default(),
391 })
392 }
393
394 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
396 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
397 source: err.clone().into(),
398 meta: err,
399 })
400 }
401 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
406 match self {
407 Self::Unhandled(e) => &e.meta,
408 }
409 }
410}
411impl ::std::error::Error for CreateBucketMetadataTableConfigurationError {
412 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
413 match self {
414 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
415 }
416 }
417}
418impl ::std::fmt::Display for CreateBucketMetadataTableConfigurationError {
419 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
420 match self {
421 Self::Unhandled(_inner) => {
422 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
423 write!(f, "unhandled error ({code})")
424 } else {
425 f.write_str("unhandled error")
426 }
427 }
428 }
429 }
430}
431impl ::aws_smithy_types::retry::ProvideErrorKind for CreateBucketMetadataTableConfigurationError {
432 fn code(&self) -> ::std::option::Option<&str> {
433 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
434 }
435 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
436 ::std::option::Option::None
437 }
438}
439impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CreateBucketMetadataTableConfigurationError {
440 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
441 match self {
442 Self::Unhandled(_inner) => &_inner.meta,
443 }
444 }
445}
446impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CreateBucketMetadataTableConfigurationError {
447 fn create_unhandled_error(
448 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
449 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
450 ) -> Self {
451 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
452 source,
453 meta: meta.unwrap_or_default(),
454 })
455 }
456}
457impl crate::s3_request_id::RequestIdExt
458 for crate::operation::create_bucket_metadata_table_configuration::CreateBucketMetadataTableConfigurationError
459{
460 fn extended_request_id(&self) -> Option<&str> {
461 self.meta().extended_request_id()
462 }
463}
464impl ::aws_types::request_id::RequestId
465 for crate::operation::create_bucket_metadata_table_configuration::CreateBucketMetadataTableConfigurationError
466{
467 fn request_id(&self) -> Option<&str> {
468 self.meta().request_id()
469 }
470}
471
472pub use crate::operation::create_bucket_metadata_table_configuration::_create_bucket_metadata_table_configuration_output::CreateBucketMetadataTableConfigurationOutput;
473
474pub use crate::operation::create_bucket_metadata_table_configuration::_create_bucket_metadata_table_configuration_input::CreateBucketMetadataTableConfigurationInput;
475
476mod _create_bucket_metadata_table_configuration_input;
477
478mod _create_bucket_metadata_table_configuration_output;
479
480pub mod builders;