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