aws_sdk_dynamodb/operation/
describe_endpoints.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `DescribeEndpoints`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct DescribeEndpoints;
6impl DescribeEndpoints {
7    /// Creates a new `DescribeEndpoints`
8    pub fn new() -> Self {
9        Self
10    }
11    /// The schema for this operation's input shape.
12                    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::describe_endpoints::DescribeEndpointsInput::SCHEMA;
13                    /// The schema for this operation's output shape.
14                    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema = crate::operation::describe_endpoints::DescribeEndpointsOutput::SCHEMA;
15    pub(crate) async fn orchestrate(
16                        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17                        input: crate::operation::describe_endpoints::DescribeEndpointsInput,
18                    ) -> ::std::result::Result<crate::operation::describe_endpoints::DescribeEndpointsOutput, ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::describe_endpoints::DescribeEndpointsError, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> {
19                        let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| {
20                            err.map_service_error(|err| {
21                                err.downcast::<crate::operation::describe_endpoints::DescribeEndpointsError>().expect("correct error type")
22                            })
23                        };
24                        let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
25                            .await
26                            .map_err(map_err)?;
27                        let output = context.finalize().map_err(map_err)?;
28                        ::std::result::Result::Ok(output.downcast::<crate::operation::describe_endpoints::DescribeEndpointsOutput>().expect("correct output type"))
29                    }
30    
31                    pub(crate) async fn orchestrate_with_stop_point(
32                        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
33                        input: crate::operation::describe_endpoints::DescribeEndpointsInput,
34                        stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
35                    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> {
36                        let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
37                        use ::tracing::Instrument;
38                        ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point(
39                            "DynamoDB",
40                            "DescribeEndpoints",
41                            input,
42                            runtime_plugins,
43                            stop_point
44                        )
45                        // Create a parent span for the entire operation. Includes a random, internal-only,
46                        // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
47                        .instrument(::tracing::debug_span!(
48                                "DynamoDB.DescribeEndpoints",
49                                "rpc.service" = "DynamoDB",
50                                "rpc.method" = "DescribeEndpoints",
51                                "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
52                                "rpc.system" = "aws-api",
53                            ))
54                        .await
55                    }
56    
57                    pub(crate) fn operation_runtime_plugins(
58                        client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
59                        client_config: &crate::config::Config,
60                        config_override: ::std::option::Option<crate::config::Builder>,
61                    ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
62                        let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
63                        
64                        if let ::std::option::Option::Some(config_override) = config_override {
65                            for plugin in config_override.runtime_plugins.iter().cloned() {
66                                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
67                            }
68                            runtime_plugins = runtime_plugins.with_operation_plugin(
69                                crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components)
70                            );
71                        }
72                        runtime_plugins
73                    }
74}
75impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for DescribeEndpoints {
76                fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
77                    let mut cfg = ::aws_smithy_types::config_bag::Layer::new("DescribeEndpoints");
78
79                    cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(DescribeEndpointsRequestSerializer));
80                    cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(DescribeEndpointsResponseDeserializer));
81
82                    cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
83                        crate::config::auth::Params::builder()
84                            .operation_name("DescribeEndpoints")
85                            .build()
86                            .expect("required fields set")
87                    ));
88
89                    cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
90                            "DescribeEndpoints",
91                            "DynamoDB",
92                        ));
93let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
94                            signing_options.double_uri_encode = true;
95                            signing_options.content_sha256_header = false;
96                            signing_options.normalize_uri_path = true;
97                            signing_options.payload_override = None;
98
99                            cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
100                                signing_options,
101                                ..::std::default::Default::default()
102                            });
103
104                    ::std::option::Option::Some(cfg.freeze())
105                }
106
107                fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
108                    #[allow(unused_mut)]
109                    let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("DescribeEndpoints")
110                            .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
111.with_interceptor(DescribeEndpointsEndpointParamsInterceptor)
112                            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<crate::operation::describe_endpoints::DescribeEndpointsError>::new())
113.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<crate::operation::describe_endpoints::DescribeEndpointsError>::new())
114.with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<crate::operation::describe_endpoints::DescribeEndpointsError>::new());
115
116                    ::std::borrow::Cow::Owned(rcb)
117                }
118            }
119
120            
121#[derive(Debug)]
122            struct DescribeEndpointsResponseDeserializer;
123            impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for DescribeEndpointsResponseDeserializer {
124                
125
126                fn deserialize_nonstreaming_with_config(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse, _cfg: &::aws_smithy_types::config_bag::ConfigBag) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
127                    let (success, status) = (response.status().is_success(), response.status().as_u16());
128            #[allow(unused_mut)]
129            let mut force_error = false;
130            ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
131            if !success && status != 200 || force_error {
132                let headers = response.headers();
133                let body = response.body().bytes().expect("body loaded");
134#[allow(unused_mut)]
135            let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body)
136                .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
137            generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
138            let generic = generic_builder.build();
139::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(::aws_smithy_runtime_api::client::interceptors::context::Error::erase(crate::operation::describe_endpoints::DescribeEndpointsError::generic(generic))))
140} else {
141                let protocol = _cfg.load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
142                    .expect("a SharedClientProtocol is required");
143                let mut deser = protocol.deserialize_response(response, DescribeEndpoints::OUTPUT_SCHEMA, _cfg)
144                    .map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
145                let body = response.body().bytes().expect("body loaded");
146                let output = crate::operation::describe_endpoints::DescribeEndpointsOutput::deserialize_with_response(
147                    &mut *deser,
148                    response.headers(),
149                    response.status().into(),
150                    body,
151                ).map_err(|e| ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e)))?;
152                ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
153            }
154                }
155            }
156#[derive(Debug)]
157            struct DescribeEndpointsRequestSerializer;
158            impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for DescribeEndpointsRequestSerializer {
159                #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
160                fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
161                    let input = input.downcast::<crate::operation::describe_endpoints::DescribeEndpointsInput>().expect("correct type");
162                    let protocol = _cfg.load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
163                        .expect("a SharedClientProtocol is required");
164                    let mut request = protocol.serialize_request(
165                            &input, DescribeEndpoints::INPUT_SCHEMA, "", _cfg,
166                        ).map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
167                        
168                        return ::std::result::Result::Ok(request);
169                }
170            }
171#[derive(Debug)]
172            struct DescribeEndpointsEndpointParamsInterceptor;
173
174            impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DescribeEndpointsEndpointParamsInterceptor {
175                fn name(&self) -> &'static str {
176                    "DescribeEndpointsEndpointParamsInterceptor"
177                }
178
179                fn read_before_execution(
180                    &self,
181                    context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>,
182                    cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
183                ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
184                    let _input = context.input()
185                        .downcast_ref::<DescribeEndpointsInput>()
186                        .ok_or("failed to downcast to DescribeEndpointsInput")?;
187
188                    
189
190                    let params = crate::config::endpoint::Params::builder()
191                        .set_region(cfg.load::<::aws_types::region::Region>().map(|r|r.as_ref().to_owned()))
192.set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
193.set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
194.set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
195.set_account_id_endpoint_mode(::std::option::Option::Some(cfg.load::<::aws_types::endpoint_config::AccountIdEndpointMode>().cloned().unwrap_or_default().to_string()))
196                        .build()
197                        .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?;
198                    cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
199                    ::std::result::Result::Ok(())
200                }
201            }
202
203            // The get_* functions below are generated from JMESPath expressions in the
204            // operationContextParams trait. They target the operation's input shape.
205
206            
207
208/// Error type for the `DescribeEndpointsError` operation.
209#[non_exhaustive]
210#[derive(::std::fmt::Debug)]
211pub enum DescribeEndpointsError {
212    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
213                    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
214    variable wildcard pattern and check `.code()`:
215     \
216    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
217     \
218    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-DescribeEndpointsError) for what information is available for the error.")]
219                    Unhandled(crate::error::sealed_unhandled::Unhandled),
220}
221impl DescribeEndpointsError {
222    /// Creates the `DescribeEndpointsError::Unhandled` variant from any error type.
223                    pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>) -> Self {
224                        Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() })
225                    }
226    
227                    /// Creates the `DescribeEndpointsError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
228                    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
229                        Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err })
230                    }
231    /// 
232    /// Returns error metadata, which includes the error code, message,
233    /// request ID, and potentially additional information.
234    /// 
235    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
236        match self {
237            Self::Unhandled(e) => &e.meta,
238        }
239    }
240}
241impl ::std::error::Error for DescribeEndpointsError {
242    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
243        match self {
244            Self::Unhandled(_inner) => {
245                ::std::option::Option::Some(&*_inner.source)
246            }
247        }
248    }
249}
250impl ::std::fmt::Display for DescribeEndpointsError {
251    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
252        match self {
253            Self::Unhandled(_inner) => {
254                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
255                                                        write!(f, "unhandled error ({code})")
256                                                    } else {
257                                                        f.write_str("unhandled error")
258                                                    }
259            }
260        }
261    }
262}
263impl ::aws_smithy_types::retry::ProvideErrorKind for DescribeEndpointsError {
264    fn code(&self) -> ::std::option::Option<&str> {
265        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
266    }
267    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
268        ::std::option::Option::None
269    }
270}
271impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for DescribeEndpointsError {
272    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
273        match self {
274            Self::Unhandled(_inner) => {
275                &_inner.meta
276            }
277        }
278    }
279}
280impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for DescribeEndpointsError {
281    fn create_unhandled_error(
282                        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
283                        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>
284                    ) -> Self {
285        Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() })
286    }
287}
288impl ::aws_types::request_id::RequestId for crate::operation::describe_endpoints::DescribeEndpointsError {
289                                fn request_id(&self) -> Option<&str> {
290                                    self.meta().request_id()
291                                }
292                            }
293
294pub use crate::operation::describe_endpoints::_describe_endpoints_input::DescribeEndpointsInput;
295
296pub use crate::operation::describe_endpoints::_describe_endpoints_output::DescribeEndpointsOutput;
297
298mod _describe_endpoints_input;
299
300mod _describe_endpoints_output;
301
302/// Builders
303pub mod builders;
304