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