AWS SDK
rev. 94f0eaf10b3c815f4addb1b170a9f93d7a15c7b3
Files changed:
@@ -1,1 +34,34 @@
1 1 | # Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 | [package]
|
3 3 | name = "aws-smithy-mocks"
|
4 - | version = "0.1.2"
|
4 + | version = "0.2.0"
|
5 5 | authors = ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>"]
|
6 6 | description = "Testing utilities for smithy-rs generated clients"
|
7 7 | edition = "2021"
|
8 8 | license = "Apache-2.0"
|
9 9 | repository = "https://github.com/smithy-lang/smithy-rs"
|
10 10 | [package.metadata.docs.rs]
|
11 11 | all-features = true
|
12 12 | targets = ["x86_64-unknown-linux-gnu"]
|
13 13 | cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
|
14 14 | rustdoc-args = ["--cfg", "docsrs"]
|
15 15 |
|
16 16 | [dependencies]
|
17 17 | http = "1"
|
18 18 |
|
19 19 | [dependencies.aws-smithy-types]
|
20 20 | path = "../aws-smithy-types"
|
21 21 | version = "1.3.2"
|
22 22 |
|
23 23 | [dependencies.aws-smithy-runtime-api]
|
24 24 | path = "../aws-smithy-runtime-api"
|
25 25 | features = ["client", "http-1x", "test-util"]
|
26 26 | version = "1.9.0"
|
27 27 |
|
28 28 | [dependencies.aws-smithy-http-client]
|
29 29 | path = "../aws-smithy-http-client"
|
30 30 | features = ["test-util"]
|
31 31 | version = "1.1.2"
|
32 32 | [dev-dependencies.tokio]
|
33 33 | version = "1"
|
34 34 | features = ["full"]
|
@@ -1,1 +46,70 @@
1 1 | # aws-smithy-mocks
|
2 2 |
|
3 3 | A flexible mocking framework for testing clients generated by smithy-rs, including all packages of the AWS SDK for Rust.
|
4 4 |
|
5 5 | This crate provides a simple yet powerful way to mock SDK client responses for testing purposes.
|
6 6 | It uses interceptors to return stub responses, allowing you to test both happy-path and error scenarios
|
7 7 | without mocking the entire client or using traits.
|
8 8 |
|
9 9 | ## Key Features
|
10 10 |
|
11 11 | - **Simple API**: Create mock rules with a fluent API using the [`mock!`] macro
|
12 12 | - **Flexible Response Types**: Return modeled outputs, errors, or raw HTTP responses
|
13 13 | - **Request Matching**: Match requests based on their properties
|
14 14 | - **Response Sequencing**: Define sequences of responses for testing retry behavior
|
15 15 | - **Rule Modes**: Control how rules are matched and applied
|
16 16 |
|
17 + | ## Prerequisites
|
18 + |
|
19 + | <div class="warning">
|
20 + | You must enable the `test-util` feature of the service client crate in order to use the `mock_client` macro.
|
21 + | </div>
|
22 + |
|
23 + | If the feature is not enabled a compilation error similar to the following will occur:
|
24 + |
|
25 + | ```
|
26 + | no method named with_test_defaults found for struct <service-client-crate>::config::Builder in the current scope
|
27 + | method not found in Builder
|
28 + | ```
|
29 + |
|
30 + | Example `Cargo.toml` using the `aws-sdk-s3` crate as the service client crate under test:
|
31 + |
|
32 + | ```toml
|
33 + | [dependencies]
|
34 + | aws-sdk-s3 = "1"
|
35 + |
|
36 + | [test-dependencies]
|
37 + | aws-smithy-mocks = "0.2"
|
38 + | aws-sdk-s3 = { version = "1", features = ["test-util"] }
|
39 + | ```
|
40 + |
|
17 41 | ## Basic Usage
|
18 42 |
|
19 43 | ```rust,ignore
|
20 44 | use aws_sdk_s3::operation::get_object::GetObjectOutput;
|
21 45 | use aws_sdk_s3::Client;
|
22 46 | use aws_smithy_types::byte_stream::ByteStream;
|
23 47 | use aws_smithy_mocks::{mock, mock_client};
|
24 48 |
|
25 49 | #[tokio::test]
|
26 50 | async fn test_s3_get_object() {
|
27 51 | // Create a rule that returns a successful response
|
28 52 | let get_object_rule = mock!(Client::get_object)
|
29 53 | .match_requests(|req| req.bucket() == Some("test-bucket") && req.key() == Some("test-key"))
|
30 54 | .then_output(|| GetObjectOutput::builder()
|
31 55 | .body(ByteStream::from_static(b"test-content"))
|
32 56 | .build()
|
33 57 | );
|
34 58 |
|
35 59 | // Create a mocked client with the rule
|
36 60 | let s3 = mock_client!(aws_sdk_s3, [&get_object_rule]);
|
37 61 |
|
38 62 | // Use the client as you would normally
|
39 63 | let result = s3.get_object()
|
40 64 | .bucket("test-bucket")
|
41 65 | .key("test-key")
|
42 66 | .send()
|
43 67 | .await
|
44 68 | .expect("success response");
|
45 69 |
|
46 70 | // Verify the response
|
@@ -50,50 +109,112 @@
50 50 | /// use aws_sdk_s3::operation::get_object::GetObjectError;
|
51 51 | /// use aws_sdk_s3::types::error::NoSuchKey;
|
52 52 | /// use aws_sdk_s3::Client;
|
53 53 | /// use aws_smithy_mocks::mock;
|
54 54 | /// let get_object_error_path = mock!(Client::get_object)
|
55 55 | /// .then_error(||GetObjectError::NoSuchKey(NoSuchKey::builder().build()));
|
56 56 | /// ```
|
57 57 | ///
|
58 58 | #[macro_export]
|
59 59 | macro_rules! mock {
|
60 60 | ($operation: expr) => {
|
61 61 | #[allow(unreachable_code)]
|
62 62 | {
|
63 63 | $crate::RuleBuilder::new_from_mock(
|
64 64 | // We don't actually want to run this code, so we put it in a closure. The closure
|
65 65 | // has the types we want which makes this whole thing type-safe (and the IDE can even
|
66 66 | // figure out the right input/output types in inference!)
|
67 67 | // The code generated here is:
|
68 68 | // `Client::list_buckets(todo!())`
|
69 69 | || $operation(todo!()).as_input().clone().build().unwrap(),
|
70 70 | || $operation(todo!()).send(),
|
71 71 | )
|
72 72 | }
|
73 73 | };
|
74 74 | }
|
75 75 |
|
76 76 | // This could be obviated by a reasonable trait, since you can express it with SdkConfig if clients implement From<&SdkConfig>.
|
77 77 |
|
78 78 | /// `mock_client!` macro produces a Client configured with a number of Rules and appropriate test default configuration.
|
79 79 | ///
|
80 + | /// ## Prerequisites
|
81 + | /// You must enable the `test-util` feature of the service client crate in order to use the `mock_client` macro.
|
82 + | ///
|
80 83 | /// # Examples
|
81 84 | ///
|
82 85 | /// **Create a client that uses a mock failure and then a success**:
|
83 86 | ///
|
84 87 | /// ```rust,ignore
|
85 88 | /// use aws_sdk_s3::operation::get_object::{GetObjectOutput, GetObjectError};
|
86 89 | /// use aws_sdk_s3::types::error::NoSuchKey;
|
87 90 | /// use aws_sdk_s3::Client;
|
88 91 | /// use aws_smithy_types::byte_stream::ByteStream;
|
89 92 | /// use aws_smithy_mocks::{mock_client, mock, RuleMode};
|
90 93 | /// let get_object_error_path = mock!(Client::get_object)
|
91 94 | /// .then_error(||GetObjectError::NoSuchKey(NoSuchKey::builder().build()))
|
92 95 | /// .build();
|
93 96 | /// let get_object_happy_path = mock!(Client::get_object)
|
94 97 | /// .match_requests(|req|req.bucket() == Some("test-bucket") && req.key() == Some("test-key"))
|
95 98 | /// .then_output(||GetObjectOutput::builder().body(ByteStream::from_static(b"12345-abcde")).build())
|
96 99 | /// .build();
|
97 100 | /// let client = mock_client!(aws_sdk_s3, RuleMode::Sequential, &[&get_object_error_path, &get_object_happy_path]);
|
98 101 | ///
|
99 102 | ///
|
100 103 | /// **Create a client but customize a specific setting**:
|
101 104 | /// rust,ignore
|
102 105 | /// use aws_sdk_s3::operation::get_object::GetObjectOutput;
|
103 106 | /// use aws_sdk_s3::Client;
|
104 107 | /// use aws_smithy_types::byte_stream::ByteStream;
|
105 108 | /// use aws_smithy_mocks::{mock_client, mock, RuleMode};
|
106 109 | /// let get_object_happy_path = mock!(Client::get_object)
|
107 110 | /// .match_requests(|req|req.bucket() == Some("test-bucket") && req.key() == Some("test-key"))
|
108 111 | /// .then_output(||GetObjectOutput::builder().body(ByteStream::from_static(b"12345-abcde")).build())
|
109 112 | /// .build();
|
@@ -116,119 +153,155 @@
116 119 | /// );
|
117 120 | /// ```
|
118 121 | ///
|
119 122 | #[macro_export]
|
120 123 | macro_rules! mock_client {
|
121 124 | ($aws_crate: ident, $rules: expr) => {
|
122 125 | $crate::mock_client!($aws_crate, $crate::RuleMode::Sequential, $rules)
|
123 126 | };
|
124 127 | ($aws_crate: ident, $rule_mode: expr, $rules: expr) => {{
|
125 128 | $crate::mock_client!($aws_crate, $rule_mode, $rules, |conf| conf)
|
126 129 | }};
|
127 130 | ($aws_crate: ident, $rule_mode: expr, $rules: expr, $additional_configuration: expr) => {{
|
128 131 | let mut mock_response_interceptor =
|
129 132 | $crate::MockResponseInterceptor::new().rule_mode($rule_mode);
|
130 133 | for rule in $rules {
|
131 134 | mock_response_interceptor = mock_response_interceptor.with_rule(rule)
|
132 135 | }
|
133 136 |
|
134 137 | // Create a mock HTTP client
|
135 138 | let mock_http_client = $crate::create_mock_http_client();
|
136 139 |
|
137 140 | // Allow callers to avoid explicitly specifying the type
|
138 141 | fn coerce<T: Fn($aws_crate::config::Builder) -> $aws_crate::config::Builder>(f: T) -> T {
|
139 142 | f
|
140 143 | }
|
141 144 |
|
142 145 | $aws_crate::client::Client::from_conf(
|
143 146 | coerce($additional_configuration)(
|
144 147 | $aws_crate::config::Config::builder()
|
145 148 | .with_test_defaults()
|
146 - | .region($aws_crate::config::Region::from_static("us-east-1"))
|
147 149 | .http_client(mock_http_client)
|
148 150 | .interceptor(mock_response_interceptor),
|
149 151 | )
|
150 152 | .build(),
|
151 153 | )
|
152 154 | }};
|
153 155 | }
|
@@ -1252,1252 +1311,1314 @@
1252 1252 |
|
1253 1253 | /// Convenience method to set the latest behavior major version
|
1254 1254 | ///
|
1255 1255 | /// This is equivalent to enabling the `behavior-version-latest` Cargo feature
|
1256 1256 | pub fn behavior_version_latest(mut self) -> Self {
|
1257 1257 | self.set_behavior_version(Some(crate::config::BehaviorVersion::latest()));
|
1258 1258 | self
|
1259 1259 | }
|
1260 1260 | /// Adds a runtime plugin to the config.
|
1261 1261 | #[allow(unused)]
|
1262 1262 | pub(crate) fn runtime_plugin(mut self, plugin: impl crate::config::RuntimePlugin + 'static) -> Self {
|
1263 1263 | self.push_runtime_plugin(crate::config::SharedRuntimePlugin::new(plugin));
|
1264 1264 | self
|
1265 1265 | }
|
1266 1266 | /// Adds a runtime plugin to the config.
|
1267 1267 | #[allow(unused)]
|
1268 1268 | pub(crate) fn push_runtime_plugin(&mut self, plugin: crate::config::SharedRuntimePlugin) -> &mut Self {
|
1269 1269 | self.runtime_plugins.push(plugin);
|
1270 1270 | self
|
1271 1271 | }
|
1272 1272 | #[cfg(any(feature = "test-util", test))]
|
1273 1273 | #[allow(unused_mut)]
|
1274 1274 | /// Apply test defaults to the builder
|
1275 1275 | pub fn apply_test_defaults(&mut self) -> &mut Self {
|
1276 1276 | self.set_idempotency_token_provider(Some("00000000-0000-4000-8000-000000000000".into()));
|
1277 1277 | self.set_time_source(::std::option::Option::Some(::aws_smithy_async::time::SharedTimeSource::new(
|
1278 1278 | ::aws_smithy_async::time::StaticTimeSource::new(::std::time::UNIX_EPOCH + ::std::time::Duration::from_secs(1234567890)),
|
1279 1279 | )));
|
1280 1280 | self.config.store_put(::aws_runtime::user_agent::AwsUserAgent::for_tests());
|
1281 1281 | self.set_token_provider(Some(crate::config::SharedTokenProvider::new(::aws_credential_types::Token::for_tests())));
|
1282 + | if self.config.load::<crate::config::Region>().is_none() {
|
1283 + | self.set_region(::std::option::Option::Some(crate::config::Region::new("us-east-1")));
|
1284 + | }
|
1282 1285 | self.set_credentials_provider(Some(crate::config::SharedCredentialsProvider::new(
|
1283 1286 | ::aws_credential_types::Credentials::for_tests(),
|
1284 1287 | )));
|
1285 1288 | self.behavior_version = ::std::option::Option::Some(crate::config::BehaviorVersion::latest());
|
1286 1289 | self
|
1287 1290 | }
|
1288 1291 | #[cfg(any(feature = "test-util", test))]
|
1289 1292 | #[allow(unused_mut)]
|
1290 1293 | /// Apply test defaults to the builder
|
1291 1294 | pub fn with_test_defaults(mut self) -> Self {
|
1292 1295 | self.apply_test_defaults();
|
1293 1296 | self
|
1294 1297 | }
|
1295 1298 | /// Builds a [`Config`].
|
1296 1299 | #[allow(unused_mut)]
|
1297 1300 | pub fn build(mut self) -> Config {
|
1298 1301 | let mut layer = self.config;
|
1299 1302 | if self.runtime_components.time_source().is_none() {
|
1300 1303 | self.runtime_components
|
1301 1304 | .set_time_source(::std::option::Option::Some(::std::default::Default::default()));
|
1302 1305 | }
|
1303 1306 | layer.store_put(crate::meta::API_METADATA.clone());
|
1304 1307 | layer.store_put(::aws_types::SigningName::from_static("bedrock"));
|
1305 1308 | layer
|
1306 1309 | .load::<::aws_types::region::Region>()
|
1307 1310 | .cloned()
|
1308 1311 | .map(|r| layer.store_put(::aws_types::region::SigningRegion::from(r)));
|
1309 1312 | Config {
|
1310 1313 | config: crate::config::Layer::from(layer.clone())
|
1311 1314 | .with_name("aws_sdk_bedrockruntime::config::Config")
|
@@ -1206,1206 +1265,1268 @@
1206 1206 | }
|
1207 1207 |
|
1208 1208 | /// Convenience method to set the latest behavior major version
|
1209 1209 | ///
|
1210 1210 | /// This is equivalent to enabling the `behavior-version-latest` Cargo feature
|
1211 1211 | pub fn behavior_version_latest(mut self) -> Self {
|
1212 1212 | self.set_behavior_version(Some(crate::config::BehaviorVersion::latest()));
|
1213 1213 | self
|
1214 1214 | }
|
1215 1215 | /// Adds a runtime plugin to the config.
|
1216 1216 | #[allow(unused)]
|
1217 1217 | pub(crate) fn runtime_plugin(mut self, plugin: impl crate::config::RuntimePlugin + 'static) -> Self {
|
1218 1218 | self.push_runtime_plugin(crate::config::SharedRuntimePlugin::new(plugin));
|
1219 1219 | self
|
1220 1220 | }
|
1221 1221 | /// Adds a runtime plugin to the config.
|
1222 1222 | #[allow(unused)]
|
1223 1223 | pub(crate) fn push_runtime_plugin(&mut self, plugin: crate::config::SharedRuntimePlugin) -> &mut Self {
|
1224 1224 | self.runtime_plugins.push(plugin);
|
1225 1225 | self
|
1226 1226 | }
|
1227 1227 | #[cfg(any(feature = "test-util", test))]
|
1228 1228 | #[allow(unused_mut)]
|
1229 1229 | /// Apply test defaults to the builder
|
1230 1230 | pub fn apply_test_defaults(&mut self) -> &mut Self {
|
1231 1231 | self.set_idempotency_token_provider(Some("00000000-0000-4000-8000-000000000000".into()));
|
1232 1232 | self.set_time_source(::std::option::Option::Some(::aws_smithy_async::time::SharedTimeSource::new(
|
1233 1233 | ::aws_smithy_async::time::StaticTimeSource::new(::std::time::UNIX_EPOCH + ::std::time::Duration::from_secs(1234567890)),
|
1234 1234 | )));
|
1235 1235 | self.config.store_put(::aws_runtime::user_agent::AwsUserAgent::for_tests());
|
1236 + | if self.config.load::<crate::config::Region>().is_none() {
|
1237 + | self.set_region(::std::option::Option::Some(crate::config::Region::new("us-east-1")));
|
1238 + | }
|
1236 1239 | self.set_credentials_provider(Some(crate::config::SharedCredentialsProvider::new(
|
1237 1240 | ::aws_credential_types::Credentials::for_tests(),
|
1238 1241 | )));
|
1239 1242 | self.behavior_version = ::std::option::Option::Some(crate::config::BehaviorVersion::latest());
|
1240 1243 | self
|
1241 1244 | }
|
1242 1245 | #[cfg(any(feature = "test-util", test))]
|
1243 1246 | #[allow(unused_mut)]
|
1244 1247 | /// Apply test defaults to the builder
|
1245 1248 | pub fn with_test_defaults(mut self) -> Self {
|
1246 1249 | self.apply_test_defaults();
|
1247 1250 | self
|
1248 1251 | }
|
1249 1252 | /// Builds a [`Config`].
|
1250 1253 | #[allow(unused_mut)]
|
1251 1254 | pub fn build(mut self) -> Config {
|
1252 1255 | let mut layer = self.config;
|
1253 1256 | if self.runtime_components.time_source().is_none() {
|
1254 1257 | self.runtime_components
|
1255 1258 | .set_time_source(::std::option::Option::Some(::std::default::Default::default()));
|
1256 1259 | }
|
1257 1260 | layer.store_put(crate::meta::API_METADATA.clone());
|
1258 1261 | layer.store_put(::aws_types::SigningName::from_static("logs"));
|
1259 1262 | layer
|
1260 1263 | .load::<::aws_types::region::Region>()
|
1261 1264 | .cloned()
|
1262 1265 | .map(|r| layer.store_put(::aws_types::region::SigningRegion::from(r)));
|
1263 1266 | Config {
|
1264 1267 | config: crate::config::Layer::from(layer.clone())
|
1265 1268 | .with_name("aws_sdk_cloudwatchlogs::config::Config")
|
@@ -1212,1212 +1271,1274 @@
1212 1212 |
|
1213 1213 | /// Convenience method to set the latest behavior major version
|
1214 1214 | ///
|
1215 1215 | /// This is equivalent to enabling the `behavior-version-latest` Cargo feature
|
1216 1216 | pub fn behavior_version_latest(mut self) -> Self {
|
1217 1217 | self.set_behavior_version(Some(crate::config::BehaviorVersion::latest()));
|
1218 1218 | self
|
1219 1219 | }
|
1220 1220 | /// Adds a runtime plugin to the config.
|
1221 1221 | #[allow(unused)]
|
1222 1222 | pub(crate) fn runtime_plugin(mut self, plugin: impl crate::config::RuntimePlugin + 'static) -> Self {
|
1223 1223 | self.push_runtime_plugin(crate::config::SharedRuntimePlugin::new(plugin));
|
1224 1224 | self
|
1225 1225 | }
|
1226 1226 | /// Adds a runtime plugin to the config.
|
1227 1227 | #[allow(unused)]
|
1228 1228 | pub(crate) fn push_runtime_plugin(&mut self, plugin: crate::config::SharedRuntimePlugin) -> &mut Self {
|
1229 1229 | self.runtime_plugins.push(plugin);
|
1230 1230 | self
|
1231 1231 | }
|
1232 1232 | #[cfg(any(feature = "test-util", test))]
|
1233 1233 | #[allow(unused_mut)]
|
1234 1234 | /// Apply test defaults to the builder
|
1235 1235 | pub fn apply_test_defaults(&mut self) -> &mut Self {
|
1236 1236 | self.set_idempotency_token_provider(Some("00000000-0000-4000-8000-000000000000".into()));
|
1237 1237 | self.set_time_source(::std::option::Option::Some(::aws_smithy_async::time::SharedTimeSource::new(
|
1238 1238 | ::aws_smithy_async::time::StaticTimeSource::new(::std::time::UNIX_EPOCH + ::std::time::Duration::from_secs(1234567890)),
|
1239 1239 | )));
|
1240 1240 | self.config.store_put(::aws_runtime::user_agent::AwsUserAgent::for_tests());
|
1241 1241 | self.set_token_provider(Some(crate::config::SharedTokenProvider::new(::aws_credential_types::Token::for_tests())));
|
1242 + | if self.config.load::<crate::config::Region>().is_none() {
|
1243 + | self.set_region(::std::option::Option::Some(crate::config::Region::new("us-east-1")));
|
1244 + | }
|
1242 1245 | self.behavior_version = ::std::option::Option::Some(crate::config::BehaviorVersion::latest());
|
1243 1246 | self
|
1244 1247 | }
|
1245 1248 | #[cfg(any(feature = "test-util", test))]
|
1246 1249 | #[allow(unused_mut)]
|
1247 1250 | /// Apply test defaults to the builder
|
1248 1251 | pub fn with_test_defaults(mut self) -> Self {
|
1249 1252 | self.apply_test_defaults();
|
1250 1253 | self
|
1251 1254 | }
|
1252 1255 | /// Builds a [`Config`].
|
1253 1256 | #[allow(unused_mut)]
|
1254 1257 | pub fn build(mut self) -> Config {
|
1255 1258 | let mut layer = self.config;
|
1256 1259 | if self.runtime_components.time_source().is_none() {
|
1257 1260 | self.runtime_components
|
1258 1261 | .set_time_source(::std::option::Option::Some(::std::default::Default::default()));
|
1259 1262 | }
|
1260 1263 | layer.store_put(crate::meta::API_METADATA.clone());
|
1261 1264 | Config {
|
1262 1265 | config: crate::config::Layer::from(layer.clone())
|
1263 1266 | .with_name("aws_sdk_codecatalyst::config::Config")
|
1264 1267 | .freeze(),
|
1265 1268 | cloneable: layer,
|
1266 1269 | runtime_components: self.runtime_components,
|
1267 1270 | runtime_plugins: self.runtime_plugins,
|
1268 1271 | behavior_version: self.behavior_version,
|
1269 1272 | }
|
1270 1273 | }
|
1271 1274 | }
|
@@ -1189,1189 +1248,1251 @@
1189 1189 | self
|
1190 1190 | }
|
1191 1191 |
|
1192 1192 | /// Convenience method to set the latest behavior major version
|
1193 1193 | ///
|
1194 1194 | /// This is equivalent to enabling the `behavior-version-latest` Cargo feature
|
1195 1195 | pub fn behavior_version_latest(mut self) -> Self {
|
1196 1196 | self.set_behavior_version(Some(crate::config::BehaviorVersion::latest()));
|
1197 1197 | self
|
1198 1198 | }
|
1199 1199 | /// Adds a runtime plugin to the config.
|
1200 1200 | #[allow(unused)]
|
1201 1201 | pub(crate) fn runtime_plugin(mut self, plugin: impl crate::config::RuntimePlugin + 'static) -> Self {
|
1202 1202 | self.push_runtime_plugin(crate::config::SharedRuntimePlugin::new(plugin));
|
1203 1203 | self
|
1204 1204 | }
|
1205 1205 | /// Adds a runtime plugin to the config.
|
1206 1206 | #[allow(unused)]
|
1207 1207 | pub(crate) fn push_runtime_plugin(&mut self, plugin: crate::config::SharedRuntimePlugin) -> &mut Self {
|
1208 1208 | self.runtime_plugins.push(plugin);
|
1209 1209 | self
|
1210 1210 | }
|
1211 1211 | #[cfg(any(feature = "test-util", test))]
|
1212 1212 | #[allow(unused_mut)]
|
1213 1213 | /// Apply test defaults to the builder
|
1214 1214 | pub fn apply_test_defaults(&mut self) -> &mut Self {
|
1215 1215 | self.set_time_source(::std::option::Option::Some(::aws_smithy_async::time::SharedTimeSource::new(
|
1216 1216 | ::aws_smithy_async::time::StaticTimeSource::new(::std::time::UNIX_EPOCH + ::std::time::Duration::from_secs(1234567890)),
|
1217 1217 | )));
|
1218 1218 | self.config.store_put(::aws_runtime::user_agent::AwsUserAgent::for_tests());
|
1219 + | if self.config.load::<crate::config::Region>().is_none() {
|
1220 + | self.set_region(::std::option::Option::Some(crate::config::Region::new("us-east-1")));
|
1221 + | }
|
1219 1222 | self.set_credentials_provider(Some(crate::config::SharedCredentialsProvider::new(
|
1220 1223 | ::aws_credential_types::Credentials::for_tests(),
|
1221 1224 | )));
|
1222 1225 | self.behavior_version = ::std::option::Option::Some(crate::config::BehaviorVersion::latest());
|
1223 1226 | self
|
1224 1227 | }
|
1225 1228 | #[cfg(any(feature = "test-util", test))]
|
1226 1229 | #[allow(unused_mut)]
|
1227 1230 | /// Apply test defaults to the builder
|
1228 1231 | pub fn with_test_defaults(mut self) -> Self {
|
1229 1232 | self.apply_test_defaults();
|
1230 1233 | self
|
1231 1234 | }
|
1232 1235 | /// Builds a [`Config`].
|
1233 1236 | #[allow(unused_mut)]
|
1234 1237 | pub fn build(mut self) -> Config {
|
1235 1238 | let mut layer = self.config;
|
1236 1239 | if self.runtime_components.time_source().is_none() {
|
1237 1240 | self.runtime_components
|
1238 1241 | .set_time_source(::std::option::Option::Some(::std::default::Default::default()));
|
1239 1242 | }
|
1240 1243 | layer.store_put(crate::meta::API_METADATA.clone());
|
1241 1244 | layer.store_put(::aws_types::SigningName::from_static("config"));
|
1242 1245 | layer
|
1243 1246 | .load::<::aws_types::region::Region>()
|
1244 1247 | .cloned()
|
1245 1248 | .map(|r| layer.store_put(::aws_types::region::SigningRegion::from(r)));
|
1246 1249 | Config {
|
1247 1250 | config: crate::config::Layer::from(layer.clone())
|
1248 1251 | .with_name("aws_sdk_config::config::Config")
|
@@ -1220,1220 +1279,1282 @@
1220 1220 | }
|
1221 1221 |
|
1222 1222 | /// Convenience method to set the latest behavior major version
|
1223 1223 | ///
|
1224 1224 | /// This is equivalent to enabling the `behavior-version-latest` Cargo feature
|
1225 1225 | pub fn behavior_version_latest(mut self) -> Self {
|
1226 1226 | self.set_behavior_version(Some(crate::config::BehaviorVersion::latest()));
|
1227 1227 | self
|
1228 1228 | }
|
1229 1229 | /// Adds a runtime plugin to the config.
|
1230 1230 | #[allow(unused)]
|
1231 1231 | pub(crate) fn runtime_plugin(mut self, plugin: impl crate::config::RuntimePlugin + 'static) -> Self {
|
1232 1232 | self.push_runtime_plugin(crate::config::SharedRuntimePlugin::new(plugin));
|
1233 1233 | self
|
1234 1234 | }
|
1235 1235 | /// Adds a runtime plugin to the config.
|
1236 1236 | #[allow(unused)]
|
1237 1237 | pub(crate) fn push_runtime_plugin(&mut self, plugin: crate::config::SharedRuntimePlugin) -> &mut Self {
|
1238 1238 | self.runtime_plugins.push(plugin);
|
1239 1239 | self
|
1240 1240 | }
|
1241 1241 | #[cfg(any(feature = "test-util", test))]
|
1242 1242 | #[allow(unused_mut)]
|
1243 1243 | /// Apply test defaults to the builder
|
1244 1244 | pub fn apply_test_defaults(&mut self) -> &mut Self {
|
1245 1245 | self.set_idempotency_token_provider(Some("00000000-0000-4000-8000-000000000000".into()));
|
1246 1246 | self.set_time_source(::std::option::Option::Some(::aws_smithy_async::time::SharedTimeSource::new(
|
1247 1247 | ::aws_smithy_async::time::StaticTimeSource::new(::std::time::UNIX_EPOCH + ::std::time::Duration::from_secs(1234567890)),
|
1248 1248 | )));
|
1249 1249 | self.config.store_put(::aws_runtime::user_agent::AwsUserAgent::for_tests());
|
1250 + | if self.config.load::<crate::config::Region>().is_none() {
|
1251 + | self.set_region(::std::option::Option::Some(crate::config::Region::new("us-east-1")));
|
1252 + | }
|
1250 1253 | self.set_credentials_provider(Some(crate::config::SharedCredentialsProvider::new(
|
1251 1254 | ::aws_credential_types::Credentials::for_tests(),
|
1252 1255 | )));
|
1253 1256 | self.behavior_version = ::std::option::Option::Some(crate::config::BehaviorVersion::latest());
|
1254 1257 | self
|
1255 1258 | }
|
1256 1259 | #[cfg(any(feature = "test-util", test))]
|
1257 1260 | #[allow(unused_mut)]
|
1258 1261 | /// Apply test defaults to the builder
|
1259 1262 | pub fn with_test_defaults(mut self) -> Self {
|
1260 1263 | self.apply_test_defaults();
|
1261 1264 | self
|
1262 1265 | }
|
1263 1266 | /// Builds a [`Config`].
|
1264 1267 | #[allow(unused_mut)]
|
1265 1268 | pub fn build(mut self) -> Config {
|
1266 1269 | let mut layer = self.config;
|
1267 1270 | if self.runtime_components.time_source().is_none() {
|
1268 1271 | self.runtime_components
|
1269 1272 | .set_time_source(::std::option::Option::Some(::std::default::Default::default()));
|
1270 1273 | }
|
1271 1274 | layer.store_put(crate::meta::API_METADATA.clone());
|
1272 1275 | layer.store_put(::aws_types::SigningName::from_static("dynamodb"));
|
1273 1276 | layer
|
1274 1277 | .load::<::aws_types::region::Region>()
|
1275 1278 | .cloned()
|
1276 1279 | .map(|r| layer.store_put(::aws_types::region::SigningRegion::from(r)));
|
1277 1280 | Config {
|
1278 1281 | config: crate::config::Layer::from(layer.clone())
|
1279 1282 | .with_name("aws_sdk_dynamodb::config::Config")
|
@@ -1206,1206 +1265,1268 @@
1206 1206 | }
|
1207 1207 |
|
1208 1208 | /// Convenience method to set the latest behavior major version
|
1209 1209 | ///
|
1210 1210 | /// This is equivalent to enabling the `behavior-version-latest` Cargo feature
|
1211 1211 | pub fn behavior_version_latest(mut self) -> Self {
|
1212 1212 | self.set_behavior_version(Some(crate::config::BehaviorVersion::latest()));
|
1213 1213 | self
|
1214 1214 | }
|
1215 1215 | /// Adds a runtime plugin to the config.
|
1216 1216 | #[allow(unused)]
|
1217 1217 | pub(crate) fn runtime_plugin(mut self, plugin: impl crate::config::RuntimePlugin + 'static) -> Self {
|
1218 1218 | self.push_runtime_plugin(crate::config::SharedRuntimePlugin::new(plugin));
|
1219 1219 | self
|
1220 1220 | }
|
1221 1221 | /// Adds a runtime plugin to the config.
|
1222 1222 | #[allow(unused)]
|
1223 1223 | pub(crate) fn push_runtime_plugin(&mut self, plugin: crate::config::SharedRuntimePlugin) -> &mut Self {
|
1224 1224 | self.runtime_plugins.push(plugin);
|
1225 1225 | self
|
1226 1226 | }
|
1227 1227 | #[cfg(any(feature = "test-util", test))]
|
1228 1228 | #[allow(unused_mut)]
|
1229 1229 | /// Apply test defaults to the builder
|
1230 1230 | pub fn apply_test_defaults(&mut self) -> &mut Self {
|
1231 1231 | self.set_idempotency_token_provider(Some("00000000-0000-4000-8000-000000000000".into()));
|
1232 1232 | self.set_time_source(::std::option::Option::Some(::aws_smithy_async::time::SharedTimeSource::new(
|
1233 1233 | ::aws_smithy_async::time::StaticTimeSource::new(::std::time::UNIX_EPOCH + ::std::time::Duration::from_secs(1234567890)),
|
1234 1234 | )));
|
1235 1235 | self.config.store_put(::aws_runtime::user_agent::AwsUserAgent::for_tests());
|
1236 + | if self.config.load::<crate::config::Region>().is_none() {
|
1237 + | self.set_region(::std::option::Option::Some(crate::config::Region::new("us-east-1")));
|
1238 + | }
|
1236 1239 | self.set_credentials_provider(Some(crate::config::SharedCredentialsProvider::new(
|
1237 1240 | ::aws_credential_types::Credentials::for_tests(),
|
1238 1241 | )));
|
1239 1242 | self.behavior_version = ::std::option::Option::Some(crate::config::BehaviorVersion::latest());
|
1240 1243 | self
|
1241 1244 | }
|
1242 1245 | #[cfg(any(feature = "test-util", test))]
|
1243 1246 | #[allow(unused_mut)]
|
1244 1247 | /// Apply test defaults to the builder
|
1245 1248 | pub fn with_test_defaults(mut self) -> Self {
|
1246 1249 | self.apply_test_defaults();
|
1247 1250 | self
|
1248 1251 | }
|
1249 1252 | /// Builds a [`Config`].
|
1250 1253 | #[allow(unused_mut)]
|
1251 1254 | pub fn build(mut self) -> Config {
|
1252 1255 | let mut layer = self.config;
|
1253 1256 | if self.runtime_components.time_source().is_none() {
|
1254 1257 | self.runtime_components
|
1255 1258 | .set_time_source(::std::option::Option::Some(::std::default::Default::default()));
|
1256 1259 | }
|
1257 1260 | layer.store_put(crate::meta::API_METADATA.clone());
|
1258 1261 | layer.store_put(::aws_types::SigningName::from_static("ec2"));
|
1259 1262 | layer
|
1260 1263 | .load::<::aws_types::region::Region>()
|
1261 1264 | .cloned()
|
1262 1265 | .map(|r| layer.store_put(::aws_types::region::SigningRegion::from(r)));
|
1263 1266 | Config {
|
1264 1267 | config: crate::config::Layer::from(layer.clone())
|
1265 1268 | .with_name("aws_sdk_ec2::config::Config")
|
@@ -1206,1206 +1265,1268 @@
1206 1206 | }
|
1207 1207 |
|
1208 1208 | /// Convenience method to set the latest behavior major version
|
1209 1209 | ///
|
1210 1210 | /// This is equivalent to enabling the `behavior-version-latest` Cargo feature
|
1211 1211 | pub fn behavior_version_latest(mut self) -> Self {
|
1212 1212 | self.set_behavior_version(Some(crate::config::BehaviorVersion::latest()));
|
1213 1213 | self
|
1214 1214 | }
|
1215 1215 | /// Adds a runtime plugin to the config.
|
1216 1216 | #[allow(unused)]
|
1217 1217 | pub(crate) fn runtime_plugin(mut self, plugin: impl crate::config::RuntimePlugin + 'static) -> Self {
|
1218 1218 | self.push_runtime_plugin(crate::config::SharedRuntimePlugin::new(plugin));
|
1219 1219 | self
|
1220 1220 | }
|
1221 1221 | /// Adds a runtime plugin to the config.
|
1222 1222 | #[allow(unused)]
|
1223 1223 | pub(crate) fn push_runtime_plugin(&mut self, plugin: crate::config::SharedRuntimePlugin) -> &mut Self {
|
1224 1224 | self.runtime_plugins.push(plugin);
|
1225 1225 | self
|
1226 1226 | }
|
1227 1227 | #[cfg(any(feature = "test-util", test))]
|
1228 1228 | #[allow(unused_mut)]
|
1229 1229 | /// Apply test defaults to the builder
|
1230 1230 | pub fn apply_test_defaults(&mut self) -> &mut Self {
|
1231 1231 | self.set_idempotency_token_provider(Some("00000000-0000-4000-8000-000000000000".into()));
|
1232 1232 | self.set_time_source(::std::option::Option::Some(::aws_smithy_async::time::SharedTimeSource::new(
|
1233 1233 | ::aws_smithy_async::time::StaticTimeSource::new(::std::time::UNIX_EPOCH + ::std::time::Duration::from_secs(1234567890)),
|
1234 1234 | )));
|
1235 1235 | self.config.store_put(::aws_runtime::user_agent::AwsUserAgent::for_tests());
|
1236 + | if self.config.load::<crate::config::Region>().is_none() {
|
1237 + | self.set_region(::std::option::Option::Some(crate::config::Region::new("us-east-1")));
|
1238 + | }
|
1236 1239 | self.set_credentials_provider(Some(crate::config::SharedCredentialsProvider::new(
|
1237 1240 | ::aws_credential_types::Credentials::for_tests(),
|
1238 1241 | )));
|
1239 1242 | self.behavior_version = ::std::option::Option::Some(crate::config::BehaviorVersion::latest());
|
1240 1243 | self
|
1241 1244 | }
|
1242 1245 | #[cfg(any(feature = "test-util", test))]
|
1243 1246 | #[allow(unused_mut)]
|
1244 1247 | /// Apply test defaults to the builder
|
1245 1248 | pub fn with_test_defaults(mut self) -> Self {
|
1246 1249 | self.apply_test_defaults();
|
1247 1250 | self
|
1248 1251 | }
|
1249 1252 | /// Builds a [`Config`].
|
1250 1253 | #[allow(unused_mut)]
|
1251 1254 | pub fn build(mut self) -> Config {
|
1252 1255 | let mut layer = self.config;
|
1253 1256 | if self.runtime_components.time_source().is_none() {
|
1254 1257 | self.runtime_components
|
1255 1258 | .set_time_source(::std::option::Option::Some(::std::default::Default::default()));
|
1256 1259 | }
|
1257 1260 | layer.store_put(crate::meta::API_METADATA.clone());
|
1258 1261 | layer.store_put(::aws_types::SigningName::from_static("ecs"));
|
1259 1262 | layer
|
1260 1263 | .load::<::aws_types::region::Region>()
|
1261 1264 | .cloned()
|
1262 1265 | .map(|r| layer.store_put(::aws_types::region::SigningRegion::from(r)));
|
1263 1266 | Config {
|
1264 1267 | config: crate::config::Layer::from(layer.clone())
|
1265 1268 | .with_name("aws_sdk_ecs::config::Config")
|
@@ -1189,1189 +1248,1251 @@
1189 1189 | self
|
1190 1190 | }
|
1191 1191 |
|
1192 1192 | /// Convenience method to set the latest behavior major version
|
1193 1193 | ///
|
1194 1194 | /// This is equivalent to enabling the `behavior-version-latest` Cargo feature
|
1195 1195 | pub fn behavior_version_latest(mut self) -> Self {
|
1196 1196 | self.set_behavior_version(Some(crate::config::BehaviorVersion::latest()));
|
1197 1197 | self
|
1198 1198 | }
|
1199 1199 | /// Adds a runtime plugin to the config.
|
1200 1200 | #[allow(unused)]
|
1201 1201 | pub(crate) fn runtime_plugin(mut self, plugin: impl crate::config::RuntimePlugin + 'static) -> Self {
|
1202 1202 | self.push_runtime_plugin(crate::config::SharedRuntimePlugin::new(plugin));
|
1203 1203 | self
|
1204 1204 | }
|
1205 1205 | /// Adds a runtime plugin to the config.
|
1206 1206 | #[allow(unused)]
|
1207 1207 | pub(crate) fn push_runtime_plugin(&mut self, plugin: crate::config::SharedRuntimePlugin) -> &mut Self {
|
1208 1208 | self.runtime_plugins.push(plugin);
|
1209 1209 | self
|
1210 1210 | }
|
1211 1211 | #[cfg(any(feature = "test-util", test))]
|
1212 1212 | #[allow(unused_mut)]
|
1213 1213 | /// Apply test defaults to the builder
|
1214 1214 | pub fn apply_test_defaults(&mut self) -> &mut Self {
|
1215 1215 | self.set_time_source(::std::option::Option::Some(::aws_smithy_async::time::SharedTimeSource::new(
|
1216 1216 | ::aws_smithy_async::time::StaticTimeSource::new(::std::time::UNIX_EPOCH + ::std::time::Duration::from_secs(1234567890)),
|
1217 1217 | )));
|
1218 1218 | self.config.store_put(::aws_runtime::user_agent::AwsUserAgent::for_tests());
|
1219 + | if self.config.load::<crate::config::Region>().is_none() {
|
1220 + | self.set_region(::std::option::Option::Some(crate::config::Region::new("us-east-1")));
|
1221 + | }
|
1219 1222 | self.set_credentials_provider(Some(crate::config::SharedCredentialsProvider::new(
|
1220 1223 | ::aws_credential_types::Credentials::for_tests(),
|
1221 1224 | )));
|
1222 1225 | self.behavior_version = ::std::option::Option::Some(crate::config::BehaviorVersion::latest());
|
1223 1226 | self
|
1224 1227 | }
|
1225 1228 | #[cfg(any(feature = "test-util", test))]
|
1226 1229 | #[allow(unused_mut)]
|
1227 1230 | /// Apply test defaults to the builder
|
1228 1231 | pub fn with_test_defaults(mut self) -> Self {
|
1229 1232 | self.apply_test_defaults();
|
1230 1233 | self
|
1231 1234 | }
|
1232 1235 | /// Builds a [`Config`].
|
1233 1236 | #[allow(unused_mut)]
|
1234 1237 | pub fn build(mut self) -> Config {
|
1235 1238 | let mut layer = self.config;
|
1236 1239 | if self.runtime_components.time_source().is_none() {
|
1237 1240 | self.runtime_components
|
1238 1241 | .set_time_source(::std::option::Option::Some(::std::default::Default::default()));
|
1239 1242 | }
|
1240 1243 | layer.store_put(crate::meta::API_METADATA.clone());
|
1241 1244 | layer.store_put(::aws_types::SigningName::from_static("glacier"));
|
1242 1245 | layer
|
1243 1246 | .load::<::aws_types::region::Region>()
|
1244 1247 | .cloned()
|
1245 1248 | .map(|r| layer.store_put(::aws_types::region::SigningRegion::from(r)));
|
1246 1249 | Config {
|
1247 1250 | config: crate::config::Layer::from(layer.clone())
|
1248 1251 | .with_name("aws_sdk_glacier::config::Config")
|
@@ -1189,1189 +1248,1251 @@
1189 1189 | self
|
1190 1190 | }
|
1191 1191 |
|
1192 1192 | /// Convenience method to set the latest behavior major version
|
1193 1193 | ///
|
1194 1194 | /// This is equivalent to enabling the `behavior-version-latest` Cargo feature
|
1195 1195 | pub fn behavior_version_latest(mut self) -> Self {
|
1196 1196 | self.set_behavior_version(Some(crate::config::BehaviorVersion::latest()));
|
1197 1197 | self
|
1198 1198 | }
|
1199 1199 | /// Adds a runtime plugin to the config.
|
1200 1200 | #[allow(unused)]
|
1201 1201 | pub(crate) fn runtime_plugin(mut self, plugin: impl crate::config::RuntimePlugin + 'static) -> Self {
|
1202 1202 | self.push_runtime_plugin(crate::config::SharedRuntimePlugin::new(plugin));
|
1203 1203 | self
|
1204 1204 | }
|
1205 1205 | /// Adds a runtime plugin to the config.
|
1206 1206 | #[allow(unused)]
|
1207 1207 | pub(crate) fn push_runtime_plugin(&mut self, plugin: crate::config::SharedRuntimePlugin) -> &mut Self {
|
1208 1208 | self.runtime_plugins.push(plugin);
|
1209 1209 | self
|
1210 1210 | }
|
1211 1211 | #[cfg(any(feature = "test-util", test))]
|
1212 1212 | #[allow(unused_mut)]
|
1213 1213 | /// Apply test defaults to the builder
|
1214 1214 | pub fn apply_test_defaults(&mut self) -> &mut Self {
|
1215 1215 | self.set_time_source(::std::option::Option::Some(::aws_smithy_async::time::SharedTimeSource::new(
|
1216 1216 | ::aws_smithy_async::time::StaticTimeSource::new(::std::time::UNIX_EPOCH + ::std::time::Duration::from_secs(1234567890)),
|
1217 1217 | )));
|
1218 1218 | self.config.store_put(::aws_runtime::user_agent::AwsUserAgent::for_tests());
|
1219 + | if self.config.load::<crate::config::Region>().is_none() {
|
1220 + | self.set_region(::std::option::Option::Some(crate::config::Region::new("us-east-1")));
|
1221 + | }
|
1219 1222 | self.set_credentials_provider(Some(crate::config::SharedCredentialsProvider::new(
|
1220 1223 | ::aws_credential_types::Credentials::for_tests(),
|
1221 1224 | )));
|
1222 1225 | self.behavior_version = ::std::option::Option::Some(crate::config::BehaviorVersion::latest());
|
1223 1226 | self
|
1224 1227 | }
|
1225 1228 | #[cfg(any(feature = "test-util", test))]
|
1226 1229 | #[allow(unused_mut)]
|
1227 1230 | /// Apply test defaults to the builder
|
1228 1231 | pub fn with_test_defaults(mut self) -> Self {
|
1229 1232 | self.apply_test_defaults();
|
1230 1233 | self
|
1231 1234 | }
|
1232 1235 | /// Builds a [`Config`].
|
1233 1236 | #[allow(unused_mut)]
|
1234 1237 | pub fn build(mut self) -> Config {
|
1235 1238 | let mut layer = self.config;
|
1236 1239 | if self.runtime_components.time_source().is_none() {
|
1237 1240 | self.runtime_components
|
1238 1241 | .set_time_source(::std::option::Option::Some(::std::default::Default::default()));
|
1239 1242 | }
|
1240 1243 | layer.store_put(crate::meta::API_METADATA.clone());
|
1241 1244 | layer.store_put(::aws_types::SigningName::from_static("iam"));
|
1242 1245 | layer
|
1243 1246 | .load::<::aws_types::region::Region>()
|
1244 1247 | .cloned()
|
1245 1248 | .map(|r| layer.store_put(::aws_types::region::SigningRegion::from(r)));
|
1246 1249 | Config {
|
1247 1250 | config: crate::config::Layer::from(layer.clone())
|
1248 1251 | .with_name("aws_sdk_iam::config::Config")
|
@@ -1189,1189 +1248,1251 @@
1189 1189 | self
|
1190 1190 | }
|
1191 1191 |
|
1192 1192 | /// Convenience method to set the latest behavior major version
|
1193 1193 | ///
|
1194 1194 | /// This is equivalent to enabling the `behavior-version-latest` Cargo feature
|
1195 1195 | pub fn behavior_version_latest(mut self) -> Self {
|
1196 1196 | self.set_behavior_version(Some(crate::config::BehaviorVersion::latest()));
|
1197 1197 | self
|
1198 1198 | }
|
1199 1199 | /// Adds a runtime plugin to the config.
|
1200 1200 | #[allow(unused)]
|
1201 1201 | pub(crate) fn runtime_plugin(mut self, plugin: impl crate::config::RuntimePlugin + 'static) -> Self {
|
1202 1202 | self.push_runtime_plugin(crate::config::SharedRuntimePlugin::new(plugin));
|
1203 1203 | self
|
1204 1204 | }
|
1205 1205 | /// Adds a runtime plugin to the config.
|
1206 1206 | #[allow(unused)]
|
1207 1207 | pub(crate) fn push_runtime_plugin(&mut self, plugin: crate::config::SharedRuntimePlugin) -> &mut Self {
|
1208 1208 | self.runtime_plugins.push(plugin);
|
1209 1209 | self
|
1210 1210 | }
|
1211 1211 | #[cfg(any(feature = "test-util", test))]
|
1212 1212 | #[allow(unused_mut)]
|
1213 1213 | /// Apply test defaults to the builder
|
1214 1214 | pub fn apply_test_defaults(&mut self) -> &mut Self {
|
1215 1215 | self.set_time_source(::std::option::Option::Some(::aws_smithy_async::time::SharedTimeSource::new(
|
1216 1216 | ::aws_smithy_async::time::StaticTimeSource::new(::std::time::UNIX_EPOCH + ::std::time::Duration::from_secs(1234567890)),
|
1217 1217 | )));
|
1218 1218 | self.config.store_put(::aws_runtime::user_agent::AwsUserAgent::for_tests());
|
1219 + | if self.config.load::<crate::config::Region>().is_none() {
|
1220 + | self.set_region(::std::option::Option::Some(crate::config::Region::new("us-east-1")));
|
1221 + | }
|
1219 1222 | self.set_credentials_provider(Some(crate::config::SharedCredentialsProvider::new(
|
1220 1223 | ::aws_credential_types::Credentials::for_tests(),
|
1221 1224 | )));
|
1222 1225 | self.behavior_version = ::std::option::Option::Some(crate::config::BehaviorVersion::latest());
|
1223 1226 | self
|
1224 1227 | }
|
1225 1228 | #[cfg(any(feature = "test-util", test))]
|
1226 1229 | #[allow(unused_mut)]
|
1227 1230 | /// Apply test defaults to the builder
|
1228 1231 | pub fn with_test_defaults(mut self) -> Self {
|
1229 1232 | self.apply_test_defaults();
|
1230 1233 | self
|
1231 1234 | }
|
1232 1235 | /// Builds a [`Config`].
|
1233 1236 | #[allow(unused_mut)]
|
1234 1237 | pub fn build(mut self) -> Config {
|
1235 1238 | let mut layer = self.config;
|
1236 1239 | if self.runtime_components.time_source().is_none() {
|
1237 1240 | self.runtime_components
|
1238 1241 | .set_time_source(::std::option::Option::Some(::std::default::Default::default()));
|
1239 1242 | }
|
1240 1243 | layer.store_put(crate::meta::API_METADATA.clone());
|
1241 1244 | layer.store_put(::aws_types::SigningName::from_static("kms"));
|
1242 1245 | layer
|
1243 1246 | .load::<::aws_types::region::Region>()
|
1244 1247 | .cloned()
|
1245 1248 | .map(|r| layer.store_put(::aws_types::region::SigningRegion::from(r)));
|
1246 1249 | Config {
|
1247 1250 | config: crate::config::Layer::from(layer.clone())
|
1248 1251 | .with_name("aws_sdk_kms::config::Config")
|
@@ -1189,1189 +1248,1251 @@
1189 1189 | self
|
1190 1190 | }
|
1191 1191 |
|
1192 1192 | /// Convenience method to set the latest behavior major version
|
1193 1193 | ///
|
1194 1194 | /// This is equivalent to enabling the `behavior-version-latest` Cargo feature
|
1195 1195 | pub fn behavior_version_latest(mut self) -> Self {
|
1196 1196 | self.set_behavior_version(Some(crate::config::BehaviorVersion::latest()));
|
1197 1197 | self
|
1198 1198 | }
|
1199 1199 | /// Adds a runtime plugin to the config.
|
1200 1200 | #[allow(unused)]
|
1201 1201 | pub(crate) fn runtime_plugin(mut self, plugin: impl crate::config::RuntimePlugin + 'static) -> Self {
|
1202 1202 | self.push_runtime_plugin(crate::config::SharedRuntimePlugin::new(plugin));
|
1203 1203 | self
|
1204 1204 | }
|
1205 1205 | /// Adds a runtime plugin to the config.
|
1206 1206 | #[allow(unused)]
|
1207 1207 | pub(crate) fn push_runtime_plugin(&mut self, plugin: crate::config::SharedRuntimePlugin) -> &mut Self {
|
1208 1208 | self.runtime_plugins.push(plugin);
|
1209 1209 | self
|
1210 1210 | }
|
1211 1211 | #[cfg(any(feature = "test-util", test))]
|
1212 1212 | #[allow(unused_mut)]
|
1213 1213 | /// Apply test defaults to the builder
|
1214 1214 | pub fn apply_test_defaults(&mut self) -> &mut Self {
|
1215 1215 | self.set_time_source(::std::option::Option::Some(::aws_smithy_async::time::SharedTimeSource::new(
|
1216 1216 | ::aws_smithy_async::time::StaticTimeSource::new(::std::time::UNIX_EPOCH + ::std::time::Duration::from_secs(1234567890)),
|
1217 1217 | )));
|
1218 1218 | self.config.store_put(::aws_runtime::user_agent::AwsUserAgent::for_tests());
|
1219 + | if self.config.load::<crate::config::Region>().is_none() {
|
1220 + | self.set_region(::std::option::Option::Some(crate::config::Region::new("us-east-1")));
|
1221 + | }
|
1219 1222 | self.set_credentials_provider(Some(crate::config::SharedCredentialsProvider::new(
|
1220 1223 | ::aws_credential_types::Credentials::for_tests(),
|
1221 1224 | )));
|
1222 1225 | self.behavior_version = ::std::option::Option::Some(crate::config::BehaviorVersion::latest());
|
1223 1226 | self
|
1224 1227 | }
|
1225 1228 | #[cfg(any(feature = "test-util", test))]
|
1226 1229 | #[allow(unused_mut)]
|
1227 1230 | /// Apply test defaults to the builder
|
1228 1231 | pub fn with_test_defaults(mut self) -> Self {
|
1229 1232 | self.apply_test_defaults();
|
1230 1233 | self
|
1231 1234 | }
|
1232 1235 | /// Builds a [`Config`].
|
1233 1236 | #[allow(unused_mut)]
|
1234 1237 | pub fn build(mut self) -> Config {
|
1235 1238 | let mut layer = self.config;
|
1236 1239 | if self.runtime_components.time_source().is_none() {
|
1237 1240 | self.runtime_components
|
1238 1241 | .set_time_source(::std::option::Option::Some(::std::default::Default::default()));
|
1239 1242 | }
|
1240 1243 | layer.store_put(crate::meta::API_METADATA.clone());
|
1241 1244 | layer.store_put(::aws_types::SigningName::from_static("lambda"));
|
1242 1245 | layer
|
1243 1246 | .load::<::aws_types::region::Region>()
|
1244 1247 | .cloned()
|
1245 1248 | .map(|r| layer.store_put(::aws_types::region::SigningRegion::from(r)));
|
1246 1249 | Config {
|
1247 1250 | config: crate::config::Layer::from(layer.clone())
|
1248 1251 | .with_name("aws_sdk_lambda::config::Config")
|
@@ -1189,1189 +1248,1251 @@
1189 1189 | self
|
1190 1190 | }
|
1191 1191 |
|
1192 1192 | /// Convenience method to set the latest behavior major version
|
1193 1193 | ///
|
1194 1194 | /// This is equivalent to enabling the `behavior-version-latest` Cargo feature
|
1195 1195 | pub fn behavior_version_latest(mut self) -> Self {
|
1196 1196 | self.set_behavior_version(Some(crate::config::BehaviorVersion::latest()));
|
1197 1197 | self
|
1198 1198 | }
|
1199 1199 | /// Adds a runtime plugin to the config.
|
1200 1200 | #[allow(unused)]
|
1201 1201 | pub(crate) fn runtime_plugin(mut self, plugin: impl crate::config::RuntimePlugin + 'static) -> Self {
|
1202 1202 | self.push_runtime_plugin(crate::config::SharedRuntimePlugin::new(plugin));
|
1203 1203 | self
|
1204 1204 | }
|
1205 1205 | /// Adds a runtime plugin to the config.
|
1206 1206 | #[allow(unused)]
|
1207 1207 | pub(crate) fn push_runtime_plugin(&mut self, plugin: crate::config::SharedRuntimePlugin) -> &mut Self {
|
1208 1208 | self.runtime_plugins.push(plugin);
|
1209 1209 | self
|
1210 1210 | }
|
1211 1211 | #[cfg(any(feature = "test-util", test))]
|
1212 1212 | #[allow(unused_mut)]
|
1213 1213 | /// Apply test defaults to the builder
|
1214 1214 | pub fn apply_test_defaults(&mut self) -> &mut Self {
|
1215 1215 | self.set_time_source(::std::option::Option::Some(::aws_smithy_async::time::SharedTimeSource::new(
|
1216 1216 | ::aws_smithy_async::time::StaticTimeSource::new(::std::time::UNIX_EPOCH + ::std::time::Duration::from_secs(1234567890)),
|
1217 1217 | )));
|
1218 1218 | self.config.store_put(::aws_runtime::user_agent::AwsUserAgent::for_tests());
|
1219 + | if self.config.load::<crate::config::Region>().is_none() {
|
1220 + | self.set_region(::std::option::Option::Some(crate::config::Region::new("us-east-1")));
|
1221 + | }
|
1219 1222 | self.set_credentials_provider(Some(crate::config::SharedCredentialsProvider::new(
|
1220 1223 | ::aws_credential_types::Credentials::for_tests(),
|
1221 1224 | )));
|
1222 1225 | self.behavior_version = ::std::option::Option::Some(crate::config::BehaviorVersion::latest());
|
1223 1226 | self
|
1224 1227 | }
|
1225 1228 | #[cfg(any(feature = "test-util", test))]
|
1226 1229 | #[allow(unused_mut)]
|
1227 1230 | /// Apply test defaults to the builder
|
1228 1231 | pub fn with_test_defaults(mut self) -> Self {
|
1229 1232 | self.apply_test_defaults();
|
1230 1233 | self
|
1231 1234 | }
|
1232 1235 | /// Builds a [`Config`].
|
1233 1236 | #[allow(unused_mut)]
|
1234 1237 | pub fn build(mut self) -> Config {
|
1235 1238 | let mut layer = self.config;
|
1236 1239 | if self.runtime_components.time_source().is_none() {
|
1237 1240 | self.runtime_components
|
1238 1241 | .set_time_source(::std::option::Option::Some(::std::default::Default::default()));
|
1239 1242 | }
|
1240 1243 | layer.store_put(crate::meta::API_METADATA.clone());
|
1241 1244 | layer.store_put(::aws_types::SigningName::from_static("polly"));
|
1242 1245 | layer
|
1243 1246 | .load::<::aws_types::region::Region>()
|
1244 1247 | .cloned()
|
1245 1248 | .map(|r| layer.store_put(::aws_types::region::SigningRegion::from(r)));
|
1246 1249 | Config {
|
1247 1250 | config: crate::config::Layer::from(layer.clone())
|
1248 1251 | .with_name("aws_sdk_polly::config::Config")
|