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