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 + | ///
|
148 150 | /// # Examples
|
149 151 | /// ```no_run
|
150 152 | /// # async fn create_config() {
|
151 153 | /// let config = aws_config::from_env().region("us-east-1").load().await;
|
152 154 | /// # }
|
153 155 | /// ```
|
154 156 | #[cfg(feature = "behavior-version-latest")]
|
155 157 | pub fn from_env() -> ConfigLoader {
|
156 158 | ConfigLoader::default().behavior_version(BehaviorVersion::latest())
|
157 159 | }
|
158 160 |
|
159 161 | /// Load default configuration with the _latest_ defaults.
|
160 162 | ///
|
161 163 | /// 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).
|
162 166 | #[cfg(feature = "behavior-version-latest")]
|
163 167 | pub async fn load_from_env() -> SdkConfig {
|
164 168 | from_env().load().await
|
165 169 | }
|
166 170 |
|
167 171 | /// Create a config loader with the _latest_ defaults.
|
168 172 | #[cfg(not(feature = "behavior-version-latest"))]
|
169 173 | #[deprecated(
|
170 174 | 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."
|
171 175 | )]
|
172 176 | pub fn from_env() -> ConfigLoader {
|
173 177 | ConfigLoader::default().behavior_version(BehaviorVersion::latest())
|
174 178 | }
|
175 179 |
|
176 180 | /// Load default configuration with the _latest_ defaults.
|
177 181 | #[cfg(not(feature = "behavior-version-latest"))]
|
178 182 | #[deprecated(
|
179 183 | 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."
|
180 184 | )]
|
181 185 | pub async fn load_from_env() -> SdkConfig {
|
182 186 | load_defaults(BehaviorVersion::latest()).await
|
183 187 | }
|
184 188 |
|
185 189 | /// Create a config loader with the defaults for the given behavior version.
|
186 190 | ///
|
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 + | ///
|
187 193 | /// # Examples
|
188 194 | /// ```no_run
|
189 195 | /// # async fn create_config() {
|
190 196 | /// use aws_config::BehaviorVersion;
|
191 197 | /// let config = aws_config::defaults(BehaviorVersion::v2023_11_09())
|
192 198 | /// .region("us-east-1")
|
193 199 | /// .load()
|
194 200 | /// .await;
|
195 201 | /// # }
|
196 202 | /// ```
|
197 203 | pub fn defaults(version: BehaviorVersion) -> ConfigLoader {
|
198 204 | ConfigLoader::default().behavior_version(version)
|
199 205 | }
|
200 206 |
|
201 207 | /// Load default configuration with the given behavior version.
|
202 208 | ///
|
203 209 | /// 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).
|
204 212 | pub async fn load_defaults(version: BehaviorVersion) -> SdkConfig {
|
205 213 | defaults(version).load().await
|
206 214 | }
|
207 215 |
|
208 216 | mod loader {
|
209 217 | use crate::env_service_config::EnvServiceConfig;
|
210 218 | use aws_credential_types::provider::{
|
211 219 | token::{ProvideToken, SharedTokenProvider},
|
212 220 | ProvideCredentials, SharedCredentialsProvider,
|
213 221 | };
|
214 222 | use aws_credential_types::Credentials;
|
215 223 | use aws_smithy_async::rt::sleep::{default_async_sleep, AsyncSleep, SharedAsyncSleep};
|
216 224 | use aws_smithy_async::time::{SharedTimeSource, TimeSource};
|
217 225 | use aws_smithy_runtime::client::identity::IdentityCache;
|
218 226 | use aws_smithy_runtime_api::client::behavior_version::BehaviorVersion;
|
219 227 | use aws_smithy_runtime_api::client::http::HttpClient;
|
220 228 | use aws_smithy_runtime_api::client::identity::{ResolveCachedIdentity, SharedIdentityCache};
|
221 229 | use aws_smithy_runtime_api::client::stalled_stream_protection::StalledStreamProtectionConfig;
|
222 230 | use aws_smithy_runtime_api::shared::IntoShared;
|
223 231 | use aws_smithy_types::retry::RetryConfig;
|
224 232 | use aws_smithy_types::timeout::TimeoutConfig;
|
225 233 | use aws_types::app_name::AppName;
|
226 234 | use aws_types::docs_for;
|
227 235 | use aws_types::origin::Origin;
|
228 236 | use aws_types::os_shim_internal::{Env, Fs};
|
229 237 | use aws_types::sdk_config::SharedHttpClient;
|
230 238 | use aws_types::SdkConfig;
|
231 239 |
|
232 240 | use crate::default_provider::{
|
233 241 | app_name, credentials, disable_request_compression, endpoint_url,
|