Unverified Commit c6143ec5 authored by Russell Cohen's avatar Russell Cohen Committed by GitHub
Browse files

Minimal Support for Shared Config Loading (#675)



* create an AWS config module

This commit adds a new AWS config module. It only currently supports region resolution. A follow up commit will remove `ProvideRegion` from AWS types.

* create aws-config

This commit introduces `aws-config`, the configuration loader entry point for the SDK. Currently, this adds very little new code, instead, it migrates code from `aws_types` into the shared-config package.

* Update Examples to use shared-config

* Fix KMS IT

* Fix cargo docs

* Fix clippy

* Clarify doc comment on EnvLoader

* Clarify region chain impl, add tests

* Update CHANGELOG.md

Co-authored-by: default avatarJohn DiSanti <jdisanti@amazon.com>

* Delete dead module

* CR feedback

* Add more docs to aws-config

Co-authored-by: default avatarJohn DiSanti <jdisanti@amazon.com>
parent b2187deb
Loading
Loading
Loading
Loading
+23 −2
Original line number Diff line number Diff line
vNext (Month Day, Year)
-----------------------
**Breaking Changes**
- `<sevicename>::from_env()` has been removed (#675). A drop-in replacement is available:
  1. Add a dependency on `aws-config`:
     ```toml
     [dependencies]
     aws-config = { git = "https://github.com/awslabs/aws-sdk-rust", tag = "v0.0.17-alpha" }
     ```
  2. Update your client creation code:
     ```rust
     let client = <service>>::Client::new(&aws_config::load_from_env().await)
     ```

- `ProvideRegion` has been moved to `aws_config::meta::region::ProvideRegion`. (#675)
- `aws_types::region::ChainProvider` has been moved to `aws_config::meta::region::RegionProviderChain` (#675).
- `ProvideRegion` is now asynchronous. Code that called `provider.region()` must be changed to `provider.region().await`.
- `<awsservice>::Config::from_env()` is now also asynchronous because it must load a region
- `<awsservice>::Config::builder()` will **not** load a default region unspecified. A region must be specified directly.
- `<awsservice>::Config::builder()` will **not** load a default region. To preserve previous behavior:
  1. Add a dependency on `aws-config`:
     ```toml
     [dependencies]
     aws-config = { git = "https://github.com/awslabs/aws-sdk-rust", tag = "v0.0.17-alpha" }
     ```
  2. ```rust
     let shared_config = aws_config::load_from_env().await;
     let config = <service>::config::Builder::from(&shared_config).<other builder modifications>.build();
     ```
- `Request` and `Response` in `smithy_http::operation` now use `SharedPropertyBag` instead of `Arc<Mutex<PropertyBag>>`. Use the `acquire` and `acquire_mut` methods to get a reference to the underlying `PropertyBag` to access properties. (#667)

**New this week**
+1 −1
Original line number Diff line number Diff line
@@ -13,4 +13,4 @@ members = [
    "aws-sigv4"
]

exclude = ["aws-auth-providers"]
exclude = ["aws-auth-providers", "aws-config"]
+1 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ default = ["rustls", "rt-tokio"]

[dependencies]
aws-auth = { path = "../../sdk/build/aws-sdk/aws-auth" }
aws-config = { path = "../../sdk/build/aws-sdk/aws-config"}
aws-types = { path = "../../sdk/build/aws-sdk/aws-types" }
aws-sdk-sts = { path = "../../sdk/build/aws-sdk/sts"}
aws-hyper = { path = "../../sdk/build/aws-sdk/aws-hyper"}
+4 −2
Original line number Diff line number Diff line
@@ -50,8 +50,10 @@ fn default_connector() -> Option<DynConnector> {
/// This provider chain will use defaults for all settings. The region will be resolved with the default
/// provider chain. To construct a custom provider, use [`default_provider_chain::Builder`](default_provider_chain::Builder).
pub async fn default_provider() -> impl AsyncProvideCredentials {
    use aws_types::region::ProvideRegion;
    let resolved_region = aws_types::region::default_provider().region().await;
    use aws_config::meta::region::ProvideRegion;
    let resolved_region = aws_config::default_provider::region::default_provider()
        .region()
        .await;
    let mut builder = default_provider_chain::Builder::default();
    builder.set_region(resolved_region);
    builder.build()
+1 −1
Original line number Diff line number Diff line
@@ -29,11 +29,11 @@ use std::sync::Arc;

use aws_auth::provider::env::EnvironmentVariableCredentialsProvider;
use aws_auth::provider::{AsyncProvideCredentials, BoxFuture, CredentialsError, CredentialsResult};
use aws_config::meta::region::ProvideRegion;
use aws_hyper::DynConnector;
use aws_sdk_sts::Region;
use aws_types::os_shim_internal::{Env, Fs};
use aws_types::profile::ProfileParseError;
use aws_types::region::ProvideRegion;
use tracing::Instrument;

use crate::must_have_connector;
Loading