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::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
113 .with_interceptor(GetSpaceEndpointParamsInterceptor)
114 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
115 crate::operation::get_space::GetSpaceError,
116 >::new())
117 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
118 crate::operation::get_space::GetSpaceError,
119 >::new())
120 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
121 crate::operation::get_space::GetSpaceError,
122 >::new());
123
124 ::std::borrow::Cow::Owned(rcb)
125 }
126}
127
128#[derive(Debug)]
129struct GetSpaceResponseDeserializer;
130impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetSpaceResponseDeserializer {
131 fn deserialize_nonstreaming(
132 &self,
133 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
134 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
135 let (success, status) = (response.status().is_success(), response.status().as_u16());
136 let headers = response.headers();
137 let body = response.body().bytes().expect("body loaded");
138 #[allow(unused_mut)]
139 let mut force_error = false;
140 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
141 let parse_result = if !success && status != 200 || force_error {
142 crate::protocol_serde::shape_get_space::de_get_space_http_error(status, headers, body)
143 } else {
144 crate::protocol_serde::shape_get_space::de_get_space_http_response(status, headers, body)
145 };
146 crate::protocol_serde::type_erase_result(parse_result)
147 }
148}
149#[derive(Debug)]
150struct GetSpaceRequestSerializer;
151impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetSpaceRequestSerializer {
152 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
153 fn serialize_input(
154 &self,
155 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
156 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
157 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
158 let input = input.downcast::<crate::operation::get_space::GetSpaceInput>().expect("correct type");
159 let _header_serialization_settings = _cfg
160 .load::<crate::serialization_settings::HeaderSerializationSettings>()
161 .cloned()
162 .unwrap_or_default();
163 let mut request_builder = {
164 fn uri_base(
165 _input: &crate::operation::get_space::GetSpaceInput,
166 output: &mut ::std::string::String,
167 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
168 use ::std::fmt::Write as _;
169 let input_1 = &_input.name;
170 let input_1 = input_1
171 .as_ref()
172 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("name", "cannot be empty or unset"))?;
173 let name = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
174 if name.is_empty() {
175 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
176 "name",
177 "cannot be empty or unset",
178 ));
179 }
180 ::std::write!(output, "/v1/spaces/{name}", name = name).expect("formatting should succeed");
181 ::std::result::Result::Ok(())
182 }
183 #[allow(clippy::unnecessary_wraps)]
184 fn update_http_builder(
185 input: &crate::operation::get_space::GetSpaceInput,
186 builder: ::http::request::Builder,
187 ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
188 let mut uri = ::std::string::String::new();
189 uri_base(input, &mut uri)?;
190 ::std::result::Result::Ok(builder.method("GET").uri(uri))
191 }
192 let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
193 builder
194 };
195 let body = ::aws_smithy_types::body::SdkBody::from("");
196
197 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
198 }
199}
200#[derive(Debug)]
201struct GetSpaceEndpointParamsInterceptor;
202
203impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetSpaceEndpointParamsInterceptor {
204 fn name(&self) -> &'static str {
205 "GetSpaceEndpointParamsInterceptor"
206 }
207
208 fn read_before_execution(
209 &self,
210 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
211 '_,
212 ::aws_smithy_runtime_api::client::interceptors::context::Input,
213 ::aws_smithy_runtime_api::client::interceptors::context::Output,
214 ::aws_smithy_runtime_api::client::interceptors::context::Error,
215 >,
216 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
217 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
218 let _input = context
219 .input()
220 .downcast_ref::<GetSpaceInput>()
221 .ok_or("failed to downcast to GetSpaceInput")?;
222
223 let params = crate::config::endpoint::Params::builder()
224 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
225 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
226 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
227 .build()
228 .map_err(|err| {
229 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
230 })?;
231 cfg.interceptor_state()
232 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
233 ::std::result::Result::Ok(())
234 }
235}
236
237#[non_exhaustive]
242#[derive(::std::fmt::Debug)]
243pub enum GetSpaceError {
244 AccessDeniedException(crate::types::error::AccessDeniedException),
246 ConflictException(crate::types::error::ConflictException),
248 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
250 ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
252 ThrottlingException(crate::types::error::ThrottlingException),
254 ValidationException(crate::types::error::ValidationException),
256 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
258 variable wildcard pattern and check `.code()`:
259 \
260 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
261 \
262 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetSpaceError) for what information is available for the error.")]
263 Unhandled(crate::error::sealed_unhandled::Unhandled),
264}
265impl GetSpaceError {
266 pub fn unhandled(
268 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
269 ) -> Self {
270 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
271 source: err.into(),
272 meta: ::std::default::Default::default(),
273 })
274 }
275
276 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
278 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
279 source: err.clone().into(),
280 meta: err,
281 })
282 }
283 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
288 match self {
289 Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
290 Self::ConflictException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
291 Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
292 Self::ServiceQuotaExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
293 Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
294 Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
295 Self::Unhandled(e) => &e.meta,
296 }
297 }
298 pub fn is_access_denied_exception(&self) -> bool {
300 matches!(self, Self::AccessDeniedException(_))
301 }
302 pub fn is_conflict_exception(&self) -> bool {
304 matches!(self, Self::ConflictException(_))
305 }
306 pub fn is_resource_not_found_exception(&self) -> bool {
308 matches!(self, Self::ResourceNotFoundException(_))
309 }
310 pub fn is_service_quota_exceeded_exception(&self) -> bool {
312 matches!(self, Self::ServiceQuotaExceededException(_))
313 }
314 pub fn is_throttling_exception(&self) -> bool {
316 matches!(self, Self::ThrottlingException(_))
317 }
318 pub fn is_validation_exception(&self) -> bool {
320 matches!(self, Self::ValidationException(_))
321 }
322}
323impl ::std::error::Error for GetSpaceError {
324 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
325 match self {
326 Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
327 Self::ConflictException(_inner) => ::std::option::Option::Some(_inner),
328 Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
329 Self::ServiceQuotaExceededException(_inner) => ::std::option::Option::Some(_inner),
330 Self::ThrottlingException(_inner) => ::std::option::Option::Some(_inner),
331 Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
332 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
333 }
334 }
335}
336impl ::std::fmt::Display for GetSpaceError {
337 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
338 match self {
339 Self::AccessDeniedException(_inner) => _inner.fmt(f),
340 Self::ConflictException(_inner) => _inner.fmt(f),
341 Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
342 Self::ServiceQuotaExceededException(_inner) => _inner.fmt(f),
343 Self::ThrottlingException(_inner) => _inner.fmt(f),
344 Self::ValidationException(_inner) => _inner.fmt(f),
345 Self::Unhandled(_inner) => {
346 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
347 write!(f, "unhandled error ({code})")
348 } else {
349 f.write_str("unhandled error")
350 }
351 }
352 }
353 }
354}
355impl ::aws_smithy_types::retry::ProvideErrorKind for GetSpaceError {
356 fn code(&self) -> ::std::option::Option<&str> {
357 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
358 }
359 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
360 match self {
361 Self::ThrottlingException(inner) => ::std::option::Option::Some(inner.retryable_error_kind()),
362 _ => ::std::option::Option::None,
363 }
364 }
365}
366impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetSpaceError {
367 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
368 match self {
369 Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
370 Self::ConflictException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
371 Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
372 Self::ServiceQuotaExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
373 Self::ThrottlingException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
374 Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
375 Self::Unhandled(_inner) => &_inner.meta,
376 }
377 }
378}
379impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetSpaceError {
380 fn create_unhandled_error(
381 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
382 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
383 ) -> Self {
384 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
385 source,
386 meta: meta.unwrap_or_default(),
387 })
388 }
389}
390impl ::aws_types::request_id::RequestId for crate::operation::get_space::GetSpaceError {
391 fn request_id(&self) -> Option<&str> {
392 self.meta().request_id()
393 }
394}
395
396pub use crate::operation::get_space::_get_space_output::GetSpaceOutput;
397
398pub use crate::operation::get_space::_get_space_input::GetSpaceInput;
399
400mod _get_space_input;
401
402mod _get_space_output;
403
404pub mod builders;