aws_sdk_migrationhubrefactorspaces/operation/
get_route.rs1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct GetRoute;
6impl GetRoute {
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::get_route::GetRouteInput,
14 ) -> ::std::result::Result<
15 crate::operation::get_route::GetRouteOutput,
16 ::aws_smithy_runtime_api::client::result::SdkError<
17 crate::operation::get_route::GetRouteError,
18 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
19 >,
20 > {
21 let map_err =
22 |err: ::aws_smithy_runtime_api::client::result::SdkError<
23 ::aws_smithy_runtime_api::client::interceptors::context::Error,
24 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
25 >| { err.map_service_error(|err| err.downcast::<crate::operation::get_route::GetRouteError>().expect("correct error type")) };
26 let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
27 .await
28 .map_err(map_err)?;
29 let output = context.finalize().map_err(map_err)?;
30 ::std::result::Result::Ok(
31 output
32 .downcast::<crate::operation::get_route::GetRouteOutput>()
33 .expect("correct output type"),
34 )
35 }
36
37 pub(crate) async fn orchestrate_with_stop_point(
38 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
39 input: crate::operation::get_route::GetRouteInput,
40 stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
41 ) -> ::std::result::Result<
42 ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
43 ::aws_smithy_runtime_api::client::result::SdkError<
44 ::aws_smithy_runtime_api::client::interceptors::context::Error,
45 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
46 >,
47 > {
48 let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
49 use ::tracing::Instrument;
50 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point(
51 "Migration Hub Refactor Spaces",
52 "GetRoute",
53 input,
54 runtime_plugins,
55 stop_point,
56 )
57 .instrument(::tracing::debug_span!(
60 "Migration Hub Refactor Spaces.GetRoute",
61 "rpc.service" = "Migration Hub Refactor Spaces",
62 "rpc.method" = "GetRoute",
63 "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
64 "rpc.system" = "aws-api",
65 ))
66 .await
67 }
68
69 pub(crate) fn operation_runtime_plugins(
70 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
71 client_config: &crate::config::Config,
72 config_override: ::std::option::Option<crate::config::Builder>,
73 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
74 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
75
76 if let ::std::option::Option::Some(config_override) = config_override {
77 for plugin in config_override.runtime_plugins.iter().cloned() {
78 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
79 }
80 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
81 config_override,
82 client_config.config.clone(),
83 &client_config.runtime_components,
84 ));
85 }
86 runtime_plugins
87 }
88}
89impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for GetRoute {
90 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
91 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GetRoute");
92
93 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
94 GetRouteRequestSerializer,
95 ));
96 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
97 GetRouteResponseDeserializer,
98 ));
99
100 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
101 crate::config::auth::Params::builder()
102 .operation_name("GetRoute")
103 .build()
104 .expect("required fields set"),
105 ));
106
107 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
108 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
109 "GetRoute",
110 "Migration Hub Refactor Spaces",
111 ));
112 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
113 signing_options.double_uri_encode = true;
114 signing_options.content_sha256_header = false;
115 signing_options.normalize_uri_path = true;
116 signing_options.payload_override = None;
117
118 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
119 signing_options,
120 ..::std::default::Default::default()
121 });
122
123 ::std::option::Option::Some(cfg.freeze())
124 }
125
126 fn runtime_components(
127 &self,
128 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
129 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
130 #[allow(unused_mut)]
131 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("GetRoute")
132 .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
133 .with_interceptor(GetRouteEndpointParamsInterceptor)
134 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
135 crate::operation::get_route::GetRouteError,
136 >::new())
137 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
138 crate::operation::get_route::GetRouteError,
139 >::new())
140 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
141 crate::operation::get_route::GetRouteError,
142 >::new());
143
144 ::std::borrow::Cow::Owned(rcb)
145 }
146}
147
148#[derive(Debug)]
149struct GetRouteResponseDeserializer;
150impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetRouteResponseDeserializer {
151 fn deserialize_nonstreaming(
152 &self,
153 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
154 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
155 let (success, status) = (response.status().is_success(), response.status().as_u16());
156 let headers = response.headers();
157 let body = response.body().bytes().expect("body loaded");
158 #[allow(unused_mut)]
159 let mut force_error = false;
160 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
161 let parse_result = if !success && status != 200 || force_error {
162 crate::protocol_serde::shape_get_route::de_get_route_http_error(status, headers, body)
163 } else {
164 crate::protocol_serde::shape_get_route::de_get_route_http_response(status, headers, body)
165 };
166 crate::protocol_serde::type_erase_result(parse_result)
167 }
168}
169#[derive(Debug)]
170struct GetRouteRequestSerializer;
171impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetRouteRequestSerializer {
172 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
173 fn serialize_input(
174 &self,
175 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
176 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
177 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
178 let input = input.downcast::<crate::operation::get_route::GetRouteInput>().expect("correct type");
179 let _header_serialization_settings = _cfg
180 .load::<crate::serialization_settings::HeaderSerializationSettings>()
181 .cloned()
182 .unwrap_or_default();
183 let mut request_builder = {
184 fn uri_base(
185 _input: &crate::operation::get_route::GetRouteInput,
186 output: &mut ::std::string::String,
187 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
188 use ::std::fmt::Write as _;
189 let input_1 = &_input.environment_identifier;
190 let input_1 = input_1.as_ref().ok_or_else(|| {
191 ::aws_smithy_types::error::operation::BuildError::missing_field("environment_identifier", "cannot be empty or unset")
192 })?;
193 let environment_identifier = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
194 if environment_identifier.is_empty() {
195 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
196 "environment_identifier",
197 "cannot be empty or unset",
198 ));
199 }
200 let input_2 = &_input.application_identifier;
201 let input_2 = input_2.as_ref().ok_or_else(|| {
202 ::aws_smithy_types::error::operation::BuildError::missing_field("application_identifier", "cannot be empty or unset")
203 })?;
204 let application_identifier = ::aws_smithy_http::label::fmt_string(input_2, ::aws_smithy_http::label::EncodingStrategy::Default);
205 if application_identifier.is_empty() {
206 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
207 "application_identifier",
208 "cannot be empty or unset",
209 ));
210 }
211 let input_3 = &_input.route_identifier;
212 let input_3 = input_3
213 .as_ref()
214 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("route_identifier", "cannot be empty or unset"))?;
215 let route_identifier = ::aws_smithy_http::label::fmt_string(input_3, ::aws_smithy_http::label::EncodingStrategy::Default);
216 if route_identifier.is_empty() {
217 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
218 "route_identifier",
219 "cannot be empty or unset",
220 ));
221 }
222 ::std::write!(
223 output,
224 "/environments/{EnvironmentIdentifier}/applications/{ApplicationIdentifier}/routes/{RouteIdentifier}",
225 EnvironmentIdentifier = environment_identifier,
226 ApplicationIdentifier = application_identifier,
227 RouteIdentifier = route_identifier
228 )
229 .expect("formatting should succeed");
230 ::std::result::Result::Ok(())
231 }
232 #[allow(clippy::unnecessary_wraps)]
233 fn update_http_builder(
234 input: &crate::operation::get_route::GetRouteInput,
235 builder: ::http::request::Builder,
236 ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
237 let mut uri = ::std::string::String::new();
238 uri_base(input, &mut uri)?;
239 ::std::result::Result::Ok(builder.method("GET").uri(uri))
240 }
241 let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
242 builder
243 };
244 let body = ::aws_smithy_types::body::SdkBody::from("");
245
246 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
247 }
248}
249#[derive(Debug)]
250struct GetRouteEndpointParamsInterceptor;
251
252impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetRouteEndpointParamsInterceptor {
253 fn name(&self) -> &'static str {
254 "GetRouteEndpointParamsInterceptor"
255 }
256
257 fn read_before_execution(
258 &self,
259 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
260 '_,
261 ::aws_smithy_runtime_api::client::interceptors::context::Input,
262 ::aws_smithy_runtime_api::client::interceptors::context::Output,
263 ::aws_smithy_runtime_api::client::interceptors::context::Error,
264 >,
265 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
266 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
267 let _input = context
268 .input()
269 .downcast_ref::<GetRouteInput>()
270 .ok_or("failed to downcast to GetRouteInput")?;
271
272 let params = crate::config::endpoint::Params::builder()
273 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
274 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
275 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
276 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
277 .build()
278 .map_err(|err| {
279 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
280 })?;
281 cfg.interceptor_state()
282 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
283 ::std::result::Result::Ok(())
284 }
285}
286
287#[non_exhaustive]
292#[derive(::std::fmt::Debug)]
293pub enum GetRouteError {
294 AccessDeniedException(crate::types::error::AccessDeniedException),
296 InternalServerException(crate::types::error::InternalServerException),
298 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
300 ThrottlingException(crate::types::error::ThrottlingException),
302 ValidationException(crate::types::error::ValidationException),
304 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
306 variable wildcard pattern and check `.code()`:
307 \
308 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
309 \
310 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetRouteError) for what information is available for the error.")]
311 Unhandled(crate::error::sealed_unhandled::Unhandled),
312}
313impl GetRouteError {
314 pub fn unhandled(
316 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
317 ) -> Self {
318 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
319 source: err.into(),
320 meta: ::std::default::Default::default(),
321 })
322 }
323
324 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
326 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
327 source: err.clone().into(),
328 meta: err,
329 })
330 }
331 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
336 match self {
337 Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
338 Self::InternalServerException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
339 Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
340 Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
341 Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
342 Self::Unhandled(e) => &e.meta,
343 }
344 }
345 pub fn is_access_denied_exception(&self) -> bool {
347 matches!(self, Self::AccessDeniedException(_))
348 }
349 pub fn is_internal_server_exception(&self) -> bool {
351 matches!(self, Self::InternalServerException(_))
352 }
353 pub fn is_resource_not_found_exception(&self) -> bool {
355 matches!(self, Self::ResourceNotFoundException(_))
356 }
357 pub fn is_throttling_exception(&self) -> bool {
359 matches!(self, Self::ThrottlingException(_))
360 }
361 pub fn is_validation_exception(&self) -> bool {
363 matches!(self, Self::ValidationException(_))
364 }
365}
366impl ::std::error::Error for GetRouteError {
367 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
368 match self {
369 Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
370 Self::InternalServerException(_inner) => ::std::option::Option::Some(_inner),
371 Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
372 Self::ThrottlingException(_inner) => ::std::option::Option::Some(_inner),
373 Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
374 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
375 }
376 }
377}
378impl ::std::fmt::Display for GetRouteError {
379 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
380 match self {
381 Self::AccessDeniedException(_inner) => _inner.fmt(f),
382 Self::InternalServerException(_inner) => _inner.fmt(f),
383 Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
384 Self::ThrottlingException(_inner) => _inner.fmt(f),
385 Self::ValidationException(_inner) => _inner.fmt(f),
386 Self::Unhandled(_inner) => {
387 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
388 write!(f, "unhandled error ({code})")
389 } else {
390 f.write_str("unhandled error")
391 }
392 }
393 }
394 }
395}
396impl ::aws_smithy_types::retry::ProvideErrorKind for GetRouteError {
397 fn code(&self) -> ::std::option::Option<&str> {
398 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
399 }
400 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
401 ::std::option::Option::None
402 }
403}
404impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetRouteError {
405 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
406 match self {
407 Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
408 Self::InternalServerException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
409 Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
410 Self::ThrottlingException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
411 Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
412 Self::Unhandled(_inner) => &_inner.meta,
413 }
414 }
415}
416impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetRouteError {
417 fn create_unhandled_error(
418 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
419 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
420 ) -> Self {
421 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
422 source,
423 meta: meta.unwrap_or_default(),
424 })
425 }
426}
427impl ::aws_types::request_id::RequestId for crate::operation::get_route::GetRouteError {
428 fn request_id(&self) -> Option<&str> {
429 self.meta().request_id()
430 }
431}
432
433pub use crate::operation::get_route::_get_route_output::GetRouteOutput;
434
435pub use crate::operation::get_route::_get_route_input::GetRouteInput;
436
437mod _get_route_input;
438
439mod _get_route_output;
440
441pub mod builders;