1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct CreateFileSystem;
6impl CreateFileSystem {
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_file_system::CreateFileSystemInput,
14 ) -> ::std::result::Result<
15 crate::operation::create_file_system::CreateFileSystemOutput,
16 ::aws_smithy_runtime_api::client::result::SdkError<
17 crate::operation::create_file_system::CreateFileSystemError,
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_file_system::CreateFileSystemError>()
27 .expect("correct error type")
28 })
29 };
30 let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
31 .await
32 .map_err(map_err)?;
33 let output = context.finalize().map_err(map_err)?;
34 ::std::result::Result::Ok(
35 output
36 .downcast::<crate::operation::create_file_system::CreateFileSystemOutput>()
37 .expect("correct output type"),
38 )
39 }
40
41 pub(crate) async fn orchestrate_with_stop_point(
42 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
43 input: crate::operation::create_file_system::CreateFileSystemInput,
44 stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
45 ) -> ::std::result::Result<
46 ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
47 ::aws_smithy_runtime_api::client::result::SdkError<
48 ::aws_smithy_runtime_api::client::interceptors::context::Error,
49 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
50 >,
51 > {
52 let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
53 use ::tracing::Instrument;
54 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("FSx", "CreateFileSystem", input, runtime_plugins, stop_point)
55 .instrument(::tracing::debug_span!(
58 "FSx.CreateFileSystem",
59 "rpc.service" = "FSx",
60 "rpc.method" = "CreateFileSystem",
61 "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
62 "rpc.system" = "aws-api",
63 ))
64 .await
65 }
66
67 pub(crate) fn operation_runtime_plugins(
68 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
69 client_config: &crate::config::Config,
70 config_override: ::std::option::Option<crate::config::Builder>,
71 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
72 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
73 runtime_plugins = runtime_plugins.with_operation_plugin(crate::client_idempotency_token::IdempotencyTokenRuntimePlugin::new(
74 |token_provider, input| {
75 let input: &mut crate::operation::create_file_system::CreateFileSystemInput = input.downcast_mut().expect("correct type");
76 if input.client_request_token.is_none() {
77 input.client_request_token = ::std::option::Option::Some(token_provider.make_idempotency_token());
78 }
79 },
80 ));
81 if let ::std::option::Option::Some(config_override) = config_override {
82 for plugin in config_override.runtime_plugins.iter().cloned() {
83 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
84 }
85 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
86 config_override,
87 client_config.config.clone(),
88 &client_config.runtime_components,
89 ));
90 }
91 runtime_plugins
92 }
93}
94impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for CreateFileSystem {
95 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
96 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("CreateFileSystem");
97
98 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
99 CreateFileSystemRequestSerializer,
100 ));
101 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
102 CreateFileSystemResponseDeserializer,
103 ));
104
105 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
106 crate::config::auth::Params::builder()
107 .operation_name("CreateFileSystem")
108 .build()
109 .expect("required fields set"),
110 ));
111
112 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
113 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("CreateFileSystem", "FSx"));
114 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
115 signing_options.double_uri_encode = true;
116 signing_options.content_sha256_header = false;
117 signing_options.normalize_uri_path = true;
118 signing_options.payload_override = None;
119
120 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
121 signing_options,
122 ..::std::default::Default::default()
123 });
124
125 ::std::option::Option::Some(cfg.freeze())
126 }
127
128 fn runtime_components(
129 &self,
130 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
131 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
132 #[allow(unused_mut)]
133 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("CreateFileSystem")
134 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
135 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
136 ))
137 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
138 CreateFileSystemEndpointParamsInterceptor,
139 ))
140 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
141 crate::operation::create_file_system::CreateFileSystemError,
142 >::new())
143 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
144 crate::operation::create_file_system::CreateFileSystemError,
145 >::new())
146 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
147 crate::operation::create_file_system::CreateFileSystemError,
148 >::new());
149
150 ::std::borrow::Cow::Owned(rcb)
151 }
152}
153
154#[derive(Debug)]
155struct CreateFileSystemResponseDeserializer;
156impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreateFileSystemResponseDeserializer {
157 fn deserialize_nonstreaming_with_config(
158 &self,
159 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
160 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
161 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
162 let (success, status) = (response.status().is_success(), response.status().as_u16());
163 let headers = response.headers();
164 let body = response.body().bytes().expect("body loaded");
165 #[allow(unused_mut)]
166 let mut force_error = false;
167 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
168 let parse_result = if !success && status != 200 || force_error {
169 crate::protocol_serde::shape_create_file_system::de_create_file_system_http_error(status, headers, body)
170 } else {
171 crate::protocol_serde::shape_create_file_system::de_create_file_system_http_response(status, headers, body)
172 };
173 crate::protocol_serde::type_erase_result(parse_result)
174 }
175}
176#[derive(Debug)]
177struct CreateFileSystemRequestSerializer;
178impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreateFileSystemRequestSerializer {
179 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
180 fn serialize_input(
181 &self,
182 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
183 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
184 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
185 let input = input
186 .downcast::<crate::operation::create_file_system::CreateFileSystemInput>()
187 .expect("correct type");
188 let _header_serialization_settings = _cfg
189 .load::<crate::serialization_settings::HeaderSerializationSettings>()
190 .cloned()
191 .unwrap_or_default();
192 let mut request_builder = {
193 #[allow(clippy::uninlined_format_args)]
194 fn uri_base(
195 _input: &crate::operation::create_file_system::CreateFileSystemInput,
196 output: &mut ::std::string::String,
197 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
198 use ::std::fmt::Write as _;
199 ::std::write!(output, "/").expect("formatting should succeed");
200 ::std::result::Result::Ok(())
201 }
202 #[allow(clippy::unnecessary_wraps)]
203 fn update_http_builder(
204 input: &crate::operation::create_file_system::CreateFileSystemInput,
205 builder: ::http_1x::request::Builder,
206 ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
207 let mut uri = ::std::string::String::new();
208 uri_base(input, &mut uri)?;
209 ::std::result::Result::Ok(builder.method("POST").uri(uri))
210 }
211 let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
212 builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.1");
213 builder = _header_serialization_settings.set_default_header(
214 builder,
215 ::http_1x::header::HeaderName::from_static("x-amz-target"),
216 "AWSSimbaAPIService_v20180301.CreateFileSystem",
217 );
218 builder
219 };
220 let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_create_file_system::ser_create_file_system_input(&input)?);
221 if let Some(content_length) = body.content_length() {
222 let content_length = content_length.to_string();
223 request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
224 }
225 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
226 }
227}
228#[derive(Debug)]
229struct CreateFileSystemEndpointParamsInterceptor;
230
231#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
232impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateFileSystemEndpointParamsInterceptor {
233 fn name(&self) -> &'static str {
234 "CreateFileSystemEndpointParamsInterceptor"
235 }
236
237 fn read_before_execution(
238 &self,
239 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
240 '_,
241 ::aws_smithy_runtime_api::client::interceptors::context::Input,
242 ::aws_smithy_runtime_api::client::interceptors::context::Output,
243 ::aws_smithy_runtime_api::client::interceptors::context::Error,
244 >,
245 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
246 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
247 let _input = context
248 .input()
249 .downcast_ref::<CreateFileSystemInput>()
250 .ok_or("failed to downcast to CreateFileSystemInput")?;
251
252 let params = crate::config::endpoint::Params::builder()
253 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
254 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
255 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
256 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
257 .build()
258 .map_err(|err| {
259 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
260 })?;
261 cfg.interceptor_state()
262 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
263 ::std::result::Result::Ok(())
264 }
265}
266
267#[non_exhaustive]
272#[derive(::std::fmt::Debug)]
273pub enum CreateFileSystemError {
274 ActiveDirectoryError(crate::types::error::ActiveDirectoryError),
276 BadRequest(crate::types::error::BadRequest),
278 IncompatibleParameterError(crate::types::error::IncompatibleParameterError),
280 InternalServerError(crate::types::error::InternalServerError),
282 InvalidExportPath(crate::types::error::InvalidExportPath),
284 InvalidImportPath(crate::types::error::InvalidImportPath),
286 InvalidNetworkSettings(crate::types::error::InvalidNetworkSettings),
288 InvalidPerUnitStorageThroughput(crate::types::error::InvalidPerUnitStorageThroughput),
290 MissingFileSystemConfiguration(crate::types::error::MissingFileSystemConfiguration),
292 ServiceLimitExceeded(crate::types::error::ServiceLimitExceeded),
294 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
296 variable wildcard pattern and check `.code()`:
297 \
298 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
299 \
300 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CreateFileSystemError) for what information is available for the error.")]
301 Unhandled(crate::error::sealed_unhandled::Unhandled),
302}
303impl CreateFileSystemError {
304 pub fn unhandled(
306 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
307 ) -> Self {
308 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
309 source: err.into(),
310 meta: ::std::default::Default::default(),
311 })
312 }
313
314 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
316 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
317 source: err.clone().into(),
318 meta: err,
319 })
320 }
321 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
326 match self {
327 Self::ActiveDirectoryError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
328 Self::BadRequest(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
329 Self::IncompatibleParameterError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
330 Self::InternalServerError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
331 Self::InvalidExportPath(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
332 Self::InvalidImportPath(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
333 Self::InvalidNetworkSettings(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
334 Self::InvalidPerUnitStorageThroughput(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
335 Self::MissingFileSystemConfiguration(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
336 Self::ServiceLimitExceeded(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
337 Self::Unhandled(e) => &e.meta,
338 }
339 }
340 pub fn is_active_directory_error(&self) -> bool {
342 matches!(self, Self::ActiveDirectoryError(_))
343 }
344 pub fn is_bad_request(&self) -> bool {
346 matches!(self, Self::BadRequest(_))
347 }
348 pub fn is_incompatible_parameter_error(&self) -> bool {
350 matches!(self, Self::IncompatibleParameterError(_))
351 }
352 pub fn is_internal_server_error(&self) -> bool {
354 matches!(self, Self::InternalServerError(_))
355 }
356 pub fn is_invalid_export_path(&self) -> bool {
358 matches!(self, Self::InvalidExportPath(_))
359 }
360 pub fn is_invalid_import_path(&self) -> bool {
362 matches!(self, Self::InvalidImportPath(_))
363 }
364 pub fn is_invalid_network_settings(&self) -> bool {
366 matches!(self, Self::InvalidNetworkSettings(_))
367 }
368 pub fn is_invalid_per_unit_storage_throughput(&self) -> bool {
370 matches!(self, Self::InvalidPerUnitStorageThroughput(_))
371 }
372 pub fn is_missing_file_system_configuration(&self) -> bool {
374 matches!(self, Self::MissingFileSystemConfiguration(_))
375 }
376 pub fn is_service_limit_exceeded(&self) -> bool {
378 matches!(self, Self::ServiceLimitExceeded(_))
379 }
380}
381impl ::std::error::Error for CreateFileSystemError {
382 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
383 match self {
384 Self::ActiveDirectoryError(_inner) => ::std::option::Option::Some(_inner),
385 Self::BadRequest(_inner) => ::std::option::Option::Some(_inner),
386 Self::IncompatibleParameterError(_inner) => ::std::option::Option::Some(_inner),
387 Self::InternalServerError(_inner) => ::std::option::Option::Some(_inner),
388 Self::InvalidExportPath(_inner) => ::std::option::Option::Some(_inner),
389 Self::InvalidImportPath(_inner) => ::std::option::Option::Some(_inner),
390 Self::InvalidNetworkSettings(_inner) => ::std::option::Option::Some(_inner),
391 Self::InvalidPerUnitStorageThroughput(_inner) => ::std::option::Option::Some(_inner),
392 Self::MissingFileSystemConfiguration(_inner) => ::std::option::Option::Some(_inner),
393 Self::ServiceLimitExceeded(_inner) => ::std::option::Option::Some(_inner),
394 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
395 }
396 }
397}
398impl ::std::fmt::Display for CreateFileSystemError {
399 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
400 match self {
401 Self::ActiveDirectoryError(_inner) => _inner.fmt(f),
402 Self::BadRequest(_inner) => _inner.fmt(f),
403 Self::IncompatibleParameterError(_inner) => _inner.fmt(f),
404 Self::InternalServerError(_inner) => _inner.fmt(f),
405 Self::InvalidExportPath(_inner) => _inner.fmt(f),
406 Self::InvalidImportPath(_inner) => _inner.fmt(f),
407 Self::InvalidNetworkSettings(_inner) => _inner.fmt(f),
408 Self::InvalidPerUnitStorageThroughput(_inner) => _inner.fmt(f),
409 Self::MissingFileSystemConfiguration(_inner) => _inner.fmt(f),
410 Self::ServiceLimitExceeded(_inner) => _inner.fmt(f),
411 Self::Unhandled(_inner) => {
412 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
413 write!(f, "unhandled error ({code})")
414 } else {
415 f.write_str("unhandled error")
416 }
417 }
418 }
419 }
420}
421impl ::aws_smithy_types::retry::ProvideErrorKind for CreateFileSystemError {
422 fn code(&self) -> ::std::option::Option<&str> {
423 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
424 }
425 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
426 ::std::option::Option::None
427 }
428}
429impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CreateFileSystemError {
430 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
431 match self {
432 Self::ActiveDirectoryError(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
433 Self::BadRequest(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
434 Self::IncompatibleParameterError(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
435 Self::InternalServerError(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
436 Self::InvalidExportPath(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
437 Self::InvalidImportPath(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
438 Self::InvalidNetworkSettings(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
439 Self::InvalidPerUnitStorageThroughput(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
440 Self::MissingFileSystemConfiguration(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
441 Self::ServiceLimitExceeded(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
442 Self::Unhandled(_inner) => &_inner.meta,
443 }
444 }
445}
446impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CreateFileSystemError {
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 ::aws_types::request_id::RequestId for crate::operation::create_file_system::CreateFileSystemError {
458 fn request_id(&self) -> Option<&str> {
459 self.meta().request_id()
460 }
461}
462
463pub use crate::operation::create_file_system::_create_file_system_input::CreateFileSystemInput;
464
465pub use crate::operation::create_file_system::_create_file_system_output::CreateFileSystemOutput;
466
467mod _create_file_system_input;
468
469mod _create_file_system_output;
470
471pub mod builders;