aws_sdk_s3/
sdk_feature_tracker.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/*
3 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#[allow(dead_code)]
8pub(crate) mod rpc_v2_cbor {
9    use aws_smithy_runtime::client::sdk_feature::SmithySdkFeature;
10    use aws_smithy_runtime_api::box_error::BoxError;
11    use aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextMut;
12    use aws_smithy_runtime_api::client::interceptors::Intercept;
13    use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
14    use aws_smithy_types::config_bag::ConfigBag;
15
16    #[derive(Debug)]
17    pub(crate) struct RpcV2CborFeatureTrackerInterceptor;
18
19    impl RpcV2CborFeatureTrackerInterceptor {
20        pub(crate) fn new() -> Self {
21            Self
22        }
23    }
24
25    impl Intercept for RpcV2CborFeatureTrackerInterceptor {
26        fn name(&self) -> &'static str {
27            "RpcV2CborFeatureTrackerInterceptor"
28        }
29
30        fn modify_before_serialization(
31            &self,
32            _context: &mut BeforeSerializationInterceptorContextMut<'_>,
33            _runtime_components: &RuntimeComponents,
34            cfg: &mut ConfigBag,
35        ) -> Result<(), BoxError> {
36            cfg.interceptor_state()
37                .store_append::<SmithySdkFeature>(SmithySdkFeature::ProtocolRpcV2Cbor);
38            Ok(())
39        }
40    }
41}
42
43#[allow(dead_code)]
44pub(crate) mod paginator {
45    use aws_smithy_runtime::client::sdk_feature::SmithySdkFeature;
46    use aws_smithy_runtime_api::box_error::BoxError;
47    use aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextMut;
48    use aws_smithy_runtime_api::client::interceptors::{Intercept, SharedInterceptor};
49    use aws_smithy_runtime_api::client::runtime_components::{RuntimeComponents, RuntimeComponentsBuilder};
50    use aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
51    use aws_smithy_types::config_bag::ConfigBag;
52    use std::borrow::Cow;
53
54    #[derive(Debug)]
55    struct PaginatorFeatureTrackerInterceptor;
56
57    impl PaginatorFeatureTrackerInterceptor {
58        pub(crate) fn new() -> Self {
59            Self
60        }
61    }
62
63    impl Intercept for PaginatorFeatureTrackerInterceptor {
64        fn name(&self) -> &'static str {
65            "PaginatorFeatureTrackerInterceptor"
66        }
67
68        fn modify_before_serialization(
69            &self,
70            _context: &mut BeforeSerializationInterceptorContextMut<'_>,
71            _runtime_components: &RuntimeComponents,
72            cfg: &mut ConfigBag,
73        ) -> Result<(), BoxError> {
74            cfg.interceptor_state().store_append::<SmithySdkFeature>(SmithySdkFeature::Paginator);
75            Ok(())
76        }
77    }
78
79    #[derive(Debug)]
80    pub(crate) struct PaginatorFeatureTrackerRuntimePlugin {
81        runtime_components: RuntimeComponentsBuilder,
82    }
83
84    impl PaginatorFeatureTrackerRuntimePlugin {
85        pub(crate) fn new() -> Self {
86            Self {
87                runtime_components: RuntimeComponentsBuilder::new("PaginatorFeatureTrackerRuntimePlugin")
88                    .with_interceptor(SharedInterceptor::new(PaginatorFeatureTrackerInterceptor::new())),
89            }
90        }
91    }
92
93    impl RuntimePlugin for PaginatorFeatureTrackerRuntimePlugin {
94        fn runtime_components(&self, _: &RuntimeComponentsBuilder) -> Cow<'_, RuntimeComponentsBuilder> {
95            Cow::Borrowed(&self.runtime_components)
96        }
97    }
98}
99
100#[allow(dead_code)]
101pub(crate) mod waiter {
102    use aws_smithy_runtime::client::sdk_feature::SmithySdkFeature;
103    use aws_smithy_runtime_api::box_error::BoxError;
104    use aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextMut;
105    use aws_smithy_runtime_api::client::interceptors::{Intercept, SharedInterceptor};
106    use aws_smithy_runtime_api::client::runtime_components::{RuntimeComponents, RuntimeComponentsBuilder};
107    use aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin;
108    use aws_smithy_types::config_bag::ConfigBag;
109    use std::borrow::Cow;
110
111    #[derive(Debug)]
112    struct WaiterFeatureTrackerInterceptor;
113
114    impl WaiterFeatureTrackerInterceptor {
115        pub(crate) fn new() -> Self {
116            Self
117        }
118    }
119
120    impl Intercept for WaiterFeatureTrackerInterceptor {
121        fn name(&self) -> &'static str {
122            "WaiterFeatureTrackerInterceptor"
123        }
124
125        fn modify_before_serialization(
126            &self,
127            _context: &mut BeforeSerializationInterceptorContextMut<'_>,
128            _runtime_components: &RuntimeComponents,
129            cfg: &mut ConfigBag,
130        ) -> Result<(), BoxError> {
131            cfg.interceptor_state().store_append::<SmithySdkFeature>(SmithySdkFeature::Waiter);
132            Ok(())
133        }
134    }
135
136    #[derive(Debug)]
137    pub(crate) struct WaiterFeatureTrackerRuntimePlugin {
138        runtime_components: RuntimeComponentsBuilder,
139    }
140
141    impl WaiterFeatureTrackerRuntimePlugin {
142        pub(crate) fn new() -> Self {
143            Self {
144                runtime_components: RuntimeComponentsBuilder::new("WaiterFeatureTrackerRuntimePlugin")
145                    .with_interceptor(SharedInterceptor::new(WaiterFeatureTrackerInterceptor::new())),
146            }
147        }
148    }
149
150    impl RuntimePlugin for WaiterFeatureTrackerRuntimePlugin {
151        fn runtime_components(&self, _: &RuntimeComponentsBuilder) -> Cow<'_, RuntimeComponentsBuilder> {
152            Cow::Borrowed(&self.runtime_components)
153        }
154    }
155}
156
157#[allow(dead_code)]
158pub(crate) mod retry_mode {
159    use aws_smithy_runtime::client::sdk_feature::SmithySdkFeature;
160    use aws_smithy_runtime_api::box_error::BoxError;
161    use aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef;
162    use aws_smithy_runtime_api::client::interceptors::Intercept;
163    use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents;
164    use aws_smithy_types::config_bag::ConfigBag;
165    use aws_smithy_types::retry::{RetryConfig, RetryMode};
166
167    #[derive(Debug)]
168    pub(crate) struct RetryModeFeatureTrackerInterceptor;
169
170    impl RetryModeFeatureTrackerInterceptor {
171        pub(crate) fn new() -> Self {
172            Self
173        }
174    }
175
176    impl Intercept for RetryModeFeatureTrackerInterceptor {
177        fn name(&self) -> &'static str {
178            "RetryModeFeatureTrackerInterceptor"
179        }
180
181        fn read_before_serialization(
182            &self,
183            _context: &BeforeSerializationInterceptorContextRef<'_>,
184            _runtime_components: &RuntimeComponents,
185            cfg: &mut ConfigBag,
186        ) -> Result<(), BoxError> {
187            cfg.load::<RetryConfig>()
188                .map(|retry_config| match retry_config.mode() {
189                    RetryMode::Standard => SmithySdkFeature::RetryModeStandard,
190                    RetryMode::Adaptive => SmithySdkFeature::RetryModeAdaptive,
191                    _ => unreachable!("retry mode must be standard or adaptive"),
192                })
193                .map(|feature| cfg.interceptor_state().store_append::<SmithySdkFeature>(feature));
194
195            Ok(())
196        }
197    }
198}