aws_sdk_codecatalyst/operation/
get_space.rs1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct GetSpace;
6impl GetSpace {
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_space::GetSpaceInput,
14 ) -> ::std::result::Result<
15 crate::operation::get_space::GetSpaceOutput,
16 ::aws_smithy_runtime_api::client::result::SdkError<
17 crate::operation::get_space::GetSpaceError,
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_space::GetSpaceError>().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_space::GetSpaceOutput>()
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_space::GetSpaceInput,
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("CodeCatalyst", "GetSpace", input, runtime_plugins, stop_point)
51 .instrument(::tracing::debug_span!(
54 "CodeCatalyst.GetSpace",
55 "rpc.service" = "CodeCatalyst",
56 "rpc.method" = "GetSpace",
57 "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
58 "rpc.system" = "aws-api",
59 ))
60 .await
61 }
62
63 pub(crate) fn operation_runtime_plugins(
64 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
65 client_config: &crate::config::Config,
66 config_override: ::std::option::Option<crate::config::Builder>,
67 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
68 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
69
70 if let ::std::option::Option::Some(config_override) = config_override {
71 for plugin in config_override.runtime_plugins.iter().cloned() {
72 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
73 }
74 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
75 config_override,
76 client_config.config.clone(),
77 &client_config.runtime_components,
78 ));
79 }
80 runtime_plugins
81 }
82}
83impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for GetSpace {
84 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
85 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GetSpace");
86
87 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
88 GetSpaceRequestSerializer,
89 ));
90 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
91 GetSpaceResponseDeserializer,
92 ));
93
94 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
95 crate::config::auth::Params::builder()
96 .operation_name("GetSpace")
97 .build()
98 .expect("required fields set"),
99 ));
100
101 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("GetSpace", "CodeCatalyst"));
102
103 ::std::option::Option::Some(cfg.freeze())
104 }
105
106 fn runtime_components(
107 &self,
108 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
109 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
110 #[allow(unused_mut)]
111 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("GetSpace")
112 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
113 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
114 ))
115 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
116 GetSpaceEndpointParamsInterceptor,
117 ))
118 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
119 crate::operation::get_space::GetSpaceError,
120 >::new())
121 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
122 crate::operation::get_space::GetSpaceError,
123 >::new())
124 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
125 crate::operation::get_space::GetSpaceError,
126 >::new());
127
128 ::std::borrow::Cow::Owned(rcb)
129 }
130}
131
132#[derive(Debug)]
133struct GetSpaceResponseDeserializer;
134impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetSpaceResponseDeserializer {
135 fn deserialize_nonstreaming(
136 &self,
137 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
138 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
139 let (success, status) = (response.status().is_success(), response.status().as_u16());
140 let headers = response.headers();
141 let body = response.body().bytes().expect("body loaded");
142 #[allow(unused_mut)]
143 let mut force_error = false;
144 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
145 let parse_result = if !success && status != 200 || force_error {
146 crate::protocol_serde::shape_get_space::de_get_space_http_error(status, headers, body)
147 } else {
148 crate::protocol_serde::shape_get_space::de_get_space_http_response(status, headers, body)
149 };
150 crate::protocol_serde::type_erase_result(parse_result)
151 }
152}
153#[derive(Debug)]
154struct GetSpaceRequestSerializer;
155impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetSpaceRequestSerializer {
156 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
157 fn serialize_input(
158 &self,
159 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
160 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
161 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
162 let input = input.downcast::<crate::operation::get_space::GetSpaceInput>().expect("correct type");
163 let _header_serialization_settings = _cfg
164 .load::<crate::serialization_settings::HeaderSerializationSettings>()
165 .cloned()
166 .unwrap_or_default();
167 let mut request_builder = {
168 #[allow(clippy::uninlined_format_args)]
169 fn uri_base(
170 _input: &crate::operation::get_space::GetSpaceInput,
171 output: &mut ::std::string::String,
172 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
173 use ::std::fmt::Write as _;
174 let input_1 = &_input.name;
175 let input_1 = input_1
176 .as_ref()
177 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("name", "cannot be empty or unset"))?;
178 let name = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
179 if name.is_empty() {
180 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
181 "name",
182 "cannot be empty or unset",
183 ));
184 }
185 ::std::write!(output, "/v1/spaces/{name}", name = name).expect("formatting should succeed");
186 ::std::result::Result::Ok(())
187 }
188 #[allow(clippy::unnecessary_wraps)]
189 fn update_http_builder(
190 input: &crate::operation::get_space::GetSpaceInput,
191 builder: ::http_1x::request::Builder,
192 ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
193 let mut uri = ::std::string::String::new();
194 uri_base(input, &mut uri)?;
195 ::std::result::Result::Ok(builder.method("GET").uri(uri))
196 }
197 let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
198 builder
199 };
200 let body = ::aws_smithy_types::body::SdkBody::from("");
201
202 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
203 }
204}
205#[derive(Debug)]
206struct GetSpaceEndpointParamsInterceptor;
207
208#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
209impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetSpaceEndpointParamsInterceptor {
210 fn name(&self) -> &'static str {
211 "GetSpaceEndpointParamsInterceptor"
212 }
213
214 fn read_before_execution(
215 &self,
216 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
217 '_,
218 ::aws_smithy_runtime_api::client::interceptors::context::Input,
219 ::aws_smithy_runtime_api::client::interceptors::context::Output,
220 ::aws_smithy_runtime_api::client::interceptors::context::Error,
221 >,
222 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
223 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
224 let _input = context
225 .input()
226 .downcast_ref::<GetSpaceInput>()
227 .ok_or("failed to downcast to GetSpaceInput")?;
228
229 let params = crate::config::endpoint::Params::builder()
230 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
231 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
232 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
233 .build()
234 .map_err(|err| {
235 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
236 })?;
237 cfg.interceptor_state()
238 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
239 ::std::result::Result::Ok(())
240 }
241}
242
243#[non_exhaustive]
248#[derive(::std::fmt::Debug)]
249pub enum GetSpaceError {
250 AccessDeniedException(crate::types::error::AccessDeniedException),
252 ConflictException(crate::types::error::ConflictException),
254 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
256 ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
258 ThrottlingException(crate::types::error::ThrottlingException),
260 ValidationException(crate::types::error::ValidationException),
262 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
264 variable wildcard pattern and check `.code()`:
265 \
266 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
267 \
268 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetSpaceError) for what information is available for the error.")]
269 Unhandled(crate::error::sealed_unhandled::Unhandled),
270}
271impl GetSpaceError {
272 pub fn unhandled(
274 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
275 ) -> Self {
276 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
277 source: err.into(),
278 meta: ::std::default::Default::default(),
279 })
280 }
281
282 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
284 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
285 source: err.clone().into(),
286 meta: err,
287 })
288 }
289 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
294 match self {
295 Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
296 Self::ConflictException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
297 Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
298 Self::ServiceQuotaExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
299 Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
300 Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
301 Self::Unhandled(e) => &e.meta,
302 }
303 }
304 pub fn is_access_denied_exception(&self) -> bool {
306 matches!(self, Self::AccessDeniedException(_))
307 }
308 pub fn is_conflict_exception(&self) -> bool {
310 matches!(self, Self::ConflictException(_))
311 }
312 pub fn is_resource_not_found_exception(&self) -> bool {
314 matches!(self, Self::ResourceNotFoundException(_))
315 }
316 pub fn is_service_quota_exceeded_exception(&self) -> bool {
318 matches!(self, Self::ServiceQuotaExceededException(_))
319 }
320 pub fn is_throttling_exception(&self) -> bool {
322 matches!(self, Self::ThrottlingException(_))
323 }
324 pub fn is_validation_exception(&self) -> bool {
326 matches!(self, Self::ValidationException(_))
327 }
328}
329impl ::std::error::Error for GetSpaceError {
330 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
331 match self {
332 Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
333 Self::ConflictException(_inner) => ::std::option::Option::Some(_inner),
334 Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
335 Self::ServiceQuotaExceededException(_inner) => ::std::option::Option::Some(_inner),
336 Self::ThrottlingException(_inner) => ::std::option::Option::Some(_inner),
337 Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
338 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
339 }
340 }
341}
342impl ::std::fmt::Display for GetSpaceError {
343 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
344 match self {
345 Self::AccessDeniedException(_inner) => _inner.fmt(f),
346 Self::ConflictException(_inner) => _inner.fmt(f),
347 Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
348 Self::ServiceQuotaExceededException(_inner) => _inner.fmt(f),
349 Self::ThrottlingException(_inner) => _inner.fmt(f),
350 Self::ValidationException(_inner) => _inner.fmt(f),
351 Self::Unhandled(_inner) => {
352 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
353 write!(f, "unhandled error ({code})")
354 } else {
355 f.write_str("unhandled error")
356 }
357 }
358 }
359 }
360}
361impl ::aws_smithy_types::retry::ProvideErrorKind for GetSpaceError {
362 fn code(&self) -> ::std::option::Option<&str> {
363 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
364 }
365 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
366 match self {
367 Self::ThrottlingException(inner) => ::std::option::Option::Some(inner.retryable_error_kind()),
368 _ => ::std::option::Option::None,
369 }
370 }
371}
372impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetSpaceError {
373 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
374 match self {
375 Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
376 Self::ConflictException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
377 Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
378 Self::ServiceQuotaExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
379 Self::ThrottlingException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
380 Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
381 Self::Unhandled(_inner) => &_inner.meta,
382 }
383 }
384}
385impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetSpaceError {
386 fn create_unhandled_error(
387 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
388 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
389 ) -> Self {
390 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
391 source,
392 meta: meta.unwrap_or_default(),
393 })
394 }
395}
396impl ::aws_types::request_id::RequestId for crate::operation::get_space::GetSpaceError {
397 fn request_id(&self) -> Option<&str> {
398 self.meta().request_id()
399 }
400}
401
402pub use crate::operation::get_space::_get_space_input::GetSpaceInput;
403
404pub use crate::operation::get_space::_get_space_output::GetSpaceOutput;
405
406mod _get_space_input;
407
408mod _get_space_output;
409
410pub mod builders;