138 138 | pub mod sso;
|
139 139 | pub mod stalled_stream_protection;
|
140 140 | pub mod sts;
|
141 141 | pub mod timeout;
|
142 142 | pub mod web_identity_token;
|
143 143 |
|
144 144 | /// Create a config loader with the _latest_ defaults.
|
145 145 | ///
|
146 146 | /// This loader will always set [`BehaviorVersion::latest`].
|
147 147 | ///
|
148 - | /// For more information about default configuration, refer to the AWS SDKs and Tools [shared configuration documentation](https://docs.aws.amazon.com/sdkref/latest/guide/creds-config-files.html).
|
149 - | ///
|
150 148 | /// # Examples
|
151 149 | /// ```no_run
|
152 150 | /// # async fn create_config() {
|
153 151 | /// let config = aws_config::from_env().region("us-east-1").load().await;
|
154 152 | /// # }
|
155 153 | /// ```
|
156 154 | #[cfg(feature = "behavior-version-latest")]
|
157 155 | pub fn from_env() -> ConfigLoader {
|
158 156 | ConfigLoader::default().behavior_version(BehaviorVersion::latest())
|
159 157 | }
|
160 158 |
|
161 159 | /// Load default configuration with the _latest_ defaults.
|
162 160 | ///
|
163 161 | /// Convenience wrapper equivalent to `aws_config::load_defaults(BehaviorVersion::latest()).await`
|
164 - | ///
|
165 - | /// For more information about default configuration, refer to the AWS SDKs and Tools [shared configuration documentation](https://docs.aws.amazon.com/sdkref/latest/guide/creds-config-files.html).
|
166 162 | #[cfg(feature = "behavior-version-latest")]
|
167 163 | pub async fn load_from_env() -> SdkConfig {
|
168 164 | from_env().load().await
|
169 165 | }
|
170 166 |
|
171 167 | /// Create a config loader with the _latest_ defaults.
|
172 168 | #[cfg(not(feature = "behavior-version-latest"))]
|
173 169 | #[deprecated(
|
174 170 | note = "Use the `aws_config::defaults` function. If you don't care about future default behavior changes, you can continue to use this function by enabling the `behavior-version-latest` feature. Doing so will make this deprecation notice go away."
|
175 171 | )]
|
176 172 | pub fn from_env() -> ConfigLoader {
|
177 173 | ConfigLoader::default().behavior_version(BehaviorVersion::latest())
|
178 174 | }
|
179 175 |
|
180 176 | /// Load default configuration with the _latest_ defaults.
|
181 177 | #[cfg(not(feature = "behavior-version-latest"))]
|
182 178 | #[deprecated(
|
183 179 | note = "Use the `aws_config::load_defaults` function. If you don't care about future default behavior changes, you can continue to use this function by enabling the `behavior-version-latest` feature. Doing so will make this deprecation notice go away."
|
184 180 | )]
|
185 181 | pub async fn load_from_env() -> SdkConfig {
|
186 182 | load_defaults(BehaviorVersion::latest()).await
|
187 183 | }
|
188 184 |
|
189 185 | /// Create a config loader with the defaults for the given behavior version.
|
190 186 | ///
|
191 - | /// For more information about default configuration, refer to the AWS SDKs and Tools [shared configuration documentation](https://docs.aws.amazon.com/sdkref/latest/guide/creds-config-files.html).
|
192 - | ///
|
193 187 | /// # Examples
|
194 188 | /// ```no_run
|
195 189 | /// # async fn create_config() {
|
196 190 | /// use aws_config::BehaviorVersion;
|
197 191 | /// let config = aws_config::defaults(BehaviorVersion::v2023_11_09())
|
198 192 | /// .region("us-east-1")
|
199 193 | /// .load()
|
200 194 | /// .await;
|
201 195 | /// # }
|
202 196 | /// ```
|
203 197 | pub fn defaults(version: BehaviorVersion) -> ConfigLoader {
|
204 198 | ConfigLoader::default().behavior_version(version)
|
205 199 | }
|
206 200 |
|
207 201 | /// Load default configuration with the given behavior version.
|
208 202 | ///
|
209 203 | /// Convenience wrapper equivalent to `aws_config::defaults(behavior_version).load().await`
|
210 - | ///
|
211 - | /// For more information about default configuration, refer to the AWS SDKs and Tools [shared configuration documentation](https://docs.aws.amazon.com/sdkref/latest/guide/creds-config-files.html).
|
212 204 | pub async fn load_defaults(version: BehaviorVersion) -> SdkConfig {
|
213 205 | defaults(version).load().await
|
214 206 | }
|
215 207 |
|
216 208 | mod loader {
|
217 209 | use crate::env_service_config::EnvServiceConfig;
|
218 210 | use aws_credential_types::provider::{
|
219 211 | token::{ProvideToken, SharedTokenProvider},
|
220 212 | ProvideCredentials, SharedCredentialsProvider,
|
221 213 | };
|
222 214 | use aws_credential_types::Credentials;
|
223 215 | use aws_smithy_async::rt::sleep::{default_async_sleep, AsyncSleep, SharedAsyncSleep};
|
224 216 | use aws_smithy_async::time::{SharedTimeSource, TimeSource};
|
225 217 | use aws_smithy_runtime::client::identity::IdentityCache;
|
226 218 | use aws_smithy_runtime_api::client::behavior_version::BehaviorVersion;
|
227 219 | use aws_smithy_runtime_api::client::http::HttpClient;
|
228 220 | use aws_smithy_runtime_api::client::identity::{ResolveCachedIdentity, SharedIdentityCache};
|
229 221 | use aws_smithy_runtime_api::client::stalled_stream_protection::StalledStreamProtectionConfig;
|
230 222 | use aws_smithy_runtime_api::shared::IntoShared;
|
231 223 | use aws_smithy_types::retry::RetryConfig;
|
232 224 | use aws_smithy_types::timeout::TimeoutConfig;
|
233 225 | use aws_types::app_name::AppName;
|
234 226 | use aws_types::docs_for;
|
235 227 | use aws_types::origin::Origin;
|
236 228 | use aws_types::os_shim_internal::{Env, Fs};
|
237 229 | use aws_types::sdk_config::SharedHttpClient;
|
238 230 | use aws_types::SdkConfig;
|
239 231 |
|
240 232 | use crate::default_provider::{
|
241 233 | app_name, credentials, disable_request_compression, endpoint_url,
|