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