1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 | pub use ::aws_smithy_runtime_api::client::endpoint::EndpointFuture;
|
3 3 | pub use ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver;
|
4 4 | pub use ::aws_smithy_types::endpoint::Endpoint;
|
5 5 |
|
6 + | /// Interceptor that tracks endpoint override business metric.
|
7 + | #[derive(Debug, Default)]
|
8 + | pub(crate) struct EndpointOverrideFeatureTrackerInterceptor;
|
9 + |
|
10 + | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for EndpointOverrideFeatureTrackerInterceptor {
|
11 + | fn name(&self) -> &'static str {
|
12 + | "EndpointOverrideFeatureTrackerInterceptor"
|
13 + | }
|
14 + |
|
15 + | fn read_before_execution(
|
16 + | &self,
|
17 + | _context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_>,
|
18 + | cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
19 + | ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
|
20 + | if cfg.load::<::aws_types::endpoint_config::EndpointUrl>().is_some() {
|
21 + | cfg.interceptor_state()
|
22 + | .store_append(::aws_runtime::sdk_feature::AwsSdkFeature::EndpointOverride);
|
23 + | }
|
24 + | ::std::result::Result::Ok(())
|
25 + | }
|
26 + | }
|
27 + |
|
6 28 | #[cfg(test)]
|
7 29 | mod test {
|
8 30 |
|
9 31 | /// For region af-south-1 with FIPS disabled and DualStack disabled
|
10 32 | #[test]
|
11 33 | fn test_1() {
|
12 34 | let params = crate::config::endpoint::Params::builder()
|
13 35 | .region("af-south-1".to_string())
|
14 36 | .use_fips(false)
|
15 37 | .use_dual_stack(false)
|
16 38 | .build()
|
17 39 | .expect("invalid params");
|
18 40 | let resolver = crate::config::endpoint::DefaultResolver::new();
|
19 41 | let endpoint = resolver.resolve_endpoint(¶ms);
|
20 42 | let endpoint = endpoint.expect("Expected valid endpoint: https://logs.af-south-1.amazonaws.com");
|
21 43 | assert_eq!(
|
22 44 | endpoint,
|
23 45 | ::aws_smithy_types::endpoint::Endpoint::builder()
|
24 46 | .url("https://logs.af-south-1.amazonaws.com")
|
25 47 | .build()
|
26 48 | );
|
27 49 | }
|
28 50 |
|
29 51 | /// For region ap-east-1 with FIPS disabled and DualStack disabled
|
30 52 | #[test]
|
31 53 | fn test_2() {
|
32 54 | let params = crate::config::endpoint::Params::builder()
|
33 55 | .region("ap-east-1".to_string())
|
34 56 | .use_fips(false)
|
35 57 | .use_dual_stack(false)
|